Beginnings of ETA calc based on actual data
Beginnings of ETA calc based on actual data

file:b/.gitmodules (new)
  [submodule "js/flotr2"]
  path = js/flotr2
  url = https://github.com/HumbleSoftware/Flotr2.git
  [submodule "js/FlashCanvas"]
  path = js/FlashCanvas
  url = https://github.com/timcameronryan/FlashCanvas
  [submodule "lib/amon-php"]
  path = lib/amon-php
  url = https://github.com/martinrusev/amon-php.git
  [submodule "js/yepnope"]
  path = js/yepnope
  url = https://github.com/SlexAxton/yepnope.js.git
  [submodule "javascripts/tesseract"]
  path = javascripts/tesseract
  url = https://github.com/square/tesseract.git
  [submodule "javascripts/d3"]
  path = javascripts/d3
  url = https://github.com/mbostock/d3.git
file:a/about.php -> file:b/about.php
<?php <?php
/* /*
* Copyright 2010,2011 Alexander Sadleir * Copyright 2010,2011 Alexander Sadleir
   
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
   
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
include ('include/common.inc.php'); include ('include/common.inc.php');
include_header("About", "about") include_header("About", "about")
?> ?>
<p> <p>
Busness Time - An ACT bus timetable webapp<br /> Busness Time - An ACT bus timetable webapp<br />
Based on the maxious-canberra-transit-feed (<a Based on the maxious-canberra-transit-feed (<a
href="http://s3-ap-southeast-1.amazonaws.com/busresources/cbrfeed.zip">download</a>, href="http://busresources.lambdacomplex.org/cbrfeed.zip">download</a>,
last updated <?php echo date("F d Y.", @filemtime('cbrfeed.zip')); ?>)<br /> last updated <?php echo date("F d Y.", @filemtime('../busresources/cbrfeed.zip')); ?>)<br />
Source code for the <a Source code for the <a
href="https://github.com/maxious/ACTBus-data">transit href="https://github.com/maxious/ACTBus-data">transit
feed</a> and <a href="https://github.com/maxious/ACTBus-ui">this feed</a> and <a href="https://github.com/maxious/ACTBus-ui">this
site</a> available from github.<br /> site</a> available from github.<br />
Uses jQuery Mobile, PHP, PostgreSQL, OpenTripPlanner, OpenLayers, OpenStreetMap, Cloudmade Geocoder and Tile Service<br /> Uses jQuery Mobile, PHP, PostgreSQL, OpenTripPlanner, OpenLayers, OpenStreetMap, Cloudmade Geocoder and Tile Service<br />
Suburb Geocoding Based on <A href="http://www.abs.gov.au/AUSSTATS/abs@.nsf/Lookup/1270.0.55.003Main+Features1July%202011?OpenDocument">Australian Bureau of Statistics data.</a><br /> Suburb Geocoding Based on <A href="http://www.abs.gov.au/AUSSTATS/abs@.nsf/Lookup/1270.0.55.003Main+Features1July%202011?OpenDocument">Australian Bureau of Statistics data.</a><br />
Street geocoding based on work by OpenStreetMap contributors<br> Street geocoding based on work by OpenStreetMap contributors<br>
<br /> <br />
Feedback encouraged; contact maxious@lambdacomplex.org<br /> Feedback encouraged; contact maxious@lambdacomplex.org<br />
<br /> <br />
Some icons by Joseph Wain / glyphish.com<br /> Some icons by Joseph Wain / glyphish.com<br />
Native clients also available for iPhone(<a href="http://itunes.apple.com/au/app/cbrtimetable/id444287349?mt=8">cbrTimetable by Sandor Kolotenko</a> Native clients also available for iPhone(<a href="http://itunes.apple.com/au/app/cbrtimetable/id444287349?mt=8">cbrTimetable by Sandor Kolotenko</a>
, <a href="http://itunes.apple.com/au/app/act-buses/id376634797?mt=8">ACT Buses by David Sullivan</a>) , <a href="http://itunes.apple.com/au/app/act-buses/id376634797?mt=8">ACT Buses by David Sullivan</a>, <a href="http://itunes.apple.com/app/bus-trips-act/id489146525?mt=8">Bus Trips ACT by Molson Chengalath</a>)
, Android (<a href="https://market.android.com/details?id=com.action">MyBus 2.0 by Imagine Team</a>) , Android (<a href="https://market.android.com/details?id=com.action">MyBus 2.0 by Imagine Team</a>, <A href="https://market.android.com/details?id=GetMe2CanberraFree.source">GetMe2 Canberra by
and Windows Phone 7 (<a href="http://www.windowsphone.com/en-AU/apps/d840375e-429c-4aa4-a358-80eec6ea9e66">TransHub Canberra by Soul Solutions</a>) Colin Thompson </a>, <a href="https://market.android.com/details?id=au.com.transittimes.android">TransitTimes+ by Zervaas Enterprises</a>)
  and Windows Phone 7 (<a href="http://www.windowsphone.com/en-AU/apps/d840375e-429c-4aa4-a358-80eec6ea9e66">TransHub Canberra by Soul Solutions</a>) Other web clients include <a href="http://canberra.itranzit.com/option.html">iTranzit</a>.
<br /> <br />
GTFS-realtime API: GTFS-realtime API:
Alerts and Trip Updates (but only Cancelled or Stop Skipped) Alerts and Trip Updates (but only Cancelled or Stop Skipped)
Default format binary Protocol Buffer but can get JSON by adding ?ascii=yes Default format binary Protocol Buffer but can get JSON by adding ?ascii=yes
<br /> <br />
<br /> <br />
<small>Disclaimer: The content of this website is of a general and informative nature. Please check with printed timetables or those available on http://action.act.gov.au before your trip. <small>Disclaimer: The content of this website is of a general and informative nature. Please check with printed timetables or those available on http://action.act.gov.au before your trip.
Whilst every effort has been made to ensure the high quality and accuracy of the Site, the Author makes no warranty, Whilst every effort has been made to ensure the high quality and accuracy of the Site, the Author makes no warranty,
express or implied concerning the topicality, correctness, completeness or quality of the information, which is provided express or implied concerning the topicality, correctness, completeness or quality of the information, which is provided
"as is". The Author expressly disclaims all warranties, including but not limited to warranties of fitness for a particular purpose and warranties of merchantability. "as is". The Author expressly disclaims all warranties, including but not limited to warranties of fitness for a particular purpose and warranties of merchantability.
All offers are not binding and without obligation. The Author expressly reserves the right, in his discretion, to suspend, All offers are not binding and without obligation. The Author expressly reserves the right, in his discretion, to suspend,
change, modify, add or remove portions of the Site and to restrict or terminate the use and accessibility of the Site change, modify, add or remove portions of the Site and to restrict or terminate the use and accessibility of the Site
without prior notice. </small> without prior notice. </small>
<?php <?php
include_footer(); include_footer();
?> ?>
   
file:a/aws/awsStartup.sh (deleted)
#!/bin/bash  
#this script should be run from a fresh git checkout from github  
#ami base must have yum install lighttpd-fastcgi, git, tomcat6  
#php-cli php-gd tomcat6-webapps tomcat6-admin-webapps svn maven2  
#postgres postgres-server php-pg  
#http://www.how2forge.org/installing-lighttpd-with-php5-and-mysql-support-on-fedora-12  
 
sh busuiphp.sh  
sh busuidb.sh  
sh busuiotp.sh  
 
 
 
file:a/aws/busuidb.sh (deleted)
createdb transitdata  
createlang -d transitdata plpgsql  
psql -d transitdata -f /var/www/lib/postgis.sql  
# curl https://github.com/maxious/ACTBus-ui/raw/master/transitdata.cbrfeed.sql.gz -o transitdata.cbrfeed.sql.gz  
#made with pg_dump transitdata | gzip -c > transitdata.cbrfeed.sql.gz  
gunzip /var/www/transitdata.cbrfeed.sql.gz  
psql -d transitdata -f /var/www/transitdata.cbrfeed.sql  
#createuser transitdata -SDRP  
#password transitdata  
#psql -d transitdata -c "GRANT SELECT ON TABLE agency,calendar,calendar_dates,routes,stop_times,stops,trips TO transitdata;"  
#psql -d transitdata -c "GRANT SELECT,INSERT ON TABLE myway_observations,myway_routes,myway_stops,myway_timingdeltas TO transitdata;"  
#psql -d transitdata -c "GRANT SELECT,INSERT,UPDATE ON TABLE myway_routes,myway_stops TO transitdata;"  
##psql -d transitdata -c "GRANT SELECT ON ALL TABLES IN SCHEMA public TO transitdata;"  
php /var/www/updatedb.php  
file:a/aws/busuiotp.sh (deleted)
wget http://s3-ap-southeast-1.amazonaws.com/busresources/Graph.obj \  
-O /tmp/Graph.obj  
/etc/init.d/tomcat6 stop  
rm -rfv /usr/share/tomcat6/webapps/opentripplanner*  
wget http://s3-ap-southeast-1.amazonaws.com/busresources/opentripplanner-webapp.war \  
-O /usr/share/tomcat6/webapps/opentripplanner-webapp.war  
wget http://s3-ap-southeast-1.amazonaws.com/busresources/opentripplanner-api-webapp.war \  
-O /usr/share/tomcat6/webapps/opentripplanner-api-webapp.war  
/etc/init.d/tomcat6 restart  
 
file:a/aws/busuiotp.testing.sh (deleted)
wget http://s3-ap-southeast-1.amazonaws.com/busresources/testing/Graph.obj \  
-O /tmp/Graph.obj  
/etc/init.d/tomcat6 stop  
rm -rfv /usr/share/tomcat6/webapps/opentripplanner*  
wget http://s3-ap-southeast-1.amazonaws.com/busresources/testing/opentripplanner-webapp.war \  
-O /usr/share/tomcat6/webapps/opentripplanner-webapp.war  
wget http://s3-ap-southeast-1.amazonaws.com/busresources/testing/opentripplanner-api-webapp.war \  
-O /usr/share/tomcat6/webapps/opentripplanner-api-webapp.war  
/etc/init.d/tomcat6 restart  
 
file:a/aws/busuiphp.sh (deleted)
cp /root/aws.php /tmp/  
chmod 777 /var/cache/lighttpd/compress/  
 
chcon -h system_u:object_r:httpd_sys_content_t /var/www  
chcon -R -h root:object_r:httpd_sys_content_t /var/www/*  
 
chcon -R -t httpd_sys_content_rw_t /var/www/labs/tiles  
chmod -R 777 /var/www/labs/tiles  
 
wget http://s3-ap-southeast-1.amazonaws.com/busresources/cbrfeed.zip \  
-O /var/www/cbrfeed.zip  
 
file:a/aws/compress.conf (deleted)
#######################################################################  
##  
## Output Compression  
## --------------------  
##  
## see http://www.lighttpd.net/documentation/compress.html  
##  
server.modules += ( "mod_compress" )  
 
##  
## where should the compressed files be cached?  
## see the base config for the declaration of the variable.  
##  
## This directory should be changed per vhost otherwise you can  
## run into trouble with overlapping filenames  
##  
compress.cache-dir = cache_dir + "/compress"  
 
##  
## FileTypes to compress.  
##  
#compress.filetype = ("text/plain", "text/html")  
compress.filetype = ("text/plain", "text/html", "text/javascript", "text/css", "text/xml")  
 
##  
## Maximum filesize that will be compressed.  
## Default is 0, which means unlimited file size.  
##  
#compress.max-filesize = 0  
 
##  
#######################################################################  
 
file:a/aws/data-sources.xml (deleted)
<?xml version="1.0" encoding="UTF-8"?>  
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">  
 
<!-- Single graph -->  
<import resource="classpath:org/opentripplanner/api/application-context.xml" />  
 
<bean id="graphBundle" class="org.opentripplanner.model.GraphBundle">  
<property name="path" value="/tmp/" />  
</bean>  
 
</beans>  
 
file:a/aws/expire.conf (deleted)
#######################################################################  
##  
## Expire Module  
## ---------------  
##  
## See http://www.lighttpd.net/documentation/expire.html  
##  
server.modules += ( "mod_expire" )  
 
##  
## assignes a expiration to all files below the specified path. The  
## specification of the time is made up of:  
##  
## <access|modification> <number> <years|months|days|hours|minutes|seconds>  
##  
#expire.url = (  
# "/buggy/" => "access 2 hours",  
# "/images/" => "access plus 1 seconds 2 minutes"  
#)  
etag.use-mtime = "enable"  
etag.use-inode = "disable"  
static-file.etags = "enable"  
$HTTP["url"] =~ "\.(css|js|png|jpg|ico|gif)$" {  
expire.url = ( "" => "access 7 days" )  
}  
 
##  
#######################################################################  
 
file:a/aws/fastcgi.conf (deleted)
#######################################################################  
##  
## FastCGI Module  
## ---------------  
##  
## http://www.lighttpd.net/documentation/fastcgi.html  
##  
server.modules += ( "mod_fastcgi" )  
fastcgi.server = ( ".php" =>  
( "localhost" =>  
(  
"socket" =>  
"/var/run/lighttpd/php-fastcgi.socket",  
"bin-path" => "/usr/bin/php-cgi"  
)  
)  
)  
##  
## PHP Example  
## For PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini.  
##  
## The number of php processes you will get can be easily calculated:  
##  
## num-procs = max-procs * ( 1 + PHP_FCGI_CHILDREN )  
##  
## for the php-num-procs example it means you will get 17*5 = 85 php  
## processes. you always should need this high number for your very  
## busy sites. And if you have a lot of RAM. :)  
##  
#fastcgi.server = ( ".php" =>  
# ( "php-local" =>  
# (  
# "socket" => socket_dir + "/php-fastcgi-1.socket",  
# "bin-path" => server_root + "/php-cgi",  
# "max-procs" => 1,  
# "broken-scriptfilename" => "enable",  
# )  
# ),  
# ( "php-tcp" =>  
# (  
# "host" => "127.0.0.1",  
# "port" => 9999,  
# "check-local" => "disable",  
# "broken-scriptfilename" => "enable",  
# )  
# ),  
#  
# ( "php-num-procs" =>  
# (  
# "socket" => socket_dir + "/php-fastcgi-2.socket",  
# "bin-path" => server_root + "/php-cgi",  
# "bin-environment" => (  
# "PHP_FCGI_CHILDREN" => "16",  
# "PHP_FCGI_MAX_REQUESTS" => "10000",  
# ),  
# "max-procs" => 5,  
# "broken-scriptfilename" => "enable",  
# )  
# ),  
# )  
 
##  
## Ruby on Rails Example  
##  
## Normally you only run one Rails application on one vhost.  
##  
#$HTTP["host"] == "rails1.example.com" {  
# server.document-root = server_root + "/rails/someapp/public"  
# server.error-handler-404 = "/dispatch.fcgi"  
# fastcgi.server = ( ".fcgi" =>  
# ("someapp" =>  
# ( "socket" => socket_dir + "/someapp-fcgi.socket",  
# "bin-path" => server_root + "/rails/someapp/public/dispatch.fcgi",  
# "bin-environment" => (  
# "RAILS_ENV" => "production",  
# "TMP" => home_dir + "/rails/someapp",  
# ),  
# )  
# )  
# )  
#}  
 
##  
## Another example with multiple rails applications on one vhost.  
##  
## http://blog.lighttpd.net/articles/2005/11/23/lighttpd-1-4-8-and-multiple-rails-apps  
##  
#$HTTP["host"] == "rails2.example.com" {  
# $HTTP["url"] =~ "^/someapp1" {  
# server.document-root = server_root + "/rails/someapp1/public"  
# server.error-handler-404 = "/dispatch.fcgi"  
# fastcgi.server = ( ".fcgi" =>  
# ("someapp1" =>  
# ( "socket" => socket_dir + "/someapp1-fcgi.socket",  
# "bin-path" => server_root + "/rails/someapp1/public/dispatch.fcgi",  
# "bin-environment" => (  
# "RAILS_ENV" => "production",  
# "TMP" => home_dir + "/rails/someapp1",  
# ),  
# "strip-request-uri" => "/someapp1/"  
# )  
# )  
# )  
# }  
#  
# $HTTP["url"] =~ "^/someapp2" {  
# server.document-root = server_root + "/rails/someapp2/public"  
# server.error-handler-404 = "/dispatch.fcgi"  
# fastcgi.server = ( ".fcgi" =>  
# ("someapp2" =>  
# ( "socket" => socket_dir + "/someapp2-fcgi.socket",  
# "bin-path" => server_root + "/rails/someapp2/public/dispatch.fcgi",  
# "bin-environment" => (  
# "RAILS_ENV" => "production",  
# "TMP" => home_dir + "/rails/someapp2",  
# ),  
# "strip-request-uri" => "/someapp2/"  
# )  
# )  
# )  
# }  
#}  
 
## chrooted webserver + external PHP  
##  
## $ spawn-fcgi -f /usr/bin/php-cgi -p 2000 -a 127.0.0.1 -C 8  
##  
## webserver chrooted to /srv/www/  
## php running outside the chroot  
#  
#fastcgi.server = (  
# ".php" => ((  
# "host" => "127.0.0.1",  
# "port" => "2000",  
# "docroot" => "/srv/www/servers/www.example.org/htdocs/"  
# )))  
#  
#server.chroot = "/srv/www"  
#server.document-root = "/servers/wwww.example.org/htdocs/"  
#  
 
##  
#######################################################################  
 
file:a/aws/modules.conf (deleted)
#######################################################################  
##  
## Modules to load  
## -----------------  
##  
## at least mod_access and mod_accesslog should be loaded  
## all other module should only be loaded if really neccesary  
##  
## - saves some time  
## - saves memory  
##  
## the default module set contains:  
##  
## "mod_indexfile", "mod_dirlisting", "mod_staticfile"  
##  
## you dont have to include those modules in your list  
##  
## Modules, which are pulled in via conf.d/*.conf  
##  
## NOTE: the order of modules is important.  
##  
## - mod_accesslog -> conf.d/access_log.conf  
## - mod_compress -> conf.d/compress.conf  
## - mod_status -> conf.d/status.conf  
## - mod_webdav -> conf.d/webdav.conf  
## - mod_cml -> conf.d/cml.conf  
## - mod_evhost -> conf.d/evhost.conf  
## - mod_simple_vhost -> conf.d/simple_vhost.conf  
## - mod_mysql_vhost -> conf.d/mysql_vhost.conf  
## - mod_trigger_b4_dl -> conf.d/trigger_b4_dl.conf  
## - mod_userdir -> conf.d/userdir.conf  
## - mod_rrdtool -> conf.d/rrdtool.conf  
## - mod_ssi -> conf.d/ssi.conf  
## - mod_cgi -> conf.d/cgi.conf  
## - mod_scgi -> conf.d/scgi.conf  
## - mod_fastcgi -> conf.d/fastcgi.conf  
## - mod_proxy -> conf.d/proxy.conf  
## - mod_secdownload -> conf.d/secdownload.conf  
## - mod_expire -> conf.d/expire.conf  
##  
 
server.modules = (  
"mod_access",  
# "mod_alias",  
# "mod_auth",  
# "mod_evasive",  
# "mod_redirect",  
# "mod_rewrite",  
# "mod_setenv",  
# "mod_usertrack",  
)  
 
##  
#######################################################################  
 
#######################################################################  
##  
## Config for various Modules  
##  
 
##  
## mod_ssi  
##  
#include "conf.d/ssi.conf"  
 
##  
## mod_status  
##  
#include "conf.d/status.conf"  
 
##  
## mod_webdav  
##  
#include "conf.d/webdav.conf"  
 
##  
## mod_compress  
##  
include "conf.d/compress.conf"  
 
##  
## mod_userdir  
##  
#include "conf.d/userdir.conf"  
 
##  
## mod_magnet  
##  
#include "conf.d/magnet.conf"  
 
##  
## mod_cml  
##  
#include "conf.d/cml.conf"  
 
##  
## mod_rrdtool  
##  
#include "conf.d/rrdtool.conf"  
 
##  
## mod_proxy  
##  
#include "conf.d/proxy.conf"  
 
##  
## mod_expire  
##  
include "conf.d/expire.conf"  
 
##  
## mod_secdownload  
##  
#include "conf.d/secdownload.conf"  
 
##  
#######################################################################  
 
#######################################################################  
##  
## CGI modules  
##  
 
##  
## SCGI (mod_scgi)  
##  
#include "conf.d/scgi.conf"  
 
##  
## FastCGI (mod_fastcgi)  
##  
include "conf.d/fastcgi.conf"  
 
##  
## plain old CGI (mod_cgi)  
##  
#include "conf.d/cgi.conf"  
 
##  
#######################################################################  
 
#######################################################################  
##  
## VHost Modules  
##  
## Only load ONE of them!  
## ========================  
##  
 
##  
## You can use conditionals for vhosts aswell.  
##  
## see http://www.lighttpd.net/documentation/configuration.html  
##  
 
##  
## mod_evhost  
##  
#include "conf.d/evhost.conf"  
 
##  
## mod_simple_vhost  
##  
#include "conf.d/simple_vhost.conf"  
 
##  
## mod_mysql_vhost  
##  
#include "conf.d/mysql_vhost.conf"  
 
##  
#######################################################################  
 
file:a/aws/pg_hba.conf (deleted)
# PostgreSQL Client Authentication Configuration File  
# ===================================================  
#  
# Refer to the "Client Authentication" section in the  
# PostgreSQL documentation for a complete description  
# of this file. A short synopsis follows.  
#  
# This file controls: which hosts are allowed to connect, how clients  
# are authenticated, which PostgreSQL user names they can use, which  
# databases they can access. Records take one of these forms:  
#  
# local DATABASE USER METHOD [OPTIONS]  
# host DATABASE USER CIDR-ADDRESS METHOD [OPTIONS]  
# hostssl DATABASE USER CIDR-ADDRESS METHOD [OPTIONS]  
# hostnossl DATABASE USER CIDR-ADDRESS METHOD [OPTIONS]  
#  
# (The uppercase items must be replaced by actual values.)  
#  
# The first field is the connection type: "local" is a Unix-domain socket,  
# "host" is either a plain or SSL-encrypted TCP/IP socket, "hostssl" is an  
# SSL-encrypted TCP/IP socket, and "hostnossl" is a plain TCP/IP socket.  
#  
# DATABASE can be "all", "sameuser", "samerole", a database name, or  
# a comma-separated list thereof.  
#  
# USER can be "all", a user name, a group name prefixed with "+", or  
# a comma-separated list thereof. In both the DATABASE and USER fields  
# you can also write a file name prefixed with "@" to include names from  
# a separate file.  
#  
# CIDR-ADDRESS specifies the set of hosts the record matches.  
# It is made up of an IP address and a CIDR mask that is an integer  
# (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that specifies  
# the number of significant bits in the mask. Alternatively, you can write  
# an IP address and netmask in separate columns to specify the set of hosts.  
#  
# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi", "krb5",  
# "ident", "pam", "ldap" or "cert". Note that "password" sends passwords  
# in clear text; "md5" is preferred since it sends encrypted passwords.  
#  
# OPTIONS are a set of options for the authentication in the format  
# NAME=VALUE. The available options depend on the different authentication  
# methods - refer to the "Client Authentication" section in the documentation  
# for a list of which options are available for which authentication methods.  
#  
# Database and user names containing spaces, commas, quotes and other special  
# characters must be quoted. Quoting one of the keywords "all", "sameuser" or  
# "samerole" makes the name lose its special character, and just match a  
# database or username with that name.  
#  
# This file is read on server startup and when the postmaster receives  
# a SIGHUP signal. If you edit the file on a running system, you have  
# to SIGHUP the postmaster for the changes to take effect. You can use  
# "pg_ctl reload" to do that.  
 
# Put your actual configuration here  
# ----------------------------------  
#  
# If you want to allow non-local connections, you need to add more  
# "host" records. In that case you will also need to make PostgreSQL listen  
# on a non-local interface via the listen_addresses configuration parameter,  
# or via the -i or -h command line switches.  
#  
 
 
 
# TYPE DATABASE USER CIDR-ADDRESS METHOD  
 
# "local" is for Unix domain socket connections only  
local all all trust  
# IPv4 local connections:  
host all all 127.0.0.1/32 trust  
# IPv6 local connections:  
host all all ::1/128 trust  
#Allow any IP to connect, with a password:  
host all all 0.0.0.0 0.0.0.0 md5  
 
file:a/aws/php.ini (deleted)
[PHP]  
 
date.timezone = "Australia/Sydney"  
 
;;;;;;;;;;;;;;;;;;;  
; About php.ini ;  
;;;;;;;;;;;;;;;;;;;  
; PHP's initialization file, generally called php.ini, is responsible for  
; configuring many of the aspects of PHP's behavior.  
 
; PHP attempts to find and load this configuration from a number of locations.  
; The following is a summary of its search order:  
; 1. SAPI module specific location.  
; 2. The PHPRC environment variable. (As of PHP 5.2.0)  
; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0)  
; 4. Current working directory (except CLI)  
; 5. The web server's directory (for SAPI modules), or directory of PHP  
; (otherwise in Windows)  
; 6. The directory from the --with-config-file-path compile time option, or the  
; Windows directory (C:\windows or C:\winnt)  
; See the PHP docs for more specific information.  
; http://www.php.net/manual/en/configuration.file.php  
 
; The syntax of the file is extremely simple. Whitespace and Lines  
; beginning with a semicolon are silently ignored (as you probably guessed).  
; Section headers (e.g. [Foo]) are also silently ignored, even though  
; they might mean something in the future.  
 
; Directives following the section heading [PATH=/www/mysite] only  
; apply to PHP files in the /www/mysite directory. Directives  
; following the section heading [HOST=www.example.com] only apply to  
; PHP files served from www.example.com. Directives set in these  
; special sections cannot be overridden by user-defined INI files or  
; at runtime. Currently, [PATH=] and [HOST=] sections only work under  
; CGI/FastCGI.  
; http://www.php.net/manual/en/ini.sections.php  
 
; Directives are specified using the following syntax:  
; directive = value  
; Directive names are *case sensitive* - foo=bar is different from FOO=bar.  
; Directives are variables used to configure PHP or PHP extensions.  
; There is no name validation. If PHP can't find an expected  
; directive because it is not set or is mistyped, a default value will be used.  
 
; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one  
; of the INI constants (On, Off, True, False, Yes, No and None) or an expression  
; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a  
; previously set variable or directive (e.g. ${foo})  
 
; Expressions in the INI file are limited to bitwise operators and parentheses:  
; | bitwise OR  
; ^ bitwise XOR  
; & bitwise AND  
; ~ bitwise NOT  
; ! boolean NOT  
 
; Boolean flags can be turned on using the values 1, On, True or Yes.  
; They can be turned off using the values 0, Off, False or No.  
 
; An empty string can be denoted by simply not writing anything after the equal  
; sign, or by using the None keyword:  
 
; foo = ; sets foo to an empty string  
; foo = None ; sets foo to an empty string  
; foo = "None" ; sets foo to the string 'None'  
 
; If you use constants in your value, and these constants belong to a  
; dynamically loaded extension (either a PHP extension or a Zend extension),  
; you may only use these constants *after* the line that loads the extension.  
 
;;;;;;;;;;;;;;;;;;;  
; About this file ;  
;;;;;;;;;;;;;;;;;;;  
; PHP comes packaged with two INI files. One that is recommended to be used  
; in production environments and one that is recommended to be used in  
; development environments.  
 
; php.ini-production contains settings which hold security, performance and  
; best practices at its core. But please be aware, these settings may break  
; compatibility with older or less security conscience applications. We  
; recommending using the production ini in production and testing environments.  
 
; php.ini-development is very similar to its production variant, except it's  
; much more verbose when it comes to errors. We recommending using the  
; development version only in development environments as errors shown to  
; application users can inadvertently leak otherwise secure information.  
 
; This 2 files are provided, by RPM, in /usr/share/doc/php-common-*/  
; File used by RPM (the /etc/php.ini) is mainly the php.ini-production  
 
;;;;;;;;;;;;;;;;;;;  
; Quick Reference ;  
;;;;;;;;;;;;;;;;;;;  
; The following are all the settings which are different in either the production  
; or development versions of the INIs with respect to PHP's default behavior.  
; Please see the actual settings later in the document for more details as to why  
; we recommend these changes in PHP's behavior.  
 
; allow_call_time_pass_reference  
; Default Value: On  
; Development Value: Off  
; Production Value: Off  
 
; display_errors  
; Default Value: On  
; Development Value: On  
; Production Value: Off  
 
; display_startup_errors  
; Default Value: Off  
; Development Value: On  
; Production Value: Off  
 
; error_reporting  
; Default Value: E_ALL & ~E_NOTICE  
; Development Value: E_ALL | E_STRICT  
; Production Value: E_ALL & ~E_DEPRECATED  
 
; html_errors  
; Default Value: On  
; Development Value: On  
; Production value: Off  
 
; log_errors  
; Default Value: Off  
; Development Value: On  
; Production Value: On  
 
; magic_quotes_gpc  
; Default Value: On  
; Development Value: Off  
; Production Value: Off  
 
; max_input_time  
; Default Value: -1 (Unlimited)  
; Development Value: 60 (60 seconds)  
; Production Value: 60 (60 seconds)  
 
; output_buffering  
; Default Value: Off  
; Development Value: 4096  
; Production Value: 4096  
 
; register_argc_argv  
; Default Value: On  
; Development Value: Off  
; Production Value: Off  
 
; register_long_arrays  
; Default Value: On  
; Development Value: Off  
; Production Value: Off  
 
; request_order  
; Default Value: None  
; Development Value: "GP"  
; Production Value: "GP"  
 
; session.bug_compat_42  
; Default Value: On  
; Development Value: On  
; Production Value: Off  
 
; session.bug_compat_warn  
; Default Value: On  
; Development Value: On  
; Production Value: Off  
 
; session.gc_divisor  
; Default Value: 100  
; Development Value: 1000  
; Production Value: 1000  
 
; session.hash_bits_per_character  
; Default Value: 4  
; Development Value: 5  
; Production Value: 5  
 
; short_open_tag  
; Default Value: On  
; Development Value: Off  
; Production Value: Off  
 
; track_errors  
; Default Value: Off  
; Development Value: On  
; Production Value: Off  
 
; url_rewriter.tags  
; Default Value: "a=href,area=href,frame=src,form=,fieldset="  
; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry"  
; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry"  
 
; variables_order  
; Default Value: "EGPCS"  
; Development Value: "GPCS"  
; Production Value: "GPCS"  
 
;;;;;;;;;;;;;;;;;;;;  
; php.ini Options ;  
;;;;;;;;;;;;;;;;;;;;  
; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini"  
;user_ini.filename = ".user.ini"  
 
; To disable this feature set this option to empty value  
;user_ini.filename =  
 
; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes)  
;user_ini.cache_ttl = 300  
 
;;;;;;;;;;;;;;;;;;;;  
; Language Options ;  
;;;;;;;;;;;;;;;;;;;;  
 
; Enable the PHP scripting language engine under Apache.  
; http://www.php.net/manual/en/apache.configuration.php#ini.engine  
engine = On  
 
; This directive determines whether or not PHP will recognize code between  
; <? and ?> tags as PHP source which should be processed as such. It's been  
; recommended for several years that you not use the short tag "short cut" and  
; instead to use the full <?php and ?> tag combination. With the wide spread use  
; of XML and use of these tags by other languages, the server can become easily  
; confused and end up parsing the wrong code in the wrong context. But because  
; this short cut has been a feature for such a long time, it's currently still  
; supported for backwards compatibility, but we recommend you don't use them.  
; Default Value: On  
; Development Value: Off  
; Production Value: Off  
; http://www.php.net/manual/en/ini.core.php#ini.short-open-tag  
short_open_tag = Off  
 
; Allow ASP-style <% %> tags.  
; http://www.php.net/manual/en/ini.core.php#ini.asp-tags  
asp_tags = Off  
 
; The number of significant digits displayed in floating point numbers.  
; http://www.php.net/manual/en/ini.core.php#ini.precision  
precision = 14  
 
; Enforce year 2000 compliance (will cause problems with non-compliant browsers)  
; http://www.php.net/manual/en/ini.core.php#ini.y2k-compliance  
y2k_compliance = On  
 
; Output buffering is a mechanism for controlling how much output data  
; (excluding headers and cookies) PHP should keep internally before pushing that  
; data to the client. If your application's output exceeds this setting, PHP  
; will send that data in chunks of roughly the size you specify.  
; Turning on this setting and managing its maximum buffer size can yield some  
; interesting side-effects depending on your application and web server.  
; You may be able to send headers and cookies after you've already sent output  
; through print or echo. You also may see performance benefits if your server is  
; emitting less packets due to buffered output versus PHP streaming the output  
; as it gets it. On production servers, 4096 bytes is a good setting for performance  
; reasons.  
; Note: Output buffering can also be controlled via Output Buffering Control  
; functions.  
; Possible Values:  
; On = Enabled and buffer is unlimited. (Use with caution)  
; Off = Disabled  
; Integer = Enables the buffer and sets its maximum size in bytes.  
; Default Value: Off  
; Development Value: 4096  
; Production Value: 4096  
; http://www.php.net/manual/en/outcontrol.configuration.php#ini.output-buffering  
output_buffering = 4096  
 
; You can redirect all of the output of your scripts to a function. For  
; example, if you set output_handler to "mb_output_handler", character  
; encoding will be transparently converted to the specified encoding.  
; Setting any output handler automatically turns on output buffering.  
; Note: People who wrote portable scripts should not depend on this ini  
; directive. Instead, explicitly set the output handler using ob_start().  
; Using this ini directive may cause problems unless you know what script  
; is doing.  
; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler"  
; and you cannot use both "ob_gzhandler" and "zlib.output_compression".  
; Note: output_handler must be empty if this is set 'On' !!!!  
; Instead you must use zlib.output_handler.  
; http://www.php.net/manual/en/outcontrol.configuration.php#ini.output-handler  
;output_handler =  
 
; Transparent output compression using the zlib library  
; Valid values for this option are 'off', 'on', or a specific buffer size  
; to be used for compression (default is 4KB)  
; Note: Resulting chunk size may vary due to nature of compression. PHP  
; outputs chunks that are few hundreds bytes each as a result of  
; compression. If you prefer a larger chunk size for better  
; performance, enable output_buffering in addition.  
; Note: You need to use zlib.output_handler instead of the standard  
; output_handler, or otherwise the output will be corrupted.  
; http://www.php.net/manual/en/zlib.configuration.php#ini.zlib.output-compression  
zlib.output_compression = on  
 
; http://www.php.net/manual/en/zlib.configuration.php#ini.zlib.output-compression-level  
;zlib.output_compression_level = -1  
 
; You cannot specify additional output handlers if zlib.output_compression  
; is activated here. This setting does the same as output_handler but in  
; a different order.  
; http://www.php.net/manual/en/zlib.configuration.php#ini.zlib.output-handler  
;zlib.output_handler =  
 
; Implicit flush tells PHP to tell the output layer to flush itself  
; automatically after every output block. This is equivalent to calling the  
; PHP function flush() after each and every call to print() or echo() and each  
; and every HTML block. Turning this option on has serious performance  
; implications and is generally recommended for debugging purposes only.  
; http://www.php.net/manual/en/outcontrol.configuration.php#ini.implicit-flush  
implicit_flush = Off  
 
; The unserialize callback function will be called (with the undefined class'  
; name as parameter), if the unserializer finds an undefined class  
; which should be instantiated. A warning appears if the specified function is  
; not defined, or if the function doesn't include/implement the missing class.  
; So only set this entry, if you really want to implement such a  
; callback-function.  
unserialize_callback_func =  
 
; When floats & doubles are serialized store serialize_precision significant  
; digits after the floating point. The default value ensures that when floats  
; are decoded with unserialize, the data will remain the same.  
serialize_precision = 100  
 
; This directive allows you to enable and disable warnings which PHP will issue  
; if you pass a value by reference at function call time. Passing values by  
; reference at function call time is a deprecated feature which will be removed  
; from PHP at some point in the near future. The acceptable method for passing a  
; value by reference to a function is by declaring the reference in the functions  
; definition, not at call time. This directive does not disable this feature, it  
; only determines whether PHP will warn you about it or not. These warnings  
; should enabled in development environments only.  
; Default Value: On (Suppress warnings)  
; Development Value: Off (Issue warnings)  
; Production Value: Off (Issue warnings)  
; http://www.php.net/manual/en/ini.core.php#ini.allow-call-time-pass-reference  
allow_call_time_pass_reference = Off  
 
; Safe Mode  
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode  
safe_mode = Off  
 
; By default, Safe Mode does a UID compare check when  
; opening files. If you want to relax this to a GID compare,  
; then turn on safe_mode_gid.  
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-gid  
safe_mode_gid = Off  
 
; When safe_mode is on, UID/GID checks are bypassed when  
; including files from this directory and its subdirectories.  
; (directory must also be in include_path or full path must  
; be used when including)  
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-include-dir  
safe_mode_include_dir =  
 
; When safe_mode is on, only executables located in the safe_mode_exec_dir  
; will be allowed to be executed via the exec family of functions.  
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-exec-dir  
safe_mode_exec_dir =  
 
; Setting certain environment variables may be a potential security breach.  
; This directive contains a comma-delimited list of prefixes. In Safe Mode,  
; the user may only alter environment variables whose names begin with the  
; prefixes supplied here. By default, users will only be able to set  
; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR).  
; Note: If this directive is empty, PHP will let the user modify ANY  
; environment variable!  
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-allowed-env-vars  
safe_mode_allowed_env_vars = PHP_  
 
; This directive contains a comma-delimited list of environment variables that  
; the end user won't be able to change using putenv(). These variables will be  
; protected even if safe_mode_allowed_env_vars is set to allow to change them.  
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-protected-env-vars  
safe_mode_protected_env_vars = LD_LIBRARY_PATH  
 
; open_basedir, if set, limits all file operations to the defined directory  
; and below. This directive makes most sense if used in a per-directory  
; or per-virtualhost web server configuration file. This directive is  
; *NOT* affected by whether Safe Mode is turned On or Off.  
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.open-basedir  
;open_basedir =  
 
; This directive allows you to disable certain functions for security reasons.  
; It receives a comma-delimited list of function names. This directive is  
; *NOT* affected by whether Safe Mode is turned On or Off.  
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.disable-functions  
disable_functions =  
 
; This directive allows you to disable certain classes for security reasons.  
; It receives a comma-delimited list of class names. This directive is  
; *NOT* affected by whether Safe Mode is turned On or Off.  
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.disable-classes  
disable_classes =  
 
; Colors for Syntax Highlighting mode. Anything that's acceptable in  
; <span style="color: ???????"> would work.  
; http://www.php.net/manual/en/misc.configuration.php#ini.syntax-highlighting  
;highlight.string = #DD0000  
;highlight.comment = #FF9900  
;highlight.keyword = #007700  
;highlight.bg = #FFFFFF  
;highlight.default = #0000BB  
;highlight.html = #000000  
 
; If enabled, the request will be allowed to complete even if the user aborts  
; the request. Consider enabling it if executing long requests, which may end up  
; being interrupted by the user or a browser timing out. PHP's default behavior  
; is to disable this feature.  
; http://www.php.net/manual/en/misc.configuration.php#ini.ignore-user-abort  
;ignore_user_abort = On  
 
; Determines the size of the realpath cache to be used by PHP. This value should  
; be increased on systems where PHP opens many files to reflect the quantity of  
; the file operations performed.  
; http://www.php.net/manual/en/ini.core.php#ini.realpath-cache-size  
;realpath_cache_size = 16k  
 
; Duration of time, in seconds for which to cache realpath information for a given  
; file or directory. For systems with rarely changing files, consider increasing this  
; value.  
; http://www.php.net/manual/en/ini.core.php#ini.realpath-cache-ttl  
;realpath_cache_ttl = 120  
 
;;;;;;;;;;;;;;;;;  
; Miscellaneous ;  
;;;;;;;;;;;;;;;;;  
 
; Decides whether PHP may expose the fact that it is installed on the server  
; (e.g. by adding its signature to the Web server header). It is no security  
; threat in any way, but it makes it possible to determine whether you use PHP  
; on your server or not.  
; http://www.php.net/manual/en/ini.core.php#ini.expose-php  
expose_php = On  
 
;;;;;;;;;;;;;;;;;;;  
; Resource Limits ;  
;;;;;;;;;;;;;;;;;;;  
 
; Maximum execution time of each script, in seconds  
; http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time  
max_execution_time = 30  
 
; Maximum amount of time each script may spend parsing request data. It's a good  
; idea to limit this time on productions servers in order to eliminate unexpectedly  
; long running scripts.  
; Default Value: -1 (Unlimited)  
; Development Value: 60 (60 seconds)  
; Production Value: 60 (60 seconds)  
; http://www.php.net/manual/en/info.configuration.php#ini.max-input-time  
max_input_time = 60  
 
; Maximum input variable nesting level  
; http://www.php.net/manual/en/info.configuration.php#ini.max-input-nesting-level  
;max_input_nesting_level = 64  
 
; Maximum amount of memory a script may consume (128MB)  
; http://www.php.net/manual/en/ini.core.php#ini.memory-limit  
memory_limit = 128M  
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
; Error handling and logging ;  
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
 
; This directive informs PHP of which errors, warnings and notices you would like  
; it to take action for. The recommended way of setting values for this  
; directive is through the use of the error level constants and bitwise  
; operators. The error level constants are below here for convenience as well as  
; some common settings and their meanings.  
; By default, PHP is set to take action on all errors, notices and warnings EXCEPT  
; those related to E_NOTICE and E_STRICT, which together cover best practices and  
; recommended coding standards in PHP. For performance reasons, this is the  
; recommend error reporting setting. Your production server shouldn't be wasting  
; resources complaining about best practices and coding standards. That's what  
; development servers and development settings are for.  
; Note: The php.ini-development file has this setting as E_ALL | E_STRICT. This  
; means it pretty much reports everything which is exactly what you want during  
; development and early testing.  
;  
; Error Level Constants:  
; E_ALL - All errors and warnings (includes E_STRICT as of PHP 6.0.0)  
; E_ERROR - fatal run-time errors  
; E_RECOVERABLE_ERROR - almost fatal run-time errors  
; E_WARNING - run-time warnings (non-fatal errors)  
; E_PARSE - compile-time parse errors  
; E_NOTICE - run-time notices (these are warnings which often result  
; from a bug in your code, but it's possible that it was  
; intentional (e.g., using an uninitialized variable and  
; relying on the fact it's automatically initialized to an  
; empty string)  
; E_STRICT - run-time notices, enable to have PHP suggest changes  
; to your code which will ensure the best interoperability  
; and forward compatibility of your code  
; E_CORE_ERROR - fatal errors that occur during PHP's initial startup  
; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's  
; initial startup  
; E_COMPILE_ERROR - fatal compile-time errors  
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)  
; E_USER_ERROR - user-generated error message  
; E_USER_WARNING - user-generated warning message  
; E_USER_NOTICE - user-generated notice message  
; E_DEPRECATED - warn about code that will not work in future versions  
; of PHP  
; E_USER_DEPRECATED - user-generated deprecation warnings  
;  
; Common Values:  
; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.)  
; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices)  
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)  
; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.)  
; Default Value: E_ALL & ~E_NOTICE  
; Development Value: E_ALL | E_STRICT  
; Production Value: E_ALL & ~E_DEPRECATED  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting  
error_reporting = E_ALL & ~E_DEPRECATED  
 
; This directive controls whether or not and where PHP will output errors,  
; notices and warnings too. Error output is very useful during development, but  
; it could be very dangerous in production environments. Depending on the code  
; which is triggering the error, sensitive information could potentially leak  
; out of your application such as database usernames and passwords or worse.  
; It's recommended that errors be logged on production servers rather than  
; having the errors sent to STDOUT.  
; Possible Values:  
; Off = Do not display any errors  
; stderr = Display errors to STDERR (affects only CGI/CLI binaries!)  
; On or stdout = Display errors to STDOUT  
; Default Value: On  
; Development Value: On  
; Production Value: Off  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors  
display_errors = Off  
 
; The display of errors which occur during PHP's startup sequence are handled  
; separately from display_errors. PHP's default behavior is to suppress those  
; errors from clients. Turning the display of startup errors on can be useful in  
; debugging configuration problems. But, it's strongly recommended that you  
; leave this setting off on production servers.  
; Default Value: Off  
; Development Value: On  
; Production Value: Off  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-startup-errors  
display_startup_errors = Off  
 
; Besides displaying errors, PHP can also log errors to locations such as a  
; server-specific log, STDERR, or a location specified by the error_log  
; directive found below. While errors should not be displayed on productions  
; servers they should still be monitored and logging is a great way to do that.  
; Default Value: Off  
; Development Value: On  
; Production Value: On  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.log-errors  
log_errors = On  
 
; Set maximum length of log_errors. In error_log information about the source is  
; added. The default is 1024 and 0 allows to not apply any maximum length at all.  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.log-errors-max-len  
log_errors_max_len = 1024  
 
; Do not log repeated messages. Repeated errors must occur in same file on same  
; line unless ignore_repeated_source is set true.  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.ignore-repeated-errors  
ignore_repeated_errors = Off  
 
; Ignore source of message when ignoring repeated messages. When this setting  
; is On you will not log errors with repeated messages from different files or  
; source lines.  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.ignore-repeated-source  
ignore_repeated_source = Off  
 
; If this parameter is set to Off, then memory leaks will not be shown (on  
; stdout or in the log). This has only effect in a debug compile, and if  
; error reporting includes E_WARNING in the allowed list  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.report-memleaks  
report_memleaks = On  
 
; This setting is on by default.  
;report_zend_debug = 0  
 
; Store the last error/warning message in $php_errormsg (boolean). Setting this value  
; to On can assist in debugging and is appropriate for development servers. It should  
; however be disabled on production servers.  
; Default Value: Off  
; Development Value: On  
; Production Value: Off  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.track-errors  
track_errors = Off  
 
; Turn off normal error reporting and emit XML-RPC error XML  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.xmlrpc-errors  
;xmlrpc_errors = 0  
 
; An XML-RPC faultCode  
;xmlrpc_error_number = 0  
 
; When PHP displays or logs an error, it has the capability of inserting html  
; links to documentation related to that error. This directive controls whether  
; those HTML links appear in error messages or not. For performance and security  
; reasons, it's recommended you disable this on production servers.  
; Default Value: On  
; Development Value: On  
; Production value: Off  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.html-errors  
html_errors = Off  
 
; If html_errors is set On PHP produces clickable error messages that direct  
; to a page describing the error or function causing the error in detail.  
; You can download a copy of the PHP manual from http://www.php.net/docs.php  
; and change docref_root to the base URL of your local copy including the  
; leading '/'. You must also specify the file extension being used including  
; the dot. PHP's default behavior is to leave these settings empty.  
; Note: Never use this feature for production boxes.  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.docref-root  
; Examples  
;docref_root = "/phpmanual/"  
 
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.docref-ext  
;docref_ext = .html  
 
; String to output before an error message. PHP's default behavior is to leave  
; this setting blank.  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-prepend-string  
; Example:  
;error_prepend_string = "<font color=#ff0000>"  
 
; String to output after an error message. PHP's default behavior is to leave  
; this setting blank.  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-append-string  
; Example:  
;error_append_string = "</font>"  
 
; Log errors to specified file. PHP's default behavior is to leave this value  
; empty.  
; http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log  
; Example:  
;error_log = php_errors.log  
; Log errors to syslog (Event Log on NT, not valid in Windows 95).  
;error_log = syslog  
 
;;;;;;;;;;;;;;;;;  
; Data Handling ;  
;;;;;;;;;;;;;;;;;  
 
; Note - track_vars is ALWAYS enabled as of PHP 4.0.3  
 
; The separator used in PHP generated URLs to separate arguments.  
; PHP's default setting is "&".  
; http://www.php.net/manual/en/ini.core.php#ini.arg-separator.output  
; Example:  
;arg_separator.output = "&amp;"  
 
; List of separator(s) used by PHP to parse input URLs into variables.  
; PHP's default setting is "&".  
; NOTE: Every character in this directive is considered as separator!  
; http://www.php.net/manual/en/ini.core.php#ini.arg-separator.input  
; Example:  
;arg_separator.input = ";&"  
 
; This directive determines which super global arrays are registered when PHP  
; starts up. If the register_globals directive is enabled, it also determines  
; what order variables are populated into the global space. G,P,C,E & S are  
; abbreviations for the following respective super globals: GET, POST, COOKIE,  
; ENV and SERVER. There is a performance penalty paid for the registration of  
; these arrays and because ENV is not as commonly used as the others, ENV is  
; is not recommended on productions servers. You can still get access to  
; the environment variables through getenv() should you need to.  
; Default Value: "EGPCS"  
; Development Value: "GPCS"  
; Production Value: "GPCS";  
; http://www.php.net/manual/en/ini.core.php#ini.variables-order  
variables_order = "GPCS"  
 
; This directive determines which super global data (G,P,C,E & S) should  
; be registered into the super global array REQUEST. If so, it also determines  
; the order in which that data is registered. The values for this directive are  
; specified in the same manner as the variables_order directive, EXCEPT one.  
; Leaving this value empty will cause PHP to use the value set in the  
; variables_order directive. It does not mean it will leave the super globals  
; array REQUEST empty.  
; Default Value: None  
; Development Value: "GP"  
; Production Value: "GP"  
; http://www.php.net/manual/en/ini.core.php#ini.request-order  
request_order = "GP"  
 
; Whether or not to register the EGPCS variables as global variables. You may  
; want to turn this off if you don't want to clutter your scripts' global scope  
; with user data. This makes most sense when coupled with track_vars - in which  
; case you can access all of the GPC variables through the $HTTP_*_VARS[],  
; variables.  
; You should do your best to write your scripts so that they do not require  
; register_globals to be on; Using form variables as globals can easily lead  
; to possible security problems, if the code is not very well thought of.  
; http://www.php.net/manual/en/ini.core.php#ini.register-globals  
register_globals = Off  
 
; Determines whether the deprecated long $HTTP_*_VARS type predefined variables  
; are registered by PHP or not. As they are deprecated, we obviously don't  
; recommend you use them. They are on by default for compatibility reasons but  
; they are not recommended on production servers.  
; Default Value: On  
; Development Value: Off  
; Production Value: Off  
; http://www.php.net/manual/en/ini.core.php#ini.register-long-arrays  
register_long_arrays = Off  
 
; This directive determines whether PHP registers $argv & $argc each time it  
; runs. $argv contains an array of all the arguments passed to PHP when a script  
; is invoked. $argc contains an integer representing the number of arguments  
; that were passed when the script was invoked. These arrays are extremely  
; useful when running scripts from the command line. When this directive is  
; enabled, registering these variables consumes CPU cycles and memory each time  
; a script is executed. For performance reasons, this feature should be disabled  
; on production servers.  
; Default Value: On  
; Development Value: Off  
; Production Value: Off  
; http://www.php.net/manual/en/ini.core.php#ini.register-argc-argv  
register_argc_argv = Off  
 
; When enabled, the SERVER and ENV variables are created when they're first  
; used (Just In Time) instead of when the script starts. If these variables  
; are not used within a script, having this directive on will result in a  
; performance gain. The PHP directives register_globals, register_long_arrays,  
; and register_argc_argv must be disabled for this directive to have any affect.  
; http://www.php.net/manual/en/ini.core.php#ini.auto-globals-jit  
auto_globals_jit = On  
 
; Maximum size of POST data that PHP will accept.  
; http://www.php.net/manual/en/ini.core.php#ini.post-max-size  
post_max_size = 8M  
 
; Magic quotes are a preprocessing feature of PHP where PHP will attempt to  
; escape any character sequences in GET, POST, COOKIE and ENV data which might  
; otherwise corrupt data being placed in resources such as databases before  
; making that data available to you. Because of character encoding issues and  
; non-standard SQL implementations across many databases, it's not currently  
; possible for this feature to be 100% accurate. PHP's default behavior is to  
; enable the feature. We strongly recommend you use the escaping mechanisms  
; designed specifically for the database your using instead of relying on this  
; feature. Also note, this feature has been deprecated as of PHP 5.3.0 and is  
; scheduled for removal in PHP 6.  
; Default Value: On  
; Development Value: Off  
; Production Value: Off  
; http://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-gpc  
magic_quotes_gpc = Off  
 
; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.  
; http://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime  
magic_quotes_runtime = Off  
 
; Use Sybase-style magic quotes (escape ' with '' instead of \').  
; http://www.php.net/manual/en/sybase.configuration.php#ini.magic-quotes-sybase  
magic_quotes_sybase = Off  
 
; Automatically add files before PHP document.  
; http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file  
auto_prepend_file =  
 
; Automatically add files after PHP document.  
; http://www.php.net/manual/en/ini.core.php#ini.auto-append-file  
auto_append_file =  
 
; As of 4.0b4, PHP always outputs a character encoding by default in  
; the Content-type: header. To disable sending of the charset, simply  
; set it to be empty.  
;  
; PHP's built-in default is text/html  
; http://www.php.net/manual/en/ini.core.php#ini.default-mimetype  
default_mimetype = "text/html"  
 
; PHP's default character set is set to empty.  
; http://www.php.net/manual/en/ini.core.php#ini.default-charset  
;default_charset = "iso-8859-1"  
 
; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default behavior is  
; to disable this feature.  
; http://www.php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data  
;always_populate_raw_post_data = On  
 
;;;;;;;;;;;;;;;;;;;;;;;;;  
; Paths and Directories ;  
;;;;;;;;;;;;;;;;;;;;;;;;;  
 
; UNIX: "/path1:/path2"  
;include_path = ".:/php/includes"  
;  
; Windows: "\path1;\path2"  
;include_path = ".;c:\php\includes"  
;  
; PHP's default setting for include_path is ".;/path/to/php/pear"  
; http://www.php.net/manual/en/ini.core.php#ini.include-path  
 
; The root of the PHP pages, used only if nonempty.  
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root  
; if you are running php as a CGI under any web server (other than IIS)  
; see documentation for security issues. The alternate is to use the  
; cgi.force_redirect configuration below  
; http://www.php.net/manual/en/ini.core.php#ini.doc-root  
doc_root =  
 
; The directory under which PHP opens the script using /~username used only  
; if nonempty.  
; http://www.php.net/manual/en/ini.core.php#ini.user-dir  
user_dir =  
 
; Directory in which the loadable extensions (modules) reside.  
; http://www.php.net/manual/en/ini.core.php#ini.extension-dir  
; extension_dir = "./"  
 
; Whether or not to enable the dl() function. The dl() function does NOT work  
; properly in multithreaded servers, such as IIS or Zeus, and is automatically  
; disabled on them.  
; http://www.php.net/manual/en/info.configuration.php#ini.enable-dl  
enable_dl = Off  
 
; cgi.force_redirect is necessary to provide security running PHP as a CGI under  
; most web servers. Left undefined, PHP turns this on by default. You can  
; turn it off here AT YOUR OWN RISK  
; **You CAN safely turn this off for IIS, in fact, you MUST.**  
; http://www.php.net/manual/en/ini.core.php#ini.cgi.force-redirect  
;cgi.force_redirect = 1  
 
; if cgi.nph is enabled it will force cgi to always sent Status: 200 with  
; every request. PHP's default behavior is to disable this feature.  
;cgi.nph = 1  
 
; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape  
; (iPlanet) web servers, you MAY need to set an environment variable name that PHP  
; will look for to know it is OK to continue execution. Setting this variable MAY  
; cause security issues, KNOW WHAT YOU ARE DOING FIRST.  
; http://www.php.net/manual/en/ini.core.php#ini.cgi.redirect-status-env  
;cgi.redirect_status_env = ;  
 
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's  
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok  
; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting  
; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting  
; of zero causes PHP to behave as before. Default is 1. You should fix your scripts  
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.  
; http://www.php.net/manual/en/ini.core.php#ini.cgi.fix-pathinfo  
cgi.fix_pathinfo=1  
 
; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate  
; security tokens of the calling client. This allows IIS to define the  
; security context that the request runs under. mod_fastcgi under Apache  
; does not currently support this feature (03/17/2002)  
; Set to 1 if running under IIS. Default is zero.  
; http://www.php.net/manual/en/ini.core.php#ini.fastcgi.impersonate  
;fastcgi.impersonate = 1;  
 
; Disable logging through FastCGI connection. PHP's default behavior is to enable  
; this feature.  
;fastcgi.logging = 0  
 
; cgi.rfc2616_headers configuration option tells PHP what type of headers to  
; use when sending HTTP response code. If it's set 0 PHP sends Status: header that  
; is supported by Apache. When this option is set to 1 PHP will send  
; RFC2616 compliant header.  
; Default is zero.  
; http://www.php.net/manual/en/ini.core.php#ini.cgi.rfc2616-headers  
;cgi.rfc2616_headers = 0  
 
;;;;;;;;;;;;;;;;  
; File Uploads ;  
;;;;;;;;;;;;;;;;  
 
; Whether to allow HTTP file uploads.  
; http://www.php.net/manual/en/ini.core.php#ini.file-uploads  
file_uploads = On  
 
; Temporary directory for HTTP uploaded files (will use system default if not  
; specified).  
; http://www.php.net/manual/en/ini.core.php#ini.upload-tmp-dir  
;upload_tmp_dir =  
 
; Maximum allowed size for uploaded files.  
; http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize  
upload_max_filesize = 2M  
 
;;;;;;;;;;;;;;;;;;  
; Fopen wrappers ;  
;;;;;;;;;;;;;;;;;;  
 
; Whether to allow the treatment of URLs (like http:// or ftp://) as files.  
; http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen  
allow_url_fopen = On  
 
; Whether to allow include/require to open URLs (like http:// or ftp://) as files.  
; http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-include  
allow_url_include = Off  
 
; Define the anonymous ftp password (your email address). PHP's default setting  
; for this is empty.  
; http://www.php.net/manual/en/filesystem.configuration.php#ini.from  
;from="john@doe.com"  
 
; Define the User-Agent string. PHP's default setting for this is empty.  
; http://www.php.net/manual/en/filesystem.configuration.php#ini.user-agent  
;user_agent="PHP"  
 
; Default timeout for socket based streams (seconds)  
; http://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout  
default_socket_timeout = 60  
 
; If your scripts have to deal with files from Macintosh systems,  
; or you are running on a Mac and need to deal with files from  
; unix or win32 systems, setting this flag will cause PHP to  
; automatically detect the EOL character in those files so that  
; fgets() and file() will work regardless of the source of the file.  
; http://www.php.net/manual/en/filesystem.configuration.php#ini.auto-detect-line-endings  
;auto_detect_line_endings = Off  
 
;;;;;;;;;;;;;;;;;;;;;;  
; Dynamic Extensions ;  
;;;;;;;;;;;;;;;;;;;;;;  
 
; If you wish to have an extension loaded automatically, use the following  
; syntax:  
;  
; extension=modulename.extension  
;  
; For example  
;  
; extension=msql.so  
;  
; ... or with a path:  
;  
; extension=/path/to/extension/msql.so  
;  
; If you only provide the name of the extension, PHP will look for it in its  
; default extension directory.  
 
;;;;  
; Note: packaged extension modules are now loaded via the .ini files  
; found in the directory /etc/php.d; these are loaded by default.  
;;;;  
 
 
;;;;;;;;;;;;;;;;;;;  
; Module Settings ;  
;;;;;;;;;;;;;;;;;;;  
 
[Date]  
; Defines the default timezone used by the date functions  
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone  
;date.timezone =  
 
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.default-latitude  
;date.default_latitude = 31.7667  
 
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.default-longitude  
;date.default_longitude = 35.2333  
 
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.sunrise-zenith  
;date.sunrise_zenith = 90.583333  
 
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.sunset-zenith  
;date.sunset_zenith = 90.583333  
 
[filter]  
; http://www.php.net/manual/en/filter.configuration.php#ini.filter.default  
;filter.default = unsafe_raw  
 
; http://www.php.net/manual/en/filter.configuration.php#ini.filter.default-flags  
;filter.default_flags =  
 
[iconv]  
;iconv.input_encoding = ISO-8859-1  
;iconv.internal_encoding = ISO-8859-1  
;iconv.output_encoding = ISO-8859-1  
 
[intl]  
;intl.default_locale =  
 
[sqlite]  
; http://www.php.net/manual/en/sqlite.configuration.php#ini.sqlite.assoc-case  
;sqlite.assoc_case = 0  
 
[sqlite3]  
;sqlite3.extension_dir =  
 
[Pcre]  
;PCRE library backtracking limit.  
; http://www.php.net/manual/en/pcre.configuration.php#ini.pcre.backtrack-limit  
;pcre.backtrack_limit=100000  
 
;PCRE library recursion limit.  
;Please note that if you set this value to a high number you may consume all  
;the available process stack and eventually crash PHP (due to reaching the  
;stack size limit imposed by the Operating System).  
; http://www.php.net/manual/en/pcre.configuration.php#ini.pcre.recursion-limit  
;pcre.recursion_limit=100000  
 
[Pdo]  
; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off"  
; http://www.php.net/manual/en/ref.pdo-odbc.php#ini.pdo-odbc.connection-pooling  
;pdo_odbc.connection_pooling=strict  
 
[Phar]  
; http://www.php.net/manual/en/phar.configuration.php#ini.phar.readonly  
;phar.readonly = On  
 
; http://www.php.net/manual/en/phar.configuration.php#ini.phar.require-hash  
;phar.require_hash = On  
 
;phar.cache_list =  
 
[Syslog]  
; Whether or not to define the various syslog variables (e.g. $LOG_PID,  
; $LOG_CRON, etc.). Turning it off is a good idea performance-wise. In  
; runtime, you can define these variables by calling define_syslog_variables().  
; http://www.php.net/manual/en/network.configuration.php#ini.define-syslog-variables  
define_syslog_variables = Off  
 
[mail function]  
; For Win32 only.  
; http://www.php.net/manual/en/mail.configuration.php#ini.smtp  
SMTP = localhost  
; http://www.php.net/manual/en/mail.configuration.php#ini.smtp-port  
smtp_port = 25  
 
; For Win32 only.  
; http://www.php.net/manual/en/mail.configuration.php#ini.sendmail-from  
;sendmail_from = me@example.com  
 
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").  
; http://www.php.net/manual/en/mail.configuration.php#ini.sendmail-path  
sendmail_path = /usr/sbin/sendmail -t -i  
 
; Force the addition of the specified parameters to be passed as extra parameters  
; to the sendmail binary. These parameters will always replace the value of  
; the 5th parameter to mail(), even in safe mode.  
;mail.force_extra_parameters =  
 
; Add X-PHP-Originaiting-Script: that will include uid of the script followed by the filename  
mail.add_x_header = On  
 
; Log all mail() calls including the full path of the script, line #, to address and headers  
;mail.log =  
 
[SQL]  
; http://www.php.net/manual/en/ini.core.php#ini.sql.safe-mode  
sql.safe_mode = Off  
 
[ODBC]  
; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.default-db  
;odbc.default_db = Not yet implemented  
 
; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.default-user  
;odbc.default_user = Not yet implemented  
 
; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.default-pw  
;odbc.default_pw = Not yet implemented  
 
; Allow or prevent persistent links.  
; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.allow-persistent  
odbc.allow_persistent = On  
 
; Check that a connection is still valid before reuse.  
; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.check-persistent  
odbc.check_persistent = On  
 
; Maximum number of persistent links. -1 means no limit.  
; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.max-persistent  
odbc.max_persistent = -1  
 
; Maximum number of links (persistent + non-persistent). -1 means no limit.  
; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.max-links  
odbc.max_links = -1  
 
; Handling of LONG fields. Returns number of bytes to variables. 0 means  
; passthru.  
; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.defaultlrl  
odbc.defaultlrl = 4096  
 
; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char.  
; See the documentation on odbc_binmode and odbc_longreadlen for an explanation  
; of uodbc.defaultlrl and uodbc.defaultbinmode  
; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.defaultbinmode  
odbc.defaultbinmode = 1  
 
;birdstep.max_links = -1  
 
[MySQL]  
; Allow or prevent persistent links.  
; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.allow-persistent  
mysql.allow_persistent = On  
 
; Maximum number of persistent links. -1 means no limit.  
; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.max-persistent  
mysql.max_persistent = -1  
 
; Maximum number of links (persistent + non-persistent). -1 means no limit.  
; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.max-links  
mysql.max_links = -1  
 
; Default port number for mysql_connect(). If unset, mysql_connect() will use  
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the  
; compile-time value defined MYSQL_PORT (in that order). Win32 will only look  
; at MYSQL_PORT.  
; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-port  
mysql.default_port =  
 
; Default socket name for local MySQL connects. If empty, uses the built-in  
; MySQL defaults.  
; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-socket  
mysql.default_socket =  
 
; Default host for mysql_connect() (doesn't apply in safe mode).  
; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-host  
mysql.default_host =  
 
; Default user for mysql_connect() (doesn't apply in safe mode).  
; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-user  
mysql.default_user =  
 
; Default password for mysql_connect() (doesn't apply in safe mode).  
; Note that this is generally a *bad* idea to store passwords in this file.  
; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")  
; and reveal this password! And of course, any users with read access to this  
; file will be able to reveal the password as well.  
; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-password  
mysql.default_password =  
 
; Maximum time (in seconds) for connect timeout. -1 means no limit  
; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.connect-timeout  
mysql.connect_timeout = 60  
 
; Trace mode. When trace_mode is active (=On), warnings for table/index scans and  
; SQL-Errors will be displayed.  
; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.trace-mode  
mysql.trace_mode = Off  
 
[MySQLi]  
 
; Maximum number of links. -1 means no limit.  
; http://www.php.net/manual/en/mysqli.configuration.php#ini.mysqli.max-links  
mysqli.max_links = -1  
 
; Default port number for mysqli_connect(). If unset, mysqli_connect() will use  
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the  
; compile-time value defined MYSQL_PORT (in that order). Win32 will only look  
; at MYSQL_PORT.  
; http://www.php.net/manual/en/mysqli.configuration.php#ini.mysqli.default-port  
mysqli.default_port = 3306  
 
; Default socket name for local MySQL connects. If empty, uses the built-in  
; MySQL defaults.  
; http://www.php.net/manual/en/mysqli.configuration.php#ini.mysqli.default-socket  
mysqli.default_socket =  
 
; Default host for mysql_connect() (doesn't apply in safe mode).  
; http://www.php.net/manual/en/mysqli.configuration.php#ini.mysqli.default-host  
mysqli.default_host =  
 
; Default user for mysql_connect() (doesn't apply in safe mode).  
; http://www.php.net/manual/en/mysqli.configuration.php#ini.mysqli.default-user  
mysqli.default_user =  
 
; Default password for mysqli_connect() (doesn't apply in safe mode).  
; Note that this is generally a *bad* idea to store passwords in this file.  
; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw")  
; and reveal this password! And of course, any users with read access to this  
; file will be able to reveal the password as well.  
; http://www.php.net/manual/en/mysqli.configuration.php#ini.mysqli.default-pw  
mysqli.default_pw =  
 
; Allow or prevent reconnect  
mysqli.reconnect = Off  
 
[PostgresSQL]  
; Allow or prevent persistent links.  
; http://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.allow-persistent  
pgsql.allow_persistent = On  
 
; Detect broken persistent links always with pg_pconnect().  
; Auto reset feature requires a little overheads.  
; http://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.auto-reset-persistent  
pgsql.auto_reset_persistent = Off  
 
; Maximum number of persistent links. -1 means no limit.  
; http://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.max-persistent  
pgsql.max_persistent = -1  
 
; Maximum number of links (persistent+non persistent). -1 means no limit.  
; http://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.max-links  
pgsql.max_links = -1  
 
; Ignore PostgreSQL backends Notice message or not.  
; Notice message logging require a little overheads.  
; http://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.ignore-notice  
pgsql.ignore_notice = 0  
 
; Log PostgreSQL backends Noitce message or not.  
; Unless pgsql.ignore_notice=0, module cannot log notice message.  
; http://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.log-notice  
pgsql.log_notice = 0  
 
[Sybase-CT]  
; Allow or prevent persistent links.  
; http://www.php.net/manual/en/sybase.configuration.php#ini.sybct.allow-persistent  
sybct.allow_persistent = On  
 
; Maximum number of persistent links. -1 means no limit.  
; http://www.php.net/manual/en/sybase.configuration.php#ini.sybct.max-persistent  
sybct.max_persistent = -1  
 
; Maximum number of links (persistent + non-persistent). -1 means no limit.  
; http://www.php.net/manual/en/sybase.configuration.php#ini.sybct.max-links  
sybct.max_links = -1  
 
; Minimum server message severity to display.  
; http://www.php.net/manual/en/sybase.configuration.php#ini.sybct.min-server-severity  
sybct.min_server_severity = 10  
 
; Minimum client message severity to display.  
; http://www.php.net/manual/en/sybase.configuration.php#ini.sybct.min-client-severity  
sybct.min_client_severity = 10  
 
; Set per-context timeout  
; http://www.php.net/manual/en/sybase.configuration.php#ini.sybct.timeout  
;sybct.timeout=  
 
;sybct.packet_size  
 
[bcmath]  
; Number of decimal digits for all bcmath functions.  
; http://www.php.net/manual/en/bc.configuration.php#ini.bcmath.scale  
bcmath.scale = 0  
 
[browscap]  
; http://www.php.net/manual/en/misc.configuration.php#ini.browscap  
;browscap = extra/browscap.ini  
 
[Session]  
; Handler used to store/retrieve data.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.save-handler  
session.save_handler = files  
 
; Argument passed to save_handler. In the case of files, this is the path  
; where data files are stored. Note: Windows users have to change this  
; variable in order to use PHP's session functions.  
;  
; As of PHP 4.0.1, you can define the path as:  
;  
; session.save_path = "N;/path"  
;  
; where N is an integer. Instead of storing all the session files in  
; /path, what this will do is use subdirectories N-levels deep, and  
; store the session data in those directories. This is useful if you  
; or your OS have problems with lots of files in one directory, and is  
; a more efficient layout for servers that handle lots of sessions.  
;  
; NOTE 1: PHP will not create this directory structure automatically.  
; You can use the script in the ext/session dir for that purpose.  
; NOTE 2: See the section on garbage collection below if you choose to  
; use subdirectories for session storage  
;  
; The file storage module creates files using mode 600 by default.  
; You can change that by using  
;  
; session.save_path = "N;MODE;/path"  
;  
; where MODE is the octal representation of the mode. Note that this  
; does not overwrite the process's umask.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.save-path  
session.save_path = "/tmp"  
 
; Whether to use cookies.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.use-cookies  
session.use_cookies = 1  
 
; http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-secure  
;session.cookie_secure =  
 
; This option forces PHP to fetch and use a cookie for storing and maintaining  
; the session id. We encourage this operation as it's very helpful in combatting  
; session hijacking when not specifying and managing your own session id. It is  
; not the end all be all of session hijacking defense, but it's a good start.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.use-only-cookies  
session.use_only_cookies = 1  
 
; Name of the session (used as cookie name).  
; http://www.php.net/manual/en/session.configuration.php#ini.session.name  
session.name = PHPSESSID  
 
; Initialize session on request startup.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.auto-start  
session.auto_start = 0  
 
; Lifetime in seconds of cookie or, if 0, until browser is restarted.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime  
session.cookie_lifetime = 0  
 
; The path for which the cookie is valid.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-path  
session.cookie_path = /  
 
; The domain for which the cookie is valid.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-domain  
session.cookie_domain =  
 
; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-httponly  
session.cookie_httponly =  
 
; Handler used to serialize data. php is the standard serializer of PHP.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler  
session.serialize_handler = php  
 
; Defines the probability that the 'garbage collection' process is started  
; on every session initialization. The probability is calculated by using  
; gc_probability/gc_divisor. Where session.gc_probability is the numerator  
; and gc_divisor is the denominator in the equation. Setting this value to 1  
; when the session.gc_divisor value is 100 will give you approximately a 1% chance  
; the gc will run on any give request.  
; Default Value: 1  
; Development Value: 1  
; Production Value: 1  
; http://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability  
session.gc_probability = 1  
 
; Defines the probability that the 'garbage collection' process is started on every  
; session initialization. The probability is calculated by using the following equation:  
; gc_probability/gc_divisor. Where session.gc_probability is the numerator and  
; session.gc_divisor is the denominator in the equation. Setting this value to 1  
; when the session.gc_divisor value is 100 will give you approximately a 1% chance  
; the gc will run on any give request. Increasing this value to 1000 will give you  
; a 0.1% chance the gc will run on any give request. For high volume production servers,  
; this is a more efficient approach.  
; Default Value: 100  
; Development Value: 1000  
; Production Value: 1000  
; http://www.php.net/manual/en/session.configuration.php#ini.session.gc-divisor  
session.gc_divisor = 1000  
 
; After this number of seconds, stored data will be seen as 'garbage' and  
; cleaned up by the garbage collection process.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime  
session.gc_maxlifetime = 1440  
 
; NOTE: If you are using the subdirectory option for storing session files  
; (see session.save_path above), then garbage collection does *not*  
; happen automatically. You will need to do your own garbage  
; collection through a shell script, cron entry, or some other method.  
; For example, the following script would is the equivalent of  
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):  
; cd /path/to/sessions; find -cmin +24 | xargs rm  
 
; PHP 4.2 and less have an undocumented feature/bug that allows you to  
; to initialize a session variable in the global scope, even when register_globals  
; is disabled. PHP 4.3 and later will warn you, if this feature is used.  
; You can disable the feature and the warning separately. At this time,  
; the warning is only displayed, if bug_compat_42 is enabled. This feature  
; introduces some serious security problems if not handled correctly. It's  
; recommended that you do not use this feature on production servers. But you  
; should enable this on development servers and enable the warning as well. If you  
; do not enable the feature on development servers, you won't be warned when it's  
; used and debugging errors caused by this can be difficult to track down.  
; Default Value: On  
; Development Value: On  
; Production Value: Off  
; http://www.php.net/manual/en/session.configuration.php#ini.session.bug-compat-42  
session.bug_compat_42 = Off  
 
; This setting controls whether or not you are warned by PHP when initializing a  
; session value into the global space. session.bug_compat_42 must be enabled before  
; these warnings can be issued by PHP. See the directive above for more information.  
; Default Value: On  
; Development Value: On  
; Production Value: Off  
; http://www.php.net/manual/en/session.configuration.php#ini.session.bug-compat-warn  
session.bug_compat_warn = Off  
 
; Check HTTP Referer to invalidate externally stored URLs containing ids.  
; HTTP_REFERER has to contain this substring for the session to be  
; considered as valid.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.referer-check  
session.referer_check =  
 
; How many bytes to read from the file.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.entropy-length  
session.entropy_length = 0  
 
; Specified here to create the session id.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.entropy-file  
;session.entropy_file = /dev/urandom  
session.entropy_file =  
 
; http://www.php.net/manual/en/session.configuration.php#ini.session.entropy-length  
;session.entropy_length = 16  
 
; Set to {nocache,private,public,} to determine HTTP caching aspects  
; or leave this empty to avoid sending anti-caching headers.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.cache-limiter  
session.cache_limiter = nocache  
 
; Document expires after n minutes.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.cache-expire  
session.cache_expire = 180  
 
; trans sid support is disabled by default.  
; Use of trans sid may risk your users security.  
; Use this option with caution.  
; - User may send URL contains active session ID  
; to other person via. email/irc/etc.  
; - URL that contains active session ID may be stored  
; in publically accessible computer.  
; - User may access your site with the same session ID  
; always using URL stored in browser's history or bookmarks.  
; http://www.php.net/manual/en/session.configuration.php#ini.session.use-trans-sid  
session.use_trans_sid = 0  
 
; Select a hash function for use in generating session ids.  
; Possible Values  
; 0 (MD5 128 bits)  
; 1 (SHA-1 160 bits)  
; http://www.php.net/manual/en/session.configuration.php#ini.session.hash-function  
session.hash_function = 0  
 
; Define how many bits are stored in each character when converting  
; the binary hash data to something readable.  
; Possible values:  
; 4 (4 bits: 0-9, a-f)  
; 5 (5 bits: 0-9, a-v)  
; 6 (6 bits: 0-9, a-z, A-Z, "-", ",")  
; Default Value: 4  
; Development Value: 5  
; Production Value: 5  
; http://www.php.net/manual/en/session.configuration.php#ini.session.hash-bits-per-character  
session.hash_bits_per_character = 5  
 
; The URL rewriter will look for URLs in a defined set of HTML tags.  
; form/fieldset are special; if you include them here, the rewriter will  
; add a hidden <input> field with the info which is otherwise appended  
; to URLs. If you want XHTML conformity, remove the form entry.  
; Note that all valid entries require a "=", even if no value follows.  
; Default Value: "a=href,area=href,frame=src,form=,fieldset="  
; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry"  
; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry"  
; http://www.php.net/manual/en/session.configuration.php#ini.url-rewriter.tags  
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"  
 
[MSSQL]  
; Allow or prevent persistent links.  
mssql.allow_persistent = On  
 
; Maximum number of persistent links. -1 means no limit.  
mssql.max_persistent = -1  
 
; Maximum number of links (persistent+non persistent). -1 means no limit.  
mssql.max_links = -1  
 
; Minimum error severity to display.  
mssql.min_error_severity = 10  
 
; Minimum message severity to display.  
mssql.min_message_severity = 10  
 
; Compatibility mode with old versions of PHP 3.0.  
mssql.compatability_mode = Off  
 
; Connect timeout  
;mssql.connect_timeout = 5  
 
; Query timeout  
;mssql.timeout = 60  
 
; Valid range 0 - 2147483647. Default = 4096.  
;mssql.textlimit = 4096  
 
; Valid range 0 - 2147483647. Default = 4096.  
;mssql.textsize = 4096  
 
; Limits the number of records in each batch. 0 = all records in one batch.  
;mssql.batchsize = 0  
 
; Specify how datetime and datetim4 columns are returned  
; On => Returns data converted to SQL server settings  
; Off => Returns values as YYYY-MM-DD hh:mm:ss  
;mssql.datetimeconvert = On  
 
; Use NT authentication when connecting to the server  
mssql.secure_connection = Off  
 
; Specify max number of processes. -1 = library default  
; msdlib defaults to 25  
; FreeTDS defaults to 4096  
;mssql.max_procs = -1  
 
; Specify client character set.  
; If empty or not set the client charset from freetds.comf is used  
; This is only used when compiled with FreeTDS  
;mssql.charset = "ISO-8859-1"  
 
[Assertion]  
; Assert(expr); active by default.  
; http://www.php.net/manual/en/info.configuration.php#ini.assert.active  
;assert.active = On  
 
; Issue a PHP warning for each failed assertion.  
; http://www.php.net/manual/en/info.configuration.php#ini.assert.warning  
;assert.warning = On  
 
; Don't bail out by default.  
; http://www.php.net/manual/en/info.configuration.php#ini.assert.bail  
;assert.bail = Off  
 
; User-function to be called if an assertion fails.  
; http://www.php.net/manual/en/info.configuration.php#ini.assert.callback  
;assert.callback = 0  
 
; Eval the expression with current error_reporting(). Set to true if you want  
; error_reporting(0) around the eval().  
; http://www.php.net/manual/en/info.configuration.php#ini.assert.quiet-eval  
;assert.quiet_eval = 0  
 
[COM]  
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs  
; http://www.php.net/manual/en/com.configuration.php#ini.com.typelib-file  
;com.typelib_file =  
 
; allow Distributed-COM calls  
; http://www.php.net/manual/en/com.configuration.php#ini.com.allow-dcom  
;com.allow_dcom = true  
 
; autoregister constants of a components typlib on com_load()  
; http://www.php.net/manual/en/com.configuration.php#ini.com.autoregister-typelib  
;com.autoregister_typelib = true  
 
; register constants casesensitive  
; http://www.php.net/manual/en/com.configuration.php#ini.com.autoregister-casesensitive  
;com.autoregister_casesensitive = false  
 
; show warnings on duplicate constant registrations  
; http://www.php.net/manual/en/com.configuration.php#ini.com.autoregister-verbose  
;com.autoregister_verbose = true  
 
[mbstring]  
; language for internal character representation.  
; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.language  
;mbstring.language = Japanese  
 
; internal/script encoding.  
; Some encoding cannot work as internal encoding.  
; (e.g. SJIS, BIG5, ISO-2022-*)  
; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.internal-encoding  
;mbstring.internal_encoding = EUC-JP  
 
; http input encoding.  
; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.http-input  
;mbstring.http_input = auto  
 
; http output encoding. mb_output_handler must be  
; registered as output buffer to function  
; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.http-output  
;mbstring.http_output = SJIS  
 
; enable automatic encoding translation according to  
; mbstring.internal_encoding setting. Input chars are  
; converted to internal encoding by setting this to On.  
; Note: Do _not_ use automatic encoding translation for  
; portable libs/applications.  
; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.encoding-translation  
;mbstring.encoding_translation = Off  
 
; automatic encoding detection order.  
; auto means  
; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.detect-order  
;mbstring.detect_order = auto  
 
; substitute_character used when character cannot be converted  
; one from another  
; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.substitute-character  
;mbstring.substitute_character = none;  
 
; overload(replace) single byte functions by mbstring functions.  
; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),  
; etc. Possible values are 0,1,2,4 or combination of them.  
; For example, 7 for overload everything.  
; 0: No overload  
; 1: Overload mail() function  
; 2: Overload str*() functions  
; 4: Overload ereg*() functions  
; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.func-overload  
;mbstring.func_overload = 0  
 
; enable strict encoding detection.  
;mbstring.strict_detection = Off  
 
; This directive specifies the regex pattern of content types for which mb_output_handler()  
; is activated.  
; Default: mbstring.http_output_conv_mimetype=^(text/|application/xhtml\+xml)  
;mbstring.http_output_conv_mimetype=  
 
[gd]  
; Tell the jpeg decode to ignore warnings and try to create  
; a gd image. The warning will then be displayed as notices  
; disabled by default  
; http://www.php.net/manual/en/image.configuration.php#ini.image.jpeg-ignore-warning  
;gd.jpeg_ignore_warning = 0  
 
[exif]  
; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS.  
; With mbstring support this will automatically be converted into the encoding  
; given by corresponding encode setting. When empty mbstring.internal_encoding  
; is used. For the decode settings you can distinguish between motorola and  
; intel byte order. A decode setting cannot be empty.  
; http://www.php.net/manual/en/exif.configuration.php#ini.exif.encode-unicode  
;exif.encode_unicode = ISO-8859-15  
 
; http://www.php.net/manual/en/exif.configuration.php#ini.exif.decode-unicode-motorola  
;exif.decode_unicode_motorola = UCS-2BE  
 
; http://www.php.net/manual/en/exif.configuration.php#ini.exif.decode-unicode-intel  
;exif.decode_unicode_intel = UCS-2LE  
 
; http://www.php.net/manual/en/exif.configuration.php#ini.exif.encode-jis  
;exif.encode_jis =  
 
; http://www.php.net/manual/en/exif.configuration.php#ini.exif.decode-jis-motorola  
;exif.decode_jis_motorola = JIS  
 
; http://www.php.net/manual/en/exif.configuration.php#ini.exif.decode-jis-intel  
;exif.decode_jis_intel = JIS  
 
[Tidy]  
; The path to a default tidy configuration file to use when using tidy  
; http://www.php.net/manual/en/tidy.configuration.php#ini.tidy.default-config  
;tidy.default_config = /usr/local/lib/php/default.tcfg  
 
; Should tidy clean and repair output automatically?  
; WARNING: Do not use this option if you are generating non-html content  
; such as dynamic images  
; http://www.php.net/manual/en/tidy.configuration.php#ini.tidy.clean-output  
tidy.clean_output = Off  
 
[soap]  
; Enables or disables WSDL caching feature.  
; http://www.php.net/manual/en/soap.configuration.php#ini.soap.wsdl-cache-enabled  
soap.wsdl_cache_enabled=1  
 
; Sets the directory name where SOAP extension will put cache files.  
; http://www.php.net/manual/en/soap.configuration.php#ini.soap.wsdl-cache-dir  
soap.wsdl_cache_dir="/tmp"  
 
; (time to live) Sets the number of second while cached file will be used  
; instead of original one.  
; http://www.php.net/manual/en/soap.configuration.php#ini.soap.wsdl-cache-ttl  
soap.wsdl_cache_ttl=86400  
 
[sysvshm]  
; A default size of the shared memory segment  
;sysvshm.init_mem = 10000  
 
 
; Local Variables:  
; tab-width: 4  
; End:  
 
file:a/aws/postgresql.conf (deleted)
# -----------------------------  
# PostgreSQL configuration file  
# -----------------------------  
#  
# This file consists of lines of the form:  
#  
# name = value  
#  
# (The "=" is optional.) Whitespace may be used. Comments are introduced with  
# "#" anywhere on a line. The complete list of parameter names and allowed  
# values can be found in the PostgreSQL documentation.  
#  
# The commented-out settings shown in this file represent the default values.  
# Re-commenting a setting is NOT sufficient to revert it to the default value;  
# you need to reload the server.  
#  
# This file is read on server startup and when the server receives a SIGHUP  
# signal. If you edit the file on a running system, you have to SIGHUP the  
# server for the changes to take effect, or use "pg_ctl reload". Some  
# parameters, which are marked below, require a server shutdown and restart to  
# take effect.  
#  
# Any parameter can also be given as a command-line option to the server, e.g.,  
# "postgres -c log_connections=on". Some parameters can be changed at run time  
# with the "SET" SQL command.  
#  
# Memory units: kB = kilobytes Time units: ms = milliseconds  
# MB = megabytes s = seconds  
# GB = gigabytes min = minutes  
# h = hours  
# d = days  
 
 
#------------------------------------------------------------------------------  
# FILE LOCATIONS  
#------------------------------------------------------------------------------  
 
# The default values of these variables are driven from the -D command-line  
# option or PGDATA environment variable, represented here as ConfigDir.  
 
#data_directory = 'ConfigDir' # use data in another directory  
# (change requires restart)  
#hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file  
# (change requires restart)  
#ident_file = 'ConfigDir/pg_ident.conf' # ident configuration file  
# (change requires restart)  
 
# If external_pid_file is not explicitly set, no extra PID file is written.  
#external_pid_file = '(none)' # write an extra PID file  
# (change requires restart)  
 
 
#------------------------------------------------------------------------------  
# CONNECTIONS AND AUTHENTICATION  
#------------------------------------------------------------------------------  
 
# - Connection Settings -  
 
listen_addresses = '*' # what IP address(es) to listen on;  
# comma-separated list of addresses;  
# defaults to 'localhost', '*' = all  
# (change requires restart)  
#port = 5432 # (change requires restart)  
max_connections = 100 # (change requires restart)  
# Note: Increasing max_connections costs ~400 bytes of shared memory per  
# connection slot, plus lock space (see max_locks_per_transaction).  
#superuser_reserved_connections = 3 # (change requires restart)  
#unix_socket_directory = '' # (change requires restart)  
#unix_socket_group = '' # (change requires restart)  
#unix_socket_permissions = 0777 # begin with 0 to use octal notation  
# (change requires restart)  
#bonjour_name = '' # defaults to the computer name  
# (change requires restart)  
 
# - Security and Authentication -  
 
#authentication_timeout = 1min # 1s-600s  
#ssl = off # (change requires restart)  
#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH' # allowed SSL ciphers  
# (change requires restart)  
#ssl_renegotiation_limit = 512MB # amount of data between renegotiations  
#password_encryption = on  
#db_user_namespace = off  
 
# Kerberos and GSSAPI  
#krb_server_keyfile = ''  
#krb_srvname = 'postgres' # (Kerberos only)  
#krb_caseins_users = off  
 
# - TCP Keepalives -  
# see "man 7 tcp" for details  
 
#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;  
# 0 selects the system default  
#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;  
# 0 selects the system default  
#tcp_keepalives_count = 0 # TCP_KEEPCNT;  
# 0 selects the system default  
 
 
#------------------------------------------------------------------------------  
# RESOURCE USAGE (except WAL)  
#------------------------------------------------------------------------------  
 
# - Memory -  
 
shared_buffers = 32MB # min 128kB  
# (change requires restart)  
#temp_buffers = 8MB # min 800kB  
#max_prepared_transactions = 0 # zero disables the feature  
# (change requires restart)  
# Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory  
# per transaction slot, plus lock space (see max_locks_per_transaction).  
# It is not advisable to set max_prepared_transactions nonzero unless you  
# actively intend to use prepared transactions.  
#work_mem = 1MB # min 64kB  
#maintenance_work_mem = 16MB # min 1MB  
#max_stack_depth = 2MB # min 100kB  
 
# - Kernel Resource Usage -  
 
#max_files_per_process = 1000 # min 25  
# (change requires restart)  
#shared_preload_libraries = '' # (change requires restart)  
 
# - Cost-Based Vacuum Delay -  
 
#vacuum_cost_delay = 0ms # 0-100 milliseconds  
#vacuum_cost_page_hit = 1 # 0-10000 credits  
#vacuum_cost_page_miss = 10 # 0-10000 credits  
#vacuum_cost_page_dirty = 20 # 0-10000 credits  
#vacuum_cost_limit = 200 # 1-10000 credits  
 
# - Background Writer -  
 
#bgwriter_delay = 200ms # 10-10000ms between rounds  
#bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round  
#bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned/round  
 
# - Asynchronous Behavior -  
 
#effective_io_concurrency = 1 # 1-1000. 0 disables prefetching  
 
 
#------------------------------------------------------------------------------  
# WRITE AHEAD LOG  
#------------------------------------------------------------------------------  
 
# - Settings -  
 
#fsync = on # turns forced synchronization on or off  
#synchronous_commit = on # immediate fsync at commit  
#wal_sync_method = fsync # the default is the first option  
# supported by the operating system:  
# open_datasync  
# fdatasync  
# fsync  
# fsync_writethrough  
# open_sync  
#full_page_writes = on # recover from partial page writes  
#wal_buffers = 64kB # min 32kB  
# (change requires restart)  
#wal_writer_delay = 200ms # 1-10000 milliseconds  
 
#commit_delay = 0 # range 0-100000, in microseconds  
#commit_siblings = 5 # range 1-1000  
 
# - Checkpoints -  
 
#checkpoint_segments = 3 # in logfile segments, min 1, 16MB each  
#checkpoint_timeout = 5min # range 30s-1h  
#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0  
#checkpoint_warning = 30s # 0 disables  
 
# - Archiving -  
 
#archive_mode = off # allows archiving to be done  
# (change requires restart)  
#archive_command = '' # command to use to archive a logfile segment  
#archive_timeout = 0 # force a logfile segment switch after this  
# number of seconds; 0 disables  
 
 
#------------------------------------------------------------------------------  
# QUERY TUNING  
#------------------------------------------------------------------------------  
 
# - Planner Method Configuration -  
 
#enable_bitmapscan = on  
#enable_hashagg = on  
#enable_hashjoin = on  
#enable_indexscan = on  
#enable_mergejoin = on  
#enable_nestloop = on  
#enable_seqscan = on  
#enable_sort = on  
#enable_tidscan = on  
 
# - Planner Cost Constants -  
 
#seq_page_cost = 1.0 # measured on an arbitrary scale  
#random_page_cost = 4.0 # same scale as above  
#cpu_tuple_cost = 0.01 # same scale as above  
#cpu_index_tuple_cost = 0.005 # same scale as above  
#cpu_operator_cost = 0.0025 # same scale as above  
#effective_cache_size = 128MB  
 
# - Genetic Query Optimizer -  
 
#geqo = on  
#geqo_threshold = 12  
#geqo_effort = 5 # range 1-10  
#geqo_pool_size = 0 # selects default based on effort  
#geqo_generations = 0 # selects default based on effort  
#geqo_selection_bias = 2.0 # range 1.5-2.0  
 
# - Other Planner Options -  
 
#default_statistics_target = 100 # range 1-10000  
#constraint_exclusion = partition # on, off, or partition  
#cursor_tuple_fraction = 0.1 # range 0.0-1.0  
#from_collapse_limit = 8  
#join_collapse_limit = 8 # 1 disables collapsing of explicit  
# JOIN clauses  
 
 
#------------------------------------------------------------------------------  
# ERROR REPORTING AND LOGGING  
#------------------------------------------------------------------------------  
 
# - Where to Log -  
 
#log_destination = 'stderr' # Valid values are combinations of  
# stderr, csvlog, syslog and eventlog,  
# depending on platform. csvlog  
# requires logging_collector to be on.  
 
# This is used when logging to stderr:  
logging_collector = on # Enable capturing of stderr and csvlog  
# into log files. Required to be on for  
# csvlogs.  
# (change requires restart)  
 
# These are only used if logging_collector is on:  
log_directory = 'pg_log' # directory where log files are written,  
# can be absolute or relative to PGDATA  
log_filename = 'postgresql-%a.log' # log file name pattern,  
# can include strftime() escapes  
log_truncate_on_rotation = on # If on, an existing log file of the  
# same name as the new log file will be  
# truncated rather than appended to.  
# But such truncation only occurs on  
# time-driven rotation, not on restarts  
# or size-driven rotation. Default is  
# off, meaning append to existing files  
# in all cases.  
log_rotation_age = 1d # Automatic rotation of logfiles will  
# happen after that time. 0 disables.  
log_rotation_size = 0 # Automatic rotation of logfiles will  
# happen after that much log output.  
# 0 disables.  
 
# These are relevant when logging to syslog:  
#syslog_facility = 'LOCAL0'  
#syslog_ident = 'postgres'  
 
#silent_mode = off # Run server silently.  
# DO NOT USE without syslog or  
# logging_collector  
# (change requires restart)  
 
 
# - When to Log -  
 
#client_min_messages = notice # values in order of decreasing detail:  
# debug5  
# debug4  
# debug3  
# debug2  
# debug1  
# log  
# notice  
# warning  
# error  
 
#log_min_messages = warning # values in order of decreasing detail:  
# debug5  
# debug4  
# debug3  
# debug2  
# debug1  
# info  
# notice  
# warning  
# error  
# log  
# fatal  
# panic  
 
#log_error_verbosity = default # terse, default, or verbose messages  
 
#log_min_error_statement = error # values in order of decreasing detail:  
# debug5  
# debug4  
# debug3  
# debug2  
# debug1  
# info  
# notice  
# warning  
# error  
# log  
# fatal  
# panic (effectively off)  
 
#log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements  
# and their durations, > 0 logs only  
# statements running at least this number  
# of milliseconds  
 
 
# - What to Log -  
 
#debug_print_parse = off  
#debug_print_rewritten = off  
#debug_print_plan = off  
#debug_pretty_print = on  
#log_checkpoints = off  
#log_connections = off  
#log_disconnections = off  
#log_duration = off  
#log_hostname = off  
#log_line_prefix = '' # special values:  
# %u = user name  
# %d = database name  
# %r = remote host and port  
# %h = remote host  
# %p = process ID  
# %t = timestamp without milliseconds  
# %m = timestamp with milliseconds  
# %i = command tag  
# %c = session ID  
# %l = session line number  
# %s = session start timestamp  
# %v = virtual transaction ID  
# %x = transaction ID (0 if none)  
# %q = stop here in non-session  
# processes  
# %% = '%'  
# e.g. '<%u%%%d> '  
#log_lock_waits = off # log lock waits >= deadlock_timeout  
#log_statement = 'none' # none, ddl, mod, all  
#log_temp_files = -1 # log temporary files equal or larger  
# than the specified size in kilobytes;  
# -1 disables, 0 logs all temp files  
#log_timezone = unknown # actually, defaults to TZ environment  
# setting  
 
 
#------------------------------------------------------------------------------  
# RUNTIME STATISTICS  
#------------------------------------------------------------------------------  
 
# - Query/Index Statistics Collector -  
 
#track_activities = on  
#track_counts = on  
#track_functions = none # none, pl, all  
#track_activity_query_size = 1024  
#update_process_title = on  
#stats_temp_directory = 'pg_stat_tmp'  
 
 
# - Statistics Monitoring -  
 
#log_parser_stats = off  
#log_planner_stats = off  
#log_executor_stats = off  
#log_statement_stats = off  
 
 
#------------------------------------------------------------------------------  
# AUTOVACUUM PARAMETERS  
#------------------------------------------------------------------------------  
 
#autovacuum = on # Enable autovacuum subprocess? 'on'  
# requires track_counts to also be on.  
#log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and  
# their durations, > 0 logs only  
# actions running at least this number  
# of milliseconds.  
#autovacuum_max_workers = 3 # max number of autovacuum subprocesses  
#autovacuum_naptime = 1min # time between autovacuum runs  
#autovacuum_vacuum_threshold = 50 # min number of row updates before  
# vacuum  
#autovacuum_analyze_threshold = 50 # min number of row updates before  
# analyze  
#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum  
#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze  
#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum  
# (change requires restart)  
#autovacuum_vacuum_cost_delay = 20ms # default vacuum cost delay for  
# autovacuum, in milliseconds;  
# -1 means use vacuum_cost_delay  
#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for  
# autovacuum, -1 means use  
# vacuum_cost_limit  
 
 
#------------------------------------------------------------------------------  
# CLIENT CONNECTION DEFAULTS  
#------------------------------------------------------------------------------  
 
# - Statement Behavior -  
 
#search_path = '"$user",public' # schema names  
#default_tablespace = '' # a tablespace name, '' uses the default  
#temp_tablespaces = '' # a list of tablespace names, '' uses  
# only default tablespace  
#check_function_bodies = on  
#default_transaction_isolation = 'read committed'  
#default_transaction_read_only = off  
#session_replication_role = 'origin'  
#statement_timeout = 0 # in milliseconds, 0 is disabled  
#vacuum_freeze_min_age = 50000000  
#vacuum_freeze_table_age = 150000000  
#xmlbinary = 'base64'  
#xmloption = 'content'  
 
# - Locale and Formatting -  
 
datestyle = 'iso, mdy'  
#intervalstyle = 'postgres'  
#timezone = unknown # actually, defaults to TZ environment  
# setting  
#timezone_abbreviations = 'Default' # Select the set of available time zone  
# abbreviations. Currently, there are  
# Default  
# Australia  
# India  
# You can create your own file in  
# share/timezonesets/.  
#extra_float_digits = 0 # min -15, max 2  
#client_encoding = sql_ascii # actually, defaults to database  
# encoding  
 
# These settings are initialized by initdb, but they can be changed.  
lc_messages = 'en_US.UTF-8' # locale for system error message  
# strings  
lc_monetary = 'en_US.UTF-8' # locale for monetary formatting  
lc_numeric = 'en_US.UTF-8' # locale for number formatting  
lc_time = 'en_US.UTF-8' # locale for time formatting  
 
# default configuration for text search  
default_text_search_config = 'pg_catalog.english'  
 
# - Other Defaults -  
 
#dynamic_library_path = '$libdir'  
#local_preload_libraries = ''  
 
 
#------------------------------------------------------------------------------  
# LOCK MANAGEMENT  
#------------------------------------------------------------------------------  
 
#deadlock_timeout = 1s  
#max_locks_per_transaction = 64 # min 10  
# (change requires restart)  
# Note: Each lock table slot uses ~270 bytes of shared memory, and there are  
# max_locks_per_transaction * (max_connections + max_prepared_transactions)  
# lock table slots.  
 
 
#------------------------------------------------------------------------------  
# VERSION/PLATFORM COMPATIBILITY  
#------------------------------------------------------------------------------  
 
# - Previous PostgreSQL Versions -  
 
#add_missing_from = off  
#array_nulls = on  
#backslash_quote = safe_encoding # on, off, or safe_encoding  
#default_with_oids = off  
#escape_string_warning = on  
#regex_flavor = advanced # advanced, extended, or basic  
#sql_inheritance = on  
#standard_conforming_strings = off  
#synchronize_seqscans = on  
 
# - Other Platforms and Clients -  
 
#transform_null_equals = off  
 
 
#------------------------------------------------------------------------------  
# CUSTOMIZED OPTIONS  
#------------------------------------------------------------------------------  
 
#custom_variable_classes = '' # list of custom variable class names  
 
file:a/aws/rc.local (deleted)
#!/bin/sh  
#  
# This script will be executed *after* all the other init scripts.  
# You can put your own initialization stuff in here if you don't  
# want to do the full Sys V style init stuff.  
 
touch /var/lock/subsys/local  
cd /tmp  
rm -rfv busui  
git clone http://maxious.lambdacomplex.org/busui/git  
sh busui/aws/awsStartup.sh  
 
 
 
file:a/aws/transitdata.sql (deleted)
--  
-- PostgreSQL database dump  
--  
 
-- Dumped from database version 9.0.4  
-- Dumped by pg_dump version 9.0.4  
-- Started on 2011-10-11 23:16:11  
 
SET statement_timeout = 0;  
SET client_encoding = 'UTF8';  
SET standard_conforming_strings = off;  
SET check_function_bodies = false;  
SET client_min_messages = warning;  
SET escape_string_warning = off;  
 
--  
-- TOC entry 1168 (class 2612 OID 11574)  
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres  
--  
 
CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql;  
 
 
ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;  
 
SET search_path = public, pg_catalog;  
 
--  
-- TOC entry 1088 (class 0 OID 0)  
-- Name: box2d; Type: SHELL TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE box2d;  
 
 
--  
-- TOC entry 15 (class 1255 OID 18351)  
-- Dependencies: 6 1088  
-- Name: box2d_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box2d_in(cstring) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_in';  
 
 
ALTER FUNCTION public.box2d_in(cstring) OWNER TO postgres;  
 
--  
-- TOC entry 19 (class 1255 OID 18352)  
-- Dependencies: 6 1088  
-- Name: box2d_out(box2d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box2d_out(box2d) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_out';  
 
 
ALTER FUNCTION public.box2d_out(box2d) OWNER TO postgres;  
 
--  
-- TOC entry 1087 (class 1247 OID 18350)  
-- Dependencies: 6 15 19  
-- Name: box2d; Type: TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE box2d (  
INTERNALLENGTH = 16,  
INPUT = box2d_in,  
OUTPUT = box2d_out,  
ALIGNMENT = int4,  
STORAGE = plain  
);  
 
 
ALTER TYPE public.box2d OWNER TO postgres;  
 
--  
-- TOC entry 1091 (class 0 OID 0)  
-- Name: box3d; Type: SHELL TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE box3d;  
 
 
--  
-- TOC entry 20 (class 1255 OID 18355)  
-- Dependencies: 6 1091  
-- Name: box3d_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box3d_in(cstring) RETURNS box3d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_in';  
 
 
ALTER FUNCTION public.box3d_in(cstring) OWNER TO postgres;  
 
--  
-- TOC entry 21 (class 1255 OID 18356)  
-- Dependencies: 6 1091  
-- Name: box3d_out(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box3d_out(box3d) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_out';  
 
 
ALTER FUNCTION public.box3d_out(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 1090 (class 1247 OID 18354)  
-- Dependencies: 6 21 20  
-- Name: box3d; Type: TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE box3d (  
INTERNALLENGTH = 48,  
INPUT = box3d_in,  
OUTPUT = box3d_out,  
ALIGNMENT = double,  
STORAGE = plain  
);  
 
 
ALTER TYPE public.box3d OWNER TO postgres;  
 
--  
-- TOC entry 1094 (class 0 OID 0)  
-- Name: box3d_extent; Type: SHELL TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE box3d_extent;  
 
 
--  
-- TOC entry 22 (class 1255 OID 18359)  
-- Dependencies: 6 1094  
-- Name: box3d_extent_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box3d_extent_in(cstring) RETURNS box3d_extent  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_in';  
 
 
ALTER FUNCTION public.box3d_extent_in(cstring) OWNER TO postgres;  
 
--  
-- TOC entry 23 (class 1255 OID 18360)  
-- Dependencies: 6 1094  
-- Name: box3d_extent_out(box3d_extent); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box3d_extent_out(box3d_extent) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_extent_out';  
 
 
ALTER FUNCTION public.box3d_extent_out(box3d_extent) OWNER TO postgres;  
 
--  
-- TOC entry 1093 (class 1247 OID 18358)  
-- Dependencies: 6 23 22  
-- Name: box3d_extent; Type: TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE box3d_extent (  
INTERNALLENGTH = 48,  
INPUT = box3d_extent_in,  
OUTPUT = box3d_extent_out,  
ALIGNMENT = double,  
STORAGE = plain  
);  
 
 
ALTER TYPE public.box3d_extent OWNER TO postgres;  
 
--  
-- TOC entry 1097 (class 0 OID 0)  
-- Name: chip; Type: SHELL TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE chip;  
 
 
--  
-- TOC entry 24 (class 1255 OID 18363)  
-- Dependencies: 6 1097  
-- Name: chip_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION chip_in(cstring) RETURNS chip  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_in';  
 
 
ALTER FUNCTION public.chip_in(cstring) OWNER TO postgres;  
 
--  
-- TOC entry 25 (class 1255 OID 18364)  
-- Dependencies: 6 1097  
-- Name: chip_out(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION chip_out(chip) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_out';  
 
 
ALTER FUNCTION public.chip_out(chip) OWNER TO postgres;  
 
--  
-- TOC entry 1096 (class 1247 OID 18362)  
-- Dependencies: 6 25 24  
-- Name: chip; Type: TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE chip (  
INTERNALLENGTH = variable,  
INPUT = chip_in,  
OUTPUT = chip_out,  
ALIGNMENT = double,  
STORAGE = extended  
);  
 
 
ALTER TYPE public.chip OWNER TO postgres;  
 
--  
-- TOC entry 1100 (class 0 OID 0)  
-- Name: geography; Type: SHELL TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE geography;  
 
 
--  
-- TOC entry 26 (class 1255 OID 18367)  
-- Dependencies: 6  
-- Name: geography_analyze(internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_analyze(internal) RETURNS boolean  
LANGUAGE c STRICT  
AS '$libdir/postgis-1.5', 'geography_analyze';  
 
 
ALTER FUNCTION public.geography_analyze(internal) OWNER TO postgres;  
 
--  
-- TOC entry 27 (class 1255 OID 18368)  
-- Dependencies: 6 1100  
-- Name: geography_in(cstring, oid, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_in(cstring, oid, integer) RETURNS geography  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_in';  
 
 
ALTER FUNCTION public.geography_in(cstring, oid, integer) OWNER TO postgres;  
 
--  
-- TOC entry 28 (class 1255 OID 18369)  
-- Dependencies: 6 1100  
-- Name: geography_out(geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_out(geography) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_out';  
 
 
ALTER FUNCTION public.geography_out(geography) OWNER TO postgres;  
 
--  
-- TOC entry 29 (class 1255 OID 18370)  
-- Dependencies: 6  
-- Name: geography_typmod_in(cstring[]); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_typmod_in(cstring[]) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_typmod_in';  
 
 
ALTER FUNCTION public.geography_typmod_in(cstring[]) OWNER TO postgres;  
 
--  
-- TOC entry 30 (class 1255 OID 18371)  
-- Dependencies: 6  
-- Name: geography_typmod_out(integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_typmod_out(integer) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_typmod_out';  
 
 
ALTER FUNCTION public.geography_typmod_out(integer) OWNER TO postgres;  
 
--  
-- TOC entry 1099 (class 1247 OID 18366)  
-- Dependencies: 26 6 27 28 29 30  
-- Name: geography; Type: TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE geography (  
INTERNALLENGTH = variable,  
INPUT = geography_in,  
OUTPUT = geography_out,  
TYPMOD_IN = geography_typmod_in,  
TYPMOD_OUT = geography_typmod_out,  
ANALYZE = geography_analyze,  
ALIGNMENT = double,  
STORAGE = main  
);  
 
 
ALTER TYPE public.geography OWNER TO postgres;  
 
--  
-- TOC entry 1103 (class 0 OID 0)  
-- Name: geometry; Type: SHELL TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE geometry;  
 
 
--  
-- TOC entry 31 (class 1255 OID 18374)  
-- Dependencies: 6  
-- Name: geometry_analyze(internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_analyze(internal) RETURNS boolean  
LANGUAGE c STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_analyze';  
 
 
ALTER FUNCTION public.geometry_analyze(internal) OWNER TO postgres;  
 
--  
-- TOC entry 32 (class 1255 OID 18375)  
-- Dependencies: 6 1103  
-- Name: geometry_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_in(cstring) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_in';  
 
 
ALTER FUNCTION public.geometry_in(cstring) OWNER TO postgres;  
 
--  
-- TOC entry 33 (class 1255 OID 18376)  
-- Dependencies: 6 1103  
-- Name: geometry_out(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_out(geometry) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_out';  
 
 
ALTER FUNCTION public.geometry_out(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 34 (class 1255 OID 18377)  
-- Dependencies: 6 1103  
-- Name: geometry_recv(internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_recv(internal) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_recv';  
 
 
ALTER FUNCTION public.geometry_recv(internal) OWNER TO postgres;  
 
--  
-- TOC entry 35 (class 1255 OID 18378)  
-- Dependencies: 6 1103  
-- Name: geometry_send(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_send(geometry) RETURNS bytea  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_send';  
 
 
ALTER FUNCTION public.geometry_send(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1102 (class 1247 OID 18373)  
-- Dependencies: 33 34 35 31 6 32  
-- Name: geometry; Type: TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE geometry (  
INTERNALLENGTH = variable,  
INPUT = geometry_in,  
OUTPUT = geometry_out,  
RECEIVE = geometry_recv,  
SEND = geometry_send,  
ANALYZE = geometry_analyze,  
DELIMITER = ':',  
ALIGNMENT = int4,  
STORAGE = main  
);  
 
 
ALTER TYPE public.geometry OWNER TO postgres;  
 
--  
-- TOC entry 1105 (class 1247 OID 18382)  
-- Dependencies: 6 2408  
-- Name: geometry_dump; Type: TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE geometry_dump AS (  
path integer[],  
geom geometry  
);  
 
 
ALTER TYPE public.geometry_dump OWNER TO postgres;  
 
--  
-- TOC entry 1108 (class 0 OID 0)  
-- Name: gidx; Type: SHELL TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE gidx;  
 
 
--  
-- TOC entry 36 (class 1255 OID 18384)  
-- Dependencies: 6 1108  
-- Name: gidx_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION gidx_in(cstring) RETURNS gidx  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'gidx_in';  
 
 
ALTER FUNCTION public.gidx_in(cstring) OWNER TO postgres;  
 
--  
-- TOC entry 37 (class 1255 OID 18385)  
-- Dependencies: 6 1108  
-- Name: gidx_out(gidx); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION gidx_out(gidx) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'gidx_out';  
 
 
ALTER FUNCTION public.gidx_out(gidx) OWNER TO postgres;  
 
--  
-- TOC entry 1107 (class 1247 OID 18383)  
-- Dependencies: 37 36 6  
-- Name: gidx; Type: TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE gidx (  
INTERNALLENGTH = variable,  
INPUT = gidx_in,  
OUTPUT = gidx_out,  
ALIGNMENT = double,  
STORAGE = plain  
);  
 
 
ALTER TYPE public.gidx OWNER TO postgres;  
 
--  
-- TOC entry 1111 (class 0 OID 0)  
-- Name: pgis_abs; Type: SHELL TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE pgis_abs;  
 
 
--  
-- TOC entry 38 (class 1255 OID 18388)  
-- Dependencies: 6 1111  
-- Name: pgis_abs_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION pgis_abs_in(cstring) RETURNS pgis_abs  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'pgis_abs_in';  
 
 
ALTER FUNCTION public.pgis_abs_in(cstring) OWNER TO postgres;  
 
--  
-- TOC entry 39 (class 1255 OID 18389)  
-- Dependencies: 6 1111  
-- Name: pgis_abs_out(pgis_abs); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION pgis_abs_out(pgis_abs) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'pgis_abs_out';  
 
 
ALTER FUNCTION public.pgis_abs_out(pgis_abs) OWNER TO postgres;  
 
--  
-- TOC entry 1110 (class 1247 OID 18387)  
-- Dependencies: 38 6 39  
-- Name: pgis_abs; Type: TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE pgis_abs (  
INTERNALLENGTH = 8,  
INPUT = pgis_abs_in,  
OUTPUT = pgis_abs_out,  
ALIGNMENT = double,  
STORAGE = plain  
);  
 
 
ALTER TYPE public.pgis_abs OWNER TO postgres;  
 
--  
-- TOC entry 1114 (class 0 OID 0)  
-- Name: spheroid; Type: SHELL TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE spheroid;  
 
 
--  
-- TOC entry 40 (class 1255 OID 18392)  
-- Dependencies: 6 1114  
-- Name: spheroid_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION spheroid_in(cstring) RETURNS spheroid  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'ellipsoid_in';  
 
 
ALTER FUNCTION public.spheroid_in(cstring) OWNER TO postgres;  
 
--  
-- TOC entry 41 (class 1255 OID 18393)  
-- Dependencies: 6 1114  
-- Name: spheroid_out(spheroid); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION spheroid_out(spheroid) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'ellipsoid_out';  
 
 
ALTER FUNCTION public.spheroid_out(spheroid) OWNER TO postgres;  
 
--  
-- TOC entry 1113 (class 1247 OID 18391)  
-- Dependencies: 41 6 40  
-- Name: spheroid; Type: TYPE; Schema: public; Owner: postgres  
--  
 
CREATE TYPE spheroid (  
INTERNALLENGTH = 65,  
INPUT = spheroid_in,  
OUTPUT = spheroid_out,  
ALIGNMENT = double,  
STORAGE = plain  
);  
 
 
ALTER TYPE public.spheroid OWNER TO postgres;  
 
--  
-- TOC entry 42 (class 1255 OID 18395)  
-- Dependencies: 6 1102  
-- Name: _st_asgeojson(integer, geometry, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_asgeojson(integer, geometry, integer, integer) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asGeoJson';  
 
 
ALTER FUNCTION public._st_asgeojson(integer, geometry, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 43 (class 1255 OID 18396)  
-- Dependencies: 6 1099  
-- Name: _st_asgeojson(integer, geography, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_asgeojson(integer, geography, integer, integer) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_as_geojson';  
 
 
ALTER FUNCTION public._st_asgeojson(integer, geography, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 44 (class 1255 OID 18397)  
-- Dependencies: 6 1102  
-- Name: _st_asgml(integer, geometry, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_asgml(integer, geometry, integer, integer) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asGML';  
 
 
ALTER FUNCTION public._st_asgml(integer, geometry, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 45 (class 1255 OID 18398)  
-- Dependencies: 6 1099  
-- Name: _st_asgml(integer, geography, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_asgml(integer, geography, integer, integer) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_as_gml';  
 
 
ALTER FUNCTION public._st_asgml(integer, geography, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 46 (class 1255 OID 18399)  
-- Dependencies: 1102 6  
-- Name: _st_askml(integer, geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_askml(integer, geometry, integer) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asKML';  
 
 
ALTER FUNCTION public._st_askml(integer, geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 47 (class 1255 OID 18400)  
-- Dependencies: 6 1099  
-- Name: _st_askml(integer, geography, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_askml(integer, geography, integer) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_as_kml';  
 
 
ALTER FUNCTION public._st_askml(integer, geography, integer) OWNER TO postgres;  
 
--  
-- TOC entry 49 (class 1255 OID 18402)  
-- Dependencies: 1099 6  
-- Name: _st_bestsrid(geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_bestsrid(geography) RETURNS integer  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_BestSRID($1,$1)$_$;  
 
 
ALTER FUNCTION public._st_bestsrid(geography) OWNER TO postgres;  
 
--  
-- TOC entry 48 (class 1255 OID 18401)  
-- Dependencies: 6 1099 1099  
-- Name: _st_bestsrid(geography, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_bestsrid(geography, geography) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_bestsrid';  
 
 
ALTER FUNCTION public._st_bestsrid(geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 50 (class 1255 OID 18403)  
-- Dependencies: 1102 6 1102  
-- Name: _st_buffer(geometry, double precision, cstring); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_buffer(geometry, double precision, cstring) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'buffer';  
 
 
ALTER FUNCTION public._st_buffer(geometry, double precision, cstring) OWNER TO postgres;  
 
--  
-- TOC entry 51 (class 1255 OID 18404)  
-- Dependencies: 6 1102 1102  
-- Name: _st_contains(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_contains(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'contains';  
 
 
ALTER FUNCTION public._st_contains(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 52 (class 1255 OID 18405)  
-- Dependencies: 6 1102 1102  
-- Name: _st_containsproperly(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_containsproperly(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'containsproperly';  
 
 
ALTER FUNCTION public._st_containsproperly(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 53 (class 1255 OID 18406)  
-- Dependencies: 6 1102 1102  
-- Name: _st_coveredby(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_coveredby(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'coveredby';  
 
 
ALTER FUNCTION public._st_coveredby(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 54 (class 1255 OID 18407)  
-- Dependencies: 1102 1102 6  
-- Name: _st_covers(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_covers(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'covers';  
 
 
ALTER FUNCTION public._st_covers(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 55 (class 1255 OID 18408)  
-- Dependencies: 1099 1099 6  
-- Name: _st_covers(geography, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_covers(geography, geography) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'geography_covers';  
 
 
ALTER FUNCTION public._st_covers(geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 56 (class 1255 OID 18409)  
-- Dependencies: 1102 1102 6  
-- Name: _st_crosses(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_crosses(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'crosses';  
 
 
ALTER FUNCTION public._st_crosses(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 57 (class 1255 OID 18410)  
-- Dependencies: 1102 6 1102  
-- Name: _st_dfullywithin(geometry, geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_dfullywithin(geometry, geometry, double precision) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_dfullywithin';  
 
 
ALTER FUNCTION public._st_dfullywithin(geometry, geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 58 (class 1255 OID 18411)  
-- Dependencies: 1099 6 1099  
-- Name: _st_distance(geography, geography, double precision, boolean); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_distance(geography, geography, double precision, boolean) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'geography_distance';  
 
 
ALTER FUNCTION public._st_distance(geography, geography, double precision, boolean) OWNER TO postgres;  
 
--  
-- TOC entry 59 (class 1255 OID 18412)  
-- Dependencies: 6 1168 1105 1102  
-- Name: _st_dumppoints(geometry, integer[]); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_dumppoints(the_geom geometry, cur_path integer[]) RETURNS SETOF geometry_dump  
LANGUAGE plpgsql  
AS $$  
DECLARE  
tmp geometry_dump;  
tmp2 geometry_dump;  
nb_points integer;  
nb_geom integer;  
i integer;  
j integer;  
g geometry;  
 
BEGIN  
 
RAISE DEBUG '%,%', cur_path, ST_GeometryType(the_geom);  
 
-- Special case (MULTI* OR GEOMETRYCOLLECTION) : iterate and return the DumpPoints of the geometries  
SELECT ST_NumGeometries(the_geom) INTO nb_geom;  
 
IF (nb_geom IS NOT NULL) THEN  
 
i = 1;  
FOR tmp2 IN SELECT (ST_Dump(the_geom)).* LOOP  
 
FOR tmp IN SELECT * FROM _ST_DumpPoints(tmp2.geom, cur_path || tmp2.path) LOOP  
RETURN NEXT tmp;  
END LOOP;  
i = i + 1;  
 
END LOOP;  
 
RETURN;  
END IF;  
 
 
-- Special case (POLYGON) : return the points of the rings of a polygon  
IF (ST_GeometryType(the_geom) = 'ST_Polygon') THEN  
 
FOR tmp IN SELECT * FROM _ST_DumpPoints(ST_ExteriorRing(the_geom), cur_path || ARRAY[1]) LOOP  
RETURN NEXT tmp;  
END LOOP;  
 
j := ST_NumInteriorRings(the_geom);  
FOR i IN 1..j LOOP  
FOR tmp IN SELECT * FROM _ST_DumpPoints(ST_InteriorRingN(the_geom, i), cur_path || ARRAY[i+1]) LOOP  
RETURN NEXT tmp;  
END LOOP;  
END LOOP;  
 
RETURN;  
END IF;  
 
 
-- Special case (POINT) : return the point  
IF (ST_GeometryType(the_geom) = 'ST_Point') THEN  
 
tmp.path = cur_path || ARRAY[1];  
tmp.geom = the_geom;  
 
RETURN NEXT tmp;  
RETURN;  
 
END IF;  
 
 
-- Use ST_NumPoints rather than ST_NPoints to have a NULL value if the_geom isn't  
-- a LINESTRING or CIRCULARSTRING.  
SELECT ST_NumPoints(the_geom) INTO nb_points;  
 
-- This should never happen  
IF (nb_points IS NULL) THEN  
RAISE EXCEPTION 'Unexpected error while dumping geometry %', ST_AsText(the_geom);  
END IF;  
 
FOR i IN 1..nb_points LOOP  
tmp.path = cur_path || ARRAY[i];  
tmp.geom := ST_PointN(the_geom, i);  
RETURN NEXT tmp;  
END LOOP;  
 
END  
$$;  
 
 
ALTER FUNCTION public._st_dumppoints(the_geom geometry, cur_path integer[]) OWNER TO postgres;  
 
--  
-- TOC entry 60 (class 1255 OID 18413)  
-- Dependencies: 1102 6 1102  
-- Name: _st_dwithin(geometry, geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_dwithin(geometry, geometry, double precision) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_dwithin';  
 
 
ALTER FUNCTION public._st_dwithin(geometry, geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 61 (class 1255 OID 18414)  
-- Dependencies: 1099 6 1099  
-- Name: _st_dwithin(geography, geography, double precision, boolean); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_dwithin(geography, geography, double precision, boolean) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'geography_dwithin';  
 
 
ALTER FUNCTION public._st_dwithin(geography, geography, double precision, boolean) OWNER TO postgres;  
 
--  
-- TOC entry 62 (class 1255 OID 18415)  
-- Dependencies: 1102 6 1102  
-- Name: _st_equals(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_equals(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'geomequals';  
 
 
ALTER FUNCTION public._st_equals(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 63 (class 1255 OID 18416)  
-- Dependencies: 1099 1099 6  
-- Name: _st_expand(geography, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_expand(geography, double precision) RETURNS geography  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_expand';  
 
 
ALTER FUNCTION public._st_expand(geography, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 64 (class 1255 OID 18417)  
-- Dependencies: 6 1102 1102  
-- Name: _st_intersects(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_intersects(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'intersects';  
 
 
ALTER FUNCTION public._st_intersects(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 65 (class 1255 OID 18418)  
-- Dependencies: 6 1102 1102  
-- Name: _st_linecrossingdirection(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_linecrossingdirection(geometry, geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'ST_LineCrossingDirection';  
 
 
ALTER FUNCTION public._st_linecrossingdirection(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 66 (class 1255 OID 18419)  
-- Dependencies: 1102 1102 1102 6  
-- Name: _st_longestline(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_longestline(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_longestline2d';  
 
 
ALTER FUNCTION public._st_longestline(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 67 (class 1255 OID 18420)  
-- Dependencies: 6 1102 1102  
-- Name: _st_maxdistance(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_maxdistance(geometry, geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_maxdistance2d_linestring';  
 
 
ALTER FUNCTION public._st_maxdistance(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 68 (class 1255 OID 18421)  
-- Dependencies: 6 1102 1102  
-- Name: _st_orderingequals(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_orderingequals(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_same';  
 
 
ALTER FUNCTION public._st_orderingequals(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 69 (class 1255 OID 18422)  
-- Dependencies: 1102 1102 6  
-- Name: _st_overlaps(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_overlaps(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'overlaps';  
 
 
ALTER FUNCTION public._st_overlaps(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 70 (class 1255 OID 18423)  
-- Dependencies: 6 1099 1099  
-- Name: _st_pointoutside(geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_pointoutside(geography) RETURNS geography  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_point_outside';  
 
 
ALTER FUNCTION public._st_pointoutside(geography) OWNER TO postgres;  
 
--  
-- TOC entry 71 (class 1255 OID 18424)  
-- Dependencies: 6 1102 1102  
-- Name: _st_touches(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_touches(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'touches';  
 
 
ALTER FUNCTION public._st_touches(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 72 (class 1255 OID 18425)  
-- Dependencies: 6 1102 1102  
-- Name: _st_within(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION _st_within(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'within';  
 
 
ALTER FUNCTION public._st_within(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 73 (class 1255 OID 18426)  
-- Dependencies: 6 1168  
-- Name: addauth(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION addauth(text) RETURNS boolean  
LANGUAGE plpgsql  
AS $_$  
DECLARE  
lockid alias for $1;  
okay boolean;  
myrec record;  
BEGIN  
-- check to see if table exists  
-- if not, CREATE TEMP TABLE mylock (transid xid, lockcode text)  
okay := 'f';  
FOR myrec IN SELECT * FROM pg_class WHERE relname = 'temp_lock_have_table' LOOP  
okay := 't';  
END LOOP;  
IF (okay <> 't') THEN  
CREATE TEMP TABLE temp_lock_have_table (transid xid, lockcode text);  
-- this will only work from pgsql7.4 up  
-- ON COMMIT DELETE ROWS;  
END IF;  
 
-- INSERT INTO mylock VALUES ( $1)  
-- EXECUTE 'INSERT INTO temp_lock_have_table VALUES ( '||  
-- quote_literal(getTransactionID()) || ',' ||  
-- quote_literal(lockid) ||')';  
 
INSERT INTO temp_lock_have_table VALUES (getTransactionID(), lockid);  
 
RETURN true::boolean;  
END;  
$_$;  
 
 
ALTER FUNCTION public.addauth(text) OWNER TO postgres;  
 
--  
-- TOC entry 74 (class 1255 OID 18427)  
-- Dependencies: 6 1102 1102  
-- Name: addbbox(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION addbbox(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_addBBOX';  
 
 
ALTER FUNCTION public.addbbox(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 79 (class 1255 OID 18430)  
-- Dependencies: 6 1168  
-- Name: addgeometrycolumn(character varying, character varying, integer, character varying, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION addgeometrycolumn(character varying, character varying, integer, character varying, integer) RETURNS text  
LANGUAGE plpgsql STRICT  
AS $_$  
DECLARE  
ret text;  
BEGIN  
SELECT AddGeometryColumn('','',$1,$2,$3,$4,$5) into ret;  
RETURN ret;  
END;  
$_$;  
 
 
ALTER FUNCTION public.addgeometrycolumn(character varying, character varying, integer, character varying, integer) OWNER TO postgres;  
 
--  
-- TOC entry 78 (class 1255 OID 18429)  
-- Dependencies: 6 1168  
-- Name: addgeometrycolumn(character varying, character varying, character varying, integer, character varying, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION addgeometrycolumn(character varying, character varying, character varying, integer, character varying, integer) RETURNS text  
LANGUAGE plpgsql STABLE STRICT  
AS $_$  
DECLARE  
ret text;  
BEGIN  
SELECT AddGeometryColumn('',$1,$2,$3,$4,$5,$6) into ret;  
RETURN ret;  
END;  
$_$;  
 
 
ALTER FUNCTION public.addgeometrycolumn(character varying, character varying, character varying, integer, character varying, integer) OWNER TO postgres;  
 
--  
-- TOC entry 77 (class 1255 OID 18428)  
-- Dependencies: 6 1168  
-- Name: addgeometrycolumn(character varying, character varying, character varying, character varying, integer, character varying, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION addgeometrycolumn(character varying, character varying, character varying, character varying, integer, character varying, integer) RETURNS text  
LANGUAGE plpgsql STRICT  
AS $_$  
DECLARE  
catalog_name alias for $1;  
schema_name alias for $2;  
table_name alias for $3;  
column_name alias for $4;  
new_srid alias for $5;  
new_type alias for $6;  
new_dim alias for $7;  
rec RECORD;  
sr varchar;  
real_schema name;  
sql text;  
 
BEGIN  
 
-- Verify geometry type  
IF ( NOT ( (new_type = 'GEOMETRY') OR  
(new_type = 'GEOMETRYCOLLECTION') OR  
(new_type = 'POINT') OR  
(new_type = 'MULTIPOINT') OR  
(new_type = 'POLYGON') OR  
(new_type = 'MULTIPOLYGON') OR  
(new_type = 'LINESTRING') OR  
(new_type = 'MULTILINESTRING') OR  
(new_type = 'GEOMETRYCOLLECTIONM') OR  
(new_type = 'POINTM') OR  
(new_type = 'MULTIPOINTM') OR  
(new_type = 'POLYGONM') OR  
(new_type = 'MULTIPOLYGONM') OR  
(new_type = 'LINESTRINGM') OR  
(new_type = 'MULTILINESTRINGM') OR  
(new_type = 'CIRCULARSTRING') OR  
(new_type = 'CIRCULARSTRINGM') OR  
(new_type = 'COMPOUNDCURVE') OR  
(new_type = 'COMPOUNDCURVEM') OR  
(new_type = 'CURVEPOLYGON') OR  
(new_type = 'CURVEPOLYGONM') OR  
(new_type = 'MULTICURVE') OR  
(new_type = 'MULTICURVEM') OR  
(new_type = 'MULTISURFACE') OR  
(new_type = 'MULTISURFACEM')) )  
THEN  
RAISE EXCEPTION 'Invalid type name - valid ones are:  
POINT, MULTIPOINT,  
LINESTRING, MULTILINESTRING,  
POLYGON, MULTIPOLYGON,  
CIRCULARSTRING, COMPOUNDCURVE, MULTICURVE,  
CURVEPOLYGON, MULTISURFACE,  
GEOMETRY, GEOMETRYCOLLECTION,  
POINTM, MULTIPOINTM,  
LINESTRINGM, MULTILINESTRINGM,  
POLYGONM, MULTIPOLYGONM,  
CIRCULARSTRINGM, COMPOUNDCURVEM, MULTICURVEM  
CURVEPOLYGONM, MULTISURFACEM,  
or GEOMETRYCOLLECTIONM';  
RETURN 'fail';  
END IF;  
 
 
-- Verify dimension  
IF ( (new_dim >4) OR (new_dim <0) ) THEN  
RAISE EXCEPTION 'invalid dimension';  
RETURN 'fail';  
END IF;  
 
IF ( (new_type LIKE '%M') AND (new_dim!=3) ) THEN  
RAISE EXCEPTION 'TypeM needs 3 dimensions';  
RETURN 'fail';  
END IF;  
 
 
-- Verify SRID  
IF ( new_srid != -1 ) THEN  
SELECT SRID INTO sr FROM spatial_ref_sys WHERE SRID = new_srid;  
IF NOT FOUND THEN  
RAISE EXCEPTION 'AddGeometryColumns() - invalid SRID';  
RETURN 'fail';  
END IF;  
END IF;  
 
 
-- Verify schema  
IF ( schema_name IS NOT NULL AND schema_name != '' ) THEN  
sql := 'SELECT nspname FROM pg_namespace ' ||  
'WHERE text(nspname) = ' || quote_literal(schema_name) ||  
'LIMIT 1';  
RAISE DEBUG '%', sql;  
EXECUTE sql INTO real_schema;  
 
IF ( real_schema IS NULL ) THEN  
RAISE EXCEPTION 'Schema % is not a valid schemaname', quote_literal(schema_name);  
RETURN 'fail';  
END IF;  
END IF;  
 
IF ( real_schema IS NULL ) THEN  
RAISE DEBUG 'Detecting schema';  
sql := 'SELECT n.nspname AS schemaname ' ||  
'FROM pg_catalog.pg_class c ' ||  
'JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace ' ||  
'WHERE c.relkind = ' || quote_literal('r') ||  
' AND n.nspname NOT IN (' || quote_literal('pg_catalog') || ', ' || quote_literal('pg_toast') || ')' ||  
' AND pg_catalog.pg_table_is_visible(c.oid)' ||  
' AND c.relname = ' || quote_literal(table_name);  
RAISE DEBUG '%', sql;  
EXECUTE sql INTO real_schema;  
 
IF ( real_schema IS NULL ) THEN  
RAISE EXCEPTION 'Table % does not occur in the search_path', quote_literal(table_name);  
RETURN 'fail';  
END IF;  
END IF;  
 
 
-- Add geometry column to table  
sql := 'ALTER TABLE ' ||  
quote_ident(real_schema) || '.' || quote_ident(table_name)  
|| ' ADD COLUMN ' || quote_ident(column_name) ||  
' geometry ';  
RAISE DEBUG '%', sql;  
EXECUTE sql;  
 
 
-- Delete stale record in geometry_columns (if any)  
sql := 'DELETE FROM geometry_columns WHERE  
f_table_catalog = ' || quote_literal('') ||  
' AND f_table_schema = ' ||  
quote_literal(real_schema) ||  
' AND f_table_name = ' || quote_literal(table_name) ||  
' AND f_geometry_column = ' || quote_literal(column_name);  
RAISE DEBUG '%', sql;  
EXECUTE sql;  
 
 
-- Add record in geometry_columns  
sql := 'INSERT INTO geometry_columns (f_table_catalog,f_table_schema,f_table_name,' ||  
'f_geometry_column,coord_dimension,srid,type)' ||  
' VALUES (' ||  
quote_literal('') || ',' ||  
quote_literal(real_schema) || ',' ||  
quote_literal(table_name) || ',' ||  
quote_literal(column_name) || ',' ||  
new_dim::text || ',' ||  
new_srid::text || ',' ||  
quote_literal(new_type) || ')';  
RAISE DEBUG '%', sql;  
EXECUTE sql;  
 
 
-- Add table CHECKs  
sql := 'ALTER TABLE ' ||  
quote_ident(real_schema) || '.' || quote_ident(table_name)  
|| ' ADD CONSTRAINT '  
|| quote_ident('enforce_srid_' || column_name)  
|| ' CHECK (ST_SRID(' || quote_ident(column_name) ||  
') = ' || new_srid::text || ')' ;  
RAISE DEBUG '%', sql;  
EXECUTE sql;  
 
sql := 'ALTER TABLE ' ||  
quote_ident(real_schema) || '.' || quote_ident(table_name)  
|| ' ADD CONSTRAINT '  
|| quote_ident('enforce_dims_' || column_name)  
|| ' CHECK (ST_NDims(' || quote_ident(column_name) ||  
') = ' || new_dim::text || ')' ;  
RAISE DEBUG '%', sql;  
EXECUTE sql;  
 
IF ( NOT (new_type = 'GEOMETRY')) THEN  
sql := 'ALTER TABLE ' ||  
quote_ident(real_schema) || '.' || quote_ident(table_name) || ' ADD CONSTRAINT ' ||  
quote_ident('enforce_geotype_' || column_name) ||  
' CHECK (GeometryType(' ||  
quote_ident(column_name) || ')=' ||  
quote_literal(new_type) || ' OR (' ||  
quote_ident(column_name) || ') is null)';  
RAISE DEBUG '%', sql;  
EXECUTE sql;  
END IF;  
 
RETURN  
real_schema || '.' ||  
table_name || '.' || column_name ||  
' SRID:' || new_srid::text ||  
' TYPE:' || new_type ||  
' DIMS:' || new_dim::text || ' ';  
END;  
$_$;  
 
 
ALTER FUNCTION public.addgeometrycolumn(character varying, character varying, character varying, character varying, integer, character varying, integer) OWNER TO postgres;  
 
--  
-- TOC entry 80 (class 1255 OID 18431)  
-- Dependencies: 6 1102 1102 1102  
-- Name: addpoint(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION addpoint(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_addpoint';  
 
 
ALTER FUNCTION public.addpoint(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 81 (class 1255 OID 18432)  
-- Dependencies: 6 1102 1102 1102  
-- Name: addpoint(geometry, geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION addpoint(geometry, geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_addpoint';  
 
 
ALTER FUNCTION public.addpoint(geometry, geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 83 (class 1255 OID 18434)  
-- Dependencies: 1102 6 1102  
-- Name: affine(geometry, double precision, double precision, double precision, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION affine(geometry, double precision, double precision, double precision, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT affine($1, $2, $3, 0, $4, $5, 0, 0, 0, 1, $6, $7, 0)$_$;  
 
 
ALTER FUNCTION public.affine(geometry, double precision, double precision, double precision, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 82 (class 1255 OID 18433)  
-- Dependencies: 1102 1102 6  
-- Name: affine(geometry, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION affine(geometry, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_affine';  
 
 
ALTER FUNCTION public.affine(geometry, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 84 (class 1255 OID 18435)  
-- Dependencies: 1102 6  
-- Name: area(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION area(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_area_polygon';  
 
 
ALTER FUNCTION public.area(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 85 (class 1255 OID 18436)  
-- Dependencies: 1102 6  
-- Name: area2d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION area2d(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_area_polygon';  
 
 
ALTER FUNCTION public.area2d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 86 (class 1255 OID 18437)  
-- Dependencies: 1102 6  
-- Name: asbinary(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION asbinary(geometry) RETURNS bytea  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asBinary';  
 
 
ALTER FUNCTION public.asbinary(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 87 (class 1255 OID 18438)  
-- Dependencies: 1102 6  
-- Name: asbinary(geometry, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION asbinary(geometry, text) RETURNS bytea  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asBinary';  
 
 
ALTER FUNCTION public.asbinary(geometry, text) OWNER TO postgres;  
 
--  
-- TOC entry 88 (class 1255 OID 18439)  
-- Dependencies: 6 1102  
-- Name: asewkb(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION asewkb(geometry) RETURNS bytea  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'WKBFromLWGEOM';  
 
 
ALTER FUNCTION public.asewkb(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 89 (class 1255 OID 18440)  
-- Dependencies: 1102 6  
-- Name: asewkb(geometry, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION asewkb(geometry, text) RETURNS bytea  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'WKBFromLWGEOM';  
 
 
ALTER FUNCTION public.asewkb(geometry, text) OWNER TO postgres;  
 
--  
-- TOC entry 90 (class 1255 OID 18441)  
-- Dependencies: 1102 6  
-- Name: asewkt(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION asewkt(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asEWKT';  
 
 
ALTER FUNCTION public.asewkt(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 92 (class 1255 OID 18443)  
-- Dependencies: 6 1102  
-- Name: asgml(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION asgml(geometry) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGML(2, $1, 15, 0)$_$;  
 
 
ALTER FUNCTION public.asgml(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 91 (class 1255 OID 18442)  
-- Dependencies: 1102 6  
-- Name: asgml(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION asgml(geometry, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGML(2, $1, $2, 0)$_$;  
 
 
ALTER FUNCTION public.asgml(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 93 (class 1255 OID 18444)  
-- Dependencies: 6 1102  
-- Name: ashexewkb(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION ashexewkb(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asHEXEWKB';  
 
 
ALTER FUNCTION public.ashexewkb(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 94 (class 1255 OID 18445)  
-- Dependencies: 1102 6  
-- Name: ashexewkb(geometry, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION ashexewkb(geometry, text) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asHEXEWKB';  
 
 
ALTER FUNCTION public.ashexewkb(geometry, text) OWNER TO postgres;  
 
--  
-- TOC entry 96 (class 1255 OID 18447)  
-- Dependencies: 1102 6  
-- Name: askml(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION askml(geometry) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsKML(2, transform($1,4326), 15)$_$;  
 
 
ALTER FUNCTION public.askml(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 95 (class 1255 OID 18446)  
-- Dependencies: 1102 6  
-- Name: askml(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION askml(geometry, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsKML(2, transform($1,4326), $2)$_$;  
 
 
ALTER FUNCTION public.askml(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 97 (class 1255 OID 18448)  
-- Dependencies: 6 1102  
-- Name: askml(integer, geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION askml(integer, geometry, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsKML($1, transform($2,4326), $3)$_$;  
 
 
ALTER FUNCTION public.askml(integer, geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 100 (class 1255 OID 18451)  
-- Dependencies: 6 1102  
-- Name: assvg(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION assvg(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'assvg_geometry';  
 
 
ALTER FUNCTION public.assvg(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 99 (class 1255 OID 18450)  
-- Dependencies: 6 1102  
-- Name: assvg(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION assvg(geometry, integer) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'assvg_geometry';  
 
 
ALTER FUNCTION public.assvg(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 98 (class 1255 OID 18449)  
-- Dependencies: 6 1102  
-- Name: assvg(geometry, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION assvg(geometry, integer, integer) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'assvg_geometry';  
 
 
ALTER FUNCTION public.assvg(geometry, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 101 (class 1255 OID 18452)  
-- Dependencies: 1102 6  
-- Name: astext(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION astext(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asText';  
 
 
ALTER FUNCTION public.astext(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 102 (class 1255 OID 18453)  
-- Dependencies: 6 1102 1102  
-- Name: azimuth(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION azimuth(geometry, geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_azimuth';  
 
 
ALTER FUNCTION public.azimuth(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 103 (class 1255 OID 18454)  
-- Dependencies: 1102 1168 6  
-- Name: bdmpolyfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION bdmpolyfromtext(text, integer) RETURNS geometry  
LANGUAGE plpgsql IMMUTABLE STRICT  
AS $_$  
DECLARE  
geomtext alias for $1;  
srid alias for $2;  
mline geometry;  
geom geometry;  
BEGIN  
mline := MultiLineStringFromText(geomtext, srid);  
 
IF mline IS NULL  
THEN  
RAISE EXCEPTION 'Input is not a MultiLinestring';  
END IF;  
 
geom := multi(BuildArea(mline));  
 
RETURN geom;  
END;  
$_$;  
 
 
ALTER FUNCTION public.bdmpolyfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 75 (class 1255 OID 18455)  
-- Dependencies: 6 1168 1102  
-- Name: bdpolyfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION bdpolyfromtext(text, integer) RETURNS geometry  
LANGUAGE plpgsql IMMUTABLE STRICT  
AS $_$  
DECLARE  
geomtext alias for $1;  
srid alias for $2;  
mline geometry;  
geom geometry;  
BEGIN  
mline := MultiLineStringFromText(geomtext, srid);  
 
IF mline IS NULL  
THEN  
RAISE EXCEPTION 'Input is not a MultiLinestring';  
END IF;  
 
geom := BuildArea(mline);  
 
IF GeometryType(geom) != 'POLYGON'  
THEN  
RAISE EXCEPTION 'Input returns more then a single polygon, try using BdMPolyFromText instead';  
END IF;  
 
RETURN geom;  
END;  
$_$;  
 
 
ALTER FUNCTION public.bdpolyfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 76 (class 1255 OID 18456)  
-- Dependencies: 6 1102 1102  
-- Name: boundary(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION boundary(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'boundary';  
 
 
ALTER FUNCTION public.boundary(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 104 (class 1255 OID 18457)  
-- Dependencies: 6 1102  
-- Name: box(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box(geometry) RETURNS box  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_to_BOX';  
 
 
ALTER FUNCTION public.box(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 105 (class 1255 OID 18458)  
-- Dependencies: 6 1090  
-- Name: box(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box(box3d) RETURNS box  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_to_BOX';  
 
 
ALTER FUNCTION public.box(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 106 (class 1255 OID 18459)  
-- Dependencies: 6 1087 1093  
-- Name: box2d(box3d_extent); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box2d(box3d_extent) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_to_BOX2DFLOAT4';  
 
 
ALTER FUNCTION public.box2d(box3d_extent) OWNER TO postgres;  
 
--  
-- TOC entry 107 (class 1255 OID 18460)  
-- Dependencies: 6 1087 1102  
-- Name: box2d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box2d(geometry) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_to_BOX2DFLOAT4';  
 
 
ALTER FUNCTION public.box2d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 108 (class 1255 OID 18461)  
-- Dependencies: 1087 1090 6  
-- Name: box2d(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box2d(box3d) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_to_BOX2DFLOAT4';  
 
 
ALTER FUNCTION public.box2d(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 109 (class 1255 OID 18462)  
-- Dependencies: 6 1090 1102  
-- Name: box3d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box3d(geometry) RETURNS box3d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_to_BOX3D';  
 
 
ALTER FUNCTION public.box3d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 110 (class 1255 OID 18463)  
-- Dependencies: 6 1090 1087  
-- Name: box3d(box2d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box3d(box2d) RETURNS box3d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_to_BOX3D';  
 
 
ALTER FUNCTION public.box3d(box2d) OWNER TO postgres;  
 
--  
-- TOC entry 111 (class 1255 OID 18464)  
-- Dependencies: 6 1090 1093  
-- Name: box3d_extent(box3d_extent); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box3d_extent(box3d_extent) RETURNS box3d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_extent_to_BOX3D';  
 
 
ALTER FUNCTION public.box3d_extent(box3d_extent) OWNER TO postgres;  
 
--  
-- TOC entry 112 (class 1255 OID 18465)  
-- Dependencies: 6 1090  
-- Name: box3dtobox(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION box3dtobox(box3d) RETURNS box  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT box($1)$_$;  
 
 
ALTER FUNCTION public.box3dtobox(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 113 (class 1255 OID 18466)  
-- Dependencies: 6 1102 1102  
-- Name: buffer(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION buffer(geometry, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'buffer';  
 
 
ALTER FUNCTION public.buffer(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 114 (class 1255 OID 18467)  
-- Dependencies: 6 1102 1102  
-- Name: buffer(geometry, double precision, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION buffer(geometry, double precision, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT ST_Buffer($1, $2, $3)$_$;  
 
 
ALTER FUNCTION public.buffer(geometry, double precision, integer) OWNER TO postgres;  
 
--  
-- TOC entry 115 (class 1255 OID 18468)  
-- Dependencies: 6 1102 1102  
-- Name: buildarea(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION buildarea(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_buildarea';  
 
 
ALTER FUNCTION public.buildarea(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 116 (class 1255 OID 18469)  
-- Dependencies: 6 1102  
-- Name: bytea(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION bytea(geometry) RETURNS bytea  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_to_bytea';  
 
 
ALTER FUNCTION public.bytea(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 117 (class 1255 OID 18470)  
-- Dependencies: 6 1102 1102  
-- Name: centroid(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION centroid(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'centroid';  
 
 
ALTER FUNCTION public.centroid(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 119 (class 1255 OID 18472)  
-- Dependencies: 6  
-- Name: checkauth(text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION checkauth(text, text) RETURNS integer  
LANGUAGE sql  
AS $_$ SELECT CheckAuth('', $1, $2) $_$;  
 
 
ALTER FUNCTION public.checkauth(text, text) OWNER TO postgres;  
 
--  
-- TOC entry 118 (class 1255 OID 18471)  
-- Dependencies: 6 1168  
-- Name: checkauth(text, text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION checkauth(text, text, text) RETURNS integer  
LANGUAGE plpgsql  
AS $_$  
DECLARE  
schema text;  
BEGIN  
IF NOT LongTransactionsEnabled() THEN  
RAISE EXCEPTION 'Long transaction support disabled, use EnableLongTransaction() to enable.';  
END IF;  
 
if ( $1 != '' ) THEN  
schema = $1;  
ELSE  
SELECT current_schema() into schema;  
END IF;  
 
-- TODO: check for an already existing trigger ?  
 
EXECUTE 'CREATE TRIGGER check_auth BEFORE UPDATE OR DELETE ON '  
|| quote_ident(schema) || '.' || quote_ident($2)  
||' FOR EACH ROW EXECUTE PROCEDURE CheckAuthTrigger('  
|| quote_literal($3) || ')';  
 
RETURN 0;  
END;  
$_$;  
 
 
ALTER FUNCTION public.checkauth(text, text, text) OWNER TO postgres;  
 
--  
-- TOC entry 120 (class 1255 OID 18473)  
-- Dependencies: 6  
-- Name: checkauthtrigger(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION checkauthtrigger() RETURNS trigger  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'check_authorization';  
 
 
ALTER FUNCTION public.checkauthtrigger() OWNER TO postgres;  
 
--  
-- TOC entry 121 (class 1255 OID 18474)  
-- Dependencies: 6 1102 1102 1102  
-- Name: collect(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION collect(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'LWGEOM_collect';  
 
 
ALTER FUNCTION public.collect(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 122 (class 1255 OID 18475)  
-- Dependencies: 6 1087 1087 1102  
-- Name: combine_bbox(box2d, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION combine_bbox(box2d, geometry) RETURNS box2d  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_combine';  
 
 
ALTER FUNCTION public.combine_bbox(box2d, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 123 (class 1255 OID 18476)  
-- Dependencies: 6 1093 1093 1102  
-- Name: combine_bbox(box3d_extent, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION combine_bbox(box3d_extent, geometry) RETURNS box3d_extent  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'BOX3D_combine';  
 
 
ALTER FUNCTION public.combine_bbox(box3d_extent, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 124 (class 1255 OID 18477)  
-- Dependencies: 6 1090 1090 1102  
-- Name: combine_bbox(box3d, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION combine_bbox(box3d, geometry) RETURNS box3d  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'BOX3D_combine';  
 
 
ALTER FUNCTION public.combine_bbox(box3d, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 125 (class 1255 OID 18478)  
-- Dependencies: 6 1096  
-- Name: compression(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION compression(chip) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_getCompression';  
 
 
ALTER FUNCTION public.compression(chip) OWNER TO postgres;  
 
--  
-- TOC entry 126 (class 1255 OID 18479)  
-- Dependencies: 6 1102 1102  
-- Name: contains(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION contains(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'contains';  
 
 
ALTER FUNCTION public.contains(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 127 (class 1255 OID 18480)  
-- Dependencies: 6 1102 1102  
-- Name: convexhull(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION convexhull(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'convexhull';  
 
 
ALTER FUNCTION public.convexhull(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 128 (class 1255 OID 18481)  
-- Dependencies: 6 1102 1102  
-- Name: crosses(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION crosses(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'crosses';  
 
 
ALTER FUNCTION public.crosses(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 129 (class 1255 OID 18482)  
-- Dependencies: 6 1096  
-- Name: datatype(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION datatype(chip) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_getDatatype';  
 
 
ALTER FUNCTION public.datatype(chip) OWNER TO postgres;  
 
--  
-- TOC entry 130 (class 1255 OID 18483)  
-- Dependencies: 6 1102 1102 1102  
-- Name: difference(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION difference(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'difference';  
 
 
ALTER FUNCTION public.difference(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 131 (class 1255 OID 18484)  
-- Dependencies: 6 1102  
-- Name: dimension(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION dimension(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_dimension';  
 
 
ALTER FUNCTION public.dimension(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 132 (class 1255 OID 18485)  
-- Dependencies: 6 1168  
-- Name: disablelongtransactions(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION disablelongtransactions() RETURNS text  
LANGUAGE plpgsql  
AS $$  
DECLARE  
rec RECORD;  
 
BEGIN  
 
--  
-- Drop all triggers applied by CheckAuth()  
--  
FOR rec IN  
SELECT c.relname, t.tgname, t.tgargs FROM pg_trigger t, pg_class c, pg_proc p  
WHERE p.proname = 'checkauthtrigger' and t.tgfoid = p.oid and t.tgrelid = c.oid  
LOOP  
EXECUTE 'DROP TRIGGER ' || quote_ident(rec.tgname) ||  
' ON ' || quote_ident(rec.relname);  
END LOOP;  
 
--  
-- Drop the authorization_table table  
--  
FOR rec IN SELECT * FROM pg_class WHERE relname = 'authorization_table' LOOP  
DROP TABLE authorization_table;  
END LOOP;  
 
--  
-- Drop the authorized_tables view  
--  
FOR rec IN SELECT * FROM pg_class WHERE relname = 'authorized_tables' LOOP  
DROP VIEW authorized_tables;  
END LOOP;  
 
RETURN 'Long transactions support disabled';  
END;  
$$;  
 
 
ALTER FUNCTION public.disablelongtransactions() OWNER TO postgres;  
 
--  
-- TOC entry 133 (class 1255 OID 18486)  
-- Dependencies: 6 1102 1102  
-- Name: disjoint(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION disjoint(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'disjoint';  
 
 
ALTER FUNCTION public.disjoint(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 134 (class 1255 OID 18487)  
-- Dependencies: 6 1102 1102  
-- Name: distance(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION distance(geometry, geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_mindistance2d';  
 
 
ALTER FUNCTION public.distance(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 135 (class 1255 OID 18488)  
-- Dependencies: 6 1102 1102  
-- Name: distance_sphere(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION distance_sphere(geometry, geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_distance_sphere';  
 
 
ALTER FUNCTION public.distance_sphere(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 136 (class 1255 OID 18489)  
-- Dependencies: 6 1102 1102 1113  
-- Name: distance_spheroid(geometry, geometry, spheroid); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION distance_spheroid(geometry, geometry, spheroid) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_distance_ellipsoid';  
 
 
ALTER FUNCTION public.distance_spheroid(geometry, geometry, spheroid) OWNER TO postgres;  
 
--  
-- TOC entry 137 (class 1255 OID 18490)  
-- Dependencies: 6 1102 1102  
-- Name: dropbbox(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION dropbbox(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_dropBBOX';  
 
 
ALTER FUNCTION public.dropbbox(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 140 (class 1255 OID 18493)  
-- Dependencies: 6 1168  
-- Name: dropgeometrycolumn(character varying, character varying); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION dropgeometrycolumn(character varying, character varying) RETURNS text  
LANGUAGE plpgsql STRICT  
AS $_$  
DECLARE  
ret text;  
BEGIN  
SELECT DropGeometryColumn('','',$1,$2) into ret;  
RETURN ret;  
END;  
$_$;  
 
 
ALTER FUNCTION public.dropgeometrycolumn(character varying, character varying) OWNER TO postgres;  
 
--  
-- TOC entry 139 (class 1255 OID 18492)  
-- Dependencies: 6 1168  
-- Name: dropgeometrycolumn(character varying, character varying, character varying); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION dropgeometrycolumn(character varying, character varying, character varying) RETURNS text  
LANGUAGE plpgsql STRICT  
AS $_$  
DECLARE  
ret text;  
BEGIN  
SELECT DropGeometryColumn('',$1,$2,$3) into ret;  
RETURN ret;  
END;  
$_$;  
 
 
ALTER FUNCTION public.dropgeometrycolumn(character varying, character varying, character varying) OWNER TO postgres;  
 
--  
-- TOC entry 138 (class 1255 OID 18491)  
-- Dependencies: 6 1168  
-- Name: dropgeometrycolumn(character varying, character varying, character varying, character varying); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION dropgeometrycolumn(character varying, character varying, character varying, character varying) RETURNS text  
LANGUAGE plpgsql STRICT  
AS $_$  
DECLARE  
catalog_name alias for $1;  
schema_name alias for $2;  
table_name alias for $3;  
column_name alias for $4;  
myrec RECORD;  
okay boolean;  
real_schema name;  
 
BEGIN  
 
 
-- Find, check or fix schema_name  
IF ( schema_name != '' ) THEN  
okay = 'f';  
 
FOR myrec IN SELECT nspname FROM pg_namespace WHERE text(nspname) = schema_name LOOP  
okay := 't';  
END LOOP;  
 
IF ( okay <> 't' ) THEN  
RAISE NOTICE 'Invalid schema name - using current_schema()';  
SELECT current_schema() into real_schema;  
ELSE  
real_schema = schema_name;  
END IF;  
ELSE  
SELECT current_schema() into real_schema;  
END IF;  
 
-- Find out if the column is in the geometry_columns table  
okay = 'f';  
FOR myrec IN SELECT * from geometry_columns where f_table_schema = text(real_schema) and f_table_name = table_name and f_geometry_column = column_name LOOP  
okay := 't';  
END LOOP;  
IF (okay <> 't') THEN  
RAISE EXCEPTION 'column not found in geometry_columns table';  
RETURN 'f';  
END IF;  
 
-- Remove ref from geometry_columns table  
EXECUTE 'delete from geometry_columns where f_table_schema = ' ||  
quote_literal(real_schema) || ' and f_table_name = ' ||  
quote_literal(table_name) || ' and f_geometry_column = ' ||  
quote_literal(column_name);  
 
-- Remove table column  
EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) || '.' ||  
quote_ident(table_name) || ' DROP COLUMN ' ||  
quote_ident(column_name);  
 
RETURN real_schema || '.' || table_name || '.' || column_name ||' effectively removed.';  
 
END;  
$_$;  
 
 
ALTER FUNCTION public.dropgeometrycolumn(character varying, character varying, character varying, character varying) OWNER TO postgres;  
 
--  
-- TOC entry 143 (class 1255 OID 18496)  
-- Dependencies: 6  
-- Name: dropgeometrytable(character varying); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION dropgeometrytable(character varying) RETURNS text  
LANGUAGE sql STRICT  
AS $_$ SELECT DropGeometryTable('','',$1) $_$;  
 
 
ALTER FUNCTION public.dropgeometrytable(character varying) OWNER TO postgres;  
 
--  
-- TOC entry 142 (class 1255 OID 18495)  
-- Dependencies: 6  
-- Name: dropgeometrytable(character varying, character varying); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION dropgeometrytable(character varying, character varying) RETURNS text  
LANGUAGE sql STRICT  
AS $_$ SELECT DropGeometryTable('',$1,$2) $_$;  
 
 
ALTER FUNCTION public.dropgeometrytable(character varying, character varying) OWNER TO postgres;  
 
--  
-- TOC entry 141 (class 1255 OID 18494)  
-- Dependencies: 6 1168  
-- Name: dropgeometrytable(character varying, character varying, character varying); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION dropgeometrytable(character varying, character varying, character varying) RETURNS text  
LANGUAGE plpgsql STRICT  
AS $_$  
DECLARE  
catalog_name alias for $1;  
schema_name alias for $2;  
table_name alias for $3;  
real_schema name;  
 
BEGIN  
 
IF ( schema_name = '' ) THEN  
SELECT current_schema() into real_schema;  
ELSE  
real_schema = schema_name;  
END IF;  
 
-- Remove refs from geometry_columns table  
EXECUTE 'DELETE FROM geometry_columns WHERE ' ||  
'f_table_schema = ' || quote_literal(real_schema) ||  
' AND ' ||  
' f_table_name = ' || quote_literal(table_name);  
 
-- Remove table  
EXECUTE 'DROP TABLE '  
|| quote_ident(real_schema) || '.' ||  
quote_ident(table_name);  
 
RETURN  
real_schema || '.' ||  
table_name ||' dropped.';  
 
END;  
$_$;  
 
 
ALTER FUNCTION public.dropgeometrytable(character varying, character varying, character varying) OWNER TO postgres;  
 
--  
-- TOC entry 144 (class 1255 OID 18497)  
-- Dependencies: 6 1105 1102  
-- Name: dump(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION dump(geometry) RETURNS SETOF geometry_dump  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_dump';  
 
 
ALTER FUNCTION public.dump(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 145 (class 1255 OID 18498)  
-- Dependencies: 6 1105 1102  
-- Name: dumprings(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION dumprings(geometry) RETURNS SETOF geometry_dump  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_dump_rings';  
 
 
ALTER FUNCTION public.dumprings(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 146 (class 1255 OID 18499)  
-- Dependencies: 6 1168  
-- Name: enablelongtransactions(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION enablelongtransactions() RETURNS text  
LANGUAGE plpgsql  
AS $$  
DECLARE  
"query" text;  
exists bool;  
rec RECORD;  
 
BEGIN  
 
exists = 'f';  
FOR rec IN SELECT * FROM pg_class WHERE relname = 'authorization_table'  
LOOP  
exists = 't';  
END LOOP;  
 
IF NOT exists  
THEN  
"query" = 'CREATE TABLE authorization_table (  
toid oid, -- table oid  
rid text, -- row id  
expires timestamp,  
authid text  
)';  
EXECUTE "query";  
END IF;  
 
exists = 'f';  
FOR rec IN SELECT * FROM pg_class WHERE relname = 'authorized_tables'  
LOOP  
exists = 't';  
END LOOP;  
 
IF NOT exists THEN  
"query" = 'CREATE VIEW authorized_tables AS ' ||  
'SELECT ' ||  
'n.nspname as schema, ' ||  
'c.relname as table, trim(' ||  
quote_literal(chr(92) || '000') ||  
' from t.tgargs) as id_column ' ||  
'FROM pg_trigger t, pg_class c, pg_proc p ' ||  
', pg_namespace n ' ||  
'WHERE p.proname = ' || quote_literal('checkauthtrigger') ||  
' AND c.relnamespace = n.oid' ||  
' AND t.tgfoid = p.oid and t.tgrelid = c.oid';  
EXECUTE "query";  
END IF;  
 
RETURN 'Long transactions support enabled';  
END;  
$$;  
 
 
ALTER FUNCTION public.enablelongtransactions() OWNER TO postgres;  
 
--  
-- TOC entry 147 (class 1255 OID 18500)  
-- Dependencies: 6 1102 1102  
-- Name: endpoint(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION endpoint(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_endpoint_linestring';  
 
 
ALTER FUNCTION public.endpoint(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 148 (class 1255 OID 18501)  
-- Dependencies: 6 1102 1102  
-- Name: envelope(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION envelope(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_envelope';  
 
 
ALTER FUNCTION public.envelope(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 149 (class 1255 OID 18502)  
-- Dependencies: 6 1102 1102  
-- Name: equals(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION equals(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geomequals';  
 
 
ALTER FUNCTION public.equals(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 151 (class 1255 OID 18504)  
-- Dependencies: 6 1087  
-- Name: estimated_extent(text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION estimated_extent(text, text) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT SECURITY DEFINER  
AS '$libdir/postgis-1.5', 'LWGEOM_estimated_extent';  
 
 
ALTER FUNCTION public.estimated_extent(text, text) OWNER TO postgres;  
 
--  
-- TOC entry 150 (class 1255 OID 18503)  
-- Dependencies: 6 1087  
-- Name: estimated_extent(text, text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION estimated_extent(text, text, text) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT SECURITY DEFINER  
AS '$libdir/postgis-1.5', 'LWGEOM_estimated_extent';  
 
 
ALTER FUNCTION public.estimated_extent(text, text, text) OWNER TO postgres;  
 
--  
-- TOC entry 152 (class 1255 OID 18505)  
-- Dependencies: 6 1090 1090  
-- Name: expand(box3d, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION expand(box3d, double precision) RETURNS box3d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_expand';  
 
 
ALTER FUNCTION public.expand(box3d, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 153 (class 1255 OID 18506)  
-- Dependencies: 6 1087 1087  
-- Name: expand(box2d, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION expand(box2d, double precision) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_expand';  
 
 
ALTER FUNCTION public.expand(box2d, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 154 (class 1255 OID 18507)  
-- Dependencies: 6 1102 1102  
-- Name: expand(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION expand(geometry, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_expand';  
 
 
ALTER FUNCTION public.expand(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 155 (class 1255 OID 18508)  
-- Dependencies: 6 1102 1102  
-- Name: exteriorring(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION exteriorring(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_exteriorring_polygon';  
 
 
ALTER FUNCTION public.exteriorring(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 156 (class 1255 OID 18509)  
-- Dependencies: 6 1096  
-- Name: factor(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION factor(chip) RETURNS real  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_getFactor';  
 
 
ALTER FUNCTION public.factor(chip) OWNER TO postgres;  
 
--  
-- TOC entry 158 (class 1255 OID 18511)  
-- Dependencies: 6 1168 1087  
-- Name: find_extent(text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION find_extent(text, text) RETURNS box2d  
LANGUAGE plpgsql IMMUTABLE STRICT  
AS $_$  
DECLARE  
tablename alias for $1;  
columnname alias for $2;  
myrec RECORD;  
 
BEGIN  
FOR myrec IN EXECUTE 'SELECT extent("' || columnname || '") FROM "' || tablename || '"' LOOP  
return myrec.extent;  
END LOOP;  
END;  
$_$;  
 
 
ALTER FUNCTION public.find_extent(text, text) OWNER TO postgres;  
 
--  
-- TOC entry 157 (class 1255 OID 18510)  
-- Dependencies: 6 1168 1087  
-- Name: find_extent(text, text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION find_extent(text, text, text) RETURNS box2d  
LANGUAGE plpgsql IMMUTABLE STRICT  
AS $_$  
DECLARE  
schemaname alias for $1;  
tablename alias for $2;  
columnname alias for $3;  
myrec RECORD;  
 
BEGIN  
FOR myrec IN EXECUTE 'SELECT extent("' || columnname || '") FROM "' || schemaname || '"."' || tablename || '"' LOOP  
return myrec.extent;  
END LOOP;  
END;  
$_$;  
 
 
ALTER FUNCTION public.find_extent(text, text, text) OWNER TO postgres;  
 
--  
-- TOC entry 159 (class 1255 OID 18512)  
-- Dependencies: 6 1168  
-- Name: find_srid(character varying, character varying, character varying); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION find_srid(character varying, character varying, character varying) RETURNS integer  
LANGUAGE plpgsql IMMUTABLE STRICT  
AS $_$  
DECLARE  
schem text;  
tabl text;  
sr int4;  
BEGIN  
IF $1 IS NULL THEN  
RAISE EXCEPTION 'find_srid() - schema is NULL!';  
END IF;  
IF $2 IS NULL THEN  
RAISE EXCEPTION 'find_srid() - table name is NULL!';  
END IF;  
IF $3 IS NULL THEN  
RAISE EXCEPTION 'find_srid() - column name is NULL!';  
END IF;  
schem = $1;  
tabl = $2;  
-- if the table contains a . and the schema is empty  
-- split the table into a schema and a table  
-- otherwise drop through to default behavior  
IF ( schem = '' and tabl LIKE '%.%' ) THEN  
schem = substr(tabl,1,strpos(tabl,'.')-1);  
tabl = substr(tabl,length(schem)+2);  
ELSE  
schem = schem || '%';  
END IF;  
 
select SRID into sr from geometry_columns where f_table_schema like schem and f_table_name = tabl and f_geometry_column = $3;  
IF NOT FOUND THEN  
RAISE EXCEPTION 'find_srid() - couldnt find the corresponding SRID - is the geometry registered in the GEOMETRY_COLUMNS table? Is there an uppercase/lowercase missmatch?';  
END IF;  
return sr;  
END;  
$_$;  
 
 
ALTER FUNCTION public.find_srid(character varying, character varying, character varying) OWNER TO postgres;  
 
--  
-- TOC entry 160 (class 1255 OID 18513)  
-- Dependencies: 6 1168  
-- Name: fix_geometry_columns(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION fix_geometry_columns() RETURNS text  
LANGUAGE plpgsql  
AS $$  
DECLARE  
mislinked record;  
result text;  
linked integer;  
deleted integer;  
foundschema integer;  
BEGIN  
 
-- Since 7.3 schema support has been added.  
-- Previous postgis versions used to put the database name in  
-- the schema column. This needs to be fixed, so we try to  
-- set the correct schema for each geometry_colums record  
-- looking at table, column, type and srid.  
UPDATE geometry_columns SET f_table_schema = n.nspname  
FROM pg_namespace n, pg_class c, pg_attribute a,  
pg_constraint sridcheck, pg_constraint typecheck  
WHERE ( f_table_schema is NULL  
OR f_table_schema = ''  
OR f_table_schema NOT IN (  
SELECT nspname::varchar  
FROM pg_namespace nn, pg_class cc, pg_attribute aa  
WHERE cc.relnamespace = nn.oid  
AND cc.relname = f_table_name::name  
AND aa.attrelid = cc.oid  
AND aa.attname = f_geometry_column::name))  
AND f_table_name::name = c.relname  
AND c.oid = a.attrelid  
AND c.relnamespace = n.oid  
AND f_geometry_column::name = a.attname  
 
AND sridcheck.conrelid = c.oid  
AND sridcheck.consrc LIKE '(srid(% = %)'  
AND sridcheck.consrc ~ textcat(' = ', srid::text)  
 
AND typecheck.conrelid = c.oid  
AND typecheck.consrc LIKE  
'((geometrytype(%) = ''%''::text) OR (% IS NULL))'  
AND typecheck.consrc ~ textcat(' = ''', type::text)  
 
AND NOT EXISTS (  
SELECT oid FROM geometry_columns gc  
WHERE c.relname::varchar = gc.f_table_name  
AND n.nspname::varchar = gc.f_table_schema  
AND a.attname::varchar = gc.f_geometry_column  
);  
 
GET DIAGNOSTICS foundschema = ROW_COUNT;  
 
-- no linkage to system table needed  
return 'fixed:'||foundschema::text;  
 
END;  
$$;  
 
 
ALTER FUNCTION public.fix_geometry_columns() OWNER TO postgres;  
 
--  
-- TOC entry 161 (class 1255 OID 18514)  
-- Dependencies: 6 1102 1102  
-- Name: force_2d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION force_2d(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_force_2d';  
 
 
ALTER FUNCTION public.force_2d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 162 (class 1255 OID 18515)  
-- Dependencies: 6 1102 1102  
-- Name: force_3d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION force_3d(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_force_3dz';  
 
 
ALTER FUNCTION public.force_3d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 163 (class 1255 OID 18516)  
-- Dependencies: 6 1102 1102  
-- Name: force_3dm(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION force_3dm(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_force_3dm';  
 
 
ALTER FUNCTION public.force_3dm(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 164 (class 1255 OID 18517)  
-- Dependencies: 6 1102 1102  
-- Name: force_3dz(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION force_3dz(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_force_3dz';  
 
 
ALTER FUNCTION public.force_3dz(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 165 (class 1255 OID 18518)  
-- Dependencies: 6 1102 1102  
-- Name: force_4d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION force_4d(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_force_4d';  
 
 
ALTER FUNCTION public.force_4d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 166 (class 1255 OID 18519)  
-- Dependencies: 6 1102 1102  
-- Name: force_collection(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION force_collection(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_force_collection';  
 
 
ALTER FUNCTION public.force_collection(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 167 (class 1255 OID 18520)  
-- Dependencies: 6 1102 1102  
-- Name: forcerhr(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION forcerhr(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_forceRHR_poly';  
 
 
ALTER FUNCTION public.forcerhr(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 169 (class 1255 OID 18522)  
-- Dependencies: 6 1099 1102  
-- Name: geography(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography(geometry) RETURNS geography  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_from_geometry';  
 
 
ALTER FUNCTION public.geography(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 168 (class 1255 OID 18521)  
-- Dependencies: 6 1099 1099  
-- Name: geography(geography, integer, boolean); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography(geography, integer, boolean) RETURNS geography  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_enforce_typmod';  
 
 
ALTER FUNCTION public.geography(geography, integer, boolean) OWNER TO postgres;  
 
--  
-- TOC entry 170 (class 1255 OID 18523)  
-- Dependencies: 6 1099 1099  
-- Name: geography_cmp(geography, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_cmp(geography, geography) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_cmp';  
 
 
ALTER FUNCTION public.geography_cmp(geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 171 (class 1255 OID 18524)  
-- Dependencies: 6 1099 1099  
-- Name: geography_eq(geography, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_eq(geography, geography) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_eq';  
 
 
ALTER FUNCTION public.geography_eq(geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 172 (class 1255 OID 18525)  
-- Dependencies: 6 1099 1099  
-- Name: geography_ge(geography, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_ge(geography, geography) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_ge';  
 
 
ALTER FUNCTION public.geography_ge(geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 173 (class 1255 OID 18526)  
-- Dependencies: 6  
-- Name: geography_gist_compress(internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_gist_compress(internal) RETURNS internal  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'geography_gist_compress';  
 
 
ALTER FUNCTION public.geography_gist_compress(internal) OWNER TO postgres;  
 
--  
-- TOC entry 174 (class 1255 OID 18527)  
-- Dependencies: 6 1102  
-- Name: geography_gist_consistent(internal, geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_gist_consistent(internal, geometry, integer) RETURNS boolean  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'geography_gist_consistent';  
 
 
ALTER FUNCTION public.geography_gist_consistent(internal, geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 175 (class 1255 OID 18528)  
-- Dependencies: 6  
-- Name: geography_gist_decompress(internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_gist_decompress(internal) RETURNS internal  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'geography_gist_decompress';  
 
 
ALTER FUNCTION public.geography_gist_decompress(internal) OWNER TO postgres;  
 
--  
-- TOC entry 176 (class 1255 OID 18529)  
-- Dependencies: 6  
-- Name: geography_gist_join_selectivity(internal, oid, internal, smallint); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_gist_join_selectivity(internal, oid, internal, smallint) RETURNS double precision  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'geography_gist_join_selectivity';  
 
 
ALTER FUNCTION public.geography_gist_join_selectivity(internal, oid, internal, smallint) OWNER TO postgres;  
 
--  
-- TOC entry 177 (class 1255 OID 18530)  
-- Dependencies: 6  
-- Name: geography_gist_penalty(internal, internal, internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_gist_penalty(internal, internal, internal) RETURNS internal  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'geography_gist_penalty';  
 
 
ALTER FUNCTION public.geography_gist_penalty(internal, internal, internal) OWNER TO postgres;  
 
--  
-- TOC entry 178 (class 1255 OID 18531)  
-- Dependencies: 6  
-- Name: geography_gist_picksplit(internal, internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_gist_picksplit(internal, internal) RETURNS internal  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'geography_gist_picksplit';  
 
 
ALTER FUNCTION public.geography_gist_picksplit(internal, internal) OWNER TO postgres;  
 
--  
-- TOC entry 179 (class 1255 OID 18532)  
-- Dependencies: 6 1087 1087  
-- Name: geography_gist_same(box2d, box2d, internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_gist_same(box2d, box2d, internal) RETURNS internal  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'geography_gist_same';  
 
 
ALTER FUNCTION public.geography_gist_same(box2d, box2d, internal) OWNER TO postgres;  
 
--  
-- TOC entry 180 (class 1255 OID 18533)  
-- Dependencies: 6  
-- Name: geography_gist_selectivity(internal, oid, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_gist_selectivity(internal, oid, internal, integer) RETURNS double precision  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'geography_gist_selectivity';  
 
 
ALTER FUNCTION public.geography_gist_selectivity(internal, oid, internal, integer) OWNER TO postgres;  
 
--  
-- TOC entry 181 (class 1255 OID 18534)  
-- Dependencies: 6  
-- Name: geography_gist_union(bytea, internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_gist_union(bytea, internal) RETURNS internal  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'geography_gist_union';  
 
 
ALTER FUNCTION public.geography_gist_union(bytea, internal) OWNER TO postgres;  
 
--  
-- TOC entry 182 (class 1255 OID 18535)  
-- Dependencies: 6 1099 1099  
-- Name: geography_gt(geography, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_gt(geography, geography) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_gt';  
 
 
ALTER FUNCTION public.geography_gt(geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 183 (class 1255 OID 18536)  
-- Dependencies: 6 1099 1099  
-- Name: geography_le(geography, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_le(geography, geography) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_le';  
 
 
ALTER FUNCTION public.geography_le(geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 184 (class 1255 OID 18537)  
-- Dependencies: 6 1099 1099  
-- Name: geography_lt(geography, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_lt(geography, geography) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_lt';  
 
 
ALTER FUNCTION public.geography_lt(geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 185 (class 1255 OID 18538)  
-- Dependencies: 6 1099 1099  
-- Name: geography_overlaps(geography, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_overlaps(geography, geography) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_overlaps';  
 
 
ALTER FUNCTION public.geography_overlaps(geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 186 (class 1255 OID 18539)  
-- Dependencies: 6  
-- Name: geography_typmod_dims(integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_typmod_dims(integer) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_typmod_dims';  
 
 
ALTER FUNCTION public.geography_typmod_dims(integer) OWNER TO postgres;  
 
--  
-- TOC entry 187 (class 1255 OID 18540)  
-- Dependencies: 6  
-- Name: geography_typmod_srid(integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_typmod_srid(integer) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_typmod_srid';  
 
 
ALTER FUNCTION public.geography_typmod_srid(integer) OWNER TO postgres;  
 
--  
-- TOC entry 188 (class 1255 OID 18541)  
-- Dependencies: 6  
-- Name: geography_typmod_type(integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geography_typmod_type(integer) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_typmod_type';  
 
 
ALTER FUNCTION public.geography_typmod_type(integer) OWNER TO postgres;  
 
--  
-- TOC entry 190 (class 1255 OID 18543)  
-- Dependencies: 6 1102  
-- Name: geomcollfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geomcollfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE  
WHEN geometrytype(GeomFromText($1)) = 'GEOMETRYCOLLECTION'  
THEN GeomFromText($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.geomcollfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 189 (class 1255 OID 18542)  
-- Dependencies: 6 1102  
-- Name: geomcollfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geomcollfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE  
WHEN geometrytype(GeomFromText($1, $2)) = 'GEOMETRYCOLLECTION'  
THEN GeomFromText($1,$2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.geomcollfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 192 (class 1255 OID 18545)  
-- Dependencies: 6 1102  
-- Name: geomcollfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geomcollfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE  
WHEN geometrytype(GeomFromWKB($1)) = 'GEOMETRYCOLLECTION'  
THEN GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.geomcollfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 191 (class 1255 OID 18544)  
-- Dependencies: 6 1102  
-- Name: geomcollfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geomcollfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE  
WHEN geometrytype(GeomFromWKB($1, $2)) = 'GEOMETRYCOLLECTION'  
THEN GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.geomcollfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 193 (class 1255 OID 18546)  
-- Dependencies: 6 1102 1093  
-- Name: geometry(box3d_extent); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry(box3d_extent) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_to_LWGEOM';  
 
 
ALTER FUNCTION public.geometry(box3d_extent) OWNER TO postgres;  
 
--  
-- TOC entry 194 (class 1255 OID 18547)  
-- Dependencies: 6 1102 1087  
-- Name: geometry(box2d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry(box2d) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_to_LWGEOM';  
 
 
ALTER FUNCTION public.geometry(box2d) OWNER TO postgres;  
 
--  
-- TOC entry 195 (class 1255 OID 18548)  
-- Dependencies: 6 1102 1090  
-- Name: geometry(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry(box3d) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_to_LWGEOM';  
 
 
ALTER FUNCTION public.geometry(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 196 (class 1255 OID 18549)  
-- Dependencies: 6 1102  
-- Name: geometry(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry(text) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'parse_WKT_lwgeom';  
 
 
ALTER FUNCTION public.geometry(text) OWNER TO postgres;  
 
--  
-- TOC entry 197 (class 1255 OID 18550)  
-- Dependencies: 6 1102 1096  
-- Name: geometry(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry(chip) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_to_LWGEOM';  
 
 
ALTER FUNCTION public.geometry(chip) OWNER TO postgres;  
 
--  
-- TOC entry 198 (class 1255 OID 18551)  
-- Dependencies: 6 1102  
-- Name: geometry(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry(bytea) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_from_bytea';  
 
 
ALTER FUNCTION public.geometry(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 199 (class 1255 OID 18552)  
-- Dependencies: 6 1102 1099  
-- Name: geometry(geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry(geography) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geometry_from_geography';  
 
 
ALTER FUNCTION public.geometry(geography) OWNER TO postgres;  
 
--  
-- TOC entry 200 (class 1255 OID 18553)  
-- Dependencies: 6 1102 1102  
-- Name: geometry_above(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_above(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_above';  
 
 
ALTER FUNCTION public.geometry_above(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 201 (class 1255 OID 18554)  
-- Dependencies: 6 1102 1102  
-- Name: geometry_below(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_below(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_below';  
 
 
ALTER FUNCTION public.geometry_below(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 202 (class 1255 OID 18555)  
-- Dependencies: 6 1102 1102  
-- Name: geometry_cmp(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_cmp(geometry, geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'lwgeom_cmp';  
 
 
ALTER FUNCTION public.geometry_cmp(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 203 (class 1255 OID 18556)  
-- Dependencies: 6 1102 1102  
-- Name: geometry_contain(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_contain(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_contain';  
 
 
ALTER FUNCTION public.geometry_contain(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 204 (class 1255 OID 18557)  
-- Dependencies: 6 1102 1102  
-- Name: geometry_contained(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_contained(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_contained';  
 
 
ALTER FUNCTION public.geometry_contained(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 205 (class 1255 OID 18558)  
-- Dependencies: 6 1102 1102  
-- Name: geometry_eq(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_eq(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'lwgeom_eq';  
 
 
ALTER FUNCTION public.geometry_eq(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 206 (class 1255 OID 18559)  
-- Dependencies: 6 1102 1102  
-- Name: geometry_ge(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_ge(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'lwgeom_ge';  
 
 
ALTER FUNCTION public.geometry_ge(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 207 (class 1255 OID 18560)  
-- Dependencies: 6  
-- Name: geometry_gist_joinsel(internal, oid, internal, smallint); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_gist_joinsel(internal, oid, internal, smallint) RETURNS double precision  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'LWGEOM_gist_joinsel';  
 
 
ALTER FUNCTION public.geometry_gist_joinsel(internal, oid, internal, smallint) OWNER TO postgres;  
 
--  
-- TOC entry 208 (class 1255 OID 18561)  
-- Dependencies: 6  
-- Name: geometry_gist_sel(internal, oid, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_gist_sel(internal, oid, internal, integer) RETURNS double precision  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'LWGEOM_gist_sel';  
 
 
ALTER FUNCTION public.geometry_gist_sel(internal, oid, internal, integer) OWNER TO postgres;  
 
--  
-- TOC entry 209 (class 1255 OID 18562)  
-- Dependencies: 1102 6 1102  
-- Name: geometry_gt(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_gt(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'lwgeom_gt';  
 
 
ALTER FUNCTION public.geometry_gt(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 210 (class 1255 OID 18563)  
-- Dependencies: 1102 6 1102  
-- Name: geometry_le(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_le(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'lwgeom_le';  
 
 
ALTER FUNCTION public.geometry_le(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 211 (class 1255 OID 18564)  
-- Dependencies: 1102 6 1102  
-- Name: geometry_left(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_left(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_left';  
 
 
ALTER FUNCTION public.geometry_left(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 212 (class 1255 OID 18565)  
-- Dependencies: 1102 6 1102  
-- Name: geometry_lt(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_lt(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'lwgeom_lt';  
 
 
ALTER FUNCTION public.geometry_lt(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 213 (class 1255 OID 18566)  
-- Dependencies: 1102 6 1102  
-- Name: geometry_overabove(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_overabove(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_overabove';  
 
 
ALTER FUNCTION public.geometry_overabove(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 214 (class 1255 OID 18567)  
-- Dependencies: 1102 6 1102  
-- Name: geometry_overbelow(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_overbelow(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_overbelow';  
 
 
ALTER FUNCTION public.geometry_overbelow(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 215 (class 1255 OID 18568)  
-- Dependencies: 1102 6 1102  
-- Name: geometry_overlap(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_overlap(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_overlap';  
 
 
ALTER FUNCTION public.geometry_overlap(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 216 (class 1255 OID 18569)  
-- Dependencies: 1102 6 1102  
-- Name: geometry_overleft(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_overleft(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_overleft';  
 
 
ALTER FUNCTION public.geometry_overleft(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 217 (class 1255 OID 18570)  
-- Dependencies: 1102 6 1102  
-- Name: geometry_overright(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_overright(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_overright';  
 
 
ALTER FUNCTION public.geometry_overright(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 218 (class 1255 OID 18571)  
-- Dependencies: 1102 6 1102  
-- Name: geometry_right(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_right(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_right';  
 
 
ALTER FUNCTION public.geometry_right(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 219 (class 1255 OID 18572)  
-- Dependencies: 1102 6 1102  
-- Name: geometry_same(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_same(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_samebox';  
 
 
ALTER FUNCTION public.geometry_same(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 220 (class 1255 OID 18573)  
-- Dependencies: 1102 6 1102  
-- Name: geometry_samebox(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometry_samebox(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_samebox';  
 
 
ALTER FUNCTION public.geometry_samebox(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 221 (class 1255 OID 18574)  
-- Dependencies: 6 1102  
-- Name: geometryfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometryfromtext(text) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_from_text';  
 
 
ALTER FUNCTION public.geometryfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 222 (class 1255 OID 18575)  
-- Dependencies: 1102 6  
-- Name: geometryfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometryfromtext(text, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_from_text';  
 
 
ALTER FUNCTION public.geometryfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 223 (class 1255 OID 18576)  
-- Dependencies: 6 1102 1102  
-- Name: geometryn(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometryn(geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_geometryn_collection';  
 
 
ALTER FUNCTION public.geometryn(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 224 (class 1255 OID 18577)  
-- Dependencies: 1102 6  
-- Name: geometrytype(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geometrytype(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_getTYPE';  
 
 
ALTER FUNCTION public.geometrytype(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 225 (class 1255 OID 18578)  
-- Dependencies: 6 1102  
-- Name: geomfromewkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geomfromewkb(bytea) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOMFromWKB';  
 
 
ALTER FUNCTION public.geomfromewkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 226 (class 1255 OID 18579)  
-- Dependencies: 6 1102  
-- Name: geomfromewkt(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geomfromewkt(text) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'parse_WKT_lwgeom';  
 
 
ALTER FUNCTION public.geomfromewkt(text) OWNER TO postgres;  
 
--  
-- TOC entry 227 (class 1255 OID 18580)  
-- Dependencies: 6 1102  
-- Name: geomfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geomfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT geometryfromtext($1)$_$;  
 
 
ALTER FUNCTION public.geomfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 228 (class 1255 OID 18581)  
-- Dependencies: 6 1102  
-- Name: geomfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geomfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT geometryfromtext($1, $2)$_$;  
 
 
ALTER FUNCTION public.geomfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 229 (class 1255 OID 18582)  
-- Dependencies: 6 1102  
-- Name: geomfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geomfromwkb(bytea) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_from_WKB';  
 
 
ALTER FUNCTION public.geomfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 230 (class 1255 OID 18583)  
-- Dependencies: 6 1102  
-- Name: geomfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geomfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT setSRID(GeomFromWKB($1), $2)$_$;  
 
 
ALTER FUNCTION public.geomfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 231 (class 1255 OID 18584)  
-- Dependencies: 1102 6 1102 1102  
-- Name: geomunion(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION geomunion(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geomunion';  
 
 
ALTER FUNCTION public.geomunion(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 232 (class 1255 OID 18585)  
-- Dependencies: 6 1168  
-- Name: get_proj4_from_srid(integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION get_proj4_from_srid(integer) RETURNS text  
LANGUAGE plpgsql IMMUTABLE STRICT  
AS $_$  
BEGIN  
RETURN proj4text::text FROM spatial_ref_sys WHERE srid= $1;  
END;  
$_$;  
 
 
ALTER FUNCTION public.get_proj4_from_srid(integer) OWNER TO postgres;  
 
--  
-- TOC entry 233 (class 1255 OID 18586)  
-- Dependencies: 1087 6 1102  
-- Name: getbbox(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION getbbox(geometry) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_to_BOX2DFLOAT4';  
 
 
ALTER FUNCTION public.getbbox(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 234 (class 1255 OID 18587)  
-- Dependencies: 1102 6  
-- Name: getsrid(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION getsrid(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_getSRID';  
 
 
ALTER FUNCTION public.getsrid(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 235 (class 1255 OID 18588)  
-- Dependencies: 6  
-- Name: gettransactionid(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION gettransactionid() RETURNS xid  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'getTransactionID';  
 
 
ALTER FUNCTION public.gettransactionid() OWNER TO postgres;  
 
--  
-- TOC entry 236 (class 1255 OID 18589)  
-- Dependencies: 1102 6  
-- Name: hasbbox(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION hasbbox(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_hasBBOX';  
 
 
ALTER FUNCTION public.hasbbox(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 237 (class 1255 OID 18590)  
-- Dependencies: 6 1096  
-- Name: height(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION height(chip) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_getHeight';  
 
 
ALTER FUNCTION public.height(chip) OWNER TO postgres;  
 
--  
-- TOC entry 238 (class 1255 OID 18591)  
-- Dependencies: 1102 1102 6  
-- Name: interiorringn(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION interiorringn(geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_interiorringn_polygon';  
 
 
ALTER FUNCTION public.interiorringn(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 239 (class 1255 OID 18592)  
-- Dependencies: 1102 6 1102 1102  
-- Name: intersection(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION intersection(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'intersection';  
 
 
ALTER FUNCTION public.intersection(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 240 (class 1255 OID 18593)  
-- Dependencies: 1102 6 1102  
-- Name: intersects(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION intersects(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'intersects';  
 
 
ALTER FUNCTION public.intersects(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 241 (class 1255 OID 18594)  
-- Dependencies: 6 1102  
-- Name: isclosed(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION isclosed(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_isclosed_linestring';  
 
 
ALTER FUNCTION public.isclosed(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 242 (class 1255 OID 18595)  
-- Dependencies: 6 1102  
-- Name: isempty(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION isempty(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_isempty';  
 
 
ALTER FUNCTION public.isempty(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 243 (class 1255 OID 18596)  
-- Dependencies: 1102 6  
-- Name: isring(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION isring(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'isring';  
 
 
ALTER FUNCTION public.isring(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 244 (class 1255 OID 18597)  
-- Dependencies: 6 1102  
-- Name: issimple(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION issimple(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'issimple';  
 
 
ALTER FUNCTION public.issimple(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 245 (class 1255 OID 18598)  
-- Dependencies: 6 1102  
-- Name: isvalid(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION isvalid(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'isvalid';  
 
 
ALTER FUNCTION public.isvalid(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 246 (class 1255 OID 18599)  
-- Dependencies: 1102 6  
-- Name: length(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION length(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_length_linestring';  
 
 
ALTER FUNCTION public.length(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 247 (class 1255 OID 18600)  
-- Dependencies: 6 1102  
-- Name: length2d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION length2d(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_length2d_linestring';  
 
 
ALTER FUNCTION public.length2d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 248 (class 1255 OID 18601)  
-- Dependencies: 1102 6 1113  
-- Name: length2d_spheroid(geometry, spheroid); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION length2d_spheroid(geometry, spheroid) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_length2d_ellipsoid';  
 
 
ALTER FUNCTION public.length2d_spheroid(geometry, spheroid) OWNER TO postgres;  
 
--  
-- TOC entry 249 (class 1255 OID 18602)  
-- Dependencies: 1102 6  
-- Name: length3d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION length3d(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_length_linestring';  
 
 
ALTER FUNCTION public.length3d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 250 (class 1255 OID 18603)  
-- Dependencies: 6 1102 1113  
-- Name: length3d_spheroid(geometry, spheroid); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION length3d_spheroid(geometry, spheroid) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_length_ellipsoid_linestring';  
 
 
ALTER FUNCTION public.length3d_spheroid(geometry, spheroid) OWNER TO postgres;  
 
--  
-- TOC entry 251 (class 1255 OID 18604)  
-- Dependencies: 1113 6 1102  
-- Name: length_spheroid(geometry, spheroid); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION length_spheroid(geometry, spheroid) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_length_ellipsoid_linestring';  
 
 
ALTER FUNCTION public.length_spheroid(geometry, spheroid) OWNER TO postgres;  
 
--  
-- TOC entry 252 (class 1255 OID 18605)  
-- Dependencies: 6 1102 1102  
-- Name: line_interpolate_point(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION line_interpolate_point(geometry, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_line_interpolate_point';  
 
 
ALTER FUNCTION public.line_interpolate_point(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 253 (class 1255 OID 18606)  
-- Dependencies: 6 1102 1102  
-- Name: line_locate_point(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION line_locate_point(geometry, geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_line_locate_point';  
 
 
ALTER FUNCTION public.line_locate_point(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 254 (class 1255 OID 18607)  
-- Dependencies: 6 1102 1102  
-- Name: line_substring(geometry, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION line_substring(geometry, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_line_substring';  
 
 
ALTER FUNCTION public.line_substring(geometry, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 255 (class 1255 OID 18608)  
-- Dependencies: 6 1102 1102  
-- Name: linefrommultipoint(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION linefrommultipoint(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_line_from_mpoint';  
 
 
ALTER FUNCTION public.linefrommultipoint(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 256 (class 1255 OID 18609)  
-- Dependencies: 6 1102  
-- Name: linefromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION linefromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'LINESTRING'  
THEN GeomFromText($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.linefromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 257 (class 1255 OID 18610)  
-- Dependencies: 6 1102  
-- Name: linefromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION linefromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'LINESTRING'  
THEN GeomFromText($1,$2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.linefromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 259 (class 1255 OID 18612)  
-- Dependencies: 6 1102  
-- Name: linefromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION linefromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'LINESTRING'  
THEN GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.linefromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 258 (class 1255 OID 18611)  
-- Dependencies: 6 1102  
-- Name: linefromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION linefromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'LINESTRING'  
THEN GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.linefromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 260 (class 1255 OID 18613)  
-- Dependencies: 6 1102 1102  
-- Name: linemerge(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION linemerge(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'linemerge';  
 
 
ALTER FUNCTION public.linemerge(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 261 (class 1255 OID 18614)  
-- Dependencies: 6 1102  
-- Name: linestringfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION linestringfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT LineFromText($1)$_$;  
 
 
ALTER FUNCTION public.linestringfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 262 (class 1255 OID 18615)  
-- Dependencies: 6 1102  
-- Name: linestringfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION linestringfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT LineFromText($1, $2)$_$;  
 
 
ALTER FUNCTION public.linestringfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 264 (class 1255 OID 18617)  
-- Dependencies: 6 1102  
-- Name: linestringfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION linestringfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'LINESTRING'  
THEN GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.linestringfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 263 (class 1255 OID 18616)  
-- Dependencies: 6 1102  
-- Name: linestringfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION linestringfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'LINESTRING'  
THEN GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.linestringfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 265 (class 1255 OID 18618)  
-- Dependencies: 6 1102 1102  
-- Name: locate_along_measure(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION locate_along_measure(geometry, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT locate_between_measures($1, $2, $2) $_$;  
 
 
ALTER FUNCTION public.locate_along_measure(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 266 (class 1255 OID 18619)  
-- Dependencies: 1102 1102 6  
-- Name: locate_between_measures(geometry, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION locate_between_measures(geometry, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_locate_between_m';  
 
 
ALTER FUNCTION public.locate_between_measures(geometry, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 269 (class 1255 OID 18622)  
-- Dependencies: 6  
-- Name: lockrow(text, text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION lockrow(text, text, text) RETURNS integer  
LANGUAGE sql STRICT  
AS $_$ SELECT LockRow(current_schema(), $1, $2, $3, now()::timestamp+'1:00'); $_$;  
 
 
ALTER FUNCTION public.lockrow(text, text, text) OWNER TO postgres;  
 
--  
-- TOC entry 268 (class 1255 OID 18621)  
-- Dependencies: 6  
-- Name: lockrow(text, text, text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION lockrow(text, text, text, text) RETURNS integer  
LANGUAGE sql STRICT  
AS $_$ SELECT LockRow($1, $2, $3, $4, now()::timestamp+'1:00'); $_$;  
 
 
ALTER FUNCTION public.lockrow(text, text, text, text) OWNER TO postgres;  
 
--  
-- TOC entry 270 (class 1255 OID 18623)  
-- Dependencies: 6  
-- Name: lockrow(text, text, text, timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION lockrow(text, text, text, timestamp without time zone) RETURNS integer  
LANGUAGE sql STRICT  
AS $_$ SELECT LockRow(current_schema(), $1, $2, $3, $4); $_$;  
 
 
ALTER FUNCTION public.lockrow(text, text, text, timestamp without time zone) OWNER TO postgres;  
 
--  
-- TOC entry 267 (class 1255 OID 18620)  
-- Dependencies: 6 1168  
-- Name: lockrow(text, text, text, text, timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION lockrow(text, text, text, text, timestamp without time zone) RETURNS integer  
LANGUAGE plpgsql STRICT  
AS $_$  
DECLARE  
myschema alias for $1;  
mytable alias for $2;  
myrid alias for $3;  
authid alias for $4;  
expires alias for $5;  
ret int;  
mytoid oid;  
myrec RECORD;  
 
BEGIN  
 
IF NOT LongTransactionsEnabled() THEN  
RAISE EXCEPTION 'Long transaction support disabled, use EnableLongTransaction() to enable.';  
END IF;  
 
EXECUTE 'DELETE FROM authorization_table WHERE expires < now()';  
 
SELECT c.oid INTO mytoid FROM pg_class c, pg_namespace n  
WHERE c.relname = mytable  
AND c.relnamespace = n.oid  
AND n.nspname = myschema;  
 
-- RAISE NOTICE 'toid: %', mytoid;  
 
FOR myrec IN SELECT * FROM authorization_table WHERE  
toid = mytoid AND rid = myrid  
LOOP  
IF myrec.authid != authid THEN  
RETURN 0;  
ELSE  
RETURN 1;  
END IF;  
END LOOP;  
 
EXECUTE 'INSERT INTO authorization_table VALUES ('||  
quote_literal(mytoid::text)||','||quote_literal(myrid)||  
','||quote_literal(expires::text)||  
','||quote_literal(authid) ||')';  
 
GET DIAGNOSTICS ret = ROW_COUNT;  
 
RETURN ret;  
END;  
$_$;  
 
 
ALTER FUNCTION public.lockrow(text, text, text, text, timestamp without time zone) OWNER TO postgres;  
 
--  
-- TOC entry 271 (class 1255 OID 18624)  
-- Dependencies: 1168 6  
-- Name: longtransactionsenabled(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION longtransactionsenabled() RETURNS boolean  
LANGUAGE plpgsql  
AS $$  
DECLARE  
rec RECORD;  
BEGIN  
FOR rec IN SELECT oid FROM pg_class WHERE relname = 'authorized_tables'  
LOOP  
return 't';  
END LOOP;  
return 'f';  
END;  
$$;  
 
 
ALTER FUNCTION public.longtransactionsenabled() OWNER TO postgres;  
 
--  
-- TOC entry 272 (class 1255 OID 18625)  
-- Dependencies: 6  
-- Name: lwgeom_gist_compress(internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION lwgeom_gist_compress(internal) RETURNS internal  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'LWGEOM_gist_compress';  
 
 
ALTER FUNCTION public.lwgeom_gist_compress(internal) OWNER TO postgres;  
 
--  
-- TOC entry 273 (class 1255 OID 18626)  
-- Dependencies: 6 1102  
-- Name: lwgeom_gist_consistent(internal, geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION lwgeom_gist_consistent(internal, geometry, integer) RETURNS boolean  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'LWGEOM_gist_consistent';  
 
 
ALTER FUNCTION public.lwgeom_gist_consistent(internal, geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 274 (class 1255 OID 18627)  
-- Dependencies: 6  
-- Name: lwgeom_gist_decompress(internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION lwgeom_gist_decompress(internal) RETURNS internal  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'LWGEOM_gist_decompress';  
 
 
ALTER FUNCTION public.lwgeom_gist_decompress(internal) OWNER TO postgres;  
 
--  
-- TOC entry 275 (class 1255 OID 18628)  
-- Dependencies: 6  
-- Name: lwgeom_gist_penalty(internal, internal, internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION lwgeom_gist_penalty(internal, internal, internal) RETURNS internal  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'LWGEOM_gist_penalty';  
 
 
ALTER FUNCTION public.lwgeom_gist_penalty(internal, internal, internal) OWNER TO postgres;  
 
--  
-- TOC entry 276 (class 1255 OID 18629)  
-- Dependencies: 6  
-- Name: lwgeom_gist_picksplit(internal, internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION lwgeom_gist_picksplit(internal, internal) RETURNS internal  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'LWGEOM_gist_picksplit';  
 
 
ALTER FUNCTION public.lwgeom_gist_picksplit(internal, internal) OWNER TO postgres;  
 
--  
-- TOC entry 277 (class 1255 OID 18630)  
-- Dependencies: 6 1087 1087  
-- Name: lwgeom_gist_same(box2d, box2d, internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION lwgeom_gist_same(box2d, box2d, internal) RETURNS internal  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'LWGEOM_gist_same';  
 
 
ALTER FUNCTION public.lwgeom_gist_same(box2d, box2d, internal) OWNER TO postgres;  
 
--  
-- TOC entry 278 (class 1255 OID 18631)  
-- Dependencies: 6  
-- Name: lwgeom_gist_union(bytea, internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION lwgeom_gist_union(bytea, internal) RETURNS internal  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'LWGEOM_gist_union';  
 
 
ALTER FUNCTION public.lwgeom_gist_union(bytea, internal) OWNER TO postgres;  
 
--  
-- TOC entry 279 (class 1255 OID 18632)  
-- Dependencies: 6 1102  
-- Name: m(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION m(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_m_point';  
 
 
ALTER FUNCTION public.m(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 280 (class 1255 OID 18633)  
-- Dependencies: 1102 6 1087 1102  
-- Name: makebox2d(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION makebox2d(geometry, geometry) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_construct';  
 
 
ALTER FUNCTION public.makebox2d(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 281 (class 1255 OID 18634)  
-- Dependencies: 1090 6 1102 1102  
-- Name: makebox3d(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION makebox3d(geometry, geometry) RETURNS box3d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_construct';  
 
 
ALTER FUNCTION public.makebox3d(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 282 (class 1255 OID 18635)  
-- Dependencies: 6 1102 1102 1102  
-- Name: makeline(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION makeline(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makeline';  
 
 
ALTER FUNCTION public.makeline(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 283 (class 1255 OID 18636)  
-- Dependencies: 6 1102 1104  
-- Name: makeline_garray(geometry[]); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION makeline_garray(geometry[]) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makeline_garray';  
 
 
ALTER FUNCTION public.makeline_garray(geometry[]) OWNER TO postgres;  
 
--  
-- TOC entry 284 (class 1255 OID 18637)  
-- Dependencies: 6 1102  
-- Name: makepoint(double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION makepoint(double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makepoint';  
 
 
ALTER FUNCTION public.makepoint(double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 285 (class 1255 OID 18638)  
-- Dependencies: 6 1102  
-- Name: makepoint(double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION makepoint(double precision, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makepoint';  
 
 
ALTER FUNCTION public.makepoint(double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 286 (class 1255 OID 18639)  
-- Dependencies: 6 1102  
-- Name: makepoint(double precision, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION makepoint(double precision, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makepoint';  
 
 
ALTER FUNCTION public.makepoint(double precision, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 287 (class 1255 OID 18640)  
-- Dependencies: 6 1102  
-- Name: makepointm(double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION makepointm(double precision, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makepoint3dm';  
 
 
ALTER FUNCTION public.makepointm(double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 289 (class 1255 OID 18642)  
-- Dependencies: 6 1102 1102  
-- Name: makepolygon(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION makepolygon(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makepoly';  
 
 
ALTER FUNCTION public.makepolygon(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 288 (class 1255 OID 18641)  
-- Dependencies: 1104 6 1102 1102  
-- Name: makepolygon(geometry, geometry[]); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION makepolygon(geometry, geometry[]) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makepoly';  
 
 
ALTER FUNCTION public.makepolygon(geometry, geometry[]) OWNER TO postgres;  
 
--  
-- TOC entry 290 (class 1255 OID 18643)  
-- Dependencies: 1102 1102 6  
-- Name: max_distance(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION max_distance(geometry, geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_maxdistance2d_linestring';  
 
 
ALTER FUNCTION public.max_distance(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 291 (class 1255 OID 18644)  
-- Dependencies: 6 1102  
-- Name: mem_size(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION mem_size(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_mem_size';  
 
 
ALTER FUNCTION public.mem_size(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 293 (class 1255 OID 18646)  
-- Dependencies: 6 1102  
-- Name: mlinefromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION mlinefromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTILINESTRING'  
THEN GeomFromText($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.mlinefromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 292 (class 1255 OID 18645)  
-- Dependencies: 6 1102  
-- Name: mlinefromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION mlinefromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE  
WHEN geometrytype(GeomFromText($1, $2)) = 'MULTILINESTRING'  
THEN GeomFromText($1,$2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.mlinefromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 295 (class 1255 OID 18648)  
-- Dependencies: 6 1102  
-- Name: mlinefromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION mlinefromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTILINESTRING'  
THEN GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.mlinefromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 294 (class 1255 OID 18647)  
-- Dependencies: 1102 6  
-- Name: mlinefromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION mlinefromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTILINESTRING'  
THEN GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.mlinefromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 297 (class 1255 OID 18650)  
-- Dependencies: 6 1102  
-- Name: mpointfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION mpointfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTIPOINT'  
THEN GeomFromText($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.mpointfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 296 (class 1255 OID 18649)  
-- Dependencies: 6 1102  
-- Name: mpointfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION mpointfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromText($1,$2)) = 'MULTIPOINT'  
THEN GeomFromText($1,$2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.mpointfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 299 (class 1255 OID 18652)  
-- Dependencies: 6 1102  
-- Name: mpointfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION mpointfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOINT'  
THEN GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.mpointfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 298 (class 1255 OID 18651)  
-- Dependencies: 6 1102  
-- Name: mpointfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION mpointfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1,$2)) = 'MULTIPOINT'  
THEN GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.mpointfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 301 (class 1255 OID 18654)  
-- Dependencies: 6 1102  
-- Name: mpolyfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION mpolyfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTIPOLYGON'  
THEN GeomFromText($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.mpolyfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 300 (class 1255 OID 18653)  
-- Dependencies: 1102 6  
-- Name: mpolyfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION mpolyfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'MULTIPOLYGON'  
THEN GeomFromText($1,$2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.mpolyfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 303 (class 1255 OID 18656)  
-- Dependencies: 1102 6  
-- Name: mpolyfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION mpolyfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOLYGON'  
THEN GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.mpolyfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 302 (class 1255 OID 18655)  
-- Dependencies: 1102 6  
-- Name: mpolyfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION mpolyfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTIPOLYGON'  
THEN GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.mpolyfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 304 (class 1255 OID 18657)  
-- Dependencies: 1102 6 1102  
-- Name: multi(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION multi(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_force_multi';  
 
 
ALTER FUNCTION public.multi(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 306 (class 1255 OID 18659)  
-- Dependencies: 1102 6  
-- Name: multilinefromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION multilinefromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTILINESTRING'  
THEN GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.multilinefromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 305 (class 1255 OID 18658)  
-- Dependencies: 1102 6  
-- Name: multilinefromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION multilinefromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTILINESTRING'  
THEN GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.multilinefromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 307 (class 1255 OID 18660)  
-- Dependencies: 1102 6  
-- Name: multilinestringfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION multilinestringfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT ST_MLineFromText($1)$_$;  
 
 
ALTER FUNCTION public.multilinestringfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 308 (class 1255 OID 18661)  
-- Dependencies: 1102 6  
-- Name: multilinestringfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION multilinestringfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT MLineFromText($1, $2)$_$;  
 
 
ALTER FUNCTION public.multilinestringfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 310 (class 1255 OID 18663)  
-- Dependencies: 1102 6  
-- Name: multipointfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION multipointfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT MPointFromText($1)$_$;  
 
 
ALTER FUNCTION public.multipointfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 309 (class 1255 OID 18662)  
-- Dependencies: 1102 6  
-- Name: multipointfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION multipointfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT MPointFromText($1, $2)$_$;  
 
 
ALTER FUNCTION public.multipointfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 312 (class 1255 OID 18665)  
-- Dependencies: 1102 6  
-- Name: multipointfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION multipointfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOINT'  
THEN GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.multipointfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 311 (class 1255 OID 18664)  
-- Dependencies: 6 1102  
-- Name: multipointfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION multipointfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1,$2)) = 'MULTIPOINT'  
THEN GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.multipointfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 314 (class 1255 OID 18667)  
-- Dependencies: 6 1102  
-- Name: multipolyfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION multipolyfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOLYGON'  
THEN GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.multipolyfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 313 (class 1255 OID 18666)  
-- Dependencies: 6 1102  
-- Name: multipolyfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION multipolyfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTIPOLYGON'  
THEN GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.multipolyfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 316 (class 1255 OID 18669)  
-- Dependencies: 1102 6  
-- Name: multipolygonfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION multipolygonfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT MPolyFromText($1)$_$;  
 
 
ALTER FUNCTION public.multipolygonfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 315 (class 1255 OID 18668)  
-- Dependencies: 6 1102  
-- Name: multipolygonfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION multipolygonfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT MPolyFromText($1, $2)$_$;  
 
 
ALTER FUNCTION public.multipolygonfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 317 (class 1255 OID 18670)  
-- Dependencies: 6 1102  
-- Name: ndims(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION ndims(geometry) RETURNS smallint  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_ndims';  
 
 
ALTER FUNCTION public.ndims(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 318 (class 1255 OID 18671)  
-- Dependencies: 6 1102 1102  
-- Name: noop(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION noop(geometry) RETURNS geometry  
LANGUAGE c STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_noop';  
 
 
ALTER FUNCTION public.noop(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 319 (class 1255 OID 18672)  
-- Dependencies: 6 1102  
-- Name: npoints(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION npoints(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_npoints';  
 
 
ALTER FUNCTION public.npoints(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 320 (class 1255 OID 18673)  
-- Dependencies: 6 1102  
-- Name: nrings(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION nrings(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_nrings';  
 
 
ALTER FUNCTION public.nrings(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 321 (class 1255 OID 18674)  
-- Dependencies: 6 1102  
-- Name: numgeometries(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION numgeometries(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_numgeometries_collection';  
 
 
ALTER FUNCTION public.numgeometries(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 322 (class 1255 OID 18675)  
-- Dependencies: 6 1102  
-- Name: numinteriorring(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION numinteriorring(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_numinteriorrings_polygon';  
 
 
ALTER FUNCTION public.numinteriorring(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 323 (class 1255 OID 18676)  
-- Dependencies: 6 1102  
-- Name: numinteriorrings(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION numinteriorrings(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_numinteriorrings_polygon';  
 
 
ALTER FUNCTION public.numinteriorrings(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 324 (class 1255 OID 18677)  
-- Dependencies: 6 1102  
-- Name: numpoints(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION numpoints(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_numpoints_linestring';  
 
 
ALTER FUNCTION public.numpoints(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 325 (class 1255 OID 18678)  
-- Dependencies: 6 1102 1102  
-- Name: overlaps(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION "overlaps"(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'overlaps';  
 
 
ALTER FUNCTION public."overlaps"(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 326 (class 1255 OID 18679)  
-- Dependencies: 6 1102  
-- Name: perimeter(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION perimeter(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_perimeter_poly';  
 
 
ALTER FUNCTION public.perimeter(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 327 (class 1255 OID 18680)  
-- Dependencies: 1102 6  
-- Name: perimeter2d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION perimeter2d(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_perimeter2d_poly';  
 
 
ALTER FUNCTION public.perimeter2d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 328 (class 1255 OID 18681)  
-- Dependencies: 6 1102  
-- Name: perimeter3d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION perimeter3d(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_perimeter_poly';  
 
 
ALTER FUNCTION public.perimeter3d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 329 (class 1255 OID 18682)  
-- Dependencies: 1104 6 1110  
-- Name: pgis_geometry_accum_finalfn(pgis_abs); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION pgis_geometry_accum_finalfn(pgis_abs) RETURNS geometry[]  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'pgis_geometry_accum_finalfn';  
 
 
ALTER FUNCTION public.pgis_geometry_accum_finalfn(pgis_abs) OWNER TO postgres;  
 
--  
-- TOC entry 330 (class 1255 OID 18683)  
-- Dependencies: 1110 6 1110 1102  
-- Name: pgis_geometry_accum_transfn(pgis_abs, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION pgis_geometry_accum_transfn(pgis_abs, geometry) RETURNS pgis_abs  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'pgis_geometry_accum_transfn';  
 
 
ALTER FUNCTION public.pgis_geometry_accum_transfn(pgis_abs, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 331 (class 1255 OID 18684)  
-- Dependencies: 1102 6 1110  
-- Name: pgis_geometry_collect_finalfn(pgis_abs); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION pgis_geometry_collect_finalfn(pgis_abs) RETURNS geometry  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'pgis_geometry_collect_finalfn';  
 
 
ALTER FUNCTION public.pgis_geometry_collect_finalfn(pgis_abs) OWNER TO postgres;  
 
--  
-- TOC entry 332 (class 1255 OID 18685)  
-- Dependencies: 1102 6 1110  
-- Name: pgis_geometry_makeline_finalfn(pgis_abs); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION pgis_geometry_makeline_finalfn(pgis_abs) RETURNS geometry  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'pgis_geometry_makeline_finalfn';  
 
 
ALTER FUNCTION public.pgis_geometry_makeline_finalfn(pgis_abs) OWNER TO postgres;  
 
--  
-- TOC entry 333 (class 1255 OID 18686)  
-- Dependencies: 1110 6 1102  
-- Name: pgis_geometry_polygonize_finalfn(pgis_abs); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION pgis_geometry_polygonize_finalfn(pgis_abs) RETURNS geometry  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'pgis_geometry_polygonize_finalfn';  
 
 
ALTER FUNCTION public.pgis_geometry_polygonize_finalfn(pgis_abs) OWNER TO postgres;  
 
--  
-- TOC entry 334 (class 1255 OID 18687)  
-- Dependencies: 1110 1102 6  
-- Name: pgis_geometry_union_finalfn(pgis_abs); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION pgis_geometry_union_finalfn(pgis_abs) RETURNS geometry  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'pgis_geometry_union_finalfn';  
 
 
ALTER FUNCTION public.pgis_geometry_union_finalfn(pgis_abs) OWNER TO postgres;  
 
--  
-- TOC entry 335 (class 1255 OID 18688)  
-- Dependencies: 1102 6  
-- Name: point_inside_circle(geometry, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION point_inside_circle(geometry, double precision, double precision, double precision) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_inside_circle_point';  
 
 
ALTER FUNCTION public.point_inside_circle(geometry, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 336 (class 1255 OID 18689)  
-- Dependencies: 6 1102  
-- Name: pointfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION pointfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'POINT'  
THEN GeomFromText($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.pointfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 337 (class 1255 OID 18690)  
-- Dependencies: 6 1102  
-- Name: pointfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION pointfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'POINT'  
THEN GeomFromText($1,$2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.pointfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 339 (class 1255 OID 18692)  
-- Dependencies: 6 1102  
-- Name: pointfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION pointfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POINT'  
THEN GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.pointfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 338 (class 1255 OID 18691)  
-- Dependencies: 1102 6  
-- Name: pointfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION pointfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'POINT'  
THEN GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.pointfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 340 (class 1255 OID 18693)  
-- Dependencies: 6 1102 1102  
-- Name: pointn(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION pointn(geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_pointn_linestring';  
 
 
ALTER FUNCTION public.pointn(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 341 (class 1255 OID 18694)  
-- Dependencies: 6 1102 1102  
-- Name: pointonsurface(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION pointonsurface(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'pointonsurface';  
 
 
ALTER FUNCTION public.pointonsurface(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 342 (class 1255 OID 18695)  
-- Dependencies: 6 1102  
-- Name: polyfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION polyfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'POLYGON'  
THEN GeomFromText($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.polyfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 343 (class 1255 OID 18696)  
-- Dependencies: 6 1102  
-- Name: polyfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION polyfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'POLYGON'  
THEN GeomFromText($1,$2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.polyfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 345 (class 1255 OID 18698)  
-- Dependencies: 6 1102  
-- Name: polyfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION polyfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POLYGON'  
THEN GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.polyfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 344 (class 1255 OID 18697)  
-- Dependencies: 1102 6  
-- Name: polyfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION polyfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'POLYGON'  
THEN GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.polyfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 347 (class 1255 OID 18700)  
-- Dependencies: 6 1102  
-- Name: polygonfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION polygonfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT PolyFromText($1)$_$;  
 
 
ALTER FUNCTION public.polygonfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 346 (class 1255 OID 18699)  
-- Dependencies: 6 1102  
-- Name: polygonfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION polygonfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT PolyFromText($1, $2)$_$;  
 
 
ALTER FUNCTION public.polygonfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 349 (class 1255 OID 18702)  
-- Dependencies: 1102 6  
-- Name: polygonfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION polygonfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POLYGON'  
THEN GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.polygonfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 348 (class 1255 OID 18701)  
-- Dependencies: 6 1102  
-- Name: polygonfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION polygonfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1,$2)) = 'POLYGON'  
THEN GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.polygonfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 350 (class 1255 OID 18703)  
-- Dependencies: 6 1102 1104  
-- Name: polygonize_garray(geometry[]); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION polygonize_garray(geometry[]) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'polygonize_garray';  
 
 
ALTER FUNCTION public.polygonize_garray(geometry[]) OWNER TO postgres;  
 
--  
-- TOC entry 351 (class 1255 OID 18704)  
-- Dependencies: 6 1168  
-- Name: populate_geometry_columns(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION populate_geometry_columns() RETURNS text  
LANGUAGE plpgsql  
AS $$  
DECLARE  
inserted integer;  
oldcount integer;  
probed integer;  
stale integer;  
gcs RECORD;  
gc RECORD;  
gsrid integer;  
gndims integer;  
gtype text;  
query text;  
gc_is_valid boolean;  
 
BEGIN  
SELECT count(*) INTO oldcount FROM geometry_columns;  
inserted := 0;  
 
EXECUTE 'TRUNCATE geometry_columns';  
 
-- Count the number of geometry columns in all tables and views  
SELECT count(DISTINCT c.oid) INTO probed  
FROM pg_class c,  
pg_attribute a,  
pg_type t,  
pg_namespace n  
WHERE (c.relkind = 'r' OR c.relkind = 'v')  
AND t.typname = 'geometry'  
AND a.attisdropped = false  
AND a.atttypid = t.oid  
AND a.attrelid = c.oid  
AND c.relnamespace = n.oid  
AND n.nspname NOT ILIKE 'pg_temp%';  
 
-- Iterate through all non-dropped geometry columns  
RAISE DEBUG 'Processing Tables.....';  
 
FOR gcs IN  
SELECT DISTINCT ON (c.oid) c.oid, n.nspname, c.relname  
FROM pg_class c,  
pg_attribute a,  
pg_type t,  
pg_namespace n  
WHERE c.relkind = 'r'  
AND t.typname = 'geometry'  
AND a.attisdropped = false  
AND a.atttypid = t.oid  
AND a.attrelid = c.oid  
AND c.relnamespace = n.oid  
AND n.nspname NOT ILIKE 'pg_temp%'  
LOOP  
 
inserted := inserted + populate_geometry_columns(gcs.oid);  
END LOOP;  
 
-- Add views to geometry columns table  
RAISE DEBUG 'Processing Views.....';  
FOR gcs IN  
SELECT DISTINCT ON (c.oid) c.oid, n.nspname, c.relname  
FROM pg_class c,  
pg_attribute a,  
pg_type t,  
pg_namespace n  
WHERE c.relkind = 'v'  
AND t.typname = 'geometry'  
AND a.attisdropped = false  
AND a.atttypid = t.oid  
AND a.attrelid = c.oid  
AND c.relnamespace = n.oid  
LOOP  
 
inserted := inserted + populate_geometry_columns(gcs.oid);  
END LOOP;  
 
IF oldcount > inserted THEN  
stale = oldcount-inserted;  
ELSE  
stale = 0;  
END IF;  
 
RETURN 'probed:' ||probed|| ' inserted:'||inserted|| ' conflicts:'||probed-inserted|| ' deleted:'||stale;  
END  
 
$$;  
 
 
ALTER FUNCTION public.populate_geometry_columns() OWNER TO postgres;  
 
--  
-- TOC entry 352 (class 1255 OID 18705)  
-- Dependencies: 6 1168  
-- Name: populate_geometry_columns(oid); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION populate_geometry_columns(tbl_oid oid) RETURNS integer  
LANGUAGE plpgsql  
AS $$  
DECLARE  
gcs RECORD;  
gc RECORD;  
gsrid integer;  
gndims integer;  
gtype text;  
query text;  
gc_is_valid boolean;  
inserted integer;  
 
BEGIN  
inserted := 0;  
 
-- Iterate through all geometry columns in this table  
FOR gcs IN  
SELECT n.nspname, c.relname, a.attname  
FROM pg_class c,  
pg_attribute a,  
pg_type t,  
pg_namespace n  
WHERE c.relkind = 'r'  
AND t.typname = 'geometry'  
AND a.attisdropped = false  
AND a.atttypid = t.oid  
AND a.attrelid = c.oid  
AND c.relnamespace = n.oid  
AND n.nspname NOT ILIKE 'pg_temp%'  
AND c.oid = tbl_oid  
LOOP  
 
RAISE DEBUG 'Processing table %.%.%', gcs.nspname, gcs.relname, gcs.attname;  
 
DELETE FROM geometry_columns  
WHERE f_table_schema = quote_ident(gcs.nspname)  
AND f_table_name = quote_ident(gcs.relname)  
AND f_geometry_column = quote_ident(gcs.attname);  
 
gc_is_valid := true;  
 
-- Try to find srid check from system tables (pg_constraint)  
gsrid :=  
(SELECT replace(replace(split_part(s.consrc, ' = ', 2), ')', ''), '(', '')  
FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s  
WHERE n.nspname = gcs.nspname  
AND c.relname = gcs.relname  
AND a.attname = gcs.attname  
AND a.attrelid = c.oid  
AND s.connamespace = n.oid  
AND s.conrelid = c.oid  
AND a.attnum = ANY (s.conkey)  
AND s.consrc LIKE '%srid(% = %');  
IF (gsrid IS NULL) THEN  
-- Try to find srid from the geometry itself  
EXECUTE 'SELECT srid(' || quote_ident(gcs.attname) || ')  
FROM ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) || '  
WHERE ' || quote_ident(gcs.attname) || ' IS NOT NULL LIMIT 1'  
INTO gc;  
gsrid := gc.srid;  
 
-- Try to apply srid check to column  
IF (gsrid IS NOT NULL) THEN  
BEGIN  
EXECUTE 'ALTER TABLE ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) || '  
ADD CONSTRAINT ' || quote_ident('enforce_srid_' || gcs.attname) || '  
CHECK (srid(' || quote_ident(gcs.attname) || ') = ' || gsrid || ')';  
EXCEPTION  
WHEN check_violation THEN  
RAISE WARNING 'Not inserting ''%'' in ''%.%'' into geometry_columns: could not apply constraint CHECK (srid(%) = %)', quote_ident(gcs.attname), quote_ident(gcs.nspname), quote_ident(gcs.relname), quote_ident(gcs.attname), gsrid;  
gc_is_valid := false;  
END;  
END IF;  
END IF;  
 
-- Try to find ndims check from system tables (pg_constraint)  
gndims :=  
(SELECT replace(split_part(s.consrc, ' = ', 2), ')', '')  
FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s  
WHERE n.nspname = gcs.nspname  
AND c.relname = gcs.relname  
AND a.attname = gcs.attname  
AND a.attrelid = c.oid  
AND s.connamespace = n.oid  
AND s.conrelid = c.oid  
AND a.attnum = ANY (s.conkey)  
AND s.consrc LIKE '%ndims(% = %');  
IF (gndims IS NULL) THEN  
-- Try to find ndims from the geometry itself  
EXECUTE 'SELECT ndims(' || quote_ident(gcs.attname) || ')  
FROM ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) || '  
WHERE ' || quote_ident(gcs.attname) || ' IS NOT NULL LIMIT 1'  
INTO gc;  
gndims := gc.ndims;  
 
-- Try to apply ndims check to column  
IF (gndims IS NOT NULL) THEN  
BEGIN  
EXECUTE 'ALTER TABLE ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) || '  
ADD CONSTRAINT ' || quote_ident('enforce_dims_' || gcs.attname) || '  
CHECK (ndims(' || quote_ident(gcs.attname) || ') = '||gndims||')';  
EXCEPTION  
WHEN check_violation THEN  
RAISE WARNING 'Not inserting ''%'' in ''%.%'' into geometry_columns: could not apply constraint CHECK (ndims(%) = %)', quote_ident(gcs.attname), quote_ident(gcs.nspname), quote_ident(gcs.relname), quote_ident(gcs.attname), gndims;  
gc_is_valid := false;  
END;  
END IF;  
END IF;  
 
-- Try to find geotype check from system tables (pg_constraint)  
gtype :=  
(SELECT replace(split_part(s.consrc, '''', 2), ')', '')  
FROM pg_class c, pg_namespace n, pg_attribute a, pg_constraint s  
WHERE n.nspname = gcs.nspname  
AND c.relname = gcs.relname  
AND a.attname = gcs.attname  
AND a.attrelid = c.oid  
AND s.connamespace = n.oid  
AND s.conrelid = c.oid  
AND a.attnum = ANY (s.conkey)  
AND s.consrc LIKE '%geometrytype(% = %');  
IF (gtype IS NULL) THEN  
-- Try to find geotype from the geometry itself  
EXECUTE 'SELECT geometrytype(' || quote_ident(gcs.attname) || ')  
FROM ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) || '  
WHERE ' || quote_ident(gcs.attname) || ' IS NOT NULL LIMIT 1'  
INTO gc;  
gtype := gc.geometrytype;  
--IF (gtype IS NULL) THEN  
-- gtype := 'GEOMETRY';  
--END IF;  
 
-- Try to apply geometrytype check to column  
IF (gtype IS NOT NULL) THEN  
BEGIN  
EXECUTE 'ALTER TABLE ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) || '  
ADD CONSTRAINT ' || quote_ident('enforce_geotype_' || gcs.attname) || '  
CHECK ((geometrytype(' || quote_ident(gcs.attname) || ') = ' || quote_literal(gtype) || ') OR (' || quote_ident(gcs.attname) || ' IS NULL))';  
EXCEPTION  
WHEN check_violation THEN  
-- No geometry check can be applied. This column contains a number of geometry types.  
RAISE WARNING 'Could not add geometry type check (%) to table column: %.%.%', gtype, quote_ident(gcs.nspname),quote_ident(gcs.relname),quote_ident(gcs.attname);  
END;  
END IF;  
END IF;  
 
IF (gsrid IS NULL) THEN  
RAISE WARNING 'Not inserting ''%'' in ''%.%'' into geometry_columns: could not determine the srid', quote_ident(gcs.attname), quote_ident(gcs.nspname), quote_ident(gcs.relname);  
ELSIF (gndims IS NULL) THEN  
RAISE WARNING 'Not inserting ''%'' in ''%.%'' into geometry_columns: could not determine the number of dimensions', quote_ident(gcs.attname), quote_ident(gcs.nspname), quote_ident(gcs.relname);  
ELSIF (gtype IS NULL) THEN  
RAISE WARNING 'Not inserting ''%'' in ''%.%'' into geometry_columns: could not determine the geometry type', quote_ident(gcs.attname), quote_ident(gcs.nspname), quote_ident(gcs.relname);  
ELSE  
-- Only insert into geometry_columns if table constraints could be applied.  
IF (gc_is_valid) THEN  
INSERT INTO geometry_columns (f_table_catalog,f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, type)  
VALUES ('', gcs.nspname, gcs.relname, gcs.attname, gndims, gsrid, gtype);  
inserted := inserted + 1;  
END IF;  
END IF;  
END LOOP;  
 
-- Add views to geometry columns table  
FOR gcs IN  
SELECT n.nspname, c.relname, a.attname  
FROM pg_class c,  
pg_attribute a,  
pg_type t,  
pg_namespace n  
WHERE c.relkind = 'v'  
AND t.typname = 'geometry'  
AND a.attisdropped = false  
AND a.atttypid = t.oid  
AND a.attrelid = c.oid  
AND c.relnamespace = n.oid  
AND n.nspname NOT ILIKE 'pg_temp%'  
AND c.oid = tbl_oid  
LOOP  
RAISE DEBUG 'Processing view %.%.%', gcs.nspname, gcs.relname, gcs.attname;  
 
EXECUTE 'SELECT ndims(' || quote_ident(gcs.attname) || ')  
FROM ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) || '  
WHERE ' || quote_ident(gcs.attname) || ' IS NOT NULL LIMIT 1'  
INTO gc;  
gndims := gc.ndims;  
 
EXECUTE 'SELECT srid(' || quote_ident(gcs.attname) || ')  
FROM ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) || '  
WHERE ' || quote_ident(gcs.attname) || ' IS NOT NULL LIMIT 1'  
INTO gc;  
gsrid := gc.srid;  
 
EXECUTE 'SELECT geometrytype(' || quote_ident(gcs.attname) || ')  
FROM ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) || '  
WHERE ' || quote_ident(gcs.attname) || ' IS NOT NULL LIMIT 1'  
INTO gc;  
gtype := gc.geometrytype;  
 
IF (gndims IS NULL) THEN  
RAISE WARNING 'Not inserting ''%'' in ''%.%'' into geometry_columns: could not determine ndims', quote_ident(gcs.attname), quote_ident(gcs.nspname), quote_ident(gcs.relname);  
ELSIF (gsrid IS NULL) THEN  
RAISE WARNING 'Not inserting ''%'' in ''%.%'' into geometry_columns: could not determine srid', quote_ident(gcs.attname), quote_ident(gcs.nspname), quote_ident(gcs.relname);  
ELSIF (gtype IS NULL) THEN  
RAISE WARNING 'Not inserting ''%'' in ''%.%'' into geometry_columns: could not determine gtype', quote_ident(gcs.attname), quote_ident(gcs.nspname), quote_ident(gcs.relname);  
ELSE  
query := 'INSERT INTO geometry_columns (f_table_catalog,f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, type) ' ||  
'VALUES ('''', ' || quote_literal(gcs.nspname) || ',' || quote_literal(gcs.relname) || ',' || quote_literal(gcs.attname) || ',' || gndims || ',' || gsrid || ',' || quote_literal(gtype) || ')';  
EXECUTE query;  
inserted := inserted + 1;  
END IF;  
END LOOP;  
 
RETURN inserted;  
END  
 
$$;  
 
 
ALTER FUNCTION public.populate_geometry_columns(tbl_oid oid) OWNER TO postgres;  
 
--  
-- TOC entry 353 (class 1255 OID 18707)  
-- Dependencies: 6 1102 1102  
-- Name: postgis_addbbox(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_addbbox(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_addBBOX';  
 
 
ALTER FUNCTION public.postgis_addbbox(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 354 (class 1255 OID 18708)  
-- Dependencies: 6  
-- Name: postgis_cache_bbox(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_cache_bbox() RETURNS trigger  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'cache_bbox';  
 
 
ALTER FUNCTION public.postgis_cache_bbox() OWNER TO postgres;  
 
--  
-- TOC entry 355 (class 1255 OID 18709)  
-- Dependencies: 1102 1102 6  
-- Name: postgis_dropbbox(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_dropbbox(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_dropBBOX';  
 
 
ALTER FUNCTION public.postgis_dropbbox(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 356 (class 1255 OID 18710)  
-- Dependencies: 6 1168  
-- Name: postgis_full_version(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_full_version() RETURNS text  
LANGUAGE plpgsql IMMUTABLE  
AS $$  
DECLARE  
libver text;  
projver text;  
geosver text;  
libxmlver text;  
usestats bool;  
dbproc text;  
relproc text;  
fullver text;  
BEGIN  
SELECT postgis_lib_version() INTO libver;  
SELECT postgis_proj_version() INTO projver;  
SELECT postgis_geos_version() INTO geosver;  
SELECT postgis_libxml_version() INTO libxmlver;  
SELECT postgis_uses_stats() INTO usestats;  
SELECT postgis_scripts_installed() INTO dbproc;  
SELECT postgis_scripts_released() INTO relproc;  
 
fullver = 'POSTGIS="' || libver || '"';  
 
IF geosver IS NOT NULL THEN  
fullver = fullver || ' GEOS="' || geosver || '"';  
END IF;  
 
IF projver IS NOT NULL THEN  
fullver = fullver || ' PROJ="' || projver || '"';  
END IF;  
 
IF libxmlver IS NOT NULL THEN  
fullver = fullver || ' LIBXML="' || libxmlver || '"';  
END IF;  
 
IF usestats THEN  
fullver = fullver || ' USE_STATS';  
END IF;  
 
-- fullver = fullver || ' DBPROC="' || dbproc || '"';  
-- fullver = fullver || ' RELPROC="' || relproc || '"';  
 
IF dbproc != relproc THEN  
fullver = fullver || ' (procs from ' || dbproc || ' need upgrade)';  
END IF;  
 
RETURN fullver;  
END  
$$;  
 
 
ALTER FUNCTION public.postgis_full_version() OWNER TO postgres;  
 
--  
-- TOC entry 357 (class 1255 OID 18711)  
-- Dependencies: 6  
-- Name: postgis_geos_version(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_geos_version() RETURNS text  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'postgis_geos_version';  
 
 
ALTER FUNCTION public.postgis_geos_version() OWNER TO postgres;  
 
--  
-- TOC entry 358 (class 1255 OID 18712)  
-- Dependencies: 1102 6 1087  
-- Name: postgis_getbbox(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_getbbox(geometry) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_to_BOX2DFLOAT4';  
 
 
ALTER FUNCTION public.postgis_getbbox(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 359 (class 1255 OID 18713)  
-- Dependencies: 6  
-- Name: postgis_gist_joinsel(internal, oid, internal, smallint); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_gist_joinsel(internal, oid, internal, smallint) RETURNS double precision  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'LWGEOM_gist_joinsel';  
 
 
ALTER FUNCTION public.postgis_gist_joinsel(internal, oid, internal, smallint) OWNER TO postgres;  
 
--  
-- TOC entry 360 (class 1255 OID 18714)  
-- Dependencies: 6  
-- Name: postgis_gist_sel(internal, oid, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_gist_sel(internal, oid, internal, integer) RETURNS double precision  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'LWGEOM_gist_sel';  
 
 
ALTER FUNCTION public.postgis_gist_sel(internal, oid, internal, integer) OWNER TO postgres;  
 
--  
-- TOC entry 361 (class 1255 OID 18715)  
-- Dependencies: 1102 6  
-- Name: postgis_hasbbox(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_hasbbox(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_hasBBOX';  
 
 
ALTER FUNCTION public.postgis_hasbbox(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 362 (class 1255 OID 18716)  
-- Dependencies: 6  
-- Name: postgis_lib_build_date(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_lib_build_date() RETURNS text  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'postgis_lib_build_date';  
 
 
ALTER FUNCTION public.postgis_lib_build_date() OWNER TO postgres;  
 
--  
-- TOC entry 363 (class 1255 OID 18717)  
-- Dependencies: 6  
-- Name: postgis_lib_version(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_lib_version() RETURNS text  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'postgis_lib_version';  
 
 
ALTER FUNCTION public.postgis_lib_version() OWNER TO postgres;  
 
--  
-- TOC entry 364 (class 1255 OID 18718)  
-- Dependencies: 6  
-- Name: postgis_libxml_version(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_libxml_version() RETURNS text  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'postgis_libxml_version';  
 
 
ALTER FUNCTION public.postgis_libxml_version() OWNER TO postgres;  
 
--  
-- TOC entry 365 (class 1255 OID 18719)  
-- Dependencies: 1102 6 1102  
-- Name: postgis_noop(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_noop(geometry) RETURNS geometry  
LANGUAGE c STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_noop';  
 
 
ALTER FUNCTION public.postgis_noop(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 366 (class 1255 OID 18720)  
-- Dependencies: 6  
-- Name: postgis_proj_version(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_proj_version() RETURNS text  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'postgis_proj_version';  
 
 
ALTER FUNCTION public.postgis_proj_version() OWNER TO postgres;  
 
--  
-- TOC entry 367 (class 1255 OID 18721)  
-- Dependencies: 6  
-- Name: postgis_scripts_build_date(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_scripts_build_date() RETURNS text  
LANGUAGE sql IMMUTABLE  
AS $$SELECT '2010-03-11 19:15:17'::text AS version$$;  
 
 
ALTER FUNCTION public.postgis_scripts_build_date() OWNER TO postgres;  
 
--  
-- TOC entry 368 (class 1255 OID 18722)  
-- Dependencies: 6  
-- Name: postgis_scripts_installed(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_scripts_installed() RETURNS text  
LANGUAGE sql IMMUTABLE  
AS $$SELECT '1.5 r5385'::text AS version$$;  
 
 
ALTER FUNCTION public.postgis_scripts_installed() OWNER TO postgres;  
 
--  
-- TOC entry 369 (class 1255 OID 18723)  
-- Dependencies: 6  
-- Name: postgis_scripts_released(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_scripts_released() RETURNS text  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'postgis_scripts_released';  
 
 
ALTER FUNCTION public.postgis_scripts_released() OWNER TO postgres;  
 
--  
-- TOC entry 370 (class 1255 OID 18724)  
-- Dependencies: 1102 6 1102  
-- Name: postgis_transform_geometry(geometry, text, text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_transform_geometry(geometry, text, text, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'transform_geom';  
 
 
ALTER FUNCTION public.postgis_transform_geometry(geometry, text, text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 371 (class 1255 OID 18725)  
-- Dependencies: 6  
-- Name: postgis_uses_stats(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_uses_stats() RETURNS boolean  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'postgis_uses_stats';  
 
 
ALTER FUNCTION public.postgis_uses_stats() OWNER TO postgres;  
 
--  
-- TOC entry 372 (class 1255 OID 18726)  
-- Dependencies: 6  
-- Name: postgis_version(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION postgis_version() RETURNS text  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'postgis_version';  
 
 
ALTER FUNCTION public.postgis_version() OWNER TO postgres;  
 
--  
-- TOC entry 373 (class 1255 OID 18727)  
-- Dependencies: 6 1168  
-- Name: probe_geometry_columns(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION probe_geometry_columns() RETURNS text  
LANGUAGE plpgsql  
AS $$  
DECLARE  
inserted integer;  
oldcount integer;  
probed integer;  
stale integer;  
BEGIN  
 
SELECT count(*) INTO oldcount FROM geometry_columns;  
 
SELECT count(*) INTO probed  
FROM pg_class c, pg_attribute a, pg_type t,  
pg_namespace n,  
pg_constraint sridcheck, pg_constraint typecheck  
 
WHERE t.typname = 'geometry'  
AND a.atttypid = t.oid  
AND a.attrelid = c.oid  
AND c.relnamespace = n.oid  
AND sridcheck.connamespace = n.oid  
AND typecheck.connamespace = n.oid  
AND sridcheck.conrelid = c.oid  
AND sridcheck.consrc LIKE '(srid('||a.attname||') = %)'  
AND typecheck.conrelid = c.oid  
AND typecheck.consrc LIKE  
'((geometrytype('||a.attname||') = ''%''::text) OR (% IS NULL))'  
;  
 
INSERT INTO geometry_columns SELECT  
''::varchar as f_table_catalogue,  
n.nspname::varchar as f_table_schema,  
c.relname::varchar as f_table_name,  
a.attname::varchar as f_geometry_column,  
2 as coord_dimension,  
trim(both ' =)' from  
replace(replace(split_part(  
sridcheck.consrc, ' = ', 2), ')', ''), '(', ''))::integer AS srid,  
trim(both ' =)''' from substr(typecheck.consrc,  
strpos(typecheck.consrc, '='),  
strpos(typecheck.consrc, '::')-  
strpos(typecheck.consrc, '=')  
))::varchar as type  
FROM pg_class c, pg_attribute a, pg_type t,  
pg_namespace n,  
pg_constraint sridcheck, pg_constraint typecheck  
WHERE t.typname = 'geometry'  
AND a.atttypid = t.oid  
AND a.attrelid = c.oid  
AND c.relnamespace = n.oid  
AND sridcheck.connamespace = n.oid  
AND typecheck.connamespace = n.oid  
AND sridcheck.conrelid = c.oid  
AND sridcheck.consrc LIKE '(st_srid('||a.attname||') = %)'  
AND typecheck.conrelid = c.oid  
AND typecheck.consrc LIKE  
'((geometrytype('||a.attname||') = ''%''::text) OR (% IS NULL))'  
 
AND NOT EXISTS (  
SELECT oid FROM geometry_columns gc  
WHERE c.relname::varchar = gc.f_table_name  
AND n.nspname::varchar = gc.f_table_schema  
AND a.attname::varchar = gc.f_geometry_column  
);  
 
GET DIAGNOSTICS inserted = ROW_COUNT;  
 
IF oldcount > probed THEN  
stale = oldcount-probed;  
ELSE  
stale = 0;  
END IF;  
 
RETURN 'probed:'||probed::text||  
' inserted:'||inserted::text||  
' conflicts:'||(probed-inserted)::text||  
' stale:'||stale::text;  
END  
 
$$;  
 
 
ALTER FUNCTION public.probe_geometry_columns() OWNER TO postgres;  
 
--  
-- TOC entry 374 (class 1255 OID 18728)  
-- Dependencies: 6 1102 1102  
-- Name: relate(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION relate(geometry, geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'relate_full';  
 
 
ALTER FUNCTION public.relate(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 375 (class 1255 OID 18729)  
-- Dependencies: 1102 6 1102  
-- Name: relate(geometry, geometry, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION relate(geometry, geometry, text) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'relate_pattern';  
 
 
ALTER FUNCTION public.relate(geometry, geometry, text) OWNER TO postgres;  
 
--  
-- TOC entry 376 (class 1255 OID 18730)  
-- Dependencies: 1102 6 1102  
-- Name: removepoint(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION removepoint(geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_removepoint';  
 
 
ALTER FUNCTION public.removepoint(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 377 (class 1255 OID 18731)  
-- Dependencies: 6  
-- Name: rename_geometry_table_constraints(); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION rename_geometry_table_constraints() RETURNS text  
LANGUAGE sql IMMUTABLE  
AS $$  
SELECT 'rename_geometry_table_constraint() is obsoleted'::text  
$$;  
 
 
ALTER FUNCTION public.rename_geometry_table_constraints() OWNER TO postgres;  
 
--  
-- TOC entry 378 (class 1255 OID 18732)  
-- Dependencies: 1102 6 1102  
-- Name: reverse(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION reverse(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_reverse';  
 
 
ALTER FUNCTION public.reverse(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 379 (class 1255 OID 18733)  
-- Dependencies: 1102 6 1102  
-- Name: rotate(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION rotate(geometry, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT rotateZ($1, $2)$_$;  
 
 
ALTER FUNCTION public.rotate(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 380 (class 1255 OID 18734)  
-- Dependencies: 1102 6 1102  
-- Name: rotatex(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION rotatex(geometry, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT affine($1, 1, 0, 0, 0, cos($2), -sin($2), 0, sin($2), cos($2), 0, 0, 0)$_$;  
 
 
ALTER FUNCTION public.rotatex(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 381 (class 1255 OID 18735)  
-- Dependencies: 1102 6 1102  
-- Name: rotatey(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION rotatey(geometry, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT affine($1, cos($2), 0, sin($2), 0, 1, 0, -sin($2), 0, cos($2), 0, 0, 0)$_$;  
 
 
ALTER FUNCTION public.rotatey(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 382 (class 1255 OID 18736)  
-- Dependencies: 1102 6 1102  
-- Name: rotatez(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION rotatez(geometry, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT affine($1, cos($2), -sin($2), 0, sin($2), cos($2), 0, 0, 0, 1, 0, 0, 0)$_$;  
 
 
ALTER FUNCTION public.rotatez(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 384 (class 1255 OID 18738)  
-- Dependencies: 6 1102 1102  
-- Name: scale(geometry, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION scale(geometry, double precision, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT scale($1, $2, $3, 1)$_$;  
 
 
ALTER FUNCTION public.scale(geometry, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 383 (class 1255 OID 18737)  
-- Dependencies: 6 1102 1102  
-- Name: scale(geometry, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION scale(geometry, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT affine($1, $2, 0, 0, 0, $3, 0, 0, 0, $4, 0, 0, 0)$_$;  
 
 
ALTER FUNCTION public.scale(geometry, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 385 (class 1255 OID 18739)  
-- Dependencies: 1102 6 1102  
-- Name: se_envelopesintersect(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION se_envelopesintersect(geometry, geometry) RETURNS boolean  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT $1 && $2  
$_$;  
 
 
ALTER FUNCTION public.se_envelopesintersect(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 386 (class 1255 OID 18740)  
-- Dependencies: 6 1102  
-- Name: se_is3d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION se_is3d(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_hasz';  
 
 
ALTER FUNCTION public.se_is3d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 387 (class 1255 OID 18741)  
-- Dependencies: 6 1102  
-- Name: se_ismeasured(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION se_ismeasured(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_hasm';  
 
 
ALTER FUNCTION public.se_ismeasured(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 388 (class 1255 OID 18742)  
-- Dependencies: 1102 6 1102  
-- Name: se_locatealong(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION se_locatealong(geometry, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT locate_between_measures($1, $2, $2) $_$;  
 
 
ALTER FUNCTION public.se_locatealong(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 389 (class 1255 OID 18743)  
-- Dependencies: 1102 6 1102  
-- Name: se_locatebetween(geometry, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION se_locatebetween(geometry, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_locate_between_m';  
 
 
ALTER FUNCTION public.se_locatebetween(geometry, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 390 (class 1255 OID 18744)  
-- Dependencies: 6 1102  
-- Name: se_m(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION se_m(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_m_point';  
 
 
ALTER FUNCTION public.se_m(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 391 (class 1255 OID 18745)  
-- Dependencies: 6 1102  
-- Name: se_z(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION se_z(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_z_point';  
 
 
ALTER FUNCTION public.se_z(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 392 (class 1255 OID 18746)  
-- Dependencies: 1102 6 1102  
-- Name: segmentize(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION segmentize(geometry, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_segmentize2d';  
 
 
ALTER FUNCTION public.segmentize(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 393 (class 1255 OID 18747)  
-- Dependencies: 1096 6 1096  
-- Name: setfactor(chip, real); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION setfactor(chip, real) RETURNS chip  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_setFactor';  
 
 
ALTER FUNCTION public.setfactor(chip, real) OWNER TO postgres;  
 
--  
-- TOC entry 394 (class 1255 OID 18748)  
-- Dependencies: 1102 6 1102 1102  
-- Name: setpoint(geometry, integer, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION setpoint(geometry, integer, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_setpoint_linestring';  
 
 
ALTER FUNCTION public.setpoint(geometry, integer, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 395 (class 1255 OID 18749)  
-- Dependencies: 1096 6 1096  
-- Name: setsrid(chip, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION setsrid(chip, integer) RETURNS chip  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_setSRID';  
 
 
ALTER FUNCTION public.setsrid(chip, integer) OWNER TO postgres;  
 
--  
-- TOC entry 396 (class 1255 OID 18750)  
-- Dependencies: 1102 6 1102  
-- Name: setsrid(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION setsrid(geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_setSRID';  
 
 
ALTER FUNCTION public.setsrid(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 397 (class 1255 OID 18751)  
-- Dependencies: 6 1102 1102  
-- Name: shift_longitude(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION shift_longitude(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_longitude_shift';  
 
 
ALTER FUNCTION public.shift_longitude(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 398 (class 1255 OID 18752)  
-- Dependencies: 6 1102 1102  
-- Name: simplify(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION simplify(geometry, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_simplify2d';  
 
 
ALTER FUNCTION public.simplify(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 401 (class 1255 OID 18755)  
-- Dependencies: 1102 6 1102  
-- Name: snaptogrid(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION snaptogrid(geometry, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT SnapToGrid($1, 0, 0, $2, $2)$_$;  
 
 
ALTER FUNCTION public.snaptogrid(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 400 (class 1255 OID 18754)  
-- Dependencies: 1102 6 1102  
-- Name: snaptogrid(geometry, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION snaptogrid(geometry, double precision, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT SnapToGrid($1, 0, 0, $2, $3)$_$;  
 
 
ALTER FUNCTION public.snaptogrid(geometry, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 399 (class 1255 OID 18753)  
-- Dependencies: 6 1102 1102  
-- Name: snaptogrid(geometry, double precision, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION snaptogrid(geometry, double precision, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_snaptogrid';  
 
 
ALTER FUNCTION public.snaptogrid(geometry, double precision, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 402 (class 1255 OID 18756)  
-- Dependencies: 1102 6 1102 1102  
-- Name: snaptogrid(geometry, geometry, double precision, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION snaptogrid(geometry, geometry, double precision, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_snaptogrid_pointoff';  
 
 
ALTER FUNCTION public.snaptogrid(geometry, geometry, double precision, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 403 (class 1255 OID 18757)  
-- Dependencies: 6 1096  
-- Name: srid(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION srid(chip) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_getSRID';  
 
 
ALTER FUNCTION public.srid(chip) OWNER TO postgres;  
 
--  
-- TOC entry 404 (class 1255 OID 18758)  
-- Dependencies: 6 1102  
-- Name: srid(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION srid(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_getSRID';  
 
 
ALTER FUNCTION public.srid(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 405 (class 1255 OID 18759)  
-- Dependencies: 6 1102 1102  
-- Name: st_addmeasure(geometry, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_addmeasure(geometry, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'ST_AddMeasure';  
 
 
ALTER FUNCTION public.st_addmeasure(geometry, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 406 (class 1255 OID 18760)  
-- Dependencies: 6 1102 1102 1102  
-- Name: st_addpoint(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_addpoint(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_addpoint';  
 
 
ALTER FUNCTION public.st_addpoint(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 407 (class 1255 OID 18761)  
-- Dependencies: 6 1102 1102 1102  
-- Name: st_addpoint(geometry, geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_addpoint(geometry, geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_addpoint';  
 
 
ALTER FUNCTION public.st_addpoint(geometry, geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 409 (class 1255 OID 18763)  
-- Dependencies: 6 1102 1102  
-- Name: st_affine(geometry, double precision, double precision, double precision, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_affine(geometry, double precision, double precision, double precision, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT affine($1, $2, $3, 0, $4, $5, 0, 0, 0, 1, $6, $7, 0)$_$;  
 
 
ALTER FUNCTION public.st_affine(geometry, double precision, double precision, double precision, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 408 (class 1255 OID 18762)  
-- Dependencies: 6 1102 1102  
-- Name: st_affine(geometry, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_affine(geometry, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_affine';  
 
 
ALTER FUNCTION public.st_affine(geometry, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 410 (class 1255 OID 18764)  
-- Dependencies: 6 1102  
-- Name: st_area(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_area(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_area_polygon';  
 
 
ALTER FUNCTION public.st_area(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 412 (class 1255 OID 18766)  
-- Dependencies: 6 1099  
-- Name: st_area(geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_area(geography) RETURNS double precision  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT ST_Area($1, true)$_$;  
 
 
ALTER FUNCTION public.st_area(geography) OWNER TO postgres;  
 
--  
-- TOC entry 413 (class 1255 OID 18767)  
-- Dependencies: 6  
-- Name: st_area(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_area(text) RETURNS double precision  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_Area($1::geometry); $_$;  
 
 
ALTER FUNCTION public.st_area(text) OWNER TO postgres;  
 
--  
-- TOC entry 411 (class 1255 OID 18765)  
-- Dependencies: 6 1099  
-- Name: st_area(geography, boolean); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_area(geography, boolean) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'geography_area';  
 
 
ALTER FUNCTION public.st_area(geography, boolean) OWNER TO postgres;  
 
--  
-- TOC entry 414 (class 1255 OID 18768)  
-- Dependencies: 6 1102  
-- Name: st_area2d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_area2d(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_area_polygon';  
 
 
ALTER FUNCTION public.st_area2d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 415 (class 1255 OID 18769)  
-- Dependencies: 6 1102  
-- Name: st_asbinary(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asbinary(geometry) RETURNS bytea  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asBinary';  
 
 
ALTER FUNCTION public.st_asbinary(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 417 (class 1255 OID 18771)  
-- Dependencies: 6 1099  
-- Name: st_asbinary(geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asbinary(geography) RETURNS bytea  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_as_binary';  
 
 
ALTER FUNCTION public.st_asbinary(geography) OWNER TO postgres;  
 
--  
-- TOC entry 418 (class 1255 OID 18772)  
-- Dependencies: 6  
-- Name: st_asbinary(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asbinary(text) RETURNS bytea  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_AsBinary($1::geometry); $_$;  
 
 
ALTER FUNCTION public.st_asbinary(text) OWNER TO postgres;  
 
--  
-- TOC entry 416 (class 1255 OID 18770)  
-- Dependencies: 6 1102  
-- Name: st_asbinary(geometry, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asbinary(geometry, text) RETURNS bytea  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asBinary';  
 
 
ALTER FUNCTION public.st_asbinary(geometry, text) OWNER TO postgres;  
 
--  
-- TOC entry 419 (class 1255 OID 18773)  
-- Dependencies: 6 1102  
-- Name: st_asewkb(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asewkb(geometry) RETURNS bytea  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'WKBFromLWGEOM';  
 
 
ALTER FUNCTION public.st_asewkb(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 420 (class 1255 OID 18774)  
-- Dependencies: 6 1102  
-- Name: st_asewkb(geometry, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asewkb(geometry, text) RETURNS bytea  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'WKBFromLWGEOM';  
 
 
ALTER FUNCTION public.st_asewkb(geometry, text) OWNER TO postgres;  
 
--  
-- TOC entry 421 (class 1255 OID 18775)  
-- Dependencies: 6 1102  
-- Name: st_asewkt(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asewkt(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asEWKT';  
 
 
ALTER FUNCTION public.st_asewkt(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 423 (class 1255 OID 18777)  
-- Dependencies: 6 1102  
-- Name: st_asgeojson(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgeojson(geometry) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGeoJson(1, $1, 15, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgeojson(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 429 (class 1255 OID 18783)  
-- Dependencies: 6 1099  
-- Name: st_asgeojson(geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgeojson(geography) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGeoJson(1, $1, 15, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgeojson(geography) OWNER TO postgres;  
 
--  
-- TOC entry 430 (class 1255 OID 18784)  
-- Dependencies: 6  
-- Name: st_asgeojson(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgeojson(text) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_AsGeoJson($1::geometry); $_$;  
 
 
ALTER FUNCTION public.st_asgeojson(text) OWNER TO postgres;  
 
--  
-- TOC entry 422 (class 1255 OID 18776)  
-- Dependencies: 6 1102  
-- Name: st_asgeojson(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgeojson(geometry, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGeoJson(1, $1, $2, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgeojson(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 424 (class 1255 OID 18778)  
-- Dependencies: 6 1102  
-- Name: st_asgeojson(integer, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgeojson(integer, geometry) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGeoJson($1, $2, 15, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgeojson(integer, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 428 (class 1255 OID 18782)  
-- Dependencies: 6 1099  
-- Name: st_asgeojson(geography, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgeojson(geography, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGeoJson(1, $1, $2, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgeojson(geography, integer) OWNER TO postgres;  
 
--  
-- TOC entry 431 (class 1255 OID 18785)  
-- Dependencies: 6 1099  
-- Name: st_asgeojson(integer, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgeojson(integer, geography) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGeoJson($1, $2, 15, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgeojson(integer, geography) OWNER TO postgres;  
 
--  
-- TOC entry 425 (class 1255 OID 18779)  
-- Dependencies: 6 1102  
-- Name: st_asgeojson(integer, geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgeojson(integer, geometry, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGeoJson($1, $2, $3, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgeojson(integer, geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 426 (class 1255 OID 18780)  
-- Dependencies: 6 1102  
-- Name: st_asgeojson(geometry, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgeojson(geometry, integer, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGeoJson(1, $1, $2, $3)$_$;  
 
 
ALTER FUNCTION public.st_asgeojson(geometry, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 432 (class 1255 OID 18786)  
-- Dependencies: 6 1099  
-- Name: st_asgeojson(integer, geography, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgeojson(integer, geography, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGeoJson($1, $2, $3, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgeojson(integer, geography, integer) OWNER TO postgres;  
 
--  
-- TOC entry 433 (class 1255 OID 18787)  
-- Dependencies: 6 1099  
-- Name: st_asgeojson(geography, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgeojson(geography, integer, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGeoJson(1, $1, $2, $3)$_$;  
 
 
ALTER FUNCTION public.st_asgeojson(geography, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 427 (class 1255 OID 18781)  
-- Dependencies: 6 1102  
-- Name: st_asgeojson(integer, geometry, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgeojson(integer, geometry, integer, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGeoJson($1, $2, $3, $4)$_$;  
 
 
ALTER FUNCTION public.st_asgeojson(integer, geometry, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 434 (class 1255 OID 18788)  
-- Dependencies: 6 1099  
-- Name: st_asgeojson(integer, geography, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgeojson(integer, geography, integer, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGeoJson($1, $2, $3, $4)$_$;  
 
 
ALTER FUNCTION public.st_asgeojson(integer, geography, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 436 (class 1255 OID 18790)  
-- Dependencies: 6 1102  
-- Name: st_asgml(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgml(geometry) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGML(2, $1, 15, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgml(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 442 (class 1255 OID 18796)  
-- Dependencies: 6 1099  
-- Name: st_asgml(geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgml(geography) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGML(2, $1, 15, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgml(geography) OWNER TO postgres;  
 
--  
-- TOC entry 443 (class 1255 OID 18797)  
-- Dependencies: 6  
-- Name: st_asgml(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgml(text) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_AsGML($1::geometry); $_$;  
 
 
ALTER FUNCTION public.st_asgml(text) OWNER TO postgres;  
 
--  
-- TOC entry 435 (class 1255 OID 18789)  
-- Dependencies: 6 1102  
-- Name: st_asgml(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgml(geometry, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGML(2, $1, $2, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgml(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 437 (class 1255 OID 18791)  
-- Dependencies: 6 1102  
-- Name: st_asgml(integer, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgml(integer, geometry) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGML($1, $2, 15, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgml(integer, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 441 (class 1255 OID 18795)  
-- Dependencies: 6 1099  
-- Name: st_asgml(geography, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgml(geography, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGML(2, $1, $2, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgml(geography, integer) OWNER TO postgres;  
 
--  
-- TOC entry 444 (class 1255 OID 18798)  
-- Dependencies: 6 1099  
-- Name: st_asgml(integer, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgml(integer, geography) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGML($1, $2, 15, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgml(integer, geography) OWNER TO postgres;  
 
--  
-- TOC entry 438 (class 1255 OID 18792)  
-- Dependencies: 6 1102  
-- Name: st_asgml(integer, geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgml(integer, geometry, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGML($1, $2, $3, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgml(integer, geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 439 (class 1255 OID 18793)  
-- Dependencies: 6 1102  
-- Name: st_asgml(geometry, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgml(geometry, integer, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGML(2, $1, $2, $3)$_$;  
 
 
ALTER FUNCTION public.st_asgml(geometry, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 445 (class 1255 OID 18799)  
-- Dependencies: 6 1099  
-- Name: st_asgml(integer, geography, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgml(integer, geography, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGML($1, $2, $3, 0)$_$;  
 
 
ALTER FUNCTION public.st_asgml(integer, geography, integer) OWNER TO postgres;  
 
--  
-- TOC entry 446 (class 1255 OID 18800)  
-- Dependencies: 6 1099  
-- Name: st_asgml(geography, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgml(geography, integer, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGML(2, $1, $2, $3)$_$;  
 
 
ALTER FUNCTION public.st_asgml(geography, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 440 (class 1255 OID 18794)  
-- Dependencies: 6 1102  
-- Name: st_asgml(integer, geometry, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgml(integer, geometry, integer, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGML($1, $2, $3, $4)$_$;  
 
 
ALTER FUNCTION public.st_asgml(integer, geometry, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 447 (class 1255 OID 18801)  
-- Dependencies: 6 1099  
-- Name: st_asgml(integer, geography, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_asgml(integer, geography, integer, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsGML($1, $2, $3, $4)$_$;  
 
 
ALTER FUNCTION public.st_asgml(integer, geography, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 448 (class 1255 OID 18802)  
-- Dependencies: 6 1102  
-- Name: st_ashexewkb(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_ashexewkb(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asHEXEWKB';  
 
 
ALTER FUNCTION public.st_ashexewkb(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 449 (class 1255 OID 18803)  
-- Dependencies: 6 1102  
-- Name: st_ashexewkb(geometry, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_ashexewkb(geometry, text) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asHEXEWKB';  
 
 
ALTER FUNCTION public.st_ashexewkb(geometry, text) OWNER TO postgres;  
 
--  
-- TOC entry 451 (class 1255 OID 18805)  
-- Dependencies: 6 1102  
-- Name: st_askml(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_askml(geometry) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsKML(2, ST_Transform($1,4326), 15)$_$;  
 
 
ALTER FUNCTION public.st_askml(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 455 (class 1255 OID 18809)  
-- Dependencies: 6 1099  
-- Name: st_askml(geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_askml(geography) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsKML(2, $1, 15)$_$;  
 
 
ALTER FUNCTION public.st_askml(geography) OWNER TO postgres;  
 
--  
-- TOC entry 456 (class 1255 OID 18810)  
-- Dependencies: 6  
-- Name: st_askml(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_askml(text) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_AsKML($1::geometry); $_$;  
 
 
ALTER FUNCTION public.st_askml(text) OWNER TO postgres;  
 
--  
-- TOC entry 450 (class 1255 OID 18804)  
-- Dependencies: 6 1102  
-- Name: st_askml(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_askml(geometry, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsKML(2, ST_Transform($1,4326), $2)$_$;  
 
 
ALTER FUNCTION public.st_askml(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 452 (class 1255 OID 18806)  
-- Dependencies: 6 1102  
-- Name: st_askml(integer, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_askml(integer, geometry) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsKML($1, ST_Transform($2,4326), 15)$_$;  
 
 
ALTER FUNCTION public.st_askml(integer, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 454 (class 1255 OID 18808)  
-- Dependencies: 1099 6  
-- Name: st_askml(geography, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_askml(geography, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsKML(2, $1, $2)$_$;  
 
 
ALTER FUNCTION public.st_askml(geography, integer) OWNER TO postgres;  
 
--  
-- TOC entry 457 (class 1255 OID 18811)  
-- Dependencies: 6 1099  
-- Name: st_askml(integer, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_askml(integer, geography) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsKML($1, $2, 15)$_$;  
 
 
ALTER FUNCTION public.st_askml(integer, geography) OWNER TO postgres;  
 
--  
-- TOC entry 453 (class 1255 OID 18807)  
-- Dependencies: 6 1102  
-- Name: st_askml(integer, geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_askml(integer, geometry, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsKML($1, ST_Transform($2,4326), $3)$_$;  
 
 
ALTER FUNCTION public.st_askml(integer, geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 458 (class 1255 OID 18812)  
-- Dependencies: 6 1099  
-- Name: st_askml(integer, geography, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_askml(integer, geography, integer) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_AsKML($1, $2, $3)$_$;  
 
 
ALTER FUNCTION public.st_askml(integer, geography, integer) OWNER TO postgres;  
 
--  
-- TOC entry 461 (class 1255 OID 18815)  
-- Dependencies: 6 1102  
-- Name: st_assvg(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_assvg(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'assvg_geometry';  
 
 
ALTER FUNCTION public.st_assvg(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 464 (class 1255 OID 18818)  
-- Dependencies: 6 1099  
-- Name: st_assvg(geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_assvg(geography) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_as_svg';  
 
 
ALTER FUNCTION public.st_assvg(geography) OWNER TO postgres;  
 
--  
-- TOC entry 465 (class 1255 OID 18819)  
-- Dependencies: 6  
-- Name: st_assvg(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_assvg(text) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_AsSVG($1::geometry); $_$;  
 
 
ALTER FUNCTION public.st_assvg(text) OWNER TO postgres;  
 
--  
-- TOC entry 460 (class 1255 OID 18814)  
-- Dependencies: 6 1102  
-- Name: st_assvg(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_assvg(geometry, integer) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'assvg_geometry';  
 
 
ALTER FUNCTION public.st_assvg(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 463 (class 1255 OID 18817)  
-- Dependencies: 6 1099  
-- Name: st_assvg(geography, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_assvg(geography, integer) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_as_svg';  
 
 
ALTER FUNCTION public.st_assvg(geography, integer) OWNER TO postgres;  
 
--  
-- TOC entry 459 (class 1255 OID 18813)  
-- Dependencies: 6 1102  
-- Name: st_assvg(geometry, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_assvg(geometry, integer, integer) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'assvg_geometry';  
 
 
ALTER FUNCTION public.st_assvg(geometry, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 462 (class 1255 OID 18816)  
-- Dependencies: 6 1099  
-- Name: st_assvg(geography, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_assvg(geography, integer, integer) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_as_svg';  
 
 
ALTER FUNCTION public.st_assvg(geography, integer, integer) OWNER TO postgres;  
 
--  
-- TOC entry 466 (class 1255 OID 18820)  
-- Dependencies: 6 1102  
-- Name: st_astext(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_astext(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_asText';  
 
 
ALTER FUNCTION public.st_astext(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 467 (class 1255 OID 18821)  
-- Dependencies: 6 1099  
-- Name: st_astext(geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_astext(geography) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_as_text';  
 
 
ALTER FUNCTION public.st_astext(geography) OWNER TO postgres;  
 
--  
-- TOC entry 468 (class 1255 OID 18822)  
-- Dependencies: 6  
-- Name: st_astext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_astext(text) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_AsText($1::geometry); $_$;  
 
 
ALTER FUNCTION public.st_astext(text) OWNER TO postgres;  
 
--  
-- TOC entry 469 (class 1255 OID 18823)  
-- Dependencies: 6 1102 1102  
-- Name: st_azimuth(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_azimuth(geometry, geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_azimuth';  
 
 
ALTER FUNCTION public.st_azimuth(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 470 (class 1255 OID 18824)  
-- Dependencies: 6 1168 1102  
-- Name: st_bdmpolyfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_bdmpolyfromtext(text, integer) RETURNS geometry  
LANGUAGE plpgsql IMMUTABLE STRICT  
AS $_$  
DECLARE  
geomtext alias for $1;  
srid alias for $2;  
mline geometry;  
geom geometry;  
BEGIN  
mline := ST_MultiLineStringFromText(geomtext, srid);  
 
IF mline IS NULL  
THEN  
RAISE EXCEPTION 'Input is not a MultiLinestring';  
END IF;  
 
geom := multi(ST_BuildArea(mline));  
 
RETURN geom;  
END;  
$_$;  
 
 
ALTER FUNCTION public.st_bdmpolyfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 471 (class 1255 OID 18825)  
-- Dependencies: 6 1168 1102  
-- Name: st_bdpolyfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_bdpolyfromtext(text, integer) RETURNS geometry  
LANGUAGE plpgsql IMMUTABLE STRICT  
AS $_$  
DECLARE  
geomtext alias for $1;  
srid alias for $2;  
mline geometry;  
geom geometry;  
BEGIN  
mline := ST_MultiLineStringFromText(geomtext, srid);  
 
IF mline IS NULL  
THEN  
RAISE EXCEPTION 'Input is not a MultiLinestring';  
END IF;  
 
geom := ST_BuildArea(mline);  
 
IF GeometryType(geom) != 'POLYGON'  
THEN  
RAISE EXCEPTION 'Input returns more then a single polygon, try using BdMPolyFromText instead';  
END IF;  
 
RETURN geom;  
END;  
$_$;  
 
 
ALTER FUNCTION public.st_bdpolyfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 472 (class 1255 OID 18826)  
-- Dependencies: 6 1102 1102  
-- Name: st_boundary(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_boundary(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'boundary';  
 
 
ALTER FUNCTION public.st_boundary(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 473 (class 1255 OID 18827)  
-- Dependencies: 6 1102  
-- Name: st_box(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_box(geometry) RETURNS box  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_to_BOX';  
 
 
ALTER FUNCTION public.st_box(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 474 (class 1255 OID 18828)  
-- Dependencies: 6 1090  
-- Name: st_box(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_box(box3d) RETURNS box  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_to_BOX';  
 
 
ALTER FUNCTION public.st_box(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 475 (class 1255 OID 18829)  
-- Dependencies: 6 1087 1102  
-- Name: st_box2d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_box2d(geometry) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_to_BOX2DFLOAT4';  
 
 
ALTER FUNCTION public.st_box2d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 476 (class 1255 OID 18830)  
-- Dependencies: 6 1087 1090  
-- Name: st_box2d(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_box2d(box3d) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_to_BOX2DFLOAT4';  
 
 
ALTER FUNCTION public.st_box2d(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 477 (class 1255 OID 18831)  
-- Dependencies: 6 1087 1093  
-- Name: st_box2d(box3d_extent); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_box2d(box3d_extent) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_to_BOX2DFLOAT4';  
 
 
ALTER FUNCTION public.st_box2d(box3d_extent) OWNER TO postgres;  
 
--  
-- TOC entry 478 (class 1255 OID 18832)  
-- Dependencies: 6 1087  
-- Name: st_box2d_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_box2d_in(cstring) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_in';  
 
 
ALTER FUNCTION public.st_box2d_in(cstring) OWNER TO postgres;  
 
--  
-- TOC entry 479 (class 1255 OID 18833)  
-- Dependencies: 6 1087  
-- Name: st_box2d_out(box2d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_box2d_out(box2d) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_out';  
 
 
ALTER FUNCTION public.st_box2d_out(box2d) OWNER TO postgres;  
 
--  
-- TOC entry 480 (class 1255 OID 18834)  
-- Dependencies: 6 1090 1102  
-- Name: st_box3d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_box3d(geometry) RETURNS box3d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_to_BOX3D';  
 
 
ALTER FUNCTION public.st_box3d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 481 (class 1255 OID 18835)  
-- Dependencies: 6 1090 1087  
-- Name: st_box3d(box2d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_box3d(box2d) RETURNS box3d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_to_BOX3D';  
 
 
ALTER FUNCTION public.st_box3d(box2d) OWNER TO postgres;  
 
--  
-- TOC entry 482 (class 1255 OID 18836)  
-- Dependencies: 6 1090 1093  
-- Name: st_box3d_extent(box3d_extent); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_box3d_extent(box3d_extent) RETURNS box3d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_extent_to_BOX3D';  
 
 
ALTER FUNCTION public.st_box3d_extent(box3d_extent) OWNER TO postgres;  
 
--  
-- TOC entry 483 (class 1255 OID 18837)  
-- Dependencies: 6 1090  
-- Name: st_box3d_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_box3d_in(cstring) RETURNS box3d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_in';  
 
 
ALTER FUNCTION public.st_box3d_in(cstring) OWNER TO postgres;  
 
--  
-- TOC entry 484 (class 1255 OID 18838)  
-- Dependencies: 6 1090  
-- Name: st_box3d_out(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_box3d_out(box3d) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_out';  
 
 
ALTER FUNCTION public.st_box3d_out(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 485 (class 1255 OID 18839)  
-- Dependencies: 6 1102 1102  
-- Name: st_buffer(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_buffer(geometry, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'buffer';  
 
 
ALTER FUNCTION public.st_buffer(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 488 (class 1255 OID 18842)  
-- Dependencies: 6 1099 1099  
-- Name: st_buffer(geography, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_buffer(geography, double precision) RETURNS geography  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT geography(ST_Transform(ST_Buffer(ST_Transform(geometry($1), _ST_BestSRID($1)), $2), 4326))$_$;  
 
 
ALTER FUNCTION public.st_buffer(geography, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 489 (class 1255 OID 18843)  
-- Dependencies: 6 1102  
-- Name: st_buffer(text, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_buffer(text, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_Buffer($1::geometry, $2); $_$;  
 
 
ALTER FUNCTION public.st_buffer(text, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 486 (class 1255 OID 18840)  
-- Dependencies: 6 1102 1102  
-- Name: st_buffer(geometry, double precision, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_buffer(geometry, double precision, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT _ST_Buffer($1, $2,  
CAST('quad_segs='||CAST($3 AS text) as cstring))  
$_$;  
 
 
ALTER FUNCTION public.st_buffer(geometry, double precision, integer) OWNER TO postgres;  
 
--  
-- TOC entry 487 (class 1255 OID 18841)  
-- Dependencies: 6 1102 1102  
-- Name: st_buffer(geometry, double precision, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_buffer(geometry, double precision, text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT _ST_Buffer($1, $2,  
CAST( regexp_replace($3, '^[0123456789]+$',  
'quad_segs='||$3) AS cstring)  
)  
$_$;  
 
 
ALTER FUNCTION public.st_buffer(geometry, double precision, text) OWNER TO postgres;  
 
--  
-- TOC entry 490 (class 1255 OID 18844)  
-- Dependencies: 6 1102 1102  
-- Name: st_buildarea(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_buildarea(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_buildarea';  
 
 
ALTER FUNCTION public.st_buildarea(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 491 (class 1255 OID 18845)  
-- Dependencies: 6 1102  
-- Name: st_bytea(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_bytea(geometry) RETURNS bytea  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_to_bytea';  
 
 
ALTER FUNCTION public.st_bytea(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 492 (class 1255 OID 18846)  
-- Dependencies: 6 1102 1102  
-- Name: st_centroid(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_centroid(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'centroid';  
 
 
ALTER FUNCTION public.st_centroid(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 493 (class 1255 OID 18847)  
-- Dependencies: 6 1096  
-- Name: st_chip_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_chip_in(cstring) RETURNS chip  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_in';  
 
 
ALTER FUNCTION public.st_chip_in(cstring) OWNER TO postgres;  
 
--  
-- TOC entry 494 (class 1255 OID 18848)  
-- Dependencies: 6 1096  
-- Name: st_chip_out(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_chip_out(chip) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_out';  
 
 
ALTER FUNCTION public.st_chip_out(chip) OWNER TO postgres;  
 
--  
-- TOC entry 495 (class 1255 OID 18849)  
-- Dependencies: 6 1102 1102 1102  
-- Name: st_closestpoint(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_closestpoint(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_closestpoint';  
 
 
ALTER FUNCTION public.st_closestpoint(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 497 (class 1255 OID 18851)  
-- Dependencies: 6 1102 1104  
-- Name: st_collect(geometry[]); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_collect(geometry[]) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_collect_garray';  
 
 
ALTER FUNCTION public.st_collect(geometry[]) OWNER TO postgres;  
 
--  
-- TOC entry 496 (class 1255 OID 18850)  
-- Dependencies: 6 1102 1102 1102  
-- Name: st_collect(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_collect(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'LWGEOM_collect';  
 
 
ALTER FUNCTION public.st_collect(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 498 (class 1255 OID 18852)  
-- Dependencies: 6 1102 1102  
-- Name: st_collectionextract(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_collectionextract(geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'ST_CollectionExtract';  
 
 
ALTER FUNCTION public.st_collectionextract(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 499 (class 1255 OID 18853)  
-- Dependencies: 6 1087 1087 1102  
-- Name: st_combine_bbox(box2d, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_combine_bbox(box2d, geometry) RETURNS box2d  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_combine';  
 
 
ALTER FUNCTION public.st_combine_bbox(box2d, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 500 (class 1255 OID 18854)  
-- Dependencies: 6 1093 1093 1102  
-- Name: st_combine_bbox(box3d_extent, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_combine_bbox(box3d_extent, geometry) RETURNS box3d_extent  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'BOX3D_combine';  
 
 
ALTER FUNCTION public.st_combine_bbox(box3d_extent, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 501 (class 1255 OID 18855)  
-- Dependencies: 6 1090 1090 1102  
-- Name: st_combine_bbox(box3d, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_combine_bbox(box3d, geometry) RETURNS box3d  
LANGUAGE c IMMUTABLE  
AS '$libdir/postgis-1.5', 'BOX3D_combine';  
 
 
ALTER FUNCTION public.st_combine_bbox(box3d, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 502 (class 1255 OID 18856)  
-- Dependencies: 6 1096  
-- Name: st_compression(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_compression(chip) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_getCompression';  
 
 
ALTER FUNCTION public.st_compression(chip) OWNER TO postgres;  
 
--  
-- TOC entry 503 (class 1255 OID 18857)  
-- Dependencies: 6 1102 1102  
-- Name: st_contains(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_contains(geometry, geometry) RETURNS boolean  
LANGUAGE sql IMMUTABLE  
AS $_$SELECT $1 && $2 AND _ST_Contains($1,$2)$_$;  
 
 
ALTER FUNCTION public.st_contains(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 504 (class 1255 OID 18858)  
-- Dependencies: 6 1102 1102  
-- Name: st_containsproperly(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_containsproperly(geometry, geometry) RETURNS boolean  
LANGUAGE sql IMMUTABLE  
AS $_$SELECT $1 && $2 AND _ST_ContainsProperly($1,$2)$_$;  
 
 
ALTER FUNCTION public.st_containsproperly(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 505 (class 1255 OID 18859)  
-- Dependencies: 6 1102 1102  
-- Name: st_convexhull(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_convexhull(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'convexhull';  
 
 
ALTER FUNCTION public.st_convexhull(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 506 (class 1255 OID 18860)  
-- Dependencies: 6 1102  
-- Name: st_coorddim(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_coorddim(geometry) RETURNS smallint  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_ndims';  
 
 
ALTER FUNCTION public.st_coorddim(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 507 (class 1255 OID 18861)  
-- Dependencies: 6 1102 1102  
-- Name: st_coveredby(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_coveredby(geometry, geometry) RETURNS boolean  
LANGUAGE sql IMMUTABLE  
AS $_$SELECT $1 && $2 AND _ST_CoveredBy($1,$2)$_$;  
 
 
ALTER FUNCTION public.st_coveredby(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 508 (class 1255 OID 18862)  
-- Dependencies: 6 1099 1099  
-- Name: st_coveredby(geography, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_coveredby(geography, geography) RETURNS boolean  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT $1 && $2 AND _ST_Covers($2, $1)$_$;  
 
 
ALTER FUNCTION public.st_coveredby(geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 509 (class 1255 OID 18863)  
-- Dependencies: 6  
-- Name: st_coveredby(text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_coveredby(text, text) RETURNS boolean  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_CoveredBy($1::geometry, $2::geometry); $_$;  
 
 
ALTER FUNCTION public.st_coveredby(text, text) OWNER TO postgres;  
 
--  
-- TOC entry 510 (class 1255 OID 18864)  
-- Dependencies: 6 1102 1102  
-- Name: st_covers(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_covers(geometry, geometry) RETURNS boolean  
LANGUAGE sql IMMUTABLE  
AS $_$SELECT $1 && $2 AND _ST_Covers($1,$2)$_$;  
 
 
ALTER FUNCTION public.st_covers(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 511 (class 1255 OID 18865)  
-- Dependencies: 6 1099 1099  
-- Name: st_covers(geography, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_covers(geography, geography) RETURNS boolean  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT $1 && $2 AND _ST_Covers($1, $2)$_$;  
 
 
ALTER FUNCTION public.st_covers(geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 512 (class 1255 OID 18866)  
-- Dependencies: 6  
-- Name: st_covers(text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_covers(text, text) RETURNS boolean  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_Covers($1::geometry, $2::geometry); $_$;  
 
 
ALTER FUNCTION public.st_covers(text, text) OWNER TO postgres;  
 
--  
-- TOC entry 513 (class 1255 OID 18867)  
-- Dependencies: 6 1102 1102  
-- Name: st_crosses(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_crosses(geometry, geometry) RETURNS boolean  
LANGUAGE sql IMMUTABLE  
AS $_$SELECT $1 && $2 AND _ST_Crosses($1,$2)$_$;  
 
 
ALTER FUNCTION public.st_crosses(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 515 (class 1255 OID 18869)  
-- Dependencies: 6 1102 1102  
-- Name: st_curvetoline(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_curvetoline(geometry) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT ST_CurveToLine($1, 32)$_$;  
 
 
ALTER FUNCTION public.st_curvetoline(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 514 (class 1255 OID 18868)  
-- Dependencies: 6 1102 1102  
-- Name: st_curvetoline(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_curvetoline(geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_curve_segmentize';  
 
 
ALTER FUNCTION public.st_curvetoline(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 516 (class 1255 OID 18870)  
-- Dependencies: 6 1096  
-- Name: st_datatype(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_datatype(chip) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_getDatatype';  
 
 
ALTER FUNCTION public.st_datatype(chip) OWNER TO postgres;  
 
--  
-- TOC entry 517 (class 1255 OID 18871)  
-- Dependencies: 6 1102 1102  
-- Name: st_dfullywithin(geometry, geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_dfullywithin(geometry, geometry, double precision) RETURNS boolean  
LANGUAGE sql IMMUTABLE  
AS $_$SELECT $1 && ST_Expand($2,$3) AND $2 && ST_Expand($1,$3) AND _ST_DFullyWithin(ST_ConvexHull($1), ST_ConvexHull($2), $3)$_$;  
 
 
ALTER FUNCTION public.st_dfullywithin(geometry, geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 518 (class 1255 OID 18872)  
-- Dependencies: 6 1102 1102 1102  
-- Name: st_difference(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_difference(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'difference';  
 
 
ALTER FUNCTION public.st_difference(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 519 (class 1255 OID 18873)  
-- Dependencies: 6 1102  
-- Name: st_dimension(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_dimension(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_dimension';  
 
 
ALTER FUNCTION public.st_dimension(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 520 (class 1255 OID 18874)  
-- Dependencies: 6 1102 1102  
-- Name: st_disjoint(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_disjoint(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'disjoint';  
 
 
ALTER FUNCTION public.st_disjoint(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 521 (class 1255 OID 18875)  
-- Dependencies: 6 1102 1102  
-- Name: st_distance(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_distance(geometry, geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_mindistance2d';  
 
 
ALTER FUNCTION public.st_distance(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 523 (class 1255 OID 18877)  
-- Dependencies: 6 1099 1099  
-- Name: st_distance(geography, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_distance(geography, geography) RETURNS double precision  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_Distance($1, $2, 0.0, true)$_$;  
 
 
ALTER FUNCTION public.st_distance(geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 524 (class 1255 OID 18878)  
-- Dependencies: 6  
-- Name: st_distance(text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_distance(text, text) RETURNS double precision  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_Distance($1::geometry, $2::geometry); $_$;  
 
 
ALTER FUNCTION public.st_distance(text, text) OWNER TO postgres;  
 
--  
-- TOC entry 522 (class 1255 OID 18876)  
-- Dependencies: 6 1099 1099  
-- Name: st_distance(geography, geography, boolean); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_distance(geography, geography, boolean) RETURNS double precision  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_Distance($1, $2, 0.0, $3)$_$;  
 
 
ALTER FUNCTION public.st_distance(geography, geography, boolean) OWNER TO postgres;  
 
--  
-- TOC entry 525 (class 1255 OID 18879)  
-- Dependencies: 6 1102 1102  
-- Name: st_distance_sphere(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_distance_sphere(geometry, geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_distance_sphere';  
 
 
ALTER FUNCTION public.st_distance_sphere(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 526 (class 1255 OID 18880)  
-- Dependencies: 6 1102 1102 1113  
-- Name: st_distance_spheroid(geometry, geometry, spheroid); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_distance_spheroid(geometry, geometry, spheroid) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_distance_ellipsoid';  
 
 
ALTER FUNCTION public.st_distance_spheroid(geometry, geometry, spheroid) OWNER TO postgres;  
 
--  
-- TOC entry 527 (class 1255 OID 18881)  
-- Dependencies: 6 1105 1102  
-- Name: st_dump(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_dump(geometry) RETURNS SETOF geometry_dump  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_dump';  
 
 
ALTER FUNCTION public.st_dump(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 528 (class 1255 OID 18882)  
-- Dependencies: 6 1105 1102  
-- Name: st_dumppoints(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_dumppoints(geometry) RETURNS SETOF geometry_dump  
LANGUAGE sql  
AS $_$  
SELECT * FROM _ST_DumpPoints($1, NULL);  
$_$;  
 
 
ALTER FUNCTION public.st_dumppoints(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 529 (class 1255 OID 18883)  
-- Dependencies: 6 1105 1102  
-- Name: st_dumprings(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_dumprings(geometry) RETURNS SETOF geometry_dump  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_dump_rings';  
 
 
ALTER FUNCTION public.st_dumprings(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 530 (class 1255 OID 18884)  
-- Dependencies: 6 1102 1102  
-- Name: st_dwithin(geometry, geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_dwithin(geometry, geometry, double precision) RETURNS boolean  
LANGUAGE sql IMMUTABLE  
AS $_$SELECT $1 && ST_Expand($2,$3) AND $2 && ST_Expand($1,$3) AND _ST_DWithin($1, $2, $3)$_$;  
 
 
ALTER FUNCTION public.st_dwithin(geometry, geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 532 (class 1255 OID 18886)  
-- Dependencies: 6 1099 1099  
-- Name: st_dwithin(geography, geography, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_dwithin(geography, geography, double precision) RETURNS boolean  
LANGUAGE sql IMMUTABLE  
AS $_$SELECT $1 && _ST_Expand($2,$3) AND $2 && _ST_Expand($1,$3) AND _ST_DWithin($1, $2, $3, true)$_$;  
 
 
ALTER FUNCTION public.st_dwithin(geography, geography, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 533 (class 1255 OID 18887)  
-- Dependencies: 6  
-- Name: st_dwithin(text, text, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_dwithin(text, text, double precision) RETURNS boolean  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_DWithin($1::geometry, $2::geometry, $3); $_$;  
 
 
ALTER FUNCTION public.st_dwithin(text, text, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 531 (class 1255 OID 18885)  
-- Dependencies: 6 1099 1099  
-- Name: st_dwithin(geography, geography, double precision, boolean); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_dwithin(geography, geography, double precision, boolean) RETURNS boolean  
LANGUAGE sql IMMUTABLE  
AS $_$SELECT $1 && _ST_Expand($2,$3) AND $2 && _ST_Expand($1,$3) AND _ST_DWithin($1, $2, $3, $4)$_$;  
 
 
ALTER FUNCTION public.st_dwithin(geography, geography, double precision, boolean) OWNER TO postgres;  
 
--  
-- TOC entry 534 (class 1255 OID 18888)  
-- Dependencies: 6 1102 1102  
-- Name: st_endpoint(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_endpoint(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_endpoint_linestring';  
 
 
ALTER FUNCTION public.st_endpoint(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 535 (class 1255 OID 18889)  
-- Dependencies: 6 1102 1102  
-- Name: st_envelope(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_envelope(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_envelope';  
 
 
ALTER FUNCTION public.st_envelope(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 536 (class 1255 OID 18890)  
-- Dependencies: 6 1102 1102  
-- Name: st_equals(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_equals(geometry, geometry) RETURNS boolean  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT $1 && $2 AND _ST_Equals($1,$2)$_$;  
 
 
ALTER FUNCTION public.st_equals(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 538 (class 1255 OID 18892)  
-- Dependencies: 1087 6  
-- Name: st_estimated_extent(text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_estimated_extent(text, text) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT SECURITY DEFINER  
AS '$libdir/postgis-1.5', 'LWGEOM_estimated_extent';  
 
 
ALTER FUNCTION public.st_estimated_extent(text, text) OWNER TO postgres;  
 
--  
-- TOC entry 537 (class 1255 OID 18891)  
-- Dependencies: 6 1087  
-- Name: st_estimated_extent(text, text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_estimated_extent(text, text, text) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT SECURITY DEFINER  
AS '$libdir/postgis-1.5', 'LWGEOM_estimated_extent';  
 
 
ALTER FUNCTION public.st_estimated_extent(text, text, text) OWNER TO postgres;  
 
--  
-- TOC entry 539 (class 1255 OID 18893)  
-- Dependencies: 6 1090 1090  
-- Name: st_expand(box3d, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_expand(box3d, double precision) RETURNS box3d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_expand';  
 
 
ALTER FUNCTION public.st_expand(box3d, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 540 (class 1255 OID 18896)  
-- Dependencies: 1087 1087 6  
-- Name: st_expand(box2d, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_expand(box2d, double precision) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_expand';  
 
 
ALTER FUNCTION public.st_expand(box2d, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 541 (class 1255 OID 18897)  
-- Dependencies: 6 1102 1102  
-- Name: st_expand(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_expand(geometry, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_expand';  
 
 
ALTER FUNCTION public.st_expand(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 542 (class 1255 OID 18898)  
-- Dependencies: 6 1102 1102  
-- Name: st_exteriorring(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_exteriorring(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_exteriorring_polygon';  
 
 
ALTER FUNCTION public.st_exteriorring(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 543 (class 1255 OID 18899)  
-- Dependencies: 6 1096  
-- Name: st_factor(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_factor(chip) RETURNS real  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_getFactor';  
 
 
ALTER FUNCTION public.st_factor(chip) OWNER TO postgres;  
 
--  
-- TOC entry 545 (class 1255 OID 18901)  
-- Dependencies: 1087 1168 6  
-- Name: st_find_extent(text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_find_extent(text, text) RETURNS box2d  
LANGUAGE plpgsql IMMUTABLE STRICT  
AS $_$  
DECLARE  
tablename alias for $1;  
columnname alias for $2;  
myrec RECORD;  
 
BEGIN  
FOR myrec IN EXECUTE 'SELECT extent("' || columnname || '") FROM "' || tablename || '"' LOOP  
return myrec.extent;  
END LOOP;  
END;  
$_$;  
 
 
ALTER FUNCTION public.st_find_extent(text, text) OWNER TO postgres;  
 
--  
-- TOC entry 544 (class 1255 OID 18900)  
-- Dependencies: 1168 6 1087  
-- Name: st_find_extent(text, text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_find_extent(text, text, text) RETURNS box2d  
LANGUAGE plpgsql IMMUTABLE STRICT  
AS $_$  
DECLARE  
schemaname alias for $1;  
tablename alias for $2;  
columnname alias for $3;  
myrec RECORD;  
 
BEGIN  
FOR myrec IN EXECUTE 'SELECT extent("' || columnname || '") FROM "' || schemaname || '"."' || tablename || '"' LOOP  
return myrec.extent;  
END LOOP;  
END;  
$_$;  
 
 
ALTER FUNCTION public.st_find_extent(text, text, text) OWNER TO postgres;  
 
--  
-- TOC entry 546 (class 1255 OID 18902)  
-- Dependencies: 1102 1102 6  
-- Name: st_force_2d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_force_2d(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_force_2d';  
 
 
ALTER FUNCTION public.st_force_2d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 547 (class 1255 OID 18903)  
-- Dependencies: 6 1102 1102  
-- Name: st_force_3d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_force_3d(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_force_3dz';  
 
 
ALTER FUNCTION public.st_force_3d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 548 (class 1255 OID 18904)  
-- Dependencies: 6 1102 1102  
-- Name: st_force_3dm(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_force_3dm(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_force_3dm';  
 
 
ALTER FUNCTION public.st_force_3dm(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 549 (class 1255 OID 18905)  
-- Dependencies: 1102 6 1102  
-- Name: st_force_3dz(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_force_3dz(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_force_3dz';  
 
 
ALTER FUNCTION public.st_force_3dz(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 550 (class 1255 OID 18906)  
-- Dependencies: 1102 1102 6  
-- Name: st_force_4d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_force_4d(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_force_4d';  
 
 
ALTER FUNCTION public.st_force_4d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 551 (class 1255 OID 18907)  
-- Dependencies: 6 1102 1102  
-- Name: st_force_collection(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_force_collection(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_force_collection';  
 
 
ALTER FUNCTION public.st_force_collection(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 552 (class 1255 OID 18908)  
-- Dependencies: 1102 1102 6  
-- Name: st_forcerhr(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_forcerhr(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_forceRHR_poly';  
 
 
ALTER FUNCTION public.st_forcerhr(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 553 (class 1255 OID 18909)  
-- Dependencies: 1099 6  
-- Name: st_geogfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geogfromtext(text) RETURNS geography  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_from_text';  
 
 
ALTER FUNCTION public.st_geogfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 554 (class 1255 OID 18910)  
-- Dependencies: 1099 6  
-- Name: st_geogfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geogfromwkb(bytea) RETURNS geography  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_from_binary';  
 
 
ALTER FUNCTION public.st_geogfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 555 (class 1255 OID 18911)  
-- Dependencies: 6 1099  
-- Name: st_geographyfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geographyfromtext(text) RETURNS geography  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geography_from_text';  
 
 
ALTER FUNCTION public.st_geographyfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 557 (class 1255 OID 18913)  
-- Dependencies: 6 1102  
-- Name: st_geohash(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geohash(geometry) RETURNS text  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT ST_GeoHash($1, 0)$_$;  
 
 
ALTER FUNCTION public.st_geohash(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 556 (class 1255 OID 18912)  
-- Dependencies: 1102 6  
-- Name: st_geohash(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geohash(geometry, integer) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'ST_GeoHash';  
 
 
ALTER FUNCTION public.st_geohash(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 559 (class 1255 OID 18915)  
-- Dependencies: 6 1102  
-- Name: st_geomcollfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geomcollfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE  
WHEN geometrytype(ST_GeomFromText($1)) = 'GEOMETRYCOLLECTION'  
THEN ST_GeomFromText($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_geomcollfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 558 (class 1255 OID 18914)  
-- Dependencies: 1102 6  
-- Name: st_geomcollfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geomcollfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE  
WHEN geometrytype(ST_GeomFromText($1, $2)) = 'GEOMETRYCOLLECTION'  
THEN ST_GeomFromText($1,$2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_geomcollfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 561 (class 1255 OID 18917)  
-- Dependencies: 6 1102  
-- Name: st_geomcollfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geomcollfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE  
WHEN geometrytype(ST_GeomFromWKB($1)) = 'GEOMETRYCOLLECTION'  
THEN ST_GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_geomcollfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 560 (class 1255 OID 18916)  
-- Dependencies: 6 1102  
-- Name: st_geomcollfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geomcollfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE  
WHEN geometrytype(GeomFromWKB($1, $2)) = 'GEOMETRYCOLLECTION'  
THEN GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_geomcollfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 562 (class 1255 OID 18918)  
-- Dependencies: 1087 6 1102  
-- Name: st_geometry(box2d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry(box2d) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_to_LWGEOM';  
 
 
ALTER FUNCTION public.st_geometry(box2d) OWNER TO postgres;  
 
--  
-- TOC entry 563 (class 1255 OID 18919)  
-- Dependencies: 6 1102 1090  
-- Name: st_geometry(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry(box3d) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_to_LWGEOM';  
 
 
ALTER FUNCTION public.st_geometry(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 564 (class 1255 OID 18920)  
-- Dependencies: 6 1102  
-- Name: st_geometry(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry(text) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'parse_WKT_lwgeom';  
 
 
ALTER FUNCTION public.st_geometry(text) OWNER TO postgres;  
 
--  
-- TOC entry 565 (class 1255 OID 18921)  
-- Dependencies: 1102 1096 6  
-- Name: st_geometry(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry(chip) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_to_LWGEOM';  
 
 
ALTER FUNCTION public.st_geometry(chip) OWNER TO postgres;  
 
--  
-- TOC entry 566 (class 1255 OID 18922)  
-- Dependencies: 6 1102  
-- Name: st_geometry(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry(bytea) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_from_bytea';  
 
 
ALTER FUNCTION public.st_geometry(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 567 (class 1255 OID 18923)  
-- Dependencies: 6 1093 1102  
-- Name: st_geometry(box3d_extent); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry(box3d_extent) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_to_LWGEOM';  
 
 
ALTER FUNCTION public.st_geometry(box3d_extent) OWNER TO postgres;  
 
--  
-- TOC entry 568 (class 1255 OID 18924)  
-- Dependencies: 1102 1102 6  
-- Name: st_geometry_above(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_above(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_above';  
 
 
ALTER FUNCTION public.st_geometry_above(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 569 (class 1255 OID 18925)  
-- Dependencies: 6  
-- Name: st_geometry_analyze(internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_analyze(internal) RETURNS boolean  
LANGUAGE c STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_analyze';  
 
 
ALTER FUNCTION public.st_geometry_analyze(internal) OWNER TO postgres;  
 
--  
-- TOC entry 570 (class 1255 OID 18926)  
-- Dependencies: 1102 1102 6  
-- Name: st_geometry_below(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_below(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_below';  
 
 
ALTER FUNCTION public.st_geometry_below(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 571 (class 1255 OID 18927)  
-- Dependencies: 6 1102 1102  
-- Name: st_geometry_cmp(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_cmp(geometry, geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'lwgeom_cmp';  
 
 
ALTER FUNCTION public.st_geometry_cmp(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 572 (class 1255 OID 18928)  
-- Dependencies: 1102 6 1102  
-- Name: st_geometry_contain(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_contain(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_contain';  
 
 
ALTER FUNCTION public.st_geometry_contain(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 573 (class 1255 OID 18929)  
-- Dependencies: 6 1102 1102  
-- Name: st_geometry_contained(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_contained(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_contained';  
 
 
ALTER FUNCTION public.st_geometry_contained(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 574 (class 1255 OID 18930)  
-- Dependencies: 6 1102 1102  
-- Name: st_geometry_eq(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_eq(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'lwgeom_eq';  
 
 
ALTER FUNCTION public.st_geometry_eq(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 575 (class 1255 OID 18931)  
-- Dependencies: 1102 6 1102  
-- Name: st_geometry_ge(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_ge(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'lwgeom_ge';  
 
 
ALTER FUNCTION public.st_geometry_ge(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 576 (class 1255 OID 18932)  
-- Dependencies: 6 1102 1102  
-- Name: st_geometry_gt(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_gt(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'lwgeom_gt';  
 
 
ALTER FUNCTION public.st_geometry_gt(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 577 (class 1255 OID 18933)  
-- Dependencies: 6 1102  
-- Name: st_geometry_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_in(cstring) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_in';  
 
 
ALTER FUNCTION public.st_geometry_in(cstring) OWNER TO postgres;  
 
--  
-- TOC entry 578 (class 1255 OID 18934)  
-- Dependencies: 1102 6 1102  
-- Name: st_geometry_le(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_le(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'lwgeom_le';  
 
 
ALTER FUNCTION public.st_geometry_le(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 579 (class 1255 OID 18935)  
-- Dependencies: 1102 1102 6  
-- Name: st_geometry_left(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_left(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_left';  
 
 
ALTER FUNCTION public.st_geometry_left(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 580 (class 1255 OID 18936)  
-- Dependencies: 1102 6 1102  
-- Name: st_geometry_lt(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_lt(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'lwgeom_lt';  
 
 
ALTER FUNCTION public.st_geometry_lt(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 581 (class 1255 OID 18937)  
-- Dependencies: 1102 6  
-- Name: st_geometry_out(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_out(geometry) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_out';  
 
 
ALTER FUNCTION public.st_geometry_out(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 582 (class 1255 OID 18938)  
-- Dependencies: 1102 1102 6  
-- Name: st_geometry_overabove(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_overabove(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_overabove';  
 
 
ALTER FUNCTION public.st_geometry_overabove(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 583 (class 1255 OID 18939)  
-- Dependencies: 6 1102 1102  
-- Name: st_geometry_overbelow(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_overbelow(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_overbelow';  
 
 
ALTER FUNCTION public.st_geometry_overbelow(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 584 (class 1255 OID 18940)  
-- Dependencies: 6 1102 1102  
-- Name: st_geometry_overlap(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_overlap(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_overlap';  
 
 
ALTER FUNCTION public.st_geometry_overlap(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 585 (class 1255 OID 18941)  
-- Dependencies: 1102 6 1102  
-- Name: st_geometry_overleft(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_overleft(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_overleft';  
 
 
ALTER FUNCTION public.st_geometry_overleft(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 586 (class 1255 OID 18942)  
-- Dependencies: 6 1102 1102  
-- Name: st_geometry_overright(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_overright(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_overright';  
 
 
ALTER FUNCTION public.st_geometry_overright(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 587 (class 1255 OID 18943)  
-- Dependencies: 1102 6  
-- Name: st_geometry_recv(internal); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_recv(internal) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_recv';  
 
 
ALTER FUNCTION public.st_geometry_recv(internal) OWNER TO postgres;  
 
--  
-- TOC entry 588 (class 1255 OID 18944)  
-- Dependencies: 1102 6 1102  
-- Name: st_geometry_right(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_right(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_right';  
 
 
ALTER FUNCTION public.st_geometry_right(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 589 (class 1255 OID 18945)  
-- Dependencies: 1102 6 1102  
-- Name: st_geometry_same(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_same(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_samebox';  
 
 
ALTER FUNCTION public.st_geometry_same(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 590 (class 1255 OID 18946)  
-- Dependencies: 6 1102  
-- Name: st_geometry_send(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometry_send(geometry) RETURNS bytea  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_send';  
 
 
ALTER FUNCTION public.st_geometry_send(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 591 (class 1255 OID 18947)  
-- Dependencies: 1102 6  
-- Name: st_geometryfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometryfromtext(text) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_from_text';  
 
 
ALTER FUNCTION public.st_geometryfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 592 (class 1255 OID 18948)  
-- Dependencies: 1102 6  
-- Name: st_geometryfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometryfromtext(text, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_from_text';  
 
 
ALTER FUNCTION public.st_geometryfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 593 (class 1255 OID 18949)  
-- Dependencies: 1102 6 1102  
-- Name: st_geometryn(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometryn(geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_geometryn_collection';  
 
 
ALTER FUNCTION public.st_geometryn(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 594 (class 1255 OID 18950)  
-- Dependencies: 6 1102  
-- Name: st_geometrytype(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geometrytype(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geometry_geometrytype';  
 
 
ALTER FUNCTION public.st_geometrytype(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 595 (class 1255 OID 18951)  
-- Dependencies: 1102 6  
-- Name: st_geomfromewkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geomfromewkb(bytea) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOMFromWKB';  
 
 
ALTER FUNCTION public.st_geomfromewkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 596 (class 1255 OID 18952)  
-- Dependencies: 1102 6  
-- Name: st_geomfromewkt(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geomfromewkt(text) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'parse_WKT_lwgeom';  
 
 
ALTER FUNCTION public.st_geomfromewkt(text) OWNER TO postgres;  
 
--  
-- TOC entry 597 (class 1255 OID 18953)  
-- Dependencies: 6 1102  
-- Name: st_geomfromgml(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geomfromgml(text) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geom_from_gml';  
 
 
ALTER FUNCTION public.st_geomfromgml(text) OWNER TO postgres;  
 
--  
-- TOC entry 598 (class 1255 OID 18954)  
-- Dependencies: 6 1102  
-- Name: st_geomfromkml(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geomfromkml(text) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geom_from_kml';  
 
 
ALTER FUNCTION public.st_geomfromkml(text) OWNER TO postgres;  
 
--  
-- TOC entry 599 (class 1255 OID 18955)  
-- Dependencies: 6 1102  
-- Name: st_geomfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geomfromtext(text) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_from_text';  
 
 
ALTER FUNCTION public.st_geomfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 600 (class 1255 OID 18956)  
-- Dependencies: 1102 6  
-- Name: st_geomfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geomfromtext(text, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_from_text';  
 
 
ALTER FUNCTION public.st_geomfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 601 (class 1255 OID 18957)  
-- Dependencies: 1102 6  
-- Name: st_geomfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geomfromwkb(bytea) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_from_WKB';  
 
 
ALTER FUNCTION public.st_geomfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 602 (class 1255 OID 18958)  
-- Dependencies: 1102 6  
-- Name: st_geomfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_geomfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT ST_SetSRID(ST_GeomFromWKB($1), $2)$_$;  
 
 
ALTER FUNCTION public.st_geomfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 603 (class 1255 OID 18959)  
-- Dependencies: 1102 6  
-- Name: st_gmltosql(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_gmltosql(text) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geom_from_gml';  
 
 
ALTER FUNCTION public.st_gmltosql(text) OWNER TO postgres;  
 
--  
-- TOC entry 604 (class 1255 OID 18960)  
-- Dependencies: 1102 6  
-- Name: st_hasarc(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_hasarc(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_has_arc';  
 
 
ALTER FUNCTION public.st_hasarc(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 605 (class 1255 OID 18961)  
-- Dependencies: 1102 6 1102  
-- Name: st_hausdorffdistance(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_hausdorffdistance(geometry, geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'hausdorffdistance';  
 
 
ALTER FUNCTION public.st_hausdorffdistance(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 606 (class 1255 OID 18962)  
-- Dependencies: 1102 1102 6  
-- Name: st_hausdorffdistance(geometry, geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_hausdorffdistance(geometry, geometry, double precision) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'hausdorffdistancedensify';  
 
 
ALTER FUNCTION public.st_hausdorffdistance(geometry, geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 607 (class 1255 OID 18963)  
-- Dependencies: 6 1096  
-- Name: st_height(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_height(chip) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_getHeight';  
 
 
ALTER FUNCTION public.st_height(chip) OWNER TO postgres;  
 
--  
-- TOC entry 608 (class 1255 OID 18964)  
-- Dependencies: 6 1102 1102  
-- Name: st_interiorringn(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_interiorringn(geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_interiorringn_polygon';  
 
 
ALTER FUNCTION public.st_interiorringn(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 609 (class 1255 OID 18965)  
-- Dependencies: 6 1102 1102 1102  
-- Name: st_intersection(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_intersection(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'intersection';  
 
 
ALTER FUNCTION public.st_intersection(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 610 (class 1255 OID 18966)  
-- Dependencies: 6 1099 1099 1099  
-- Name: st_intersection(geography, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_intersection(geography, geography) RETURNS geography  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT geography(ST_Transform(ST_Intersection(ST_Transform(geometry($1), _ST_BestSRID($1, $2)), ST_Transform(geometry($2), _ST_BestSRID($1, $2))), 4326))$_$;  
 
 
ALTER FUNCTION public.st_intersection(geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 611 (class 1255 OID 18967)  
-- Dependencies: 6 1102  
-- Name: st_intersection(text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_intersection(text, text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_Intersection($1::geometry, $2::geometry); $_$;  
 
 
ALTER FUNCTION public.st_intersection(text, text) OWNER TO postgres;  
 
--  
-- TOC entry 612 (class 1255 OID 18968)  
-- Dependencies: 6 1102 1102  
-- Name: st_intersects(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_intersects(geometry, geometry) RETURNS boolean  
LANGUAGE sql IMMUTABLE  
AS $_$SELECT $1 && $2 AND _ST_Intersects($1,$2)$_$;  
 
 
ALTER FUNCTION public.st_intersects(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 613 (class 1255 OID 18969)  
-- Dependencies: 6 1099 1099  
-- Name: st_intersects(geography, geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_intersects(geography, geography) RETURNS boolean  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT $1 && $2 AND _ST_Distance($1, $2, 0.0, false) < 0.00001$_$;  
 
 
ALTER FUNCTION public.st_intersects(geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 614 (class 1255 OID 18970)  
-- Dependencies: 6  
-- Name: st_intersects(text, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_intersects(text, text) RETURNS boolean  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_Intersects($1::geometry, $2::geometry); $_$;  
 
 
ALTER FUNCTION public.st_intersects(text, text) OWNER TO postgres;  
 
--  
-- TOC entry 615 (class 1255 OID 18971)  
-- Dependencies: 6 1102  
-- Name: st_isclosed(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_isclosed(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_isclosed_linestring';  
 
 
ALTER FUNCTION public.st_isclosed(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 616 (class 1255 OID 18972)  
-- Dependencies: 6 1102  
-- Name: st_isempty(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_isempty(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_isempty';  
 
 
ALTER FUNCTION public.st_isempty(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 617 (class 1255 OID 18973)  
-- Dependencies: 6 1102  
-- Name: st_isring(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_isring(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'isring';  
 
 
ALTER FUNCTION public.st_isring(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 618 (class 1255 OID 18974)  
-- Dependencies: 6 1102  
-- Name: st_issimple(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_issimple(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'issimple';  
 
 
ALTER FUNCTION public.st_issimple(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 619 (class 1255 OID 18975)  
-- Dependencies: 6 1102  
-- Name: st_isvalid(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_isvalid(geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'isvalid';  
 
 
ALTER FUNCTION public.st_isvalid(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 620 (class 1255 OID 18976)  
-- Dependencies: 6 1102  
-- Name: st_isvalidreason(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_isvalidreason(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'isvalidreason';  
 
 
ALTER FUNCTION public.st_isvalidreason(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 621 (class 1255 OID 18977)  
-- Dependencies: 6 1102  
-- Name: st_length(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_length(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_length2d_linestring';  
 
 
ALTER FUNCTION public.st_length(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 623 (class 1255 OID 18979)  
-- Dependencies: 6 1099  
-- Name: st_length(geography); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_length(geography) RETURNS double precision  
LANGUAGE sql IMMUTABLE  
AS $_$SELECT ST_Length($1, true)$_$;  
 
 
ALTER FUNCTION public.st_length(geography) OWNER TO postgres;  
 
--  
-- TOC entry 624 (class 1255 OID 18980)  
-- Dependencies: 6  
-- Name: st_length(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_length(text) RETURNS double precision  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT ST_Length($1::geometry); $_$;  
 
 
ALTER FUNCTION public.st_length(text) OWNER TO postgres;  
 
--  
-- TOC entry 622 (class 1255 OID 18978)  
-- Dependencies: 6 1099  
-- Name: st_length(geography, boolean); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_length(geography, boolean) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'geography_length';  
 
 
ALTER FUNCTION public.st_length(geography, boolean) OWNER TO postgres;  
 
--  
-- TOC entry 625 (class 1255 OID 18981)  
-- Dependencies: 6 1102  
-- Name: st_length2d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_length2d(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_length2d_linestring';  
 
 
ALTER FUNCTION public.st_length2d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 626 (class 1255 OID 18982)  
-- Dependencies: 6 1102 1113  
-- Name: st_length2d_spheroid(geometry, spheroid); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_length2d_spheroid(geometry, spheroid) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_length2d_ellipsoid';  
 
 
ALTER FUNCTION public.st_length2d_spheroid(geometry, spheroid) OWNER TO postgres;  
 
--  
-- TOC entry 627 (class 1255 OID 18983)  
-- Dependencies: 6 1102  
-- Name: st_length3d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_length3d(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_length_linestring';  
 
 
ALTER FUNCTION public.st_length3d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 628 (class 1255 OID 18984)  
-- Dependencies: 6 1102 1113  
-- Name: st_length3d_spheroid(geometry, spheroid); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_length3d_spheroid(geometry, spheroid) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_length_ellipsoid_linestring';  
 
 
ALTER FUNCTION public.st_length3d_spheroid(geometry, spheroid) OWNER TO postgres;  
 
--  
-- TOC entry 629 (class 1255 OID 18985)  
-- Dependencies: 6 1102 1113  
-- Name: st_length_spheroid(geometry, spheroid); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_length_spheroid(geometry, spheroid) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'LWGEOM_length_ellipsoid_linestring';  
 
 
ALTER FUNCTION public.st_length_spheroid(geometry, spheroid) OWNER TO postgres;  
 
--  
-- TOC entry 630 (class 1255 OID 18986)  
-- Dependencies: 6 1102 1102  
-- Name: st_line_interpolate_point(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_line_interpolate_point(geometry, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_line_interpolate_point';  
 
 
ALTER FUNCTION public.st_line_interpolate_point(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 631 (class 1255 OID 18987)  
-- Dependencies: 6 1102 1102  
-- Name: st_line_locate_point(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_line_locate_point(geometry, geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_line_locate_point';  
 
 
ALTER FUNCTION public.st_line_locate_point(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 632 (class 1255 OID 18988)  
-- Dependencies: 6 1102 1102  
-- Name: st_line_substring(geometry, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_line_substring(geometry, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_line_substring';  
 
 
ALTER FUNCTION public.st_line_substring(geometry, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 633 (class 1255 OID 18989)  
-- Dependencies: 6 1102 1102  
-- Name: st_linecrossingdirection(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_linecrossingdirection(geometry, geometry) RETURNS integer  
LANGUAGE sql IMMUTABLE  
AS $_$ SELECT CASE WHEN NOT $1 && $2 THEN 0 ELSE _ST_LineCrossingDirection($1,$2) END $_$;  
 
 
ALTER FUNCTION public.st_linecrossingdirection(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 634 (class 1255 OID 18990)  
-- Dependencies: 6 1102 1102  
-- Name: st_linefrommultipoint(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_linefrommultipoint(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_line_from_mpoint';  
 
 
ALTER FUNCTION public.st_linefrommultipoint(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 635 (class 1255 OID 18991)  
-- Dependencies: 6 1102  
-- Name: st_linefromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_linefromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromText($1)) = 'LINESTRING'  
THEN ST_GeomFromText($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_linefromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 636 (class 1255 OID 18992)  
-- Dependencies: 6 1102  
-- Name: st_linefromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_linefromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'LINESTRING'  
THEN GeomFromText($1,$2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_linefromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 638 (class 1255 OID 18994)  
-- Dependencies: 6 1102  
-- Name: st_linefromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_linefromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1)) = 'LINESTRING'  
THEN ST_GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_linefromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 637 (class 1255 OID 18993)  
-- Dependencies: 6 1102  
-- Name: st_linefromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_linefromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1, $2)) = 'LINESTRING'  
THEN ST_GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_linefromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 639 (class 1255 OID 18995)  
-- Dependencies: 6 1102 1102  
-- Name: st_linemerge(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_linemerge(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'linemerge';  
 
 
ALTER FUNCTION public.st_linemerge(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 641 (class 1255 OID 18997)  
-- Dependencies: 6 1102  
-- Name: st_linestringfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_linestringfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'LINESTRING'  
THEN GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_linestringfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 640 (class 1255 OID 18996)  
-- Dependencies: 6 1102  
-- Name: st_linestringfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_linestringfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1, $2)) = 'LINESTRING'  
THEN ST_GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_linestringfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 642 (class 1255 OID 18998)  
-- Dependencies: 6 1102 1102  
-- Name: st_linetocurve(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_linetocurve(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_line_desegmentize';  
 
 
ALTER FUNCTION public.st_linetocurve(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 643 (class 1255 OID 18999)  
-- Dependencies: 6 1102 1102  
-- Name: st_locate_along_measure(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_locate_along_measure(geometry, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$ SELECT locate_between_measures($1, $2, $2) $_$;  
 
 
ALTER FUNCTION public.st_locate_along_measure(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 644 (class 1255 OID 19000)  
-- Dependencies: 6 1102 1102  
-- Name: st_locate_between_measures(geometry, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_locate_between_measures(geometry, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_locate_between_m';  
 
 
ALTER FUNCTION public.st_locate_between_measures(geometry, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 645 (class 1255 OID 19001)  
-- Dependencies: 6 1102 1102  
-- Name: st_locatebetweenelevations(geometry, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_locatebetweenelevations(geometry, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'ST_LocateBetweenElevations';  
 
 
ALTER FUNCTION public.st_locatebetweenelevations(geometry, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 646 (class 1255 OID 19002)  
-- Dependencies: 6 1102 1102 1102  
-- Name: st_longestline(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_longestline(geometry, geometry) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_LongestLine(ST_ConvexHull($1), ST_ConvexHull($2))$_$;  
 
 
ALTER FUNCTION public.st_longestline(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 647 (class 1255 OID 19003)  
-- Dependencies: 6 1102  
-- Name: st_m(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_m(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_m_point';  
 
 
ALTER FUNCTION public.st_m(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 648 (class 1255 OID 19004)  
-- Dependencies: 6 1087 1102 1102  
-- Name: st_makebox2d(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_makebox2d(geometry, geometry) RETURNS box2d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX2DFLOAT4_construct';  
 
 
ALTER FUNCTION public.st_makebox2d(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 649 (class 1255 OID 19005)  
-- Dependencies: 6 1090 1102 1102  
-- Name: st_makebox3d(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_makebox3d(geometry, geometry) RETURNS box3d  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_construct';  
 
 
ALTER FUNCTION public.st_makebox3d(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 650 (class 1255 OID 19006)  
-- Dependencies: 6 1102  
-- Name: st_makeenvelope(double precision, double precision, double precision, double precision, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_makeenvelope(double precision, double precision, double precision, double precision, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'ST_MakeEnvelope';  
 
 
ALTER FUNCTION public.st_makeenvelope(double precision, double precision, double precision, double precision, integer) OWNER TO postgres;  
 
--  
-- TOC entry 651 (class 1255 OID 19007)  
-- Dependencies: 6 1102 1104  
-- Name: st_makeline(geometry[]); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_makeline(geometry[]) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makeline_garray';  
 
 
ALTER FUNCTION public.st_makeline(geometry[]) OWNER TO postgres;  
 
--  
-- TOC entry 652 (class 1255 OID 19008)  
-- Dependencies: 6 1102 1102 1102  
-- Name: st_makeline(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_makeline(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makeline';  
 
 
ALTER FUNCTION public.st_makeline(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 653 (class 1255 OID 19009)  
-- Dependencies: 6 1102 1104  
-- Name: st_makeline_garray(geometry[]); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_makeline_garray(geometry[]) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makeline_garray';  
 
 
ALTER FUNCTION public.st_makeline_garray(geometry[]) OWNER TO postgres;  
 
--  
-- TOC entry 654 (class 1255 OID 19010)  
-- Dependencies: 1102 6  
-- Name: st_makepoint(double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_makepoint(double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makepoint';  
 
 
ALTER FUNCTION public.st_makepoint(double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 655 (class 1255 OID 19011)  
-- Dependencies: 6 1102  
-- Name: st_makepoint(double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_makepoint(double precision, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makepoint';  
 
 
ALTER FUNCTION public.st_makepoint(double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 656 (class 1255 OID 19012)  
-- Dependencies: 6 1102  
-- Name: st_makepoint(double precision, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_makepoint(double precision, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makepoint';  
 
 
ALTER FUNCTION public.st_makepoint(double precision, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 657 (class 1255 OID 19013)  
-- Dependencies: 6 1102  
-- Name: st_makepointm(double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_makepointm(double precision, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makepoint3dm';  
 
 
ALTER FUNCTION public.st_makepointm(double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 659 (class 1255 OID 19015)  
-- Dependencies: 6 1102 1102  
-- Name: st_makepolygon(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_makepolygon(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makepoly';  
 
 
ALTER FUNCTION public.st_makepolygon(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 658 (class 1255 OID 19014)  
-- Dependencies: 6 1102 1102 1104  
-- Name: st_makepolygon(geometry, geometry[]); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_makepolygon(geometry, geometry[]) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makepoly';  
 
 
ALTER FUNCTION public.st_makepolygon(geometry, geometry[]) OWNER TO postgres;  
 
--  
-- TOC entry 660 (class 1255 OID 19016)  
-- Dependencies: 6 1102 1102  
-- Name: st_maxdistance(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_maxdistance(geometry, geometry) RETURNS double precision  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT _ST_MaxDistance(ST_ConvexHull($1), ST_ConvexHull($2))$_$;  
 
 
ALTER FUNCTION public.st_maxdistance(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 661 (class 1255 OID 19017)  
-- Dependencies: 6 1102  
-- Name: st_mem_size(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_mem_size(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_mem_size';  
 
 
ALTER FUNCTION public.st_mem_size(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 663 (class 1255 OID 19020)  
-- Dependencies: 6 1102 1102  
-- Name: st_minimumboundingcircle(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_minimumboundingcircle(geometry) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT ST_MinimumBoundingCircle($1, 48)$_$;  
 
 
ALTER FUNCTION public.st_minimumboundingcircle(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 662 (class 1255 OID 19018)  
-- Dependencies: 6 1168 1102 1102  
-- Name: st_minimumboundingcircle(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_minimumboundingcircle(inputgeom geometry, segs_per_quarter integer) RETURNS geometry  
LANGUAGE plpgsql IMMUTABLE STRICT  
AS $$  
DECLARE  
hull GEOMETRY;  
ring GEOMETRY;  
center GEOMETRY;  
radius DOUBLE PRECISION;  
dist DOUBLE PRECISION;  
d DOUBLE PRECISION;  
idx1 integer;  
idx2 integer;  
l1 GEOMETRY;  
l2 GEOMETRY;  
p1 GEOMETRY;  
p2 GEOMETRY;  
a1 DOUBLE PRECISION;  
a2 DOUBLE PRECISION;  
 
 
BEGIN  
 
-- First compute the ConvexHull of the geometry  
hull = ST_ConvexHull(inputgeom);  
--A point really has no MBC  
IF ST_GeometryType(hull) = 'ST_Point' THEN  
RETURN hull;  
END IF;  
-- convert the hull perimeter to a linestring so we can manipulate individual points  
--If its already a linestring force it to a closed linestring  
ring = CASE WHEN ST_GeometryType(hull) = 'ST_LineString' THEN ST_AddPoint(hull, ST_StartPoint(hull)) ELSE ST_ExteriorRing(hull) END;  
 
dist = 0;  
-- Brute Force - check every pair  
FOR i in 1 .. (ST_NumPoints(ring)-2)  
LOOP  
FOR j in i .. (ST_NumPoints(ring)-1)  
LOOP  
d = ST_Distance(ST_PointN(ring,i),ST_PointN(ring,j));  
-- Check the distance and update if larger  
IF (d > dist) THEN  
dist = d;  
idx1 = i;  
idx2 = j;  
END IF;  
END LOOP;  
END LOOP;  
 
-- We now have the diameter of the convex hull. The following line returns it if desired.  
-- RETURN MakeLine(PointN(ring,idx1),PointN(ring,idx2));  
 
-- Now for the Minimum Bounding Circle. Since we know the two points furthest from each  
-- other, the MBC must go through those two points. Start with those points as a diameter of a circle.  
 
-- The radius is half the distance between them and the center is midway between them  
radius = ST_Distance(ST_PointN(ring,idx1),ST_PointN(ring,idx2)) / 2.0;  
center = ST_Line_interpolate_point(ST_MakeLine(ST_PointN(ring,idx1),ST_PointN(ring,idx2)),0.5);  
 
-- Loop through each vertex and check if the distance from the center to the point  
-- is greater than the current radius.  
FOR k in 1 .. (ST_NumPoints(ring)-1)  
LOOP  
IF(k <> idx1 and k <> idx2) THEN  
dist = ST_Distance(center,ST_PointN(ring,k));  
IF (dist > radius) THEN  
-- We have to expand the circle. The new circle must pass trhough  
-- three points - the two original diameters and this point.  
 
-- Draw a line from the first diameter to this point  
l1 = ST_Makeline(ST_PointN(ring,idx1),ST_PointN(ring,k));  
-- Compute the midpoint  
p1 = ST_line_interpolate_point(l1,0.5);  
-- Rotate the line 90 degrees around the midpoint (perpendicular bisector)  
l1 = ST_Translate(ST_Rotate(ST_Translate(l1,-X(p1),-Y(p1)),pi()/2),X(p1),Y(p1));  
-- Compute the azimuth of the bisector  
a1 = ST_Azimuth(ST_PointN(l1,1),ST_PointN(l1,2));  
-- Extend the line in each direction the new computed distance to insure they will intersect  
l1 = ST_AddPoint(l1,ST_Makepoint(X(ST_PointN(l1,2))+sin(a1)*dist,Y(ST_PointN(l1,2))+cos(a1)*dist),-1);  
l1 = ST_AddPoint(l1,ST_Makepoint(X(ST_PointN(l1,1))-sin(a1)*dist,Y(ST_PointN(l1,1))-cos(a1)*dist),0);  
 
-- Repeat for the line from the point to the other diameter point  
l2 = ST_Makeline(ST_PointN(ring,idx2),ST_PointN(ring,k));  
p2 = ST_Line_interpolate_point(l2,0.5);  
l2 = ST_Translate(ST_Rotate(ST_Translate(l2,-X(p2),-Y(p2)),pi()/2),X(p2),Y(p2));  
a2 = ST_Azimuth(ST_PointN(l2,1),ST_PointN(l2,2));  
l2 = ST_AddPoint(l2,ST_Makepoint(X(ST_PointN(l2,2))+sin(a2)*dist,Y(ST_PointN(l2,2))+cos(a2)*dist),-1);  
l2 = ST_AddPoint(l2,ST_Makepoint(X(ST_PointN(l2,1))-sin(a2)*dist,Y(ST_PointN(l2,1))-cos(a2)*dist),0);  
 
-- The new center is the intersection of the two bisectors  
center = ST_Intersection(l1,l2);  
-- The new radius is the distance to any of the three points  
radius = ST_Distance(center,ST_PointN(ring,idx1));  
END IF;  
END IF;  
END LOOP;  
--DONE!! Return the MBC via the buffer command  
RETURN ST_Buffer(center,radius,segs_per_quarter);  
 
END;  
$$;  
 
 
ALTER FUNCTION public.st_minimumboundingcircle(inputgeom geometry, segs_per_quarter integer) OWNER TO postgres;  
 
--  
-- TOC entry 665 (class 1255 OID 19022)  
-- Dependencies: 6 1102  
-- Name: st_mlinefromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_mlinefromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromText($1)) = 'MULTILINESTRING'  
THEN ST_GeomFromText($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_mlinefromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 664 (class 1255 OID 19021)  
-- Dependencies: 6 1102  
-- Name: st_mlinefromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_mlinefromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE  
WHEN geometrytype(GeomFromText($1, $2)) = 'MULTILINESTRING'  
THEN GeomFromText($1,$2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_mlinefromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 667 (class 1255 OID 19024)  
-- Dependencies: 6 1102  
-- Name: st_mlinefromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_mlinefromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1)) = 'MULTILINESTRING'  
THEN ST_GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_mlinefromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 666 (class 1255 OID 19023)  
-- Dependencies: 6 1102  
-- Name: st_mlinefromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_mlinefromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1, $2)) = 'MULTILINESTRING'  
THEN ST_GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_mlinefromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 669 (class 1255 OID 19026)  
-- Dependencies: 6 1102  
-- Name: st_mpointfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_mpointfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromText($1)) = 'MULTIPOINT'  
THEN ST_GeomFromText($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_mpointfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 668 (class 1255 OID 19025)  
-- Dependencies: 6 1102  
-- Name: st_mpointfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_mpointfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'MULTIPOINT'  
THEN GeomFromText($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_mpointfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 672 (class 1255 OID 19028)  
-- Dependencies: 6 1102  
-- Name: st_mpointfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_mpointfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1)) = 'MULTIPOINT'  
THEN ST_GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_mpointfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 671 (class 1255 OID 19027)  
-- Dependencies: 6 1102  
-- Name: st_mpointfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_mpointfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTIPOINT'  
THEN GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_mpointfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 674 (class 1255 OID 19030)  
-- Dependencies: 6 1102  
-- Name: st_mpolyfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_mpolyfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromText($1)) = 'MULTIPOLYGON'  
THEN ST_GeomFromText($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_mpolyfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 673 (class 1255 OID 19029)  
-- Dependencies: 6 1102  
-- Name: st_mpolyfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_mpolyfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromText($1, $2)) = 'MULTIPOLYGON'  
THEN ST_GeomFromText($1,$2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_mpolyfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 676 (class 1255 OID 19032)  
-- Dependencies: 6 1102  
-- Name: st_mpolyfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_mpolyfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1)) = 'MULTIPOLYGON'  
THEN ST_GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_mpolyfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 675 (class 1255 OID 19031)  
-- Dependencies: 6 1102  
-- Name: st_mpolyfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_mpolyfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1, $2)) = 'MULTIPOLYGON'  
THEN ST_GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_mpolyfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 677 (class 1255 OID 19033)  
-- Dependencies: 6 1102 1102  
-- Name: st_multi(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_multi(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_force_multi';  
 
 
ALTER FUNCTION public.st_multi(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 678 (class 1255 OID 19034)  
-- Dependencies: 6 1102  
-- Name: st_multilinefromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_multilinefromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1)) = 'MULTILINESTRING'  
THEN ST_GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_multilinefromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 679 (class 1255 OID 19035)  
-- Dependencies: 6 1102  
-- Name: st_multilinestringfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_multilinestringfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT ST_MLineFromText($1)$_$;  
 
 
ALTER FUNCTION public.st_multilinestringfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 680 (class 1255 OID 19036)  
-- Dependencies: 6 1102  
-- Name: st_multilinestringfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_multilinestringfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT MLineFromText($1, $2)$_$;  
 
 
ALTER FUNCTION public.st_multilinestringfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 681 (class 1255 OID 19037)  
-- Dependencies: 6 1102  
-- Name: st_multipointfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_multipointfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT MPointFromText($1)$_$;  
 
 
ALTER FUNCTION public.st_multipointfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 683 (class 1255 OID 19039)  
-- Dependencies: 1102 6  
-- Name: st_multipointfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_multipointfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1)) = 'MULTIPOINT'  
THEN ST_GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_multipointfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 682 (class 1255 OID 19038)  
-- Dependencies: 6 1102  
-- Name: st_multipointfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_multipointfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1,$2)) = 'MULTIPOINT'  
THEN ST_GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_multipointfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 685 (class 1255 OID 19041)  
-- Dependencies: 6 1102  
-- Name: st_multipolyfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_multipolyfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1)) = 'MULTIPOLYGON'  
THEN ST_GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_multipolyfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 684 (class 1255 OID 19040)  
-- Dependencies: 6 1102  
-- Name: st_multipolyfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_multipolyfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1, $2)) = 'MULTIPOLYGON'  
THEN ST_GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_multipolyfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 687 (class 1255 OID 19043)  
-- Dependencies: 6 1102  
-- Name: st_multipolygonfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_multipolygonfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT MPolyFromText($1)$_$;  
 
 
ALTER FUNCTION public.st_multipolygonfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 686 (class 1255 OID 19042)  
-- Dependencies: 6 1102  
-- Name: st_multipolygonfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_multipolygonfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT MPolyFromText($1, $2)$_$;  
 
 
ALTER FUNCTION public.st_multipolygonfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 688 (class 1255 OID 19044)  
-- Dependencies: 6 1102  
-- Name: st_ndims(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_ndims(geometry) RETURNS smallint  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_ndims';  
 
 
ALTER FUNCTION public.st_ndims(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 689 (class 1255 OID 19045)  
-- Dependencies: 6 1102  
-- Name: st_npoints(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_npoints(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_npoints';  
 
 
ALTER FUNCTION public.st_npoints(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 690 (class 1255 OID 19046)  
-- Dependencies: 6 1102  
-- Name: st_nrings(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_nrings(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_nrings';  
 
 
ALTER FUNCTION public.st_nrings(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 691 (class 1255 OID 19047)  
-- Dependencies: 6 1102  
-- Name: st_numgeometries(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_numgeometries(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_numgeometries_collection';  
 
 
ALTER FUNCTION public.st_numgeometries(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 692 (class 1255 OID 19048)  
-- Dependencies: 6 1102  
-- Name: st_numinteriorring(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_numinteriorring(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_numinteriorrings_polygon';  
 
 
ALTER FUNCTION public.st_numinteriorring(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 693 (class 1255 OID 19049)  
-- Dependencies: 6 1102  
-- Name: st_numinteriorrings(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_numinteriorrings(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_numinteriorrings_polygon';  
 
 
ALTER FUNCTION public.st_numinteriorrings(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 694 (class 1255 OID 19050)  
-- Dependencies: 6 1102  
-- Name: st_numpoints(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_numpoints(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_numpoints_linestring';  
 
 
ALTER FUNCTION public.st_numpoints(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 695 (class 1255 OID 19051)  
-- Dependencies: 6 1102 1102  
-- Name: st_orderingequals(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_orderingequals(geometry, geometry) RETURNS boolean  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT $1 ~= $2 AND _ST_OrderingEquals($1, $2)  
$_$;  
 
 
ALTER FUNCTION public.st_orderingequals(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 696 (class 1255 OID 19052)  
-- Dependencies: 6 1102 1102  
-- Name: st_overlaps(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_overlaps(geometry, geometry) RETURNS boolean  
LANGUAGE sql IMMUTABLE  
AS $_$SELECT $1 && $2 AND _ST_Overlaps($1,$2)$_$;  
 
 
ALTER FUNCTION public.st_overlaps(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 697 (class 1255 OID 19053)  
-- Dependencies: 6 1102  
-- Name: st_perimeter(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_perimeter(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_perimeter2d_poly';  
 
 
ALTER FUNCTION public.st_perimeter(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 698 (class 1255 OID 19054)  
-- Dependencies: 6 1102  
-- Name: st_perimeter2d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_perimeter2d(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_perimeter2d_poly';  
 
 
ALTER FUNCTION public.st_perimeter2d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 699 (class 1255 OID 19055)  
-- Dependencies: 6 1102  
-- Name: st_perimeter3d(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_perimeter3d(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_perimeter_poly';  
 
 
ALTER FUNCTION public.st_perimeter3d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 700 (class 1255 OID 19056)  
-- Dependencies: 6 1102  
-- Name: st_point(double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_point(double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_makepoint';  
 
 
ALTER FUNCTION public.st_point(double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 701 (class 1255 OID 19057)  
-- Dependencies: 6 1102  
-- Name: st_point_inside_circle(geometry, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_point_inside_circle(geometry, double precision, double precision, double precision) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_inside_circle_point';  
 
 
ALTER FUNCTION public.st_point_inside_circle(geometry, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 702 (class 1255 OID 19058)  
-- Dependencies: 6 1102  
-- Name: st_pointfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_pointfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromText($1)) = 'POINT'  
THEN ST_GeomFromText($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_pointfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 703 (class 1255 OID 19059)  
-- Dependencies: 6 1102  
-- Name: st_pointfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_pointfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromText($1, $2)) = 'POINT'  
THEN ST_GeomFromText($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_pointfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 706 (class 1255 OID 19061)  
-- Dependencies: 6 1102  
-- Name: st_pointfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_pointfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1)) = 'POINT'  
THEN ST_GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_pointfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 705 (class 1255 OID 19060)  
-- Dependencies: 6 1102  
-- Name: st_pointfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_pointfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1, $2)) = 'POINT'  
THEN ST_GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_pointfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 707 (class 1255 OID 19062)  
-- Dependencies: 6 1102 1102  
-- Name: st_pointn(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_pointn(geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_pointn_linestring';  
 
 
ALTER FUNCTION public.st_pointn(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 708 (class 1255 OID 19063)  
-- Dependencies: 6 1102 1102  
-- Name: st_pointonsurface(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_pointonsurface(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'pointonsurface';  
 
 
ALTER FUNCTION public.st_pointonsurface(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 709 (class 1255 OID 19064)  
-- Dependencies: 6 1102  
-- Name: st_polyfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_polyfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromText($1)) = 'POLYGON'  
THEN ST_GeomFromText($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_polyfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 710 (class 1255 OID 19065)  
-- Dependencies: 6 1102  
-- Name: st_polyfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_polyfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromText($1, $2)) = 'POLYGON'  
THEN ST_GeomFromText($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_polyfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 712 (class 1255 OID 19067)  
-- Dependencies: 6 1102  
-- Name: st_polyfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_polyfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1)) = 'POLYGON'  
THEN ST_GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_polyfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 711 (class 1255 OID 19066)  
-- Dependencies: 6 1102  
-- Name: st_polyfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_polyfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1, $2)) = 'POLYGON'  
THEN ST_GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_polyfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 713 (class 1255 OID 19068)  
-- Dependencies: 6 1102 1102  
-- Name: st_polygon(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_polygon(geometry, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT setSRID(makepolygon($1), $2)  
$_$;  
 
 
ALTER FUNCTION public.st_polygon(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 715 (class 1255 OID 19070)  
-- Dependencies: 1102 6  
-- Name: st_polygonfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_polygonfromtext(text) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT ST_PolyFromText($1)$_$;  
 
 
ALTER FUNCTION public.st_polygonfromtext(text) OWNER TO postgres;  
 
--  
-- TOC entry 714 (class 1255 OID 19069)  
-- Dependencies: 6 1102  
-- Name: st_polygonfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_polygonfromtext(text, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT PolyFromText($1, $2)$_$;  
 
 
ALTER FUNCTION public.st_polygonfromtext(text, integer) OWNER TO postgres;  
 
--  
-- TOC entry 717 (class 1255 OID 19072)  
-- Dependencies: 6 1102  
-- Name: st_polygonfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_polygonfromwkb(bytea) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POLYGON'  
THEN GeomFromWKB($1)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_polygonfromwkb(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 716 (class 1255 OID 19071)  
-- Dependencies: 1102 6  
-- Name: st_polygonfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_polygonfromwkb(bytea, integer) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$  
SELECT CASE WHEN geometrytype(ST_GeomFromWKB($1,$2)) = 'POLYGON'  
THEN ST_GeomFromWKB($1, $2)  
ELSE NULL END  
$_$;  
 
 
ALTER FUNCTION public.st_polygonfromwkb(bytea, integer) OWNER TO postgres;  
 
--  
-- TOC entry 718 (class 1255 OID 19073)  
-- Dependencies: 1102 6 1104  
-- Name: st_polygonize(geometry[]); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_polygonize(geometry[]) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'polygonize_garray';  
 
 
ALTER FUNCTION public.st_polygonize(geometry[]) OWNER TO postgres;  
 
--  
-- TOC entry 719 (class 1255 OID 19074)  
-- Dependencies: 1102 6 1104  
-- Name: st_polygonize_garray(geometry[]); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_polygonize_garray(geometry[]) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'polygonize_garray';  
 
 
ALTER FUNCTION public.st_polygonize_garray(geometry[]) OWNER TO postgres;  
 
--  
-- TOC entry 720 (class 1255 OID 19075)  
-- Dependencies: 6  
-- Name: st_postgis_gist_joinsel(internal, oid, internal, smallint); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_postgis_gist_joinsel(internal, oid, internal, smallint) RETURNS double precision  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'LWGEOM_gist_joinsel';  
 
 
ALTER FUNCTION public.st_postgis_gist_joinsel(internal, oid, internal, smallint) OWNER TO postgres;  
 
--  
-- TOC entry 721 (class 1255 OID 19076)  
-- Dependencies: 6  
-- Name: st_postgis_gist_sel(internal, oid, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_postgis_gist_sel(internal, oid, internal, integer) RETURNS double precision  
LANGUAGE c  
AS '$libdir/postgis-1.5', 'LWGEOM_gist_sel';  
 
 
ALTER FUNCTION public.st_postgis_gist_sel(internal, oid, internal, integer) OWNER TO postgres;  
 
--  
-- TOC entry 722 (class 1255 OID 19077)  
-- Dependencies: 1102 6 1102  
-- Name: st_relate(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_relate(geometry, geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'relate_full';  
 
 
ALTER FUNCTION public.st_relate(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 723 (class 1255 OID 19078)  
-- Dependencies: 1102 6 1102  
-- Name: st_relate(geometry, geometry, text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_relate(geometry, geometry, text) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'relate_pattern';  
 
 
ALTER FUNCTION public.st_relate(geometry, geometry, text) OWNER TO postgres;  
 
--  
-- TOC entry 724 (class 1255 OID 19079)  
-- Dependencies: 1102 6 1102  
-- Name: st_removepoint(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_removepoint(geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_removepoint';  
 
 
ALTER FUNCTION public.st_removepoint(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 725 (class 1255 OID 19080)  
-- Dependencies: 1102 6 1102  
-- Name: st_reverse(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_reverse(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_reverse';  
 
 
ALTER FUNCTION public.st_reverse(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 726 (class 1255 OID 19081)  
-- Dependencies: 1102 6 1102  
-- Name: st_rotate(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_rotate(geometry, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT rotateZ($1, $2)$_$;  
 
 
ALTER FUNCTION public.st_rotate(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 727 (class 1255 OID 19082)  
-- Dependencies: 1102 6 1102  
-- Name: st_rotatex(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_rotatex(geometry, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT affine($1, 1, 0, 0, 0, cos($2), -sin($2), 0, sin($2), cos($2), 0, 0, 0)$_$;  
 
 
ALTER FUNCTION public.st_rotatex(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 728 (class 1255 OID 19083)  
-- Dependencies: 1102 6 1102  
-- Name: st_rotatey(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_rotatey(geometry, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT affine($1, cos($2), 0, sin($2), 0, 1, 0, -sin($2), 0, cos($2), 0, 0, 0)$_$;  
 
 
ALTER FUNCTION public.st_rotatey(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 729 (class 1255 OID 19084)  
-- Dependencies: 1102 6 1102  
-- Name: st_rotatez(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_rotatez(geometry, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT affine($1, cos($2), -sin($2), 0, sin($2), cos($2), 0, 0, 0, 1, 0, 0, 0)$_$;  
 
 
ALTER FUNCTION public.st_rotatez(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 731 (class 1255 OID 19086)  
-- Dependencies: 1102 1102 6  
-- Name: st_scale(geometry, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_scale(geometry, double precision, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT scale($1, $2, $3, 1)$_$;  
 
 
ALTER FUNCTION public.st_scale(geometry, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 730 (class 1255 OID 19085)  
-- Dependencies: 1102 6 1102  
-- Name: st_scale(geometry, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_scale(geometry, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT affine($1, $2, 0, 0, 0, $3, 0, 0, 0, $4, 0, 0, 0)$_$;  
 
 
ALTER FUNCTION public.st_scale(geometry, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 732 (class 1255 OID 19087)  
-- Dependencies: 1102 1102 6  
-- Name: st_segmentize(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_segmentize(geometry, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_segmentize2d';  
 
 
ALTER FUNCTION public.st_segmentize(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 733 (class 1255 OID 19088)  
-- Dependencies: 6 1096 1096  
-- Name: st_setfactor(chip, real); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_setfactor(chip, real) RETURNS chip  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_setFactor';  
 
 
ALTER FUNCTION public.st_setfactor(chip, real) OWNER TO postgres;  
 
--  
-- TOC entry 734 (class 1255 OID 19089)  
-- Dependencies: 6 1102 1102 1102  
-- Name: st_setpoint(geometry, integer, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_setpoint(geometry, integer, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_setpoint_linestring';  
 
 
ALTER FUNCTION public.st_setpoint(geometry, integer, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 735 (class 1255 OID 19090)  
-- Dependencies: 1102 6 1102  
-- Name: st_setsrid(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_setsrid(geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_setSRID';  
 
 
ALTER FUNCTION public.st_setsrid(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 736 (class 1255 OID 19091)  
-- Dependencies: 1102 6 1102  
-- Name: st_shift_longitude(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_shift_longitude(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_longitude_shift';  
 
 
ALTER FUNCTION public.st_shift_longitude(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 737 (class 1255 OID 19092)  
-- Dependencies: 1102 1102 1102 6  
-- Name: st_shortestline(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_shortestline(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_shortestline2d';  
 
 
ALTER FUNCTION public.st_shortestline(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 738 (class 1255 OID 19093)  
-- Dependencies: 6 1102 1102  
-- Name: st_simplify(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_simplify(geometry, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_simplify2d';  
 
 
ALTER FUNCTION public.st_simplify(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 739 (class 1255 OID 19094)  
-- Dependencies: 1102 6 1102  
-- Name: st_simplifypreservetopology(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_simplifypreservetopology(geometry, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT COST 100  
AS '$libdir/postgis-1.5', 'topologypreservesimplify';  
 
 
ALTER FUNCTION public.st_simplifypreservetopology(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 740 (class 1255 OID 19097)  
-- Dependencies: 1102 6 1102  
-- Name: st_snaptogrid(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_snaptogrid(geometry, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT ST_SnapToGrid($1, 0, 0, $2, $2)$_$;  
 
 
ALTER FUNCTION public.st_snaptogrid(geometry, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 704 (class 1255 OID 19096)  
-- Dependencies: 6 1102 1102  
-- Name: st_snaptogrid(geometry, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_snaptogrid(geometry, double precision, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT ST_SnapToGrid($1, 0, 0, $2, $3)$_$;  
 
 
ALTER FUNCTION public.st_snaptogrid(geometry, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 670 (class 1255 OID 19095)  
-- Dependencies: 6 1102 1102  
-- Name: st_snaptogrid(geometry, double precision, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_snaptogrid(geometry, double precision, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_snaptogrid';  
 
 
ALTER FUNCTION public.st_snaptogrid(geometry, double precision, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 741 (class 1255 OID 19098)  
-- Dependencies: 1102 1102 1102 6  
-- Name: st_snaptogrid(geometry, geometry, double precision, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_snaptogrid(geometry, geometry, double precision, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_snaptogrid_pointoff';  
 
 
ALTER FUNCTION public.st_snaptogrid(geometry, geometry, double precision, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 742 (class 1255 OID 19099)  
-- Dependencies: 6 1113  
-- Name: st_spheroid_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_spheroid_in(cstring) RETURNS spheroid  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'ellipsoid_in';  
 
 
ALTER FUNCTION public.st_spheroid_in(cstring) OWNER TO postgres;  
 
--  
-- TOC entry 743 (class 1255 OID 19100)  
-- Dependencies: 6 1113  
-- Name: st_spheroid_out(spheroid); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_spheroid_out(spheroid) RETURNS cstring  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'ellipsoid_out';  
 
 
ALTER FUNCTION public.st_spheroid_out(spheroid) OWNER TO postgres;  
 
--  
-- TOC entry 744 (class 1255 OID 19101)  
-- Dependencies: 1096 6  
-- Name: st_srid(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_srid(chip) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_getSRID';  
 
 
ALTER FUNCTION public.st_srid(chip) OWNER TO postgres;  
 
--  
-- TOC entry 745 (class 1255 OID 19102)  
-- Dependencies: 6 1102  
-- Name: st_srid(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_srid(geometry) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_getSRID';  
 
 
ALTER FUNCTION public.st_srid(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 746 (class 1255 OID 19103)  
-- Dependencies: 6 1102 1102  
-- Name: st_startpoint(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_startpoint(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_startpoint_linestring';  
 
 
ALTER FUNCTION public.st_startpoint(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 747 (class 1255 OID 19104)  
-- Dependencies: 6 1102  
-- Name: st_summary(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_summary(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_summary';  
 
 
ALTER FUNCTION public.st_summary(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 748 (class 1255 OID 19105)  
-- Dependencies: 1102 1102 1102 6  
-- Name: st_symdifference(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_symdifference(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'symdifference';  
 
 
ALTER FUNCTION public.st_symdifference(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 749 (class 1255 OID 19106)  
-- Dependencies: 1102 1102 1102 6  
-- Name: st_symmetricdifference(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_symmetricdifference(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'symdifference';  
 
 
ALTER FUNCTION public.st_symmetricdifference(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 750 (class 1255 OID 19107)  
-- Dependencies: 6 1102  
-- Name: st_text(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_text(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_to_text';  
 
 
ALTER FUNCTION public.st_text(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 751 (class 1255 OID 19108)  
-- Dependencies: 1102 6 1102  
-- Name: st_touches(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_touches(geometry, geometry) RETURNS boolean  
LANGUAGE sql IMMUTABLE  
AS $_$SELECT $1 && $2 AND _ST_Touches($1,$2)$_$;  
 
 
ALTER FUNCTION public.st_touches(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 752 (class 1255 OID 19109)  
-- Dependencies: 6 1102 1102  
-- Name: st_transform(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_transform(geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'transform';  
 
 
ALTER FUNCTION public.st_transform(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 754 (class 1255 OID 19111)  
-- Dependencies: 1102 6 1102  
-- Name: st_translate(geometry, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_translate(geometry, double precision, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT translate($1, $2, $3, 0)$_$;  
 
 
ALTER FUNCTION public.st_translate(geometry, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 753 (class 1255 OID 19110)  
-- Dependencies: 1102 6 1102  
-- Name: st_translate(geometry, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_translate(geometry, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT affine($1, 1, 0, 0, 0, 1, 0, 0, 0, 1, $2, $3, $4)$_$;  
 
 
ALTER FUNCTION public.st_translate(geometry, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 755 (class 1255 OID 19112)  
-- Dependencies: 6 1102 1102  
-- Name: st_transscale(geometry, double precision, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_transscale(geometry, double precision, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT affine($1, $4, 0, 0, 0, $5, 0,  
0, 0, 1, $2 * $4, $3 * $5, 0)$_$;  
 
 
ALTER FUNCTION public.st_transscale(geometry, double precision, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 757 (class 1255 OID 19114)  
-- Dependencies: 6 1104 1102  
-- Name: st_union(geometry[]); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_union(geometry[]) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'pgis_union_geometry_array';  
 
 
ALTER FUNCTION public.st_union(geometry[]) OWNER TO postgres;  
 
--  
-- TOC entry 756 (class 1255 OID 19113)  
-- Dependencies: 6 1102 1102 1102  
-- Name: st_union(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_union(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'geomunion';  
 
 
ALTER FUNCTION public.st_union(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 758 (class 1255 OID 19115)  
-- Dependencies: 1104 6 1102  
-- Name: st_unite_garray(geometry[]); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_unite_garray(geometry[]) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'pgis_union_geometry_array';  
 
 
ALTER FUNCTION public.st_unite_garray(geometry[]) OWNER TO postgres;  
 
--  
-- TOC entry 759 (class 1255 OID 19116)  
-- Dependencies: 6 1096  
-- Name: st_width(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_width(chip) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_getWidth';  
 
 
ALTER FUNCTION public.st_width(chip) OWNER TO postgres;  
 
--  
-- TOC entry 760 (class 1255 OID 19117)  
-- Dependencies: 1102 1102 6  
-- Name: st_within(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_within(geometry, geometry) RETURNS boolean  
LANGUAGE sql IMMUTABLE  
AS $_$SELECT $1 && $2 AND _ST_Within($1,$2)$_$;  
 
 
ALTER FUNCTION public.st_within(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 761 (class 1255 OID 19118)  
-- Dependencies: 1102 6  
-- Name: st_wkbtosql(bytea); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_wkbtosql(bytea) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_from_WKB';  
 
 
ALTER FUNCTION public.st_wkbtosql(bytea) OWNER TO postgres;  
 
--  
-- TOC entry 762 (class 1255 OID 19119)  
-- Dependencies: 6 1102  
-- Name: st_wkttosql(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_wkttosql(text) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_from_text';  
 
 
ALTER FUNCTION public.st_wkttosql(text) OWNER TO postgres;  
 
--  
-- TOC entry 763 (class 1255 OID 19120)  
-- Dependencies: 1102 6  
-- Name: st_x(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_x(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_x_point';  
 
 
ALTER FUNCTION public.st_x(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 764 (class 1255 OID 19121)  
-- Dependencies: 6 1090  
-- Name: st_xmax(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_xmax(box3d) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_xmax';  
 
 
ALTER FUNCTION public.st_xmax(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 765 (class 1255 OID 19122)  
-- Dependencies: 6 1090  
-- Name: st_xmin(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_xmin(box3d) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_xmin';  
 
 
ALTER FUNCTION public.st_xmin(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 766 (class 1255 OID 19123)  
-- Dependencies: 1102 6  
-- Name: st_y(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_y(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_y_point';  
 
 
ALTER FUNCTION public.st_y(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 767 (class 1255 OID 19124)  
-- Dependencies: 1090 6  
-- Name: st_ymax(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_ymax(box3d) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_ymax';  
 
 
ALTER FUNCTION public.st_ymax(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 768 (class 1255 OID 19125)  
-- Dependencies: 6 1090  
-- Name: st_ymin(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_ymin(box3d) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_ymin';  
 
 
ALTER FUNCTION public.st_ymin(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 769 (class 1255 OID 19126)  
-- Dependencies: 1102 6  
-- Name: st_z(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_z(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_z_point';  
 
 
ALTER FUNCTION public.st_z(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 770 (class 1255 OID 19127)  
-- Dependencies: 6 1090  
-- Name: st_zmax(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_zmax(box3d) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_zmax';  
 
 
ALTER FUNCTION public.st_zmax(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 771 (class 1255 OID 19128)  
-- Dependencies: 6 1102  
-- Name: st_zmflag(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_zmflag(geometry) RETURNS smallint  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_zmflag';  
 
 
ALTER FUNCTION public.st_zmflag(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 772 (class 1255 OID 19129)  
-- Dependencies: 1090 6  
-- Name: st_zmin(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION st_zmin(box3d) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_zmin';  
 
 
ALTER FUNCTION public.st_zmin(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 773 (class 1255 OID 19130)  
-- Dependencies: 1102 6 1102  
-- Name: startpoint(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION startpoint(geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_startpoint_linestring';  
 
 
ALTER FUNCTION public.startpoint(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 774 (class 1255 OID 19131)  
-- Dependencies: 6 1102  
-- Name: summary(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION summary(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_summary';  
 
 
ALTER FUNCTION public.summary(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 775 (class 1255 OID 19132)  
-- Dependencies: 1102 6 1102 1102  
-- Name: symdifference(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION symdifference(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'symdifference';  
 
 
ALTER FUNCTION public.symdifference(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 776 (class 1255 OID 19133)  
-- Dependencies: 1102 6 1102 1102  
-- Name: symmetricdifference(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION symmetricdifference(geometry, geometry) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'symdifference';  
 
 
ALTER FUNCTION public.symmetricdifference(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 777 (class 1255 OID 19134)  
-- Dependencies: 6 1102  
-- Name: text(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION text(geometry) RETURNS text  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_to_text';  
 
 
ALTER FUNCTION public.text(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 778 (class 1255 OID 19135)  
-- Dependencies: 1102 6 1102  
-- Name: touches(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION touches(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'touches';  
 
 
ALTER FUNCTION public.touches(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 779 (class 1255 OID 19136)  
-- Dependencies: 1102 6 1102  
-- Name: transform(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION transform(geometry, integer) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'transform';  
 
 
ALTER FUNCTION public.transform(geometry, integer) OWNER TO postgres;  
 
--  
-- TOC entry 781 (class 1255 OID 19138)  
-- Dependencies: 1102 6 1102  
-- Name: translate(geometry, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION translate(geometry, double precision, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT translate($1, $2, $3, 0)$_$;  
 
 
ALTER FUNCTION public.translate(geometry, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 780 (class 1255 OID 19137)  
-- Dependencies: 1102 6 1102  
-- Name: translate(geometry, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION translate(geometry, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT affine($1, 1, 0, 0, 0, 1, 0, 0, 0, 1, $2, $3, $4)$_$;  
 
 
ALTER FUNCTION public.translate(geometry, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 782 (class 1255 OID 19139)  
-- Dependencies: 6 1102 1102  
-- Name: transscale(geometry, double precision, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION transscale(geometry, double precision, double precision, double precision, double precision) RETURNS geometry  
LANGUAGE sql IMMUTABLE STRICT  
AS $_$SELECT affine($1, $4, 0, 0, 0, $5, 0,  
0, 0, 1, $2 * $4, $3 * $5, 0)$_$;  
 
 
ALTER FUNCTION public.transscale(geometry, double precision, double precision, double precision, double precision) OWNER TO postgres;  
 
--  
-- TOC entry 783 (class 1255 OID 19140)  
-- Dependencies: 1104 6 1102  
-- Name: unite_garray(geometry[]); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION unite_garray(geometry[]) RETURNS geometry  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'pgis_union_geometry_array';  
 
 
ALTER FUNCTION public.unite_garray(geometry[]) OWNER TO postgres;  
 
--  
-- TOC entry 784 (class 1255 OID 19141)  
-- Dependencies: 6 1168  
-- Name: unlockrows(text); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION unlockrows(text) RETURNS integer  
LANGUAGE plpgsql STRICT  
AS $_$  
DECLARE  
ret int;  
BEGIN  
 
IF NOT LongTransactionsEnabled() THEN  
RAISE EXCEPTION 'Long transaction support disabled, use EnableLongTransaction() to enable.';  
END IF;  
 
EXECUTE 'DELETE FROM authorization_table where authid = ' ||  
quote_literal($1);  
 
GET DIAGNOSTICS ret = ROW_COUNT;  
 
RETURN ret;  
END;  
$_$;  
 
 
ALTER FUNCTION public.unlockrows(text) OWNER TO postgres;  
 
--  
-- TOC entry 787 (class 1255 OID 19144)  
-- Dependencies: 6 1168  
-- Name: updategeometrysrid(character varying, character varying, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION updategeometrysrid(character varying, character varying, integer) RETURNS text  
LANGUAGE plpgsql STRICT  
AS $_$  
DECLARE  
ret text;  
BEGIN  
SELECT UpdateGeometrySRID('','',$1,$2,$3) into ret;  
RETURN ret;  
END;  
$_$;  
 
 
ALTER FUNCTION public.updategeometrysrid(character varying, character varying, integer) OWNER TO postgres;  
 
--  
-- TOC entry 786 (class 1255 OID 19143)  
-- Dependencies: 6 1168  
-- Name: updategeometrysrid(character varying, character varying, character varying, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION updategeometrysrid(character varying, character varying, character varying, integer) RETURNS text  
LANGUAGE plpgsql STRICT  
AS $_$  
DECLARE  
ret text;  
BEGIN  
SELECT UpdateGeometrySRID('',$1,$2,$3,$4) into ret;  
RETURN ret;  
END;  
$_$;  
 
 
ALTER FUNCTION public.updategeometrysrid(character varying, character varying, character varying, integer) OWNER TO postgres;  
 
--  
-- TOC entry 785 (class 1255 OID 19142)  
-- Dependencies: 1168 6  
-- Name: updategeometrysrid(character varying, character varying, character varying, character varying, integer); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION updategeometrysrid(character varying, character varying, character varying, character varying, integer) RETURNS text  
LANGUAGE plpgsql STRICT  
AS $_$  
DECLARE  
catalog_name alias for $1;  
schema_name alias for $2;  
table_name alias for $3;  
column_name alias for $4;  
new_srid alias for $5;  
myrec RECORD;  
okay boolean;  
cname varchar;  
real_schema name;  
 
BEGIN  
 
 
-- Find, check or fix schema_name  
IF ( schema_name != '' ) THEN  
okay = 'f';  
 
FOR myrec IN SELECT nspname FROM pg_namespace WHERE text(nspname) = schema_name LOOP  
okay := 't';  
END LOOP;  
 
IF ( okay <> 't' ) THEN  
RAISE EXCEPTION 'Invalid schema name';  
ELSE  
real_schema = schema_name;  
END IF;  
ELSE  
SELECT INTO real_schema current_schema()::text;  
END IF;  
 
-- Find out if the column is in the geometry_columns table  
okay = 'f';  
FOR myrec IN SELECT * from geometry_columns where f_table_schema = text(real_schema) and f_table_name = table_name and f_geometry_column = column_name LOOP  
okay := 't';  
END LOOP;  
IF (okay <> 't') THEN  
RAISE EXCEPTION 'column not found in geometry_columns table';  
RETURN 'f';  
END IF;  
 
-- Update ref from geometry_columns table  
EXECUTE 'UPDATE geometry_columns SET SRID = ' || new_srid::text ||  
' where f_table_schema = ' ||  
quote_literal(real_schema) || ' and f_table_name = ' ||  
quote_literal(table_name) || ' and f_geometry_column = ' ||  
quote_literal(column_name);  
 
-- Make up constraint name  
cname = 'enforce_srid_' || column_name;  
 
-- Drop enforce_srid constraint  
EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) ||  
'.' || quote_ident(table_name) ||  
' DROP constraint ' || quote_ident(cname);  
 
-- Update geometries SRID  
EXECUTE 'UPDATE ' || quote_ident(real_schema) ||  
'.' || quote_ident(table_name) ||  
' SET ' || quote_ident(column_name) ||  
' = setSRID(' || quote_ident(column_name) ||  
', ' || new_srid::text || ')';  
 
-- Reset enforce_srid constraint  
EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) ||  
'.' || quote_ident(table_name) ||  
' ADD constraint ' || quote_ident(cname) ||  
' CHECK (srid(' || quote_ident(column_name) ||  
') = ' || new_srid::text || ')';  
 
RETURN real_schema || '.' || table_name || '.' || column_name ||' SRID changed to ' || new_srid::text;  
 
END;  
$_$;  
 
 
ALTER FUNCTION public.updategeometrysrid(character varying, character varying, character varying, character varying, integer) OWNER TO postgres;  
 
--  
-- TOC entry 788 (class 1255 OID 19145)  
-- Dependencies: 6 1096  
-- Name: width(chip); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION width(chip) RETURNS integer  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'CHIP_getWidth';  
 
 
ALTER FUNCTION public.width(chip) OWNER TO postgres;  
 
--  
-- TOC entry 789 (class 1255 OID 19146)  
-- Dependencies: 1102 1102 6  
-- Name: within(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION within(geometry, geometry) RETURNS boolean  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'within';  
 
 
ALTER FUNCTION public.within(geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 790 (class 1255 OID 19147)  
-- Dependencies: 6 1102  
-- Name: x(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION x(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_x_point';  
 
 
ALTER FUNCTION public.x(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 791 (class 1255 OID 19148)  
-- Dependencies: 6 1090  
-- Name: xmax(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION xmax(box3d) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_xmax';  
 
 
ALTER FUNCTION public.xmax(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 792 (class 1255 OID 19149)  
-- Dependencies: 1090 6  
-- Name: xmin(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION xmin(box3d) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_xmin';  
 
 
ALTER FUNCTION public.xmin(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 793 (class 1255 OID 19150)  
-- Dependencies: 6 1102  
-- Name: y(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION y(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_y_point';  
 
 
ALTER FUNCTION public.y(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 794 (class 1255 OID 19151)  
-- Dependencies: 1090 6  
-- Name: ymax(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION ymax(box3d) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_ymax';  
 
 
ALTER FUNCTION public.ymax(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 795 (class 1255 OID 19152)  
-- Dependencies: 1090 6  
-- Name: ymin(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION ymin(box3d) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_ymin';  
 
 
ALTER FUNCTION public.ymin(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 796 (class 1255 OID 19153)  
-- Dependencies: 1102 6  
-- Name: z(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION z(geometry) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_z_point';  
 
 
ALTER FUNCTION public.z(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 797 (class 1255 OID 19154)  
-- Dependencies: 1090 6  
-- Name: zmax(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION zmax(box3d) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_zmax';  
 
 
ALTER FUNCTION public.zmax(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 798 (class 1255 OID 19155)  
-- Dependencies: 6 1102  
-- Name: zmflag(geometry); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION zmflag(geometry) RETURNS smallint  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'LWGEOM_zmflag';  
 
 
ALTER FUNCTION public.zmflag(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 799 (class 1255 OID 19156)  
-- Dependencies: 1090 6  
-- Name: zmin(box3d); Type: FUNCTION; Schema: public; Owner: postgres  
--  
 
CREATE FUNCTION zmin(box3d) RETURNS double precision  
LANGUAGE c IMMUTABLE STRICT  
AS '$libdir/postgis-1.5', 'BOX3D_zmin';  
 
 
ALTER FUNCTION public.zmin(box3d) OWNER TO postgres;  
 
--  
-- TOC entry 1173 (class 1255 OID 19157)  
-- Dependencies: 1104 1102 330 329 6  
-- Name: accum(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE accum(geometry) (  
SFUNC = pgis_geometry_accum_transfn,  
STYPE = pgis_abs,  
FINALFUNC = pgis_geometry_accum_finalfn  
);  
 
 
ALTER AGGREGATE public.accum(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1174 (class 1255 OID 19158)  
-- Dependencies: 331 6 1102 1102 330  
-- Name: collect(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE collect(geometry) (  
SFUNC = pgis_geometry_accum_transfn,  
STYPE = pgis_abs,  
FINALFUNC = pgis_geometry_collect_finalfn  
);  
 
 
ALTER AGGREGATE public.collect(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1175 (class 1255 OID 19159)  
-- Dependencies: 6 1102 500 1093  
-- Name: extent(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE extent(geometry) (  
SFUNC = public.st_combine_bbox,  
STYPE = box3d_extent  
);  
 
 
ALTER AGGREGATE public.extent(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1176 (class 1255 OID 19160)  
-- Dependencies: 124 1102 1090 6  
-- Name: extent3d(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE extent3d(geometry) (  
SFUNC = public.combine_bbox,  
STYPE = box3d  
);  
 
 
ALTER AGGREGATE public.extent3d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1177 (class 1255 OID 19161)  
-- Dependencies: 1102 6 1102 330 332  
-- Name: makeline(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE makeline(geometry) (  
SFUNC = pgis_geometry_accum_transfn,  
STYPE = pgis_abs,  
FINALFUNC = pgis_geometry_makeline_finalfn  
);  
 
 
ALTER AGGREGATE public.makeline(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1178 (class 1255 OID 19162)  
-- Dependencies: 1102 496 1102 6  
-- Name: memcollect(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE memcollect(geometry) (  
SFUNC = public.st_collect,  
STYPE = geometry  
);  
 
 
ALTER AGGREGATE public.memcollect(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1179 (class 1255 OID 19163)  
-- Dependencies: 231 1102 1102 6  
-- Name: memgeomunion(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE memgeomunion(geometry) (  
SFUNC = geomunion,  
STYPE = geometry  
);  
 
 
ALTER AGGREGATE public.memgeomunion(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1180 (class 1255 OID 19164)  
-- Dependencies: 6 333 330 1102 1102  
-- Name: polygonize(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE polygonize(geometry) (  
SFUNC = pgis_geometry_accum_transfn,  
STYPE = pgis_abs,  
FINALFUNC = pgis_geometry_polygonize_finalfn  
);  
 
 
ALTER AGGREGATE public.polygonize(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1181 (class 1255 OID 19165)  
-- Dependencies: 329 330 1102 1104 6  
-- Name: st_accum(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE st_accum(geometry) (  
SFUNC = pgis_geometry_accum_transfn,  
STYPE = pgis_abs,  
FINALFUNC = pgis_geometry_accum_finalfn  
);  
 
 
ALTER AGGREGATE public.st_accum(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1182 (class 1255 OID 19166)  
-- Dependencies: 331 330 1102 1102 6  
-- Name: st_collect(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE st_collect(geometry) (  
SFUNC = pgis_geometry_accum_transfn,  
STYPE = pgis_abs,  
FINALFUNC = pgis_geometry_collect_finalfn  
);  
 
 
ALTER AGGREGATE public.st_collect(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1183 (class 1255 OID 19167)  
-- Dependencies: 500 1102 1093 6  
-- Name: st_extent(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE st_extent(geometry) (  
SFUNC = public.st_combine_bbox,  
STYPE = box3d_extent  
);  
 
 
ALTER AGGREGATE public.st_extent(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1169 (class 1255 OID 19168)  
-- Dependencies: 501 1102 1090 6  
-- Name: st_extent3d(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE st_extent3d(geometry) (  
SFUNC = public.st_combine_bbox,  
STYPE = box3d  
);  
 
 
ALTER AGGREGATE public.st_extent3d(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1170 (class 1255 OID 19169)  
-- Dependencies: 1102 6 330 332 1102  
-- Name: st_makeline(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE st_makeline(geometry) (  
SFUNC = pgis_geometry_accum_transfn,  
STYPE = pgis_abs,  
FINALFUNC = pgis_geometry_makeline_finalfn  
);  
 
 
ALTER AGGREGATE public.st_makeline(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1171 (class 1255 OID 19170)  
-- Dependencies: 6 496 1102 1102  
-- Name: st_memcollect(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE st_memcollect(geometry) (  
SFUNC = public.st_collect,  
STYPE = geometry  
);  
 
 
ALTER AGGREGATE public.st_memcollect(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1172 (class 1255 OID 19171)  
-- Dependencies: 756 6 1102 1102  
-- Name: st_memunion(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE st_memunion(geometry) (  
SFUNC = public.st_union,  
STYPE = geometry  
);  
 
 
ALTER AGGREGATE public.st_memunion(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1184 (class 1255 OID 19172)  
-- Dependencies: 330 333 1102 1102 6  
-- Name: st_polygonize(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE st_polygonize(geometry) (  
SFUNC = pgis_geometry_accum_transfn,  
STYPE = pgis_abs,  
FINALFUNC = pgis_geometry_polygonize_finalfn  
);  
 
 
ALTER AGGREGATE public.st_polygonize(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1185 (class 1255 OID 19173)  
-- Dependencies: 330 334 1102 1102 6  
-- Name: st_union(geometry); Type: AGGREGATE; Schema: public; Owner: postgres  
--  
 
CREATE AGGREGATE st_union(geometry) (  
SFUNC = pgis_geometry_accum_transfn,  
STYPE = pgis_abs,  
FINALFUNC = pgis_geometry_union_finalfn  
);  
 
 
ALTER AGGREGATE public.st_union(geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1891 (class 2617 OID 19174)  
-- Dependencies: 215 6 1102 1102 208 207  
-- Name: &&; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR && (  
PROCEDURE = geometry_overlap,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = &&,  
RESTRICT = geometry_gist_sel,  
JOIN = geometry_gist_joinsel  
);  
 
 
ALTER OPERATOR public.&& (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1892 (class 2617 OID 19175)  
-- Dependencies: 6 176 180 185 1099 1099  
-- Name: &&; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR && (  
PROCEDURE = geography_overlaps,  
LEFTARG = geography,  
RIGHTARG = geography,  
COMMUTATOR = &&,  
RESTRICT = geography_gist_selectivity,  
JOIN = geography_gist_join_selectivity  
);  
 
 
ALTER OPERATOR public.&& (geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 1893 (class 2617 OID 19177)  
-- Dependencies: 1102 6 1102 216  
-- Name: &<; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR &< (  
PROCEDURE = geometry_overleft,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = &>,  
RESTRICT = positionsel,  
JOIN = positionjoinsel  
);  
 
 
ALTER OPERATOR public.&< (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1894 (class 2617 OID 19179)  
-- Dependencies: 1102 214 1102 6  
-- Name: &<|; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR &<| (  
PROCEDURE = geometry_overbelow,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = |&>,  
RESTRICT = positionsel,  
JOIN = positionjoinsel  
);  
 
 
ALTER OPERATOR public.&<| (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1895 (class 2617 OID 19176)  
-- Dependencies: 1102 217 6 1102  
-- Name: &>; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR &> (  
PROCEDURE = geometry_overright,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = &<,  
RESTRICT = positionsel,  
JOIN = positionjoinsel  
);  
 
 
ALTER OPERATOR public.&> (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1896 (class 2617 OID 19182)  
-- Dependencies: 6 1102 1102 212  
-- Name: <; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR < (  
PROCEDURE = geometry_lt,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = >,  
NEGATOR = >=,  
RESTRICT = contsel,  
JOIN = contjoinsel  
);  
 
 
ALTER OPERATOR public.< (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1899 (class 2617 OID 19185)  
-- Dependencies: 1099 6 1099 184  
-- Name: <; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR < (  
PROCEDURE = geography_lt,  
LEFTARG = geography,  
RIGHTARG = geography,  
COMMUTATOR = >,  
NEGATOR = >=,  
RESTRICT = contsel,  
JOIN = contjoinsel  
);  
 
 
ALTER OPERATOR public.< (geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 1900 (class 2617 OID 19187)  
-- Dependencies: 1102 6 1102 211  
-- Name: <<; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR << (  
PROCEDURE = geometry_left,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = >>,  
RESTRICT = positionsel,  
JOIN = positionjoinsel  
);  
 
 
ALTER OPERATOR public.<< (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1901 (class 2617 OID 19189)  
-- Dependencies: 6 1102 1102 201  
-- Name: <<|; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR <<| (  
PROCEDURE = geometry_below,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = |>>,  
RESTRICT = positionsel,  
JOIN = positionjoinsel  
);  
 
 
ALTER OPERATOR public.<<| (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1902 (class 2617 OID 19190)  
-- Dependencies: 1102 6 210 1102  
-- Name: <=; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR <= (  
PROCEDURE = geometry_le,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = >=,  
NEGATOR = >,  
RESTRICT = contsel,  
JOIN = contjoinsel  
);  
 
 
ALTER OPERATOR public.<= (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1903 (class 2617 OID 19191)  
-- Dependencies: 183 1099 1099 6  
-- Name: <=; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR <= (  
PROCEDURE = geography_le,  
LEFTARG = geography,  
RIGHTARG = geography,  
COMMUTATOR = >=,  
NEGATOR = >,  
RESTRICT = contsel,  
JOIN = contjoinsel  
);  
 
 
ALTER OPERATOR public.<= (geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 1904 (class 2617 OID 19192)  
-- Dependencies: 205 6 1102 1102  
-- Name: =; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR = (  
PROCEDURE = geometry_eq,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = =,  
RESTRICT = contsel,  
JOIN = contjoinsel  
);  
 
 
ALTER OPERATOR public.= (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1905 (class 2617 OID 19193)  
-- Dependencies: 1099 171 1099 6  
-- Name: =; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR = (  
PROCEDURE = geography_eq,  
LEFTARG = geography,  
RIGHTARG = geography,  
COMMUTATOR = =,  
RESTRICT = contsel,  
JOIN = contjoinsel  
);  
 
 
ALTER OPERATOR public.= (geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 1897 (class 2617 OID 19180)  
-- Dependencies: 209 6 1102 1102  
-- Name: >; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR > (  
PROCEDURE = geometry_gt,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = <,  
NEGATOR = <=,  
RESTRICT = contsel,  
JOIN = contjoinsel  
);  
 
 
ALTER OPERATOR public.> (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1906 (class 2617 OID 19183)  
-- Dependencies: 1099 1099 6 182  
-- Name: >; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR > (  
PROCEDURE = geography_gt,  
LEFTARG = geography,  
RIGHTARG = geography,  
COMMUTATOR = <,  
NEGATOR = <=,  
RESTRICT = contsel,  
JOIN = contjoinsel  
);  
 
 
ALTER OPERATOR public.> (geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 1907 (class 2617 OID 19181)  
-- Dependencies: 206 1102 1102 6  
-- Name: >=; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR >= (  
PROCEDURE = geometry_ge,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = <=,  
NEGATOR = <,  
RESTRICT = contsel,  
JOIN = contjoinsel  
);  
 
 
ALTER OPERATOR public.>= (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1908 (class 2617 OID 19184)  
-- Dependencies: 6 1099 1099 172  
-- Name: >=; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR >= (  
PROCEDURE = geography_ge,  
LEFTARG = geography,  
RIGHTARG = geography,  
COMMUTATOR = <=,  
NEGATOR = <,  
RESTRICT = contsel,  
JOIN = contjoinsel  
);  
 
 
ALTER OPERATOR public.>= (geography, geography) OWNER TO postgres;  
 
--  
-- TOC entry 1909 (class 2617 OID 19186)  
-- Dependencies: 6 218 1102 1102  
-- Name: >>; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR >> (  
PROCEDURE = geometry_right,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = <<,  
RESTRICT = positionsel,  
JOIN = positionjoinsel  
);  
 
 
ALTER OPERATOR public.>> (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1910 (class 2617 OID 19195)  
-- Dependencies: 1102 6 204 1102  
-- Name: @; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR @ (  
PROCEDURE = geometry_contained,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = ~,  
RESTRICT = contsel,  
JOIN = contjoinsel  
);  
 
 
ALTER OPERATOR public.@ (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1898 (class 2617 OID 19178)  
-- Dependencies: 1102 1102 213 6  
-- Name: |&>; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR |&> (  
PROCEDURE = geometry_overabove,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = &<|,  
RESTRICT = positionsel,  
JOIN = positionjoinsel  
);  
 
 
ALTER OPERATOR public.|&> (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1911 (class 2617 OID 19188)  
-- Dependencies: 200 1102 6 1102  
-- Name: |>>; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR |>> (  
PROCEDURE = geometry_above,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = <<|,  
RESTRICT = positionsel,  
JOIN = positionjoinsel  
);  
 
 
ALTER OPERATOR public.|>> (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1912 (class 2617 OID 19194)  
-- Dependencies: 6 1102 1102 203  
-- Name: ~; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR ~ (  
PROCEDURE = geometry_contain,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = @,  
RESTRICT = contsel,  
JOIN = contjoinsel  
);  
 
 
ALTER OPERATOR public.~ (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 1913 (class 2617 OID 19196)  
-- Dependencies: 1102 220 6 1102  
-- Name: ~=; Type: OPERATOR; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR ~= (  
PROCEDURE = geometry_samebox,  
LEFTARG = geometry,  
RIGHTARG = geometry,  
COMMUTATOR = ~=,  
RESTRICT = eqsel,  
JOIN = eqjoinsel  
);  
 
 
ALTER OPERATOR public.~= (geometry, geometry) OWNER TO postgres;  
 
--  
-- TOC entry 2026 (class 2616 OID 19198)  
-- Dependencies: 2137 6 1099  
-- Name: btree_geography_ops; Type: OPERATOR CLASS; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR CLASS btree_geography_ops  
DEFAULT FOR TYPE geography USING btree AS  
OPERATOR 1 <(geography,geography) ,  
OPERATOR 2 <=(geography,geography) ,  
OPERATOR 3 =(geography,geography) ,  
OPERATOR 4 >=(geography,geography) ,  
OPERATOR 5 >(geography,geography) ,  
FUNCTION 1 geography_cmp(geography,geography);  
 
 
ALTER OPERATOR CLASS public.btree_geography_ops USING btree OWNER TO postgres;  
 
--  
-- TOC entry 2027 (class 2616 OID 19206)  
-- Dependencies: 1102 2138 6  
-- Name: btree_geometry_ops; Type: OPERATOR CLASS; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR CLASS btree_geometry_ops  
DEFAULT FOR TYPE geometry USING btree AS  
OPERATOR 1 <(geometry,geometry) ,  
OPERATOR 2 <=(geometry,geometry) ,  
OPERATOR 3 =(geometry,geometry) ,  
OPERATOR 4 >=(geometry,geometry) ,  
OPERATOR 5 >(geometry,geometry) ,  
FUNCTION 1 geometry_cmp(geometry,geometry);  
 
 
ALTER OPERATOR CLASS public.btree_geometry_ops USING btree OWNER TO postgres;  
 
--  
-- TOC entry 2028 (class 2616 OID 19214)  
-- Dependencies: 1099 1107 6 2139  
-- Name: gist_geography_ops; Type: OPERATOR CLASS; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR CLASS gist_geography_ops  
DEFAULT FOR TYPE geography USING gist AS  
STORAGE gidx ,  
OPERATOR 3 &&(geography,geography) ,  
FUNCTION 1 geography_gist_consistent(internal,geometry,integer) ,  
FUNCTION 2 geography_gist_union(bytea,internal) ,  
FUNCTION 3 geography_gist_compress(internal) ,  
FUNCTION 4 geography_gist_decompress(internal) ,  
FUNCTION 5 geography_gist_penalty(internal,internal,internal) ,  
FUNCTION 6 geography_gist_picksplit(internal,internal) ,  
FUNCTION 7 geography_gist_same(box2d,box2d,internal);  
 
 
ALTER OPERATOR CLASS public.gist_geography_ops USING gist OWNER TO postgres;  
 
--  
-- TOC entry 2029 (class 2616 OID 19224)  
-- Dependencies: 2140 6 1087 1102  
-- Name: gist_geometry_ops; Type: OPERATOR CLASS; Schema: public; Owner: postgres  
--  
 
CREATE OPERATOR CLASS gist_geometry_ops  
DEFAULT FOR TYPE geometry USING gist AS  
STORAGE box2d ,  
OPERATOR 1 <<(geometry,geometry) ,  
OPERATOR 2 &<(geometry,geometry) ,  
OPERATOR 3 &&(geometry,geometry) ,  
OPERATOR 4 &>(geometry,geometry) ,  
OPERATOR 5 >>(geometry,geometry) ,  
OPERATOR 6 ~=(geometry,geometry) ,  
OPERATOR 7 ~(geometry,geometry) ,  
OPERATOR 8 @(geometry,geometry) ,  
OPERATOR 9 &<|(geometry,geometry) ,  
OPERATOR 10 <<|(geometry,geometry) ,  
OPERATOR 11 |>>(geometry,geometry) ,  
OPERATOR 12 |&>(geometry,geometry) ,  
FUNCTION 1 lwgeom_gist_consistent(internal,geometry,integer) ,  
FUNCTION 2 lwgeom_gist_union(bytea,internal) ,  
FUNCTION 3 lwgeom_gist_compress(internal) ,  
FUNCTION 4 lwgeom_gist_decompress(internal) ,  
FUNCTION 5 lwgeom_gist_penalty(internal,internal,internal) ,  
FUNCTION 6 lwgeom_gist_picksplit(internal,internal) ,  
FUNCTION 7 lwgeom_gist_same(box2d,box2d,internal);  
 
 
ALTER OPERATOR CLASS public.gist_geometry_ops USING gist OWNER TO postgres;  
 
SET search_path = pg_catalog;  
 
--  
-- TOC entry 2708 (class 2605 OID 19244)  
-- Dependencies: 110 110 1087 1090  
-- Name: CAST (public.box2d AS public.box3d); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.box2d AS public.box3d) WITH FUNCTION public.box3d(public.box2d) AS IMPLICIT;  
 
 
--  
-- TOC entry 2709 (class 2605 OID 19245)  
-- Dependencies: 194 194 1102 1087  
-- Name: CAST (public.box2d AS public.geometry); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.box2d AS public.geometry) WITH FUNCTION public.geometry(public.box2d) AS IMPLICIT;  
 
 
--  
-- TOC entry 2710 (class 2605 OID 19246)  
-- Dependencies: 105 1090 105  
-- Name: CAST (public.box3d AS box); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.box3d AS box) WITH FUNCTION public.box(public.box3d) AS IMPLICIT;  
 
 
--  
-- TOC entry 2711 (class 2605 OID 19247)  
-- Dependencies: 108 1087 1090 108  
-- Name: CAST (public.box3d AS public.box2d); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.box3d AS public.box2d) WITH FUNCTION public.box2d(public.box3d) AS IMPLICIT;  
 
 
--  
-- TOC entry 2712 (class 2605 OID 19248)  
-- Dependencies: 195 1102 1090 195  
-- Name: CAST (public.box3d AS public.geometry); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.box3d AS public.geometry) WITH FUNCTION public.geometry(public.box3d) AS IMPLICIT;  
 
 
--  
-- TOC entry 2713 (class 2605 OID 19249)  
-- Dependencies: 106 106 1087 1093  
-- Name: CAST (public.box3d_extent AS public.box2d); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.box3d_extent AS public.box2d) WITH FUNCTION public.box2d(public.box3d_extent) AS IMPLICIT;  
 
 
--  
-- TOC entry 2714 (class 2605 OID 19250)  
-- Dependencies: 111 1093 1090 111  
-- Name: CAST (public.box3d_extent AS public.box3d); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.box3d_extent AS public.box3d) WITH FUNCTION public.box3d_extent(public.box3d_extent) AS IMPLICIT;  
 
 
--  
-- TOC entry 2715 (class 2605 OID 19251)  
-- Dependencies: 193 1093 1102 193  
-- Name: CAST (public.box3d_extent AS public.geometry); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.box3d_extent AS public.geometry) WITH FUNCTION public.geometry(public.box3d_extent) AS IMPLICIT;  
 
 
--  
-- TOC entry 2519 (class 2605 OID 19252)  
-- Dependencies: 198 1102 198  
-- Name: CAST (bytea AS public.geometry); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (bytea AS public.geometry) WITH FUNCTION public.geometry(bytea) AS IMPLICIT;  
 
 
--  
-- TOC entry 2716 (class 2605 OID 19253)  
-- Dependencies: 197 197 1096 1102  
-- Name: CAST (public.chip AS public.geometry); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.chip AS public.geometry) WITH FUNCTION public.geometry(public.chip) AS IMPLICIT;  
 
 
--  
-- TOC entry 2717 (class 2605 OID 19254)  
-- Dependencies: 168 1099 168 1099  
-- Name: CAST (public.geography AS public.geography); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.geography AS public.geography) WITH FUNCTION public.geography(public.geography, integer, boolean) AS IMPLICIT;  
 
 
--  
-- TOC entry 2718 (class 2605 OID 19255)  
-- Dependencies: 199 1102 199 1099  
-- Name: CAST (public.geography AS public.geometry); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.geography AS public.geometry) WITH FUNCTION public.geometry(public.geography);  
 
 
--  
-- TOC entry 2721 (class 2605 OID 19256)  
-- Dependencies: 104 1102 104  
-- Name: CAST (public.geometry AS box); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.geometry AS box) WITH FUNCTION public.box(public.geometry) AS IMPLICIT;  
 
 
--  
-- TOC entry 2722 (class 2605 OID 19257)  
-- Dependencies: 107 1087 1102 107  
-- Name: CAST (public.geometry AS public.box2d); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.geometry AS public.box2d) WITH FUNCTION public.box2d(public.geometry) AS IMPLICIT;  
 
 
--  
-- TOC entry 2723 (class 2605 OID 19258)  
-- Dependencies: 109 1090 1102 109  
-- Name: CAST (public.geometry AS public.box3d); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.geometry AS public.box3d) WITH FUNCTION public.box3d(public.geometry) AS IMPLICIT;  
 
 
--  
-- TOC entry 2719 (class 2605 OID 19259)  
-- Dependencies: 116 1102 116  
-- Name: CAST (public.geometry AS bytea); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.geometry AS bytea) WITH FUNCTION public.bytea(public.geometry) AS IMPLICIT;  
 
 
--  
-- TOC entry 2724 (class 2605 OID 19260)  
-- Dependencies: 169 1099 1102 169  
-- Name: CAST (public.geometry AS public.geography); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.geometry AS public.geography) WITH FUNCTION public.geography(public.geometry) AS IMPLICIT;  
 
 
--  
-- TOC entry 2720 (class 2605 OID 19261)  
-- Dependencies: 777 1102 777  
-- Name: CAST (public.geometry AS text); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (public.geometry AS text) WITH FUNCTION public.text(public.geometry) AS IMPLICIT;  
 
 
--  
-- TOC entry 2585 (class 2605 OID 19262)  
-- Dependencies: 196 196 1102  
-- Name: CAST (text AS public.geometry); Type: CAST; Schema: pg_catalog; Owner:  
--  
 
CREATE CAST (text AS public.geometry) WITH FUNCTION public.geometry(text) AS IMPLICIT;  
 
 
SET search_path = public, pg_catalog;  
 
SET default_tablespace = '';  
 
SET default_with_oids = false;  
 
--  
-- TOC entry 2423 (class 1259 OID 40481)  
-- Dependencies: 6  
-- Name: agency; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE agency (  
agency_name text NOT NULL,  
agency_url text,  
agency_timezone text,  
agency_lang text,  
agency_phone text  
);  
 
 
ALTER TABLE public.agency OWNER TO postgres;  
 
--  
-- TOC entry 2409 (class 1259 OID 19269)  
-- Dependencies: 6  
-- Name: calendar; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE calendar (  
service_id text NOT NULL,  
start_date text,  
end_date text,  
monday integer,  
tuesday integer,  
wednesday integer,  
thursday integer,  
friday integer,  
saturday integer,  
sunday integer  
);  
 
 
ALTER TABLE public.calendar OWNER TO postgres;  
 
--  
-- TOC entry 2410 (class 1259 OID 19275)  
-- Dependencies: 6  
-- Name: calendar_dates; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE calendar_dates (  
service_id text NOT NULL,  
date text NOT NULL,  
exception_type text  
);  
 
 
ALTER TABLE public.calendar_dates OWNER TO postgres;  
 
--  
-- TOC entry 2411 (class 1259 OID 19281)  
-- Dependencies: 2514 6  
-- Name: geography_columns; Type: VIEW; Schema: public; Owner: postgres  
--  
 
CREATE VIEW geography_columns AS  
SELECT current_database() AS f_table_catalog, n.nspname AS f_table_schema, c.relname AS f_table_name, a.attname AS f_geography_column, geography_typmod_dims(a.atttypmod) AS coord_dimension, geography_typmod_srid(a.atttypmod) AS srid, geography_typmod_type(a.atttypmod) AS type FROM pg_class c, pg_attribute a, pg_type t, pg_namespace n WHERE ((((((c.relkind = ANY (ARRAY['r'::"char", 'v'::"char"])) AND (t.typname = 'geography'::name)) AND (a.attisdropped = false)) AND (a.atttypid = t.oid)) AND (a.attrelid = c.oid)) AND (c.relnamespace = n.oid));  
 
 
ALTER TABLE public.geography_columns OWNER TO postgres;  
 
SET default_with_oids = true;  
 
--  
-- TOC entry 2412 (class 1259 OID 19286)  
-- Dependencies: 6  
-- Name: geometry_columns; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE geometry_columns (  
f_table_catalog character varying(256) NOT NULL,  
f_table_schema character varying(256) NOT NULL,  
f_table_name character varying(256) NOT NULL,  
f_geometry_column character varying(256) NOT NULL,  
coord_dimension integer NOT NULL,  
srid integer NOT NULL,  
type character varying(30) NOT NULL  
);  
 
 
ALTER TABLE public.geometry_columns OWNER TO postgres;  
 
SET default_with_oids = false;  
 
--  
-- TOC entry 2413 (class 1259 OID 19292)  
-- Dependencies: 6  
-- Name: myway_observations; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE myway_observations (  
observation_id text NOT NULL,  
myway_stop text,  
"time" timestamp with time zone,  
myway_route text  
);  
 
 
ALTER TABLE public.myway_observations OWNER TO postgres;  
 
--  
-- TOC entry 2427 (class 1259 OID 40519)  
-- Dependencies: 6  
-- Name: myway_routes; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE myway_routes (  
myway_route text NOT NULL,  
route_short_name text,  
trip_headsign text  
);  
 
 
ALTER TABLE public.myway_routes OWNER TO postgres;  
 
--  
-- TOC entry 2424 (class 1259 OID 40489)  
-- Dependencies: 6  
-- Name: myway_stops; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE myway_stops (  
myway_stop text NOT NULL,  
stop_id text  
);  
 
 
ALTER TABLE public.myway_stops OWNER TO postgres;  
 
--  
-- TOC entry 2425 (class 1259 OID 40498)  
-- Dependencies: 6  
-- Name: myway_timingdeltas; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE myway_timingdeltas (  
observation_id text NOT NULL,  
route_id text,  
stop_id text,  
timing_delta integer,  
"time" time with time zone,  
date date,  
timing_period text,  
stop_sequence integer,  
myway_stop text,  
route_name text  
);  
 
 
ALTER TABLE public.myway_timingdeltas OWNER TO postgres;  
 
--  
-- TOC entry 2426 (class 1259 OID 40504)  
-- Dependencies: 6 2425  
-- Name: myway_timingdeltas_timing_period_seq; Type: SEQUENCE; Schema: public; Owner: postgres  
--  
 
CREATE SEQUENCE myway_timingdeltas_timing_period_seq  
START WITH 1  
INCREMENT BY 1  
NO MINVALUE  
NO MAXVALUE  
CACHE 1;  
 
 
ALTER TABLE public.myway_timingdeltas_timing_period_seq OWNER TO postgres;  
 
--  
-- TOC entry 2771 (class 0 OID 0)  
-- Dependencies: 2426  
-- Name: myway_timingdeltas_timing_period_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres  
--  
 
ALTER SEQUENCE myway_timingdeltas_timing_period_seq OWNED BY myway_timingdeltas.timing_period;  
 
 
--  
-- TOC entry 2420 (class 1259 OID 40443)  
-- Dependencies: 6  
-- Name: routes; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE routes (  
route_id text NOT NULL,  
route_short_name text,  
route_long_name text,  
route_desc text,  
route_type integer,  
route_url text,  
route_text_color text,  
route_color text  
);  
 
 
ALTER TABLE public.routes OWNER TO postgres;  
 
--  
-- TOC entry 2414 (class 1259 OID 19328)  
-- Dependencies: 6  
-- Name: servicealerts_alerts; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE servicealerts_alerts (  
id integer NOT NULL,  
url text,  
description text,  
start timestamp with time zone,  
"end" timestamp with time zone,  
cause text,  
effect text,  
header text  
);  
 
 
ALTER TABLE public.servicealerts_alerts OWNER TO postgres;  
 
--  
-- TOC entry 2415 (class 1259 OID 19334)  
-- Dependencies: 2414 6  
-- Name: servicealerts_alerts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres  
--  
 
CREATE SEQUENCE servicealerts_alerts_id_seq  
START WITH 1  
INCREMENT BY 1  
NO MINVALUE  
NO MAXVALUE  
CACHE 1;  
 
 
ALTER TABLE public.servicealerts_alerts_id_seq OWNER TO postgres;  
 
--  
-- TOC entry 2772 (class 0 OID 0)  
-- Dependencies: 2415  
-- Name: servicealerts_alerts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres  
--  
 
ALTER SEQUENCE servicealerts_alerts_id_seq OWNED BY servicealerts_alerts.id;  
 
 
--  
-- TOC entry 2416 (class 1259 OID 19336)  
-- Dependencies: 6  
-- Name: servicealerts_informed; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE servicealerts_informed (  
servicealert_id integer NOT NULL,  
informed_class text NOT NULL,  
informed_id text NOT NULL,  
informed_action text  
);  
 
 
ALTER TABLE public.servicealerts_informed OWNER TO postgres;  
 
--  
-- TOC entry 2417 (class 1259 OID 19342)  
-- Dependencies: 6  
-- Name: shapes; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE shapes (  
shape_id text NOT NULL,  
shape_pt_lat double precision,  
shape_pt_lon double precision,  
shape_pt_sequence integer NOT NULL,  
shape_dist_traveled integer,  
shape_pt geography,  
);  
 
 
ALTER TABLE public.shapes OWNER TO postgres;  
 
--  
-- TOC entry 2418 (class 1259 OID 19348)  
-- Dependencies: 6  
-- Name: spatial_ref_sys; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE spatial_ref_sys (  
srid integer NOT NULL,  
auth_name character varying(256),  
auth_srid integer,  
srtext character varying(2048),  
proj4text character varying(2048)  
);  
 
 
ALTER TABLE public.spatial_ref_sys OWNER TO postgres;  
 
--  
-- TOC entry 2419 (class 1259 OID 20682)  
-- Dependencies: 6  
-- Name: stop_times; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE stop_times (  
trip_id text NOT NULL,  
arrival_time time without time zone,  
departure_time time without time zone,  
stop_id text,  
stop_sequence integer NOT NULL,  
stop_headsign text,  
pickup_type text,  
drop_off_type text,  
shape_dist_travelled text  
);  
 
 
ALTER TABLE public.stop_times OWNER TO postgres;  
 
--  
-- TOC entry 2421 (class 1259 OID 40452)  
-- Dependencies: 6 1099  
-- Name: stops; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE stops (  
stop_id text NOT NULL,  
stop_code text,  
stop_name text,  
stop_desc text,  
stop_lat double precision,  
stop_lon double precision,  
zone_id text,  
stop_url text,  
location_type integer,  
"position" geography  
);  
 
 
ALTER TABLE public.stops OWNER TO postgres;  
 
--  
-- TOC entry 2422 (class 1259 OID 40466)  
-- Dependencies: 6  
-- Name: trips; Type: TABLE; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE TABLE trips (  
route_id text,  
service_id text,  
trip_id text NOT NULL,  
trip_headsign text,  
direction_id text,  
block_id text,  
shape_id text  
);  
 
 
ALTER TABLE public.trips OWNER TO postgres;  
 
--  
-- TOC entry 2725 (class 2604 OID 19372)  
-- Dependencies: 2415 2414  
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres  
--  
 
ALTER TABLE servicealerts_alerts ALTER COLUMN id SET DEFAULT nextval('servicealerts_alerts_id_seq'::regclass);  
 
 
--  
-- TOC entry 2758 (class 2606 OID 40488)  
-- Dependencies: 2423 2423  
-- Name: agency_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY agency  
ADD CONSTRAINT agency_pkey PRIMARY KEY (agency_name);  
 
 
--  
-- TOC entry 2729 (class 2606 OID 19376)  
-- Dependencies: 2410 2410 2410  
-- Name: calendar_dates_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY calendar_dates  
ADD CONSTRAINT calendar_dates_pkey PRIMARY KEY (service_id, date);  
 
 
--  
-- TOC entry 2727 (class 2606 OID 19378)  
-- Dependencies: 2409 2409  
-- Name: calendar_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY calendar  
ADD CONSTRAINT calendar_pkey PRIMARY KEY (service_id);  
 
 
--  
-- TOC entry 2731 (class 2606 OID 19380)  
-- Dependencies: 2412 2412 2412 2412 2412  
-- Name: geometry_columns_pk; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY geometry_columns  
ADD CONSTRAINT geometry_columns_pk PRIMARY KEY (f_table_catalog, f_table_schema, f_table_name, f_geometry_column);  
 
 
--  
-- TOC entry 2733 (class 2606 OID 19382)  
-- Dependencies: 2413 2413  
-- Name: myway_observations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY myway_observations  
ADD CONSTRAINT myway_observations_pkey PRIMARY KEY (observation_id);  
 
 
--  
-- TOC entry 2764 (class 2606 OID 40526)  
-- Dependencies: 2427 2427  
-- Name: myway_routes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY myway_routes  
ADD CONSTRAINT myway_routes_pkey PRIMARY KEY (myway_route);  
 
 
--  
-- TOC entry 2762 (class 2606 OID 40507)  
-- Dependencies: 2425 2425  
-- Name: myway_timingdeltas_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY myway_timingdeltas  
ADD CONSTRAINT myway_timingdeltas_pkey PRIMARY KEY (observation_id);  
 
 
--  
-- TOC entry 2760 (class 2606 OID 40496)  
-- Dependencies: 2424 2424  
-- Name: mywaystops_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY myway_stops  
ADD CONSTRAINT mywaystops_pkey PRIMARY KEY (myway_stop);  
 
 
--  
-- TOC entry 2749 (class 2606 OID 40450)  
-- Dependencies: 2420 2420  
-- Name: routes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY routes  
ADD CONSTRAINT routes_pkey PRIMARY KEY (route_id);  
 
 
--  
-- TOC entry 2735 (class 2606 OID 19392)  
-- Dependencies: 2414 2414  
-- Name: servicealerts_alerts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY servicealerts_alerts  
ADD CONSTRAINT servicealerts_alerts_pkey PRIMARY KEY (id);  
 
 
--  
-- TOC entry 2737 (class 2606 OID 19394)  
-- Dependencies: 2416 2416 2416 2416  
-- Name: servicealerts_informed_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY servicealerts_informed  
ADD CONSTRAINT servicealerts_informed_pkey PRIMARY KEY (servicealert_id, informed_class, informed_id);  
 
 
--  
-- TOC entry 2739 (class 2606 OID 19396)  
-- Dependencies: 2417 2417 2417  
-- Name: shapes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY shapes  
ADD CONSTRAINT shapes_pkey PRIMARY KEY (shape_id, shape_pt_sequence);  
 
 
--  
-- TOC entry 2741 (class 2606 OID 19398)  
-- Dependencies: 2418 2418  
-- Name: spatial_ref_sys_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY spatial_ref_sys  
ADD CONSTRAINT spatial_ref_sys_pkey PRIMARY KEY (srid);  
 
 
--  
-- TOC entry 2744 (class 2606 OID 40421)  
-- Dependencies: 2419 2419 2419  
-- Name: stop_times_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY stop_times  
ADD CONSTRAINT stop_times_pkey PRIMARY KEY (trip_id, stop_sequence);  
 
 
--  
-- TOC entry 2751 (class 2606 OID 40459)  
-- Dependencies: 2421 2421  
-- Name: stops_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY stops  
ADD CONSTRAINT stops_pkey PRIMARY KEY (stop_id);  
 
 
--  
-- TOC entry 2753 (class 2606 OID 40461)  
-- Dependencies: 2421 2421  
-- Name: stops_stop_code_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY stops  
ADD CONSTRAINT stops_stop_code_key UNIQUE (stop_code);  
 
 
--  
-- TOC entry 2756 (class 2606 OID 40473)  
-- Dependencies: 2422 2422  
-- Name: trips_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:  
--  
 
ALTER TABLE ONLY trips  
ADD CONSTRAINT trips_pkey PRIMARY KEY (trip_id);  
 
 
--  
-- TOC entry 2747 (class 1259 OID 40451)  
-- Dependencies: 2420  
-- Name: routenumber; Type: INDEX; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE INDEX routenumber ON routes USING btree (route_short_name);  
 
 
--  
-- TOC entry 2754 (class 1259 OID 40474)  
-- Dependencies: 2422  
-- Name: routetrips; Type: INDEX; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE INDEX routetrips ON trips USING btree (route_id);  
 
 
--  
-- TOC entry 2742 (class 1259 OID 40418)  
-- Dependencies: 2419 2419 2419  
-- Name: starttime; Type: INDEX; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE UNIQUE INDEX starttime ON stop_times USING btree (trip_id, stop_id, stop_sequence);  
 
 
--  
-- TOC entry 2745 (class 1259 OID 40406)  
-- Dependencies: 2419 2419  
-- Name: stoptimes; Type: INDEX; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE INDEX stoptimes ON stop_times USING btree (arrival_time, stop_id);  
 
 
--  
-- TOC entry 2746 (class 1259 OID 40419)  
-- Dependencies: 2419 2419  
-- Name: triptimes; Type: INDEX; Schema: public; Owner: postgres; Tablespace:  
--  
 
CREATE INDEX triptimes ON stop_times USING btree (trip_id, arrival_time);  
 
 
--  
-- TOC entry 2765 (class 2606 OID 19412)  
-- Dependencies: 2734 2414 2416  
-- Name: servicealerts_alertid; Type: FK CONSTRAINT; Schema: public; Owner: postgres  
--  
 
ALTER TABLE ONLY servicealerts_informed  
ADD CONSTRAINT servicealerts_alertid FOREIGN KEY (servicealert_id) REFERENCES servicealerts_alerts(id);  
 
 
--  
-- TOC entry 2770 (class 0 OID 0)  
-- Dependencies: 6  
-- Name: public; Type: ACL; Schema: -; Owner: postgres  
--  
 
REVOKE ALL ON SCHEMA public FROM PUBLIC;  
REVOKE ALL ON SCHEMA public FROM postgres;  
GRANT ALL ON SCHEMA public TO postgres;  
GRANT ALL ON SCHEMA public TO PUBLIC;  
 
 
-- Completed on 2011-10-11 23:16:12  
 
--  
-- PostgreSQL database dump complete  
--  
 
 
/* /*
* jQuery UI CSS Framework 1.8.12 * jQuery UI CSS Framework 1.8.12
* *
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses. * Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license * http://jquery.org/license
* *
* http://docs.jquery.com/UI/Theming/API * http://docs.jquery.com/UI/Theming/API
*/ */
   
/* Layout helpers /* Layout helpers
----------------------------------*/ ----------------------------------*/
.ui-helper-hidden { display: none; } .ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
.ui-helper-clearfix { display: inline-block; } .ui-helper-clearfix { display: inline-block; }
/* required comment for clearfix to work in Opera \*/ /* required comment for clearfix to work in Opera \*/
* html .ui-helper-clearfix { height:1%; } * html .ui-helper-clearfix { height:1%; }
.ui-helper-clearfix { display:block; } .ui-helper-clearfix { display:block; }
/* end clearfix */ /* end clearfix */
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
   
   
/* Interaction Cues /* Interaction Cues
----------------------------------*/ ----------------------------------*/
.ui-state-disabled { cursor: default !important; } .ui-state-disabled { cursor: default !important; }
   
   
/* Icons /* Icons
----------------------------------*/ ----------------------------------*/
   
/* states and images */ /* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } .jqui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
   
   
/* Misc visuals /* Misc visuals
----------------------------------*/ ----------------------------------*/
   
/* Overlays */ /* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
   
   
/* /*
* jQuery UI CSS Framework 1.8.12 * jQuery UI CSS Framework 1.8.12
* *
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses. * Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license * http://jquery.org/license
* *
* http://docs.jquery.com/UI/Theming/API * http://docs.jquery.com/UI/Theming/API
* *
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
*/ */
   
   
/* Component containers /* Component containers
----------------------------------*/ ----------------------------------*/
.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; } .ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
.ui-widget .ui-widget { font-size: 1em; } .ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; } .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; } .ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
.ui-widget-content a { color: #333333; } .ui-widget-content a { color: #333333; }
.ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; } .ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
.ui-widget-header a { color: #ffffff; } .ui-widget-header a { color: #ffffff; }
   
/* Interaction states /* Interaction states
----------------------------------*/ ----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; } .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; } .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; } .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; }
.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; } .ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; } .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; } .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; }
.ui-widget :active { outline: none; } .ui-widget :active { outline: none; }
   
/* Interaction Cues /* Interaction Cues
----------------------------------*/ ----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; } .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; } .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; } .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; } .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
   
/* Icons /* Icons
----------------------------------*/ ----------------------------------*/
   
/* states and images */ /* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); } .jqui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); } .ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
.ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); } .ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); } .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); } .ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); } .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); } .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
   
/* positioning */ /* positioning */
.ui-icon-carat-1-n { background-position: 0 0; } .ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; } .ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; } .ui-icon-carat-1-e { background-position: -32px 0; }
.ui-icon-carat-1-se { background-position: -48px 0; } .ui-icon-carat-1-se { background-position: -48px 0; }
.ui-icon-carat-1-s { background-position: -64px 0; } .ui-icon-carat-1-s { background-position: -64px 0; }
.ui-icon-carat-1-sw { background-position: -80px 0; } .ui-icon-carat-1-sw { background-position: -80px 0; }
.ui-icon-carat-1-w { background-position: -96px 0; } .ui-icon-carat-1-w { background-position: -96px 0; }
.ui-icon-carat-1-nw { background-position: -112px 0; } .ui-icon-carat-1-nw { background-position: -112px 0; }
.ui-icon-carat-2-n-s { background-position: -128px 0; } .ui-icon-carat-2-n-s { background-position: -128px 0; }
.ui-icon-carat-2-e-w { background-position: -144px 0; } .ui-icon-carat-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; } .ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; } .ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; } .ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; } .ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -64px -16px; } .ui-icon-triangle-1-s { background-position: -64px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; } .ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; } .ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; } .ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; } .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; } .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; } .ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; } .ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; } .ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; } .ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -64px -32px; } .ui-icon-arrow-1-s { background-position: -64px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; } .ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; } .ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; } .ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; } .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; } .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; } .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; } .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; } .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; } .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 0 -48px; } .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; } .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; } .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; } .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; } .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; } .ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; } .ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; } .ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; } .ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; } .ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; } .ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; } .ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; } .ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; } .ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; } .ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; } .ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; } .ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; } .ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; } .ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; } .ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; } .ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; } .ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; } .ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; } .ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; } .ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; } .ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; } .ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; } .ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; } .ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; } .ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; } .ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; } .ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; } .ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; } .ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; } .ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; } .ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; } .ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; } .ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; } .ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; } .ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; } .ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; } .ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; } .ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; } .ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; } .ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; } .ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; } .ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; } .ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; } .ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; } .ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; } .ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; } .ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; } .ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; } .ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; } .ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; } .ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; } .ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; } .ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; } .ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; } .ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; } .ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; } .ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; } .ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; } .ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; } .ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; } .ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; } .ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-off { background-position: -96px -144px; } .ui-icon-radio-off { background-position: -96px -144px; }
.ui-icon-radio-on { background-position: -112px -144px; } .ui-icon-radio-on { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; } .ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; } .ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; } .ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; } .ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; } .ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; } .ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; } .ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-start { background-position: -80px -160px; } .ui-icon-seek-start { background-position: -80px -160px; }
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
.ui-icon-seek-first { background-position: -80px -160px; } .ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; } .ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; } .ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; } .ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; } .ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; } .ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; } .ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; } .ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; } .ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; } .ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; } .ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; } .ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; } .ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; } .ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; } .ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; } .ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; } .ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; } .ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; } .ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; } .ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; } .ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; } .ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; } .ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; } .ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; } .ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; } .ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; } .ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; } .ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; } .ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; } .ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; } .ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; } .ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; } .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; } .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
   
   
/* Misc visuals /* Misc visuals
----------------------------------*/ ----------------------------------*/
   
/* Corner radius */ /* Corner radius */
.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; } .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; }
.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } .ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } .ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } .ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } .ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } .ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
   
/* Overlays */ /* Overlays */
.ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); } .ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/* .ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/*
* jQuery UI Autocomplete 1.8.12 * jQuery UI Autocomplete 1.8.12
* *
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses. * Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license * http://jquery.org/license
* *
* http://docs.jquery.com/UI/Autocomplete#theming * http://docs.jquery.com/UI/Autocomplete#theming
*/ */
.ui-autocomplete { position: absolute; cursor: default; } .ui-autocomplete { position: absolute; cursor: default; }
   
/* workarounds */ /* workarounds */
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
   
/* /*
* jQuery UI Menu 1.8.12 * jQuery UI Menu 1.8.12
* *
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses. * Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license * http://jquery.org/license
* *
* http://docs.jquery.com/UI/Menu#theming * http://docs.jquery.com/UI/Menu#theming
*/ */
.ui-menu { .ui-menu {
list-style:none; list-style:none;
padding: 2px; padding: 2px;
margin: 0; margin: 0;
display:block; display:block;
float: left; float: left;
} }
.ui-menu .ui-menu { .ui-menu .ui-menu {
margin-top: -3px; margin-top: -3px;
} }
.ui-menu .ui-menu-item { .ui-menu .ui-menu-item {
margin:0; margin:0;
padding: 0; padding: 0;
zoom: 1; zoom: 1;
float: left; float: left;
clear: left; clear: left;
width: 100%; width: 100%;
} }
.ui-menu .ui-menu-item a { .ui-menu .ui-menu-item a {
text-decoration:none; text-decoration:none;
display:block; display:block;
padding:.2em .4em; padding:.2em .4em;
line-height:1.5; line-height:1.5;
zoom:1; zoom:1;
} }
.ui-menu .ui-menu-item a.ui-state-hover, .ui-menu .ui-menu-item a.ui-state-hover,
.ui-menu .ui-menu-item a.ui-state-active { .ui-menu .ui-menu-item a.ui-state-active {
font-weight: normal; font-weight: normal;
margin: -1px; margin: -1px;
} }
   
/*! jQuery Mobile v1.0rc2 jquerymobile.com | jquery.org/license */  
.ui-bar-a{border:1px solid #2a2a2a;background:#111;color:#fff;font-weight:bold;text-shadow:0 -1px 1px #000;background-image:-webkit-gradient(linear,left top,left bottom,from(#3c3c3c),to(#111));background-image:-webkit-linear-gradient(#3c3c3c,#111);background-image:-moz-linear-gradient(#3c3c3c,#111);background-image:-ms-linear-gradient(#3c3c3c,#111);background-image:-o-linear-gradient(#3c3c3c,#111);background-image:linear-gradient(#3c3c3c,#111)}.ui-bar-a,.ui-bar-a input,.ui-bar-a select,.ui-bar-a textarea,.ui-bar-a button{font-family:Helvetica,Arial,sans-serif}.ui-bar-a .ui-link-inherit{color:#fff}.ui-bar-a .ui-link{color:#7cc4e7;font-weight:bold}.ui-bar-a .ui-link:hover{color:#2489ce}.ui-bar-a .ui-link:active{color:#2489ce}.ui-bar-a .ui-link:visited{color:#2489ce}.ui-body-a,.ui-dialog.ui-overlay-a{border:1px solid #2a2a2a;background:#222;color:#fff;text-shadow:0 1px 0 #000;font-weight:normal;background-image:-webkit-gradient(linear,left top,left bottom,from(#666),to(#222));background-image:-webkit-linear-gradient(#666,#222);background-image:-moz-linear-gradient(#666,#222);background-image:-ms-linear-gradient(#666,#222);background-image:-o-linear-gradient(#666,#222);background-image:linear-gradient(#666,#222)}.ui-body-a,.ui-body-a input,.ui-body-a select,.ui-body-a textarea,.ui-body-a button{font-family:Helvetica,Arial,sans-serif}.ui-body-a .ui-link-inherit{color:#fff}.ui-body-a .ui-link{color:#2489ce;font-weight:bold}.ui-body-a .ui-link:hover{color:#2489ce}.ui-body-a .ui-link:active{color:#2489ce}.ui-body-a .ui-link:visited{color:#2489ce}.ui-btn-up-a{border:1px solid #222;background:#333;font-weight:bold;color:#fff;text-shadow:0 -1px 1px #000;background-image:-webkit-gradient(linear,left top,left bottom,from(#555),to(#333));background-image:-webkit-linear-gradient(#555,#333);background-image:-moz-linear-gradient(#555,#333);background-image:-ms-linear-gradient(#555,#333);background-image:-o-linear-gradient(#555,#333);background-image:linear-gradient(#555,#333)}.ui-btn-up-a a.ui-link-inherit{color:#fff}.ui-btn-hover-a{border:1px solid #000;background:#444;font-weight:bold;color:#fff;text-shadow:0 -1px 1px #000;background-image:-webkit-gradient(linear,left top,left bottom,from(#666),to(#444));background-image:-webkit-linear-gradient(#666,#444);background-image:-moz-linear-gradient(#666,#444);background-image:-ms-linear-gradient(#666,#444);background-image:-o-linear-gradient(#666,#444);background-image:linear-gradient(#666,#444)}.ui-btn-hover-a a.ui-link-inherit{color:#fff}.ui-btn-down-a{border:1px solid #000;background:#3d3d3d;font-weight:bold;color:#fff;text-shadow:0 -1px 1px #000;background-image:-webkit-gradient(linear,left top,left bottom,from(#333),to(#5a5a5a));background-image:-webkit-linear-gradient(#333,#5a5a5a);background-image:-moz-linear-gradient(#333,#5a5a5a);background-image:-ms-linear-gradient(#333,#5a5a5a);background-image:-o-linear-gradient(#333,#5a5a5a);background-image:linear-gradient(#333,#5a5a5a)}.ui-btn-down-a a.ui-link-inherit{color:#fff}.ui-btn-up-a,.ui-btn-hover-a,.ui-btn-down-a{font-family:Helvetica,Arial,sans-serif;text-decoration:none}.ui-bar-b{border:1px solid #456f9a;background:#5e87b0;color:#fff;font-weight:bold;text-shadow:0 -1px 1px #254f7a;background-image:-webkit-gradient(linear,left top,left bottom,from(#81a8ce),to(#5e87b0));background-image:-webkit-linear-gradient(#81a8ce,#5e87b0);background-image:-moz-linear-gradient(#81a8ce,#5e87b0);background-image:-ms-linear-gradient(#81a8ce,#5e87b0);background-image:-o-linear-gradient(#81a8ce,#5e87b0);background-image:linear-gradient(#81a8ce,#5e87b0)}.ui-bar-b,.ui-bar-b input,.ui-bar-b select,.ui-bar-b textarea,.ui-bar-b button{font-family:Helvetica,Arial,sans-serif}.ui-bar-b .ui-link-inherit{color:#fff}.ui-bar-b .ui-link{color:#ddf0f8;font-weight:bold}.ui-bar-b .ui-link:hover{color:#ddf0f8}.ui-bar-b .ui-link:active{color:#ddf0f8}.ui-bar-b .ui-link:visited{color:#ddf0f8}.ui-body-b,.ui-dialog.ui-overlay-b{border:1px solid #c6c6c6;background:#ccc;color:#333;text-shadow:0 1px 0 #fff;font-weight:normal;background-image:-webkit-gradient(linear,left top,left bottom,from(#e6e6e6),to(#ccc));background-image:-webkit-linear-gradient(#e6e6e6,#ccc);background-image:-moz-linear-gradient(#e6e6e6,#ccc);background-image:-ms-linear-gradient(#e6e6e6,#ccc);background-image:-o-linear-gradient(#e6e6e6,#ccc);background-image:linear-gradient(#e6e6e6,#ccc)}.ui-body-b,.ui-body-b input,.ui-body-b select,.ui-body-b textarea,.ui-body-b button{font-family:Helvetica,Arial,sans-serif}.ui-body-b .ui-link-inherit{color:#333}.ui-body-b .ui-link{color:#2489ce;font-weight:bold}.ui-body-b .ui-link:hover{color:#2489ce}.ui-body-b .ui-link:active{color:#2489ce}.ui-body-b .ui-link:visited{color:#2489ce}.ui-btn-up-b{border:1px solid #145072;background:#2567ab;font-weight:bold;color:#fff;text-shadow:0 -1px 1px #145072;background-image:-webkit-gradient(linear,left top,left bottom,from(#5f9cc5),to(#396b9e));background-image:-webkit-linear-gradient(#5f9cc5,#396b9e);background-image:-moz-linear-gradient(#5f9cc5,#396b9e);background-image:-ms-linear-gradient(#5f9cc5,#396b9e);background-image:-o-linear-gradient(#5f9cc5,#396b9e);background-image:linear-gradient(#5f9cc5,#396b9e)}.ui-btn-up-b a.ui-link-inherit{color:#fff}.ui-btn-hover-b{border:1px solid #00516e;background:#4b88b6;font-weight:bold;color:#fff;text-shadow:0 -1px 1px #014d68;background-image:-webkit-gradient(linear,left top,left bottom,from(#72b0d4),to(#4b88b6));background-image:-webkit-linear-gradient(#72b0d4,#4b88b6);background-image:-moz-linear-gradient(#72b0d4,#4b88b6);background-image:-ms-linear-gradient(#72b0d4,#4b88b6);background-image:-o-linear-gradient(#72b0d4,#4b88b6);background-image:linear-gradient(#72b0d4,#4b88b6)}.ui-btn-hover-b a.ui-link-inherit{color:#fff}.ui-btn-down-b{border:1px solid #225377;background:#4e89c5;font-weight:bold;color:#fff;text-shadow:0 -1px 1px #225377;background-image:-webkit-gradient(linear,left top,left bottom,from(#396b9e),to(#4e89c5));background-image:-webkit-linear-gradient(#396b9e,#4e89c5);background-image:-moz-linear-gradient(#396b9e,#4e89c5);background-image:-ms-linear-gradient(#396b9e,#4e89c5);background-image:-o-linear-gradient(#396b9e,#4e89c5);background-image:linear-gradient(#396b9e,#4e89c5)}.ui-btn-down-b a.ui-link-inherit{color:#fff}.ui-btn-up-b,.ui-btn-hover-b,.ui-btn-down-b{font-family:Helvetica,Arial,sans-serif;text-decoration:none}.ui-bar-c{border:1px solid #b3b3b3;background:#e9eaeb;color:#3e3e3e;font-weight:bold;text-shadow:0 1px 1px #fff;background-image:-webkit-gradient(linear,left top,left bottom,from(#f0f0f0),to(#e9eaeb));background-image:-webkit-linear-gradient(#f0f0f0,#e9eaeb);background-image:-moz-linear-gradient(#f0f0f0,#e9eaeb);background-image:-ms-linear-gradient(#f0f0f0,#e9eaeb);background-image:-o-linear-gradient(#f0f0f0,#e9eaeb);background-image:linear-gradient(#f0f0f0,#e9eaeb)}.ui-bar-c .ui-link-inherit{color:#3e3e3e}.ui-bar-c .ui-link{color:#7cc4e7;font-weight:bold}.ui-bar-c .ui-link:hover{color:#2489ce}.ui-bar-c .ui-link:active{color:#2489ce}.ui-bar-c .ui-link:visited{color:#2489ce}.ui-bar-c,.ui-bar-c input,.ui-bar-c select,.ui-bar-c textarea,.ui-bar-c button{font-family:Helvetica,Arial,sans-serif}.ui-body-c,.ui-dialog.ui-overlay-c{border:1px solid #b3b3b3;color:#333;text-shadow:0 1px 0 #fff;background:#f0f0f0;background-image:-webkit-gradient(linear,left top,left bottom,from(#eee),to(#ddd));background-image:-webkit-linear-gradient(#eee,#ddd);background-image:-moz-linear-gradient(#eee,#ddd);background-image:-ms-linear-gradient(#eee,#ddd);background-image:-o-linear-gradient(#eee,#ddd);background-image:linear-gradient(#eee,#ddd)}.ui-body-c,.ui-body-c input,.ui-body-c select,.ui-body-c textarea,.ui-body-c button{font-family:Helvetica,Arial,sans-serif}.ui-body-c .ui-link-inherit{color:#333}.ui-body-c .ui-link{color:#2489ce;font-weight:bold}.ui-body-c .ui-link:hover{color:#2489ce}.ui-body-c .ui-link:active{color:#2489ce}.ui-body-c .ui-link:visited{color:#2489ce}.ui-btn-up-c{border:1px solid #ccc;background:#eee;font-weight:bold;color:#444;text-shadow:0 1px 1px #f6f6f6;background-image:-webkit-gradient(linear,left top,left bottom,from(#fdfdfd),to(#eee));background-image:-webkit-linear-gradient(#fdfdfd,#eee);background-image:-moz-linear-gradient(#fdfdfd,#eee);background-image:-ms-linear-gradient(#fdfdfd,#eee);background-image:-o-linear-gradient(#fdfdfd,#eee);background-image:linear-gradient(#fdfdfd,#eee)}.ui-btn-up-c a.ui-link-inherit{color:#2f3e46}.ui-btn-hover-c{border:1px solid #bbb;background:#dadada;font-weight:bold;color:#101010;text-shadow:0 1px 1px #fff;background-image:-webkit-gradient(linear,left top,left bottom,from(#ededed),to(#dadada));background-image:-webkit-linear-gradient(#ededed,#dadada);background-image:-moz-linear-gradient(#ededed,#dadada);background-image:-ms-linear-gradient(#ededed,#dadada);background-image:-o-linear-gradient(#ededed,#dadada);background-image:linear-gradient(#ededed,#dadada)}.ui-btn-hover-c a.ui-link-inherit{color:#2f3e46}.ui-btn-down-c{border:1px solid #808080;background:#fdfdfd;font-weight:bold;color:#111;text-shadow:0 1px 1px #fff;background-image:-webkit-gradient(linear,left top,left bottom,from(#eee),to(#fdfdfd));background-image:-webkit-linear-gradient(#eee,#fdfdfd);background-image:-moz-linear-gradient(#eee,#fdfdfd);background-image:-ms-linear-gradient(#eee,#fdfdfd);background-image:-o-linear-gradient(#eee,#fdfdfd);background-image:linear-gradient(#eee,#fdfdfd)}.ui-btn-down-c a.ui-link-inherit{color:#2f3e46}.ui-btn-up-c,.ui-btn-hover-c,.ui-btn-down-c{font-family:Helvetica,Arial,sans-serif;text-decoration:none}.ui-bar-d{border:1px solid #ccc;background:#bbb;color:#333;text-shadow:0 1px 0 #eee;background-image:-webkit-gradient(linear,left top,left bottom,from(#ddd),to(#bbb));background-image:-webkit-linear-gradient(#ddd,#bbb);background-image:-moz-linear-gradient(#ddd,#bbb);background-image:-ms-linear-gradient(#ddd,#bbb);background-image:-o-linear-gradient(#ddd,#bbb);background-image:linear-gradient(#ddd,#bbb)}.ui-bar-d,.ui-bar-d input,.ui-bar-d select,.ui-bar-d textarea,.ui-bar-d button{font-family:Helvetica,Arial,sans-serif}.ui-bar-d .ui-link-inherit{color:#333}.ui-bar-d .ui-link{color:#2489ce;font-weight:bold}.ui-bar-d .ui-link:hover{color:#2489ce}.ui-bar-d .ui-link:active{color:#2489ce}.ui-bar-d .ui-link:visited{color:#2489ce}.ui-body-d,.ui-dialog.ui-overlay-d{border:1px solid #ccc;color:#333;text-shadow:0 1px 0 #fff;background:#fff;background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#fff));background-image:-webkit-linear-gradient(#fff,#fff);background-image:-moz-linear-gradient(#fff,#fff);background-image:-ms-linear-gradient(#fff,#fff);background-image:-o-linear-gradient(#fff,#fff);background-image:linear-gradient(#fff,#fff)}.ui-body-d,.ui-body-d input,.ui-body-d select,.ui-body-d textarea,.ui-body-d button{font-family:Helvetica,Arial,sans-serif}.ui-body-d .ui-link-inherit{color:#333}.ui-body-d .ui-link{color:#2489ce;font-weight:bold}.ui-body-d .ui-link:hover{color:#2489ce}.ui-body-d .ui-link:active{color:#2489ce}.ui-body-d .ui-link:visited{color:#2489ce}.ui-btn-up-d{border:1px solid #ccc;background:#fff;font-weight:bold;color:#444;text-shadow:0 1px 1px #fff;background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#fff));background-image:-webkit-linear-gradient(#fff,#fff);background-image:-moz-linear-gradient(#fff,#fff);background-image:-ms-linear-gradient(#fff,#fff);background-image:-o-linear-gradient(#fff,#fff);background-image:linear-gradient(#fff,#fff)}.ui-btn-up-d a.ui-link-inherit{color:#333}.ui-btn-hover-d{border:1px solid #aaa;background:#eee;font-weight:bold;color:#222;cursor:pointer;text-shadow:0 1px 1px #fff;background-image:-webkit-gradient(linear,left top,left bottom,from(#fdfdfd),to(#eee));background-image:-webkit-linear-gradient(#fdfdfd,#eee);background-image:-moz-linear-gradient(#fdfdfd,#eee);background-image:-ms-linear-gradient(#fdfdfd,#eee);background-image:-o-linear-gradient(#fdfdfd,#eee);background-image:linear-gradient(#fdfdfd,#eee)}.ui-btn-hover-d a.ui-link-inherit{color:#222}.ui-btn-down-d{border:1px solid #aaa;background:#fff;font-weight:bold;color:#111;text-shadow:0 1px 1px #fff;background-image:-webkit-gradient(linear,left top,left bottom,from(#eee),to(#fff));background-image:-webkit-linear-gradient(#eee,#fff);background-image:-moz-linear-gradient(#eee,#fff);background-image:-ms-linear-gradient(#eee,#fff);background-image:-o-linear-gradient(#eee,#fff);background-image:linear-gradient(#eee,#fff)}.ui-btn-down-d a.ui-link-inherit{color:#111}.ui-btn-up-d,.ui-btn-hover-d,.ui-btn-down-d{font-family:Helvetica,Arial,sans-serif;text-decoration:none}.ui-bar-e{border:1px solid #f7c942;background:#fadb4e;color:#333;text-shadow:0 1px 0 #fff;background-image:-webkit-gradient(linear,left top,left bottom,from(#fceda7),to(#fadb4e));background-image:-webkit-linear-gradient(#fceda7,#fadb4e);background-image:-moz-linear-gradient(#fceda7,#fadb4e);background-image:-ms-linear-gradient(#fceda7,#fadb4e);background-image:-o-linear-gradient(#fceda7,#fadb4e);background-image:linear-gradient(#fceda7,#fadb4e)}.ui-bar-e,.ui-bar-e input,.ui-bar-e select,.ui-bar-e textarea,.ui-bar-e button{font-family:Helvetica,Arial,sans-serif}.ui-bar-e .ui-link-inherit{color:#333}.ui-bar-e .ui-link{color:#2489ce;font-weight:bold}.ui-bar-e .ui-link:hover{color:#2489ce}.ui-bar-e .ui-link:active{color:#2489ce}.ui-bar-e .ui-link:visited{color:#2489ce}.ui-body-e,.ui-dialog.ui-overlay-e{border:1px solid #f7c942;color:#333;text-shadow:0 1px 0 #fff;background:#faeb9e;background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#faeb9e));background-image:-webkit-linear-gradient(#fff,#faeb9e);background-image:-moz-linear-gradient(#fff,#faeb9e);background-image:-ms-linear-gradient(#fff,#faeb9e);background-image:-o-linear-gradient(#fff,#faeb9e);background-image:linear-gradient(#fff,#faeb9e)}.ui-body-e,.ui-body-e input,.ui-body-e select,.ui-body-e textarea,.ui-body-e button{font-family:Helvetica,Arial,sans-serif}.ui-body-e .ui-link-inherit{color:#333}.ui-body-e .ui-link{color:#2489ce;font-weight:bold}.ui-body-e .ui-link:hover{color:#2489ce}.ui-body-e .ui-link:active{color:#2489ce}.ui-body-e .ui-link:visited{color:#2489ce}.ui-btn-up-e{border:1px solid #f7c942;background:#fadb4e;font-weight:bold;color:#333;text-shadow:0 1px 0 #fff;background-image:-webkit-gradient(linear,left top,left bottom,from(#fceda7),to(#fadb4e));background-image:-webkit-linear-gradient(#fceda7,#fadb4e);background-image:-moz-linear-gradient(#fceda7,#fadb4e);background-image:-ms-linear-gradient(#fceda7,#fadb4e);background-image:-o-linear-gradient(#fceda7,#fadb4e);background-image:linear-gradient(#fceda7,#fadb4e)}.ui-btn-up-e a.ui-link-inherit{color:#333}.ui-btn-hover-e{border:1px solid #e79952;background:#fbe26f;font-weight:bold;color:#111;text-shadow:0 1px 1px #fff;background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf0b5),to(#fbe26f));background-image:-webkit-linear-gradient(#fcf0b5,#fbe26f);background-image:-moz-linear-gradient(#fcf0b5,#fbe26f);background-image:-ms-linear-gradient(#fcf0b5,#fbe26f);background-image:-o-linear-gradient(#fcf0b5,#fbe26f);background-image:linear-gradient(#fcf0b5,#fbe26f)}.ui-btn-hover-e a.ui-link-inherit{color:#333}.ui-btn-down-e{border:1px solid #f7c942;background:#fceda7;font-weight:bold;color:#111;text-shadow:0 1px 1px #fff;background-image:-webkit-gradient(linear,left top,left bottom,from(#fadb4e),to(#fceda7));background-image:-webkit-linear-gradient(#fadb4e,#fceda7);background-image:-moz-linear-gradient(#fadb4e,#fceda7);background-image:-ms-linear-gradient(#fadb4e,#fceda7);background-image:-o-linear-gradient(#fadb4e,#fceda7);background-image:linear-gradient(#fadb4e,#fceda7)}.ui-btn-down-e a.ui-link-inherit{color:#333}.ui-btn-up-e,.ui-btn-hover-e,.ui-btn-down-e{font-family:Helvetica,Arial,sans-serif;text-decoration:none}a.ui-link-inherit{text-decoration:none!important}.ui-btn-active{border:1px solid #155678;background:#4596ce;font-weight:bold;color:#fff;cursor:pointer;text-shadow:0 -1px 1px #145072;text-decoration:none;background-image:-webkit-gradient(linear,left top,left bottom,from(#85bae4),to(#5393c5));background-image:-webkit-linear-gradient(#85bae4,#5393c5);background-image:-moz-linear-gradient(#85bae4,#5393c5);background-image:-ms-linear-gradient(#85bae4,#5393c5);background-image:-o-linear-gradient(#85bae4,#5393c5);background-image:linear-gradient(#85bae4,#5393c5);font-family:Helvetica,Arial,sans-serif}.ui-btn-active a.ui-link-inherit{color:#fff}.ui-btn-inner{border-top:1px solid #fff;border-color:rgba(255,255,255,.3)}.ui-corner-tl{-moz-border-radius-topleft:.6em;-webkit-border-top-left-radius:.6em;border-top-left-radius:.6em}.ui-corner-tr{-moz-border-radius-topright:.6em;-webkit-border-top-right-radius:.6em;border-top-right-radius:.6em}.ui-corner-bl{-moz-border-radius-bottomleft:.6em;-webkit-border-bottom-left-radius:.6em;border-bottom-left-radius:.6em}.ui-corner-br{-moz-border-radius-bottomright:.6em;-webkit-border-bottom-right-radius:.6em;border-bottom-right-radius:.6em}.ui-corner-top{-moz-border-radius-topleft:.6em;-webkit-border-top-left-radius:.6em;border-top-left-radius:.6em;-moz-border-radius-topright:.6em;-webkit-border-top-right-radius:.6em;border-top-right-radius:.6em}.ui-corner-bottom{-moz-border-radius-bottomleft:.6em;-webkit-border-bottom-left-radius:.6em;border-bottom-left-radius:.6em;-moz-border-radius-bottomright:.6em;-webkit-border-bottom-right-radius:.6em;border-bottom-right-radius:.6em}.ui-corner-right{-moz-border-radius-topright:.6em;-webkit-border-top-right-radius:.6em;border-top-right-radius:.6em;-moz-border-radius-bottomright:.6em;-webkit-border-bottom-right-radius:.6em;border-bottom-right-radius:.6em}.ui-corner-left{-moz-border-radius-topleft:.6em;-webkit-border-top-left-radius:.6em;border-top-left-radius:.6em;-moz-border-radius-bottomleft:.6em;-webkit-border-bottom-left-radius:.6em;border-bottom-left-radius:.6em}.ui-corner-all{-moz-border-radius:.6em;-webkit-border-radius:.6em;border-radius:.6em}.ui-corner-none{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.ui-br{border-bottom:#828282;border-bottom:rgba(130,130,130,.3);border-bottom-width:1px;border-bottom-style:solid}.ui-disabled{opacity:.3}.ui-disabled,.ui-disabled a{pointer-events:none;cursor:default}.ui-icon,.ui-icon-searchfield:after{background:#666;background:rgba(0,0,0,.4);background-image:url(images/icons-18-white.png);background-repeat:no-repeat;-moz-border-radius:9px;-webkit-border-radius:9px;border-radius:9px}.ui-icon-alt{background:#fff;background:rgba(255,255,255,.3);background-image:url(images/icons-18-black.png);background-repeat:no-repeat}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min--moz-device-pixel-ratio:1.5),only screen and (min-resolution:240dpi){.ui-icon-plus,.ui-icon-minus,.ui-icon-delete,.ui-icon-arrow-r,.ui-icon-arrow-l,.ui-icon-arrow-u,.ui-icon-arrow-d,.ui-icon-check,.ui-icon-gear,.ui-icon-refresh,.ui-icon-forward,.ui-icon-back,.ui-icon-grid,.ui-icon-star,.ui-icon-alert,.ui-icon-info,.ui-icon-home,.ui-icon-search,.ui-icon-searchfield:after,.ui-icon-checkbox-off,.ui-icon-checkbox-on,.ui-icon-radio-off,.ui-icon-radio-on{background-image:url(images/icons-36-white.png);-moz-background-size:776px 18px;-o-background-size:776px 18px;-webkit-background-size:776px 18px;background-size:776px 18px}.ui-icon-alt{background-image:url(images/icons-36-black.png)}}.ui-icon-plus{background-position:-0 50%}.ui-icon-minus{background-position:-36px 50%}.ui-icon-delete{background-position:-72px 50%}.ui-icon-arrow-r{background-position:-108px 50%}.ui-icon-arrow-l{background-position:-144px 50%}.ui-icon-arrow-u{background-position:-180px 50%}.ui-icon-arrow-d{background-position:-216px 50%}.ui-icon-check{background-position:-252px 50%}.ui-icon-gear{background-position:-288px 50%}.ui-icon-refresh{background-position:-324px 50%}.ui-icon-forward{background-position:-360px 50%}.ui-icon-back{background-position:-396px 50%}.ui-icon-grid{background-position:-432px 50%}.ui-icon-star{background-position:-468px 50%}.ui-icon-alert{background-position:-504px 50%}.ui-icon-info{background-position:-540px 50%}.ui-icon-home{background-position:-576px 50%}.ui-icon-search,.ui-icon-searchfield:after{background-position:-612px 50%}.ui-icon-checkbox-off{background-position:-684px 50%}.ui-icon-checkbox-on{background-position:-648px 50%}.ui-icon-radio-off{background-position:-756px 50%}.ui-icon-radio-on{background-position:-720px 50%}.ui-checkbox .ui-icon{-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}.ui-icon-checkbox-off,.ui-icon-radio-off{background-color:transparent}.ui-checkbox-on .ui-icon,.ui-radio-on .ui-icon{background-color:#4596ce}.ui-icon-loading{background-image:url(images/ajax-loader.png);width:40px;height:40px;-moz-border-radius:20px;-webkit-border-radius:20px;border-radius:20px;background-size:35px 35px}.ui-btn-corner-tl{-moz-border-radius-topleft:1em;-webkit-border-top-left-radius:1em;border-top-left-radius:1em}.ui-btn-corner-tr{-moz-border-radius-topright:1em;-webkit-border-top-right-radius:1em;border-top-right-radius:1em}.ui-btn-corner-bl{-moz-border-radius-bottomleft:1em;-webkit-border-bottom-left-radius:1em;border-bottom-left-radius:1em}.ui-btn-corner-br{-moz-border-radius-bottomright:1em;-webkit-border-bottom-right-radius:1em;border-bottom-right-radius:1em}.ui-btn-corner-top{-moz-border-radius-topleft:1em;-webkit-border-top-left-radius:1em;border-top-left-radius:1em;-moz-border-radius-topright:1em;-webkit-border-top-right-radius:1em;border-top-right-radius:1em}.ui-btn-corner-bottom{-moz-border-radius-bottomleft:1em;-webkit-border-bottom-left-radius:1em;border-bottom-left-radius:1em;-moz-border-radius-bottomright:1em;-webkit-border-bottom-right-radius:1em;border-bottom-right-radius:1em}.ui-btn-corner-right{-moz-border-radius-topright:1em;-webkit-border-top-right-radius:1em;border-top-right-radius:1em;-moz-border-radius-bottomright:1em;-webkit-border-bottom-right-radius:1em;border-bottom-right-radius:1em}.ui-btn-corner-left{-moz-border-radius-topleft:1em;-webkit-border-top-left-radius:1em;border-top-left-radius:1em;-moz-border-radius-bottomleft:1em;-webkit-border-bottom-left-radius:1em;border-bottom-left-radius:1em}.ui-btn-corner-all{-moz-border-radius:1em;-webkit-border-radius:1em;border-radius:1em}.ui-corner-tl,.ui-corner-tr,.ui-corner-bl,.ui-corner-br,.ui-corner-top,.ui-corner-bottom,.ui-corner-right,.ui-corner-left,.ui-corner-all,.ui-btn-corner-tl,.ui-btn-corner-tr,.ui-btn-corner-bl,.ui-btn-corner-br,.ui-btn-corner-top,.ui-btn-corner-bottom,.ui-btn-corner-right,.ui-btn-corner-left,.ui-btn-corner-all{-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}.ui-overlay{background:#666;opacity:.5;filter:Alpha(Opacity=50);position:absolute;width:100%;height:100%}.ui-overlay-shadow{-moz-box-shadow:0 0 12px rgba(0,0,0,.6);-webkit-box-shadow:0 0 12px rgba(0,0,0,.6);box-shadow:0 0 12px rgba(0,0,0,.6)}.ui-shadow{-moz-box-shadow:0 1px 4px rgba(0,0,0,.3);-webkit-box-shadow:0 1px 4px rgba(0,0,0,.3);box-shadow:0 1px 4px rgba(0,0,0,.3)}.ui-bar-a .ui-shadow,.ui-bar-b .ui-shadow,.ui-bar-c .ui-shadow{-moz-box-shadow:0 1px 0 rgba(255,255,255,.3);-webkit-box-shadow:0 1px 0 rgba(255,255,255,.3);box-shadow:0 1px 0 rgba(255,255,255,.3)}.ui-shadow-inset{-moz-box-shadow:inset 0 1px 4px rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 4px rgba(0,0,0,.2);box-shadow:inset 0 1px 4px rgba(0,0,0,.2)}.ui-icon-shadow{-moz-box-shadow:0 1px 0 rgba(255,255,255,.4);-webkit-box-shadow:0 1px 0 rgba(255,255,255,.4);box-shadow:0 1px 0 rgba(255,255,255,.4)}.ui-focus{-moz-box-shadow:0 0 12px #387bbe;-webkit-box-shadow:0 0 12px #387bbe;box-shadow:0 0 12px #387bbe}.ui-mobile-nosupport-boxshadow *{-moz-box-shadow:none!important;-webkit-box-shadow:none!important;box-shadow:none!important}.ui-mobile-nosupport-boxshadow .ui-focus{outline-width:2px}.ui-mobile,.ui-mobile body{height:100%}.ui-mobile fieldset,.ui-page{padding:0;margin:0}.ui-mobile a img,.ui-mobile fieldset{border:0}.ui-mobile-viewport{margin:0;overflow-x:visible;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}body.ui-mobile-viewport,div.ui-mobile-viewport{overflow-x:hidden}.ui-mobile [data-role=page],.ui-mobile [data-role=dialog],.ui-page{top:0;left:0;width:100%;min-height:100%;position:absolute;display:none;border:0}.ui-mobile .ui-page-active{display:block;overflow:visible}.ui-page{outline:0}@media screen and (orientation:portrait){.ui-mobile,.ui-mobile .ui-page{min-height:420px}}@media screen and (orientation:landscape){.ui-mobile,.ui-mobile .ui-page{min-height:300px}}.ui-page.ui-mobile-touch-overflow,.ui-mobile-touch-overflow.ui-native-fixed .ui-content{overflow:auto;height:100%;-webkit-overflow-scrolling:touch;-moz-overflow-scrolling:touch;-o-overflow-scrolling:touch;-ms-overflow-scrolling:touch;overflow-scrolling:touch}.ui-page.ui-mobile-touch-overflow,.ui-page.ui-mobile-touch-overflow *{-webkit-transform:rotateY(0)}.ui-page.ui-mobile-pre-transition{display:block}.ui-loading .ui-mobile-viewport{overflow:hidden!important}.ui-loading .ui-loader{display:block}.ui-loading .ui-page{overflow:hidden}.ui-loader{display:none;position:absolute;opacity:.85;z-index:100;left:50%;width:200px;margin-left:-130px;margin-top:-35px;padding:10px 30px}.ui-loader h1{font-size:15px;text-align:center}.ui-loader .ui-icon{position:static;display:block;opacity:.9;margin:0 auto;width:35px;height:35px;background-color:transparent}.ui-mobile-rendering>*{visibility:hidden}.ui-bar,.ui-body{position:relative;padding:.4em 15px;overflow:hidden;display:block;clear:both}.ui-bar{font-size:16px;margin:0}.ui-bar h1,.ui-bar h2,.ui-bar h3,.ui-bar h4,.ui-bar h5,.ui-bar h6{margin:0;padding:0;font-size:16px;display:inline-block}.ui-header,.ui-footer{display:block}.ui-page .ui-header,.ui-page .ui-footer{position:relative}.ui-header .ui-btn-left{position:absolute;left:10px;top:.4em}.ui-header .ui-btn-right{position:absolute;right:10px;top:.4em}.ui-header .ui-title,.ui-footer .ui-title{min-height:1.1em;text-align:center;font-size:16px;display:block;margin:.6em 90px .8em;padding:0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;outline:0!important}.ui-footer .ui-title{margin:.6em 15px .8em}.ui-content{border-width:0;overflow:visible;overflow-x:hidden;padding:15px}.ui-page-fullscreen .ui-content{padding:0}.ui-mobile-touch-overflow.ui-page.ui-native-fixed,.ui-mobile-touch-overflow.ui-page.ui-native-fullscreen{overflow:visible}.ui-mobile-touch-overflow.ui-native-fixed .ui-header,.ui-mobile-touch-overflow.ui-native-fixed .ui-footer{position:fixed;left:0;right:0;top:0;z-index:200}.ui-mobile-touch-overflow.ui-page.ui-native-fixed .ui-footer{top:auto;bottom:0}.ui-mobile-touch-overflow.ui-native-fixed .ui-content{padding-top:2.5em;padding-bottom:3em;top:0;bottom:0;height:auto;position:absolute}.ui-mobile-touch-overflow.ui-native-fullscreen .ui-content{padding-top:0;padding-bottom:0}.ui-mobile-touch-overflow.ui-native-fullscreen .ui-header,.ui-mobile-touch-overflow.ui-native-fullscreen .ui-footer{opacity:.9}.ui-native-bars-hidden{display:none}.ui-icon{width:18px;height:18px}.ui-fullscreen img{max-width:100%}.ui-nojs{position:absolute;left:-9999px}.ui-hide-label label,.ui-hidden-accessible{position:absolute!important;left:-9999px;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}.spin{-webkit-transform:rotate(360deg);-webkit-animation-name:spin;-webkit-animation-duration:1s;-webkit-animation-iteration-count:infinite;-webkit-animation-timing-function:linear}@-webkit-keyframes spin{from{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(360deg)}}.in,.out{-webkit-animation-timing-function:ease-in-out;-webkit-animation-duration:350ms}.slide.out{-webkit-transform:translateX(-100%);-webkit-animation-name:slideouttoleft}.slide.in{-webkit-transform:translateX(0);-webkit-animation-name:slideinfromright}.slide.out.reverse{-webkit-transform:translateX(100%);-webkit-animation-name:slideouttoright}.slide.in.reverse{-webkit-transform:translateX(0);-webkit-animation-name:slideinfromleft}.slideup.out{-webkit-animation-name:dontmove;z-index:0}.slideup.in{-webkit-transform:translateY(0);-webkit-animation-name:slideinfrombottom;z-index:10}.slideup.in.reverse{z-index:0;-webkit-animation-name:dontmove}.slideup.out.reverse{-webkit-transform:translateY(100%);z-index:10;-webkit-animation-name:slideouttobottom}.slidedown.out{-webkit-animation-name:dontmove;z-index:0}.slidedown.in{-webkit-transform:translateY(0);-webkit-animation-name:slideinfromtop;z-index:10}.slidedown.in.reverse{z-index:0;-webkit-animation-name:dontmove}.slidedown.out.reverse{-webkit-transform:translateY(-100%);z-index:10;-webkit-animation-name:slideouttotop}@-webkit-keyframes slideinfromright{from{-webkit-transform:translateX(100%)}to{-webkit-transform:translateX(0)}}@-webkit-keyframes slideinfromleft{from{-webkit-transform:translateX(-100%)}to{-webkit-transform:translateX(0)}}@-webkit-keyframes slideouttoleft{from{-webkit-transform:translateX(0)}to{-webkit-transform:translateX(-100%)}}@-webkit-keyframes slideouttoright{from{-webkit-transform:translateX(0)}to{-webkit-transform:translateX(100%)}}@-webkit-keyframes slideinfromtop{from{-webkit-transform:translateY(-100%)}to{-webkit-transform:translateY(0)}}@-webkit-keyframes slideinfrombottom{from{-webkit-transform:translateY(100%)}to{-webkit-transform:translateY(0)}}@-webkit-keyframes slideouttobottom{from{-webkit-transform:translateY(0)}to{-webkit-transform:translateY(100%)}}@-webkit-keyframes slideouttotop{from{-webkit-transform:translateY(0)}to{-webkit-transform:translateY(-100%)}}@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@-webkit-keyframes fadeout{from{opacity:1}to{opacity:0}}.fade.out{z-index:0;-webkit-animation-name:fadeout}.fade.in{opacity:1;z-index:10;-webkit-animation-name:fadein}.viewport-flip{-webkit-perspective:1000;position:absolute}.ui-mobile-viewport-transitioning,.ui-mobile-viewport-transitioning .ui-page{width:100%;height:100%;overflow:hidden}.flip{-webkit-animation-duration:.65s;-webkit-backface-visibility:hidden;-webkit-transform:translateX(0)}.flip.out{-webkit-transform:rotateY(-180deg) scale(.8);-webkit-animation-name:flipouttoleft}.flip.in{-webkit-transform:rotateY(0) scale(1);-webkit-animation-name:flipinfromleft}.flip.out.reverse{-webkit-transform:rotateY(180deg) scale(.8);-webkit-animation-name:flipouttoright}.flip.in.reverse{-webkit-transform:rotateY(0) scale(1);-webkit-animation-name:flipinfromright}@-webkit-keyframes flipinfromright{from{-webkit-transform:rotateY(-180deg) scale(.8)}to{-webkit-transform:rotateY(0) scale(1)}}@-webkit-keyframes flipinfromleft{from{-webkit-transform:rotateY(180deg) scale(.8)}to{-webkit-transform:rotateY(0) scale(1)}}@-webkit-keyframes flipouttoleft{from{-webkit-transform:rotateY(0) scale(1)}to{-webkit-transform:rotateY(-180deg) scale(.8)}}@-webkit-keyframes flipouttoright{from{-webkit-transform:rotateY(0) scale(1)}to{-webkit-transform:rotateY(180deg) scale(.8)}}@-webkit-keyframes dontmove{from{opacity:1}to{opacity:1}}.pop{-webkit-transform-origin:50% 50%}.pop.in{-webkit-transform:scale(1);opacity:1;-webkit-animation-name:popin;z-index:10}.pop.in.reverse{z-index:0;-webkit-animation-name:dontmove}.pop.out.reverse{-webkit-transform:scale(.2);opacity:0;-webkit-animation-name:popout;z-index:10}@-webkit-keyframes popin{from{-webkit-transform:scale(.2);opacity:0}to{-webkit-transform:scale(1);opacity:1}}@-webkit-keyframes popout{from{-webkit-transform:scale(1);opacity:1}to{-webkit-transform:scale(.2);opacity:0}}.ui-grid-a,.ui-grid-b,.ui-grid-c,.ui-grid-d{overflow:hidden}.ui-block-a,.ui-block-b,.ui-block-c,.ui-block-d,.ui-block-e{margin:0;padding:0;border:0;float:left;min-height:1px}.ui-grid-solo .ui-block-a{width:100%;float:none}.ui-grid-a .ui-block-a,.ui-grid-a .ui-block-b{width:50%}.ui-grid-a .ui-block-a{clear:left}.ui-grid-b .ui-block-a,.ui-grid-b .ui-block-b,.ui-grid-b .ui-block-c{width:33.333%}.ui-grid-b .ui-block-a{clear:left}.ui-grid-c .ui-block-a,.ui-grid-c .ui-block-b,.ui-grid-c .ui-block-c,.ui-grid-c .ui-block-d{width:25%}.ui-grid-c .ui-block-a{clear:left}.ui-grid-d .ui-block-a,.ui-grid-d .ui-block-b,.ui-grid-d .ui-block-c,.ui-grid-d .ui-block-d,.ui-grid-d .ui-block-e{width:20%}.ui-grid-d .ui-block-a{clear:left}.ui-header,.ui-footer,.ui-page-fullscreen .ui-header,.ui-page-fullscreen .ui-footer{position:absolute;overflow:hidden;width:100%;border-left-width:0;border-right-width:0}.ui-header-fixed,.ui-footer-fixed{z-index:1000;-webkit-transform:translateZ(0)}.ui-footer-duplicate,.ui-page-fullscreen .ui-fixed-inline{display:none}.ui-page-fullscreen .ui-header,.ui-page-fullscreen .ui-footer{opacity:.9}.ui-navbar{overflow:hidden}.ui-navbar ul,.ui-navbar-expanded ul{list-style:none;padding:0;margin:0;position:relative;display:block;border:0}.ui-navbar-collapsed ul{float:left;width:75%;margin-right:-2px}.ui-navbar-collapsed .ui-navbar-toggle{float:left;width:25%}.ui-navbar li.ui-navbar-truncate{position:absolute;left:-9999px;top:-9999px}.ui-navbar li .ui-btn,.ui-navbar .ui-navbar-toggle .ui-btn{display:block;font-size:12px;text-align:center;margin:0;border-right-width:0}.ui-navbar li .ui-btn{margin-right:-1px}.ui-navbar li .ui-btn:last-child{margin-right:0}.ui-header .ui-navbar li .ui-btn,.ui-header .ui-navbar .ui-navbar-toggle .ui-btn,.ui-footer .ui-navbar li .ui-btn,.ui-footer .ui-navbar .ui-navbar-toggle .ui-btn{border-top-width:0;border-bottom-width:0}.ui-navbar .ui-btn-inner{padding-left:2px;padding-right:2px}.ui-navbar-noicons li .ui-btn .ui-btn-inner,.ui-navbar-noicons .ui-navbar-toggle .ui-btn-inner{padding-top:.8em;padding-bottom:.9em}.ui-navbar-expanded .ui-btn{margin:0;font-size:14px}.ui-navbar-expanded .ui-btn-inner{padding-left:5px;padding-right:5px}.ui-navbar-expanded .ui-btn-icon-top .ui-btn-inner{padding:45px 5px 15px;text-align:center}.ui-navbar-expanded .ui-btn-icon-top .ui-icon{top:15px}.ui-navbar-expanded .ui-btn-icon-bottom .ui-btn-inner{padding:15px 5px 45px;text-align:center}.ui-navbar-expanded .ui-btn-icon-bottom .ui-icon{bottom:15px}.ui-navbar-expanded li .ui-btn .ui-btn-inner{min-height:2.5em}.ui-navbar-expanded .ui-navbar-noicons .ui-btn .ui-btn-inner{padding-top:1.8em;padding-bottom:1.9em}.ui-btn{display:block;text-align:center;cursor:pointer;position:relative;margin:.5em 5px;padding:0}.ui-header .ui-btn,.ui-footer .ui-btn,.ui-bar .ui-btn{display:inline-block;font-size:13px;margin:0}.ui-btn-inline{display:inline-block}.ui-btn-inner{padding:.6em 25px;display:block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;position:relative;zoom:1}.ui-btn input,.ui-btn button{z-index:2}.ui-header .ui-btn-inner,.ui-footer .ui-btn-inner,.ui-bar .ui-btn-inner{padding:.4em 8px .5em}.ui-btn-icon-notext{width:24px;height:24px}.ui-btn-icon-notext .ui-btn-inner{padding:2px 1px 2px 3px}.ui-btn-text{position:relative;z-index:1}.ui-btn-icon-notext .ui-btn-text{position:absolute;left:-9999px}.ui-btn-icon-left .ui-btn-inner{padding-left:33px}.ui-header .ui-btn-icon-left .ui-btn-inner,.ui-footer .ui-btn-icon-left .ui-btn-inner,.ui-bar .ui-btn-icon-left .ui-btn-inner{padding-left:27px}.ui-btn-icon-right .ui-btn-inner{padding-right:33px}.ui-header .ui-btn-icon-right .ui-btn-inner,.ui-footer .ui-btn-icon-right .ui-btn-inner,.ui-bar .ui-btn-icon-right .ui-btn-inner{padding-right:27px}.ui-btn-icon-top .ui-btn-inner{padding-top:33px}.ui-header .ui-btn-icon-top .ui-btn-inner,.ui-footer .ui-btn-icon-top .ui-btn-inner,.ui-bar .ui-btn-icon-top .ui-btn-inner{padding-top:27px}.ui-btn-icon-bottom .ui-btn-inner{padding-bottom:33px}.ui-header .ui-btn-icon-bottom .ui-btn-inner,.ui-footer .ui-btn-icon-bottom .ui-btn-inner,.ui-bar .ui-btn-icon-bottom .ui-btn-inner{padding-bottom:27px}.ui-btn-icon-notext .ui-icon{display:block;z-index:0}.ui-btn-icon-left .ui-icon,.ui-btn-icon-right .ui-icon{position:absolute;top:50%;margin-top:-9px}.ui-btn-icon-top .ui-icon,.ui-btn-icon-bottom .ui-icon{position:absolute;left:50%;margin-left:-9px}.ui-btn-icon-left .ui-icon{left:10px}.ui-btn-icon-right .ui-icon{right:10px}.ui-btn-icon-top .ui-icon{top:10px}.ui-btn-icon-bottom .ui-icon{bottom:10px}.ui-header .ui-btn-icon-left .ui-icon,.ui-footer .ui-btn-icon-left .ui-icon,.ui-bar .ui-btn-icon-left .ui-icon{left:4px}.ui-header .ui-btn-icon-right .ui-icon,.ui-footer .ui-btn-icon-right .ui-icon,.ui-bar .ui-btn-icon-right .ui-icon{right:4px}.ui-header .ui-btn-icon-top .ui-icon,.ui-footer .ui-btn-icon-top .ui-icon,.ui-bar .ui-btn-icon-top .ui-icon{top:4px}.ui-header .ui-btn-icon-bottom .ui-icon,.ui-footer .ui-btn-icon-bottom .ui-icon,.ui-bar .ui-btn-icon-bottom .ui-icon{bottom:4px}.ui-btn-hidden{position:absolute;top:0;left:0;width:100%;height:100%;-webkit-appearance:button;opacity:.1;cursor:pointer;background:#fff;background:rgba(255,255,255,0);filter:Alpha(Opacity=.0001);font-size:1px;border:0;line-height:999px}.ui-collapsible{margin:.5em 0}.ui-collapsible-heading{font-size:16px;display:block;margin:0 -8px;padding:0;border-width:0 0 1px 0;position:relative}.ui-collapsible-heading a{text-align:left;margin:0}.ui-collapsible-heading a .ui-btn-inner{padding-left:40px}.ui-collapsible-heading a span.ui-btn{position:absolute;left:6px;top:50%;margin:-12px 0 0 0;width:20px;height:20px;padding:1px 0 1px 2px;text-indent:-9999px}.ui-collapsible-heading a span.ui-btn .ui-btn-inner{padding:10px 0}.ui-collapsible-heading a span.ui-btn .ui-icon{left:0;margin-top:-10px}.ui-collapsible-heading-status{position:absolute;top:-9999px;left:0}.ui-collapsible-content{display:block;margin:0 -8px;padding:10px 16px;border-top:0;background-image:none;font-weight:normal}.ui-collapsible-content-collapsed{display:none}.ui-collapsible-set{margin:.5em 0}.ui-collapsible-set .ui-collapsible{margin:-1px 0 0}.ui-controlgroup,fieldset.ui-controlgroup{padding:0;margin:.5em 0 1em}.ui-bar .ui-controlgroup{margin:0 .3em}.ui-controlgroup-label{font-size:16px;line-height:1.4;font-weight:normal;margin:0 0 .3em}.ui-controlgroup-controls{display:block;width:100%}.ui-controlgroup li{list-style:none}.ui-controlgroup-vertical .ui-btn,.ui-controlgroup-vertical .ui-checkbox,.ui-controlgroup-vertical .ui-radio{margin:0;border-bottom-width:0}.ui-controlgroup-controls label.ui-select{position:absolute;left:-9999px}.ui-controlgroup-vertical .ui-controlgroup-last{border-bottom-width:1px}.ui-controlgroup-horizontal{padding:0}.ui-controlgroup-horizontal .ui-btn,.ui-controlgroup-horizontal .ui-select{display:inline-block;margin:0 -5px 0 0}.ui-controlgroup-horizontal .ui-checkbox,.ui-controlgroup-horizontal .ui-radio{float:left;margin:0 -1px 0 0}.ui-controlgroup-horizontal .ui-checkbox .ui-btn,.ui-controlgroup-horizontal .ui-radio .ui-btn,.ui-controlgroup-horizontal .ui-checkbox:last-child,.ui-controlgroup-horizontal .ui-radio:last-child{margin-right:0}.ui-controlgroup-horizontal .ui-controlgroup-last{margin-right:0}.ui-controlgroup .ui-checkbox label,.ui-controlgroup .ui-radio label{font-size:16px}@media all and (min-width:450px){.ui-field-contain .ui-controlgroup-label{vertical-align:top;display:inline-block;width:20%;margin:0 2% 0 0}.ui-field-contain .ui-controlgroup-controls{width:60%;display:inline-block}.ui-field-contain .ui-controlgroup .ui-select{width:100%}.ui-field-contain .ui-controlgroup-horizontal .ui-select{width:auto}}.ui-dialog{min-height:480px}.ui-dialog .ui-header,.ui-dialog .ui-content,.ui-dialog .ui-footer{max-width:500px;margin:10% auto 15px auto;width:85%;position:relative}.ui-dialog .ui-header,.ui-dialog .ui-footer{padding:0 15px;z-index:10}.ui-dialog .ui-content{padding:15px}.ui-dialog .ui-content,.ui-dialog .ui-footer{margin-top:-15px}.ui-checkbox,.ui-radio{position:relative;margin:.2em 0 .5em;z-index:1}.ui-checkbox .ui-btn,.ui-radio .ui-btn{margin:0;text-align:left;z-index:2}.ui-checkbox .ui-btn-inner,.ui-radio .ui-btn-inner{white-space:normal}.ui-checkbox .ui-btn-icon-left .ui-btn-inner,.ui-radio .ui-btn-icon-left .ui-btn-inner{padding-left:45px}.ui-checkbox .ui-btn-icon-right .ui-btn-inner,.ui-radio .ui-btn-icon-right .ui-btn-inner{padding-right:45px}.ui-checkbox .ui-icon,.ui-radio .ui-icon{top:1.1em}.ui-checkbox .ui-btn-icon-left .ui-icon,.ui-radio .ui-btn-icon-left .ui-icon{left:15px}.ui-checkbox .ui-btn-icon-right .ui-icon,.ui-radio .ui-btn-icon-right .ui-icon{right:15px}.ui-checkbox input,.ui-radio input{position:absolute;left:20px;top:50%;width:10px;height:10px;margin:-5px 0 0 0;outline:0!important;z-index:1}.ui-field-contain{padding:1.5em 0;margin:0;border-bottom-width:1px;overflow:visible}.ui-field-contain:first-child{border-top-width:0}@media all and (min-width:450px){.ui-field-contain{border-width:0;padding:0;margin:1em 0}}.ui-select{display:block;position:relative}.ui-select select{position:absolute;left:-9999px;top:-9999px}.ui-select .ui-btn{overflow:hidden}.ui-select .ui-btn{opacity:1}.ui-select .ui-btn select{cursor:pointer;-webkit-appearance:button;left:0;top:0;width:100%;min-height:1.5em;min-height:100%;height:3em;max-height:100%;opacity:0;-ms-filter:"alpha(opacity=0)";filter:alpha(opacity=0);z-index:2}@-moz-document url-prefix(){.ui-select .ui-btn select{opacity:.0001}}.ui-select .ui-btn select.ui-select-nativeonly{opacity:1;text-indent:0}.ui-select .ui-btn-icon-right .ui-btn-inner{padding-right:45px}.ui-select .ui-btn-icon-right .ui-icon{right:15px}label.ui-select{font-size:16px;line-height:1.4;font-weight:normal;margin:0 0 .3em;display:block}.ui-select .ui-btn-text,.ui-selectmenu .ui-btn-text{display:block;min-height:1em;overflow:hidden}.ui-select .ui-btn-text{text-overflow:ellipsis}.ui-selectmenu{position:absolute;padding:0;z-index:1100!important;width:80%;max-width:350px;padding:6px}.ui-selectmenu .ui-listview{margin:0}.ui-selectmenu .ui-btn.ui-li-divider{cursor:default}.ui-selectmenu-hidden{top:-9999px;left:-9999px}.ui-selectmenu-screen{position:absolute;top:0;left:0;width:100%;height:100%;z-index:99}.ui-screen-hidden,.ui-selectmenu-list .ui-li .ui-icon{display:none}.ui-selectmenu-list .ui-li .ui-icon{display:block}.ui-li.ui-selectmenu-placeholder{display:none}.ui-selectmenu .ui-header .ui-title{margin:.6em 46px .8em}@media all and (min-width:450px){.ui-field-contain label.ui-select{vertical-align:top;display:inline-block;width:20%;margin:0 2% 0 0}.ui-field-contain .ui-select{width:60%;display:inline-block}}.ui-selectmenu .ui-header h1:after{content:'.';visibility:hidden}label.ui-input-text{font-size:16px;line-height:1.4;display:block;font-weight:normal;margin:0 0 .3em}input.ui-input-text,textarea.ui-input-text{background-image:none;padding:.4em;line-height:1.4;font-size:16px;display:block;width:97%}input.ui-input-text{-webkit-appearance:none}textarea.ui-input-text{height:50px;-webkit-transition:height 200ms linear;-moz-transition:height 200ms linear;-o-transition:height 200ms linear;transition:height 200ms linear}.ui-input-search{padding:0 30px;background-image:none;position:relative}.ui-icon-searchfield:after{position:absolute;left:7px;top:50%;margin-top:-9px;content:"";width:18px;height:18px;opacity:.5}.ui-input-search input.ui-input-text{border:0;width:98%;padding:.4em 0;margin:0;display:block;background:transparent none;outline:0!important}.ui-input-search .ui-input-clear{position:absolute;right:0;top:50%;margin-top:-13px}.ui-input-search .ui-input-clear-hidden{display:none}@media all and (min-width:450px){.ui-field-contain label.ui-input-text{vertical-align:top;display:inline-block;width:20%;margin:0 2% 0 0}.ui-field-contain input.ui-input-text,.ui-field-contain textarea.ui-input-text,.ui-field-contain .ui-input-search{width:60%;display:inline-block}.ui-field-contain .ui-input-search{width:50%}.ui-hide-label input.ui-input-text,.ui-hide-label textarea.ui-input-text,.ui-hide-label .ui-input-search{padding:.4em;width:97%}.ui-input-search input.ui-input-text{width:98%}}.ui-listview{margin:0;counter-reset:listnumbering}.ui-content .ui-listview{margin:-15px}.ui-content .ui-listview-inset{margin:1em 0}.ui-listview,.ui-li{list-style:none;padding:0}.ui-li,.ui-li.ui-field-contain{display:block;margin:0;position:relative;overflow:visible;text-align:left;border-width:0;border-top-width:1px}.ui-li .ui-btn-text a.ui-link-inherit{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-li-divider,.ui-li-static{padding:.5em 15px;font-size:14px;font-weight:bold}.ui-li-divider{counter-reset:listnumbering}ol.ui-listview .ui-link-inherit:before,ol.ui-listview .ui-li-static:before,.ui-li-dec{font-size:.8em;display:inline-block;padding-right:.3em;font-weight:normal;counter-increment:listnumbering;content:counter(listnumbering) ". "}ol.ui-listview .ui-li-jsnumbering:before{content:""!important}.ui-listview-inset .ui-li{border-right-width:1px;border-left-width:1px}.ui-li:last-child,.ui-li.ui-field-contain:last-child{border-bottom-width:1px}.ui-li>.ui-btn-inner{display:block;position:relative;padding:0}.ui-li .ui-btn-inner a.ui-link-inherit,.ui-li-static.ui-li{padding:.7em 15px .7em 15px;display:block}.ui-li-has-thumb .ui-btn-inner a.ui-link-inherit,.ui-li-static.ui-li-has-thumb{min-height:60px;padding-left:100px}.ui-li-has-icon .ui-btn-inner a.ui-link-inherit,.ui-li-static.ui-li-has-icon{min-height:20px;padding-left:40px}.ui-li-has-count .ui-btn-inner a.ui-link-inherit,.ui-li-static.ui-li-has-count{padding-right:45px}.ui-li-has-arrow .ui-btn-inner a.ui-link-inherit,.ui-li-static.ui-li-has-arrow{padding-right:30px}.ui-li-has-arrow.ui-li-has-count .ui-btn-inner a.ui-link-inherit,.ui-li-static.ui-li-has-arrow.ui-li-has-count{padding-right:75px}.ui-li-has-count .ui-btn-text{padding-right:15px}.ui-li-heading{font-size:16px;font-weight:bold;display:block;margin:.6em 0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-li-desc{font-size:12px;font-weight:normal;display:block;margin:-.5em 0 .6em;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-li-thumb,.ui-listview .ui-li-icon{position:absolute;left:1px;top:0;max-height:80px;max-width:80px}.ui-listview .ui-li-icon{max-height:40px;max-width:40px;left:10px;top:.9em}.ui-li-thumb,.ui-listview .ui-li-icon,.ui-li-content{float:left;margin-right:10px}.ui-li-aside{float:right;width:50%;text-align:right;margin:.3em 0}@media all and (min-width:480px){.ui-li-aside{width:45%}}.ui-li-divider{cursor:default}.ui-li-has-alt .ui-btn-inner a.ui-link-inherit,.ui-li-static.ui-li-has-alt{padding-right:95px}.ui-li-has-count .ui-li-count{position:absolute;font-size:11px;font-weight:bold;padding:.2em .5em;top:50%;margin-top:-.9em;right:38px}.ui-li-divider .ui-li-count,.ui-li-static .ui-li-count{right:10px}.ui-li-has-alt .ui-li-count{right:55px}.ui-li-link-alt{position:absolute;width:40px;height:100%;border-width:0;border-left-width:1px;top:0;right:0;margin:0;padding:0;z-index:2}.ui-li-link-alt .ui-btn{overflow:hidden;position:absolute;right:8px;top:50%;margin:-11px 0 0 0;border-bottom-width:1px;z-index:-1}.ui-li-link-alt .ui-btn-inner{padding:0;height:100%;position:absolute;width:100%;top:0;left:0}.ui-li-link-alt .ui-btn .ui-icon{right:50%;margin-right:-9px}.ui-listview * .ui-btn-inner>.ui-btn>.ui-btn-inner{border-top:0}.ui-listview-filter{border-width:0;overflow:hidden;margin:-15px -15px 15px -15px}.ui-listview-filter .ui-input-search{margin:5px;width:auto;display:block}.ui-listview-filter-inset{margin:-15px -5px -15px -5px;background:transparent}.ui-li.ui-screen-hidden{display:none}@media only screen and (min-device-width:768px) and (max-device-width:1024px){.ui-li .ui-btn-text{overflow:visible}}label.ui-slider{font-size:16px;line-height:1.4;font-weight:normal;margin:0 0 .3em;display:block}input.ui-slider-input,.ui-field-contain input.ui-slider-input{display:inline-block;width:50px}select.ui-slider-switch{display:none}div.ui-slider{position:relative;display:inline-block;overflow:visible;height:15px;padding:0;margin:0 2% 0 20px;top:4px;width:66%}div.ui-slider-switch{width:99.8%}a.ui-slider-handle{position:absolute;z-index:10;top:50%;width:28px;height:28px;margin-top:-15px;margin-left:-15px}a.ui-slider-handle .ui-btn-inner{padding-left:0;padding-right:0}@media all and (min-width:480px){.ui-field-contain label.ui-slider{vertical-align:top;display:inline-block;width:20%;margin:0 2% 0 0}.ui-field-contain div.ui-slider{width:43%}}div.ui-slider-switch{height:32px;overflow:hidden;margin-left:0}div.ui-slider-inneroffset{margin-left:50%;position:absolute;top:1px;height:100%;width:50%}a.ui-slider-handle-snapping{-webkit-transition:left 70ms linear}div.ui-slider-labelbg{position:absolute;top:0;margin:0;border-width:0}div.ui-slider-switch div.ui-slider-labelbg-a{width:60%;height:100%;left:0}div.ui-slider-switch div.ui-slider-labelbg-b{width:60%;height:100%;right:0}.ui-slider-switch-a div.ui-slider-labelbg-a,.ui-slider-switch-b div.ui-slider-labelbg-b{z-index:-1}.ui-slider-switch-a div.ui-slider-labelbg-b,.ui-slider-switch-b div.ui-slider-labelbg-a{z-index:0}div.ui-slider-switch a.ui-slider-handle{z-index:20;width:101%;height:32px;margin-top:-18px;margin-left:-101%}span.ui-slider-label{width:100%;position:absolute;height:32px;font-size:16px;text-align:center;line-height:2;background:0;border-color:transparent}span.ui-slider-label-a{left:-100%;margin-right:-1px}span.ui-slider-label-b{right:-100%;margin-left:-1px}  
<?php <?php
   
header('Content-type: text/css'); header('Content-type: text/css');
ob_start("compress"); ob_start("compress");
   
function compress($buffer) { function compress($buffer) {
/* remove comments */ /* remove comments */
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
/* remove tabs, spaces, newlines, etc. */ /* remove tabs, spaces, newlines, etc. */
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer); $buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer);
return $buffer; return $buffer;
} }
   
echo ' echo '
.ui-li-thumb, .ui-li-icon { position: relative; } .ui-li-thumb, .ui-li-icon { position: relative; }
   
.ui-navbar { .ui-navbar {
width: 100%; width: 100%;
} }
.ui-btn-inner { .ui-btn-inner {
white-space: normal !important; white-space: normal !important;
} }
.ui-li-heading { .ui-li-heading {
white-space: normal !important; white-space: normal !important;
} }
.ui-listview-filter { .ui-listview-filter {
margin: 0 !important; margin: 0 !important;
} }
.ui-icon-navigation { .ui-icon-navigation {
background-image: url(images/113-navigation.png); background-image: url(images/113-navigation.png);
background-position: 1px 0; background-position: 1px 0;
} }
.ui-icon-beaker { .ui-icon-beaker {
background-image: url(images/91-beaker-2.png); background-image: url(images/91-beaker-2.png);
background-position: 1px 0; background-position: 1px 0;
} }
#footer { #footer {
text-size: 0.75em; text-size: 0.75em;
text-align: center; text-align: center;
} }
body { body {
background-color: #F0F0F0; background-color: #F0F0F0;
} }
#jqm-homeheader { #jqm-homeheader {
text-align: center; text-align: center;
} }
.viaPoints { .viaPoints {
display: none; display: none;
text-size: 0.2em; text-size: 0.2em;
} }
.min-width-480px .viaPoints { .min-width-480px .viaPoints {
display: inline; display: inline;
} }
#extrainfo { #extrainfo {
visibility: hidden; visibility: hidden;
display: none; display: none;
} }
#servicewarning { .servicewarning {
padding: 1em; padding: 1em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
text-size: 0.2em; text-size: 0.2em;
background-color: #FF9; background-color: #FF9;
-moz-border-radius: 15px; -moz-border-radius: 15px;
border-radius: 15px; border-radius: 15px;
} }
   
   
#footer { #footer {
clear:both; clear:both;
text-align:center; text-align:center;
} }
// source http://webaim.org/techniques/skipnav/ // source http://webaim.org/techniques/skipnav/
#skip a, #skip a:hover, #skip a:visited #skip a, #skip a:hover, #skip a:visited
{ {
position:absolute; position:absolute;
left:0px; left:0px;
top:-500px; top:-500px;
width:1px; width:1px;
height:1px; height:1px;
overflow:hidden; overflow:hidden;
} }
   
#skip a:active, #skip a:focus #skip a:active, #skip a:focus
{ {
position:static; position:static;
width:auto; width:auto;
height:auto; height:auto;
}'; }';
   
//if (false) //if (false)
echo ' echo '
// adaptive layout from jQuery Mobile docs site // adaptive layout from jQuery Mobile docs site
.type-interior .content-secondary { .type-interior .content-secondary {
border-right: 0; border-right: 0;
border-left: 0; border-left: 0;
margin: 10px -15px 0; margin: 10px -15px 0;
background: #fff; background: #fff;
border-top: 1px solid #ccc; border-top: 1px solid #ccc;
} }
.type-home .ui-content { .type-home .ui-content {
margin-top: 5px; margin-top: 5px;
} }
.type-interior .ui-content { .type-interior .ui-content {
padding-bottom: 0; padding-bottom: 0;
} }
.content-secondary .ui-collapsible-contain { .content-secondary .ui-collapsible-contain {
padding: 10px 15px; padding: 10px 15px;
   
} }
.content-secondary .ui-collapsible-heading { .content-secondary .ui-collapsible-heading {
margin: 0 0 30px; margin: 0 0 30px;
} }
.content-secondary .ui-collapsible-heading-collapsed, .content-secondary .ui-collapsible-heading-collapsed,
.content-secondary .ui-collapsible-content { .content-secondary .ui-collapsible-content {
padding:0; padding:0;
margin: 0; margin: 0;
} }
/* hires ahoy */ /* hires ahoy */
@media all and (min-width: 650px){ @media all and (min-width: 650px){
   
.content-secondary { .content-secondary {
text-align: left; text-align: left;
float: left; float: left;
width: 45%; width: 45%;
background: none; background: none;
border-top: 0; border-top: 0;
} }
.content-secondary, .content-secondary,
.type-interior .content-secondary { .type-interior .content-secondary {
margin: 30px 0 20px 2%; margin: 30px 0 20px 2%;
padding: 20px 4% 0 0; padding: 20px 4% 0 0;
background: none; background: none;
} }
.type-index .content-secondary { .type-index .content-secondary {
padding: 0; padding: 0;
} }
.type-index .content-secondary .ui-listview { .type-index .content-secondary .ui-listview {
margin: 0; margin: 0;
} }
.content-primary { .content-primary {
width: 45%; width: 45%;
float: right; float: right;
margin-top: 30px; margin-top: 30px;
margin-right: 1%; margin-right: 1%;
padding-right: 1%; padding-right: 1%;
} }
.content-primary ul:first-child { .content-primary ul:first-child {
margin-top: 0; margin-top: 0;
} }
   
.type-interior .content-primary { .type-interior .content-primary {
padding: 1.5em 6% 3em 0; padding: 1.5em 6% 3em 0;
margin: 0; margin: 0;
} }
/* fix up the collapsibles - expanded on desktop */ /* fix up the collapsibles - expanded on desktop */
.content-secondary .ui-collapsible-heading { .content-secondary .ui-collapsible-heading {
display: none; display: none;
} }
.content-secondary .ui-collapsible-contain { .content-secondary .ui-collapsible-contain {
margin:0; margin:0;
} }
.content-secondary .ui-collapsible-content { .content-secondary .ui-collapsible-content {
display: block; display: block;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
.type-interior .content-secondary .ui-li-divider { .type-interior .content-secondary .ui-li-divider {
padding-top: 1em; padding-top: 1em;
padding-bottom: 1em; padding-bottom: 1em;
} }
.type-interior .content-secondary { .type-interior .content-secondary {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
} }
@media all and (min-width: 750px){ @media all and (min-width: 750px){
.type-home .ui-content, .type-home .ui-content,
.type-interior .ui-content { .type-interior .ui-content {
background-position: 39%; background-position: 39%;
} }
.content-secondary { .content-secondary {
width: 34%; width: 34%;
} }
.content-primary { .content-primary {
width: 56%; width: 56%;
padding-right: 1%; padding-right: 1%;
} }
.type-interior .ui-content { .type-interior .ui-content {
background-position: 34%; background-position: 34%;
} }
} }
   
@media all and (min-width: 1200px){ @media all and (min-width: 1200px){
.type-home .ui-content{ .type-home .ui-content{
background-position: 38.5%; background-position: 38.5%;
} }
.type-interior .ui-content { .type-interior .ui-content {
background-position: 30%; background-position: 30%;
} }
.content-secondary { .content-secondary {
width: 30%; width: 30%;
padding-right:6%; padding-right:6%;
margin: 30px 0 20px 5%; margin: 30px 0 20px 5%;
} }
.type-interior .content-secondary { .type-interior .content-secondary {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
.content-primary { .content-primary {
width: 50%; width: 50%;
margin-right: 5%; margin-right: 5%;
padding-right: 3%; padding-right: 3%;
} }
.type-interior .content-primary { .type-interior .content-primary {
width: 60%; width: 60%;
} }
} }
'; ';
ob_end_flush(); ob_end_flush();
?> ?>
   
<?php <?php
include ("include/common.inc.php"); include ("include/common.inc.php");
$GTFSREnabled = false; $GTFSREnabled = false;
include_header("Feedback", "feedback"); include_header("Feedback", "feedback");
function sendEmail($topic, $message) function sendEmail($topic, $message)
{ {
$address = "maxious@lambdacomplex.org"; $address = "maxious@lambdacomplex.org";
if (file_exists("/tmp/aws.php")) {  
include_once ("lib/ses.php");  
include_once ("/tmp/aws.php");  
$con = new SimpleEmailService($accessKey, $secretKey);  
//$con->verifyEmailAddress($address);  
//$con->listVerifiedEmailAddresses();  
$m = new SimpleEmailServiceMessage();  
$m->addTo($address);  
$m->setFrom($address);  
$m->setSubject($topic);  
$m->setMessageFromString($message);  
$con->sendEmail($m);  
}  
else {  
// In case any of our lines are larger than 70 characters, we should use wordwrap() // In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70); $message = wordwrap($message, 70);
// Send // Send
mail($address, $topic, $message); mail($address, $topic, $message);
}  
} }
if (isset($_REQUEST['feedback']) || isset($_REQUEST['newlocation'])){ if (isset($_REQUEST['feedback']) || isset($_REQUEST['newlocation'])){
sendEmail("bus.lambda feedback",print_r($_REQUEST,true)); sendEmail("bus.lambda feedback",print_r($_REQUEST,true));
echo "<h2 style='text-align: center;'>Thank you for your feedback!</h2>"; echo "<h2 style='text-align: center;'>Thank you for your feedback!</h2>";
} else { } else {
$stopid = ""; $stopid = "";
$stopcode = ""; $stopcode = "";
if (isset($_SERVER["HTTP_REFERER"])) $urlparts = explode("?",$_SERVER["HTTP_REFERER"]); if (isset($_SERVER["HTTP_REFERER"])) $urlparts = explode("?",$_SERVER["HTTP_REFERER"]);
if (isset($urlparts[1])) { if (isset($urlparts[1])) {
$getparams = explode("&",$urlparts[1]); $getparams = explode("&",$urlparts[1]);
foreach ($getparams as $param) { foreach ($getparams as $param) {
$paramparts=explode("=",$param); $paramparts=explode("=",$param);
if ($paramparts[0] == "stopid") $stopid = $paramparts[1]; if ($paramparts[0] == "stopid") $stopid = $paramparts[1];
if ($paramparts[0] == "stopcode") $stopcode = $paramparts[1]; if ($paramparts[0] == "stopcode") $stopcode = $paramparts[1];
} }
} }
   
?> ?>
<h3>Add/Move/Delete a Bus Stop Location</h3> <h3>Add/Move/Delete a Bus Stop Location</h3>
<form action="feedback.php" method="post"> <form action="feedback.php" method="post">
StopID: <input type="text" name="stopid" value="<?php echo $stopid ?>"/><br> StopID: <input type="text" name="stopid" value="<?php echo $stopid ?>"/><br>
or StopCode: <input type="text" name="stopcode" value="<?php echo $stopcode ?>"/><br> or StopCode: <input type="text" name="stopcode" value="<?php echo $stopcode ?>"/><br>
<small> if you click on feedback from a stop page, these will get filled in automatically. else describe the location/street of the stop in one of these boxes </small><br> <small> if you click on feedback from a stop page, these will get filled in automatically. else describe the location/street of the stop in one of these boxes </small><br>
   
Suggested Stop Location (lat/long or words): <input type="text" name="newlocation"/><br> Suggested Stop Location (lat/long or words): <input type="text" name="newlocation"/><br>
<!--<small> if your device supports javascript, you can pick a location from the map above</small><br>--> <!--<small> if your device supports javascript, you can pick a location from the map above</small><br>-->
   
<input type="submit" value="Submit!"/> <input type="submit" value="Submit!"/>
</form> </form>
<h3>Bug Report/Feedback</h3> <h3>Bug Report/Feedback</h3>
Please leave feedback about bugs/errors or general suggestions about improvements that could be made to the way the data is presented! Please leave feedback about bugs/errors or general suggestions about improvements that could be made to the way the data is presented!
<form action="feedback.php" method="post"> <form action="feedback.php" method="post">
<textarea name="feedback"> <textarea name="feedback">
</textarea> </textarea>
<textarea name="extrainfo" id="extrainfo"> <textarea name="extrainfo" id="extrainfo">
<?php <?php
echo "Referrer URL: ".($_SERVER["HTTP_REFERER"] ? $_SERVER["HTTP_REFERER"] : ""); echo "Referrer URL: ".($_SERVER["HTTP_REFERER"] ? $_SERVER["HTTP_REFERER"] : "");
echo "\nCurrent page URL: ".curPageURL(); echo "\nCurrent page URL: ".curPageURL();
echo "\nUser Agent: ".$_SERVER["HTTP_USER_AGENT"]; echo "\nUser Agent: ".$_SERVER["HTTP_USER_AGENT"];
echo "\nUser host/IP: ".$_SERVER["HTTP_X_FORWARDED_FOR"]." ".$_SERVER["REMOTE_ADDR"]; echo "\nUser host/IP: ".$_SERVER["HTTP_X_FORWARDED_FOR"]." ".$_SERVER["REMOTE_ADDR"];
echo "\nServer host/IP: ".php_uname("n"); echo "\nServer host/IP: ".php_uname("n");
echo "\nCurrent date/time: ". date("c"); echo "\nCurrent date/time: ". date("c");
echo "\nCurrent code revision: ".exec("git rev-parse --short HEAD"); echo "\nCurrent code revision: ".exec("git rev-parse --short HEAD");
echo "\nCurrent timetables version: ".date("c",@filemtime('cbrfeed.zip')); echo "\nCurrent timetables version: ".date("c",@filemtime('../busresources/cbrfeed.zip'));
echo "\nDump of session: ".print_r($_SESSION,true); echo "\nDump of session: ".print_r($_SESSION,true);
?> ?>
</textarea> </textarea>
   
<input type="submit" value="Submit!"/> <input type="submit" value="Submit!"/>
</form> </form>
<?php <?php
} }
include_footer(); include_footer();
?> ?>
   
   
<?php <?php
header('Content-Type: application/vnd.google-earth.kml+xml'); header('Content-Type: application/vnd.google-earth.kml+xml');
include ('../include/common.inc.php'); include ('../include/common.inc.php');
  header('Content-Disposition: attachment; filename="route.' . urlencode($routeid) . '.kml"');
  $debugOkay = Array(); // disable debugging output even on dev server
echo '<?xml version="1.0" encoding="UTF-8"?> echo '<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"><Document>'; <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"><Document>';
echo ' echo '
<Style id="yellowLineGreenPoly"> <Style id="ylw-pushpin">
  <IconStyle>
  <Icon>
  <href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
   
  </Icon>
  </IconStyle>
   
  </Style>
  <Style id="blue-pushpin">
  <IconStyle>
  <Icon>
  <href>http://maps.google.com/mapfiles/kml/pushpin/blue-pushpin.png</href>
   
  </Icon>
  </IconStyle>
   
  </Style>
  <Style id="grn-pushpin">
  <IconStyle>
  <Icon>
  <href>http://maps.google.com/mapfiles/kml/pushpin/grn-pushpin.png</href>
   
  </Icon>
  </IconStyle>
  </Style>
  <Style id="yellowLineYellowPoly">
<LineStyle> <LineStyle>
<color>7f00ff00</color> <color>7f00ebff</color>
<width>4</width> <width>4</width>
</LineStyle> </LineStyle>
<PolyStyle> <PolyStyle>
<color>7f00ffff</color> <color>7f00ebff</color>
</PolyStyle> </PolyStyle>
</Style>'; </Style>
  <Style id="blueLineBluePoly">
  <LineStyle>
  <color>7fff0000</color>
  <width>4</width>
  </LineStyle>
  <PolyStyle>
  <color>7fff0000</color>
  </PolyStyle>
  </Style>
  ';
$route = getRoute($routeid); $route = getRoute($routeid);
echo "\n<Placemark>\n"; echo "\n<Placemark>\n";
$link = curPageURL()."/../trip.php?routeid=".htmlspecialchars ($route["route_id"]); $_REQUEST['time'] = "12:00";
echo "<name>".$route['route_short_name']."</name>"; $trip = getRouteNextTrip($routeid, 0);
echo '<atom:link href="'.$link.'"/>'; $link = curPageURL() . "/../trip.php?routeid=" . htmlspecialchars($route["route_id"]. "&directionid=0&tripid=".$trip['trip_id']) ;
echo '<description><![CDATA[ <a href="'.$link.'">'.$route['route_short_name']." ".$route['route_long_name']."</a>]]> </description>"; echo "<name>" . $route['route_short_name'] . " Direction 0 </name>";
echo "<styleUrl>#yellowLineGreenPoly</styleUrl>"; echo '<atom:link rel="related" href="' . $link . '"/>';
  echo '<description><![CDATA[ <a href="' . $link . '">' . $route['route_short_name'] . " Direction 0</a>]]> </description>";
  echo "<styleUrl>#yellowLineYellowPoly</styleUrl>";
   
$trips = getRouteTrips($routeid); echo getTripShape($trip['trip_id']);
echo getTripShape($trips[0]['trip_id']); echo "</Placemark>\n";
  $stops = Array();
  foreach (getTripStops($trip['trip_id']) as $stop) {
  $stop['style'] = "#ylw-pushpin";
  $stops[$stop['stop_id']] = $stop;
  }
   
echo "</Placemark>\n</Document></kml>\n";  
  echo "\n<Placemark>\n";
  $trip = getRouteNextTrip($routeid, 1);
  $link = curPageURL() . "/../trip.php?routeid=" . htmlspecialchars($route["route_id"]. "&directionid=1&tripid=".$trip['trip_id']) ;
  echo "<name>" . $route['route_short_name'] . " Direction 1 </name>";
  echo '<atom:link rel="related" href="' . $link . '"/>';
  echo '<description><![CDATA[ <a href="' . $link . '">' . $route['route_short_name'] . " Direction 1</a>]]> </description>";
  echo "<styleUrl>#blueLineBluePoly</styleUrl>";
   
  echo getTripShape($trip['trip_id']);
  echo "</Placemark>\n";
  foreach (getTripStops($trip['trip_id']) as $stop) {
  if (isset($stops[$stop['stop_id']])) {
  $stop['style'] = "#grn-pushpin";
  } else {
  $stop['style'] = "#blue-pushpin";
  }
  $stops[$stop['stop_id']] = $stop;
  }
  foreach ($stops as $stop) {
  echo "\n<Placemark>\n";
  $link = curPageURL() . '/../stop.php?stopid=' . htmlspecialchars($stop['stop_id']);
  echo "<name>" . htmlspecialchars($stop['stop_name']) . "</name>";
  echo '<atom:link rel="related" href="' . $link . '"/>';
  echo '<description><![CDATA[ <a href="' . $link . '">' . htmlspecialchars($stop['stop_name']) . "</a>]]> </description>";
  echo "<styleUrl>" . $stop['style'] . "</styleUrl>";
  echo $stop['positionkml'];
  echo "</Placemark>\n";
  }
   
  echo "</Document></kml>\n";
?> ?>
   
   
<?php <?php
  header('Content-type: application/vnd.google-earth.kml+xml');
include ('../include/common.inc.php'); include ('../include/common.inc.php');
header('Content-type: application/vnd.google-earth.kml+xml'); header('Content-Disposition: attachment; filename="stops.kml"');
  $debugOkay = Array(); // disable debugging output even on dev server
//http://wiki.openstreetmap.org/wiki/OpenLayers_Dynamic_KML //http://wiki.openstreetmap.org/wiki/OpenLayers_Dynamic_KML
// Creates the KML/XML Document. // Creates the KML/XML Document.
$dom = new DOMDocument('1.0', 'UTF-8'); $dom = new DOMDocument('1.0', 'UTF-8');
// Creates the root KML element and appends it to the root document. // Creates the root KML element and appends it to the root document.
$node = $dom->createElementNS('http://earth.google.com/kml/2.1', 'kml'); $node = $dom->createElementNS('http://www.opengis.net/kml/2.2', 'kml');
$parNode = $dom->appendChild($node); $parNode = $dom->appendChild($node);
// Creates a KML Document element and append it to the KML element. // Creates a KML Document element and append it to the KML element.
$dnode = $dom->createElement('Document'); $dnode = $dom->createElement('Document');
$docNode = $parNode->appendChild($dnode); $docNode = $parNode->appendChild($dnode);
if ($suburb != "") $result_stops = getStopsBySuburb($suburb); if ($suburb != "") $result_stops = getStopsBySuburb($suburb);
else $result_stops = getStops(); else $result_stops = getStops();
foreach ($result_stops as $stop) { foreach ($result_stops as $stop) {
$description = 'http://bus.lambdacomplex.org/' . 'stop.php?stopid=' . $stop['stop_id'] . " <br>"; $description = '<a href="'.curPageURL() . '/../stop.php?stopid=' . $stop['stop_id'] . '">View stop page</a><br>';
// Creates a Placemark and append it to the Document. // Creates a Placemark and append it to the Document.
$node = $dom->createElement('Placemark'); $node = $dom->createElement('Placemark');
$placeNode = $docNode->appendChild($node); $placeNode = $docNode->appendChild($node);
// Creates an id attribute and assign it the value of id column. // Creates an id attribute and assign it the value of id column.
$placeNode->setAttribute('id', 'placemark' . $stop['stop_id']); $placeNode->setAttribute('id', 'placemark' . $stop['stop_id']);
// Create name, and description elements and assigns them the values of the name and address columns from the results. // Create name, and description elements and assigns them the values of the name and address columns from the results.
$nameNode = $dom->createElement('name', htmlentities($stop['stop_name'])); $nameNode = $dom->createElement('name', htmlentities($stop['stop_name']));
$descriptionNode = $dom->createElement('description', $description); $descriptionNode = $dom->createElement('description', $description);
$placeNode->appendChild($nameNode); $placeNode->appendChild($nameNode);
$placeNode->appendChild($descriptionNode); $placeNode->appendChild($descriptionNode);
// Creates a Point element. // Creates a Point element.
$pointNode = $dom->createElement('Point'); $pointNode = $dom->createElement('Point');
$placeNode->appendChild($pointNode); $placeNode->appendChild($pointNode);
// Creates a coordinates element and gives it the value of the lng and lat columns from the results. // Creates a coordinates element and gives it the value of the lng and lat columns from the results.
$coorStr = $stop['stop_lon'] . ',' . $stop['stop_lat']; $coorStr = $stop['stop_lon'] . ',' . $stop['stop_lat'];
$coorNode = $dom->createElement('coordinates', $coorStr); $coorNode = $dom->createElement('coordinates', $coorStr);
$pointNode->appendChild($coorNode); $pointNode->appendChild($coorNode);
} }
$kmlOutput = $dom->saveXML(); $kmlOutput = $dom->saveXML();
echo $kmlOutput; echo $kmlOutput;
?> ?>
   
file:b/geo/trip.kml.php (new)
  <?php
  header('Content-Type: application/vnd.google-earth.kml+xml');
  include ('../include/common.inc.php');
  header('Content-Disposition: attachment; filename="trip.' . urlencode($tripid) . '.kml"');
  $debugOkay = Array(); // disable debugging output even on dev server
  echo '<?xml version="1.0" encoding="UTF-8"?>
  <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"><Document>';
  echo '
  <Style id="ylw-pushpin">
  <IconStyle>
  <Icon>
  <href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
 
  </Icon>
  </IconStyle>
 
  </Style>
  <Style id="blue-pushpin">
  <IconStyle>
  <Icon>
  <href>http://maps.google.com/mapfiles/kml/pushpin/blue-pushpin.png</href>
 
  </Icon>
  </IconStyle>
 
  </Style>
  <Style id="grn-pushpin">
  <IconStyle>
  <Icon>
  <href>http://maps.google.com/mapfiles/kml/pushpin/grn-pushpin.png</href>
 
  </Icon>
  </IconStyle>
  </Style>
  <Style id="yellowLineGreenPoly">
  <LineStyle>
  <color>7f00ff00</color>
  <width>4</width>
  </LineStyle>
  <PolyStyle>
  <color>7f00ffff</color>
  </PolyStyle>
  </Style>';
  $trip = getTrip($tripid);
  echo "\n<Placemark>\n";
  $link = curPageURL() . "/../trip.php?tripid=" . htmlspecialchars($$tripid);
  echo "<name>" . $tripid . "</name>";
  echo '<atom:link rel="related" href="' . $link . '"/>';
  echo '<description><![CDATA[ <a href="' . $link . '">' . $tripid . "</a>]]> </description>";
  echo "<styleUrl>#yellowLineGreenPoly</styleUrl>";
 
 
  echo getTripShape($tripid);
 
  echo "</Placemark>\n";
  foreach (getTripStopTimes($tripid) as $stop) {
  echo "\n<Placemark>\n";
  $link = curPageURL() . '/../trip.php?tripid=' . htmlspecialchars($tripid);
  echo "<name>" . $stop['arrival_time'] . " @ " . htmlspecialchars($stop['stop_name']) . "</name>";
  echo '<atom:link rel="related" href="' . $link . '"/>';
  echo '<description><![CDATA[ <a href="' . $link . '">' . htmlspecialchars($stop['stop_name']) . "</a>]]> </description>";
  echo "<styleUrl>#blue-pushpin</styleUrl>";
  echo "<Point><coordinates>" . $stop['stop_lon'] . "," . $stop['stop_lat'] . "</coordinates></Point>";
 
  echo "</Placemark>\n";
  }
  echo "</Document></kml>\n";
  ?>
 
 
<?php <?php
require $basePath.'lib/openid.php'; require $basePath.'lib/openid.php';
$openid = new LightOpenID($_SERVER['HTTP_HOST']); $openid = new LightOpenID($_SERVER['HTTP_HOST']);
function login() function login()
{ {
global $openid; global $openid;
if(!$openid->mode) { if(!$openid->mode) {
$openid->required = array('contact/email'); $openid->required = array('contact/email');
$openid->identity = 'https://www.google.com/accounts/o8/id'; $openid->identity = 'https://www.google.com/accounts/o8/id';
header('Location: ' . $openid->authUrl()); header('Location: ' . $openid->authUrl());
} }
} }
   
   
function auth() function auth()
   
{ {
if ($_SESSION['authed'] == true) return true; if ($_SESSION['authed'] == true) return true;
global $openid; global $openid;
if($openid->mode) { if($openid->mode) {
$attr = $openid->getAttributes(); $attr = $openid->getAttributes();
if ($attr["contact/email"] != "maxious@gmail.com") { if ($attr["contact/email"] != "maxious@gmail.com") {
die("Access Denied"); die("Access Denied");
} else { } else {
$_SESSION['authed'] = true; $_SESSION['authed'] = true;
} }
} else { } else {
login(); login();
} }
} }
?>  
<?php <?php
   
/* /*
* Copyright 2010,2011 Alexander Sadleir * Copyright 2010,2011 Alexander Sadleir
   
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
   
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
if (strstr(php_uname('n'),"actbus")) { if (strstr(php_uname('n'),"actbus")) {
$conn = new PDO("pgsql:dbname=transitdata;user=transitdata;password=transitdata;host=bus-main.lambdacomplex.org"); $conn = new PDO("pgsql:dbname=transitdata;user=transitdata;password=transitdata;host=bus-main.lambdacomplex.org");
} else if (isDebugServer()) { } else if (isDebugServer()) {
$conn = new PDO("pgsql:dbname=transitdata;user=postgres;password=snmc;host=localhost"); $conn = new PDO("pgsql:dbname=transitdata;user=postgres;password=snmc;host=localhost");
} else { } else {
$conn = new PDO("pgsql:dbname=transitdata;user=transitdata;password=transitdata;host=localhost"); $conn = new PDO("pgsql:dbname=transitdata;user=transitdata;password=transitdata;host=localhost");
} }
if (!$conn) { if (!$conn) {
die("A database error occurred.\n"); die("A database error occurred.\n");
} }
   
function databaseError($errMsg) { function databaseError($errMsg) {
die($errMsg); if ($errMsg[1] != "") {
  die(print_r($errMsg,true));
  }
} }
   
include ('db/route-dao.inc.php'); include ('db/route-dao.inc.php');
include ('db/trip-dao.inc.php'); include ('db/trip-dao.inc.php');
include ('db/stop-dao.inc.php'); include ('db/stop-dao.inc.php');
include ('db/servicealert-dao.inc.php'); include ('db/servicealert-dao.inc.php');
?>  
   
<?php <?php
   
/* /*
* Copyright 2010,2011 Alexander Sadleir * Copyright 2010,2011 Alexander Sadleir
   
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
   
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
// SELECT array_to_string(array(SELECT REPLACE(name_2006, ',', '\,') as name FROM suburbs order by name), ',') // SELECT array_to_string(array(SELECT REPLACE(name_2006, ',', '\,') as name FROM suburbs order by name), ',')
$suburbs = explode(",", "Acton,Ainslie,Amaroo,Aranda,Banks,Barton,Belconnen,Bonner,Bonython,Braddon,Bruce,Calwell,Campbell,Chapman,Charnwood,Chifley,Chisholm,City,Conder,Cook,Curtin,Deakin,Dickson,Downer,Duffy,Dunlop,Evatt,Fadden,Farrer,Fisher,Florey,Flynn,Forrest,Franklin,Fraser,Fyshwick,Garran,Gilmore,Giralang,Gordon,Gowrie,Greenway,Griffith,Gungahlin,Hackett,Hall,Harrison,Hawker,Higgins,Holder,Holt,Hughes,Hume,Isaacs,Isabella Plains,Kaleen,Kambah,Kingston,Latham,Lawson,Lyneham,Lyons,Macarthur,Macgregor,Macquarie,Mawson,McKellar,Melba,Mitchell,Monash,Narrabundah,Ngunnawal,Nicholls,Oaks Estate,O'Connor,O'Malley,Oxley,Page,Palmerston,Parkes,Pearce,Phillip,Pialligo,Red Hill,Reid,Richardson,Rivett,Russell,Scullin,Spence,Stirling,Symonston,Tharwa,Theodore,Torrens,Turner,Wanniassa,Waramanga,Watson,Weetangera,Weston,Yarralumla"); $suburbs = explode(",", "Acton,Ainslie,Amaroo,Aranda,Banks,Barton,Belconnen,Bonner,Bonython,Braddon,Bruce,Calwell,Campbell,Chapman,Charnwood,Chifley,Chisholm,City,Conder,Cook,Curtin,Deakin,Dickson,Downer,Duffy,Dunlop,Evatt,Fadden,Farrer,Fisher,Florey,Flynn,Forrest,Franklin,Fraser,Fyshwick,Garran,Gilmore,Giralang,Gordon,Gowrie,Greenway,Griffith,Gungahlin,Hackett,Hall,Harrison,Hawker,Higgins,Holder,Holt,Hughes,Hume,Isaacs,Isabella Plains,Kaleen,Kambah,Kingston,Latham,Lawson,Lyneham,Lyons,Macarthur,Macgregor,Macquarie,Mawson,McKellar,Melba,Mitchell,Monash,Narrabundah,Ngunnawal,Nicholls,Oaks Estate,O'Connor,O'Malley,Oxley,Page,Palmerston,Parkes,Pearce,Phillip,Pialligo,Red Hill,Reid,Richardson,Rivett,Russell,Scullin,Spence,Stirling,Symonston,Tharwa,Theodore,Torrens,Turner,Wanniassa,Waramanga,Watson,Weetangera,Weston,Yarralumla");
   
function staticmap($mapPoints, $collapsible = true, $twotone = false, $path = false, $numbered = false) { function staticmap($mapPoints, $collapsible = true, $twotone = false, $path = false, $numbered = false) {
   
$markers = ""; $markers = "";
$height = 300; $height = 300;
$width = $height; $width = $height;
$index = 0; $index = 0;
if (sizeof($mapPoints) < 1) if (sizeof($mapPoints) < 1)
return "map error"; return "map error";
if (sizeof($mapPoints) === 1) { if (sizeof($mapPoints) === 1) {
$markers = "markers={$mapPoints[0][0]},{$mapPoints[0][1]}"; $markers = "markers={$mapPoints[0][0]},{$mapPoints[0][1]}";
} else { } else {
if (!$numbered) { if (!$numbered) {
$markers = "markers="; $markers = "markers=";
} }
if ($path) { if ($path) {
$markers.= "markers={$mapPoints[0][0]},{$mapPoints[0][1]}&amp;path="; $markers.= "markers={$mapPoints[0][0]},{$mapPoints[0][1]}&amp;path=";
} }
foreach ($mapPoints as $index => $mapPoint) { foreach ($mapPoints as $index => $mapPoint) {
if ($twotone && $index == 0) { if ($twotone && $index == 0) {
$markers = "markerd=color:red|".$mapPoint[0] . "," . $mapPoint[1]."&amp;markers="; $markers = "markerd=color:red|".$mapPoint[0] . "," . $mapPoint[1]."&amp;markers=";
} else { } else {
if ($numbered) { if ($numbered) {
$label = ($index > 9 ? 9 : $index); $label = ($index > 9 ? 9 : $index);
$markers.= "markers=label:$label|" . $mapPoint[0] . "," . $mapPoint[1]; $markers.= "markers=label:$label|" . $mapPoint[0] . "," . $mapPoint[1];
if ($index + 1 != sizeof($mapPoints)) { if ($index + 1 != sizeof($mapPoints)) {
$markers.= "&amp;"; $markers.= "&amp;";
} }
} else { } else {
$markers.= $mapPoint[0] . "," . $mapPoint[1]; $markers.= $mapPoint[0] . "," . $mapPoint[1];
if ($index + 1 != sizeof($mapPoints)) { if ($index + 1 != sizeof($mapPoints)) {
$markers.= "|"; $markers.= "|";
} }
} }
$index++; $index++;
} }
} }
} }
$output = ""; $output = "";
if ($collapsible) if ($collapsible)
$output.= '<div class="map" data-role="collapsible" data-collapsed="true"><h3>Open Map...</h3>'; $output.= '<div class="map" data-role="collapsible" data-collapsed="true"><h3>Open Map...</h3>';
if (isIOSDevice()) $output.= '<img class="hiresmap" src="http://maps.googleapis.com/maps/api/staticmap?size=' . $width . 'x' . $height . '&amp;' . $markers . '&amp;scale=2&amp;sensor=true" width=' . $width . ' height=' . $height . '>'; if (isIOSDevice()) $output.= '<img class="hiresmap" src="http://maps.googleapis.com/maps/api/staticmap?size=' . $width . 'x' . $height . '&amp;' . $markers . '&amp;scale=2&amp;sensor=true" width=' . $width . ' height=' . $height . ' alt="map of stop location">';
else $output.= '<img class="lowresmap" src="http://maps.googleapis.com/maps/api/staticmap?size=' . $width . 'x' . $height . '&amp;' . $markers . '&amp;scale=1&amp;format=jpg&amp;sensor=true" width=' . $width . ' height=' . $height . '>'; else $output.= '<img class="lowresmap" src="http://maps.googleapis.com/maps/api/staticmap?size=' . $width . 'x' . $height . '&amp;' . $markers . '&amp;scale=1&amp;format=jpg&amp;sensor=true" width=' . $width . ' height=' . $height . ' alt="map of stop location">';
if ($collapsible) if ($collapsible)
$output.= '</div>'; $output.= '</div>';
return $output; return $output;
} }
   
function distance($lat1, $lng1, $lat2, $lng2, $roundLargeValues = false) { function distance($lat1, $lng1, $lat2, $lng2, $roundLargeValues = false) {
$pi80 = M_PI / 180; $pi80 = M_PI / 180;
$lat1*= $pi80; $lat1*= $pi80;
$lng1*= $pi80; $lng1*= $pi80;
$lat2*= $pi80; $lat2*= $pi80;
$lng2*= $pi80; $lng2*= $pi80;
$r = 6372.797; // mean radius of Earth in km $r = 6372.797; // mean radius of Earth in km
$dlat = $lat2 - $lat1; $dlat = $lat2 - $lat1;
$dlng = $lng2 - $lng1; $dlng = $lng2 - $lng1;
$a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2); $a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2);
$c = 2 * atan2(sqrt($a), sqrt(1 - $a)); $c = 2 * atan2(sqrt($a), sqrt(1 - $a));
$km = $r * $c; $km = $r * $c;
if ($roundLargeValues) { if ($roundLargeValues) {
if ($km < 1) if ($km < 1)
return floor($km * 1000); return floor($km * 1000);
else else
return round($km, 2) . "k"; return round($km, 2) . "k";
} }
else else
return floor($km * 1000); return floor($km * 1000);
} }
   
function decodePolylineToArray($encoded) { function decodePolylineToArray($encoded) {
// source: http://latlongeeks.com/forum/viewtopic.php?f=4&t=5 // source: http://latlongeeks.com/forum/viewtopic.php?f=4&t=5
$length = strlen($encoded); $length = strlen($encoded);
$index = 0; $index = 0;
$points = array(); $points = array();
$lat = 0; $lat = 0;
$lng = 0; $lng = 0;
while ($index < $length) { while ($index < $length) {
// Temporary variable to hold each ASCII byte. // Temporary variable to hold each ASCII byte.
$b = 0; $b = 0;
// The encoded polyline consists of a latitude value followed by a // The encoded polyline consists of a latitude value followed by a
// longitude value. They should always come in pairs. Read the // longitude value. They should always come in pairs. Read the
// latitude value first. // latitude value first.
$shift = 0; $shift = 0;
$result = 0; $result = 0;
do { do {
// The `ord(substr($encoded, $index++))` statement returns the ASCII // The `ord(substr($encoded, $index++))` statement returns the ASCII
// code for the character at $index. Subtract 63 to get the original // code for the character at $index. Subtract 63 to get the original
// value. (63 was added to ensure proper ASCII characters are displayed // value. (63 was added to ensure proper ASCII characters are displayed
// in the encoded polyline string, which is `human` readable) // in the encoded polyline string, which is `human` readable)
$b = ord(substr($encoded, $index++)) - 63; $b = ord(substr($encoded, $index++)) - 63;
// AND the bits of the byte with 0x1f to get the original 5-bit `chunk. // AND the bits of the byte with 0x1f to get the original 5-bit `chunk.
// Then left shift the bits by the required amount, which increases // Then left shift the bits by the required amount, which increases
// by 5 bits each time. // by 5 bits each time.
// OR the value into $results, which sums up the individual 5-bit chunks // OR the value into $results, which sums up the individual 5-bit chunks
// into the original value. Since the 5-bit chunks were reversed in // into the original value. Since the 5-bit chunks were reversed in
// order during encoding, reading them in this way ensures proper // order during encoding, reading them in this way ensures proper
// summation. // summation.
$result|= ($b & 0x1f) << $shift; $result|= ($b & 0x1f) << $shift;
$shift+= 5; $shift+= 5;
} }
// Continue while the read byte is >= 0x20 since the last `chunk` // Continue while the read byte is >= 0x20 since the last `chunk`
// was not OR'd with 0x20 during the conversion process. (Signals the end) // was not OR'd with 0x20 during the conversion process. (Signals the end)
while ($b >= 0x20); while ($b >= 0x20);
// Check if negative, and convert. (All negative values have the last bit // Check if negative, and convert. (All negative values have the last bit
// set) // set)
$dlat = (($result & 1) ? ~($result >> 1) : ($result >> 1)); $dlat = (($result & 1) ? ~($result >> 1) : ($result >> 1));
// Compute actual latitude since value is offset from previous value. // Compute actual latitude since value is offset from previous value.
$lat+= $dlat; $lat+= $dlat;
// The next values will correspond to the longitude for this point. // The next values will correspond to the longitude for this point.
$shift = 0; $shift = 0;
$result = 0; $result = 0;
do { do {
$b = ord(substr($encoded, $index++)) - 63; $b = ord(substr($encoded, $index++)) - 63;
$result|= ($b & 0x1f) << $shift; $result|= ($b & 0x1f) << $shift;
$shift+= 5; $shift+= 5;
} while ($b >= 0x20); } while ($b >= 0x20);
$dlng = (($result & 1) ? ~($result >> 1) : ($result >> 1)); $dlng = (($result & 1) ? ~($result >> 1) : ($result >> 1));
$lng+= $dlng; $lng+= $dlng;
// The actual latitude and longitude values were multiplied by // The actual latitude and longitude values were multiplied by
// 1e5 before encoding so that they could be converted to a 32-bit // 1e5 before encoding so that they could be converted to a 32-bit
// integer representation. (With a decimal accuracy of 5 places) // integer representation. (With a decimal accuracy of 5 places)
// Convert back to original values. // Convert back to original values.
$points[] = array( $points[] = array(
$lat * 1e-5, $lat * 1e-5,
$lng * 1e-5 $lng * 1e-5
); );
} }
return $points; return $points;
} }
   
function geocode($query, $giveOptions) { function geocode($query, $giveOptions) {
global $cloudmadeAPIkey; global $cloudmadeAPIkey;
$url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?query=" . urlencode($query) . "&bbox=-35.5,149.00,-35.15,149.1930&return_location=true&bbox_only=true"; $url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?query=" . urlencode($query) . "&bbox=-35.5,149.00,-35.15,149.1930&return_location=true&bbox_only=true";
$contents = json_decode(getPage($url)); $contents = json_decode(getPage($url));
if ($giveOptions) if ($giveOptions)
return $contents->features; return $contents->features;
elseif (isset($contents->features[0]->centroid)) elseif (isset($contents->features[0]->centroid))
return $contents->features[0]->centroid->coordinates[0] . "," . $contents->features[0]->centroid->coordinates[1]; return $contents->features[0]->centroid->coordinates[0] . "," . $contents->features[0]->centroid->coordinates[1];
else else
return ""; return "";
} }
   
function reverseGeocode($lat, $lng) { function reverseGeocode($lat, $lng) {
global $cloudmadeAPIkey; global $cloudmadeAPIkey;
$url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?around=" . $lat . "," . $lng . "&distance=closest&object_type=road"; $url = "http://geocoding.cloudmade.com/$cloudmadeAPIkey/geocoding/v2/find.js?around=" . $lat . "," . $lng . "&distance=closest&object_type=road";
$contents = json_decode(getPage($url)); $contents = json_decode(getPage($url));
return $contents->features[0]->properties->name; return $contents->features[0]->properties->name;
} }
   
?>  
   
<?php <?php
   
/* /*
* Copyright 2010,2011 Alexander Sadleir * Copyright 2010,2011 Alexander Sadleir
   
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
   
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
   
function getPage($url) { function getPage($url) {
debug($url, "json"); debug($url, "json");
$ch = curl_init($url); $ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 45); curl_setopt($ch, CURLOPT_TIMEOUT, 45);
$page = curl_exec($ch); $page = curl_exec($ch);
if (curl_errno($ch)) { if (curl_errno($ch)) {
echo "<font color=red> Database temporarily unavailable: "; echo "<font color=red> Database temporarily unavailable: ";
echo curl_errno($ch) . " " . curl_error($ch); echo curl_errno($ch) . " " . curl_error($ch);
if (isDebug()) { if (isDebug()) {
echo $url; echo $url;
} }
echo "</font><br>"; echo "</font><br>";
} }
curl_close($ch); curl_close($ch);
debug(print_r($page, true), "json"); debug(print_r($page, true), "json");
return $page; return $page;
} }
   
function curPageURL() { function curPageURL() {
$isHTTPS = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on"); $isHTTPS = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on");
$port = (isset($_SERVER["SERVER_PORT"]) && ((!$isHTTPS && $_SERVER["SERVER_PORT"] != "80") || ($isHTTPS && $_SERVER["SERVER_PORT"] != "443"))); $port = (isset($_SERVER["SERVER_PORT"]) && ((!$isHTTPS && $_SERVER["SERVER_PORT"] != "80") || ($isHTTPS && $_SERVER["SERVER_PORT"] != "443")));
$port = ($port) ? ':' . $_SERVER["SERVER_PORT"] : ''; $port = ($port) ? ':' . $_SERVER["SERVER_PORT"] : '';
$url = ($isHTTPS ? 'https://' : 'http://') . $_SERVER["SERVER_NAME"] . $port . htmlentities(dirname($_SERVER['PHP_SELF']), ENT_QUOTES); $url = ($isHTTPS ? 'https://' : 'http://') . $_SERVER["SERVER_NAME"] . $port . htmlentities(dirname($_SERVER['PHP_SELF']), ENT_QUOTES);
return $url; return $url;
} }
   
?>  
   
<?php <?php
   
/* /*
* Copyright 2010,2011 Alexander Sadleir * Copyright 2010,2011 Alexander Sadleir
   
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
   
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
if (isset($_REQUEST['firstLetter'])) { if (isset($_REQUEST['firstLetter'])) {
$firstLetter = filter_var($_REQUEST['firstLetter'], FILTER_SANITIZE_STRING); $firstLetter = filter_var($_REQUEST['firstLetter'], FILTER_SANITIZE_STRING);
} }
if (isset($_REQUEST['bysuburbs'])) { if (isset($_REQUEST['bysuburbs'])) {
$bysuburbs = true; $bysuburbs = true;
} }
if (isset($_REQUEST['bynumber'])) { if (isset($_REQUEST['bynumber'])) {
$bynumber = true; $bynumber = true;
} }
if (isset($_REQUEST['allstops'])) { if (isset($_REQUEST['allstops'])) {
$allstops = true; $allstops = true;
} }
if (isset($_REQUEST['nearby'])) { if (isset($_REQUEST['nearby'])) {
$nearby = true; $nearby = true;
} }
  if (isset($_REQUEST['labs'])) {
  $labs = true;
  }
if (isset($_REQUEST['suburb'])) { if (isset($_REQUEST['suburb'])) {
$suburb = $_REQUEST['suburb']; $suburb = $_REQUEST['suburb'];
} }
if (isset($_REQUEST['pageKey'])) { if (isset($_REQUEST['pageKey'])) {
$pageKey = filter_var($_REQUEST['pageKey'], FILTER_SANITIZE_NUMBER_INT); $pageKey = filter_var($_REQUEST['pageKey'], FILTER_SANITIZE_NUMBER_INT);
} }
if (isset($_REQUEST['lat'])) { if (isset($_REQUEST['lat'])) {
$lat = filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $lat = filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
} }
if (isset($_REQUEST['lon'])) { if (isset($_REQUEST['lon'])) {
$lon = filter_var($_REQUEST['lon'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $lon = filter_var($_REQUEST['lon'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
} }
if (isset($_REQUEST['radius'])) { if (isset($_REQUEST['radius'])) {
$max_distance = filter_var($_REQUEST['radius'], FILTER_SANITIZE_NUMBER_INT); $max_distance = filter_var($_REQUEST['radius'], FILTER_SANITIZE_NUMBER_INT);
} }
if (isset($_REQUEST['numberSeries'])) { if (isset($_REQUEST['numberSeries'])) {
$numberSeries = filter_var($_REQUEST['numberSeries'], FILTER_SANITIZE_NUMBER_INT); $numberSeries = filter_var($_REQUEST['numberSeries'], FILTER_SANITIZE_NUMBER_INT);
} }
if (isset($_REQUEST['routeDestination'])) { if (isset($_REQUEST['routeDestination'])) {
$routeDestination = urldecode(filter_var($_REQUEST['routeDestination'], FILTER_SANITIZE_ENCODED)); $routeDestination = urldecode(filter_var($_REQUEST['routeDestination'], FILTER_SANITIZE_ENCODED));
} }
  if (isset($_REQUEST['routename'])) {
  $routename = urldecode(filter_var($_REQUEST['routename'], FILTER_SANITIZE_ENCODED));
  }
if (isset($_REQUEST['stopcode'])) { if (isset($_REQUEST['stopcode'])) {
$stopcode = filter_var($_REQUEST['stopcode'], FILTER_SANITIZE_STRING); $stopcode = filter_var($_REQUEST['stopcode'], FILTER_SANITIZE_STRING);
} }
if (isset($_REQUEST['stopids'])) { if (isset($_REQUEST['stopids'])) {
$stopids = explode(",", filter_var($_REQUEST['stopids'], FILTER_SANITIZE_STRING)); $stopids = explode(",", filter_var($_REQUEST['stopids'], FILTER_SANITIZE_STRING));
} }
  if (isset($_REQUEST['filterIncludeRoutes'])) {
  $filterIncludeRoutes = explode(",", filter_var($_REQUEST['filterIncludeRoutes'], FILTER_SANITIZE_STRING));
  }
  if (isset($_REQUEST['filterHasStop'])) {
  $filterHasStop = filter_var($_REQUEST['filterHasStop'], FILTER_SANITIZE_STRING);
  }
if (isset($_REQUEST['tripid'])) { if (isset($_REQUEST['tripid'])) {
$tripid = filter_var($_REQUEST['tripid'], FILTER_SANITIZE_STRING); $tripid = filter_var($_REQUEST['tripid'], FILTER_SANITIZE_STRING);
  }
  if (isset($_REQUEST['routeid'])) {
  $routeid = filter_var($_REQUEST['routeid'], FILTER_SANITIZE_STRING);
  }
  if (isset($_REQUEST['directionid'])) {
  $directionid = filter_var($_REQUEST['directionid'], FILTER_SANITIZE_STRING);
} }
if (isset($_REQUEST['stopid'])) { if (isset($_REQUEST['stopid'])) {
$stopid = filter_var($_REQUEST['stopid'], FILTER_SANITIZE_NUMBER_INT); $stopid = filter_var($_REQUEST['stopid'], FILTER_SANITIZE_NUMBER_INT);
} }
if (isset($_REQUEST['routeid'])) {  
$routeid = filter_var($_REQUEST['routeid'], FILTER_SANITIZE_NUMBER_INT);  
}  
if (isset($_REQUEST['geolocate'])) { if (isset($_REQUEST['geolocate'])) {
$geolocate = filter_var($_REQUEST['geolocate'], FILTER_SANITIZE_URL); $geolocate = filter_var($_REQUEST['geolocate'], FILTER_SANITIZE_URL);
} }
?>  
<?php <?php
   
/* /*
* Copyright 2010,2011 Alexander Sadleir * Copyright 2010,2011 Alexander Sadleir
   
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
   
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
// you have to open the session to be able to modify or remove it // you have to open the session to be able to modify or remove it
session_start(); session_start();
if (isset($_REQUEST['service_period'])) {  
$_SESSION['service_period'] = filter_var($_REQUEST['service_period'], FILTER_SANITIZE_STRING);  
sessionUpdated();  
}  
if (isset($_REQUEST['time'])) {  
$_SESSION['time'] = filter_var($_REQUEST['time'], FILTER_SANITIZE_STRING);  
sessionUpdated();  
}  
if (isset($_REQUEST['geolocate']) && $_REQUEST['geolocate'] != "Enter co-ordinates or address here") { if (isset($_REQUEST['geolocate']) && $_REQUEST['geolocate'] != "Enter co-ordinates or address here") {
$geocoded = false; $geocoded = false;
if (isset($_REQUEST['lat']) && isset($_REQUEST['lon'])) { if (isset($_REQUEST['lat']) && isset($_REQUEST['lon'])) {
$_SESSION['lat'] = trim(filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); $_SESSION['lat'] = trim(filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
$_SESSION['lon'] = trim(filter_var($_REQUEST['lon'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); $_SESSION['lon'] = trim(filter_var($_REQUEST['lon'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
} else { } else {
if (startsWith($geolocate, "-")) { if (startsWith($geolocate, "-")) {
$locateparts = explode(",", $geolocate); $locateparts = explode(",", $geolocate);
$_SESSION['lat'] = $locateparts[0]; $_SESSION['lat'] = $locateparts[0];
$_SESSION['lon'] = $locateparts[1]; $_SESSION['lon'] = $locateparts[1];
} else if (strpos($geolocate, "(") !== false) { } else if (strpos($geolocate, "(") !== false) {
$geoParts = explode("(", $geolocate); $geoParts = explode("(", $geolocate);
$locateparts = explode(",", str_replace(")", "", $geoParts[1])); $locateparts = explode(",", str_replace(")", "", $geoParts[1]));
$_SESSION['lat'] = $locateparts[0]; $_SESSION['lat'] = $locateparts[0];
$_SESSION['lon'] = $locateparts[1]; $_SESSION['lon'] = $locateparts[1];
} else { } else {
$contents = geocode($geolocate, true); $contents = geocode($geolocate, true);
print_r($contents); print_r($contents);
if (isset($contents[0]->centroid)) { if (isset($contents[0]->centroid)) {
$geocoded = true; $geocoded = true;
$_SESSION['lat'] = $contents[0]->centroid->coordinates[0]; $_SESSION['lat'] = $contents[0]->centroid->coordinates[0];
$_SESSION['lon'] = $contents[0]->centroid->coordinates[1]; $_SESSION['lon'] = $contents[0]->centroid->coordinates[1];
} else { } else {
$_SESSION['lat'] = ""; $_SESSION['lat'] = "";
$_SESSION['lon'] = ""; $_SESSION['lon'] = "";
} }
} }
} }
sessionUpdated(); sessionUpdated();
} }
   
function sessionUpdated() { function sessionUpdated() {
$_SESSION['lastUpdated'] = time(); $_SESSION['lastUpdated'] = time();
} }
   
// timeoutSession // timeoutSession
$TIMEOUT_LIMIT = 60 * 5; // 5 minutes $TIMEOUT_LIMIT = 60 * 5; // 5 minutes
if (isset($_SESSION['lastUpdated']) && $_SESSION['lastUpdated'] + $TIMEOUT_LIMIT < time()) { if (isset($_SESSION['lastUpdated']) && $_SESSION['lastUpdated'] + $TIMEOUT_LIMIT < time()) {
debug("Session timeout " . ($_SESSION['lastUpdated'] + $TIMEOUT_LIMIT) . ">" . time(), "session"); debug("Session timeout " . ($_SESSION['lastUpdated'] + $TIMEOUT_LIMIT) . ">" . time(), "session");
session_destroy(); session_destroy();
session_start(); session_start();
} }
   
//debug(print_r($_SESSION, true) , "session"); //debug(print_r($_SESSION, true) , "session");
function current_time() { function current_time($time = "") {
return ($_SESSION['time'] ? $_SESSION['time'] : date("H:i:s")); if (isset($_REQUEST['time'])) return $_REQUEST['time'];
  else if ($time != "") date("H:i:s",$time);
  else return date("H:i:s");
} }
   
?>  
   
<?php <?php
   
/* /*
* Copyright 2010,2011 Alexander Sadleir * Copyright 2010,2011 Alexander Sadleir
   
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
   
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
   
// Copyright 2009 Google Inc. All Rights Reserved. // Copyright 2009 Google Inc. All Rights Reserved.
$GA_ACCOUNT = "MO-22173039-1"; $GA_ACCOUNT = "MO-22173039-1";
$GA_PIXEL = "/lib/ga.php"; $GA_PIXEL = "/lib/ga.php";
   
function googleAnalyticsGetImageUrl() { function googleAnalyticsGetImageUrl() {
global $GA_ACCOUNT, $GA_PIXEL; global $GA_ACCOUNT, $GA_PIXEL;
//if (stristr($_SERVER['HTTP_USER_AGENT'], 'Googlebot') return ""; //if (stristr($_SERVER['HTTP_USER_AGENT'], 'Googlebot') return "";
$url = ""; $url = "";
$url.= $GA_PIXEL . "?"; $url.= $GA_PIXEL . "?";
$url.= "utmac=" . $GA_ACCOUNT; $url.= "utmac=" . $GA_ACCOUNT;
$url.= "&utmn=" . rand(0, 0x7fffffff); $url.= "&utmn=" . rand(0, 0x7fffffff);
$referer = (isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : ""); $referer = (isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "");
$query = $_SERVER["QUERY_STRING"]; $query = $_SERVER["QUERY_STRING"];
$path = $_SERVER["REQUEST_URI"]; $path = $_SERVER["REQUEST_URI"];
if (empty($referer)) { if (empty($referer)) {
$referer = "-"; $referer = "-";
} }
$url.= "&utmr=" . urlencode($referer); $url.= "&utmr=" . urlencode($referer);
if (!empty($path)) { if (!empty($path)) {
$url.= "&utmp=" . urlencode($path); $url.= "&utmp=" . urlencode($path);
} }
$url.= "&guid=ON"; $url.= "&guid=ON";
return str_replace("&", "&amp;", $url); return str_replace("&", "&amp;", $url);
} }
   
function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false) { function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false) {
global $basePath, $GTFSREnabled; global $basePath, $GTFSREnabled, $stopid, $routeid;
echo ' echo '
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>' . $pageTitle . ' - Canberra Bus Timetable</title> <title>' . $pageTitle . ' - Canberra Bus Timetable</title>
<meta name="google-site-verification" content="-53T5Qn4TB_de1NyfR_ZZkEVdUNcNFSaYKSFkWKx-sY" /> <meta name="google-site-verification" content="-53T5Qn4TB_de1NyfR_ZZkEVdUNcNFSaYKSFkWKx-sY" />
<link rel="dns-prefetch" href="//code.jquery.com"> <link rel="dns-prefetch" href="//code.jquery.com">
<link rel="dns-prefetch" href="//ajax.googleapis.com"> <link rel="dns-prefetch" href="//ajax.googleapis.com">';
<link rel="stylesheet" href="' . $basePath . 'css/jquery-ui-1.8.12.custom.css" />'; $jqmVersion = "1.0.1";
$jqmVersion = "1.0"; echo '
if (isDebugServer()) { <script src="'.$basePath.'js/yepnope/yepnope.1.5.3-min.js"></script>
$jqmcss = $basePath . "css/jquery.mobile-$jqmVersion.css"; <script>
$jqjs = $basePath . "js/jquery-1.6.4.min.js"; yepnope([{
$jqmjs = $basePath . "js/jquery.mobile-$jqmVersion.js"; load: "//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js",
  complete: function () {
$jqmcss = $basePath . "css/jquery.mobile-b90eab4935.css";  
$jqmjs = $basePath . "js/jquery.mobile-b90eab4935.js"; $(document).bind("mobileinit", function(){
} else {  
$jqmcss = "//code.jquery.com/mobile/$jqmVersion/jquery.mobile-$jqmVersion.min.css";  
$jqjs = "//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js";  
$jqmjs = "//code.jquery.com/mobile/$jqmVersion/jquery.mobile-$jqmVersion.min.js";  
   
}  
echo '<link rel="stylesheet" href="' . $jqmcss . '" />  
<script src="' . $jqjs . '"></script>  
<script>$(document).bind("mobileinit", function(){  
$.mobile.ajaxEnabled = false; $.mobile.ajaxEnabled = false;
}); }); }
</script>  
<script src="' . $jqmjs . '"></script> }, {
  load: ["//code.jquery.com/mobile/' . $jqmVersion . '/jquery.mobile-' . $jqmVersion . '.min.css","//code.jquery.com/mobile/' . $jqmVersion . '/jquery.mobile-' . $jqmVersion . '.min.js"]
<script src="' . $basePath . 'js/jquery.ui.core.min.js"></script> }, {
<script src="' . $basePath . 'js/jquery.ui.position.min.js"></script> load: ["' . $basePath . 'css/jquery-ui-1.8.12.custom.css","' . $basePath . 'js/jquery.ui.core.min.js","' . $basePath . 'js/jquery.ui.position.min.js","' . $basePath . 'js/jquery.ui.widget.min.js","' . $basePath . 'js/jquery.ui.autocomplete.min.js"],
<script src="' . $basePath . 'js/jquery.ui.widget.min.js"></script> complete: function() {
<script src="' . $basePath . 'js/jquery.ui.autocomplete.min.js"></script>  
<script>  
$(function() {  
$( "#geolocate" ).autocomplete({ $( "#geolocate" ).autocomplete({
source: "lib/autocomplete.php", source: "lib/autocomplete.php",
minLength: 2 minLength: 2
}); });
$( "#from" ).autocomplete({ $( "#from" ).autocomplete({
source: "lib/autocomplete.php", source: "lib/autocomplete.php",
minLength: 2 minLength: 2
}); });
$( "#to" ).autocomplete({ $( "#to" ).autocomplete({
source: "lib/autocomplete.php", source: "lib/autocomplete.php",
minLength: 2 minLength: 2
}); });
}); }
</script>';  
   
  }]);
   
  </script>
  ';
echo '<style type="text/css">'; echo '<style type="text/css">';
if (strstr($_SERVER['HTTP_USER_AGENT'], 'Android')) if (strstr($_SERVER['HTTP_USER_AGENT'], 'Android'))
echo '.ui-shadow,.ui-btn-up-a,.ui-btn-hover-a,.ui-btn-down-a,.ui-body-b,.ui-btn-up-b,.ui-btn-hover-b, echo '.ui-shadow,.ui-btn-up-a,.ui-btn-hover-a,.ui-btn-down-a,.ui-body-b,.ui-btn-up-b,.ui-btn-hover-b,
.ui-btn-down-b,.ui-bar-c,.ui-body-c,.ui-btn-up-c,.ui-btn-hover-c,.ui-btn-down-c,.ui-bar-c,.ui-body-d, .ui-btn-down-b,.ui-bar-c,.ui-body-c,.ui-btn-up-c,.ui-btn-hover-c,.ui-btn-down-c,.ui-bar-c,.ui-body-d,
.ui-btn-up-d,.ui-btn-hover-d,.ui-btn-down-d,.ui-bar-d,.ui-body-e,.ui-btn-up-e,.ui-btn-hover-e, .ui-btn-up-d,.ui-btn-hover-d,.ui-btn-down-d,.ui-bar-d,.ui-body-e,.ui-btn-up-e,.ui-btn-hover-e,
.ui-btn-down-e,.ui-bar-e,.ui-overlay-shadow,.ui-shadow,.ui-btn-active,.ui-body-a,.ui-bar-a { .ui-btn-down-e,.ui-bar-e,.ui-overlay-shadow,.ui-shadow,.ui-btn-active,.ui-body-a,.ui-bar-a {
text-shadow: none; text-shadow: none;
box-shadow: none; box-shadow: none;
-webkit-box-shadow: none; -webkit-box-shadow: none;
}'; }';
echo '</style>'; echo '</style>';
echo '<link rel="stylesheet" href="' . $basePath . 'css/local.css.php" />'; echo '<link rel="stylesheet" href="' . $basePath . 'css/local.css.php" />';
if (isIOSDevice()){ if (isIOSDevice()) {
echo '<meta name="apple-mobile-web-app-capable" content="yes" /> echo '<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-startup-image" href="startup.png" /> <link rel="apple-touch-startup-image" href="startup.png" />
<link rel="apple-touch-icon" href="apple-touch-icon.png" />'; <link rel="apple-touch-icon" href="apple-touch-icon.png" />';
} }
if ($geolocate) { if ($geolocate) {
echo "<script> echo "<script>
   
function success(position) { function success(position) {
$('#error').val('Location now detected. Please wait for data to load.'); $('#error').val('Location now detected. Please wait for data to load.');
$('#geolocate').val(position.coords.latitude+','+position.coords.longitude); $('#geolocate').val(position.coords.latitude+','+position.coords.longitude);
$.ajax({ async: false, $.ajax({ async: false,
success: function(){ success: function(){
location.reload(true); location.reload(true);
}, },
url: \"include/common.inc.php?geolocate=yes&lat=\"+position.coords.latitude+\"&lon=\"+position.coords.longitude }); url: \"include/common.inc.php?geolocate=yes&lat=\"+position.coords.latitude+\"&lon=\"+position.coords.longitude });
} }
function error(msg) { function error(msg) {
$('#error').val('Error: '+msg); $('#error').val('Error: '+msg);
} }
   
function geolocate() { function geolocate() {
if (navigator.geolocation) { if (navigator.geolocation) {
var options = { var options = {
enableHighAccuracy: true, enableHighAccuracy: true,
timeout: 60000, timeout: 60000,
maximumAge: 10000 maximumAge: 10000
} }
navigator.geolocation.getCurrentPosition(success, error, options); navigator.geolocation.getCurrentPosition(success, error, options);
} }
} }
$(document).ready(function() { $(document).ready(function() {
$('#here').click(function(event) { $('#geolocate').val(geolocate()); return false;}); $('#here').click(function(event) { $('#geolocate').val(geolocate()); return false;});
$('#here').show(); $('#here').show();
}); });
"; ";
if (!isset($_SESSION['lat']) || $_SESSION['lat'] == "") if (!isset($_SESSION['lat']) || $_SESSION['lat'] == "")
echo "geolocate();"; echo "geolocate();";
echo "</script> "; echo "</script> ";
} }
if (isAnalyticsOn()) if (isAnalyticsOn())
echo ' echo '
<script type="text/javascript">' . " <script type="text/javascript">' . "
   
var _gaq = _gaq || []; var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22173039-1']); _gaq.push(['_setAccount', 'UA-22173039-1']);
_gaq.push(['_trackPageview']); _gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']); _gaq.push(['_trackPageLoadTime']);
</script>"; </script>";
echo '</head> echo '</head>
<body> <body>
<div id="skip"> <div id="skip">
<a href="#maincontent">Skip to content</a> <a href="#maincontent">Skip to content</a>
</div> </div>
'; ';
if ($opendiv) { if ($opendiv) {
echo '<div data-role="page"> echo '<div data-role="page">
<div data-role="header" data-position="inline"> <div data-role="header" data-position="inline">
<a href="' . (isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "javascript:history.go(-1)") . '" data-icon="arrow-l" data-rel="back" class="ui-btn-left">Back</a> <a href="' . (isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "javascript:history.go(-1)") . '" data-icon="arrow-l" data-rel="back" class="ui-btn-left">Back</a>
<h1>' . $pageTitle . '</h1> <h1>' . $pageTitle . '</h1>
<a href="' . $basePath . '/index.php" data-icon="home" class="ui-btn-right">Home</a> <a href="' . $basePath . '/index.php" data-icon="home" class="ui-btn-right">Home</a>
</div><!-- /header --> </div><!-- /header -->
<a name="maincontent" id="maincontent"></a> <a name="maincontent" id="maincontent"></a>
<div data-role="content"> '; <div data-role="content"> ';
if ($GTFSREnabled) { if ($GTFSREnabled) {
$overrides = getServiceOverride(); $overrides = getServiceOverride();
if ($overrides['service_id']) { if (isset($overrides['service_id'])) {
if ($overrides['service_id'] == "noservice") { if ($overrides['service_id'] == "noservice") {
echo '<div id="servicewarning">Buses are <strong>not running today</strong> due to industrial action/public holiday. See <a echo '<div class="servicewarning">Buses are <strong>not running today</strong> due to industrial action/public holiday. See <a
href="http://www.action.act.gov.au">http://www.action.act.gov.au</a> for details.</div>'; href="http://www.action.act.gov.au">http://www.action.act.gov.au</a> for details.</div>';
} else { } else {
echo '<div id="servicewarning">Buses are running on an altered timetable today due to industrial action/public holiday. See <a href="http://www.action.act.gov.au">http://www.action.act.gov.au</a> for details.</div>'; echo '<div class="servicewarning">Buses are running on an altered timetable today due to industrial action/public holiday. See <a href="http://www.action.act.gov.au">http://www.action.act.gov.au</a> for details.</div>';
} }
} }
$serviceAlerts = getServiceAlertsAsArray("agency", "0"); $serviceAlerts = Array();
  $globalAlerts = getServiceAlertsAsArray("agency", "0");
  if ($globalAlerts != null) {
  // echo "getting alerts due to network wide";
  $serviceAlerts = array_merge($serviceAlerts, $globalAlerts);
  }
  if (isset($stopid)) {
  $stopAlerts = getServiceAlertsAsArray("stop", $stopid);
  if ($stopAlerts != null) {
  // echo "getting alerts due to stop $stopid";
  $serviceAlerts = array_merge($serviceAlerts, $stopAlerts);
  }
  }
  if (isset($routeid)) {
  $routeAlerts = getServiceAlertsAsArray("route", $routeid);
  if ($routeAlerts != null) {
  // echo "getting alerts due to route $routeid";
  $serviceAlerts = array_merge($serviceAlerts, $routeAlerts);
  }
  }
if (isset($serviceAlerts['entity']) && sizeof($serviceAlerts['entity']) > 0) { if (isset($serviceAlerts['entity']) && sizeof($serviceAlerts['entity']) > 0) {
foreach ($serviceAlerts['entity'] as $entity) { foreach ($serviceAlerts['entity'] as $entity) {
echo "<div id='servicewarning'>" . date("F j, g:i a", strtotime($entity['alert']['active_period'][0]['start'])) . " to " . date("F j, g:i a", strtotime($entity['alert']['active_period'][0]['end'])) . "{$entity['alert']['header_text']['translation'][0]['text']}<br>Warning: {$entity['alert']['description_text']['translation'][0]['text']} echo "<div class='servicewarning'><b>{$entity['alert']['header_text']['translation'][0]['text']}</b>&nbsp;<small>"
  . date("F jS Y, g:i a", $entity['alert']['active_period'][0]['start']) . " to "
  . date("F jS Y, g:i a", $entity['alert']['active_period'][0]['end']) . "</small>
  <br>Warning: {$entity['alert']['description_text']['translation'][0]['text']}
<br><a href='{$entity['alert']['url']['translation'][0]['text']}'>Source</a> </div>"; <br><a href='{$entity['alert']['url']['translation'][0]['text']}'>Source</a> </div>";
} }
} }
} }
} }
} }
   
function include_footer() { function include_footer() {
global $basePath; global $basePath;
echo '<div id="footer"><a href="' . $basePath . 'about.php">About/Contact Us</a>&nbsp;<a href="' . $basePath . 'feedback.php">Feedback/Bug Report</a>&nbsp;<a href="' . $basePath . 'privacy.php">Privacy Policy</a>'; echo '<div id="footer"><a href="' . $basePath . 'about.php">About/Contact Us</a>&nbsp;<a href="' . $basePath . 'feedback.php">Feedback/Bug Report</a>&nbsp;<a href="' . $basePath . 'privacy.php">Privacy Policy</a>';
echo '</div>'; echo '</div>';
if (isAnalyticsOn()) { if (isAnalyticsOn()) {
echo "<script> (function() { echo "<script> (function() {
var ga = document.createElement('script'); ga.type = var ga = document.createElement('script'); ga.type =
'text/javascript'; ga.async = true; 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? ga.src = ('https:' == document.location.protocol ?
'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s); s.parentNode.insertBefore(ga, s);
})();</script>"; })();</script>";
$googleAnalyticsImageUrl = googleAnalyticsGetImageUrl(); $googleAnalyticsImageUrl = googleAnalyticsGetImageUrl();
echo '<noscript><img src="' . $googleAnalyticsImageUrl . '" /></noscript>'; echo '<noscript><img src="' . $googleAnalyticsImageUrl . '" alt=""/></noscript>';
} }
echo "\n</div></div></body></html>"; echo "\n</div></div></body></html>";
} }
   
  function timeSettings() {
  global $service_periods;
  echo '<div id="settings" data-role="collapsible" data-collapsed="true">
  <h3>Change Time (' . (isset($_REQUEST['time']) ? $_REQUEST['time'] : "Current Time,") . ' ' . ucwords(service_period()) . ')...</h3>
  <form action="' . basename($_SERVER['PHP_SELF']) . '" method="GET">
  <input type="hidden" name="suburb" id="suburb" value="' . (isset($_REQUEST['suburb']) ? $_REQUEST['suburb'] : "") . '"/>
   
  <input type="hidden" name="stopid" id="stopid" value="' . (isset($_REQUEST['stopid']) ? $_REQUEST['stopid'] : "") . '"/>
  <input type="hidden" name="stopcode" id="stopcode" value="' . (isset($_REQUEST['stopcode']) ? $_REQUEST['stopcode'] : "") . '"/>
  <div class="ui-body">
  <div data-role="fieldcontain">
  <label for="time"> Time: </label>
  <input type="time" name="time" id="time" value="' . (isset($_REQUEST['time']) ? $_REQUEST['time'] : date("H:i")) . '"/>
  <a href="#" name="currentTime" id="currentTime" onClick="var d = new Date();' . "$('#time').val(d.getHours() +':'+ (d.getMinutes().toString().length == 1 ? '0'+ d.getMinutes(): d.getMinutes()));" . '">Current Time?</a>
  </div>
  <div data-role="fieldcontain">
  <label for="service_period"> Service Period: </label>
  <select name="service_period" id="service_period">';
  foreach ($service_periods as $service_period) {
  echo "<option value=\"$service_period\"" . (service_period() === $service_period ? " SELECTED" : "") . '>' . ucwords($service_period) . '</option>';
  }
  echo '</select>
  <a href="#" style="display:none" name="currentPeriod" id="currentPeriod">Current Period?</a>
  </div>
   
  <input type="submit" value="Update"/>
  </div></form>
  </div>';
  }
   
function placeSettings() { function placeSettings() {
global $service_periods;  
$geoerror = false; $geoerror = false;
$geoerror = !isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == ""; $geoerror = !isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == "";
   
echo '<div id="error">'; echo '<div id="error">';
if ($geoerror) { if ($geoerror) {
echo 'Sorry, but your location could not currently be detected. echo 'Sorry, but your location could not currently be detected.
Please allow location permission, wait for your location to be detected, Please allow location permission, wait for your location to be detected,
or enter an address/co-ordinates in the box below.'; or enter an address/co-ordinates in the box below.';
} }
echo '</div>'; echo '</div>';
echo '<div id="settings" data-role="collapsible" data-collapsed="' . !$geoerror . '"> echo '<div id="settings" data-role="collapsible" data-collapsed="' . !$geoerror . '">
<h3>Change Location...</h3> <h3>Change Location...</h3>
<form action="' . basename($_SERVER['PHP_SELF']) . "?" . $_SERVER['QUERY_STRING'] . '" method="post"> <form action="' . basename($_SERVER['PHP_SELF']) . "?" . $_SERVER['QUERY_STRING'] . '" method="post">
<div class="ui-body"> <div class="ui-body">
<div data-role="fieldcontain"> <div data-role="fieldcontain">
<label for="geolocate"> Current Location: </label> <label for="geolocate"> Current Location: </label>
<input type="text" id="geolocate" name="geolocate" value="' . (isset($_SESSION['lat']) && isset($_SESSION['lon']) ? $_SESSION['lat'] . "," . $_SESSION['lon'] : "Enter co-ordinates or address here") . '"/> <a href="#" style="display:none" name="here" id="here">Here?</a> <input type="text" id="geolocate" name="geolocate" value="' . (isset($_SESSION['lat']) && isset($_SESSION['lon']) ? $_SESSION['lat'] . "," . $_SESSION['lon'] : "Enter co-ordinates or address here") . '"/> <a href="#" style="display:none" name="here" id="here">Here?</a>
</div> </div>
<input type="submit" value="Update"/> <input type="submit" value="Update"/>
</div></form> </div></form>
</div>'; </div>';
} }
   
function trackEvent($category, $action, $label = "", $value = - 1) { function trackEvent($category, $action, $label = "", $value = - 1) {
if (isAnalyticsOn()) { if (isAnalyticsOn()) {
echo "\n<script> _gaq.push(['_trackEvent', '$category', '$action'" . ($label != "" ? ", '$label'" : "") . ($value != - 1 ? ", $value" : "") . "]);</script>"; echo "\n<script> _gaq.push(['_trackEvent', '$category', '$action'" . ($label != "" ? ", '$label'" : "") . ($value != - 1 ? ", $value" : "") . "]);</script>";
} }
} }
   
//stop list collapsing //stop list collapsing
function stopCompare($stopName) { function stopCompare($stopName) {
return substr(trim(preg_replace("/\(Platform.*/", "", $stopName)),0,9); return substr(trim(preg_replace("/\(Platform.*/", "", $stopName)), 0, 9);
} }
function stopGroupTitle($stopName,$stopdesc) {  
if (preg_match("/Dr |Cct |Cir |Av |St |Cr |Parade |Way |Bank /",$stopName)) { function stopGroupTitle($stopName, $stopdesc) {
$descParts = explode("<br>",$stopdesc); if (preg_match("/Dr |Cct |Cir |Av |St |Cr |Parade |Way |Bank /", $stopName)) {
return trim(str_replace("Street: ","",$descParts[0])); $descParts = explode("<br>", $stopdesc);
  return trim(str_replace("Street: ", "", $descParts[0]));
} else { } else {
return trim(preg_replace("/\(Platform.*/", "",$stopName)); return trim(preg_replace("/\(Platform.*/", "", $stopName));
} }
} }
   
function viaPointNames($tripid, $stop_sequence = "") { function viaPointNames($tripid, $stop_sequence = "") {
$viaPointNames = Array(); $viaPointNames = Array();
foreach (viaPoints($tripid, $stop_sequence) as $point) { foreach (viaPoints($tripid, $stop_sequence) as $point) {
if (strstr($point['stop_name'], "Station") if (strstr($point['stop_name'], "Station")
|| strstr($point['stop_name'], "Shops") || strstr($point['stop_name'], "Shops")
|| strstr($point['stop_name'], "CIT") || strstr($point['stop_name'], "CIT")
|| strstr($point['stop_name'], "School") || strstr($point['stop_name'], "School")
|| strstr($point['stop_name'], "University") || strstr($point['stop_name'], "University")
) { ) {
$viaPointNames[] = $point['stop_name']; $viaPointNames[] = $point['stop_name'];
} }
} }
if (sizeof($viaPointNames) > 0) { if (sizeof($viaPointNames) > 0) {
return r_implode(", ", $viaPointNames); return r_implode(", ", $viaPointNames);
} else { } else {
return ""; return "";
} }
} }
?>  
   
<?php <?php
   
/* /*
* Copyright 2010,2011 Alexander Sadleir * Copyright 2010,2011 Alexander Sadleir
   
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
   
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
$service_periods = Array( $service_periods = Array(
'sunday', 'sunday',
'saturday', 'saturday',
'weekday' 'weekday'
); );
   
function service_period($date = "") { function service_period($date = "") {
   
if (isset($_SESSION['service_period'])) if (isset($_REQUEST['service_period'])) {
return $_SESSION['service_period']; return $_REQUEST['service_period'];
  }
   
$override = getServiceOverride($date); $override = getServiceOverride($date);
if ($override['service_id']) { if (isset($override['service_id'])) {
$idParts = explode("-",$override['service_id']); return strtolower($override['service_id']);
return strtolower($idParts[2]); }
} $date = ($date != "" ? $date : time());
  $dow = date('w', $date);
switch (date('w', ($date != "" ? $date : time()))) {  
  switch ($dow) {
case 0: case 0:
return 'sunday'; return 'sunday';
case 6: case 6:
return 'saturday'; return 'saturday';
default: default:
return 'weekday'; return 'weekday';
} }
} }
function service_ids($service_period) {  
  function service_ids($service_period, $date = "") {
switch ($service_period) { switch ($service_period) {
case 'sunday': case 'sunday':
return Array("2010-TUGGSUN-Sunday-20","2010-BELCSUN-Sunday-19"); return Array("Sunday", "Sunday");
case 'saturday': case 'saturday':
return Array("2010-BELCSAT-Saturday-19","2010-TUGGSAT-Saturday-19"); return Array("Saturday", "Saturday");
default: default:
//return 'weekday'; $date = ($date != "" ? $date : time());
return Array("2010-BELCMAST-Weekday-15","2010-TUGGMAST-Weekday-14"); // school holidays
} $ymd = date('Ymd', $date);
  $dow = date('w', $date);
  if (intval($ymd) < "20120203" && $dow != 0 && $dow != 6) {
  return Array("Weekday-SchoolVacation", "Weekday-SchoolVacation");
  } else {
  return Array("Weekday", "Weekday");
  }
  }
  }
   
  function valid_service_ids() {
  return array_merge(service_ids(""), service_ids('saturday'), service_ids('sunday'));
} }
   
function midnight_seconds($time = "") { function midnight_seconds($time = "") {
// from http://www.perturb.org/display/Perlfunc__Seconds_Since_Midnight.html // from http://www.perturb.org/display/Perlfunc__Seconds_Since_Midnight.html
if ($time != "") { if ($time != "") {
return (date("G", $time) * 3600) + (date("i", $time) * 60) + date("s", $time); return (date("G", $time) * 3600) + (date("i", $time) * 60) + date("s", $time);
} }
if (isset($_SESSION['time'])) { if (isset($_SESSION['time'])) {
$time = strtotime($_SESSION['time']); $time = strtotime($_SESSION['time']);
return (date("G", $time) * 3600) + (date("i", $time) * 60) + date("s", $time); return (date("G", $time) * 3600) + (date("i", $time) * 60) + date("s", $time);
} }
return (date("G") * 3600) + (date("i") * 60) + date("s"); return (date("G") * 3600) + (date("i") * 60) + date("s");
} }
   
function midnight_seconds_to_time($seconds) { function midnight_seconds_to_time($seconds) {
if ($seconds > 0) { if ($seconds > 0) {
$midnight = mktime(0, 0, 0, date("n"), date("j"), date("Y")); $midnight = mktime(0, 0, 0, date("n"), date("j"), date("Y"));
return date("h:ia", $midnight + $seconds); return date("h:ia", $midnight + $seconds);
} else { } else {
return ""; return "";
} }
} }
   
if ($GTFSREnabled) { if ($GTFSREnabled) {
$serviceAlertCause = Array( $serviceAlertCause = Array(
"UNKNOWN_CAUSE" => "Unknown cause", "UNKNOWN_CAUSE" => "Unknown cause",
"OTHER_CAUSE" => "Other cause", "OTHER_CAUSE" => "Other cause",
"TECHNICAL_PROBLEM" => "Technical problem", "TECHNICAL_PROBLEM" => "Technical problem",
"STRIKE" => "Strike", "STRIKE" => "Strike",
"DEMONSTRATION" => "Demonstration", "DEMONSTRATION" => "Demonstration",
"ACCIDENT" => "Accident", "ACCIDENT" => "Accident",
"HOLIDAY" => "Holiday", "HOLIDAY" => "Holiday",
"WEATHER" => "Weather", "WEATHER" => "Weather",
"MAINTENANCE" => "Maintenance", "MAINTENANCE" => "Maintenance",
"CONSTRUCTION" => "Construction", "CONSTRUCTION" => "Construction",
"POLICE_ACTIVITY" => "Police activity", "POLICE_ACTIVITY" => "Police activity",
"MEDICAL_EMERGENCY" => "Medical emergency" "MEDICAL_EMERGENCY" => "Medical emergency"
); );
$serviceAlertEffect = Array( $serviceAlertEffect = Array(
"NO_SERVICE" => "No service", "NO_SERVICE" => "No service",
"REDUCED_SERVICE" => "Reduced service", "REDUCED_SERVICE" => "Reduced service",
"SIGNIFICANT_DELAYS" => "Significant delays", "SIGNIFICANT_DELAYS" => "Significant delays",
"DETOUR" => "Detour", "DETOUR" => "Detour",
"ADDITIONAL_SERVICE" => "Additional service", "ADDITIONAL_SERVICE" => "Additional service",
"MODIFIED_SERVICE" => "Modified service", "MODIFIED_SERVICE" => "Modified service",
"OTHER_EFFECT" => "Other effect", "OTHER_EFFECT" => "Other effect",
"UNKNOWN_EFFECT" => "Unknown effect", "UNKNOWN_EFFECT" => "Unknown effect",
"STOP_MOVED" => "Stop moved"); "STOP_MOVED" => "Stop moved");
   
set_include_path(get_include_path() . PATH_SEPARATOR . ($basePath . "lib/Protobuf-PHP/library/DrSlump/")); set_include_path(get_include_path() . PATH_SEPARATOR . ($basePath . "lib/Protobuf-PHP/library/DrSlump/"));
   
include_once("Protobuf.php"); include_once("Protobuf.php");
include_once("Protobuf/Message.php"); include_once("Protobuf/Message.php");
include_once("Protobuf/Registry.php"); include_once("Protobuf/Registry.php");
include_once("Protobuf/Descriptor.php"); include_once("Protobuf/Descriptor.php");
include_once("Protobuf/Field.php"); include_once("Protobuf/Field.php");
   
include_once($basePath . "lib/Protobuf-PHP/gtfs-realtime.php"); include_once($basePath . "lib/Protobuf-PHP/gtfs-realtime.php");
include_once("Protobuf/CodecInterface.php"); include_once("Protobuf/CodecInterface.php");
include_once("Protobuf/Codec/PhpArray.php"); include_once("Protobuf/Codec/PhpArray.php");
include_once("Protobuf/Codec/Binary.php"); include_once("Protobuf/Codec/Binary.php");
include_once("Protobuf/Codec/Binary/Writer.php"); include_once("Protobuf/Codec/Binary/Writer.php");
include_once("Protobuf/Codec/Json.php"); include_once("Protobuf/Codec/Json.php");
   
function getServiceAlerts($filter_class = "", $filter_id = "") { function getServiceAlerts($filter_class = "", $filter_id = "") {
/* /*
   
also need last modified epoch of client gtfs also need last modified epoch of client gtfs
   
- add,remove,patch,inform (null) - add,remove,patch,inform (null)
- stop - stop
- trip - trip
- network - network
- classes (WHERE=) - classes (WHERE=)
- route (short_name or route_id) - route (short_name or route_id)
- street - street
- stop - stop
- trip - trip
Currently support: Currently support:
network inform network inform
trip patch: stop remove trip patch: stop remove
street inform: route inform, trip inform, stop inform street inform: route inform, trip inform, stop inform
route patch: trip remove route patch: trip remove
*/ */
$fm = new transit_realtime\FeedMessage(); $current_alerts = getCurrentAlerts();
$fh = new transit_realtime\FeedHeader(); $informed_count = 0;
$fh->setGtfsRealtimeVersion(1); if (sizeof($current_alerts) > 0) {
$fh->setTimestamp(time());  
$fm->setHeader($fh); $fm = new transit_realtime\FeedMessage();
foreach (getCurrentAlerts() as $alert) { $fh = new transit_realtime\FeedHeader();
$fe = new transit_realtime\FeedEntity(); $fh->setGtfsRealtimeVersion(1);
$fe->setId($alert['id']); $fh->setTimestamp(time());
$fe->setIsDeleted(false); $fm->setHeader($fh);
$alert = new transit_realtime\Alert(); foreach ($current_alerts as $current_alert) {
$tr = new transit_realtime\TimeRange(); $affectsFilteredEntities = false;
$tr->setStart($alert['start']); $fe = new transit_realtime\FeedEntity();
$tr->setEnd($alert['end']); $fe->setId($current_alert['id']);
$alert->addActivePeriod($tr); $fe->setIsDeleted(false);
$informedEntities = getInformedAlerts($alert['id'], $_REQUEST['filter_class'], $_REQUEST['filter_id']); $alert = new transit_realtime\Alert();
if (sizeof($informedEntities) > 0) { $tr = new transit_realtime\TimeRange();
$informed = Array(); $tr->setStart($current_alert['start']);
$es = new transit_realtime\EntitySelector(); $tr->setEnd($current_alert['end']);
if ($informedEntity['informed_class'] == "agency") { $alert->addActivePeriod($tr);
$es->setAgencyId($informedEntity['informed_id']); $informedEntities = getInformedAlerts($current_alert['id'], $filter_class, $filter_id);
} if (sizeof($informedEntities) > 0) {
if ($informedEntity['informed_class'] == "stop") {  
$es->setStopId($informedEntity['informed_id']); $affectsFilteredEntities = true;
} foreach ($informedEntities as $informedEntity) {
if ($informedEntity['informed_class'] == "route") { $informed_count++;
$es->setRouteId($informedEntity['informed_id']); $informed = Array();
} $es = new transit_realtime\EntitySelector();
if ($informedEntity['informed_class'] == "trip") { if ($informedEntity['informed_class'] == "agency") {
$td = new transit_realtime\TripDescriptor(); $es->setAgencyId($informedEntity['informed_id']);
$td->setTripId($informedEntity['informed_id']); }
$es->setTrip($td); if ($informedEntity['informed_class'] == "stop") {
} $es->setStopId($informedEntity['informed_id']);
$alert->addInformedEntity($es); }
} if ($informedEntity['informed_class'] == "route") {
$alert->setCause(constant("transit_realtime\Alert\Cause::" . $alert['cause'])); $es->setRouteId($informedEntity['informed_id']);
$alert->setEffect(constant("transit_realtime\Alert\Effect::" . $alert['effect'])); }
$tsUrl = new transit_realtime\TranslatedString(); if ($informedEntity['informed_class'] == "trip") {
$tUrl = new transit_realtime\TranslatedString\Translation(); $td = new transit_realtime\TripDescriptor();
$tUrl->setText($alert['url']); $td->setTripId($informedEntity['informed_id']);
$tUrl->setLanguage("en"); $es->setTrip($td);
$tsUrl->addTranslation($tUrl); }
$alert->setUrl($tsUrl); $alert->addInformedEntity($es);
$tsHeaderText = new transit_realtime\TranslatedString(); }
$tHeaderText = new transit_realtime\TranslatedString\Translation(); }
$tHeaderText->setText($alert['header']); if ($current_alert['cause'] != "") {
$tHeaderText->setLanguage("en"); $alert->setCause(constant("transit_realtime\Alert\Cause::" . $current_alert['cause']));
$tsHeaderText->addTranslation($tHeaderText); }
$alert->setHeaderText($tsHeaderText); if ($current_alert['effect'] != "") {
$tsDescriptionText = new transit_realtime\TranslatedString(); $alert->setEffect(constant("transit_realtime\Alert\Effect::" . $current_alert['effect']));
$tDescriptionText = new transit_realtime\TranslatedString\Translation(); }
$tDescriptionText->setText($alert['description']); if ($current_alert['url'] != "") {
$tDescriptionText->setLanguage("en"); $tsUrl = new transit_realtime\TranslatedString();
$tsDescriptionText->addTranslation($tDescriptionText); $tUrl = new transit_realtime\TranslatedString\Translation();
$alert->setDescriptionText($tsDescriptionText); $tUrl->setText($current_alert['url']);
$fe->setAlert($alert); $tUrl->setLanguage("en");
$fm->addEntity($fe); $tsUrl->addTranslation($tUrl);
  $alert->setUrl($tsUrl);
  }
  if ($current_alert['header'] != "") {
  $tsHeaderText = new transit_realtime\TranslatedString();
  $tHeaderText = new transit_realtime\TranslatedString\Translation();
  $tHeaderText->setText($current_alert['header']);
  $tHeaderText->setLanguage("en");
  $tsHeaderText->addTranslation($tHeaderText);
  $alert->setHeaderText($tsHeaderText);
  }
  if ($current_alert['description'] != "") {
  $tsDescriptionText = new transit_realtime\TranslatedString();
  $tDescriptionText = new transit_realtime\TranslatedString\Translation();
  $tDescriptionText->setText(trim($current_alert['description']));
  $tDescriptionText->setLanguage("en");
  $tsDescriptionText->addTranslation($tDescriptionText);
  $alert->setDescriptionText($tsDescriptionText);
  }
  $fe->setAlert($alert);
  if ($affectsFilteredEntities) {
  $fm->addEntity($fe);
  }
  }
  if ($informed_count > 0) {
  return $fm;
  } else {
  return null;
  }
  } else
  return null;
  }
   
  function getServiceAlertsAsArray($filter_class = "", $filter_id = "") {
   
  $alerts = getServiceAlerts($filter_class, $filter_id);
  if ($alerts != null) {
  $codec = new DrSlump\Protobuf\Codec\PhpArray();
   
  return $codec->encode($alerts);
  } else {
  return null;
} }
return $fm;  
}  
   
function getServiceAlertsAsArray($filter_class = "", $filter_id = "") {  
$codec = new DrSlump\Protobuf\Codec\PhpArray();  
return $codec->encode(getServiceAlerts($filter_class, $filter_id));  
} }
   
function getServiceAlertsAsBinary($filter_class = "", $filter_id = "") { function getServiceAlertsAsBinary($filter_class = "", $filter_id = "") {
$codec = new DrSlump\Protobuf\Codec\Binary(); $codec = new DrSlump\Protobuf\Codec\Binary();
return $codec->encode(getServiceAlerts($filter_class, $filter_id)); return $codec->encode(getServiceAlerts($filter_class, $filter_id));
} }
   
function getServiceAlertsAsJSON($filter_class = "", $filter_id = "") { function getServiceAlertsAsJSON($filter_class = "", $filter_id = "") {
$codec = new DrSlump\Protobuf\Codec\Json(); $codec = new DrSlump\Protobuf\Codec\Json();
return $codec->encode(getServiceAlerts($filter_class, $filter_id)); return $codec->encode(getServiceAlerts($filter_class, $filter_id));
} }
   
function getServiceAlertsByClass() { function getServiceAlertsByClass() {
$return = Array(); $return = Array();
$alerts = getServiceAlertsAsArray("", ""); $alerts = getServiceAlertsAsArray("", "");
foreach ($alerts['entities'] as $entity) { foreach ($alerts['entities'] as $entity) {
foreach ($entity['informed'] as $informed) { foreach ($entity['informed'] as $informed) {
foreach ($informed as $key => $value) { foreach ($informed as $key => $value) {
if (strpos("_id", $key) > 0) { if (strpos("_id", $key) > 0) {
$parts = explode($key); $parts = explode($key);
$class = $parts[0]; $class = $parts[0];
$id = $value; $id = $value;
} }
} }
$return[$class][$id][] = $entity; $return[$class][$id][] = $entity;
} }
} }
} }
   
function getTripUpdates($filter_class = "", $filter_id = "") { function getTripUpdates($filter_class = "", $filter_id = "") {
$fm = new transit_realtime\FeedMessage(); $fm = new transit_realtime\FeedMessage();
$fh = new transit_realtime\FeedHeader(); $fh = new transit_realtime\FeedHeader();
$fh->setGtfsRealtimeVersion(1); $fh->setGtfsRealtimeVersion(1);
$fh->setTimestamp(time()); $fh->setTimestamp(time());
$fm->setHeader($fh); $fm->setHeader($fh);
foreach (getCurrentAlerts() as $alert) { foreach (getCurrentAlerts() as $alert) {
$informedEntities = getInformedAlerts($alert['id'], $_REQUEST['filter_class'], $_REQUEST['filter_id']); $informedEntities = getInformedAlerts($alert['id'], $_REQUEST['filter_class'], $_REQUEST['filter_id']);
$stops = Array(); $stops = Array();
$routestrips = Array(); $routestrips = Array();
if (sizeof($informedEntities) > 0) { if (sizeof($informedEntities) > 0) {
if ($informedEntity['informed_class'] == "stop" && $informed["x-action"] == "remove") { if ($informedEntity['informed_class'] == "stop" && $informed["x-action"] == "remove") {
$stops[] = $informedEntity['informed_id']; $stops[] = $informedEntity['informed_id'];
} }
if (($informedEntity['informed_class'] == "route" || $informedEntity['informed_class'] == "trip") && $informed["x-action"] == "patch") { if (($informedEntity['informed_class'] == "route" || $informedEntity['informed_class'] == "trip") && $informed["x-action"] == "patch") {
$routestrips[] = Array("id" => $informedEntity['informed_id'], $routestrips[] = Array("id" => $informedEntity['informed_id'],
"type" => $informedEntity['informed_class']); "type" => $informedEntity['informed_class']);
} }
} }
foreach ($routestrips as $routetrip) { foreach ($routestrips as $routetrip) {
$fe = new transit_realtime\FeedEntity(); $fe = new transit_realtime\FeedEntity();
$fe->setId($alert['id'] . $routetrip['id']); $fe->setId($alert['id'] . $routetrip['id']);
$fe->setIsDeleted(false); $fe->setIsDeleted(false);
$tu = new transit_realtime\TripUpdate(); $tu = new transit_realtime\TripUpdate();
$td = new transit_realtime\TripDescriptor(); $td = new transit_realtime\TripDescriptor();
if ($routetrip['type'] == "route") { if ($routetrip['type'] == "route") {
$td->setRouteId($routetrip['id']); $td->setRouteId($routetrip['id']);
} else if ($routetrip['type'] == "trip") { } else if ($routetrip['type'] == "trip") {
$td->setTripId($routetrip['id']); $td->setTripId($routetrip['id']);
} }
$tu->setTrip($td); $tu->setTrip($td);
foreach ($stops as $stop) { foreach ($stops as $stop) {
$stu = new transit_realtime\TripUpdate\StopTimeUpdate(); $stu = new transit_realtime\TripUpdate\StopTimeUpdate();
$stu->setStopId($stop); $stu->setStopId($stop);
$stu->setScheduleRelationship(transit_realtime\TripUpdate\StopTimeUpdate\ScheduleRelationship::SKIPPED); $stu->setScheduleRelationship(transit_realtime\TripUpdate\StopTimeUpdate\ScheduleRelationship::SKIPPED);
$tu->addStopTimeUpdate($stu); $tu->addStopTimeUpdate($stu);
} }
$fe->setTripUpdate($tu); $fe->setTripUpdate($tu);
$fm->addEntity($fe); $fm->addEntity($fe);
} }
} }
return $fm; return $fm;
} }
   
function getTripUpdatesAsArray($filter_class = "", $filter_id = "") { function getTripUpdatesAsArray($filter_class = "", $filter_id = "") {
$codec = new DrSlump\Protobuf\Codec\PhpArray(); $codec = new DrSlump\Protobuf\Codec\PhpArray();
return $codec->encode(getTripUpdates($filter_class, $filter_id)); return $codec->encode(getTripUpdates($filter_class, $filter_id));
} }
   
function getTripUpdatesAsBinary($filter_class = "", $filter_id = "") { function getTripUpdatesAsBinary($filter_class = "", $filter_id = "") {
$codec = new DrSlump\Protobuf\Codec\Binary(); $codec = new DrSlump\Protobuf\Codec\Binary();
return $codec->encode(getTripUpdates($filter_class, $filter_id)); return $codec->encode(getTripUpdates($filter_class, $filter_id));
} }
   
function getTripUpdatesAsJSON($filter_class = "", $filter_id = "") { function getTripUpdatesAsJSON($filter_class = "", $filter_id = "") {
$codec = new DrSlump\Protobuf\Codec\Json(); $codec = new DrSlump\Protobuf\Codec\Json();
return $codec->encode(getTripUpdates($filter_class, $filter_id)); return $codec->encode(getTripUpdates($filter_class, $filter_id));
} }
   
} }
?>  
   
<?php <?php
   
/* /*
* Copyright 2010,2011 Alexander Sadleir * Copyright 2010,2011 Alexander Sadleir
   
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
   
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
   
date_default_timezone_set('Australia/ACT'); date_default_timezone_set('Australia/ACT');
$debugOkay = Array( $debugOkay = Array(
"session", "session",
"json", "json",
"phperror", "phperror",
"awsotp", "awsotp",
//"squallotp", //"squallotp",
//"vanilleotp", //"vanilleotp",
"database", "database",
"other" "other"
); );
$GTFSREnabled = true; $GTFSREnabled = true;
$cloudmadeAPIkey = "daa03470bb8740298d4b10e3f03d63e6"; $cloudmadeAPIkey = "daa03470bb8740298d4b10e3f03d63e6";
$googleMapsAPIkey = "ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q"; $googleMapsAPIkey = "ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q";
$otpAPIurl = 'http://localhost:8080/opentripplanner-api-webapp/'; $otpAPIurl = 'http://localhost:8080/opentripplanner-api-webapp/';
if (isDebug("awsotp") || php_uname('n') == "maxious.xen.prgmr.com" || strstr(php_uname('n'),"actbus")) { if (isDebug("awsotp") || php_uname('n') == "maxious.xen.prgmr.com" || strstr(php_uname('n'),"actbus")) {
$otpAPIurl = 'http://bus-main.lambdacomplex.org:8080/opentripplanner-api-webapp/'; $otpAPIurl = 'http://bus-main.lambdacomplex.org:8080/opentripplanner-api-webapp/';
} }
if (isDebug("dotcloudotp") || php_uname('n') == "actbus-www") { if (isDebug("dotcloudotp") || php_uname('n') == "actbus-www") {
$otpAPIurl = 'http://otp.actbus.dotcloud.com/opentripplanner-api-webapp/'; $otpAPIurl = 'http://otp.actbus.dotcloud.com/opentripplanner-api-webapp/';
} }
if (isDebug("squallotp")) { if (isDebug("squallotp")) {
$otpAPIurl = 'http://10.0.1.108:5080/opentripplanner-api-webapp/'; $otpAPIurl = 'http://10.0.1.108:5080/opentripplanner-api-webapp/';
} }
if (isDebug("vanilleotp")) { if (isDebug("vanilleotp")) {
$otpAPIurl = 'http://10.0.1.135:8080/opentripplanner-api-webapp/'; $otpAPIurl = 'http://10.0.1.135:8080/opentripplanner-api-webapp/';
} }
if (isDebug("phperror")) if (isDebug("phperror"))
error_reporting(E_ALL ^ E_NOTICE); error_reporting(E_ALL ^ E_NOTICE);
$basePath = ""; $basePath = "";
if (strstr($_SERVER['PHP_SELF'], "labs/") if (strstr($_SERVER['PHP_SELF'], "labs/")
|| strstr($_SERVER['PHP_SELF'], "myway/") || strstr($_SERVER['PHP_SELF'], "myway/")
|| strstr($_SERVER['PHP_SELF'], "lib/") || strstr($_SERVER['PHP_SELF'], "lib/")
|| strstr($_SERVER['PHP_SELF'], "geo/") || strstr($_SERVER['PHP_SELF'], "geo/")
|| strstr($_SERVER['PHP_SELF'], "include/") || strstr($_SERVER['PHP_SELF'], "include/")
|| strstr($_SERVER['PHP_SELF'], "servicealerts/")) || strstr($_SERVER['PHP_SELF'], "rtpis/")) {
$basePath = "../"; $basePath = "../";
  }
   
function isDebugServer() { function isDebugServer() {
return php_sapi_name() == "cli" || strstr(php_uname('n'),"actbus") || isset($_SERVER['SERVER_NAME']) && ( $_SERVER['SERVER_NAME'] == "azusa" || $_SERVER['SERVER_NAME'] == "vanille" return php_sapi_name() == "cli" || strstr(php_uname('n'),"actbus") || isset($_SERVER['SERVER_NAME']) && ( $_SERVER['SERVER_NAME'] == "azusa" || $_SERVER['SERVER_NAME'] == "vanille"
|| $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" || $_SERVER['SERVER_NAME'] == "192.168.1.8"); || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" || $_SERVER['SERVER_NAME'] == "192.168.1.8" || $_SERVER['SERVER_NAME'] == "192.168.178.24");
  }
   
  if (isset($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'] == "maxious.xen.prgmr.com") {
  // Set the exception handler
  require $basePath."/lib/amon-php/amon.php";
  Amon::setup_exception_handler();
} }
   
include_once ("common-geo.inc.php"); include_once ("common-geo.inc.php");
include_once ("common-net.inc.php"); include_once ("common-net.inc.php");
include_once ("common-transit.inc.php"); include_once ("common-transit.inc.php");
if (!strstr($_SERVER['PHP_SELF'], "feedback")) { if (!strstr($_SERVER['PHP_SELF'], "feedback")) {
include_once ("common-db.inc.php"); include_once ("common-db.inc.php");
} }
   
include_once ("common-request.inc.php"); include_once ("common-request.inc.php");
include_once ("common-session.inc.php"); include_once ("common-session.inc.php");
include_once ("common-auth.inc.php"); include_once ("common-auth.inc.php");
include_once ("common-template.inc.php"); include_once ("common-template.inc.php");
   
function isAnalyticsOn() { function isAnalyticsOn() {
$user_agent = $_SERVER['HTTP_USER_AGENT']; $user_agent = $_SERVER['HTTP_USER_AGENT'];
return !isDebugServer() && !preg_match('/cloudkick/i', $user_agent) && !preg_match('/googlebot/i', $user_agent) && return !isDebugServer() && !preg_match('/cloudkick/i', $user_agent) && !preg_match('/googlebot/i', $user_agent) &&
!preg_match('/baidu/i', $user_agent); !preg_match('/baidu/i', $user_agent);
} }
   
function isDebug($debugReason = "other") { function isDebug($debugReason = "other") {
global $debugOkay; global $debugOkay;
return in_array($debugReason, $debugOkay, false) && isDebugServer(); return in_array($debugReason, $debugOkay, false) && isDebugServer();
} }
   
function debug($msg, $debugReason = "other") { function debug($msg, $debugReason = "other") {
if (isDebug($debugReason)) if (isDebug($debugReason))
echo "\n<!-- " . date(DATE_RFC822) . "\n $msg -->\n"; echo "\n<!-- " . date(DATE_RFC822) . "\n $msg -->\n";
} }
function isIOSDevice() { function isIOSDevice() {
return strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad'); return strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad');
} }
function isJQueryMobileDevice() { function isJQueryMobileDevice() {
// http://forum.jquery.com/topic/what-is-the-best-way-to-detect-all-useragents-which-can-handle-jquery-mobile#14737000002087897 // http://forum.jquery.com/topic/what-is-the-best-way-to-detect-all-useragents-which-can-handle-jquery-mobile#14737000002087897
$user_agent = $_SERVER['HTTP_USER_AGENT']; $user_agent = $_SERVER['HTTP_USER_AGENT'];
return preg_match('/iphone/i', $user_agent) || preg_match('/android/i', $user_agent) || preg_match('/webos/i', $user_agent) || preg_match('/ios/i', $user_agent) || preg_match('/bada/i', $user_agent) || preg_match('/maemo/i', $user_agent) || preg_match('/meego/i', $user_agent) || preg_match('/fennec/i', $user_agent) || (preg_match('/symbian/i', $user_agent) && preg_match('/s60/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/symbian/i', $user_agent) && preg_match('/platform/i', $user_agent) && $browser['majorver'] >= 3) || (preg_match('/blackberry/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/opera mobile/i', $user_agent) && $browser['majorver'] >= 10) || (preg_match('/opera mini/i', $user_agent) && $browser['majorver'] >= 5); return preg_match('/iphone/i', $user_agent) || preg_match('/android/i', $user_agent) || preg_match('/webos/i', $user_agent) || preg_match('/ios/i', $user_agent) || preg_match('/bada/i', $user_agent) || preg_match('/maemo/i', $user_agent) || preg_match('/meego/i', $user_agent) || preg_match('/fennec/i', $user_agent) || (preg_match('/symbian/i', $user_agent) && preg_match('/s60/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/symbian/i', $user_agent) && preg_match('/platform/i', $user_agent) && $browser['majorver'] >= 3) || (preg_match('/blackberry/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/opera mobile/i', $user_agent) && $browser['majorver'] >= 10) || (preg_match('/opera mini/i', $user_agent) && $browser['majorver'] >= 5);
} }
   
   
function array_flatten($a, $f = array()) { function array_flatten($a, $f = array()) {
if (!$a || !is_array($a)) if (!$a || !is_array($a))
return ''; return '';
foreach ($a as $k => $v) { foreach ($a as $k => $v) {
if (is_array($v)) if (is_array($v))
$f = array_flatten($v, $f); $f = array_flatten($v, $f);
else else
$f[$k] = $v; $f[$k] = $v;
} }
return $f; return $f;
} }
   
function remove_spaces($string) { function remove_spaces($string) {
return str_replace(' ', '', $string); return str_replace(' ', '', $string);
} }
   
function object2array($object) { function object2array($object) {
if (is_object($object)) { if (is_object($object)) {
foreach ($object as $key => $value) { foreach ($object as $key => $value) {
$array[$key] = $value; $array[$key] = $value;
} }
} else { } else {
$array = $object; $array = $object;
} }
return $array; return $array;
} }
   
function startsWith($haystack, $needle, $case = true) { function startsWith($haystack, $needle, $case = true) {
if ($case) { if ($case) {
return (strcmp(substr($haystack, 0, strlen($needle)), $needle) === 0); return (strcmp(substr($haystack, 0, strlen($needle)), $needle) === 0);
} }
return (strcasecmp(substr($haystack, 0, strlen($needle)), $needle) === 0); return (strcasecmp(substr($haystack, 0, strlen($needle)), $needle) === 0);
} }
   
function endsWith($haystack, $needle, $case = true) { function endsWith($haystack, $needle, $case = true) {
if ($case) { if ($case) {
return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)), $needle) === 0); return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)), $needle) === 0);
} }
return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)), $needle) === 0); return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)), $needle) === 0);
} }
   
function sksort(&$array, $subkey = "id", $sort_ascending = false) { function sksort(&$array, $subkey = "id", $sort_ascending = false) {
if (count($array)) if (count($array))
$temp_array[key($array)] = array_shift($array); $temp_array[key($array)] = array_shift($array);
foreach ($array as $key => $val) { foreach ($array as $key => $val) {
$offset = 0; $offset = 0;
$found = false; $found = false;
foreach ($temp_array as $tmp_key => $tmp_val) { foreach ($temp_array as $tmp_key => $tmp_val) {
if (!$found and strtolower($val[$subkey]) > strtolower($tmp_val[$subkey])) { if (!$found and strtolower($val[$subkey]) > strtolower($tmp_val[$subkey])) {
$temp_array = array_merge((array) array_slice($temp_array, 0, $offset), array( $temp_array = array_merge((array) array_slice($temp_array, 0, $offset), array(
$key => $val $key => $val
), array_slice($temp_array, $offset)); ), array_slice($temp_array, $offset));
$found = true; $found = true;
} }
$offset++; $offset++;
} }
if (!$found) if (!$found)
$temp_array = array_merge($temp_array, array( $temp_array = array_merge($temp_array, array(
$key => $val $key => $val
)); ));
} }
if ($sort_ascending) if ($sort_ascending)
$array = array_reverse($temp_array); $array = array_reverse($temp_array);
else else
$array = $temp_array; $array = $temp_array;
} }
   
function sktimesort(&$array, $subkey = "id", $sort_ascending = false) { function sktimesort(&$array, $subkey = "id", $sort_ascending = false) {
if (count($array)) if (count($array))
$temp_array[key($array)] = array_shift($array); $temp_array[key($array)] = array_shift($array);
foreach ($array as $key => $val) { foreach ($array as $key => $val) {
$offset = 0; $offset = 0;
$found = false; $found = false;
foreach ($temp_array as $tmp_key => $tmp_val) { foreach ($temp_array as $tmp_key => $tmp_val) {
if (!$found and strtotime($val[$subkey]) > strtotime($tmp_val[$subkey])) { if (!$found and strtotime($val[$subkey]) > strtotime($tmp_val[$subkey])) {
$temp_array = array_merge((array) array_slice($temp_array, 0, $offset), array( $temp_array = array_merge((array) array_slice($temp_array, 0, $offset), array(
$key => $val $key => $val
), array_slice($temp_array, $offset)); ), array_slice($temp_array, $offset));
$found = true; $found = true;
} }
$offset++; $offset++;
} }
if (!$found) if (!$found)
$temp_array = array_merge($temp_array, array( $temp_array = array_merge($temp_array, array(
$key => $val $key => $val
)); ));
} }
if ($sort_ascending && isset($temp_array)) if ($sort_ascending && isset($temp_array))
$array = array_reverse($temp_array); $array = array_reverse($temp_array);
else else
$array = $temp_array; $array = $temp_array;
} }
   
function r_implode($glue, $pieces) { function r_implode($glue, $pieces) {
foreach ($pieces as $r_pieces) { foreach ($pieces as $r_pieces) {
if (is_array($r_pieces)) { if (is_array($r_pieces)) {
$retVal[] = r_implode($glue, $r_pieces); $retVal[] = r_implode($glue, $r_pieces);
} else { } else {
$retVal[] = $r_pieces; $retVal[] = $r_pieces;
} }
} }
return implode($glue, $retVal); return implode($glue, $retVal);
} }
   
   
?>  
   
<?php <?php
   
/* /*
* Copyright 2010,2011 Alexander Sadleir * Copyright 2010,2011 Alexander Sadleir
   
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
   
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
   
function getRoute($routeID) { function getRoute($routeID) {
global $conn; global $conn;
$query = "Select * from routes where route_id = :routeID LIMIT 1"; $query = "Select * from routes where route_id = :routeID LIMIT 1";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":routeID", $routeID); $query->bindParam(":routeID", $routeID);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetch(PDO :: FETCH_ASSOC); return $query->fetch(PDO :: FETCH_ASSOC);
} }
   
function getRoutesByShortName($routeShortName) { function getRoutesByShortName($routeShortName) {
global $conn; global $conn;
$query = "Select distinct route_id, route_short_name from routes where route_short_name = :routeShortName"; $query = "Select distinct route_id, route_short_name from routes where route_short_name = :routeShortName";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":routeShortName", $routeShortName); $query->bindParam(":routeShortName", $routeShortName);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function getRouteHeadsigns($routeID) { function getRouteHeadsigns($routeID) {
global $conn; global $conn;
$query = "select distinct stops.stop_name, trip_headsign,direction_id from routes join trips on trips.route_id = routes.route_id $query = "select stops.stop_name, trip_headsign, direction_id,max(service_id) as service_id, count(*)
join stop_times on stop_times.trip_id = trips.trip_id join stops on stop_times.stop_id = stops.stop_id where trips.route_id = :routeID and stop_times.stop_sequence = 1"; from routes join trips on trips.route_id = routes.route_id
  join stop_times on stop_times.trip_id = trips.trip_id join stops on
  stop_times.stop_id = stops.stop_id where trips.route_id = :routeID
  and stop_times.stop_sequence = 1 group by stops.stop_name, trip_headsign, direction_id having count(*) > 2";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":routeID", $routeID); $query->bindParam(":routeID", $routeID);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); $results = $query->fetchAll();
} if (is_array($results)) {
  return $results;
  } else {
  return Array($results);
  }
  }
  function getRouteDescription($routeID, $directionID) {
  $trip = getRouteNextTrip($routeID, $directionID);
  $start = getTripStartingPoint($trip['trip_id']);
  $end = getTripDestination($trip['trip_id']);
  return "From ".$start['stop_name']." to ".$end['stop_name'];
  }
function getRouteByFullName($routeFullName) { function getRouteByFullName($routeFullName) {
global $conn; global $conn;
$query = "Select * from routes where route_short_name||route_long_name = :routeFullName LIMIT 1"; $query = "Select * from routes where route_short_name||route_long_name = :routeFullName LIMIT 1";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":routeFullName", $routeFullName); $query->bindParam(":routeFullName", $routeFullName);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetch(PDO :: FETCH_ASSOC); return $query->fetch(PDO :: FETCH_ASSOC);
} }
   
function getRoutes() { function getRoutes() {
global $conn; global $conn;
$query = "Select * from routes order by route_short_name;"; $query = "Select * from routes order by route_short_name;";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function getRoutesByNumber($routeNumber = "") {  
global $conn;  
if ($routeNumber != "") {  
$query = "Select distinct routes.route_id,routes.route_short_name,routes.route_long_name,service_id from routes join trips on trips.route_id =  
routes.route_id join stop_times on stop_times.trip_id = trips.trip_id  
where route_short_name = :routeNumber OR route_short_name LIKE :routeNumber2 order by route_short_name;";  
} else {  
$query = "SELECT DISTINCT route_short_name from routes order by route_short_name";  
}  
debug($query, "database");  
$query = $conn->prepare($query);  
if ($routeNumber != "") {  
$query->bindParam(":routeNumber", $routeNumber);  
$routeNumber2 = "% " . $routeNumber;  
$query->bindParam(":routeNumber2", $routeNumber2);  
}  
$query->execute();  
if (!$query) {  
databaseError($conn->errorInfo());  
return Array();  
}  
return $query->fetchAll();  
}  
   
function getRoutesByNumberSeries($routeNumberSeries = "") { function getRoutesByNumberSeries($routeNumberSeries = "") {
global $conn; global $conn;
if (strlen($routeNumberSeries) == 1) { if (strlen($routeNumberSeries) == 1) {
return getRoutesByNumber($routeNumberSeries); return getRoute($routeNumberSeries);
} }
$seriesMin = substr($routeNumberSeries, 0, -1) . "0"; $seriesMin = substr($routeNumberSeries, 0, -1) . "0";
$seriesMax = substr($routeNumberSeries, 0, -1) . "9"; $seriesMax = substr($routeNumberSeries, 0, -1) . "9";
$query = "Select distinct routes.route_id,routes.route_short_name,routes.route_long_name,service_id from routes join trips on trips.route_id = $query = "Select distinct routes.route_id,routes.route_short_name,routes.route_long_name,service_id from routes join trips on trips.route_id =
routes.route_id join stop_times on stop_times.trip_id = trips.trip_id where to_number(route_short_name, 'FM999') between :seriesMin and :seriesMax OR route_short_name LIKE :routeNumberSeries order by route_short_name;"; routes.route_id join stop_times on stop_times.trip_id = trips.trip_id where to_number(route_short_name, 'FM999') between :seriesMin and :seriesMax OR route_short_name LIKE :routeNumberSeries order by route_short_name;";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":seriesMin", $seriesMin); $query->bindParam(":seriesMin", $seriesMin);
$query->bindParam(":seriesMax", $seriesMax); $query->bindParam(":seriesMax", $seriesMax);
$routeNumberSeries = "% " . substr($routeNumberSeries, 0, -1) . "%"; $routeNumberSeries = "% " . substr($routeNumberSeries, 0, -1) . "%";
$query->bindParam(":routeNumberSeries", $routeNumberSeries); $query->bindParam(":routeNumberSeries", $routeNumberSeries);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function getRouteNextTrip($routeID) { function getRouteNextTrip($routeID, $directionID) {
global $conn; global $conn;
$query = "select * from routes join trips on trips.route_id = routes.route_id  
join stop_times on stop_times.trip_id = trips.trip_id where $query = "select routes.route_id,routes.route_url,direction_id,trips.trip_id,trip_headsign,departure_time,service_id from routes join trips on trips.route_id = routes.route_id
arrival_time > :currentTime and routes.route_id = :routeID order by join stop_times on stop_times.trip_id = trips.trip_id where arrival_time between :currentTime and :futureTime
  and routes.route_id = :routeID and trips.direction_id = :directionID order by
arrival_time limit 1"; arrival_time limit 1";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":currentTime", current_time()); $query->bindParam(":currentTime", current_time());
  $futureTime = current_time(strtotime(current_time() ." +2h"));
  if (date("h",strtotime(current_time()) > 22)) $futureTime = "23:59:59";
  $query->bindParam(":futureTime", $futureTime);
$query->bindParam(":routeID", $routeID); $query->bindParam(":routeID", $routeID);
$query->execute(); $query->bindParam(":directionID", $directionID);
  $query->execute();
  databaseError($conn->errorInfo());
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
$r = $query->fetch(PDO :: FETCH_ASSOC); $r = $query->fetch(PDO :: FETCH_ASSOC);
  return $r;
// past last trip of the day special case }
if (sizeof($r) < 16) {  
$query = "select * from routes join trips on trips.route_id = routes.route_id function getRouteFirstTrip($routeID,$directionID) {
join stop_times on stop_times.trip_id = trips.trip_id where routes.route_id = :routeID order by global $conn;
   
  $query = "select * from routes join trips on trips.route_id = routes.route_id
  join stop_times on stop_times.trip_id = trips.trip_id where routes.route_id = :routeID
  and trips.direction_id = :directionID order by
arrival_time DESC limit 1"; arrival_time DESC limit 1";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":routeID", $routeID); $query->bindParam(":routeID", $routeID);
   
  $query->bindParam(":directionID", $directionID);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
   
$r = $query->fetch(PDO :: FETCH_ASSOC); $r = $query->fetch(PDO :: FETCH_ASSOC);
} return $r;
return $r; }
}  
  function getRouteAtStop($routeID, $directionID, $stop_id) {
function getRouteAtStop($routeID, $stop_id) { $nextTrip = getRouteNextTrip($routeID, $directionID);
$nextTrip = getRouteNextTrip($routeID);  
if ($nextTrip['trip_id']) { if ($nextTrip['trip_id']) {
foreach (getTripStopTimes($nextTrip['trip_id']) as $tripStop) { foreach (getTripStopTimes($nextTrip['trip_id']) as $tripStop) {
if ($tripStop['stop_id'] == $stop_id) if ($tripStop['stop_id'] == $stop_id)
return $tripStop; return $tripStop;
} }
} }
return Array(); return Array();
} }
   
function getRouteTrips($routeID) { function getRouteTrips($routeID, $directionID = "", $service_period = "") {
global $conn;  
$query = "select routes.route_id,trips.trip_id,service_id,arrival_time, stop_id, stop_sequence from routes join trips on trips.route_id = routes.route_id  
join stop_times on stop_times.trip_id = trips.trip_id where routes.route_id = :routeID and stop_sequence = '1' order by  
arrival_time ";  
debug($query, "database");  
$query = $conn->prepare($query);  
$query->bindParam(":routeID", $routeID);  
$query->execute();  
if (!$query) {  
databaseError($conn->errorInfo());  
return Array();  
}  
return $query->fetchAll();  
}  
   
function getRoutesByDestination($destination = "", $service_period = "") {  
global $conn; global $conn;
if ($service_period == "") if ($service_period == "")
$service_period = service_period(); $service_period = service_period();
  $service_ids = service_ids($service_period);
  $sidA = $service_ids[0];
  $sidB = $service_ids[1];
  $directionSQL = "";
  if ($directionID != "")
  $directionSQL = " and direction_id = :directionID ";
  $query = "select routes.route_id,trips.trip_id,service_id,arrival_time, stop_id, stop_sequence from routes join trips on trips.route_id = routes.route_id
  join stop_times on stop_times.trip_id = trips.trip_id where (service_id=:service_periodA OR service_id=:service_periodB)
  AND (routes.route_id = :routeID) " . $directionSQL . " and stop_sequence = '1' order by
  arrival_time ";
  debug($query, "database");
  $query = $conn->prepare($query);
  $query->bindParam(":routeID", $routeID);
  $query->bindParam(":service_periodA", $sidA);
  $query->bindParam(":service_periodB", $sidB);
  if ($directionSQL != "")
  $query->bindParam(":directionID", $directionID);
  $query->execute();
  if (!$query) {
  databaseError($conn->errorInfo());
  return Array();
  }
  return $query->fetchAll();
  }
   
  function getRoutesByDestination($destination = "", $service_period = "") {
  global $conn;
  if ($service_period == "")
  $service_period = service_period();
  $service_ids = service_ids($service_period);
  $sidA = $service_ids[0];
  $sidB = $service_ids[1];
if ($destination != "") { if ($destination != "") {
$query = "SELECT DISTINCT trips.route_id,route_short_name,route_long_name, service_id /* $query = "SELECT DISTINCT trips.route_id,route_short_name,route_long_name, service_id
FROM stop_times join trips on trips.trip_id = FROM stop_times join trips on trips.trip_id =
stop_times.trip_id join routes on trips.route_id = routes.route_id stop_times.trip_id join routes on trips.route_id = routes.route_id
WHERE route_long_name = :destination AND service_id=:service_period order by route_short_name"; WHERE route_long_name = :destination AND (service_id=:service_periodA OR service_id=:service_periodB)
  order by route_short_name";*/
  $query = "select route_id, direction_id, stop_name, b.trip_id, b.stop_sequence from (select route_id, direction_id, max(stop_sequence) as stop_sequence, max(a.trip_id) as trip_id from stop_times inner join (SELECT route_id, direction_id, max(trip_id) as trip_id
  from trips group by route_id,direction_id) as a on stop_times.trip_id = a.trip_id group by route_id, direction_id) as b inner join stop_times on b.trip_id = stop_times.trip_id inner join stops on stop_times.stop_id = stops.stop_id where stop_times.stop_sequence = b.stop_sequence and stop_name = :destination order by route_id;";
} else { } else {
$query = "SELECT DISTINCT route_long_name $query = "select stop_name from (select route_id, direction_id, max(stop_sequence) as stop_sequence, max(a.trip_id) as trip_id from stop_times inner join (SELECT route_id, direction_id, max(trip_id) as trip_id
FROM stop_times join trips on trips.trip_id = from trips group by route_id,direction_id) as a on stop_times.trip_id = a.trip_id group by route_id, direction_id) as b inner join stop_times on b.trip_id = stop_times.trip_id inner join stops on stop_times.stop_id = stops.stop_id where stop_times.stop_sequence = b.stop_sequence group by stop_name order by stop_name;";
stop_times.trip_id join routes on trips.route_id = routes.route_id }
WHERE service_id= :service_period order by route_long_name"; debug($query, "database");
} $query = $conn->prepare($query);
debug($query, "database");  
$query = $conn->prepare($query); //$query->bindParam(":service_periodA", $sidA);
$query->bindParam(":service_period", $service_period); //$query->bindParam(":service_periodB", $sidB);
if ($destination != "") if ($destination != "")
$query->bindParam(":destination", $destination); $query->bindParam(":destination", $destination);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function getRoutesBySuburb($suburb, $service_period = "") { function getRoutesBySuburb($suburb, $service_period = "") {
if ($service_period == "") if ($service_period == "")
$service_period = service_period(); $service_period = service_period();
  $service_ids = service_ids($service_period);
  $sidA = $service_ids[0];
  $sidB = $service_ids[1];
   
global $conn; global $conn;
$query = "SELECT DISTINCT service_id,trips.route_id,route_short_name,route_long_name $query = "SELECT DISTINCT service_id,trips.route_id,route_short_name,route_long_name
FROM stop_times join trips on trips.trip_id = stop_times.trip_id FROM stop_times join trips on trips.trip_id = stop_times.trip_id
join routes on trips.route_id = routes.route_id join routes on trips.route_id = routes.route_id
join stops on stops.stop_id = stop_times.stop_id join stops on stops.stop_id = stop_times.stop_id
WHERE zone_id LIKE ':suburb AND service_id=:service_period ORDER BY route_short_name"; WHERE stop_desc LIKE :suburb AND (service_id=:service_periodA OR service_id=:service_periodB)
debug($query, "database"); ORDER BY route_short_name";
$query = $conn->prepare($query); debug($query, "database");
$query->bindParam(":service_period", $service_period); $query = $conn->prepare($query);
$suburb = "%" . $suburb . ";%"; $query->bindParam(":service_periodA", $sidA);
  $query->bindParam(":service_periodB", $sidB);
  $suburb = "%Suburb: %" . $suburb . "%";
$query->bindParam(":suburb", $suburb); $query->bindParam(":suburb", $suburb);
$query->execute(); $query->execute();
if (!$query) {  
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array();  
}  
return $query->fetchAll(); return $query->fetchAll();
} }
   
function getRoutesNearby($lat, $lng, $limit = "", $distance = 500) { function getRoutesNearby($lat, $lng, $limit = "", $distance = 500) {
if ($service_period == "") // if ($service_period == "")
$service_period = service_period(); $service_period = service_period();
$service_ids = service_ids($service_period); $service_ids = service_ids($service_period);
$sidA = $service_ids[0]; $sidA = $service_ids[0];
$sidB = $service_ids[1]; $sidB = $service_ids[1];
if ($limit != "") $limitSQL = "";
  if ($limit != "")
$limitSQL = " LIMIT :limit "; $limitSQL = " LIMIT :limit ";
global $conn; global $conn;
$query = "SELECT service_id,trips.route_id,route_short_name,route_long_name,min(stops.stop_id) as stop_id, $query = "SELECT service_id,trips.route_id,trips.direction_id,route_short_name,route_long_name,min(stops.stop_id) as stop_id,
min(ST_Distance(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), FALSE)) as distance min(ST_Distance(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), FALSE)) as distance
FROM stop_times FROM stop_times
join trips on trips.trip_id = stop_times.trip_id join trips on trips.trip_id = stop_times.trip_id
join routes on trips.route_id = routes.route_id join routes on trips.route_id = routes.route_id
join stops on stops.stop_id = stop_times.stop_id join stops on stops.stop_id = stop_times.stop_id
WHERE (service_id=:service_periodA OR service_id=:service_periodB) WHERE (service_id=:service_periodA OR service_id=:service_periodB)
AND ST_DWithin(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), :distance, FALSE) AND ST_DWithin(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), :distance, FALSE)
group by service_id,trips.route_id,route_short_name,route_long_name group by service_id,trips.route_id,trips.direction_id,route_short_name,route_long_name
order by distance $limitSQL"; order by distance $limitSQL";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":service_periodA", $sidA); $query->bindParam(":service_periodA", $sidA);
$query->bindParam(":service_periodB", $sidB); $query->bindParam(":service_periodB", $sidB);
$query->bindParam(":distance", $distance); $query->bindParam(":distance", $distance);
if ($limit != "") if ($limit != "")
$query->bindParam(":limit", $limit); $query->bindParam(":limit", $limit);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
?>  
<?php <?php
   
/* /*
* Copyright 2010,2011 Alexander Sadleir * Copyright 2010,2011 Alexander Sadleir
   
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
   
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
   
function getServiceOverride($date = "") { function getServiceOverride($date = "") {
global $conn; global $conn;
$query = "Select * from calendar_dates where date = :date and exception_type = '1' LIMIT 1"; $query = "Select * from calendar_dates where date = :date and exception_type = '1' LIMIT 1";
// debug($query,"database"); // debug($query,"database");
$query = $conn->prepare($query); // Create a prepared statement $query = $conn->prepare($query); // Create a prepared statement
$query->bindParam(":date", date("Ymd", ($date != "" ? $date : time()))); $date = date("Ymd", ($date != "" ? $date : time()));
  $query->bindParam(":date", $date);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetch(PDO :: FETCH_ASSOC); return $query->fetch(PDO :: FETCH_ASSOC);
} }
   
function getServiceAlert($alertID) { function getServiceAlert($alertID) {
global $conn; global $conn;
$query = "SELECT id,extract('epoch' from start) as start, extract('epoch' from \"end\") as \"end\",cause,effect,header,description,url from servicealerts_alerts where id = :servicealert_id"; $query = "SELECT id,extract('epoch' from start) as start, extract('epoch' from \"end\") as \"end\",cause,effect,header,description,url from servicealerts_alerts where id = :servicealert_id";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":servicealert_id", $alertID); $query->bindParam(":servicealert_id", $alertID);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetch(PDO :: FETCH_ASSOC); return $query->fetch(PDO :: FETCH_ASSOC);
} }
   
function updateServiceAlert($alertID, $start, $end, $header, $description, $url) { function updateServiceAlert($alertID, $alert) {
global $conn; global $conn;
$query = 'update servicealerts_alerts set start=:start, "end"=:end, header=:header, description=:description, url=:url where id = :servicealert_id'; $query = 'update servicealerts_alerts set start=:start, "end"=:end, header=:header, description=:description, url=:url, cause=:cause, effect=:effect where id = :servicealert_id';
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":servicealert_id", $alertID); $query->bindValue(":servicealert_id", $alertID);
$query->bindParam(":start", $start); $query->bindValue(":start", $alert['startdate']);
$query->bindParam(":end", $end); $query->bindValue(":end", $alert['enddate']);
$query->bindParam(":header", $header); $query->bindValue(":header", $alert['header']);
$query->bindParam(":description", $description); $query->bindValue(":description", $alert['description']);
$query->bindParam(":url", $url); $query->bindValue(":url", $alert['url']);
  $query->bindValue(":cause", $alert['cause']);
  $query->bindValue(":effect", $alert['effect']);
$query->execute(); $query->execute();
   
print_r($conn->errorInfo()); print_r($conn->errorInfo());
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetch(PDO :: FETCH_ASSOC); return $query->fetch(PDO :: FETCH_ASSOC);
} }
   
function addServiceAlert($start, $end, $header, $description, $url) { function addServiceAlert($alert) {
global $conn; global $conn;
$query = 'INSERT INTO servicealerts_alerts (start, "end", header, description, url) VALUES (:start, :end, :header, :description, :url) '; $query = 'INSERT INTO servicealerts_alerts (start, "end", header, description, url,cause,effect) VALUES (:start, :end, :header, :description, :url,:cause,:effect) ';
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":start", $start); //print_r($alert);
$query->bindParam(":end", $end); $query->bindValue(":start", $alert['startdate']);
$query->bindParam(":header", $header); $query->bindValue(":end", $alert['enddate']);
$query->bindParam(":description", $description); $query->bindValue(":header", $alert['header']);
$query->bindParam(":url", $url); $query->bindValue(":description", $alert['description']);
  $query->bindValue(":url", $alert['url']);
  $query->bindValue(":cause", $alert['cause']);
  $query->bindValue(":effect", $alert['effect']);
$query->execute(); $query->execute();
   
print_r($conn->errorInfo()); print_r($conn->errorInfo());
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetch(PDO :: FETCH_ASSOC); return $query->fetch(PDO :: FETCH_ASSOC);
} }
   
function getCurrentAlerts() { function getCurrentAlerts() {
global $conn; global $conn;
$query = "SELECT id,extract('epoch' from start) as start, extract('epoch' from \"end\") as \"end\",cause,effect,header,description,url from servicealerts_alerts where NOW() > start and NOW() < \"end\""; $query = "SELECT id,extract('epoch' from start) as start, extract('epoch' from \"end\") as \"end\",cause,effect,header,description,url from servicealerts_alerts where NOW() > start and NOW() < \"end\"";
// debug($query, "database"); // debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function getFutureAlerts() { function getFutureAlerts() {
global $conn; global $conn;
$query = "SELECT id,extract('epoch' from start) as start, extract('epoch' from \"end\") as \"end\",cause,effect,header,description,url from servicealerts_alerts where NOW() > start or NOW() < \"end\""; $query = "SELECT id,extract('epoch' from start) as start, extract('epoch' from \"end\") as \"end\",cause,effect,header,description,url from servicealerts_alerts where NOW() < \"end\"";
  // debug($query, "database");
  $query = $conn->prepare($query);
  $query->execute();
  if (!$query) {
  databaseError($conn->errorInfo());
  return Array();
  }
  return $query->fetchAll();
  }
  function getAllAlerts() {
  global $conn;
  $query = "SELECT id,extract('epoch' from start) as start, extract('epoch' from \"end\") as \"end\",cause,effect,header,description,url from servicealerts_alerts";
// debug($query, "database"); // debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function getInformedAlerts($id, $filter_class, $filter_id) { function getInformedAlerts($id, $filter_class, $filter_id) {
   
global $conn; global $conn;
  //echo "$id, $filter_class, $filter_id\n";
$query = "SELECT * from servicealerts_informed where servicealert_id = :servicealert_id"; $query = "SELECT * from servicealerts_informed where servicealert_id = :servicealert_id";
   
if ($filter_class != "") { if ($filter_class != "") {
$query .= " AND informed_class = :informed_class "; $query .= " AND informed_class = :informed_class ";
} }
if ($filter_id != "") { if ($filter_id != "") {
$query .= " AND informed_id = :informed_id "; $query .= " AND informed_id = :informed_id ";
} }
// debug($query, "database"); // debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
if ($filter_class != "") { if ($filter_class != "") {
$query->bindParam(":informed_class", $filter_class); $query->bindParam(":informed_class", $filter_class);
} }
if ($filter_id != "") { if ($filter_id != "") {
$query->bindParam(":informed_id", $filter_id); $query->bindParam(":informed_id", $filter_id);
} }
$query->bindParam(":servicealert_id", $id); $query->bindParam(":servicealert_id", $id);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function deleteInformedAlert($serviceAlertID, $class, $id) { function deleteInformedAlert($serviceAlertID, $class, $id) {
global $conn; global $conn;
$query = 'DELETE from servicealerts_informed where servicealert_id = :servicealert_id and informed_class = :informed_class AND informed_id = :informed_id'; $query = 'DELETE from servicealerts_informed where servicealert_id = :servicealert_id and informed_class = :informed_class AND informed_id = :informed_id';
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":servicealert_id", $serviceAlertID); $query->bindParam(":servicealert_id", $serviceAlertID);
$query->bindParam(":informed_class", $class); $query->bindParam(":informed_class", $class);
$query->bindParam(":informed_id", $id); $query->bindParam(":informed_id", $id);
$query->execute(); $query->execute();
print_r($conn->errorInfo()); print_r($conn->errorInfo());
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return null; return null;
} }
   
function addInformedAlert($serviceAlertID, $class, $id, $action) { function addInformedAlert($serviceAlertID, $class, $id, $action) {
global $conn; global $conn;
$query = 'INSERT INTO servicealerts_informed (servicealert_id , informed_class , informed_id) VALUES(:servicealert_id ,:informed_class, :informed_id)'; $query = 'INSERT INTO servicealerts_informed (servicealert_id , informed_class , informed_id, informed_action)
  VALUES(:servicealert_id ,:informed_class, :informed_id, :informed_action)';
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":servicealert_id", $serviceAlertID); $query->bindParam(":servicealert_id", $serviceAlertID);
$query->bindParam(":informed_class", $class); $query->bindParam(":informed_class", $class);
$query->bindParam(":informed_id", $id); $query->bindParam(":informed_id", $id);
  $query->bindParam(":informed_action", $action);
$query->execute(); $query->execute();
   
print_r($conn->errorInfo()); print_r($conn->errorInfo());
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return null; return null;
} }
   
?>  
<?php <?php
   
/* /*
* Copyright 2010,2011 Alexander Sadleir * Copyright 2010,2011 Alexander Sadleir
   
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
   
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
   
function getStop($stopID) { function getStop($stopID) {
global $conn; global $conn;
$query = "Select * from stops where stop_id = :stopID LIMIT 1"; $query = "Select * from stops where stop_id = :stopID LIMIT 1";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":stopID", $stopID); $query->bindParam(":stopID", $stopID);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetch(PDO :: FETCH_ASSOC); return $query->fetch(PDO :: FETCH_ASSOC);
} }
   
function getStops($firstLetter = "", $startsWith = "") { function getStops($firstLetter = "", $startsWith = "") {
global $conn; global $conn;
$conditions = Array(); $conditions = Array();
if ($firstLetter != "") if ($firstLetter != "")
$conditions[] = "substr(stop_name,1,1) = :firstLetter"; $conditions[] = "substr(stop_name,1,1) = :firstLetter";
if ($startsWith != "") if ($startsWith != "")
$conditions[] = "stop_name like :startsWith"; $conditions[] = "stop_name like :startsWith";
$query = "Select * from stops"; $query = "Select * from stops";
if (sizeof($conditions) > 0) { if (sizeof($conditions) > 0) {
if (sizeof($conditions) > 1) { if (sizeof($conditions) > 1) {
$query .= " Where " . implode(" AND ", $conditions) . " "; $query .= " Where " . implode(" AND ", $conditions) . " ";
} else { } else {
$query .= " Where " . $conditions[0] . " "; $query .= " Where " . $conditions[0] . " ";
} }
} }
$query .= " order by stop_name;"; $query .= " order by stop_name;";
debug($query,"database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
if ($firstLetter != "") if ($firstLetter != "")
$query->bindParam(":firstLetter", $firstLetter); $query->bindParam(":firstLetter", $firstLetter);
   
if ($startsWith != "") { if ($startsWith != "") {
$startsWith = $startsWith . "%"; $startsWith = $startsWith . "%";
$query->bindParam(":startsWith", $startsWith); $query->bindParam(":startsWith", $startsWith);
} }
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function getNearbyStops($lat, $lng, $limit = "", $distance = 1000) { function getNearbyStops($lat, $lng, $limit = "", $distance = 1000) {
if ($lat == null || $lng == null) if ($lat == null || $lng == null)
return Array(); return Array();
if ($limit != "") if ($limit != "")
$limitSQL = " LIMIT :limit "; $limitSQL = " LIMIT :limit ";
global $conn; global $conn;
$query = "Select *, ST_Distance(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), FALSE) as distance $query = "Select *, ST_Distance(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), FALSE) as distance
from stops WHERE ST_DWithin(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), :distance, FALSE) from stops WHERE ST_DWithin(position, ST_GeographyFromText('SRID=4326;POINT($lng $lat)'), :distance, FALSE)
order by distance $limitSQL;"; order by distance $limitSQL;";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":distance", $distance); $query->bindParam(":distance", $distance);
$query->bindParam(":limit", $limit); $query->bindParam(":limit", $limit);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function getStopsByName($name) { function getStopsByName($name) {
global $conn; global $conn;
$query = "Select * from stops where stop_name LIKE :name;"; $query = "Select * from stops where stop_name LIKE :name;";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$name = "%" . $name . ";%"; $name = $name . "%";
$query->bindParam(":name", $name); $query->bindParam(":name", $name);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function getStopsBySuburb($suburb) { function getStopsBySuburb($suburb) {
global $conn; global $conn;
$query = "Select * from stops where stop_desc LIKE :suburb order by stop_name;"; $query = "Select * from stops where stop_desc LIKE :suburb order by stop_name;";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$suburb = "%<br>Suburb: %" . $suburb . "%"; $suburb = "%<br>Suburb: %" . $suburb . "%";
$query->bindParam(":suburb", $suburb); $query->bindParam(":suburb", $suburb);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function getStopsByStopCode($stop_code, $startsWith = "") { function getStopsByStopCode($stop_code, $startsWith = "") {
global $conn; global $conn;
$query = "Select * from stops where (stop_code = :stop_code OR stop_code LIKE :stop_code2)"; $query = "Select * from stops where (stop_code = :stop_code OR stop_code LIKE :stop_code2)";
if ($startsWith != "") if ($startsWith != "")
$query .= " AND stop_name like :startsWith"; $query .= " AND stop_name like :startsWith";
   
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
   
$query->bindParam(":stop_code", $stop_code); $query->bindParam(":stop_code", $stop_code);
$stop_code2 = $stop_code . "%"; $stop_code2 = $stop_code . "%";
$query->bindParam(":stop_code2", $stop_code2); $query->bindParam(":stop_code2", $stop_code2);
if ($startsWith != "") { if ($startsWith != "") {
$startsWith = $startsWith . "%"; $startsWith = $startsWith . "%";
$query->bindParam(":startsWith", $startsWith); $query->bindParam(":startsWith", $startsWith);
} }
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function getStopRoutes($stopID, $service_period) { function getStopRoutes($stopID, $service_period) {
if ($service_period == "") { if ($service_period == "") {
$service_period = service_period(); $service_period = service_period();
} }
$service_ids = service_ids($service_period); $service_ids = service_ids($service_period);
$sidA = $service_ids[0]; $sidA = $service_ids[0];
$sidB = $service_ids[1]; $sidB = $service_ids[1];
global $conn; global $conn;
$query = "SELECT distinct service_id,trips.route_id,route_short_name,route_long_name $query = "SELECT distinct service_id,trips.route_id,route_short_name,route_long_name
FROM stop_times join trips on trips.trip_id = FROM stop_times join trips on trips.trip_id =
stop_times.trip_id join routes on trips.route_id = routes.route_id WHERE stop_id = :stopID stop_times.trip_id join routes on trips.route_id = routes.route_id WHERE stop_id = :stopID
AND (service_id=:service_periodA OR service_id=:service_periodB)"; AND (service_id=:service_periodA OR service_id=:service_periodB)";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":service_periodA", $sidA); $query->bindParam(":service_periodA", $sidA);
$query->bindParam(":service_periodB", $sidB); $query->bindParam(":service_periodB", $sidB);
$query->bindParam(":stopID", $stopID); $query->bindParam(":stopID", $stopID);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function getStopTrips($stopID, $service_period = "", $afterTime = "", $limit = "", $route_short_name = "") { function getStopTrips($stopID, $service_period = "", $afterTime = "", $limit = "", $route_short_name = "") {
if ($service_period == "") { if ($service_period == "") {
$service_period = service_period(); $service_period = service_period();
} }
$service_ids = service_ids($service_period); $service_ids = service_ids($service_period);
$sidA = $service_ids[0]; $sidA = $service_ids[0];
$sidB = $service_ids[1]; $sidB = $service_ids[1];
$limitSQL = ""; $limitSQL = "";
if ($limit != "") if ($limit != "")
$limitSQL .= " LIMIT :limit "; $limitSQL .= " LIMIT :limit ";
   
global $conn; global $conn;
if ($afterTime != "") { if ($afterTime != "") {
$query = " SELECT stop_times.trip_id,stop_times.arrival_time,stop_times.stop_id,stop_sequence,service_id,trips.route_id,route_short_name,route_long_name,end_times.arrival_time as end_time $query = " SELECT stop_times.trip_id,stop_times.arrival_time,stop_times.stop_id,stop_sequence,service_id,trips.route_id,trips.direction_id,trips.trip_headsign,route_short_name,route_long_name,end_times.arrival_time as end_time
FROM stop_times FROM stop_times
join trips on trips.trip_id = join trips on trips.trip_id =
stop_times.trip_id stop_times.trip_id
join routes on trips.route_id = routes.route_id , (SELECT trip_id,max(arrival_time) as arrival_time from stop_times join routes on trips.route_id = routes.route_id , (SELECT trip_id,max(arrival_time) as arrival_time from stop_times
WHERE stop_times.arrival_time IS NOT NULL group by trip_id) as end_times WHERE stop_times.arrival_time IS NOT NULL group by trip_id) as end_times
WHERE stop_times.stop_id = :stopID WHERE stop_times.stop_id = :stopID
AND stop_times.trip_id = end_times.trip_id AND stop_times.trip_id = end_times.trip_id
AND (service_id=:service_periodA OR service_id=:service_periodB) ".($route_short_name != "" ? " AND route_short_name = :route_short_name ":"")." AND (service_id=:service_periodA OR service_id=:service_periodB) " . ($route_short_name != "" ? " AND route_short_name = :route_short_name " : "") . "
AND end_times.arrival_time > :afterTime AND end_times.arrival_time > :afterTime
ORDER BY end_time $limitSQL"; ORDER BY end_time $limitSQL";
} else { } else {
$query = "SELECT stop_times.trip_id,arrival_time,stop_times.stop_id,stop_sequence,service_id,trips.route_id,route_short_name,route_long_name $query = "SELECT stop_times.trip_id,arrival_time,stop_times.stop_id,stop_sequence,service_id,trips.route_id,route_short_name,route_long_name
FROM stop_times FROM stop_times
join trips on trips.trip_id = join trips on trips.trip_id =
stop_times.trip_id stop_times.trip_id
join routes on trips.route_id = routes.route_id join routes on trips.route_id = routes.route_id
WHERE stop_times.stop_id = :stopID WHERE stop_times.stop_id = :stopID
AND (service_id=:service_periodA OR service_id=:service_periodB) ".($route_short_name != "" ? " AND route_short_name = :route_short_name ":"")." AND (service_id=:service_periodA OR service_id=:service_periodB) " . ($route_short_name != "" ? " AND route_short_name = :route_short_name " : "") . "
ORDER BY arrival_time $limitSQL"; ORDER BY arrival_time $limitSQL";
} }
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":service_periodA", $sidA); $query->bindParam(":service_periodA", $sidA);
$query->bindParam(":service_periodB", $sidB); $query->bindParam(":service_periodB", $sidB);
$query->bindParam(":stopID", $stopID); $query->bindParam(":stopID", $stopID);
if ($limit != "") if ($limit != "")
$query->bindParam(":limit", $limit); $query->bindParam(":limit", $limit);
if ($afterTime != "") if ($afterTime != "")
$query->bindParam(":afterTime", $afterTime); $query->bindParam(":afterTime", $afterTime);
if ($route_short_name != "") if ($route_short_name != "")
$query->bindParam(":route_short_name", $route_short_name); $query->bindParam(":route_short_name", $route_short_name);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function getStopTripsWithTimes($stopID, $time = "", $service_period = "", $time_range = "", $limit = "") { function getStopTripsWithTimes($stopID, $time = "", $service_period = "", $time_range = "", $limit = "") {
if ($service_period == "") if ($service_period == "")
$service_period = service_period(); $service_period = service_period();
if ($time_range == "") if ($time_range == "")
$time_range = (24 * 60 * 60); $time_range = (24 * 60 * 60);
if ($time == "") if ($time == "")
$time = current_time(); $time = current_time();
if ($limit == "") if ($limit == "")
$limit = 10; $limit = 10;
$trips = getStopTrips($stopID, $service_period, $time); $trips = getStopTrips($stopID, $service_period, $time);
$timedTrips = Array(); $timedTrips = Array();
if ($trips && sizeof($trips) > 0) { if ($trips && sizeof($trips) > 0) {
foreach ($trips as $trip) { foreach ($trips as $trip) {
if ($trip['arrival_time'] != "") { if ($trip['arrival_time'] != "") {
if (strtotime($trip['arrival_time']) > strtotime($time) and strtotime($trip['arrival_time']) < (strtotime($time) + $time_range)) { if (strtotime($trip['arrival_time']) > strtotime($time) and strtotime($trip['arrival_time']) < (strtotime($time) + $time_range)) {
$timedTrips[] = $trip; $timedTrips[] = $trip;
} }
} else { } else {
$timedTrip = getTripAtStop($trip['trip_id'], $trip['stop_sequence']); $timedTrip = getTripAtStop($trip['trip_id'], $trip['stop_sequence']);
if ($timedTrip['arrival_time'] > $time and strtotime($timedTrip['arrival_time']) < (strtotime($time) + $time_range)) { if ($timedTrip['arrival_time'] > $time and strtotime($timedTrip['arrival_time']) < (strtotime($time) + $time_range)) {
$timedTrips[] = $timedTrip; $timedTrips[] = $timedTrip;
} }
} }
if (sizeof($timedTrips) > $limit) if (sizeof($timedTrips) > $limit)
break; break;
} }
sktimesort($timedTrips, "arrival_time", true); sktimesort($timedTrips, "arrival_time", true);
} }
return $timedTrips; return $timedTrips;
} }
   
?>  
<?php <?php
   
/* /*
* Copyright 2010,2011 Alexander Sadleir * Copyright 2010,2011 Alexander Sadleir
   
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
   
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
   
function getTrip($tripID) { function getTrip($tripID) {
global $conn; global $conn;
$query = "Select * from trips $query = "Select * from trips
join routes on trips.route_id = routes.route_id join routes on trips.route_id = routes.route_id
where trip_id = :tripID where trip_id = :tripID
LIMIT 1"; LIMIT 1";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":tripID", $tripID); $query->bindParam(":tripID", $tripID);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
   
return Array(); return Array();
} }
return $query->fetch(PDO :: FETCH_ASSOC); return $query->fetch(PDO :: FETCH_ASSOC);
} }
  function getTripStops($tripID) {
function getTripShape($tripID) { global $conn;
// todo, use shapes table if shape_id specified $query = "SELECT stops.stop_id, stop_name, ST_AsKML(position) as positionkml,
global $conn;  
$query = "SELECT ST_AsKML(ST_MakeLine(geometry(a.position))) as the_route  
FROM (SELECT position,  
stop_sequence, trips.trip_id stop_sequence, trips.trip_id
FROM stop_times FROM stop_times
join trips on trips.trip_id = stop_times.trip_id join trips on trips.trip_id = stop_times.trip_id
join stops on stops.stop_id = stop_times.stop_id join stops on stops.stop_id = stop_times.stop_id
WHERE trips.trip_id = :tripID ORDER BY stop_sequence) as a group by a.trip_id"; WHERE trips.trip_id = :tripID ORDER BY stop_sequence";
  debug($query, "database");
  $query = $conn->prepare($query);
  $query->bindParam(":tripID", $tripID);
  $query->execute();
  if (!$query) {
  databaseError($conn->errorInfo());
  return Array();
  }
  return $query->fetchAll();
  }
   
  function getTripHasStop($tripID, $stopID) {
  global $conn;
  $query = "SELECT stop_id
  FROM stop_times
  join trips on trips.trip_id = stop_times.trip_id
  WHERE trips.trip_id = :tripID and stop_times.stop_id = :stopID";
  debug($query, "database");
  $query = $conn->prepare($query);
  $query->bindParam(":tripID", $tripID);
  $query->bindParam(":stopID", $stopID);
  $query->execute();
  if (!$query) {
  databaseError($conn->errorInfo());
  return Array();
  }
  return ($query->fetchColumn() > 0);
  }
   
  function getTripShape($tripID) {
  // todo, use shapes table if shape_id specified
  global $conn;
  $query = "SELECT ST_AsKML(ST_MakeLine(geometry(a.shape_pt))) as the_route
  FROM (SELECT shapes.shape_id,shape_pt from shapes
  inner join trips on shapes.shape_id = trips.shape_id
  WHERE trips.trip_id = :tripID ORDER BY shape_pt_sequence) as a group by a.shape_id";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":tripID", $tripID); $query->bindParam(":tripID", $tripID);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchColumn(0); return $query->fetchColumn(0);
} }
   
function getTripStopTimes($tripID) { function getTripStopTimes($tripID) {
global $conn; global $conn;
$query = "SELECT stop_times.trip_id,trip_headsign,arrival_time,stop_times.stop_id $query = "SELECT stop_times.trip_id,trip_headsign,arrival_time,stop_times.stop_id
,stop_lat,stop_lon,stop_name,stop_desc,stop_code, ,stop_lat,stop_lon,stop_name,stop_desc,stop_code,
stop_sequence,service_id,trips.route_id,route_short_name,route_long_name stop_sequence,service_id,trips.route_id,route_short_name,route_long_name
FROM stop_times FROM stop_times
join trips on trips.trip_id = stop_times.trip_id join trips on trips.trip_id = stop_times.trip_id
join routes on trips.route_id = routes.route_id join routes on trips.route_id = routes.route_id
join stops on stops.stop_id = stop_times.stop_id join stops on stops.stop_id = stop_times.stop_id
WHERE trips.trip_id = :tripID $range ORDER BY stop_sequence"; WHERE trips.trip_id = :tripID ORDER BY stop_sequence";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":tripID", $tripID); $query->bindParam(":tripID", $tripID);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
$stopTimes = $query->fetchAll(); $stopTimes = $query->fetchAll();
return $stopTimes; return $stopTimes;
} }
   
function getTripAtStop($tripID, $stop_sequence) { function getTripAtStop($tripID, $stop_sequence) {
global $conn; global $conn;
foreach (getTripStopTimes($tripID) as $tripStop) { foreach (getTripStopTimes($tripID) as $tripStop) {
if ($tripStop['stop_sequence'] == $stop_sequence) if ($tripStop['stop_sequence'] == $stop_sequence)
return $tripStop; return $tripStop;
} }
return Array(); return Array();
} }
   
function getTripStartTime($tripID) { function getTripStartTime($tripID) {
global $conn; global $conn;
$query = "Select * from stop_times $query = "Select * from stop_times
where trip_id = :tripID where trip_id = :tripID
AND arrival_time IS NOT NULL AND arrival_time IS NOT NULL
AND stop_sequence = '1'"; AND stop_sequence = '1'";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":tripID", $tripID); $query->bindParam(":tripID", $tripID);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
$r = $query->fetch(PDO :: FETCH_ASSOC); $r = $query->fetch(PDO :: FETCH_ASSOC);
return $r['arrival_time']; return $r['arrival_time'];
} }
   
function getTripEndTime($tripID) { function getTripEndTime($tripID) {
global $conn; global $conn;
$query = "SELECT trip_id,max(arrival_time) as arrival_time from stop_times $query = "SELECT trip_id,max(arrival_time) as arrival_time from stop_times
WHERE stop_times.arrival_time IS NOT NULL and trip_id = :tripID group by trip_id"; WHERE stop_times.arrival_time IS NOT NULL and trip_id = :tripID group by trip_id";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":tripID", $tripID); $query->bindParam(":tripID", $tripID);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
$r = $query->fetch(PDO :: FETCH_ASSOC); $r = $query->fetch(PDO :: FETCH_ASSOC);
return $r['arrival_time']; return $r['arrival_time'];
  }
  function getTripStartingPoint($tripID) {
  global $conn;
  $query = "SELECT stops.stop_id, stops.stop_name, stops.stop_desc
  from stop_times inner join stops on stop_times.stop_id = stops.stop_id
  WHERE trip_id = :tripID and stop_sequence = '1' limit 1";
  debug($query, "database");
  $query = $conn->prepare($query);
  $query->bindParam(":tripID", $tripID);
  $query->execute();
  if (!$query) {
  databaseError($conn->errorInfo());
  return Array();
  }
  $r = $query->fetch(PDO :: FETCH_ASSOC);
  return $r;
} }
   
function getTripDestination($tripID) { function getTripDestination($tripID) {
global $conn; global $conn;
$query = "SELECT stops.stop_id, stops.stop_name, stops.stop_desc $query = "SELECT stops.stop_id, stops.stop_name, stops.stop_desc
from stop_times inner join stops on stop_times.stop_id = stops.stop_id from stop_times inner join stops on stop_times.stop_id = stops.stop_id
WHERE trip_id = :tripID order by stop_sequence desc limit 1"; WHERE trip_id = :tripID order by stop_sequence desc limit 1";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":tripID", $tripID); $query->bindParam(":tripID", $tripID);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
$r = $query->fetch(PDO :: FETCH_ASSOC); $r = $query->fetch(PDO :: FETCH_ASSOC);
return $r; return $r;
} }
   
function getActiveTrips($time) { function getActiveTrips($time) {
global $conn; global $conn;
if ($time == "") if ($time == "")
$time = current_time(); $time = current_time();
$query = "Select distinct stop_times.trip_id, start_times.arrival_time as start_time, end_times.arrival_time as end_time from stop_times, (SELECT trip_id,arrival_time from stop_times WHERE stop_times.arrival_time IS NOT NULL $query = "Select distinct stop_times.trip_id, start_times.arrival_time as start_time, end_times.arrival_time as end_time from stop_times, (SELECT trip_id,arrival_time from stop_times WHERE stop_times.arrival_time IS NOT NULL
AND stop_sequence = '1') as start_times, (SELECT trip_id,max(arrival_time) as arrival_time from stop_times WHERE stop_times.arrival_time IS NOT NULL group by trip_id) as end_times AND stop_sequence = '1') as start_times, (SELECT trip_id,max(arrival_time) as arrival_time from stop_times WHERE stop_times.arrival_time IS NOT NULL group by trip_id) as end_times
WHERE start_times.trip_id = end_times.trip_id AND stop_times.trip_id = end_times.trip_id AND :time > start_times.arrival_time AND :time < end_times.arrival_time"; WHERE start_times.trip_id = end_times.trip_id AND stop_times.trip_id = end_times.trip_id AND :time > start_times.arrival_time AND :time < end_times.arrival_time";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
$query->bindParam(":time", $time); $query->bindParam(":time", $time);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
function viaPoints($tripID, $stop_sequence = "") { function viaPoints($tripID, $stop_sequence = "") {
global $conn; global $conn;
$query = "SELECT stops.stop_id, stop_name, arrival_time $query = "SELECT stops.stop_id, stop_name, arrival_time
FROM stop_times join stops on stops.stop_id = stop_times.stop_id FROM stop_times join stops on stops.stop_id = stop_times.stop_id
WHERE stop_times.trip_id = :tripID WHERE stop_times.trip_id = :tripID
" . ($stop_sequence != "" ? " AND stop_sequence > :stop_sequence " : "") . " ORDER BY stop_sequence"; " . ($stop_sequence != "" ? " AND stop_sequence > :stop_sequence " : "") . " ORDER BY stop_sequence";
debug($query, "database"); debug($query, "database");
$query = $conn->prepare($query); $query = $conn->prepare($query);
if ($stop_sequence != "") if ($stop_sequence != "")
$query->bindParam(":stop_sequence", $stop_sequence); $query->bindParam(":stop_sequence", $stop_sequence);
$query->bindParam(":tripID", $tripID); $query->bindParam(":tripID", $tripID);
$query->execute(); $query->execute();
if (!$query) { if (!$query) {
databaseError($conn->errorInfo()); databaseError($conn->errorInfo());
return Array(); return Array();
} }
return $query->fetchAll(); return $query->fetchAll();
} }
   
   
?>  
file:a/index.php -> file:b/index.php
<?php <?php
/* /*
* Copyright 2010,2011 Alexander Sadleir * Copyright 2010,2011 Alexander Sadleir
   
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
   
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
   
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
include ('include/common.inc.php'); include ('include/common.inc.php');
include_header("bus.lambdacomplex.org", "index", false) include_header("bus.lambdacomplex.org", "index", false)
?> ?>
<div data-role="page"> <div data-role="page">
<div data-role="content"> <div data-role="content">
<div id="jqm-homeheader"> <div id="jqm-homeheader">
<h1>busness time</h1><br><small>Canberra Bus Timetables and Trip Planner</small> <h1>busness time</h1><br><small>Canberra Bus Timetables and Trip Planner</small>
</div> </div>
<a name="maincontent" id="maincontent"></a> <a name="maincontent" id="maincontent"></a>
<a href="tripPlanner.php" data-role="button" data-icon="navigation">Launch Trip Planner...</a> <a href="tripPlanner.php" data-role="button" data-icon="navigation">Launch Trip Planner...</a>
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b"> <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
<li data-role="list-divider">Timetables - Stops</li> <li data-role="list-divider">Timetables - Stops</li>
<li><a href="stopList.php">Stops By Name</a></li> <li><a href="stopList.php">Stops By Name</a></li>
<li><a href="stopList.php?bysuburbs=yes">Stops By Suburb</a></li> <li><a href="stopList.php?bysuburbs=yes">Stops By Suburb</a></li>
<li><a class="nearby" href="stopList.php?nearby=yes">Nearby Stops</a></li> <li><a class="nearby" href="stopList.php?nearby=yes">Nearby Stops</a></li>
</ul> </ul>
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b"> <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
<li data-role="list-divider">Timetables - Routes</li> <li data-role="list-divider">Timetables - Routes</li>
<li><a href="routeList.php">Routes By Final Destination</a></li> <li><a href="routeList.php">Routes By Final Destination</a></li>
<li><a href="routeList.php?bynumber=yes">Routes By Number</a></li> <li><a href="routeList.php?bynumber=yes">Routes By Number</a></li>
<li><a href="routeList.php?bysuburbs=yes">Routes By Suburb</a></li> <li><a href="routeList.php?bysuburbs=yes">Routes By Suburb</a></li>
<li><a class="nearby" href="routeList.php?nearby=yes">Nearby Routes</a></li> <li><a class="nearby" href="routeList.php?nearby=yes">Nearby Routes</a></li>
</ul> </ul>
  <!--<a href="labs/index.php" data-role="button" data-icon="beaker">Busness R&amp;D</a>-->
  <a href="myway/index.php" data-role="button">MyWay Balance and Timeliness Survey Results</a>
<?php <?php
echo ' <a href="labs/index.php" data-role="button" data-icon="beaker">Busness R&amp;D</a>';  
echo ' <a href="myway/index.php" data-role="button">MyWay Balance and Timeliness Survey Results</a>';  
include_footer(true) include_footer(true)
?> ?>
   
directory:b/js/FlashCanvas (new)
 
file:a/js/LAB.min.js (deleted)
/*! LAB.js (LABjs :: Loading And Blocking JavaScript)  
v2.0.1 (c) Kyle Simpson  
MIT License  
*/  
(function(o){var K=o.$LAB,y="UseLocalXHR",z="AlwaysPreserveOrder",u="AllowDuplicates",A="CacheBust",B="BasePath",C=/^[^?#]*\//.exec(location.href)[0],D=/^\w+\:\/\/\/?[^\/]+/.exec(C)[0],i=document.head||document.getElementsByTagName("head"),L=(o.opera&&Object.prototype.toString.call(o.opera)=="[object Opera]")||("MozAppearance"in document.documentElement.style),q=document.createElement("script"),E=typeof q.preload=="boolean",r=E||(q.readyState&&q.readyState=="uninitialized"),F=!r&&q.async===true,M=!r&&!F&&!L;function G(a){return Object.prototype.toString.call(a)=="[object Function]"}function H(a){return Object.prototype.toString.call(a)=="[object Array]"}function N(a,c){var b=/^\w+\:\/\//;if(/^\/\/\/?/.test(a)){a=location.protocol+a}else if(!b.test(a)&&a.charAt(0)!="/"){a=(c||"")+a}return b.test(a)?a:((a.charAt(0)=="/"?D:C)+a)}function s(a,c){for(var b in a){if(a.hasOwnProperty(b)){c[b]=a[b]}}return c}function O(a){var c=false;for(var b=0;b<a.scripts.length;b++){if(a.scripts[b].ready&&a.scripts[b].exec_trigger){c=true;a.scripts[b].exec_trigger();a.scripts[b].exec_trigger=null}}return c}function t(a,c,b,d){a.onload=a.onreadystatechange=function(){if((a.readyState&&a.readyState!="complete"&&a.readyState!="loaded")||c[b])return;a.onload=a.onreadystatechange=null;d()}}function I(a){a.ready=a.finished=true;for(var c=0;c<a.finished_listeners.length;c++){setTimeout(a.finished_listeners[c],0)}a.ready_listeners=[];a.finished_listeners=[]}function P(d,f,e,g,h){setTimeout(function(){var a,c=f.real_src,b;if("item"in i){if(!i[0]){setTimeout(arguments.callee,25);return}i=i[0]}a=document.createElement("script");if(f.type)a.type=f.type;if(f.charset)a.charset=f.charset;if(h){if(r){e.elem=a;if(E){a.preload=true;a.onpreload=g}else{a.onreadystatechange=function(){if(a.readyState=="loaded")g();a.onreadystatechange=null}}a.src=c}else if(h&&c.indexOf(D)==0&&d[y]){b=new XMLHttpRequest();b.onreadystatechange=function(){if(b.readyState==4){b.onreadystatechange=function(){};e.text=b.responseText+"\n//@ sourceURL="+c;g()}};b.open("GET",c);b.send()}else{a.type="text/cache-script";t(a,e,"ready",function(){i.removeChild(a);g()});a.src=c;i.insertBefore(a,i.firstChild)}}else if(F){a.async=false;t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}else{t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}},0)}function J(){var l={},Q=r||M,n=[],p={},m;l[y]=true;l[z]=false;l[u]=false;l[A]=false;l[B]="";function R(a,c,b){var d;function f(){if(d!=null){I(b);d=null}}if(p[c.src].finished)return;if(!a[u])p[c.src].finished=true;d=b.elem||document.createElement("script");if(c.type)d.type=c.type;if(c.charset)d.charset=c.charset;t(d,b,"finished",f);if(b.elem){b.elem=null}else if(b.text){d.onload=d.onreadystatechange=null;d.text=b.text}else{d.src=c.real_src}i.insertBefore(d,i.firstChild);if(b.text){f()}}function S(c,b,d,f){var e,g,h=function(){b.ready_cb(b,function(){R(c,b,e)})},j=function(){b.finished_cb(b,d)};b.src=N(b.src,c[B]);b.real_src=b.src+(c[A]?((/\?.*$/.test(b.src)?"&_":"?_")+~~(Math.random()*1E9)+"="):"");if(!p[b.src])p[b.src]={items:[],finished:false};g=p[b.src].items;if(c[u]||g.length==0){e=g[g.length]={ready:false,finished:false,ready_listeners:[h],finished_listeners:[j]};P(c,b,e,((f)?function(){e.ready=true;for(var a=0;a<e.ready_listeners.length;a++){setTimeout(e.ready_listeners[a],0)}e.ready_listeners=[]}:function(){I(e)}),f)}else{e=g[0];if(e.finished){setTimeout(j,0)}else{e.finished_listeners.push(j)}}}function v(){var e,g=s(l,{}),h=[],j=0,w=false,k;function T(a,c){a.ready=true;a.exec_trigger=c;x()}function U(a,c){a.ready=a.finished=true;a.exec_trigger=null;for(var b=0;b<c.scripts.length;b++){if(!c.scripts[b].finished)return}c.finished=true;x()}function x(){while(j<h.length){if(G(h[j])){try{h[j]()}catch(err){}}else if(!h[j].finished){if(O(h[j]))continue;break}j++}if(j==h.length){w=false;k=false}}function V(){if(!k||!k.scripts){h.push(k={scripts:[],finished:true})}}e={script:function(){for(var f=0;f<arguments.length;f++){(function(a,c){var b;if(!H(a)){c=[a]}for(var d=0;d<c.length;d++){V();a=c[d];if(G(a))a=a();if(!a)continue;if(H(a)){b=[].slice.call(a);b.push(d,1);c.splice.call(c,b);d--;continue}if(typeof a=="string")a={src:a};a=s(a,{ready:false,ready_cb:T,finished:false,finished_cb:U});k.finished=false;k.scripts.push(a);S(g,a,k,(Q&&w));w=true;if(g[z])e.wait()}})(arguments[f],arguments[f])}return e},wait:function(){if(arguments.length>0){for(var a=0;a<arguments.length;a++){h.push(arguments[a])}k=h[h.length-1]}else k=false;x();return e}};return{script:e.script,wait:e.wait,setOptions:function(a){s(a,g);return e}}}m={setGlobalDefaults:function(a){s(a,l);return m},setOptions:function(){return v().setOptions.apply(null,arguments)},script:function(){return v().script.apply(null,arguments)},wait:function(){return v().wait.apply(null,arguments)},queueScript:function(){n[n.length]={type:"script",args:[].slice.call(arguments)};return m},queueWait:function(){n[n.length]={type:"wait",args:[].slice.call(arguments)};return m},runQueue:function(){var a=m,c=n.length,b=c,d;for(;--b>=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$LAB=K;return m},sandbox:function(){return J()}};return m}o.$LAB=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this);  
file:a/js/flot/excanvas.js (deleted)
// Copyright 2006 Google Inc.  
//  
// Licensed under the Apache License, Version 2.0 (the "License");  
// you may not use this file except in compliance with the License.  
// You may obtain a copy of the License at  
//  
// http://www.apache.org/licenses/LICENSE-2.0  
//  
// Unless required by applicable law or agreed to in writing, software  
// distributed under the License is distributed on an "AS IS" BASIS,  
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
// See the License for the specific language governing permissions and  
// limitations under the License.  
 
 
// Known Issues:  
//  
// * Patterns only support repeat.  
// * Radial gradient are not implemented. The VML version of these look very  
// different from the canvas one.  
// * Clipping paths are not implemented.  
// * Coordsize. The width and height attribute have higher priority than the  
// width and height style values which isn't correct.  
// * Painting mode isn't implemented.  
// * Canvas width/height should is using content-box by default. IE in  
// Quirks mode will draw the canvas using border-box. Either change your  
// doctype to HTML5  
// (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype)  
// or use Box Sizing Behavior from WebFX  
// (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html)  
// * Non uniform scaling does not correctly scale strokes.  
// * Filling very large shapes (above 5000 points) is buggy.  
// * Optimize. There is always room for speed improvements.  
 
// Only add this code if we do not already have a canvas implementation  
if (!document.createElement('canvas').getContext) {  
 
(function() {  
 
// alias some functions to make (compiled) code shorter  
var m = Math;  
var mr = m.round;  
var ms = m.sin;  
var mc = m.cos;  
var abs = m.abs;  
var sqrt = m.sqrt;  
 
// this is used for sub pixel precision  
var Z = 10;  
var Z2 = Z / 2;  
 
/**  
* This funtion is assigned to the <canvas> elements as element.getContext().  
* @this {HTMLElement}  
* @return {CanvasRenderingContext2D_}  
*/  
function getContext() {  
return this.context_ ||  
(this.context_ = new CanvasRenderingContext2D_(this));  
}  
 
var slice = Array.prototype.slice;  
 
/**  
* Binds a function to an object. The returned function will always use the  
* passed in {@code obj} as {@code this}.  
*  
* Example:  
*  
* g = bind(f, obj, a, b)  
* g(c, d) // will do f.call(obj, a, b, c, d)  
*  
* @param {Function} f The function to bind the object to  
* @param {Object} obj The object that should act as this when the function  
* is called  
* @param {*} var_args Rest arguments that will be used as the initial  
* arguments when the function is called  
* @return {Function} A new function that has bound this  
*/  
function bind(f, obj, var_args) {  
var a = slice.call(arguments, 2);  
return function() {  
return f.apply(obj, a.concat(slice.call(arguments)));  
};  
}  
 
function encodeHtmlAttribute(s) {  
return String(s).replace(/&/g, '&amp;').replace(/"/g, '&quot;');  
}  
 
function addNamespacesAndStylesheet(doc) {  
// create xmlns  
if (!doc.namespaces['g_vml_']) {  
doc.namespaces.add('g_vml_', 'urn:schemas-microsoft-com:vml',  
'#default#VML');  
 
}  
if (!doc.namespaces['g_o_']) {  
doc.namespaces.add('g_o_', 'urn:schemas-microsoft-com:office:office',  
'#default#VML');  
}  
 
// Setup default CSS. Only add one style sheet per document  
if (!doc.styleSheets['ex_canvas_']) {  
var ss = doc.createStyleSheet();  
ss.owningElement.id = 'ex_canvas_';  
ss.cssText = 'canvas{display:inline-block;overflow:hidden;' +  
// default size is 300x150 in Gecko and Opera  
'text-align:left;width:300px;height:150px}';  
}  
}  
 
// Add namespaces and stylesheet at startup.  
addNamespacesAndStylesheet(document);  
 
var G_vmlCanvasManager_ = {  
init: function(opt_doc) {  
if (/MSIE/.test(navigator.userAgent) && !window.opera) {  
var doc = opt_doc || document;  
// Create a dummy element so that IE will allow canvas elements to be  
// recognized.  
doc.createElement('canvas');  
doc.attachEvent('onreadystatechange', bind(this.init_, this, doc));  
}  
},  
 
init_: function(doc) {  
// find all canvas elements  
var els = doc.getElementsByTagName('canvas');  
for (var i = 0; i < els.length; i++) {  
this.initElement(els[i]);  
}  
},  
 
/**  
* Public initializes a canvas element so that it can be used as canvas  
* element from now on. This is called automatically before the page is  
* loaded but if you are creating elements using createElement you need to  
* make sure this is called on the element.  
* @param {HTMLElement} el The canvas element to initialize.  
* @return {HTMLElement} the element that was created.  
*/  
initElement: function(el) {  
if (!el.getContext) {  
el.getContext = getContext;  
 
// Add namespaces and stylesheet to document of the element.  
addNamespacesAndStylesheet(el.ownerDocument);  
 
// Remove fallback content. There is no way to hide text nodes so we  
// just remove all childNodes. We could hide all elements and remove  
// text nodes but who really cares about the fallback content.  
el.innerHTML = '';  
 
// do not use inline function because that will leak memory  
el.attachEvent('onpropertychange', onPropertyChange);  
el.attachEvent('onresize', onResize);  
 
var attrs = el.attributes;  
if (attrs.width && attrs.width.specified) {  
// TODO: use runtimeStyle and coordsize  
// el.getContext().setWidth_(attrs.width.nodeValue);  
el.style.width = attrs.width.nodeValue + 'px';  
} else {  
el.width = el.clientWidth;  
}  
if (attrs.height && attrs.height.specified) {  
// TODO: use runtimeStyle and coordsize  
// el.getContext().setHeight_(attrs.height.nodeValue);  
el.style.height = attrs.height.nodeValue + 'px';  
} else {  
el.height = el.clientHeight;  
}  
//el.getContext().setCoordsize_()  
}  
return el;  
}  
};  
 
function onPropertyChange(e) {  
var el = e.srcElement;  
 
switch (e.propertyName) {  
case 'width':  
el.getContext().clearRect();  
el.style.width = el.attributes.width.nodeValue + 'px';  
// In IE8 this does not trigger onresize.  
el.firstChild.style.width = el.clientWidth + 'px';  
break;  
case 'height':  
el.getContext().clearRect();  
el.style.height = el.attributes.height.nodeValue + 'px';  
el.firstChild.style.height = el.clientHeight + 'px';  
break;  
}  
}  
 
function onResize(e) {  
var el = e.srcElement;  
if (el.firstChild) {  
el.firstChild.style.width = el.clientWidth + 'px';  
el.firstChild.style.height = el.clientHeight + 'px';  
}  
}  
 
G_vmlCanvasManager_.init();  
 
// precompute "00" to "FF"  
var decToHex = [];  
for (var i = 0; i < 16; i++) {  
for (var j = 0; j < 16; j++) {  
decToHex[i * 16 + j] = i.toString(16) + j.toString(16);  
}  
}  
 
function createMatrixIdentity() {  
return [  
[1, 0, 0],  
[0, 1, 0],  
[0, 0, 1]  
];  
}  
 
function matrixMultiply(m1, m2) {  
var result = createMatrixIdentity();  
 
for (var x = 0; x < 3; x++) {  
for (var y = 0; y < 3; y++) {  
var sum = 0;  
 
for (var z = 0; z < 3; z++) {  
sum += m1[x][z] * m2[z][y];  
}  
 
result[x][y] = sum;  
}  
}  
return result;  
}  
 
function copyState(o1, o2) {  
o2.fillStyle = o1.fillStyle;  
o2.lineCap = o1.lineCap;  
o2.lineJoin = o1.lineJoin;  
o2.lineWidth = o1.lineWidth;  
o2.miterLimit = o1.miterLimit;  
o2.shadowBlur = o1.shadowBlur;  
o2.shadowColor = o1.shadowColor;  
o2.shadowOffsetX = o1.shadowOffsetX;  
o2.shadowOffsetY = o1.shadowOffsetY;  
o2.strokeStyle = o1.strokeStyle;  
o2.globalAlpha = o1.globalAlpha;  
o2.font = o1.font;  
o2.textAlign = o1.textAlign;  
o2.textBaseline = o1.textBaseline;  
o2.arcScaleX_ = o1.arcScaleX_;  
o2.arcScaleY_ = o1.arcScaleY_;  
o2.lineScale_ = o1.lineScale_;  
}  
 
var colorData = {  
aliceblue: '#F0F8FF',  
antiquewhite: '#FAEBD7',  
aquamarine: '#7FFFD4',  
azure: '#F0FFFF',  
beige: '#F5F5DC',  
bisque: '#FFE4C4',  
black: '#000000',  
blanchedalmond: '#FFEBCD',  
blueviolet: '#8A2BE2',  
brown: '#A52A2A',  
burlywood: '#DEB887',  
cadetblue: '#5F9EA0',  
chartreuse: '#7FFF00',  
chocolate: '#D2691E',  
coral: '#FF7F50',  
cornflowerblue: '#6495ED',  
cornsilk: '#FFF8DC',  
crimson: '#DC143C',  
cyan: '#00FFFF',  
darkblue: '#00008B',  
darkcyan: '#008B8B',  
darkgoldenrod: '#B8860B',  
darkgray: '#A9A9A9',  
darkgreen: '#006400',  
darkgrey: '#A9A9A9',  
darkkhaki: '#BDB76B',  
darkmagenta: '#8B008B',  
darkolivegreen: '#556B2F',  
darkorange: '#FF8C00',  
darkorchid: '#9932CC',  
darkred: '#8B0000',  
darksalmon: '#E9967A',  
darkseagreen: '#8FBC8F',  
darkslateblue: '#483D8B',  
darkslategray: '#2F4F4F',  
darkslategrey: '#2F4F4F',  
darkturquoise: '#00CED1',  
darkviolet: '#9400D3',  
deeppink: '#FF1493',  
deepskyblue: '#00BFFF',  
dimgray: '#696969',  
dimgrey: '#696969',  
dodgerblue: '#1E90FF',  
firebrick: '#B22222',  
floralwhite: '#FFFAF0',  
forestgreen: '#228B22',  
gainsboro: '#DCDCDC',  
ghostwhite: '#F8F8FF',  
gold: '#FFD700',  
goldenrod: '#DAA520',  
grey: '#808080',  
greenyellow: '#ADFF2F',  
honeydew: '#F0FFF0',  
hotpink: '#FF69B4',  
indianred: '#CD5C5C',  
indigo: '#4B0082',  
ivory: '#FFFFF0',  
khaki: '#F0E68C',  
lavender: '#E6E6FA',  
lavenderblush: '#FFF0F5',  
lawngreen: '#7CFC00',  
lemonchiffon: '#FFFACD',  
lightblue: '#ADD8E6',  
lightcoral: '#F08080',  
lightcyan: '#E0FFFF',  
lightgoldenrodyellow: '#FAFAD2',  
lightgreen: '#90EE90',  
lightgrey: '#D3D3D3',  
lightpink: '#FFB6C1',  
lightsalmon: '#FFA07A',  
lightseagreen: '#20B2AA',  
lightskyblue: '#87CEFA',  
lightslategray: '#778899',  
lightslategrey: '#778899',  
lightsteelblue: '#B0C4DE',  
lightyellow: '#FFFFE0',  
limegreen: '#32CD32',  
linen: '#FAF0E6',  
magenta: '#FF00FF',  
mediumaquamarine: '#66CDAA',  
mediumblue: '#0000CD',  
mediumorchid: '#BA55D3',  
mediumpurple: '#9370DB',  
mediumseagreen: '#3CB371',  
mediumslateblue: '#7B68EE',  
mediumspringgreen: '#00FA9A',  
mediumturquoise: '#48D1CC',  
mediumvioletred: '#C71585',  
midnightblue: '#191970',  
mintcream: '#F5FFFA',  
mistyrose: '#FFE4E1',  
moccasin: '#FFE4B5',  
navajowhite: '#FFDEAD',  
oldlace: '#FDF5E6',  
olivedrab: '#6B8E23',  
orange: '#FFA500',  
orangered: '#FF4500',  
orchid: '#DA70D6',  
palegoldenrod: '#EEE8AA',  
palegreen: '#98FB98',  
paleturquoise: '#AFEEEE',  
palevioletred: '#DB7093',  
papayawhip: '#FFEFD5',  
peachpuff: '#FFDAB9',  
peru: '#CD853F',  
pink: '#FFC0CB',  
plum: '#DDA0DD',  
powderblue: '#B0E0E6',  
rosybrown: '#BC8F8F',  
royalblue: '#4169E1',  
saddlebrown: '#8B4513',  
salmon: '#FA8072',  
sandybrown: '#F4A460',  
seagreen: '#2E8B57',  
seashell: '#FFF5EE',  
sienna: '#A0522D',  
skyblue: '#87CEEB',  
slateblue: '#6A5ACD',  
slategray: '#708090',  
slategrey: '#708090',  
snow: '#FFFAFA',  
springgreen: '#00FF7F',  
steelblue: '#4682B4',  
tan: '#D2B48C',  
thistle: '#D8BFD8',  
tomato: '#FF6347',  
turquoise: '#40E0D0',  
violet: '#EE82EE',  
wheat: '#F5DEB3',  
whitesmoke: '#F5F5F5',  
yellowgreen: '#9ACD32'  
};  
 
 
function getRgbHslContent(styleString) {  
var start = styleString.indexOf('(', 3);  
var end = styleString.indexOf(')', start + 1);  
var parts = styleString.substring(start + 1, end).split(',');  
// add alpha if needed  
if (parts.length == 4 && styleString.substr(3, 1) == 'a') {  
alpha = Number(parts[3]);  
} else {  
parts[3] = 1;  
}  
return parts;  
}  
 
function percent(s) {  
return parseFloat(s) / 100;  
}  
 
function clamp(v, min, max) {  
return Math.min(max, Math.max(min, v));  
}  
 
function hslToRgb(parts){  
var r, g, b;  
h = parseFloat(parts[0]) / 360 % 360;  
if (h < 0)  
h++;  
s = clamp(percent(parts[1]), 0, 1);  
l = clamp(percent(parts[2]), 0, 1);  
if (s == 0) {  
r = g = b = l; // achromatic  
} else {  
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;  
var p = 2 * l - q;  
r = hueToRgb(p, q, h + 1 / 3);  
g = hueToRgb(p, q, h);  
b = hueToRgb(p, q, h - 1 / 3);  
}  
 
return '#' + decToHex[Math.floor(r * 255)] +  
decToHex[Math.floor(g * 255)] +  
decToHex[Math.floor(b * 255)];  
}  
 
function hueToRgb(m1, m2, h) {  
if (h < 0)  
h++;  
if (h > 1)  
h--;  
 
if (6 * h < 1)  
return m1 + (m2 - m1) * 6 * h;  
else if (2 * h < 1)  
return m2;  
else if (3 * h < 2)  
return m1 + (m2 - m1) * (2 / 3 - h) * 6;  
else  
return m1;  
}  
 
function processStyle(styleString) {  
var str, alpha = 1;  
 
styleString = String(styleString);  
if (styleString.charAt(0) == '#') {  
str = styleString;  
} else if (/^rgb/.test(styleString)) {  
var parts = getRgbHslContent(styleString);  
var str = '#', n;  
for (var i = 0; i < 3; i++) {  
if (parts[i].indexOf('%') != -1) {  
n = Math.floor(percent(parts[i]) * 255);  
} else {  
n = Number(parts[i]);  
}  
str += decToHex[clamp(n, 0, 255)];  
}  
alpha = parts[3];  
} else if (/^hsl/.test(styleString)) {  
var parts = getRgbHslContent(styleString);  
str = hslToRgb(parts);  
alpha = parts[3];  
} else {  
str = colorData[styleString] || styleString;  
}  
return {color: str, alpha: alpha};  
}  
 
var DEFAULT_STYLE = {  
style: 'normal',  
variant: 'normal',  
weight: 'normal',  
size: 10,  
family: 'sans-serif'  
};  
 
// Internal text style cache  
var fontStyleCache = {};  
 
function processFontStyle(styleString) {  
if (fontStyleCache[styleString]) {  
return fontStyleCache[styleString];  
}  
 
var el = document.createElement('div');  
var style = el.style;  
try {  
style.font = styleString;  
} catch (ex) {  
// Ignore failures to set to invalid font.  
}  
 
return fontStyleCache[styleString] = {  
style: style.fontStyle || DEFAULT_STYLE.style,  
variant: style.fontVariant || DEFAULT_STYLE.variant,  
weight: style.fontWeight || DEFAULT_STYLE.weight,  
size: style.fontSize || DEFAULT_STYLE.size,  
family: style.fontFamily || DEFAULT_STYLE.family  
};  
}  
 
function getComputedStyle(style, element) {  
var computedStyle = {};  
 
for (var p in style) {  
computedStyle[p] = style[p];  
}  
 
// Compute the size  
var canvasFontSize = parseFloat(element.currentStyle.fontSize),  
fontSize = parseFloat(style.size);  
 
if (typeof style.size == 'number') {  
computedStyle.size = style.size;  
} else if (style.size.indexOf('px') != -1) {  
computedStyle.size = fontSize;  
} else if (style.size.indexOf('em') != -1) {  
computedStyle.size = canvasFontSize * fontSize;  
} else if(style.size.indexOf('%') != -1) {  
computedStyle.size = (canvasFontSize / 100) * fontSize;  
} else if (style.size.indexOf('pt') != -1) {  
computedStyle.size = fontSize / .75;  
} else {  
computedStyle.size = canvasFontSize;  
}  
 
// Different scaling between normal text and VML text. This was found using  
// trial and error to get the same size as non VML text.  
computedStyle.size *= 0.981;  
 
return computedStyle;  
}  
 
function buildStyle(style) {  
return style.style + ' ' + style.variant + ' ' + style.weight + ' ' +  
style.size + 'px ' + style.family;  
}  
 
function processLineCap(lineCap) {  
switch (lineCap) {  
case 'butt':  
return 'flat';  
case 'round':  
return 'round';  
case 'square':  
default:  
return 'square';  
}  
}  
 
/**  
* This class implements CanvasRenderingContext2D interface as described by  
* the WHATWG.  
* @param {HTMLElement} surfaceElement The element that the 2D context should  
* be associated with  
*/  
function CanvasRenderingContext2D_(surfaceElement) {  
this.m_ = createMatrixIdentity();  
 
this.mStack_ = [];  
this.aStack_ = [];  
this.currentPath_ = [];  
 
// Canvas context properties  
this.strokeStyle = '#000';  
this.fillStyle = '#000';  
 
this.lineWidth = 1;  
this.lineJoin = 'miter';  
this.lineCap = 'butt';  
this.miterLimit = Z * 1;  
this.globalAlpha = 1;  
this.font = '10px sans-serif';  
this.textAlign = 'left';  
this.textBaseline = 'alphabetic';  
this.canvas = surfaceElement;  
 
var el = surfaceElement.ownerDocument.createElement('div');  
el.style.width = surfaceElement.clientWidth + 'px';  
el.style.height = surfaceElement.clientHeight + 'px';  
el.style.overflow = 'hidden';  
el.style.position = 'absolute';  
surfaceElement.appendChild(el);  
 
this.element_ = el;  
this.arcScaleX_ = 1;  
this.arcScaleY_ = 1;  
this.lineScale_ = 1;  
}  
 
var contextPrototype = CanvasRenderingContext2D_.prototype;  
contextPrototype.clearRect = function() {  
if (this.textMeasureEl_) {  
this.textMeasureEl_.removeNode(true);  
this.textMeasureEl_ = null;  
}  
this.element_.innerHTML = '';  
};  
 
contextPrototype.beginPath = function() {  
// TODO: Branch current matrix so that save/restore has no effect  
// as per safari docs.  
this.currentPath_ = [];  
};  
 
contextPrototype.moveTo = function(aX, aY) {  
var p = this.getCoords_(aX, aY);  
this.currentPath_.push({type: 'moveTo', x: p.x, y: p.y});  
this.currentX_ = p.x;  
this.currentY_ = p.y;  
};  
 
contextPrototype.lineTo = function(aX, aY) {  
var p = this.getCoords_(aX, aY);  
this.currentPath_.push({type: 'lineTo', x: p.x, y: p.y});  
 
this.currentX_ = p.x;  
this.currentY_ = p.y;  
};  
 
contextPrototype.bezierCurveTo = function(aCP1x, aCP1y,  
aCP2x, aCP2y,  
aX, aY) {  
var p = this.getCoords_(aX, aY);  
var cp1 = this.getCoords_(aCP1x, aCP1y);  
var cp2 = this.getCoords_(aCP2x, aCP2y);  
bezierCurveTo(this, cp1, cp2, p);  
};  
 
// Helper function that takes the already fixed cordinates.  
function bezierCurveTo(self, cp1, cp2, p) {  
self.currentPath_.push({  
type: 'bezierCurveTo',  
cp1x: cp1.x,  
cp1y: cp1.y,  
cp2x: cp2.x,  
cp2y: cp2.y,  
x: p.x,  
y: p.y  
});  
self.currentX_ = p.x;  
self.currentY_ = p.y;  
}  
 
contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) {  
// the following is lifted almost directly from  
// http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes  
 
var cp = this.getCoords_(aCPx, aCPy);  
var p = this.getCoords_(aX, aY);  
 
var cp1 = {  
x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_),  
y: this.currentY_ + 2.0 / 3.0 * (cp.y - this.currentY_)  
};  
var cp2 = {  
x: cp1.x + (p.x - this.currentX_) / 3.0,  
y: cp1.y + (p.y - this.currentY_) / 3.0  
};  
 
bezierCurveTo(this, cp1, cp2, p);  
};  
 
contextPrototype.arc = function(aX, aY, aRadius,  
aStartAngle, aEndAngle, aClockwise) {  
aRadius *= Z;  
var arcType = aClockwise ? 'at' : 'wa';  
 
var xStart = aX + mc(aStartAngle) * aRadius - Z2;  
var yStart = aY + ms(aStartAngle) * aRadius - Z2;  
 
var xEnd = aX + mc(aEndAngle) * aRadius - Z2;  
var yEnd = aY + ms(aEndAngle) * aRadius - Z2;  
 
// IE won't render arches drawn counter clockwise if xStart == xEnd.  
if (xStart == xEnd && !aClockwise) {  
xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something  
// that can be represented in binary  
}  
 
var p = this.getCoords_(aX, aY);  
var pStart = this.getCoords_(xStart, yStart);  
var pEnd = this.getCoords_(xEnd, yEnd);  
 
this.currentPath_.push({type: arcType,  
x: p.x,  
y: p.y,  
radius: aRadius,  
xStart: pStart.x,  
yStart: pStart.y,  
xEnd: pEnd.x,  
yEnd: pEnd.y});  
 
};  
 
contextPrototype.rect = function(aX, aY, aWidth, aHeight) {  
this.moveTo(aX, aY);  
this.lineTo(aX + aWidth, aY);  
this.lineTo(aX + aWidth, aY + aHeight);  
this.lineTo(aX, aY + aHeight);  
this.closePath();  
};  
 
contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) {  
var oldPath = this.currentPath_;  
this.beginPath();  
 
this.moveTo(aX, aY);  
this.lineTo(aX + aWidth, aY);  
this.lineTo(aX + aWidth, aY + aHeight);  
this.lineTo(aX, aY + aHeight);  
this.closePath();  
this.stroke();  
 
this.currentPath_ = oldPath;  
};  
 
contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) {  
var oldPath = this.currentPath_;  
this.beginPath();  
 
this.moveTo(aX, aY);  
this.lineTo(aX + aWidth, aY);  
this.lineTo(aX + aWidth, aY + aHeight);  
this.lineTo(aX, aY + aHeight);  
this.closePath();  
this.fill();  
 
this.currentPath_ = oldPath;  
};  
 
contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) {  
var gradient = new CanvasGradient_('gradient');  
gradient.x0_ = aX0;  
gradient.y0_ = aY0;  
gradient.x1_ = aX1;  
gradient.y1_ = aY1;  
return gradient;  
};  
 
contextPrototype.createRadialGradient = function(aX0, aY0, aR0,  
aX1, aY1, aR1) {  
var gradient = new CanvasGradient_('gradientradial');  
gradient.x0_ = aX0;  
gradient.y0_ = aY0;  
gradient.r0_ = aR0;  
gradient.x1_ = aX1;  
gradient.y1_ = aY1;  
gradient.r1_ = aR1;  
return gradient;  
};  
 
contextPrototype.drawImage = function(image, var_args) {  
var dx, dy, dw, dh, sx, sy, sw, sh;  
 
// to find the original width we overide the width and height  
var oldRuntimeWidth = image.runtimeStyle.width;  
var oldRuntimeHeight = image.runtimeStyle.height;  
image.runtimeStyle.width = 'auto';  
image.runtimeStyle.height = 'auto';  
 
// get the original size  
var w = image.width;  
var h = image.height;  
 
// and remove overides  
image.runtimeStyle.width = oldRuntimeWidth;  
image.runtimeStyle.height = oldRuntimeHeight;  
 
if (arguments.length == 3) {  
dx = arguments[1];  
dy = arguments[2];  
sx = sy = 0;  
sw = dw = w;  
sh = dh = h;  
} else if (arguments.length == 5) {  
dx = arguments[1];  
dy = arguments[2];  
dw = arguments[3];  
dh = arguments[4];  
sx = sy = 0;  
sw = w;  
sh = h;  
} else if (arguments.length == 9) {  
sx = arguments[1];  
sy = arguments[2];  
sw = arguments[3];  
sh = arguments[4];  
dx = arguments[5];  
dy = arguments[6];  
dw = arguments[7];  
dh = arguments[8];  
} else {  
throw Error('Invalid number of arguments');  
}  
 
var d = this.getCoords_(dx, dy);  
 
var w2 = sw / 2;  
var h2 = sh / 2;  
 
var vmlStr = [];  
 
var W = 10;  
var H = 10;  
 
// For some reason that I've now forgotten, using divs didn't work  
vmlStr.push(' <g_vml_:group',  
' coordsize="', Z * W, ',', Z * H, '"',  
' coordorigin="0,0"' ,  
' style="width:', W, 'px;height:', H, 'px;position:absolute;');  
 
// If filters are necessary (rotation exists), create them  
// filters are bog-slow, so only create them if abbsolutely necessary  
// The following check doesn't account for skews (which don't exist  
// in the canvas spec (yet) anyway.  
 
if (this.m_[0][0] != 1 || this.m_[0][1] ||  
this.m_[1][1] != 1 || this.m_[1][0]) {  
var filter = [];  
 
// Note the 12/21 reversal  
filter.push('M11=', this.m_[0][0], ',',  
'M12=', this.m_[1][0], ',',  
'M21=', this.m_[0][1], ',',  
'M22=', this.m_[1][1], ',',  
'Dx=', mr(d.x / Z), ',',  
'Dy=', mr(d.y / Z), '');  
 
// Bounding box calculation (need to minimize displayed area so that  
// filters don't waste time on unused pixels.  
var max = d;  
var c2 = this.getCoords_(dx + dw, dy);  
var c3 = this.getCoords_(dx, dy + dh);  
var c4 = this.getCoords_(dx + dw, dy + dh);  
 
max.x = m.max(max.x, c2.x, c3.x, c4.x);  
max.y = m.max(max.y, c2.y, c3.y, c4.y);  
 
vmlStr.push('padding:0 ', mr(max.x / Z), 'px ', mr(max.y / Z),  
'px 0;filter:progid:DXImageTransform.Microsoft.Matrix(',  
filter.join(''), ", sizingmethod='clip');");  
 
} else {  
vmlStr.push('top:', mr(d.y / Z), 'px;left:', mr(d.x / Z), 'px;');  
}  
 
vmlStr.push(' ">' ,  
'<g_vml_:image src="', image.src, '"',  
' style="width:', Z * dw, 'px;',  
' height:', Z * dh, 'px"',  
' cropleft="', sx / w, '"',  
' croptop="', sy / h, '"',  
' cropright="', (w - sx - sw) / w, '"',  
' cropbottom="', (h - sy - sh) / h, '"',  
' />',  
'</g_vml_:group>');  
 
this.element_.insertAdjacentHTML('BeforeEnd', vmlStr.join(''));  
};  
 
contextPrototype.stroke = function(aFill) {  
var W = 10;  
var H = 10;  
// Divide the shape into chunks if it's too long because IE has a limit  
// somewhere for how long a VML shape can be. This simple division does  
// not work with fills, only strokes, unfortunately.  
var chunkSize = 5000;  
 
var min = {x: null, y: null};  
var max = {x: null, y: null};  
 
for (var j = 0; j < this.currentPath_.length; j += chunkSize) {  
var lineStr = [];  
var lineOpen = false;  
 
lineStr.push('<g_vml_:shape',  
' filled="', !!aFill, '"',  
' style="position:absolute;width:', W, 'px;height:', H, 'px;"',  
' coordorigin="0,0"',  
' coordsize="', Z * W, ',', Z * H, '"',  
' stroked="', !aFill, '"',  
' path="');  
 
var newSeq = false;  
 
for (var i = j; i < Math.min(j + chunkSize, this.currentPath_.length); i++) {  
if (i % chunkSize == 0 && i > 0) { // move into position for next chunk  
lineStr.push(' m ', mr(this.currentPath_[i-1].x), ',', mr(this.currentPath_[i-1].y));  
}  
 
var p = this.currentPath_[i];  
var c;  
 
switch (p.type) {  
case 'moveTo':  
c = p;  
lineStr.push(' m ', mr(p.x), ',', mr(p.y));  
break;  
case 'lineTo':  
lineStr.push(' l ', mr(p.x), ',', mr(p.y));  
break;  
case 'close':  
lineStr.push(' x ');  
p = null;  
break;  
case 'bezierCurveTo':  
lineStr.push(' c ',  
mr(p.cp1x), ',', mr(p.cp1y), ',',  
mr(p.cp2x), ',', mr(p.cp2y), ',',  
mr(p.x), ',', mr(p.y));  
break;  
case 'at':  
case 'wa':  
lineStr.push(' ', p.type, ' ',  
mr(p.x - this.arcScaleX_ * p.radius), ',',  
mr(p.y - this.arcScaleY_ * p.radius), ' ',  
mr(p.x + this.arcScaleX_ * p.radius), ',',  
mr(p.y + this.arcScaleY_ * p.radius), ' ',  
mr(p.xStart), ',', mr(p.yStart), ' ',  
mr(p.xEnd), ',', mr(p.yEnd));  
break;  
}  
 
 
// TODO: Following is broken for curves due to  
// move to proper paths.  
 
// Figure out dimensions so we can do gradient fills  
// properly  
if (p) {  
if (min.x == null || p.x < min.x) {  
min.x = p.x;  
}  
if (max.x == null || p.x > max.x) {  
max.x = p.x;  
}  
if (min.y == null || p.y < min.y) {  
min.y = p.y;  
}  
if (max.y == null || p.y > max.y) {  
max.y = p.y;  
}  
}  
}  
lineStr.push(' ">');  
 
if (!aFill) {  
appendStroke(this, lineStr);  
} else {  
appendFill(this, lineStr, min, max);  
}  
 
lineStr.push('</g_vml_:shape>');  
 
this.element_.insertAdjacentHTML('beforeEnd', lineStr.join(''));  
}  
};  
 
function appendStroke(ctx, lineStr) {  
var a = processStyle(ctx.strokeStyle);  
var color = a.color;  
var opacity = a.alpha * ctx.globalAlpha;  
var lineWidth = ctx.lineScale_ * ctx.lineWidth;  
 
// VML cannot correctly render a line if the width is less than 1px.  
// In that case, we dilute the color to make the line look thinner.  
if (lineWidth < 1) {  
opacity *= lineWidth;  
}  
 
lineStr.push(  
'<g_vml_:stroke',  
' opacity="', opacity, '"',  
' joinstyle="', ctx.lineJoin, '"',  
' miterlimit="', ctx.miterLimit, '"',  
' endcap="', processLineCap(ctx.lineCap), '"',  
' weight="', lineWidth, 'px"',  
' color="', color, '" />'  
);  
}  
 
function appendFill(ctx, lineStr, min, max) {  
var fillStyle = ctx.fillStyle;  
var arcScaleX = ctx.arcScaleX_;  
var arcScaleY = ctx.arcScaleY_;  
var width = max.x - min.x;  
var height = max.y - min.y;  
if (fillStyle instanceof CanvasGradient_) {  
// TODO: Gradients transformed with the transformation matrix.  
var angle = 0;  
var focus = {x: 0, y: 0};  
 
// additional offset  
var shift = 0;  
// scale factor for offset  
var expansion = 1;  
 
if (fillStyle.type_ == 'gradient') {  
var x0 = fillStyle.x0_ / arcScaleX;  
var y0 = fillStyle.y0_ / arcScaleY;  
var x1 = fillStyle.x1_ / arcScaleX;  
var y1 = fillStyle.y1_ / arcScaleY;  
var p0 = ctx.getCoords_(x0, y0);  
var p1 = ctx.getCoords_(x1, y1);  
var dx = p1.x - p0.x;  
var dy = p1.y - p0.y;  
angle = Math.atan2(dx, dy) * 180 / Math.PI;  
 
// The angle should be a non-negative number.  
if (angle < 0) {  
angle += 360;  
}  
 
// Very small angles produce an unexpected result because they are  
// converted to a scientific notation string.  
if (angle < 1e-6) {  
angle = 0;  
}  
} else {  
var p0 = ctx.getCoords_(fillStyle.x0_, fillStyle.y0_);  
focus = {  
x: (p0.x - min.x) / width,  
y: (p0.y - min.y) / height  
};  
 
width /= arcScaleX * Z;  
height /= arcScaleY * Z;  
var dimension = m.max(width, height);  
shift = 2 * fillStyle.r0_ / dimension;  
expansion = 2 * fillStyle.r1_ / dimension - shift;  
}  
 
// We need to sort the color stops in ascending order by offset,  
// otherwise IE won't interpret it correctly.  
var stops = fillStyle.colors_;  
stops.sort(function(cs1, cs2) {  
return cs1.offset - cs2.offset;  
});  
 
var length = stops.length;  
var color1 = stops[0].color;  
var color2 = stops[length - 1].color;  
var opacity1 = stops[0].alpha * ctx.globalAlpha;  
var opacity2 = stops[length - 1].alpha * ctx.globalAlpha;  
 
var colors = [];  
for (var i = 0; i < length; i++) {  
var stop = stops[i];  
colors.push(stop.offset * expansion + shift + ' ' + stop.color);  
}  
 
// When colors attribute is used, the meanings of opacity and o:opacity2  
// are reversed.  
lineStr.push('<g_vml_:fill type="', fillStyle.type_, '"',  
' method="none" focus="100%"',  
' color="', color1, '"',  
' color2="', color2, '"',  
' colors="', colors.join(','), '"',  
' opacity="', opacity2, '"',  
' g_o_:opacity2="', opacity1, '"',  
' angle="', angle, '"',  
' focusposition="', focus.x, ',', focus.y, '" />');  
} else if (fillStyle instanceof CanvasPattern_) {  
if (width && height) {  
var deltaLeft = -min.x;  
var deltaTop = -min.y;  
lineStr.push('<g_vml_:fill',  
' position="',  
deltaLeft / width * arcScaleX * arcScaleX, ',',  
deltaTop / height * arcScaleY * arcScaleY, '"',  
' type="tile"',  
// TODO: Figure out the correct size to fit the scale.  
//' size="', w, 'px ', h, 'px"',  
' src="', fillStyle.src_, '" />');  
}  
} else {  
var a = processStyle(ctx.fillStyle);  
var color = a.color;  
var opacity = a.alpha * ctx.globalAlpha;  
lineStr.push('<g_vml_:fill color="', color, '" opacity="', opacity,  
'" />');  
}  
}  
 
contextPrototype.fill = function() {  
this.stroke(true);  
};  
 
contextPrototype.closePath = function() {  
this.currentPath_.push({type: 'close'});  
};  
 
/**  
* @private  
*/  
contextPrototype.getCoords_ = function(aX, aY) {  
var m = this.m_;  
return {  
x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2,  
y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2  
};  
};  
 
contextPrototype.save = function() {  
var o = {};  
copyState(this, o);  
this.aStack_.push(o);  
this.mStack_.push(this.m_);  
this.m_ = matrixMultiply(createMatrixIdentity(), this.m_);  
};  
 
contextPrototype.restore = function() {  
if (this.aStack_.length) {  
copyState(this.aStack_.pop(), this);  
this.m_ = this.mStack_.pop();  
}  
};  
 
function matrixIsFinite(m) {  
return isFinite(m[0][0]) && isFinite(m[0][1]) &&  
isFinite(m[1][0]) && isFinite(m[1][1]) &&  
isFinite(m[2][0]) && isFinite(m[2][1]);  
}  
 
function setM(ctx, m, updateLineScale) {  
if (!matrixIsFinite(m)) {  
return;  
}  
ctx.m_ = m;  
 
if (updateLineScale) {  
// Get the line scale.  
// Determinant of this.m_ means how much the area is enlarged by the  
// transformation. So its square root can be used as a scale factor  
// for width.  
var det = m[0][0] * m[1][1] - m[0][1] * m[1][0];  
ctx.lineScale_ = sqrt(abs(det));  
}  
}  
 
contextPrototype.translate = function(aX, aY) {  
var m1 = [  
[1, 0, 0],  
[0, 1, 0],  
[aX, aY, 1]  
];  
 
setM(this, matrixMultiply(m1, this.m_), false);  
};  
 
contextPrototype.rotate = function(aRot) {  
var c = mc(aRot);  
var s = ms(aRot);  
 
var m1 = [  
[c, s, 0],  
[-s, c, 0],  
[0, 0, 1]  
];  
 
setM(this, matrixMultiply(m1, this.m_), false);  
};  
 
contextPrototype.scale = function(aX, aY) {  
this.arcScaleX_ *= aX;  
this.arcScaleY_ *= aY;  
var m1 = [  
[aX, 0, 0],  
[0, aY, 0],  
[0, 0, 1]  
];  
 
setM(this, matrixMultiply(m1, this.m_), true);  
};  
 
contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) {  
var m1 = [  
[m11, m12, 0],  
[m21, m22, 0],  
[dx, dy, 1]  
];  
 
setM(this, matrixMultiply(m1, this.m_), true);  
};  
 
contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) {  
var m = [  
[m11, m12, 0],  
[m21, m22, 0],  
[dx, dy, 1]  
];  
 
setM(this, m, true);  
};  
 
/**  
* The text drawing function.  
* The maxWidth argument isn't taken in account, since no browser supports  
* it yet.  
*/  
contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) {  
var m = this.m_,  
delta = 1000,  
left = 0,  
right = delta,  
offset = {x: 0, y: 0},  
lineStr = [];  
 
var fontStyle = getComputedStyle(processFontStyle(this.font),  
this.element_);  
 
var fontStyleString = buildStyle(fontStyle);  
 
var elementStyle = this.element_.currentStyle;  
var textAlign = this.textAlign.toLowerCase();  
switch (textAlign) {  
case 'left':  
case 'center':  
case 'right':  
break;  
case 'end':  
textAlign = elementStyle.direction == 'ltr' ? 'right' : 'left';  
break;  
case 'start':  
textAlign = elementStyle.direction == 'rtl' ? 'right' : 'left';  
break;  
default:  
textAlign = 'left';  
}  
 
// 1.75 is an arbitrary number, as there is no info about the text baseline  
switch (this.textBaseline) {  
case 'hanging':  
case 'top':  
offset.y = fontStyle.size / 1.75;  
break;  
case 'middle':  
break;  
default:  
case null:  
case 'alphabetic':  
case 'ideographic':  
case 'bottom':  
offset.y = -fontStyle.size / 2.25;  
break;  
}  
 
switch(textAlign) {  
case 'right':  
left = delta;  
right = 0.05;  
break;  
case 'center':  
left = right = delta / 2;  
break;  
}  
 
var d = this.getCoords_(x + offset.x, y + offset.y);  
 
lineStr.push('<g_vml_:line from="', -left ,' 0" to="', right ,' 0.05" ',  
' coordsize="100 100" coordorigin="0 0"',  
' filled="', !stroke, '" stroked="', !!stroke,  
'" style="position:absolute;width:1px;height:1px;">');  
 
if (stroke) {  
appendStroke(this, lineStr);  
} else {  
// TODO: Fix the min and max params.  
appendFill(this, lineStr, {x: -left, y: 0},  
{x: right, y: fontStyle.size});  
}  
 
var skewM = m[0][0].toFixed(3) + ',' + m[1][0].toFixed(3) + ',' +  
m[0][1].toFixed(3) + ',' + m[1][1].toFixed(3) + ',0,0';  
 
var skewOffset = mr(d.x / Z) + ',' + mr(d.y / Z);  
 
lineStr.push('<g_vml_:skew on="t" matrix="', skewM ,'" ',  
' offset="', skewOffset, '" origin="', left ,' 0" />',  
'<g_vml_:path textpathok="true" />',  
'<g_vml_:textpath on="true" string="',  
encodeHtmlAttribute(text),  
'" style="v-text-align:', textAlign,  
';font:', encodeHtmlAttribute(fontStyleString),  
'" /></g_vml_:line>');  
 
this.element_.insertAdjacentHTML('beforeEnd', lineStr.join(''));  
};  
 
contextPrototype.fillText = function(text, x, y, maxWidth) {  
this.drawText_(text, x, y, maxWidth, false);  
};  
 
contextPrototype.strokeText = function(text, x, y, maxWidth) {  
this.drawText_(text, x, y, maxWidth, true);  
};  
 
contextPrototype.measureText = function(text) {  
if (!this.textMeasureEl_) {  
var s = '<span style="position:absolute;' +  
'top:-20000px;left:0;padding:0;margin:0;border:none;' +  
'white-space:pre;"></span>';  
this.element_.insertAdjacentHTML('beforeEnd', s);  
this.textMeasureEl_ = this.element_.lastChild;  
}  
var doc = this.element_.ownerDocument;  
this.textMeasureEl_.innerHTML = '';  
this.textMeasureEl_.style.font = this.font;  
// Don't use innerHTML or innerText because they allow markup/whitespace.  
this.textMeasureEl_.appendChild(doc.createTextNode(text));  
return {width: this.textMeasureEl_.offsetWidth};  
};  
 
/******** STUBS ********/  
contextPrototype.clip = function() {  
// TODO: Implement  
};  
 
contextPrototype.arcTo = function() {  
// TODO: Implement  
};  
 
contextPrototype.createPattern = function(image, repetition) {  
return new CanvasPattern_(image, repetition);  
};  
 
// Gradient / Pattern Stubs  
function CanvasGradient_(aType) {  
this.type_ = aType;  
this.x0_ = 0;  
this.y0_ = 0;  
this.r0_ = 0;  
this.x1_ = 0;  
this.y1_ = 0;  
this.r1_ = 0;  
this.colors_ = [];  
}  
 
CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) {  
aColor = processStyle(aColor);  
this.colors_.push({offset: aOffset,  
color: aColor.color,  
alpha: aColor.alpha});  
};  
 
function CanvasPattern_(image, repetition) {  
assertImageIsValid(image);  
switch (repetition) {  
case 'repeat':  
case null:  
case '':  
this.repetition_ = 'repeat';  
break  
case 'repeat-x':  
case 'repeat-y':  
case 'no-repeat':  
this.repetition_ = repetition;  
break;  
default:  
throwException('SYNTAX_ERR');  
}  
 
this.src_ = image.src;  
this.width_ = image.width;  
this.height_ = image.height;  
}  
 
function throwException(s) {  
throw new DOMException_(s);  
}  
 
function assertImageIsValid(img) {  
if (!img || img.nodeType != 1 || img.tagName != 'IMG') {  
throwException('TYPE_MISMATCH_ERR');  
}  
if (img.readyState != 'complete') {  
throwException('INVALID_STATE_ERR');  
}  
}  
 
function DOMException_(s) {  
this.code = this[s];  
this.message = s +': DOM Exception ' + this.code;  
}  
var p = DOMException_.prototype = new Error;  
p.INDEX_SIZE_ERR = 1;  
p.DOMSTRING_SIZE_ERR = 2;  
p.HIERARCHY_REQUEST_ERR = 3;  
p.WRONG_DOCUMENT_ERR = 4;  
p.INVALID_CHARACTER_ERR = 5;  
p.NO_DATA_ALLOWED_ERR = 6;  
p.NO_MODIFICATION_ALLOWED_ERR = 7;  
p.NOT_FOUND_ERR = 8;  
p.NOT_SUPPORTED_ERR = 9;  
p.INUSE_ATTRIBUTE_ERR = 10;  
p.INVALID_STATE_ERR = 11;  
p.SYNTAX_ERR = 12;  
p.INVALID_MODIFICATION_ERR = 13;  
p.NAMESPACE_ERR = 14;  
p.INVALID_ACCESS_ERR = 15;  
p.VALIDATION_ERR = 16;  
p.TYPE_MISMATCH_ERR = 17;  
 
// set up externs  
G_vmlCanvasManager = G_vmlCanvasManager_;  
CanvasRenderingContext2D = CanvasRenderingContext2D_;  
CanvasGradient = CanvasGradient_;  
CanvasPattern = CanvasPattern_;  
DOMException = DOMException_;  
})();  
 
} // if  
 
file:a/js/flot/excanvas.min.js (deleted)
if(!document.createElement("canvas").getContext){(function(){var z=Math;var K=z.round;var J=z.sin;var U=z.cos;var b=z.abs;var k=z.sqrt;var D=10;var F=D/2;function T(){return this.context_||(this.context_=new W(this))}var O=Array.prototype.slice;function G(i,j,m){var Z=O.call(arguments,2);return function(){return i.apply(j,Z.concat(O.call(arguments)))}}function AD(Z){return String(Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function r(i){if(!i.namespaces.g_vml_){i.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML")}if(!i.namespaces.g_o_){i.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML")}if(!i.styleSheets.ex_canvas_){var Z=i.createStyleSheet();Z.owningElement.id="ex_canvas_";Z.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}r(document);var E={init:function(Z){if(/MSIE/.test(navigator.userAgent)&&!window.opera){var i=Z||document;i.createElement("canvas");i.attachEvent("onreadystatechange",G(this.init_,this,i))}},init_:function(m){var j=m.getElementsByTagName("canvas");for(var Z=0;Z<j.length;Z++){this.initElement(j[Z])}},initElement:function(i){if(!i.getContext){i.getContext=T;r(i.ownerDocument);i.innerHTML="";i.attachEvent("onpropertychange",S);i.attachEvent("onresize",w);var Z=i.attributes;if(Z.width&&Z.width.specified){i.style.width=Z.width.nodeValue+"px"}else{i.width=i.clientWidth}if(Z.height&&Z.height.specified){i.style.height=Z.height.nodeValue+"px"}else{i.height=i.clientHeight}}return i}};function S(i){var Z=i.srcElement;switch(i.propertyName){case"width":Z.getContext().clearRect();Z.style.width=Z.attributes.width.nodeValue+"px";Z.firstChild.style.width=Z.clientWidth+"px";break;case"height":Z.getContext().clearRect();Z.style.height=Z.attributes.height.nodeValue+"px";Z.firstChild.style.height=Z.clientHeight+"px";break}}function w(i){var Z=i.srcElement;if(Z.firstChild){Z.firstChild.style.width=Z.clientWidth+"px";Z.firstChild.style.height=Z.clientHeight+"px"}}E.init();var I=[];for(var AC=0;AC<16;AC++){for(var AB=0;AB<16;AB++){I[AC*16+AB]=AC.toString(16)+AB.toString(16)}}function V(){return[[1,0,0],[0,1,0],[0,0,1]]}function d(m,j){var i=V();for(var Z=0;Z<3;Z++){for(var AF=0;AF<3;AF++){var p=0;for(var AE=0;AE<3;AE++){p+=m[Z][AE]*j[AE][AF]}i[Z][AF]=p}}return i}function Q(i,Z){Z.fillStyle=i.fillStyle;Z.lineCap=i.lineCap;Z.lineJoin=i.lineJoin;Z.lineWidth=i.lineWidth;Z.miterLimit=i.miterLimit;Z.shadowBlur=i.shadowBlur;Z.shadowColor=i.shadowColor;Z.shadowOffsetX=i.shadowOffsetX;Z.shadowOffsetY=i.shadowOffsetY;Z.strokeStyle=i.strokeStyle;Z.globalAlpha=i.globalAlpha;Z.font=i.font;Z.textAlign=i.textAlign;Z.textBaseline=i.textBaseline;Z.arcScaleX_=i.arcScaleX_;Z.arcScaleY_=i.arcScaleY_;Z.lineScale_=i.lineScale_}var B={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",oldlace:"#FDF5E6",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",whitesmoke:"#F5F5F5",yellowgreen:"#9ACD32"};function g(i){var m=i.indexOf("(",3);var Z=i.indexOf(")",m+1);var j=i.substring(m+1,Z).split(",");if(j.length==4&&i.substr(3,1)=="a"){alpha=Number(j[3])}else{j[3]=1}return j}function C(Z){return parseFloat(Z)/100}function N(i,j,Z){return Math.min(Z,Math.max(j,i))}function c(AF){var j,i,Z;h=parseFloat(AF[0])/360%360;if(h<0){h++}s=N(C(AF[1]),0,1);l=N(C(AF[2]),0,1);if(s==0){j=i=Z=l}else{var m=l<0.5?l*(1+s):l+s-l*s;var AE=2*l-m;j=A(AE,m,h+1/3);i=A(AE,m,h);Z=A(AE,m,h-1/3)}return"#"+I[Math.floor(j*255)]+I[Math.floor(i*255)]+I[Math.floor(Z*255)]}function A(i,Z,j){if(j<0){j++}if(j>1){j--}if(6*j<1){return i+(Z-i)*6*j}else{if(2*j<1){return Z}else{if(3*j<2){return i+(Z-i)*(2/3-j)*6}else{return i}}}}function Y(Z){var AE,p=1;Z=String(Z);if(Z.charAt(0)=="#"){AE=Z}else{if(/^rgb/.test(Z)){var m=g(Z);var AE="#",AF;for(var j=0;j<3;j++){if(m[j].indexOf("%")!=-1){AF=Math.floor(C(m[j])*255)}else{AF=Number(m[j])}AE+=I[N(AF,0,255)]}p=m[3]}else{if(/^hsl/.test(Z)){var m=g(Z);AE=c(m);p=m[3]}else{AE=B[Z]||Z}}}return{color:AE,alpha:p}}var L={style:"normal",variant:"normal",weight:"normal",size:10,family:"sans-serif"};var f={};function X(Z){if(f[Z]){return f[Z]}var m=document.createElement("div");var j=m.style;try{j.font=Z}catch(i){}return f[Z]={style:j.fontStyle||L.style,variant:j.fontVariant||L.variant,weight:j.fontWeight||L.weight,size:j.fontSize||L.size,family:j.fontFamily||L.family}}function P(j,i){var Z={};for(var AF in j){Z[AF]=j[AF]}var AE=parseFloat(i.currentStyle.fontSize),m=parseFloat(j.size);if(typeof j.size=="number"){Z.size=j.size}else{if(j.size.indexOf("px")!=-1){Z.size=m}else{if(j.size.indexOf("em")!=-1){Z.size=AE*m}else{if(j.size.indexOf("%")!=-1){Z.size=(AE/100)*m}else{if(j.size.indexOf("pt")!=-1){Z.size=m/0.75}else{Z.size=AE}}}}}Z.size*=0.981;return Z}function AA(Z){return Z.style+" "+Z.variant+" "+Z.weight+" "+Z.size+"px "+Z.family}function t(Z){switch(Z){case"butt":return"flat";case"round":return"round";case"square":default:return"square"}}function W(i){this.m_=V();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=D*1;this.globalAlpha=1;this.font="10px sans-serif";this.textAlign="left";this.textBaseline="alphabetic";this.canvas=i;var Z=i.ownerDocument.createElement("div");Z.style.width=i.clientWidth+"px";Z.style.height=i.clientHeight+"px";Z.style.overflow="hidden";Z.style.position="absolute";i.appendChild(Z);this.element_=Z;this.arcScaleX_=1;this.arcScaleY_=1;this.lineScale_=1}var M=W.prototype;M.clearRect=function(){if(this.textMeasureEl_){this.textMeasureEl_.removeNode(true);this.textMeasureEl_=null}this.element_.innerHTML=""};M.beginPath=function(){this.currentPath_=[]};M.moveTo=function(i,Z){var j=this.getCoords_(i,Z);this.currentPath_.push({type:"moveTo",x:j.x,y:j.y});this.currentX_=j.x;this.currentY_=j.y};M.lineTo=function(i,Z){var j=this.getCoords_(i,Z);this.currentPath_.push({type:"lineTo",x:j.x,y:j.y});this.currentX_=j.x;this.currentY_=j.y};M.bezierCurveTo=function(j,i,AI,AH,AG,AE){var Z=this.getCoords_(AG,AE);var AF=this.getCoords_(j,i);var m=this.getCoords_(AI,AH);e(this,AF,m,Z)};function e(Z,m,j,i){Z.currentPath_.push({type:"bezierCurveTo",cp1x:m.x,cp1y:m.y,cp2x:j.x,cp2y:j.y,x:i.x,y:i.y});Z.currentX_=i.x;Z.currentY_=i.y}M.quadraticCurveTo=function(AG,j,i,Z){var AF=this.getCoords_(AG,j);var AE=this.getCoords_(i,Z);var AH={x:this.currentX_+2/3*(AF.x-this.currentX_),y:this.currentY_+2/3*(AF.y-this.currentY_)};var m={x:AH.x+(AE.x-this.currentX_)/3,y:AH.y+(AE.y-this.currentY_)/3};e(this,AH,m,AE)};M.arc=function(AJ,AH,AI,AE,i,j){AI*=D;var AN=j?"at":"wa";var AK=AJ+U(AE)*AI-F;var AM=AH+J(AE)*AI-F;var Z=AJ+U(i)*AI-F;var AL=AH+J(i)*AI-F;if(AK==Z&&!j){AK+=0.125}var m=this.getCoords_(AJ,AH);var AG=this.getCoords_(AK,AM);var AF=this.getCoords_(Z,AL);this.currentPath_.push({type:AN,x:m.x,y:m.y,radius:AI,xStart:AG.x,yStart:AG.y,xEnd:AF.x,yEnd:AF.y})};M.rect=function(j,i,Z,m){this.moveTo(j,i);this.lineTo(j+Z,i);this.lineTo(j+Z,i+m);this.lineTo(j,i+m);this.closePath()};M.strokeRect=function(j,i,Z,m){var p=this.currentPath_;this.beginPath();this.moveTo(j,i);this.lineTo(j+Z,i);this.lineTo(j+Z,i+m);this.lineTo(j,i+m);this.closePath();this.stroke();this.currentPath_=p};M.fillRect=function(j,i,Z,m){var p=this.currentPath_;this.beginPath();this.moveTo(j,i);this.lineTo(j+Z,i);this.lineTo(j+Z,i+m);this.lineTo(j,i+m);this.closePath();this.fill();this.currentPath_=p};M.createLinearGradient=function(i,m,Z,j){var p=new v("gradient");p.x0_=i;p.y0_=m;p.x1_=Z;p.y1_=j;return p};M.createRadialGradient=function(m,AE,j,i,p,Z){var AF=new v("gradientradial");AF.x0_=m;AF.y0_=AE;AF.r0_=j;AF.x1_=i;AF.y1_=p;AF.r1_=Z;return AF};M.drawImage=function(AO,j){var AH,AF,AJ,AV,AM,AK,AQ,AX;var AI=AO.runtimeStyle.width;var AN=AO.runtimeStyle.height;AO.runtimeStyle.width="auto";AO.runtimeStyle.height="auto";var AG=AO.width;var AT=AO.height;AO.runtimeStyle.width=AI;AO.runtimeStyle.height=AN;if(arguments.length==3){AH=arguments[1];AF=arguments[2];AM=AK=0;AQ=AJ=AG;AX=AV=AT}else{if(arguments.length==5){AH=arguments[1];AF=arguments[2];AJ=arguments[3];AV=arguments[4];AM=AK=0;AQ=AG;AX=AT}else{if(arguments.length==9){AM=arguments[1];AK=arguments[2];AQ=arguments[3];AX=arguments[4];AH=arguments[5];AF=arguments[6];AJ=arguments[7];AV=arguments[8]}else{throw Error("Invalid number of arguments")}}}var AW=this.getCoords_(AH,AF);var m=AQ/2;var i=AX/2;var AU=[];var Z=10;var AE=10;AU.push(" <g_vml_:group",' coordsize="',D*Z,",",D*AE,'"',' coordorigin="0,0"',' style="width:',Z,"px;height:",AE,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]||this.m_[1][1]!=1||this.m_[1][0]){var p=[];p.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",K(AW.x/D),",","Dy=",K(AW.y/D),"");var AS=AW;var AR=this.getCoords_(AH+AJ,AF);var AP=this.getCoords_(AH,AF+AV);var AL=this.getCoords_(AH+AJ,AF+AV);AS.x=z.max(AS.x,AR.x,AP.x,AL.x);AS.y=z.max(AS.y,AR.y,AP.y,AL.y);AU.push("padding:0 ",K(AS.x/D),"px ",K(AS.y/D),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",p.join(""),", sizingmethod='clip');")}else{AU.push("top:",K(AW.y/D),"px;left:",K(AW.x/D),"px;")}AU.push(' ">','<g_vml_:image src="',AO.src,'"',' style="width:',D*AJ,"px;"," height:",D*AV,'px"',' cropleft="',AM/AG,'"',' croptop="',AK/AT,'"',' cropright="',(AG-AM-AQ)/AG,'"',' cropbottom="',(AT-AK-AX)/AT,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",AU.join(""))};M.stroke=function(AM){var m=10;var AN=10;var AE=5000;var AG={x:null,y:null};var AL={x:null,y:null};for(var AH=0;AH<this.currentPath_.length;AH+=AE){var AK=[];var AF=false;AK.push("<g_vml_:shape",' filled="',!!AM,'"',' style="position:absolute;width:',m,"px;height:",AN,'px;"',' coordorigin="0,0"',' coordsize="',D*m,",",D*AN,'"',' stroked="',!AM,'"',' path="');var AO=false;for(var AI=AH;AI<Math.min(AH+AE,this.currentPath_.length);AI++){if(AI%AE==0&&AI>0){AK.push(" m ",K(this.currentPath_[AI-1].x),",",K(this.currentPath_[AI-1].y))}var Z=this.currentPath_[AI];var AJ;switch(Z.type){case"moveTo":AJ=Z;AK.push(" m ",K(Z.x),",",K(Z.y));break;case"lineTo":AK.push(" l ",K(Z.x),",",K(Z.y));break;case"close":AK.push(" x ");Z=null;break;case"bezierCurveTo":AK.push(" c ",K(Z.cp1x),",",K(Z.cp1y),",",K(Z.cp2x),",",K(Z.cp2y),",",K(Z.x),",",K(Z.y));break;case"at":case"wa":AK.push(" ",Z.type," ",K(Z.x-this.arcScaleX_*Z.radius),",",K(Z.y-this.arcScaleY_*Z.radius)," ",K(Z.x+this.arcScaleX_*Z.radius),",",K(Z.y+this.arcScaleY_*Z.radius)," ",K(Z.xStart),",",K(Z.yStart)," ",K(Z.xEnd),",",K(Z.yEnd));break}if(Z){if(AG.x==null||Z.x<AG.x){AG.x=Z.x}if(AL.x==null||Z.x>AL.x){AL.x=Z.x}if(AG.y==null||Z.y<AG.y){AG.y=Z.y}if(AL.y==null||Z.y>AL.y){AL.y=Z.y}}}AK.push(' ">');if(!AM){R(this,AK)}else{a(this,AK,AG,AL)}AK.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",AK.join(""))}};function R(j,AE){var i=Y(j.strokeStyle);var m=i.color;var p=i.alpha*j.globalAlpha;var Z=j.lineScale_*j.lineWidth;if(Z<1){p*=Z}AE.push("<g_vml_:stroke",' opacity="',p,'"',' joinstyle="',j.lineJoin,'"',' miterlimit="',j.miterLimit,'"',' endcap="',t(j.lineCap),'"',' weight="',Z,'px"',' color="',m,'" />')}function a(AO,AG,Ah,AP){var AH=AO.fillStyle;var AY=AO.arcScaleX_;var AX=AO.arcScaleY_;var Z=AP.x-Ah.x;var m=AP.y-Ah.y;if(AH instanceof v){var AL=0;var Ac={x:0,y:0};var AU=0;var AK=1;if(AH.type_=="gradient"){var AJ=AH.x0_/AY;var j=AH.y0_/AX;var AI=AH.x1_/AY;var Aj=AH.y1_/AX;var Ag=AO.getCoords_(AJ,j);var Af=AO.getCoords_(AI,Aj);var AE=Af.x-Ag.x;var p=Af.y-Ag.y;AL=Math.atan2(AE,p)*180/Math.PI;if(AL<0){AL+=360}if(AL<0.000001){AL=0}}else{var Ag=AO.getCoords_(AH.x0_,AH.y0_);Ac={x:(Ag.x-Ah.x)/Z,y:(Ag.y-Ah.y)/m};Z/=AY*D;m/=AX*D;var Aa=z.max(Z,m);AU=2*AH.r0_/Aa;AK=2*AH.r1_/Aa-AU}var AS=AH.colors_;AS.sort(function(Ak,i){return Ak.offset-i.offset});var AN=AS.length;var AR=AS[0].color;var AQ=AS[AN-1].color;var AW=AS[0].alpha*AO.globalAlpha;var AV=AS[AN-1].alpha*AO.globalAlpha;var Ab=[];for(var Ae=0;Ae<AN;Ae++){var AM=AS[Ae];Ab.push(AM.offset*AK+AU+" "+AM.color)}AG.push('<g_vml_:fill type="',AH.type_,'"',' method="none" focus="100%"',' color="',AR,'"',' color2="',AQ,'"',' colors="',Ab.join(","),'"',' opacity="',AV,'"',' g_o_:opacity2="',AW,'"',' angle="',AL,'"',' focusposition="',Ac.x,",",Ac.y,'" />')}else{if(AH instanceof u){if(Z&&m){var AF=-Ah.x;var AZ=-Ah.y;AG.push("<g_vml_:fill",' position="',AF/Z*AY*AY,",",AZ/m*AX*AX,'"',' type="tile"',' src="',AH.src_,'" />')}}else{var Ai=Y(AO.fillStyle);var AT=Ai.color;var Ad=Ai.alpha*AO.globalAlpha;AG.push('<g_vml_:fill color="',AT,'" opacity="',Ad,'" />')}}}M.fill=function(){this.stroke(true)};M.closePath=function(){this.currentPath_.push({type:"close"})};M.getCoords_=function(j,i){var Z=this.m_;return{x:D*(j*Z[0][0]+i*Z[1][0]+Z[2][0])-F,y:D*(j*Z[0][1]+i*Z[1][1]+Z[2][1])-F}};M.save=function(){var Z={};Q(this,Z);this.aStack_.push(Z);this.mStack_.push(this.m_);this.m_=d(V(),this.m_)};M.restore=function(){if(this.aStack_.length){Q(this.aStack_.pop(),this);this.m_=this.mStack_.pop()}};function H(Z){return isFinite(Z[0][0])&&isFinite(Z[0][1])&&isFinite(Z[1][0])&&isFinite(Z[1][1])&&isFinite(Z[2][0])&&isFinite(Z[2][1])}function y(i,Z,j){if(!H(Z)){return }i.m_=Z;if(j){var p=Z[0][0]*Z[1][1]-Z[0][1]*Z[1][0];i.lineScale_=k(b(p))}}M.translate=function(j,i){var Z=[[1,0,0],[0,1,0],[j,i,1]];y(this,d(Z,this.m_),false)};M.rotate=function(i){var m=U(i);var j=J(i);var Z=[[m,j,0],[-j,m,0],[0,0,1]];y(this,d(Z,this.m_),false)};M.scale=function(j,i){this.arcScaleX_*=j;this.arcScaleY_*=i;var Z=[[j,0,0],[0,i,0],[0,0,1]];y(this,d(Z,this.m_),true)};M.transform=function(p,m,AF,AE,i,Z){var j=[[p,m,0],[AF,AE,0],[i,Z,1]];y(this,d(j,this.m_),true)};M.setTransform=function(AE,p,AG,AF,j,i){var Z=[[AE,p,0],[AG,AF,0],[j,i,1]];y(this,Z,true)};M.drawText_=function(AK,AI,AH,AN,AG){var AM=this.m_,AQ=1000,i=0,AP=AQ,AF={x:0,y:0},AE=[];var Z=P(X(this.font),this.element_);var j=AA(Z);var AR=this.element_.currentStyle;var p=this.textAlign.toLowerCase();switch(p){case"left":case"center":case"right":break;case"end":p=AR.direction=="ltr"?"right":"left";break;case"start":p=AR.direction=="rtl"?"right":"left";break;default:p="left"}switch(this.textBaseline){case"hanging":case"top":AF.y=Z.size/1.75;break;case"middle":break;default:case null:case"alphabetic":case"ideographic":case"bottom":AF.y=-Z.size/2.25;break}switch(p){case"right":i=AQ;AP=0.05;break;case"center":i=AP=AQ/2;break}var AO=this.getCoords_(AI+AF.x,AH+AF.y);AE.push('<g_vml_:line from="',-i,' 0" to="',AP,' 0.05" ',' coordsize="100 100" coordorigin="0 0"',' filled="',!AG,'" stroked="',!!AG,'" style="position:absolute;width:1px;height:1px;">');if(AG){R(this,AE)}else{a(this,AE,{x:-i,y:0},{x:AP,y:Z.size})}var AL=AM[0][0].toFixed(3)+","+AM[1][0].toFixed(3)+","+AM[0][1].toFixed(3)+","+AM[1][1].toFixed(3)+",0,0";var AJ=K(AO.x/D)+","+K(AO.y/D);AE.push('<g_vml_:skew on="t" matrix="',AL,'" ',' offset="',AJ,'" origin="',i,' 0" />','<g_vml_:path textpathok="true" />','<g_vml_:textpath on="true" string="',AD(AK),'" style="v-text-align:',p,";font:",AD(j),'" /></g_vml_:line>');this.element_.insertAdjacentHTML("beforeEnd",AE.join(""))};M.fillText=function(j,Z,m,i){this.drawText_(j,Z,m,i,false)};M.strokeText=function(j,Z,m,i){this.drawText_(j,Z,m,i,true)};M.measureText=function(j){if(!this.textMeasureEl_){var Z='<span style="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;"></span>';this.element_.insertAdjacentHTML("beforeEnd",Z);this.textMeasureEl_=this.element_.lastChild}var i=this.element_.ownerDocument;this.textMeasureEl_.innerHTML="";this.textMeasureEl_.style.font=this.font;this.textMeasureEl_.appendChild(i.createTextNode(j));return{width:this.textMeasureEl_.offsetWidth}};M.clip=function(){};M.arcTo=function(){};M.createPattern=function(i,Z){return new u(i,Z)};function v(Z){this.type_=Z;this.x0_=0;this.y0_=0;this.r0_=0;this.x1_=0;this.y1_=0;this.r1_=0;this.colors_=[]}v.prototype.addColorStop=function(i,Z){Z=Y(Z);this.colors_.push({offset:i,color:Z.color,alpha:Z.alpha})};function u(i,Z){q(i);switch(Z){case"repeat":case null:case"":this.repetition_="repeat";break;case"repeat-x":case"repeat-y":case"no-repeat":this.repetition_=Z;break;default:n("SYNTAX_ERR")}this.src_=i.src;this.width_=i.width;this.height_=i.height}function n(Z){throw new o(Z)}function q(Z){if(!Z||Z.nodeType!=1||Z.tagName!="IMG"){n("TYPE_MISMATCH_ERR")}if(Z.readyState!="complete"){n("INVALID_STATE_ERR")}}function o(Z){this.code=this[Z];this.message=Z+": DOM Exception "+this.code}var x=o.prototype=new Error;x.INDEX_SIZE_ERR=1;x.DOMSTRING_SIZE_ERR=2;x.HIERARCHY_REQUEST_ERR=3;x.WRONG_DOCUMENT_ERR=4;x.INVALID_CHARACTER_ERR=5;x.NO_DATA_ALLOWED_ERR=6;x.NO_MODIFICATION_ALLOWED_ERR=7;x.NOT_FOUND_ERR=8;x.NOT_SUPPORTED_ERR=9;x.INUSE_ATTRIBUTE_ERR=10;x.INVALID_STATE_ERR=11;x.SYNTAX_ERR=12;x.INVALID_MODIFICATION_ERR=13;x.NAMESPACE_ERR=14;x.INVALID_ACCESS_ERR=15;x.VALIDATION_ERR=16;x.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=E;CanvasRenderingContext2D=W;CanvasGradient=v;CanvasPattern=u;DOMException=o})()};  
/* Plugin for jQuery for working with colors.  
*  
* Version 1.1.  
*  
* Inspiration from jQuery color animation plugin by John Resig.  
*  
* Released under the MIT license by Ole Laursen, October 2009.  
*  
* Examples:  
*  
* $.color.parse("#fff").scale('rgb', 0.25).add('a', -0.5).toString()  
* var c = $.color.extract($("#mydiv"), 'background-color');  
* console.log(c.r, c.g, c.b, c.a);  
* $.color.make(100, 50, 25, 0.4).toString() // returns "rgba(100,50,25,0.4)"  
*  
* Note that .scale() and .add() return the same modified object  
* instead of making a new one.  
*  
* V. 1.1: Fix error handling so e.g. parsing an empty string does  
* produce a color rather than just crashing.  
*/  
 
(function($) {  
$.color = {};  
 
// construct color object with some convenient chainable helpers  
$.color.make = function (r, g, b, a) {  
var o = {};  
o.r = r || 0;  
o.g = g || 0;  
o.b = b || 0;  
o.a = a != null ? a : 1;  
 
o.add = function (c, d) {  
for (var i = 0; i < c.length; ++i)  
o[c.charAt(i)] += d;  
return o.normalize();  
};  
 
o.scale = function (c, f) {  
for (var i = 0; i < c.length; ++i)  
o[c.charAt(i)] *= f;  
return o.normalize();  
};  
 
o.toString = function () {  
if (o.a >= 1.0) {  
return "rgb("+[o.r, o.g, o.b].join(",")+")";  
} else {  
return "rgba("+[o.r, o.g, o.b, o.a].join(",")+")";  
}  
};  
 
o.normalize = function () {  
function clamp(min, value, max) {  
return value < min ? min: (value > max ? max: value);  
}  
 
o.r = clamp(0, parseInt(o.r), 255);  
o.g = clamp(0, parseInt(o.g), 255);  
o.b = clamp(0, parseInt(o.b), 255);  
o.a = clamp(0, o.a, 1);  
return o;  
};  
 
o.clone = function () {  
return $.color.make(o.r, o.b, o.g, o.a);  
};  
 
return o.normalize();  
}  
 
// extract CSS color property from element, going up in the DOM  
// if it's "transparent"  
$.color.extract = function (elem, css) {  
var c;  
do {  
c = elem.css(css).toLowerCase();  
// keep going until we find an element that has color, or  
// we hit the body  
if (c != '' && c != 'transparent')  
break;  
elem = elem.parent();  
} while (!$.nodeName(elem.get(0), "body"));  
 
// catch Safari's way of signalling transparent  
if (c == "rgba(0, 0, 0, 0)")  
c = "transparent";  
 
return $.color.parse(c);  
}  
 
// parse CSS color string (like "rgb(10, 32, 43)" or "#fff"),  
// returns color object, if parsing failed, you get black (0, 0,  
// 0) out  
$.color.parse = function (str) {  
var res, m = $.color.make;  
 
// Look for rgb(num,num,num)  
if (res = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(str))  
return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10));  
 
// Look for rgba(num,num,num,num)  
if (res = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))  
return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10), parseFloat(res[4]));  
 
// Look for rgb(num%,num%,num%)  
if (res = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(str))  
return m(parseFloat(res[1])*2.55, parseFloat(res[2])*2.55, parseFloat(res[3])*2.55);  
 
// Look for rgba(num%,num%,num%,num)  
if (res = /rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))  
return m(parseFloat(res[1])*2.55, parseFloat(res[2])*2.55, parseFloat(res[3])*2.55, parseFloat(res[4]));  
 
// Look for #a0b1c2  
if (res = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(str))  
return m(parseInt(res[1], 16), parseInt(res[2], 16), parseInt(res[3], 16));  
 
// Look for #fff  
if (res = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(str))  
return m(parseInt(res[1]+res[1], 16), parseInt(res[2]+res[2], 16), parseInt(res[3]+res[3], 16));  
 
// Otherwise, we're most likely dealing with a named color  
var name = $.trim(str).toLowerCase();  
if (name == "transparent")  
return m(255, 255, 255, 0);  
else {  
// default to black  
res = lookupColors[name] || [0, 0, 0];  
return m(res[0], res[1], res[2]);  
}  
}  
 
var lookupColors = {  
aqua:[0,255,255],  
azure:[240,255,255],  
beige:[245,245,220],  
black:[0,0,0],  
blue:[0,0,255],  
brown:[165,42,42],  
cyan:[0,255,255],  
darkblue:[0,0,139],  
darkcyan:[0,139,139],  
darkgrey:[169,169,169],  
darkgreen:[0,100,0],  
darkkhaki:[189,183,107],  
darkmagenta:[139,0,139],  
darkolivegreen:[85,107,47],  
darkorange:[255,140,0],  
darkorchid:[153,50,204],  
darkred:[139,0,0],  
darksalmon:[233,150,122],  
darkviolet:[148,0,211],  
fuchsia:[255,0,255],  
gold:[255,215,0],  
green:[0,128,0],  
indigo:[75,0,130],  
khaki:[240,230,140],  
lightblue:[173,216,230],  
lightcyan:[224,255,255],  
lightgreen:[144,238,144],  
lightgrey:[211,211,211],  
lightpink:[255,182,193],  
lightyellow:[255,255,224],  
lime:[0,255,0],  
magenta:[255,0,255],  
maroon:[128,0,0],  
navy:[0,0,128],  
olive:[128,128,0],  
orange:[255,165,0],  
pink:[255,192,203],  
purple:[128,0,128],  
violet:[128,0,128],  
red:[255,0,0],  
silver:[192,192,192],  
white:[255,255,255],  
yellow:[255,255,0]  
};  
})(jQuery);  
 
(function(b){b.color={};b.color.make=function(f,e,c,d){var h={};h.r=f||0;h.g=e||0;h.b=c||0;h.a=d!=null?d:1;h.add=function(k,j){for(var g=0;g<k.length;++g){h[k.charAt(g)]+=j}return h.normalize()};h.scale=function(k,j){for(var g=0;g<k.length;++g){h[k.charAt(g)]*=j}return h.normalize()};h.toString=function(){if(h.a>=1){return"rgb("+[h.r,h.g,h.b].join(",")+")"}else{return"rgba("+[h.r,h.g,h.b,h.a].join(",")+")"}};h.normalize=function(){function g(j,k,i){return k<j?j:(k>i?i:k)}h.r=g(0,parseInt(h.r),255);h.g=g(0,parseInt(h.g),255);h.b=g(0,parseInt(h.b),255);h.a=g(0,h.a,1);return h};h.clone=function(){return b.color.make(h.r,h.b,h.g,h.a)};return h.normalize()};b.color.extract=function(e,d){var f;do{f=e.css(d).toLowerCase();if(f!=""&&f!="transparent"){break}e=e.parent()}while(!b.nodeName(e.get(0),"body"));if(f=="rgba(0, 0, 0, 0)"){f="transparent"}return b.color.parse(f)};b.color.parse=function(f){var e,c=b.color.make;if(e=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(f)){return c(parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10))}if(e=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(f)){return c(parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10),parseFloat(e[4]))}if(e=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(f)){return c(parseFloat(e[1])*2.55,parseFloat(e[2])*2.55,parseFloat(e[3])*2.55)}if(e=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(f)){return c(parseFloat(e[1])*2.55,parseFloat(e[2])*2.55,parseFloat(e[3])*2.55,parseFloat(e[4]))}if(e=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(f)){return c(parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16))}if(e=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(f)){return c(parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16))}var d=b.trim(f).toLowerCase();if(d=="transparent"){return c(255,255,255,0)}else{e=a[d]||[0,0,0];return c(e[0],e[1],e[2])}};var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);  
/*  
Flot plugin for showing crosshairs, thin lines, when the mouse hovers  
over the plot.  
 
crosshair: {  
mode: null or "x" or "y" or "xy"  
color: color  
lineWidth: number  
}  
 
Set the mode to one of "x", "y" or "xy". The "x" mode enables a  
vertical crosshair that lets you trace the values on the x axis, "y"  
enables a horizontal crosshair and "xy" enables them both. "color" is  
the color of the crosshair (default is "rgba(170, 0, 0, 0.80)"),  
"lineWidth" is the width of the drawn lines (default is 1).  
 
The plugin also adds four public methods:  
 
- setCrosshair(pos)  
 
Set the position of the crosshair. Note that this is cleared if  
the user moves the mouse. "pos" is in coordinates of the plot and  
should be on the form { x: xpos, y: ypos } (you can use x2/x3/...  
if you're using multiple axes), which is coincidentally the same  
format as what you get from a "plothover" event. If "pos" is null,  
the crosshair is cleared.  
 
- clearCrosshair()  
 
Clear the crosshair.  
 
- lockCrosshair(pos)  
 
Cause the crosshair to lock to the current location, no longer  
updating if the user moves the mouse. Optionally supply a position  
(passed on to setCrosshair()) to move it to.  
 
Example usage:  
var myFlot = $.plot( $("#graph"), ..., { crosshair: { mode: "x" } } };  
$("#graph").bind("plothover", function (evt, position, item) {  
if (item) {  
// Lock the crosshair to the data point being hovered  
myFlot.lockCrosshair({ x: item.datapoint[0], y: item.datapoint[1] });  
}  
else {  
// Return normal crosshair operation  
myFlot.unlockCrosshair();  
}  
});  
 
- unlockCrosshair()  
 
Free the crosshair to move again after locking it.  
*/  
 
(function ($) {  
var options = {  
crosshair: {  
mode: null, // one of null, "x", "y" or "xy",  
color: "rgba(170, 0, 0, 0.80)",  
lineWidth: 1  
}  
};  
 
function init(plot) {  
// position of crosshair in pixels  
var crosshair = { x: -1, y: -1, locked: false };  
 
plot.setCrosshair = function setCrosshair(pos) {  
if (!pos)  
crosshair.x = -1;  
else {  
var o = plot.p2c(pos);  
crosshair.x = Math.max(0, Math.min(o.left, plot.width()));  
crosshair.y = Math.max(0, Math.min(o.top, plot.height()));  
}  
 
plot.triggerRedrawOverlay();  
};  
 
plot.clearCrosshair = plot.setCrosshair; // passes null for pos  
 
plot.lockCrosshair = function lockCrosshair(pos) {  
if (pos)  
plot.setCrosshair(pos);  
crosshair.locked = true;  
}  
 
plot.unlockCrosshair = function unlockCrosshair() {  
crosshair.locked = false;  
}  
 
function onMouseOut(e) {  
if (crosshair.locked)  
return;  
 
if (crosshair.x != -1) {  
crosshair.x = -1;  
plot.triggerRedrawOverlay();  
}  
}  
 
function onMouseMove(e) {  
if (crosshair.locked)  
return;  
 
if (plot.getSelection && plot.getSelection()) {  
crosshair.x = -1; // hide the crosshair while selecting  
return;  
}  
 
var offset = plot.offset();  
crosshair.x = Math.max(0, Math.min(e.pageX - offset.left, plot.width()));  
crosshair.y = Math.max(0, Math.min(e.pageY - offset.top, plot.height()));  
plot.triggerRedrawOverlay();  
}  
 
plot.hooks.bindEvents.push(function (plot, eventHolder) {  
if (!plot.getOptions().crosshair.mode)  
return;  
 
eventHolder.mouseout(onMouseOut);  
eventHolder.mousemove(onMouseMove);  
});  
 
plot.hooks.drawOverlay.push(function (plot, ctx) {  
var c = plot.getOptions().crosshair;  
if (!c.mode)  
return;  
 
var plotOffset = plot.getPlotOffset();  
 
ctx.save();  
ctx.translate(plotOffset.left, plotOffset.top);  
 
if (crosshair.x != -1) {  
ctx.strokeStyle = c.color;  
ctx.lineWidth = c.lineWidth;  
ctx.lineJoin = "round";  
 
ctx.beginPath();  
if (c.mode.indexOf("x") != -1) {  
ctx.moveTo(crosshair.x, 0);  
ctx.lineTo(crosshair.x, plot.height());  
}  
if (c.mode.indexOf("y") != -1) {  
ctx.moveTo(0, crosshair.y);  
ctx.lineTo(plot.width(), crosshair.y);  
}  
ctx.stroke();  
}  
ctx.restore();  
});  
 
plot.hooks.shutdown.push(function (plot, eventHolder) {  
eventHolder.unbind("mouseout", onMouseOut);  
eventHolder.unbind("mousemove", onMouseMove);  
});  
}  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: 'crosshair',  
version: '1.0'  
});  
})(jQuery);  
 
(function(b){var a={crosshair:{mode:null,color:"rgba(170, 0, 0, 0.80)",lineWidth:1}};function c(h){var j={x:-1,y:-1,locked:false};h.setCrosshair=function e(l){if(!l){j.x=-1}else{var k=h.p2c(l);j.x=Math.max(0,Math.min(k.left,h.width()));j.y=Math.max(0,Math.min(k.top,h.height()))}h.triggerRedrawOverlay()};h.clearCrosshair=h.setCrosshair;h.lockCrosshair=function f(k){if(k){h.setCrosshair(k)}j.locked=true};h.unlockCrosshair=function g(){j.locked=false};function d(k){if(j.locked){return}if(j.x!=-1){j.x=-1;h.triggerRedrawOverlay()}}function i(k){if(j.locked){return}if(h.getSelection&&h.getSelection()){j.x=-1;return}var l=h.offset();j.x=Math.max(0,Math.min(k.pageX-l.left,h.width()));j.y=Math.max(0,Math.min(k.pageY-l.top,h.height()));h.triggerRedrawOverlay()}h.hooks.bindEvents.push(function(l,k){if(!l.getOptions().crosshair.mode){return}k.mouseout(d);k.mousemove(i)});h.hooks.drawOverlay.push(function(m,k){var n=m.getOptions().crosshair;if(!n.mode){return}var l=m.getPlotOffset();k.save();k.translate(l.left,l.top);if(j.x!=-1){k.strokeStyle=n.color;k.lineWidth=n.lineWidth;k.lineJoin="round";k.beginPath();if(n.mode.indexOf("x")!=-1){k.moveTo(j.x,0);k.lineTo(j.x,m.height())}if(n.mode.indexOf("y")!=-1){k.moveTo(0,j.y);k.lineTo(m.width(),j.y)}k.stroke()}k.restore()});h.hooks.shutdown.push(function(l,k){k.unbind("mouseout",d);k.unbind("mousemove",i)})}b.plot.plugins.push({init:c,options:a,name:"crosshair",version:"1.0"})})(jQuery);  
/*  
Flot plugin for computing bottoms for filled line and bar charts.  
 
The case: you've got two series that you want to fill the area  
between. In Flot terms, you need to use one as the fill bottom of the  
other. You can specify the bottom of each data point as the third  
coordinate manually, or you can use this plugin to compute it for you.  
 
In order to name the other series, you need to give it an id, like this  
 
var dataset = [  
{ data: [ ... ], id: "foo" } , // use default bottom  
{ data: [ ... ], fillBetween: "foo" }, // use first dataset as bottom  
];  
 
$.plot($("#placeholder"), dataset, { line: { show: true, fill: true }});  
 
As a convenience, if the id given is a number that doesn't appear as  
an id in the series, it is interpreted as the index in the array  
instead (so fillBetween: 0 can also mean the first series).  
 
Internally, the plugin modifies the datapoints in each series. For  
line series, extra data points might be inserted through  
interpolation. Note that at points where the bottom line is not  
defined (due to a null point or start/end of line), the current line  
will show a gap too. The algorithm comes from the jquery.flot.stack.js  
plugin, possibly some code could be shared.  
*/  
 
(function ($) {  
var options = {  
series: { fillBetween: null } // or number  
};  
 
function init(plot) {  
function findBottomSeries(s, allseries) {  
var i;  
for (i = 0; i < allseries.length; ++i) {  
if (allseries[i].id == s.fillBetween)  
return allseries[i];  
}  
 
if (typeof s.fillBetween == "number") {  
i = s.fillBetween;  
 
if (i < 0 || i >= allseries.length)  
return null;  
 
return allseries[i];  
}  
 
return null;  
}  
 
function computeFillBottoms(plot, s, datapoints) {  
if (s.fillBetween == null)  
return;  
 
var other = findBottomSeries(s, plot.getData());  
if (!other)  
return;  
 
var ps = datapoints.pointsize,  
points = datapoints.points,  
otherps = other.datapoints.pointsize,  
otherpoints = other.datapoints.points,  
newpoints = [],  
px, py, intery, qx, qy, bottom,  
withlines = s.lines.show,  
withbottom = ps > 2 && datapoints.format[2].y,  
withsteps = withlines && s.lines.steps,  
fromgap = true,  
i = 0, j = 0, l;  
 
while (true) {  
if (i >= points.length)  
break;  
 
l = newpoints.length;  
 
if (points[i] == null) {  
// copy gaps  
for (m = 0; m < ps; ++m)  
newpoints.push(points[i + m]);  
i += ps;  
}  
else if (j >= otherpoints.length) {  
// for lines, we can't use the rest of the points  
if (!withlines) {  
for (m = 0; m < ps; ++m)  
newpoints.push(points[i + m]);  
}  
i += ps;  
}  
else if (otherpoints[j] == null) {  
// oops, got a gap  
for (m = 0; m < ps; ++m)  
newpoints.push(null);  
fromgap = true;  
j += otherps;  
}  
else {  
// cases where we actually got two points  
px = points[i];  
py = points[i + 1];  
qx = otherpoints[j];  
qy = otherpoints[j + 1];  
bottom = 0;  
 
if (px == qx) {  
for (m = 0; m < ps; ++m)  
newpoints.push(points[i + m]);  
 
//newpoints[l + 1] += qy;  
bottom = qy;  
 
i += ps;  
j += otherps;  
}  
else if (px > qx) {  
// we got past point below, might need to  
// insert interpolated extra point  
if (withlines && i > 0 && points[i - ps] != null) {  
intery = py + (points[i - ps + 1] - py) * (qx - px) / (points[i - ps] - px);  
newpoints.push(qx);  
newpoints.push(intery)  
for (m = 2; m < ps; ++m)  
newpoints.push(points[i + m]);  
bottom = qy;  
}  
 
j += otherps;  
}  
else { // px < qx  
if (fromgap && withlines) {  
// if we come from a gap, we just skip this point  
i += ps;  
continue;  
}  
 
for (m = 0; m < ps; ++m)  
newpoints.push(points[i + m]);  
 
// we might be able to interpolate a point below,  
// this can give us a better y  
if (withlines && j > 0 && otherpoints[j - otherps] != null)  
bottom = qy + (otherpoints[j - otherps + 1] - qy) * (px - qx) / (otherpoints[j - otherps] - qx);  
 
//newpoints[l + 1] += bottom;  
 
i += ps;  
}  
 
fromgap = false;  
 
if (l != newpoints.length && withbottom)  
newpoints[l + 2] = bottom;  
}  
 
// maintain the line steps invariant  
if (withsteps && l != newpoints.length && l > 0  
&& newpoints[l] != null  
&& newpoints[l] != newpoints[l - ps]  
&& newpoints[l + 1] != newpoints[l - ps + 1]) {  
for (m = 0; m < ps; ++m)  
newpoints[l + ps + m] = newpoints[l + m];  
newpoints[l + 1] = newpoints[l - ps + 1];  
}  
}  
 
datapoints.points = newpoints;  
}  
 
plot.hooks.processDatapoints.push(computeFillBottoms);  
}  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: 'fillbetween',  
version: '1.0'  
});  
})(jQuery);  
 
(function(b){var a={series:{fillBetween:null}};function c(f){function d(j,h){var g;for(g=0;g<h.length;++g){if(h[g].id==j.fillBetween){return h[g]}}if(typeof j.fillBetween=="number"){g=j.fillBetween;if(g<0||g>=h.length){return null}return h[g]}return null}function e(B,u,g){if(u.fillBetween==null){return}var p=d(u,B.getData());if(!p){return}var y=g.pointsize,E=g.points,h=p.datapoints.pointsize,x=p.datapoints.points,r=[],w,v,k,G,F,q,t=u.lines.show,o=y>2&&g.format[2].y,n=t&&u.lines.steps,D=true,C=0,A=0,z;while(true){if(C>=E.length){break}z=r.length;if(E[C]==null){for(m=0;m<y;++m){r.push(E[C+m])}C+=y}else{if(A>=x.length){if(!t){for(m=0;m<y;++m){r.push(E[C+m])}}C+=y}else{if(x[A]==null){for(m=0;m<y;++m){r.push(null)}D=true;A+=h}else{w=E[C];v=E[C+1];G=x[A];F=x[A+1];q=0;if(w==G){for(m=0;m<y;++m){r.push(E[C+m])}q=F;C+=y;A+=h}else{if(w>G){if(t&&C>0&&E[C-y]!=null){k=v+(E[C-y+1]-v)*(G-w)/(E[C-y]-w);r.push(G);r.push(k);for(m=2;m<y;++m){r.push(E[C+m])}q=F}A+=h}else{if(D&&t){C+=y;continue}for(m=0;m<y;++m){r.push(E[C+m])}if(t&&A>0&&x[A-h]!=null){q=F+(x[A-h+1]-F)*(w-G)/(x[A-h]-G)}C+=y}}D=false;if(z!=r.length&&o){r[z+2]=q}}}}if(n&&z!=r.length&&z>0&&r[z]!=null&&r[z]!=r[z-y]&&r[z+1]!=r[z-y+1]){for(m=0;m<y;++m){r[z+y+m]=r[z+m]}r[z+1]=r[z-y+1]}}g.points=r}f.hooks.processDatapoints.push(e)}b.plot.plugins.push({init:c,options:a,name:"fillbetween",version:"1.0"})})(jQuery);  
/*  
Flot plugin for plotting images, e.g. useful for putting ticks on a  
prerendered complex visualization.  
 
The data syntax is [[image, x1, y1, x2, y2], ...] where (x1, y1) and  
(x2, y2) are where you intend the two opposite corners of the image to  
end up in the plot. Image must be a fully loaded Javascript image (you  
can make one with new Image()). If the image is not complete, it's  
skipped when plotting.  
 
There are two helpers included for retrieving images. The easiest work  
the way that you put in URLs instead of images in the data (like  
["myimage.png", 0, 0, 10, 10]), then call $.plot.image.loadData(data,  
options, callback) where data and options are the same as you pass in  
to $.plot. This loads the images, replaces the URLs in the data with  
the corresponding images and calls "callback" when all images are  
loaded (or failed loading). In the callback, you can then call $.plot  
with the data set. See the included example.  
 
A more low-level helper, $.plot.image.load(urls, callback) is also  
included. Given a list of URLs, it calls callback with an object  
mapping from URL to Image object when all images are loaded or have  
failed loading.  
 
Options for the plugin are  
 
series: {  
images: {  
show: boolean  
anchor: "corner" or "center"  
alpha: [0,1]  
}  
}  
 
which can be specified for a specific series  
 
$.plot($("#placeholder"), [{ data: [ ... ], images: { ... } ])  
 
Note that because the data format is different from usual data points,  
you can't use images with anything else in a specific data series.  
 
Setting "anchor" to "center" causes the pixels in the image to be  
anchored at the corner pixel centers inside of at the pixel corners,  
effectively letting half a pixel stick out to each side in the plot.  
 
 
A possible future direction could be support for tiling for large  
images (like Google Maps).  
 
*/  
 
(function ($) {  
var options = {  
series: {  
images: {  
show: false,  
alpha: 1,  
anchor: "corner" // or "center"  
}  
}  
};  
 
$.plot.image = {};  
 
$.plot.image.loadDataImages = function (series, options, callback) {  
var urls = [], points = [];  
 
var defaultShow = options.series.images.show;  
 
$.each(series, function (i, s) {  
if (!(defaultShow || s.images.show))  
return;  
 
if (s.data)  
s = s.data;  
 
$.each(s, function (i, p) {  
if (typeof p[0] == "string") {  
urls.push(p[0]);  
points.push(p);  
}  
});  
});  
 
$.plot.image.load(urls, function (loadedImages) {  
$.each(points, function (i, p) {  
var url = p[0];  
if (loadedImages[url])  
p[0] = loadedImages[url];  
});  
 
callback();  
});  
}  
 
$.plot.image.load = function (urls, callback) {  
var missing = urls.length, loaded = {};  
if (missing == 0)  
callback({});  
 
$.each(urls, function (i, url) {  
var handler = function () {  
--missing;  
 
loaded[url] = this;  
 
if (missing == 0)  
callback(loaded);  
};  
 
$('<img />').load(handler).error(handler).attr('src', url);  
});  
}  
 
function drawSeries(plot, ctx, series) {  
var plotOffset = plot.getPlotOffset();  
 
if (!series.images || !series.images.show)  
return;  
 
var points = series.datapoints.points,  
ps = series.datapoints.pointsize;  
 
for (var i = 0; i < points.length; i += ps) {  
var img = points[i],  
x1 = points[i + 1], y1 = points[i + 2],  
x2 = points[i + 3], y2 = points[i + 4],  
xaxis = series.xaxis, yaxis = series.yaxis,  
tmp;  
 
// actually we should check img.complete, but it  
// appears to be a somewhat unreliable indicator in  
// IE6 (false even after load event)  
if (!img || img.width <= 0 || img.height <= 0)  
continue;  
 
if (x1 > x2) {  
tmp = x2;  
x2 = x1;  
x1 = tmp;  
}  
if (y1 > y2) {  
tmp = y2;  
y2 = y1;  
y1 = tmp;  
}  
 
// if the anchor is at the center of the pixel, expand the  
// image by 1/2 pixel in each direction  
if (series.images.anchor == "center") {  
tmp = 0.5 * (x2-x1) / (img.width - 1);  
x1 -= tmp;  
x2 += tmp;  
tmp = 0.5 * (y2-y1) / (img.height - 1);  
y1 -= tmp;  
y2 += tmp;  
}  
 
// clip  
if (x1 == x2 || y1 == y2 ||  
x1 >= xaxis.max || x2 <= xaxis.min ||  
y1 >= yaxis.max || y2 <= yaxis.min)  
continue;  
 
var sx1 = 0, sy1 = 0, sx2 = img.width, sy2 = img.height;  
if (x1 < xaxis.min) {  
sx1 += (sx2 - sx1) * (xaxis.min - x1) / (x2 - x1);  
x1 = xaxis.min;  
}  
 
if (x2 > xaxis.max) {  
sx2 += (sx2 - sx1) * (xaxis.max - x2) / (x2 - x1);  
x2 = xaxis.max;  
}  
 
if (y1 < yaxis.min) {  
sy2 += (sy1 - sy2) * (yaxis.min - y1) / (y2 - y1);  
y1 = yaxis.min;  
}  
 
if (y2 > yaxis.max) {  
sy1 += (sy1 - sy2) * (yaxis.max - y2) / (y2 - y1);  
y2 = yaxis.max;  
}  
 
x1 = xaxis.p2c(x1);  
x2 = xaxis.p2c(x2);  
y1 = yaxis.p2c(y1);  
y2 = yaxis.p2c(y2);  
 
// the transformation may have swapped us  
if (x1 > x2) {  
tmp = x2;  
x2 = x1;  
x1 = tmp;  
}  
if (y1 > y2) {  
tmp = y2;  
y2 = y1;  
y1 = tmp;  
}  
 
tmp = ctx.globalAlpha;  
ctx.globalAlpha *= series.images.alpha;  
ctx.drawImage(img,  
sx1, sy1, sx2 - sx1, sy2 - sy1,  
x1 + plotOffset.left, y1 + plotOffset.top,  
x2 - x1, y2 - y1);  
ctx.globalAlpha = tmp;  
}  
}  
 
function processRawData(plot, series, data, datapoints) {  
if (!series.images.show)  
return;  
 
// format is Image, x1, y1, x2, y2 (opposite corners)  
datapoints.format = [  
{ required: true },  
{ x: true, number: true, required: true },  
{ y: true, number: true, required: true },  
{ x: true, number: true, required: true },  
{ y: true, number: true, required: true }  
];  
}  
 
function init(plot) {  
plot.hooks.processRawData.push(processRawData);  
plot.hooks.drawSeries.push(drawSeries);  
}  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: 'image',  
version: '1.1'  
});  
})(jQuery);  
 
(function(c){var a={series:{images:{show:false,alpha:1,anchor:"corner"}}};c.plot.image={};c.plot.image.loadDataImages=function(g,f,k){var j=[],h=[];var i=f.series.images.show;c.each(g,function(l,m){if(!(i||m.images.show)){return}if(m.data){m=m.data}c.each(m,function(n,o){if(typeof o[0]=="string"){j.push(o[0]);h.push(o)}})});c.plot.image.load(j,function(l){c.each(h,function(n,o){var m=o[0];if(l[m]){o[0]=l[m]}});k()})};c.plot.image.load=function(h,i){var g=h.length,f={};if(g==0){i({})}c.each(h,function(k,j){var l=function(){--g;f[j]=this;if(g==0){i(f)}};c("<img />").load(l).error(l).attr("src",j)})};function d(q,o,l){var m=q.getPlotOffset();if(!l.images||!l.images.show){return}var r=l.datapoints.points,n=l.datapoints.pointsize;for(var t=0;t<r.length;t+=n){var y=r[t],w=r[t+1],g=r[t+2],v=r[t+3],f=r[t+4],h=l.xaxis,u=l.yaxis,x;if(!y||y.width<=0||y.height<=0){continue}if(w>v){x=v;v=w;w=x}if(g>f){x=f;f=g;g=x}if(l.images.anchor=="center"){x=0.5*(v-w)/(y.width-1);w-=x;v+=x;x=0.5*(f-g)/(y.height-1);g-=x;f+=x}if(w==v||g==f||w>=h.max||v<=h.min||g>=u.max||f<=u.min){continue}var k=0,s=0,j=y.width,p=y.height;if(w<h.min){k+=(j-k)*(h.min-w)/(v-w);w=h.min}if(v>h.max){j+=(j-k)*(h.max-v)/(v-w);v=h.max}if(g<u.min){p+=(s-p)*(u.min-g)/(f-g);g=u.min}if(f>u.max){s+=(s-p)*(u.max-f)/(f-g);f=u.max}w=h.p2c(w);v=h.p2c(v);g=u.p2c(g);f=u.p2c(f);if(w>v){x=v;v=w;w=x}if(g>f){x=f;f=g;g=x}x=o.globalAlpha;o.globalAlpha*=l.images.alpha;o.drawImage(y,k,s,j-k,p-s,w+m.left,g+m.top,v-w,f-g);o.globalAlpha=x}}function b(i,f,g,h){if(!f.images.show){return}h.format=[{required:true},{x:true,number:true,required:true},{y:true,number:true,required:true},{x:true,number:true,required:true},{y:true,number:true,required:true}]}function e(f){f.hooks.processRawData.push(b);f.hooks.drawSeries.push(d)}c.plot.plugins.push({init:e,options:a,name:"image",version:"1.1"})})(jQuery);  
file:a/js/flot/jquery.flot.js (deleted)
/*! Javascript plotting library for jQuery, v. 0.7.  
*  
* Released under the MIT license by IOLA, December 2007.  
*  
*/  
 
// first an inline dependency, jquery.colorhelpers.js, we inline it here  
// for convenience  
 
/* Plugin for jQuery for working with colors.  
*  
* Version 1.1.  
*  
* Inspiration from jQuery color animation plugin by John Resig.  
*  
* Released under the MIT license by Ole Laursen, October 2009.  
*  
* Examples:  
*  
* $.color.parse("#fff").scale('rgb', 0.25).add('a', -0.5).toString()  
* var c = $.color.extract($("#mydiv"), 'background-color');  
* console.log(c.r, c.g, c.b, c.a);  
* $.color.make(100, 50, 25, 0.4).toString() // returns "rgba(100,50,25,0.4)"  
*  
* Note that .scale() and .add() return the same modified object  
* instead of making a new one.  
*  
* V. 1.1: Fix error handling so e.g. parsing an empty string does  
* produce a color rather than just crashing.  
*/  
(function(B){B.color={};B.color.make=function(F,E,C,D){var G={};G.r=F||0;G.g=E||0;G.b=C||0;G.a=D!=null?D:1;G.add=function(J,I){for(var H=0;H<J.length;++H){G[J.charAt(H)]+=I}return G.normalize()};G.scale=function(J,I){for(var H=0;H<J.length;++H){G[J.charAt(H)]*=I}return G.normalize()};G.toString=function(){if(G.a>=1){return"rgb("+[G.r,G.g,G.b].join(",")+")"}else{return"rgba("+[G.r,G.g,G.b,G.a].join(",")+")"}};G.normalize=function(){function H(J,K,I){return K<J?J:(K>I?I:K)}G.r=H(0,parseInt(G.r),255);G.g=H(0,parseInt(G.g),255);G.b=H(0,parseInt(G.b),255);G.a=H(0,G.a,1);return G};G.clone=function(){return B.color.make(G.r,G.b,G.g,G.a)};return G.normalize()};B.color.extract=function(D,C){var E;do{E=D.css(C).toLowerCase();if(E!=""&&E!="transparent"){break}D=D.parent()}while(!B.nodeName(D.get(0),"body"));if(E=="rgba(0, 0, 0, 0)"){E="transparent"}return B.color.parse(E)};B.color.parse=function(F){var E,C=B.color.make;if(E=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F)){return C(parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10))}if(E=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(F)){return C(parseInt(E[1],10),parseInt(E[2],10),parseInt(E[3],10),parseFloat(E[4]))}if(E=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F)){return C(parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55)}if(E=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(F)){return C(parseFloat(E[1])*2.55,parseFloat(E[2])*2.55,parseFloat(E[3])*2.55,parseFloat(E[4]))}if(E=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F)){return C(parseInt(E[1],16),parseInt(E[2],16),parseInt(E[3],16))}if(E=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F)){return C(parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16))}var D=B.trim(F).toLowerCase();if(D=="transparent"){return C(255,255,255,0)}else{E=A[D]||[0,0,0];return C(E[0],E[1],E[2])}};var A={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);  
 
// the actual Flot code  
(function($) {  
function Plot(placeholder, data_, options_, plugins) {  
// data is on the form:  
// [ series1, series2 ... ]  
// where series is either just the data as [ [x1, y1], [x2, y2], ... ]  
// or { data: [ [x1, y1], [x2, y2], ... ], label: "some label", ... }  
 
var series = [],  
options = {  
// the color theme used for graphs  
colors: ["#edc240", "#afd8f8", "#cb4b4b", "#4da74d", "#9440ed"],  
legend: {  
show: true,  
noColumns: 1, // number of colums in legend table  
labelFormatter: null, // fn: string -> string  
labelBoxBorderColor: "#ccc", // border color for the little label boxes  
container: null, // container (as jQuery object) to put legend in, null means default on top of graph  
position: "ne", // position of default legend container within plot  
margin: 5, // distance from grid edge to default legend container within plot  
backgroundColor: null, // null means auto-detect  
backgroundOpacity: 0.85 // set to 0 to avoid background  
},  
xaxis: {  
show: null, // null = auto-detect, true = always, false = never  
position: "bottom", // or "top"  
mode: null, // null or "time"  
color: null, // base color, labels, ticks  
tickColor: null, // possibly different color of ticks, e.g. "rgba(0,0,0,0.15)"  
transform: null, // null or f: number -> number to transform axis  
inverseTransform: null, // if transform is set, this should be the inverse function  
min: null, // min. value to show, null means set automatically  
max: null, // max. value to show, null means set automatically  
autoscaleMargin: null, // margin in % to add if auto-setting min/max  
ticks: null, // either [1, 3] or [[1, "a"], 3] or (fn: axis info -> ticks) or app. number of ticks for auto-ticks  
tickFormatter: null, // fn: number -> string  
labelWidth: null, // size of tick labels in pixels  
labelHeight: null,  
reserveSpace: null, // whether to reserve space even if axis isn't shown  
tickLength: null, // size in pixels of ticks, or "full" for whole line  
alignTicksWithAxis: null, // axis number or null for no sync  
 
// mode specific options  
tickDecimals: null, // no. of decimals, null means auto  
tickSize: null, // number or [number, "unit"]  
minTickSize: null, // number or [number, "unit"]  
monthNames: null, // list of names of months  
timeformat: null, // format string to use  
twelveHourClock: false // 12 or 24 time in time mode  
},  
yaxis: {  
autoscaleMargin: 0.02,  
position: "left" // or "right"  
},  
xaxes: [],  
yaxes: [],  
series: {  
points: {  
show: false,  
radius: 3,  
lineWidth: 2, // in pixels  
fill: true,  
fillColor: "#ffffff",  
symbol: "circle" // or callback  
},  
lines: {  
// we don't put in show: false so we can see  
// whether lines were actively disabled  
lineWidth: 2, // in pixels  
fill: false,  
fillColor: null,  
steps: false  
},  
bars: {  
show: false,  
lineWidth: 2, // in pixels  
barWidth: 1, // in units of the x axis  
fill: true,  
fillColor: null,  
align: "left", // or "center"  
horizontal: false  
},  
shadowSize: 3  
},  
grid: {  
show: true,  
aboveData: false,  
color: "#545454", // primary color used for outline and labels  
backgroundColor: null, // null for transparent, else color  
borderColor: null, // set if different from the grid color  
tickColor: null, // color for the ticks, e.g. "rgba(0,0,0,0.15)"  
labelMargin: 5, // in pixels  
axisMargin: 8, // in pixels  
borderWidth: 2, // in pixels  
minBorderMargin: null, // in pixels, null means taken from points radius  
markings: null, // array of ranges or fn: axes -> array of ranges  
markingsColor: "#f4f4f4",  
markingsLineWidth: 2,  
// interactive stuff  
clickable: false,  
hoverable: false,  
autoHighlight: true, // highlight in case mouse is near  
mouseActiveRadius: 10 // how far the mouse can be away to activate an item  
},  
hooks: {}  
},  
canvas = null, // the canvas for the plot itself  
overlay = null, // canvas for interactive stuff on top of plot  
eventHolder = null, // jQuery object that events should be bound to  
ctx = null, octx = null,  
xaxes = [], yaxes = [],  
plotOffset = { left: 0, right: 0, top: 0, bottom: 0},  
canvasWidth = 0, canvasHeight = 0,  
plotWidth = 0, plotHeight = 0,  
hooks = {  
processOptions: [],  
processRawData: [],  
processDatapoints: [],  
drawSeries: [],  
draw: [],  
bindEvents: [],  
drawOverlay: [],  
shutdown: []  
},  
plot = this;  
 
// public functions  
plot.setData = setData;  
plot.setupGrid = setupGrid;  
plot.draw = draw;  
plot.getPlaceholder = function() { return placeholder; };  
plot.getCanvas = function() { return canvas; };  
plot.getPlotOffset = function() { return plotOffset; };  
plot.width = function () { return plotWidth; };  
plot.height = function () { return plotHeight; };  
plot.offset = function () {  
var o = eventHolder.offset();  
o.left += plotOffset.left;  
o.top += plotOffset.top;  
return o;  
};  
plot.getData = function () { return series; };  
plot.getAxes = function () {  
var res = {}, i;  
$.each(xaxes.concat(yaxes), function (_, axis) {  
if (axis)  
res[axis.direction + (axis.n != 1 ? axis.n : "") + "axis"] = axis;  
});  
return res;  
};  
plot.getXAxes = function () { return xaxes; };  
plot.getYAxes = function () { return yaxes; };  
plot.c2p = canvasToAxisCoords;  
plot.p2c = axisToCanvasCoords;  
plot.getOptions = function () { return options; };  
plot.highlight = highlight;  
plot.unhighlight = unhighlight;  
plot.triggerRedrawOverlay = triggerRedrawOverlay;  
plot.pointOffset = function(point) {  
return {  
left: parseInt(xaxes[axisNumber(point, "x") - 1].p2c(+point.x) + plotOffset.left),  
top: parseInt(yaxes[axisNumber(point, "y") - 1].p2c(+point.y) + plotOffset.top)  
};  
};  
plot.shutdown = shutdown;  
plot.resize = function () {  
getCanvasDimensions();  
resizeCanvas(canvas);  
resizeCanvas(overlay);  
};  
 
// public attributes  
plot.hooks = hooks;  
 
// initialize  
initPlugins(plot);  
parseOptions(options_);  
setupCanvases();  
setData(data_);  
setupGrid();  
draw();  
bindEvents();  
 
 
function executeHooks(hook, args) {  
args = [plot].concat(args);  
for (var i = 0; i < hook.length; ++i)  
hook[i].apply(this, args);  
}  
 
function initPlugins() {  
for (var i = 0; i < plugins.length; ++i) {  
var p = plugins[i];  
p.init(plot);  
if (p.options)  
$.extend(true, options, p.options);  
}  
}  
 
function parseOptions(opts) {  
var i;  
 
$.extend(true, options, opts);  
 
if (options.xaxis.color == null)  
options.xaxis.color = options.grid.color;  
if (options.yaxis.color == null)  
options.yaxis.color = options.grid.color;  
 
if (options.xaxis.tickColor == null) // backwards-compatibility  
options.xaxis.tickColor = options.grid.tickColor;  
if (options.yaxis.tickColor == null) // backwards-compatibility  
options.yaxis.tickColor = options.grid.tickColor;  
 
if (options.grid.borderColor == null)  
options.grid.borderColor = options.grid.color;  
if (options.grid.tickColor == null)  
options.grid.tickColor = $.color.parse(options.grid.color).scale('a', 0.22).toString();  
 
// fill in defaults in axes, copy at least always the  
// first as the rest of the code assumes it'll be there  
for (i = 0; i < Math.max(1, options.xaxes.length); ++i)  
options.xaxes[i] = $.extend(true, {}, options.xaxis, options.xaxes[i]);  
for (i = 0; i < Math.max(1, options.yaxes.length); ++i)  
options.yaxes[i] = $.extend(true, {}, options.yaxis, options.yaxes[i]);  
 
// backwards compatibility, to be removed in future  
if (options.xaxis.noTicks && options.xaxis.ticks == null)  
options.xaxis.ticks = options.xaxis.noTicks;  
if (options.yaxis.noTicks && options.yaxis.ticks == null)  
options.yaxis.ticks = options.yaxis.noTicks;  
if (options.x2axis) {  
options.xaxes[1] = $.extend(true, {}, options.xaxis, options.x2axis);  
options.xaxes[1].position = "top";  
}  
if (options.y2axis) {  
options.yaxes[1] = $.extend(true, {}, options.yaxis, options.y2axis);  
options.yaxes[1].position = "right";  
}  
if (options.grid.coloredAreas)  
options.grid.markings = options.grid.coloredAreas;  
if (options.grid.coloredAreasColor)  
options.grid.markingsColor = options.grid.coloredAreasColor;  
if (options.lines)  
$.extend(true, options.series.lines, options.lines);  
if (options.points)  
$.extend(true, options.series.points, options.points);  
if (options.bars)  
$.extend(true, options.series.bars, options.bars);  
if (options.shadowSize != null)  
options.series.shadowSize = options.shadowSize;  
 
// save options on axes for future reference  
for (i = 0; i < options.xaxes.length; ++i)  
getOrCreateAxis(xaxes, i + 1).options = options.xaxes[i];  
for (i = 0; i < options.yaxes.length; ++i)  
getOrCreateAxis(yaxes, i + 1).options = options.yaxes[i];  
 
// add hooks from options  
for (var n in hooks)  
if (options.hooks[n] && options.hooks[n].length)  
hooks[n] = hooks[n].concat(options.hooks[n]);  
 
executeHooks(hooks.processOptions, [options]);  
}  
 
function setData(d) {  
series = parseData(d);  
fillInSeriesOptions();  
processData();  
}  
 
function parseData(d) {  
var res = [];  
for (var i = 0; i < d.length; ++i) {  
var s = $.extend(true, {}, options.series);  
 
if (d[i].data != null) {  
s.data = d[i].data; // move the data instead of deep-copy  
delete d[i].data;  
 
$.extend(true, s, d[i]);  
 
d[i].data = s.data;  
}  
else  
s.data = d[i];  
res.push(s);  
}  
 
return res;  
}  
 
function axisNumber(obj, coord) {  
var a = obj[coord + "axis"];  
if (typeof a == "object") // if we got a real axis, extract number  
a = a.n;  
if (typeof a != "number")  
a = 1; // default to first axis  
return a;  
}  
 
function allAxes() {  
// return flat array without annoying null entries  
return $.grep(xaxes.concat(yaxes), function (a) { return a; });  
}  
 
function canvasToAxisCoords(pos) {  
// return an object with x/y corresponding to all used axes  
var res = {}, i, axis;  
for (i = 0; i < xaxes.length; ++i) {  
axis = xaxes[i];  
if (axis && axis.used)  
res["x" + axis.n] = axis.c2p(pos.left);  
}  
 
for (i = 0; i < yaxes.length; ++i) {  
axis = yaxes[i];  
if (axis && axis.used)  
res["y" + axis.n] = axis.c2p(pos.top);  
}  
 
if (res.x1 !== undefined)  
res.x = res.x1;  
if (res.y1 !== undefined)  
res.y = res.y1;  
 
return res;  
}  
 
function axisToCanvasCoords(pos) {  
// get canvas coords from the first pair of x/y found in pos  
var res = {}, i, axis, key;  
 
for (i = 0; i < xaxes.length; ++i) {  
axis = xaxes[i];  
if (axis && axis.used) {  
key = "x" + axis.n;  
if (pos[key] == null && axis.n == 1)  
key = "x";  
 
if (pos[key] != null) {  
res.left = axis.p2c(pos[key]);  
break;  
}  
}  
}  
 
for (i = 0; i < yaxes.length; ++i) {  
axis = yaxes[i];  
if (axis && axis.used) {  
key = "y" + axis.n;  
if (pos[key] == null && axis.n == 1)  
key = "y";  
 
if (pos[key] != null) {  
res.top = axis.p2c(pos[key]);  
break;  
}  
}  
}  
 
return res;  
}  
 
function getOrCreateAxis(axes, number) {  
if (!axes[number - 1])  
axes[number - 1] = {  
n: number, // save the number for future reference  
direction: axes == xaxes ? "x" : "y",  
options: $.extend(true, {}, axes == xaxes ? options.xaxis : options.yaxis)  
};  
 
return axes[number - 1];  
}  
 
function fillInSeriesOptions() {  
var i;  
 
// collect what we already got of colors  
var neededColors = series.length,  
usedColors = [],  
assignedColors = [];  
for (i = 0; i < series.length; ++i) {  
var sc = series[i].color;  
if (sc != null) {  
--neededColors;  
if (typeof sc == "number")  
assignedColors.push(sc);  
else  
usedColors.push($.color.parse(series[i].color));  
}  
}  
 
// we might need to generate more colors if higher indices  
// are assigned  
for (i = 0; i < assignedColors.length; ++i) {  
neededColors = Math.max(neededColors, assignedColors[i] + 1);  
}  
 
// produce colors as needed  
var colors = [], variation = 0;  
i = 0;  
while (colors.length < neededColors) {  
var c;  
if (options.colors.length == i) // check degenerate case  
c = $.color.make(100, 100, 100);  
else  
c = $.color.parse(options.colors[i]);  
 
// vary color if needed  
var sign = variation % 2 == 1 ? -1 : 1;  
c.scale('rgb', 1 + sign * Math.ceil(variation / 2) * 0.2)  
 
// FIXME: if we're getting to close to something else,  
// we should probably skip this one  
colors.push(c);  
 
++i;  
if (i >= options.colors.length) {  
i = 0;  
++variation;  
}  
}  
 
// fill in the options  
var colori = 0, s;  
for (i = 0; i < series.length; ++i) {  
s = series[i];  
 
// assign colors  
if (s.color == null) {  
s.color = colors[colori].toString();  
++colori;  
}  
else if (typeof s.color == "number")  
s.color = colors[s.color].toString();  
 
// turn on lines automatically in case nothing is set  
if (s.lines.show == null) {  
var v, show = true;  
for (v in s)  
if (s[v] && s[v].show) {  
show = false;  
break;  
}  
if (show)  
s.lines.show = true;  
}  
 
// setup axes  
s.xaxis = getOrCreateAxis(xaxes, axisNumber(s, "x"));  
s.yaxis = getOrCreateAxis(yaxes, axisNumber(s, "y"));  
}  
}  
 
function processData() {  
var topSentry = Number.POSITIVE_INFINITY,  
bottomSentry = Number.NEGATIVE_INFINITY,  
fakeInfinity = Number.MAX_VALUE,  
i, j, k, m, length,  
s, points, ps, x, y, axis, val, f, p;  
 
function updateAxis(axis, min, max) {  
if (min < axis.datamin && min != -fakeInfinity)  
axis.datamin = min;  
if (max > axis.datamax && max != fakeInfinity)  
axis.datamax = max;  
}  
 
$.each(allAxes(), function (_, axis) {  
// init axis  
axis.datamin = topSentry;  
axis.datamax = bottomSentry;  
axis.used = false;  
});  
 
for (i = 0; i < series.length; ++i) {  
s = series[i];  
s.datapoints = { points: [] };  
 
executeHooks(hooks.processRawData, [ s, s.data, s.datapoints ]);  
}  
 
// first pass: clean and copy data  
for (i = 0; i < series.length; ++i) {  
s = series[i];  
 
var data = s.data, format = s.datapoints.format;  
 
if (!format) {  
format = [];  
// find out how to copy  
format.push({ x: true, number: true, required: true });  
format.push({ y: true, number: true, required: true });  
 
if (s.bars.show || (s.lines.show && s.lines.fill)) {  
format.push({ y: true, number: true, required: false, defaultValue: 0 });  
if (s.bars.horizontal) {  
delete format[format.length - 1].y;  
format[format.length - 1].x = true;  
}  
}  
 
s.datapoints.format = format;  
}  
 
if (s.datapoints.pointsize != null)  
continue; // already filled in  
 
s.datapoints.pointsize = format.length;  
 
ps = s.datapoints.pointsize;  
points = s.datapoints.points;  
 
insertSteps = s.lines.show && s.lines.steps;  
s.xaxis.used = s.yaxis.used = true;  
 
for (j = k = 0; j < data.length; ++j, k += ps) {  
p = data[j];  
 
var nullify = p == null;  
if (!nullify) {  
for (m = 0; m < ps; ++m) {  
val = p[m];  
f = format[m];  
 
if (f) {  
if (f.number && val != null) {  
val = +val; // convert to number  
if (isNaN(val))  
val = null;  
else if (val == Infinity)  
val = fakeInfinity;  
else if (val == -Infinity)  
val = -fakeInfinity;  
}  
 
if (val == null) {  
if (f.required)  
nullify = true;  
 
if (f.defaultValue != null)  
val = f.defaultValue;  
}  
}  
 
points[k + m] = val;  
}  
}  
 
if (nullify) {  
for (m = 0; m < ps; ++m) {  
val = points[k + m];  
if (val != null) {  
f = format[m];  
// extract min/max info  
if (f.x)  
updateAxis(s.xaxis, val, val);  
if (f.y)  
updateAxis(s.yaxis, val, val);  
}  
points[k + m] = null;  
}  
}  
else {  
// a little bit of line specific stuff that  
// perhaps shouldn't be here, but lacking  
// better means...  
if (insertSteps && k > 0  
&& points[k - ps] != null  
&& points[k - ps] != points[k]  
&& points[k - ps + 1] != points[k + 1]) {  
// copy the point to make room for a middle point  
for (m = 0; m < ps; ++m)  
points[k + ps + m] = points[k + m];  
 
// middle point has same y  
points[k + 1] = points[k - ps + 1];  
 
// we've added a point, better reflect that  
k += ps;  
}  
}  
}  
}  
 
// give the hooks a chance to run  
for (i = 0; i < series.length; ++i) {  
s = series[i];  
 
executeHooks(hooks.processDatapoints, [ s, s.datapoints]);  
}  
 
// second pass: find datamax/datamin for auto-scaling  
for (i = 0; i < series.length; ++i) {  
s = series[i];  
points = s.datapoints.points,  
ps = s.datapoints.pointsize;  
 
var xmin = topSentry, ymin = topSentry,  
xmax = bottomSentry, ymax = bottomSentry;  
 
for (j = 0; j < points.length; j += ps) {  
if (points[j] == null)  
continue;  
 
for (m = 0; m < ps; ++m) {  
val = points[j + m];  
f = format[m];  
if (!f || val == fakeInfinity || val == -fakeInfinity)  
continue;  
 
if (f.x) {  
if (val < xmin)  
xmin = val;  
if (val > xmax)  
xmax = val;  
}  
if (f.y) {  
if (val < ymin)  
ymin = val;  
if (val > ymax)  
ymax = val;  
}  
}  
}  
 
if (s.bars.show) {  
// make sure we got room for the bar on the dancing floor  
var delta = s.bars.align == "left" ? 0 : -s.bars.barWidth/2;  
if (s.bars.horizontal) {  
ymin += delta;  
ymax += delta + s.bars.barWidth;  
}  
else {  
xmin += delta;  
xmax += delta + s.bars.barWidth;  
}  
}  
 
updateAxis(s.xaxis, xmin, xmax);  
updateAxis(s.yaxis, ymin, ymax);  
}  
 
$.each(allAxes(), function (_, axis) {  
if (axis.datamin == topSentry)  
axis.datamin = null;  
if (axis.datamax == bottomSentry)  
axis.datamax = null;  
});  
}  
 
function makeCanvas(skipPositioning, cls) {  
var c = document.createElement('canvas');  
c.className = cls;  
c.width = canvasWidth;  
c.height = canvasHeight;  
 
if (!skipPositioning)  
$(c).css({ position: 'absolute', left: 0, top: 0 });  
 
$(c).appendTo(placeholder);  
 
if (!c.getContext) // excanvas hack  
c = window.G_vmlCanvasManager.initElement(c);  
 
// used for resetting in case we get replotted  
c.getContext("2d").save();  
 
return c;  
}  
 
function getCanvasDimensions() {  
canvasWidth = placeholder.width();  
canvasHeight = placeholder.height();  
 
if (canvasWidth <= 0 || canvasHeight <= 0)  
throw "Invalid dimensions for plot, width = " + canvasWidth + ", height = " + canvasHeight;  
}  
 
function resizeCanvas(c) {  
// resizing should reset the state (excanvas seems to be  
// buggy though)  
if (c.width != canvasWidth)  
c.width = canvasWidth;  
 
if (c.height != canvasHeight)  
c.height = canvasHeight;  
 
// so try to get back to the initial state (even if it's  
// gone now, this should be safe according to the spec)  
var cctx = c.getContext("2d");  
cctx.restore();  
 
// and save again  
cctx.save();  
}  
 
function setupCanvases() {  
var reused,  
existingCanvas = placeholder.children("canvas.base"),  
existingOverlay = placeholder.children("canvas.overlay");  
 
if (existingCanvas.length == 0 || existingOverlay == 0) {  
// init everything  
 
placeholder.html(""); // make sure placeholder is clear  
 
placeholder.css({ padding: 0 }); // padding messes up the positioning  
 
if (placeholder.css("position") == 'static')  
placeholder.css("position", "relative"); // for positioning labels and overlay  
 
getCanvasDimensions();  
 
canvas = makeCanvas(true, "base");  
overlay = makeCanvas(false, "overlay"); // overlay canvas for interactive features  
 
reused = false;  
}  
else {  
// reuse existing elements  
 
canvas = existingCanvas.get(0);  
overlay = existingOverlay.get(0);  
 
reused = true;  
}  
 
ctx = canvas.getContext("2d");  
octx = overlay.getContext("2d");  
 
// we include the canvas in the event holder too, because IE 7  
// sometimes has trouble with the stacking order  
eventHolder = $([overlay, canvas]);  
 
if (reused) {  
// run shutdown in the old plot object  
placeholder.data("plot").shutdown();  
 
// reset reused canvases  
plot.resize();  
 
// make sure overlay pixels are cleared (canvas is cleared when we redraw)  
octx.clearRect(0, 0, canvasWidth, canvasHeight);  
 
// then whack any remaining obvious garbage left  
eventHolder.unbind();  
placeholder.children().not([canvas, overlay]).remove();  
}  
 
// save in case we get replotted  
placeholder.data("plot", plot);  
}  
 
function bindEvents() {  
// bind events  
if (options.grid.hoverable) {  
eventHolder.mousemove(onMouseMove);  
eventHolder.mouseleave(onMouseLeave);  
}  
 
if (options.grid.clickable)  
eventHolder.click(onClick);  
 
executeHooks(hooks.bindEvents, [eventHolder]);  
}  
 
function shutdown() {  
if (redrawTimeout)  
clearTimeout(redrawTimeout);  
 
eventHolder.unbind("mousemove", onMouseMove);  
eventHolder.unbind("mouseleave", onMouseLeave);  
eventHolder.unbind("click", onClick);  
 
executeHooks(hooks.shutdown, [eventHolder]);  
}  
 
function setTransformationHelpers(axis) {  
// set helper functions on the axis, assumes plot area  
// has been computed already  
 
function identity(x) { return x; }  
 
var s, m, t = axis.options.transform || identity,  
it = axis.options.inverseTransform;  
 
// precompute how much the axis is scaling a point  
// in canvas space  
if (axis.direction == "x") {  
s = axis.scale = plotWidth / Math.abs(t(axis.max) - t(axis.min));  
m = Math.min(t(axis.max), t(axis.min));  
}  
else {  
s = axis.scale = plotHeight / Math.abs(t(axis.max) - t(axis.min));  
s = -s;  
m = Math.max(t(axis.max), t(axis.min));  
}  
 
// data point to canvas coordinate  
if (t == identity) // slight optimization  
axis.p2c = function (p) { return (p - m) * s; };  
else  
axis.p2c = function (p) { return (t(p) - m) * s; };  
// canvas coordinate to data point  
if (!it)  
axis.c2p = function (c) { return m + c / s; };  
else  
axis.c2p = function (c) { return it(m + c / s); };  
}  
 
function measureTickLabels(axis) {  
var opts = axis.options, i, ticks = axis.ticks || [], labels = [],  
l, w = opts.labelWidth, h = opts.labelHeight, dummyDiv;  
 
function makeDummyDiv(labels, width) {  
return $('<div style="position:absolute;top:-10000px;' + width + 'font-size:smaller">' +  
'<div class="' + axis.direction + 'Axis ' + axis.direction + axis.n + 'Axis">'  
+ labels.join("") + '</div></div>')  
.appendTo(placeholder);  
}  
 
if (axis.direction == "x") {  
// to avoid measuring the widths of the labels (it's slow), we  
// construct fixed-size boxes and put the labels inside  
// them, we don't need the exact figures and the  
// fixed-size box content is easy to center  
if (w == null)  
w = Math.floor(canvasWidth / (ticks.length > 0 ? ticks.length : 1));  
 
// measure x label heights  
if (h == null) {  
labels = [];  
for (i = 0; i < ticks.length; ++i) {  
l = ticks[i].label;  
if (l)  
labels.push('<div class="tickLabel" style="float:left;width:' + w + 'px">' + l + '</div>');  
}  
 
if (labels.length > 0) {  
// stick them all in the same div and measure  
// collective height  
labels.push('<div style="clear:left"></div>');  
dummyDiv = makeDummyDiv(labels, "width:10000px;");  
h = dummyDiv.height();  
dummyDiv.remove();  
}  
}  
}  
else if (w == null || h == null) {  
// calculate y label dimensions  
for (i = 0; i < ticks.length; ++i) {  
l = ticks[i].label;  
if (l)  
labels.push('<div class="tickLabel">' + l + '</div>');  
}  
 
if (labels.length > 0) {  
dummyDiv = makeDummyDiv(labels, "");  
if (w == null)  
w = dummyDiv.children().width();  
if (h == null)  
h = dummyDiv.find("div.tickLabel").height();  
dummyDiv.remove();  
}  
}  
 
if (w == null)  
w = 0;  
if (h == null)  
h = 0;  
 
axis.labelWidth = w;  
axis.labelHeight = h;  
}  
 
function allocateAxisBoxFirstPhase(axis) {  
// find the bounding box of the axis by looking at label  
// widths/heights and ticks, make room by diminishing the  
// plotOffset  
 
var lw = axis.labelWidth,  
lh = axis.labelHeight,  
pos = axis.options.position,  
tickLength = axis.options.tickLength,  
axismargin = options.grid.axisMargin,  
padding = options.grid.labelMargin,  
all = axis.direction == "x" ? xaxes : yaxes,  
index;  
 
// determine axis margin  
var samePosition = $.grep(all, function (a) {  
return a && a.options.position == pos && a.reserveSpace;  
});  
if ($.inArray(axis, samePosition) == samePosition.length - 1)  
axismargin = 0; // outermost  
 
// determine tick length - if we're innermost, we can use "full"  
if (tickLength == null)  
tickLength = "full";  
 
var sameDirection = $.grep(all, function (a) {  
return a && a.reserveSpace;  
});  
 
var innermost = $.inArray(axis, sameDirection) == 0;  
if (!innermost && tickLength == "full")  
tickLength = 5;  
 
if (!isNaN(+tickLength))  
padding += +tickLength;  
 
// compute box  
if (axis.direction == "x") {  
lh += padding;  
 
if (pos == "bottom") {  
plotOffset.bottom += lh + axismargin;  
axis.box = { top: canvasHeight - plotOffset.bottom, height: lh };  
}  
else {  
axis.box = { top: plotOffset.top + axismargin, height: lh };  
plotOffset.top += lh + axismargin;  
}  
}  
else {  
lw += padding;  
 
if (pos == "left") {  
axis.box = { left: plotOffset.left + axismargin, width: lw };  
plotOffset.left += lw + axismargin;  
}  
else {  
plotOffset.right += lw + axismargin;  
axis.box = { left: canvasWidth - plotOffset.right, width: lw };  
}  
}  
 
// save for future reference  
axis.position = pos;  
axis.tickLength = tickLength;  
axis.box.padding = padding;  
axis.innermost = innermost;  
}  
 
function allocateAxisBoxSecondPhase(axis) {  
// set remaining bounding box coordinates  
if (axis.direction == "x") {  
axis.box.left = plotOffset.left;  
axis.box.width = plotWidth;  
}  
else {  
axis.box.top = plotOffset.top;  
axis.box.height = plotHeight;  
}  
}  
 
function setupGrid() {  
var i, axes = allAxes();  
 
// first calculate the plot and axis box dimensions  
 
$.each(axes, function (_, axis) {  
axis.show = axis.options.show;  
if (axis.show == null)  
axis.show = axis.used; // by default an axis is visible if it's got data  
 
axis.reserveSpace = axis.show || axis.options.reserveSpace;  
 
setRange(axis);  
});  
 
allocatedAxes = $.grep(axes, function (axis) { return axis.reserveSpace; });  
 
plotOffset.left = plotOffset.right = plotOffset.top = plotOffset.bottom = 0;  
if (options.grid.show) {  
$.each(allocatedAxes, function (_, axis) {  
// make the ticks  
setupTickGeneration(axis);  
setTicks(axis);  
snapRangeToTicks(axis, axis.ticks);  
 
// find labelWidth/Height for axis  
measureTickLabels(axis);  
});  
 
// with all dimensions in house, we can compute the  
// axis boxes, start from the outside (reverse order)  
for (i = allocatedAxes.length - 1; i >= 0; --i)  
allocateAxisBoxFirstPhase(allocatedAxes[i]);  
 
// make sure we've got enough space for things that  
// might stick out  
var minMargin = options.grid.minBorderMargin;  
if (minMargin == null) {  
minMargin = 0;  
for (i = 0; i < series.length; ++i)  
minMargin = Math.max(minMargin, series[i].points.radius + series[i].points.lineWidth/2);  
}  
 
for (var a in plotOffset) {  
plotOffset[a] += options.grid.borderWidth;  
plotOffset[a] = Math.max(minMargin, plotOffset[a]);  
}  
}  
 
plotWidth = canvasWidth - plotOffset.left - plotOffset.right;  
plotHeight = canvasHeight - plotOffset.bottom - plotOffset.top;  
 
// now we got the proper plotWidth/Height, we can compute the scaling  
$.each(axes, function (_, axis) {  
setTransformationHelpers(axis);  
});  
 
if (options.grid.show) {  
$.each(allocatedAxes, function (_, axis) {  
allocateAxisBoxSecondPhase(axis);  
});  
 
insertAxisLabels();  
}  
 
insertLegend();  
}  
 
function setRange(axis) {  
var opts = axis.options,  
min = +(opts.min != null ? opts.min : axis.datamin),  
max = +(opts.max != null ? opts.max : axis.datamax),  
delta = max - min;  
 
if (delta == 0.0) {  
// degenerate case  
var widen = max == 0 ? 1 : 0.01;  
 
if (opts.min == null)  
min -= widen;  
// always widen max if we couldn't widen min to ensure we  
// don't fall into min == max which doesn't work  
if (opts.max == null || opts.min != null)  
max += widen;  
}  
else {  
// consider autoscaling  
var margin = opts.autoscaleMargin;  
if (margin != null) {  
if (opts.min == null) {  
min -= delta * margin;  
// make sure we don't go below zero if all values  
// are positive  
if (min < 0 && axis.datamin != null && axis.datamin >= 0)  
min = 0;  
}  
if (opts.max == null) {  
max += delta * margin;  
if (max > 0 && axis.datamax != null && axis.datamax <= 0)  
max = 0;  
}  
}  
}  
axis.min = min;  
axis.max = max;  
}  
 
function setupTickGeneration(axis) {  
var opts = axis.options;  
 
// estimate number of ticks  
var noTicks;  
if (typeof opts.ticks == "number" && opts.ticks > 0)  
noTicks = opts.ticks;  
else  
// heuristic based on the model a*sqrt(x) fitted to  
// some data points that seemed reasonable  
noTicks = 0.3 * Math.sqrt(axis.direction == "x" ? canvasWidth : canvasHeight);  
 
var delta = (axis.max - axis.min) / noTicks,  
size, generator, unit, formatter, i, magn, norm;  
 
if (opts.mode == "time") {  
// pretty handling of time  
 
// map of app. size of time units in milliseconds  
var timeUnitSize = {  
"second": 1000,  
"minute": 60 * 1000,  
"hour": 60 * 60 * 1000,  
"day": 24 * 60 * 60 * 1000,  
"month": 30 * 24 * 60 * 60 * 1000,  
"year": 365.2425 * 24 * 60 * 60 * 1000  
};  
 
 
// the allowed tick sizes, after 1 year we use  
// an integer algorithm  
var spec = [  
[1, "second"], [2, "second"], [5, "second"], [10, "second"],  
[30, "second"],  
[1, "minute"], [2, "minute"], [5, "minute"], [10, "minute"],  
[30, "minute"],  
[1, "hour"], [2, "hour"], [4, "hour"],  
[8, "hour"], [12, "hour"],  
[1, "day"], [2, "day"], [3, "day"],  
[0.25, "month"], [0.5, "month"], [1, "month"],  
[2, "month"], [3, "month"], [6, "month"],  
[1, "year"]  
];  
 
var minSize = 0;  
if (opts.minTickSize != null) {  
if (typeof opts.tickSize == "number")  
minSize = opts.tickSize;  
else  
minSize = opts.minTickSize[0] * timeUnitSize[opts.minTickSize[1]];  
}  
 
for (var i = 0; i < spec.length - 1; ++i)  
if (delta < (spec[i][0] * timeUnitSize[spec[i][1]]  
+ spec[i + 1][0] * timeUnitSize[spec[i + 1][1]]) / 2  
&& spec[i][0] * timeUnitSize[spec[i][1]] >= minSize)  
break;  
size = spec[i][0];  
unit = spec[i][1];  
 
// special-case the possibility of several years  
if (unit == "year") {  
magn = Math.pow(10, Math.floor(Math.log(delta / timeUnitSize.year) / Math.LN10));  
norm = (delta / timeUnitSize.year) / magn;  
if (norm < 1.5)  
size = 1;  
else if (norm < 3)  
size = 2;  
else if (norm < 7.5)  
size = 5;  
else  
size = 10;  
 
size *= magn;  
}  
 
axis.tickSize = opts.tickSize || [size, unit];  
 
generator = function(axis) {  
var ticks = [],  
tickSize = axis.tickSize[0], unit = axis.tickSize[1],  
d = new Date(axis.min);  
 
var step = tickSize * timeUnitSize[unit];  
 
if (unit == "second")  
d.setUTCSeconds(floorInBase(d.getUTCSeconds(), tickSize));  
if (unit == "minute")  
d.setUTCMinutes(floorInBase(d.getUTCMinutes(), tickSize));  
if (unit == "hour")  
d.setUTCHours(floorInBase(d.getUTCHours(), tickSize));  
if (unit == "month")  
d.setUTCMonth(floorInBase(d.getUTCMonth(), tickSize));  
if (unit == "year")  
d.setUTCFullYear(floorInBase(d.getUTCFullYear(), tickSize));  
 
// reset smaller components  
d.setUTCMilliseconds(0);  
if (step >= timeUnitSize.minute)  
d.setUTCSeconds(0);  
if (step >= timeUnitSize.hour)  
d.setUTCMinutes(0);  
if (step >= timeUnitSize.day)  
d.setUTCHours(0);  
if (step >= timeUnitSize.day * 4)  
d.setUTCDate(1);  
if (step >= timeUnitSize.year)  
d.setUTCMonth(0);  
 
 
var carry = 0, v = Number.NaN, prev;  
do {  
prev = v;  
v = d.getTime();  
ticks.push(v);  
if (unit == "month") {  
if (tickSize < 1) {  
// a bit complicated - we'll divide the month  
// up but we need to take care of fractions  
// so we don't end up in the middle of a day  
d.setUTCDate(1);  
var start = d.getTime();  
d.setUTCMonth(d.getUTCMonth() + 1);  
var end = d.getTime();  
d.setTime(v + carry * timeUnitSize.hour + (end - start) * tickSize);  
carry = d.getUTCHours();  
d.setUTCHours(0);  
}  
else  
d.setUTCMonth(d.getUTCMonth() + tickSize);  
}  
else if (unit == "year") {  
d.setUTCFullYear(d.getUTCFullYear() + tickSize);  
}  
else  
d.setTime(v + step);  
} while (v < axis.max && v != prev);  
 
return ticks;  
};  
 
formatter = function (v, axis) {  
var d = new Date(v);  
 
// first check global format  
if (opts.timeformat != null)  
return $.plot.formatDate(d, opts.timeformat, opts.monthNames);  
 
var t = axis.tickSize[0] * timeUnitSize[axis.tickSize[1]];  
var span = axis.max - axis.min;  
var suffix = (opts.twelveHourClock) ? " %p" : "";  
 
if (t < timeUnitSize.minute)  
fmt = "%h:%M:%S" + suffix;  
else if (t < timeUnitSize.day) {  
if (span < 2 * timeUnitSize.day)  
fmt = "%h:%M" + suffix;  
else  
fmt = "%b %d %h:%M" + suffix;  
}  
else if (t < timeUnitSize.month)  
fmt = "%b %d";  
else if (t < timeUnitSize.year) {  
if (span < timeUnitSize.year)  
fmt = "%b";  
else  
fmt = "%b %y";  
}  
else  
fmt = "%y";  
 
return $.plot.formatDate(d, fmt, opts.monthNames);  
};  
}  
else {  
// pretty rounding of base-10 numbers  
var maxDec = opts.tickDecimals;  
var dec = -Math.floor(Math.log(delta) / Math.LN10);  
if (maxDec != null && dec > maxDec)  
dec = maxDec;  
 
magn = Math.pow(10, -dec);  
norm = delta / magn; // norm is between 1.0 and 10.0  
 
if (norm < 1.5)  
size = 1;  
else if (norm < 3) {  
size = 2;  
// special case for 2.5, requires an extra decimal  
if (norm > 2.25 && (maxDec == null || dec + 1 <= maxDec)) {  
size = 2.5;  
++dec;  
}  
}  
else if (norm < 7.5)  
size = 5;  
else  
size = 10;  
 
size *= magn;  
 
if (opts.minTickSize != null && size < opts.minTickSize)  
size = opts.minTickSize;  
 
axis.tickDecimals = Math.max(0, maxDec != null ? maxDec : dec);  
axis.tickSize = opts.tickSize || size;  
 
generator = function (axis) {  
var ticks = [];  
 
// spew out all possible ticks  
var start = floorInBase(axis.min, axis.tickSize),  
i = 0, v = Number.NaN, prev;  
do {  
prev = v;  
v = start + i * axis.tickSize;  
ticks.push(v);  
++i;  
} while (v < axis.max && v != prev);  
return ticks;  
};  
 
formatter = function (v, axis) {  
return v.toFixed(axis.tickDecimals);  
};  
}  
 
if (opts.alignTicksWithAxis != null) {  
var otherAxis = (axis.direction == "x" ? xaxes : yaxes)[opts.alignTicksWithAxis - 1];  
if (otherAxis && otherAxis.used && otherAxis != axis) {  
// consider snapping min/max to outermost nice ticks  
var niceTicks = generator(axis);  
if (niceTicks.length > 0) {  
if (opts.min == null)  
axis.min = Math.min(axis.min, niceTicks[0]);  
if (opts.max == null && niceTicks.length > 1)  
axis.max = Math.max(axis.max, niceTicks[niceTicks.length - 1]);  
}  
 
generator = function (axis) {  
// copy ticks, scaled to this axis  
var ticks = [], v, i;  
for (i = 0; i < otherAxis.ticks.length; ++i) {  
v = (otherAxis.ticks[i].v - otherAxis.min) / (otherAxis.max - otherAxis.min);  
v = axis.min + v * (axis.max - axis.min);  
ticks.push(v);  
}  
return ticks;  
};  
 
// we might need an extra decimal since forced  
// ticks don't necessarily fit naturally  
if (axis.mode != "time" && opts.tickDecimals == null) {  
var extraDec = Math.max(0, -Math.floor(Math.log(delta) / Math.LN10) + 1),  
ts = generator(axis);  
 
// only proceed if the tick interval rounded  
// with an extra decimal doesn't give us a  
// zero at end  
if (!(ts.length > 1 && /\..*0$/.test((ts[1] - ts[0]).toFixed(extraDec))))  
axis.tickDecimals = extraDec;  
}  
}  
}  
 
axis.tickGenerator = generator;  
if ($.isFunction(opts.tickFormatter))  
axis.tickFormatter = function (v, axis) { return "" + opts.tickFormatter(v, axis); };  
else  
axis.tickFormatter = formatter;  
}  
 
function setTicks(axis) {  
var oticks = axis.options.ticks, ticks = [];  
if (oticks == null || (typeof oticks == "number" && oticks > 0))  
ticks = axis.tickGenerator(axis);  
else if (oticks) {  
if ($.isFunction(oticks))  
// generate the ticks  
ticks = oticks({ min: axis.min, max: axis.max });  
else  
ticks = oticks;  
}  
 
// clean up/labelify the supplied ticks, copy them over  
var i, v;  
axis.ticks = [];  
for (i = 0; i < ticks.length; ++i) {  
var label = null;  
var t = ticks[i];  
if (typeof t == "object") {  
v = +t[0];  
if (t.length > 1)  
label = t[1];  
}  
else  
v = +t;  
if (label == null)  
label = axis.tickFormatter(v, axis);  
if (!isNaN(v))  
axis.ticks.push({ v: v, label: label });  
}  
}  
 
function snapRangeToTicks(axis, ticks) {  
if (axis.options.autoscaleMargin && ticks.length > 0) {  
// snap to ticks  
if (axis.options.min == null)  
axis.min = Math.min(axis.min, ticks[0].v);  
if (axis.options.max == null && ticks.length > 1)  
axis.max = Math.max(axis.max, ticks[ticks.length - 1].v);  
}  
}  
 
function draw() {  
ctx.clearRect(0, 0, canvasWidth, canvasHeight);  
 
var grid = options.grid;  
 
// draw background, if any  
if (grid.show && grid.backgroundColor)  
drawBackground();  
 
if (grid.show && !grid.aboveData)  
drawGrid();  
 
for (var i = 0; i < series.length; ++i) {  
executeHooks(hooks.drawSeries, [ctx, series[i]]);  
drawSeries(series[i]);  
}  
 
executeHooks(hooks.draw, [ctx]);  
 
if (grid.show && grid.aboveData)  
drawGrid();  
}  
 
function extractRange(ranges, coord) {  
var axis, from, to, key, axes = allAxes();  
 
for (i = 0; i < axes.length; ++i) {  
axis = axes[i];  
if (axis.direction == coord) {  
key = coord + axis.n + "axis";  
if (!ranges[key] && axis.n == 1)  
key = coord + "axis"; // support x1axis as xaxis  
if (ranges[key]) {  
from = ranges[key].from;  
to = ranges[key].to;  
break;  
}  
}  
}  
 
// backwards-compat stuff - to be removed in future  
if (!ranges[key]) {  
axis = coord == "x" ? xaxes[0] : yaxes[0];  
from = ranges[coord + "1"];  
to = ranges[coord + "2"];  
}  
 
// auto-reverse as an added bonus  
if (from != null && to != null && from > to) {  
var tmp = from;  
from = to;  
to = tmp;  
}  
 
return { from: from, to: to, axis: axis };  
}  
 
function drawBackground() {  
ctx.save();  
ctx.translate(plotOffset.left, plotOffset.top);  
 
ctx.fillStyle = getColorOrGradient(options.grid.backgroundColor, plotHeight, 0, "rgba(255, 255, 255, 0)");  
ctx.fillRect(0, 0, plotWidth, plotHeight);  
ctx.restore();  
}  
 
function drawGrid() {  
var i;  
 
ctx.save();  
ctx.translate(plotOffset.left, plotOffset.top);  
 
// draw markings  
var markings = options.grid.markings;  
if (markings) {  
if ($.isFunction(markings)) {  
var axes = plot.getAxes();  
// xmin etc. is backwards compatibility, to be  
// removed in the future  
axes.xmin = axes.xaxis.min;  
axes.xmax = axes.xaxis.max;  
axes.ymin = axes.yaxis.min;  
axes.ymax = axes.yaxis.max;  
 
markings = markings(axes);  
}  
 
for (i = 0; i < markings.length; ++i) {  
var m = markings[i],  
xrange = extractRange(m, "x"),  
yrange = extractRange(m, "y");  
 
// fill in missing  
if (xrange.from == null)  
xrange.from = xrange.axis.min;  
if (xrange.to == null)  
xrange.to = xrange.axis.max;  
if (yrange.from == null)  
yrange.from = yrange.axis.min;  
if (yrange.to == null)  
yrange.to = yrange.axis.max;  
 
// clip  
if (xrange.to < xrange.axis.min || xrange.from > xrange.axis.max ||  
yrange.to < yrange.axis.min || yrange.from > yrange.axis.max)  
continue;  
 
xrange.from = Math.max(xrange.from, xrange.axis.min);  
xrange.to = Math.min(xrange.to, xrange.axis.max);  
yrange.from = Math.max(yrange.from, yrange.axis.min);  
yrange.to = Math.min(yrange.to, yrange.axis.max);  
 
if (xrange.from == xrange.to && yrange.from == yrange.to)  
continue;  
 
// then draw  
xrange.from = xrange.axis.p2c(xrange.from);  
xrange.to = xrange.axis.p2c(xrange.to);  
yrange.from = yrange.axis.p2c(yrange.from);  
yrange.to = yrange.axis.p2c(yrange.to);  
 
if (xrange.from == xrange.to || yrange.from == yrange.to) {  
// draw line  
ctx.beginPath();  
ctx.strokeStyle = m.color || options.grid.markingsColor;  
ctx.lineWidth = m.lineWidth || options.grid.markingsLineWidth;  
ctx.moveTo(xrange.from, yrange.from);  
ctx.lineTo(xrange.to, yrange.to);  
ctx.stroke();  
}  
else {  
// fill area  
ctx.fillStyle = m.color || options.grid.markingsColor;  
ctx.fillRect(xrange.from, yrange.to,  
xrange.to - xrange.from,  
yrange.from - yrange.to);  
}  
}  
}  
 
// draw the ticks  
var axes = allAxes(), bw = options.grid.borderWidth;  
 
for (var j = 0; j < axes.length; ++j) {  
var axis = axes[j], box = axis.box,  
t = axis.tickLength, x, y, xoff, yoff;  
if (!axis.show || axis.ticks.length == 0)  
continue  
 
ctx.strokeStyle = axis.options.tickColor || $.color.parse(axis.options.color).scale('a', 0.22).toString();  
ctx.lineWidth = 1;  
 
// find the edges  
if (axis.direction == "x") {  
x = 0;  
if (t == "full")  
y = (axis.position == "top" ? 0 : plotHeight);  
else  
y = box.top - plotOffset.top + (axis.position == "top" ? box.height : 0);  
}  
else {  
y = 0;  
if (t == "full")  
x = (axis.position == "left" ? 0 : plotWidth);  
else  
x = box.left - plotOffset.left + (axis.position == "left" ? box.width : 0);  
}  
 
// draw tick bar  
if (!axis.innermost) {  
ctx.beginPath();  
xoff = yoff = 0;  
if (axis.direction == "x")  
xoff = plotWidth;  
else  
yoff = plotHeight;  
 
if (ctx.lineWidth == 1) {  
x = Math.floor(x) + 0.5;  
y = Math.floor(y) + 0.5;  
}  
 
ctx.moveTo(x, y);  
ctx.lineTo(x + xoff, y + yoff);  
ctx.stroke();  
}  
 
// draw ticks  
ctx.beginPath();  
for (i = 0; i < axis.ticks.length; ++i) {  
var v = axis.ticks[i].v;  
 
xoff = yoff = 0;  
 
if (v < axis.min || v > axis.max  
// skip those lying on the axes if we got a border  
|| (t == "full" && bw > 0  
&& (v == axis.min || v == axis.max)))  
continue;  
 
if (axis.direction == "x") {  
x = axis.p2c(v);  
yoff = t == "full" ? -plotHeight : t;  
 
if (axis.position == "top")  
yoff = -yoff;  
}  
else {  
y = axis.p2c(v);  
xoff = t == "full" ? -plotWidth : t;  
 
if (axis.position == "left")  
xoff = -xoff;  
}  
 
if (ctx.lineWidth == 1) {  
if (axis.direction == "x")  
x = Math.floor(x) + 0.5;  
else  
y = Math.floor(y) + 0.5;  
}  
 
ctx.moveTo(x, y);  
ctx.lineTo(x + xoff, y + yoff);  
}  
 
ctx.stroke();  
}  
 
 
// draw border  
if (bw) {  
ctx.lineWidth = bw;  
ctx.strokeStyle = options.grid.borderColor;  
ctx.strokeRect(-bw/2, -bw/2, plotWidth + bw, plotHeight + bw);  
}  
 
ctx.restore();  
}  
 
function insertAxisLabels() {  
placeholder.find(".tickLabels").remove();  
 
var html = ['<div class="tickLabels" style="font-size:smaller">'];  
 
var axes = allAxes();  
for (var j = 0; j < axes.length; ++j) {  
var axis = axes[j], box = axis.box;  
if (!axis.show)  
continue;  
//debug: html.push('<div style="position:absolute;opacity:0.10;background-color:red;left:' + box.left + 'px;top:' + box.top + 'px;width:' + box.width + 'px;height:' + box.height + 'px"></div>')  
html.push('<div class="' + axis.direction + 'Axis ' + axis.direction + axis.n + 'Axis" style="color:' + axis.options.color + '">');  
for (var i = 0; i < axis.ticks.length; ++i) {  
var tick = axis.ticks[i];  
if (!tick.label || tick.v < axis.min || tick.v > axis.max)  
continue;  
 
var pos = {}, align;  
 
if (axis.direction == "x") {  
align = "center";  
pos.left = Math.round(plotOffset.left + axis.p2c(tick.v) - axis.labelWidth/2);  
if (axis.position == "bottom")  
pos.top = box.top + box.padding;  
else  
pos.bottom = canvasHeight - (box.top + box.height - box.padding);  
}  
else {  
pos.top = Math.round(plotOffset.top + axis.p2c(tick.v) - axis.labelHeight/2);  
if (axis.position == "left") {  
pos.right = canvasWidth - (box.left + box.width - box.padding)  
align = "right";  
}  
else {  
pos.left = box.left + box.padding;  
align = "left";  
}  
}  
 
pos.width = axis.labelWidth;  
 
var style = ["position:absolute", "text-align:" + align ];  
for (var a in pos)  
style.push(a + ":" + pos[a] + "px")  
 
html.push('<div class="tickLabel" style="' + style.join(';') + '">' + tick.label + '</div>');  
}  
html.push('</div>');  
}  
 
html.push('</div>');  
 
placeholder.append(html.join(""));  
}  
 
function drawSeries(series) {  
if (series.lines.show)  
drawSeriesLines(series);  
if (series.bars.show)  
drawSeriesBars(series);  
if (series.points.show)  
drawSeriesPoints(series);  
}  
 
function drawSeriesLines(series) {  
function plotLine(datapoints, xoffset, yoffset, axisx, axisy) {  
var points = datapoints.points,  
ps = datapoints.pointsize,  
prevx = null, prevy = null;  
 
ctx.beginPath();  
for (var i = ps; i < points.length; i += ps) {  
var x1 = points[i - ps], y1 = points[i - ps + 1],  
x2 = points[i], y2 = points[i + 1];  
 
if (x1 == null || x2 == null)  
continue;  
 
// clip with ymin  
if (y1 <= y2 && y1 < axisy.min) {  
if (y2 < axisy.min)  
continue; // line segment is outside  
// compute new intersection point  
x1 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;  
y1 = axisy.min;  
}  
else if (y2 <= y1 && y2 < axisy.min) {  
if (y1 < axisy.min)  
continue;  
x2 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;  
y2 = axisy.min;  
}  
 
// clip with ymax  
if (y1 >= y2 && y1 > axisy.max) {  
if (y2 > axisy.max)  
continue;  
x1 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;  
y1 = axisy.max;  
}  
else if (y2 >= y1 && y2 > axisy.max) {  
if (y1 > axisy.max)  
continue;  
x2 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;  
y2 = axisy.max;  
}  
 
// clip with xmin  
if (x1 <= x2 && x1 < axisx.min) {  
if (x2 < axisx.min)  
continue;  
y1 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;  
x1 = axisx.min;  
}  
else if (x2 <= x1 && x2 < axisx.min) {  
if (x1 < axisx.min)  
continue;  
y2 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;  
x2 = axisx.min;  
}  
 
// clip with xmax  
if (x1 >= x2 && x1 > axisx.max) {  
if (x2 > axisx.max)  
continue;  
y1 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;  
x1 = axisx.max;  
}  
else if (x2 >= x1 && x2 > axisx.max) {  
if (x1 > axisx.max)  
continue;  
y2 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;  
x2 = axisx.max;  
}  
 
if (x1 != prevx || y1 != prevy)  
ctx.moveTo(axisx.p2c(x1) + xoffset, axisy.p2c(y1) + yoffset);  
 
prevx = x2;  
prevy = y2;  
ctx.lineTo(axisx.p2c(x2) + xoffset, axisy.p2c(y2) + yoffset);  
}  
ctx.stroke();  
}  
 
function plotLineArea(datapoints, axisx, axisy) {  
var points = datapoints.points,  
ps = datapoints.pointsize,  
bottom = Math.min(Math.max(0, axisy.min), axisy.max),  
i = 0, top, areaOpen = false,  
ypos = 1, segmentStart = 0, segmentEnd = 0;  
 
// we process each segment in two turns, first forward  
// direction to sketch out top, then once we hit the  
// end we go backwards to sketch the bottom  
while (true) {  
if (ps > 0 && i > points.length + ps)  
break;  
 
i += ps; // ps is negative if going backwards  
 
var x1 = points[i - ps],  
y1 = points[i - ps + ypos],  
x2 = points[i], y2 = points[i + ypos];  
 
if (areaOpen) {  
if (ps > 0 && x1 != null && x2 == null) {  
// at turning point  
segmentEnd = i;  
ps = -ps;  
ypos = 2;  
continue;  
}  
 
if (ps < 0 && i == segmentStart + ps) {  
// done with the reverse sweep  
ctx.fill();  
areaOpen = false;  
ps = -ps;  
ypos = 1;  
i = segmentStart = segmentEnd + ps;  
continue;  
}  
}  
 
if (x1 == null || x2 == null)  
continue;  
 
// clip x values  
 
// clip with xmin  
if (x1 <= x2 && x1 < axisx.min) {  
if (x2 < axisx.min)  
continue;  
y1 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;  
x1 = axisx.min;  
}  
else if (x2 <= x1 && x2 < axisx.min) {  
if (x1 < axisx.min)  
continue;  
y2 = (axisx.min - x1) / (x2 - x1) * (y2 - y1) + y1;  
x2 = axisx.min;  
}  
 
// clip with xmax  
if (x1 >= x2 && x1 > axisx.max) {  
if (x2 > axisx.max)  
continue;  
y1 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;  
x1 = axisx.max;  
}  
else if (x2 >= x1 && x2 > axisx.max) {  
if (x1 > axisx.max)  
continue;  
y2 = (axisx.max - x1) / (x2 - x1) * (y2 - y1) + y1;  
x2 = axisx.max;  
}  
 
if (!areaOpen) {  
// open area  
ctx.beginPath();  
ctx.moveTo(axisx.p2c(x1), axisy.p2c(bottom));  
areaOpen = true;  
}  
 
// now first check the case where both is outside  
if (y1 >= axisy.max && y2 >= axisy.max) {  
ctx.lineTo(axisx.p2c(x1), axisy.p2c(axisy.max));  
ctx.lineTo(axisx.p2c(x2), axisy.p2c(axisy.max));  
continue;  
}  
else if (y1 <= axisy.min && y2 <= axisy.min) {  
ctx.lineTo(axisx.p2c(x1), axisy.p2c(axisy.min));  
ctx.lineTo(axisx.p2c(x2), axisy.p2c(axisy.min));  
continue;  
}  
 
// else it's a bit more complicated, there might  
// be a flat maxed out rectangle first, then a  
// triangular cutout or reverse; to find these  
// keep track of the current x values  
var x1old = x1, x2old = x2;  
 
// clip the y values, without shortcutting, we  
// go through all cases in turn  
 
// clip with ymin  
if (y1 <= y2 && y1 < axisy.min && y2 >= axisy.min) {  
x1 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;  
y1 = axisy.min;  
}  
else if (y2 <= y1 && y2 < axisy.min && y1 >= axisy.min) {  
x2 = (axisy.min - y1) / (y2 - y1) * (x2 - x1) + x1;  
y2 = axisy.min;  
}  
 
// clip with ymax  
if (y1 >= y2 && y1 > axisy.max && y2 <= axisy.max) {  
x1 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;  
y1 = axisy.max;  
}  
else if (y2 >= y1 && y2 > axisy.max && y1 <= axisy.max) {  
x2 = (axisy.max - y1) / (y2 - y1) * (x2 - x1) + x1;  
y2 = axisy.max;  
}  
 
// if the x value was changed we got a rectangle  
// to fill  
if (x1 != x1old) {  
ctx.lineTo(axisx.p2c(x1old), axisy.p2c(y1));  
// it goes to (x1, y1), but we fill that below  
}  
 
// fill triangular section, this sometimes result  
// in redundant points if (x1, y1) hasn't changed  
// from previous line to, but we just ignore that  
ctx.lineTo(axisx.p2c(x1), axisy.p2c(y1));  
ctx.lineTo(axisx.p2c(x2), axisy.p2c(y2));  
 
// fill the other rectangle if it's there  
if (x2 != x2old) {  
ctx.lineTo(axisx.p2c(x2), axisy.p2c(y2));  
ctx.lineTo(axisx.p2c(x2old), axisy.p2c(y2));  
}  
}  
}  
 
ctx.save();  
ctx.translate(plotOffset.left, plotOffset.top);  
ctx.lineJoin = "round";  
 
var lw = series.lines.lineWidth,  
sw = series.shadowSize;  
// FIXME: consider another form of shadow when filling is turned on  
if (lw > 0 && sw > 0) {  
// draw shadow as a thick and thin line with transparency  
ctx.lineWidth = sw;  
ctx.strokeStyle = "rgba(0,0,0,0.1)";  
// position shadow at angle from the mid of line  
var angle = Math.PI/18;  
plotLine(series.datapoints, Math.sin(angle) * (lw/2 + sw/2), Math.cos(angle) * (lw/2 + sw/2), series.xaxis, series.yaxis);  
ctx.lineWidth = sw/2;  
plotLine(series.datapoints, Math.sin(angle) * (lw/2 + sw/4), Math.cos(angle) * (lw/2 + sw/4), series.xaxis, series.yaxis);  
}  
 
ctx.lineWidth = lw;  
ctx.strokeStyle = series.color;  
var fillStyle = getFillStyle(series.lines, series.color, 0, plotHeight);  
if (fillStyle) {  
ctx.fillStyle = fillStyle;  
plotLineArea(series.datapoints, series.xaxis, series.yaxis);  
}  
 
if (lw > 0)  
plotLine(series.datapoints, 0, 0, series.xaxis, series.yaxis);  
ctx.restore();  
}  
 
function drawSeriesPoints(series) {  
function plotPoints(datapoints, radius, fillStyle, offset, shadow, axisx, axisy, symbol) {  
var points = datapoints.points, ps = datapoints.pointsize;  
 
for (var i = 0; i < points.length; i += ps) {  
var x = points[i], y = points[i + 1];  
if (x == null || x < axisx.min || x > axisx.max || y < axisy.min || y > axisy.max)  
continue;  
 
ctx.beginPath();  
x = axisx.p2c(x);  
y = axisy.p2c(y) + offset;  
if (symbol == "circle")  
ctx.arc(x, y, radius, 0, shadow ? Math.PI : Math.PI * 2, false);  
else  
symbol(ctx, x, y, radius, shadow);  
ctx.closePath();  
 
if (fillStyle) {  
ctx.fillStyle = fillStyle;  
ctx.fill();  
}  
ctx.stroke();  
}  
}  
 
ctx.save();  
ctx.translate(plotOffset.left, plotOffset.top);  
 
var lw = series.points.lineWidth,  
sw = series.shadowSize,  
radius = series.points.radius,  
symbol = series.points.symbol;  
if (lw > 0 && sw > 0) {  
// draw shadow in two steps  
var w = sw / 2;  
ctx.lineWidth = w;  
ctx.strokeStyle = "rgba(0,0,0,0.1)";  
plotPoints(series.datapoints, radius, null, w + w/2, true,  
series.xaxis, series.yaxis, symbol);  
 
ctx.strokeStyle = "rgba(0,0,0,0.2)";  
plotPoints(series.datapoints, radius, null, w/2, true,  
series.xaxis, series.yaxis, symbol);  
}  
 
ctx.lineWidth = lw;  
ctx.strokeStyle = series.color;  
plotPoints(series.datapoints, radius,  
getFillStyle(series.points, series.color), 0, false,  
series.xaxis, series.yaxis, symbol);  
ctx.restore();  
}  
 
function drawBar(x, y, b, barLeft, barRight, offset, fillStyleCallback, axisx, axisy, c, horizontal, lineWidth) {  
var left, right, bottom, top,  
drawLeft, drawRight, drawTop, drawBottom,  
tmp;  
 
// in horizontal mode, we start the bar from the left  
// instead of from the bottom so it appears to be  
// horizontal rather than vertical  
if (horizontal) {  
drawBottom = drawRight = drawTop = true;  
drawLeft = false;  
left = b;  
right = x;  
top = y + barLeft;  
bottom = y + barRight;  
 
// account for negative bars  
if (right < left) {  
tmp = right;  
right = left;  
left = tmp;  
drawLeft = true;  
drawRight = false;  
}  
}  
else {  
drawLeft = drawRight = drawTop = true;  
drawBottom = false;  
left = x + barLeft;  
right = x + barRight;  
bottom = b;  
top = y;  
 
// account for negative bars  
if (top < bottom) {  
tmp = top;  
top = bottom;  
bottom = tmp;  
drawBottom = true;  
drawTop = false;  
}  
}  
 
// clip  
if (right < axisx.min || left > axisx.max ||  
top < axisy.min || bottom > axisy.max)  
return;  
 
if (left < axisx.min) {  
left = axisx.min;  
drawLeft = false;  
}  
 
if (right > axisx.max) {  
right = axisx.max;  
drawRight = false;  
}  
 
if (bottom < axisy.min) {  
bottom = axisy.min;  
drawBottom = false;  
}  
 
if (top > axisy.max) {  
top = axisy.max;  
drawTop = false;  
}  
 
left = axisx.p2c(left);  
bottom = axisy.p2c(bottom);  
right = axisx.p2c(right);  
top = axisy.p2c(top);  
 
// fill the bar  
if (fillStyleCallback) {  
c.beginPath();  
c.moveTo(left, bottom);  
c.lineTo(left, top);  
c.lineTo(right, top);  
c.lineTo(right, bottom);  
c.fillStyle = fillStyleCallback(bottom, top);  
c.fill();  
}  
 
// draw outline  
if (lineWidth > 0 && (drawLeft || drawRight || drawTop || drawBottom)) {  
c.beginPath();  
 
// FIXME: inline moveTo is buggy with excanvas  
c.moveTo(left, bottom + offset);  
if (drawLeft)  
c.lineTo(left, top + offset);  
else  
c.moveTo(left, top + offset);  
if (drawTop)  
c.lineTo(right, top + offset);  
else  
c.moveTo(right, top + offset);  
if (drawRight)  
c.lineTo(right, bottom + offset);  
else  
c.moveTo(right, bottom + offset);  
if (drawBottom)  
c.lineTo(left, bottom + offset);  
else  
c.moveTo(left, bottom + offset);  
c.stroke();  
}  
}  
 
function drawSeriesBars(series) {  
function plotBars(datapoints, barLeft, barRight, offset, fillStyleCallback, axisx, axisy) {  
var points = datapoints.points, ps = datapoints.pointsize;  
 
for (var i = 0; i < points.length; i += ps) {  
if (points[i] == null)  
continue;  
drawBar(points[i], points[i + 1], points[i + 2], barLeft, barRight, offset, fillStyleCallback, axisx, axisy, ctx, series.bars.horizontal, series.bars.lineWidth);  
}  
}  
 
ctx.save();  
ctx.translate(plotOffset.left, plotOffset.top);  
 
// FIXME: figure out a way to add shadows (for instance along the right edge)  
ctx.lineWidth = series.bars.lineWidth;  
ctx.strokeStyle = series.color;  
var barLeft = series.bars.align == "left" ? 0 : -series.bars.barWidth/2;  
var fillStyleCallback = series.bars.fill ? function (bottom, top) { return getFillStyle(series.bars, series.color, bottom, top); } : null;  
plotBars(series.datapoints, barLeft, barLeft + series.bars.barWidth, 0, fillStyleCallback, series.xaxis, series.yaxis);  
ctx.restore();  
}  
 
function getFillStyle(filloptions, seriesColor, bottom, top) {  
var fill = filloptions.fill;  
if (!fill)  
return null;  
 
if (filloptions.fillColor)  
return getColorOrGradient(filloptions.fillColor, bottom, top, seriesColor);  
 
var c = $.color.parse(seriesColor);  
c.a = typeof fill == "number" ? fill : 0.4;  
c.normalize();  
return c.toString();  
}  
 
function insertLegend() {  
placeholder.find(".legend").remove();  
 
if (!options.legend.show)  
return;  
 
var fragments = [], rowStarted = false,  
lf = options.legend.labelFormatter, s, label;  
for (var i = 0; i < series.length; ++i) {  
s = series[i];  
label = s.label;  
if (!label)  
continue;  
 
if (i % options.legend.noColumns == 0) {  
if (rowStarted)  
fragments.push('</tr>');  
fragments.push('<tr>');  
rowStarted = true;  
}  
 
if (lf)  
label = lf(label, s);  
 
fragments.push(  
'<td class="legendColorBox"><div style="border:1px solid ' + options.legend.labelBoxBorderColor + ';padding:1px"><div style="width:4px;height:0;border:5px solid ' + s.color + ';overflow:hidden"></div></div></td>' +  
'<td class="legendLabel">' + label + '</td>');  
}  
if (rowStarted)  
fragments.push('</tr>');  
 
if (fragments.length == 0)  
return;  
 
var table = '<table style="font-size:smaller;color:' + options.grid.color + '">' + fragments.join("") + '</table>';  
if (options.legend.container != null)  
$(options.legend.container).html(table);  
else {  
var pos = "",  
p = options.legend.position,  
m = options.legend.margin;  
if (m[0] == null)  
m = [m, m];  
if (p.charAt(0) == "n")  
pos += 'top:' + (m[1] + plotOffset.top) + 'px;';  
else if (p.charAt(0) == "s")  
pos += 'bottom:' + (m[1] + plotOffset.bottom) + 'px;';  
if (p.charAt(1) == "e")  
pos += 'right:' + (m[0] + plotOffset.right) + 'px;';  
else if (p.charAt(1) == "w")  
pos += 'left:' + (m[0] + plotOffset.left) + 'px;';  
var legend = $('<div class="legend">' + table.replace('style="', 'style="position:absolute;' + pos +';') + '</div>').appendTo(placeholder);  
if (options.legend.backgroundOpacity != 0.0) {  
// put in the transparent background  
// separately to avoid blended labels and  
// label boxes  
var c = options.legend.backgroundColor;  
if (c == null) {  
c = options.grid.backgroundColor;  
if (c && typeof c == "string")  
c = $.color.parse(c);  
else  
c = $.color.extract(legend, 'background-color');  
c.a = 1;  
c = c.toString();  
}  
var div = legend.children();  
$('<div style="position:absolute;width:' + div.width() + 'px;height:' + div.height() + 'px;' + pos +'background-color:' + c + ';"> </div>').prependTo(legend).css('opacity', options.legend.backgroundOpacity);  
}  
}  
}  
 
 
// interactive features  
 
var highlights = [],  
redrawTimeout = null;  
 
// returns the data item the mouse is over, or null if none is found  
function findNearbyItem(mouseX, mouseY, seriesFilter) {  
var maxDistance = options.grid.mouseActiveRadius,  
smallestDistance = maxDistance * maxDistance + 1,  
item = null, foundPoint = false, i, j;  
 
for (i = series.length - 1; i >= 0; --i) {  
if (!seriesFilter(series[i]))  
continue;  
 
var s = series[i],  
axisx = s.xaxis,  
axisy = s.yaxis,  
points = s.datapoints.points,  
ps = s.datapoints.pointsize,  
mx = axisx.c2p(mouseX), // precompute some stuff to make the loop faster  
my = axisy.c2p(mouseY),  
maxx = maxDistance / axisx.scale,  
maxy = maxDistance / axisy.scale;  
 
// with inverse transforms, we can't use the maxx/maxy  
// optimization, sadly  
if (axisx.options.inverseTransform)  
maxx = Number.MAX_VALUE;  
if (axisy.options.inverseTransform)  
maxy = Number.MAX_VALUE;  
 
if (s.lines.show || s.points.show) {  
for (j = 0; j < points.length; j += ps) {  
var x = points[j], y = points[j + 1];  
if (x == null)  
continue;  
 
// For points and lines, the cursor must be within a  
// certain distance to the data point  
if (x - mx > maxx || x - mx < -maxx ||  
y - my > maxy || y - my < -maxy)  
continue;  
 
// We have to calculate distances in pixels, not in  
// data units, because the scales of the axes may be different  
var dx = Math.abs(axisx.p2c(x) - mouseX),  
dy = Math.abs(axisy.p2c(y) - mouseY),  
dist = dx * dx + dy * dy; // we save the sqrt  
 
// use <= to ensure last point takes precedence  
// (last generally means on top of)  
if (dist < smallestDistance) {  
smallestDistance = dist;  
item = [i, j / ps];  
}  
}  
}  
 
if (s.bars.show && !item) { // no other point can be nearby  
var barLeft = s.bars.align == "left" ? 0 : -s.bars.barWidth/2,  
barRight = barLeft + s.bars.barWidth;  
 
for (j = 0; j < points.length; j += ps) {  
var x = points[j], y = points[j + 1], b = points[j + 2];  
if (x == null)  
continue;  
 
// for a bar graph, the cursor must be inside the bar  
if (series[i].bars.horizontal ?  
(mx <= Math.max(b, x) && mx >= Math.min(b, x) &&  
my >= y + barLeft && my <= y + barRight) :  
(mx >= x + barLeft && mx <= x + barRight &&  
my >= Math.min(b, y) && my <= Math.max(b, y)))  
item = [i, j / ps];  
}  
}  
}  
 
if (item) {  
i = item[0];  
j = item[1];  
ps = series[i].datapoints.pointsize;  
 
return { datapoint: series[i].datapoints.points.slice(j * ps, (j + 1) * ps),  
dataIndex: j,  
series: series[i],  
seriesIndex: i };  
}  
 
return null;  
}  
 
function onMouseMove(e) {  
if (options.grid.hoverable)  
triggerClickHoverEvent("plothover", e,  
function (s) { return s["hoverable"] != false; });  
}  
 
function onMouseLeave(e) {  
if (options.grid.hoverable)  
triggerClickHoverEvent("plothover", e,  
function (s) { return false; });  
}  
 
function onClick(e) {  
triggerClickHoverEvent("plotclick", e,  
function (s) { return s["clickable"] != false; });  
}  
 
// trigger click or hover event (they send the same parameters  
// so we share their code)  
function triggerClickHoverEvent(eventname, event, seriesFilter) {  
var offset = eventHolder.offset(),  
canvasX = event.pageX - offset.left - plotOffset.left,  
canvasY = event.pageY - offset.top - plotOffset.top,  
pos = canvasToAxisCoords({ left: canvasX, top: canvasY });  
 
pos.pageX = event.pageX;  
pos.pageY = event.pageY;  
 
var item = findNearbyItem(canvasX, canvasY, seriesFilter);  
 
if (item) {  
// fill in mouse pos for any listeners out there  
item.pageX = parseInt(item.series.xaxis.p2c(item.datapoint[0]) + offset.left + plotOffset.left);  
item.pageY = parseInt(item.series.yaxis.p2c(item.datapoint[1]) + offset.top + plotOffset.top);  
}  
 
if (options.grid.autoHighlight) {  
// clear auto-highlights  
for (var i = 0; i < highlights.length; ++i) {  
var h = highlights[i];  
if (h.auto == eventname &&  
!(item && h.series == item.series &&  
h.point[0] == item.datapoint[0] &&  
h.point[1] == item.datapoint[1]))  
unhighlight(h.series, h.point);  
}  
 
if (item)  
highlight(item.series, item.datapoint, eventname);  
}  
 
placeholder.trigger(eventname, [ pos, item ]);  
}  
 
function triggerRedrawOverlay() {  
if (!redrawTimeout)  
redrawTimeout = setTimeout(drawOverlay, 30);  
}  
 
function drawOverlay() {  
redrawTimeout = null;  
 
// draw highlights  
octx.save();  
octx.clearRect(0, 0, canvasWidth, canvasHeight);  
octx.translate(plotOffset.left, plotOffset.top);  
 
var i, hi;  
for (i = 0; i < highlights.length; ++i) {  
hi = highlights[i];  
 
if (hi.series.bars.show)  
drawBarHighlight(hi.series, hi.point);  
else  
drawPointHighlight(hi.series, hi.point);  
}  
octx.restore();  
 
executeHooks(hooks.drawOverlay, [octx]);  
}  
 
function highlight(s, point, auto) {  
if (typeof s == "number")  
s = series[s];  
 
if (typeof point == "number") {  
var ps = s.datapoints.pointsize;  
point = s.datapoints.points.slice(ps * point, ps * (point + 1));  
}  
 
var i = indexOfHighlight(s, point);  
if (i == -1) {  
highlights.push({ series: s, point: point, auto: auto });  
 
triggerRedrawOverlay();  
}  
else if (!auto)  
highlights[i].auto = false;  
}  
 
function unhighlight(s, point) {  
if (s == null && point == null) {  
highlights = [];  
triggerRedrawOverlay();  
}  
 
if (typeof s == "number")  
s = series[s];  
 
if (typeof point == "number")  
point = s.data[point];  
 
var i = indexOfHighlight(s, point);  
if (i != -1) {  
highlights.splice(i, 1);  
 
triggerRedrawOverlay();  
}  
}  
 
function indexOfHighlight(s, p) {  
for (var i = 0; i < highlights.length; ++i) {  
var h = highlights[i];  
if (h.series == s && h.point[0] == p[0]  
&& h.point[1] == p[1])  
return i;  
}  
return -1;  
}  
 
function drawPointHighlight(series, point) {  
var x = point[0], y = point[1],  
axisx = series.xaxis, axisy = series.yaxis;  
 
if (x < axisx.min || x > axisx.max || y < axisy.min || y > axisy.max)  
return;  
 
var pointRadius = series.points.radius + series.points.lineWidth / 2;  
octx.lineWidth = pointRadius;  
octx.strokeStyle = $.color.parse(series.color).scale('a', 0.5).toString();  
var radius = 1.5 * pointRadius,  
x = axisx.p2c(x),  
y = axisy.p2c(y);  
 
octx.beginPath();  
if (series.points.symbol == "circle")  
octx.arc(x, y, radius, 0, 2 * Math.PI, false);  
else  
series.points.symbol(octx, x, y, radius, false);  
octx.closePath();  
octx.stroke();  
}  
 
function drawBarHighlight(series, point) {  
octx.lineWidth = series.bars.lineWidth;  
octx.strokeStyle = $.color.parse(series.color).scale('a', 0.5).toString();  
var fillStyle = $.color.parse(series.color).scale('a', 0.5).toString();  
var barLeft = series.bars.align == "left" ? 0 : -series.bars.barWidth/2;  
drawBar(point[0], point[1], point[2] || 0, barLeft, barLeft + series.bars.barWidth,  
0, function () { return fillStyle; }, series.xaxis, series.yaxis, octx, series.bars.horizontal, series.bars.lineWidth);  
}  
 
function getColorOrGradient(spec, bottom, top, defaultColor) {  
if (typeof spec == "string")  
return spec;  
else {  
// assume this is a gradient spec; IE currently only  
// supports a simple vertical gradient properly, so that's  
// what we support too  
var gradient = ctx.createLinearGradient(0, top, 0, bottom);  
 
for (var i = 0, l = spec.colors.length; i < l; ++i) {  
var c = spec.colors[i];  
if (typeof c != "string") {  
var co = $.color.parse(defaultColor);  
if (c.brightness != null)  
co = co.scale('rgb', c.brightness)  
if (c.opacity != null)  
co.a *= c.opacity;  
c = co.toString();  
}  
gradient.addColorStop(i / (l - 1), c);  
}  
 
return gradient;  
}  
}  
}  
 
$.plot = function(placeholder, data, options) {  
//var t0 = new Date();  
var plot = new Plot($(placeholder), data, options, $.plot.plugins);  
//(window.console ? console.log : alert)("time used (msecs): " + ((new Date()).getTime() - t0.getTime()));  
return plot;  
};  
 
$.plot.version = "0.7";  
 
$.plot.plugins = [];  
 
// returns a string with the date d formatted according to fmt  
$.plot.formatDate = function(d, fmt, monthNames) {  
var leftPad = function(n) {  
n = "" + n;  
return n.length == 1 ? "0" + n : n;  
};  
 
var r = [];  
var escape = false, padNext = false;  
var hours = d.getUTCHours();  
var isAM = hours < 12;  
if (monthNames == null)  
monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];  
 
if (fmt.search(/%p|%P/) != -1) {  
if (hours > 12) {  
hours = hours - 12;  
} else if (hours == 0) {  
hours = 12;  
}  
}  
for (var i = 0; i < fmt.length; ++i) {  
var c = fmt.charAt(i);  
 
if (escape) {  
switch (c) {  
case 'h': c = "" + hours; break;  
case 'H': c = leftPad(hours); break;  
case 'M': c = leftPad(d.getUTCMinutes()); break;  
case 'S': c = leftPad(d.getUTCSeconds()); break;  
case 'd': c = "" + d.getUTCDate(); break;  
case 'm': c = "" + (d.getUTCMonth() + 1); break;  
case 'y': c = "" + d.getUTCFullYear(); break;  
case 'b': c = "" + monthNames[d.getUTCMonth()]; break;  
case 'p': c = (isAM) ? ("" + "am") : ("" + "pm"); break;  
case 'P': c = (isAM) ? ("" + "AM") : ("" + "PM"); break;  
case '0': c = ""; padNext = true; break;  
}  
if (c && padNext) {  
c = leftPad(c);  
padNext = false;  
}  
r.push(c);  
if (!padNext)  
escape = false;  
}  
else {  
if (c == "%")  
escape = true;  
else  
r.push(c);  
}  
}  
return r.join("");  
};  
 
// round to nearby lower multiple of base  
function floorInBase(n, base) {  
return base * Math.floor(n / base);  
}  
 
})(jQuery);  
 
/* Javascript plotting library for jQuery, v. 0.7.  
*  
* Released under the MIT license by IOLA, December 2007.  
*  
*/  
(function(b){b.color={};b.color.make=function(d,e,g,f){var c={};c.r=d||0;c.g=e||0;c.b=g||0;c.a=f!=null?f:1;c.add=function(h,j){for(var k=0;k<h.length;++k){c[h.charAt(k)]+=j}return c.normalize()};c.scale=function(h,j){for(var k=0;k<h.length;++k){c[h.charAt(k)]*=j}return c.normalize()};c.toString=function(){if(c.a>=1){return"rgb("+[c.r,c.g,c.b].join(",")+")"}else{return"rgba("+[c.r,c.g,c.b,c.a].join(",")+")"}};c.normalize=function(){function h(k,j,l){return j<k?k:(j>l?l:j)}c.r=h(0,parseInt(c.r),255);c.g=h(0,parseInt(c.g),255);c.b=h(0,parseInt(c.b),255);c.a=h(0,c.a,1);return c};c.clone=function(){return b.color.make(c.r,c.b,c.g,c.a)};return c.normalize()};b.color.extract=function(d,e){var c;do{c=d.css(e).toLowerCase();if(c!=""&&c!="transparent"){break}d=d.parent()}while(!b.nodeName(d.get(0),"body"));if(c=="rgba(0, 0, 0, 0)"){c="transparent"}return b.color.parse(c)};b.color.parse=function(c){var d,f=b.color.make;if(d=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c)){return f(parseInt(d[1],10),parseInt(d[2],10),parseInt(d[3],10))}if(d=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(c)){return f(parseInt(d[1],10),parseInt(d[2],10),parseInt(d[3],10),parseFloat(d[4]))}if(d=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c)){return f(parseFloat(d[1])*2.55,parseFloat(d[2])*2.55,parseFloat(d[3])*2.55)}if(d=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(c)){return f(parseFloat(d[1])*2.55,parseFloat(d[2])*2.55,parseFloat(d[3])*2.55,parseFloat(d[4]))}if(d=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c)){return f(parseInt(d[1],16),parseInt(d[2],16),parseInt(d[3],16))}if(d=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c)){return f(parseInt(d[1]+d[1],16),parseInt(d[2]+d[2],16),parseInt(d[3]+d[3],16))}var e=b.trim(c).toLowerCase();if(e=="transparent"){return f(255,255,255,0)}else{d=a[e]||[0,0,0];return f(d[0],d[1],d[2])}};var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);(function(c){function b(av,ai,J,af){var Q=[],O={colors:["#edc240","#afd8f8","#cb4b4b","#4da74d","#9440ed"],legend:{show:true,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:0.85},xaxis:{show:null,position:"bottom",mode:null,color:null,tickColor:null,transform:null,inverseTransform:null,min:null,max:null,autoscaleMargin:null,ticks:null,tickFormatter:null,labelWidth:null,labelHeight:null,reserveSpace:null,tickLength:null,alignTicksWithAxis:null,tickDecimals:null,tickSize:null,minTickSize:null,monthNames:null,timeformat:null,twelveHourClock:false},yaxis:{autoscaleMargin:0.02,position:"left"},xaxes:[],yaxes:[],series:{points:{show:false,radius:3,lineWidth:2,fill:true,fillColor:"#ffffff",symbol:"circle"},lines:{lineWidth:2,fill:false,fillColor:null,steps:false},bars:{show:false,lineWidth:2,barWidth:1,fill:true,fillColor:null,align:"left",horizontal:false},shadowSize:3},grid:{show:true,aboveData:false,color:"#545454",backgroundColor:null,borderColor:null,tickColor:null,labelMargin:5,axisMargin:8,borderWidth:2,minBorderMargin:null,markings:null,markingsColor:"#f4f4f4",markingsLineWidth:2,clickable:false,hoverable:false,autoHighlight:true,mouseActiveRadius:10},hooks:{}},az=null,ad=null,y=null,H=null,A=null,p=[],aw=[],q={left:0,right:0,top:0,bottom:0},G=0,I=0,h=0,w=0,ak={processOptions:[],processRawData:[],processDatapoints:[],drawSeries:[],draw:[],bindEvents:[],drawOverlay:[],shutdown:[]},aq=this;aq.setData=aj;aq.setupGrid=t;aq.draw=W;aq.getPlaceholder=function(){return av};aq.getCanvas=function(){return az};aq.getPlotOffset=function(){return q};aq.width=function(){return h};aq.height=function(){return w};aq.offset=function(){var aB=y.offset();aB.left+=q.left;aB.top+=q.top;return aB};aq.getData=function(){return Q};aq.getAxes=function(){var aC={},aB;c.each(p.concat(aw),function(aD,aE){if(aE){aC[aE.direction+(aE.n!=1?aE.n:"")+"axis"]=aE}});return aC};aq.getXAxes=function(){return p};aq.getYAxes=function(){return aw};aq.c2p=C;aq.p2c=ar;aq.getOptions=function(){return O};aq.highlight=x;aq.unhighlight=T;aq.triggerRedrawOverlay=f;aq.pointOffset=function(aB){return{left:parseInt(p[aA(aB,"x")-1].p2c(+aB.x)+q.left),top:parseInt(aw[aA(aB,"y")-1].p2c(+aB.y)+q.top)}};aq.shutdown=ag;aq.resize=function(){B();g(az);g(ad)};aq.hooks=ak;F(aq);Z(J);X();aj(ai);t();W();ah();function an(aD,aB){aB=[aq].concat(aB);for(var aC=0;aC<aD.length;++aC){aD[aC].apply(this,aB)}}function F(){for(var aB=0;aB<af.length;++aB){var aC=af[aB];aC.init(aq);if(aC.options){c.extend(true,O,aC.options)}}}function Z(aC){var aB;c.extend(true,O,aC);if(O.xaxis.color==null){O.xaxis.color=O.grid.color}if(O.yaxis.color==null){O.yaxis.color=O.grid.color}if(O.xaxis.tickColor==null){O.xaxis.tickColor=O.grid.tickColor}if(O.yaxis.tickColor==null){O.yaxis.tickColor=O.grid.tickColor}if(O.grid.borderColor==null){O.grid.borderColor=O.grid.color}if(O.grid.tickColor==null){O.grid.tickColor=c.color.parse(O.grid.color).scale("a",0.22).toString()}for(aB=0;aB<Math.max(1,O.xaxes.length);++aB){O.xaxes[aB]=c.extend(true,{},O.xaxis,O.xaxes[aB])}for(aB=0;aB<Math.max(1,O.yaxes.length);++aB){O.yaxes[aB]=c.extend(true,{},O.yaxis,O.yaxes[aB])}if(O.xaxis.noTicks&&O.xaxis.ticks==null){O.xaxis.ticks=O.xaxis.noTicks}if(O.yaxis.noTicks&&O.yaxis.ticks==null){O.yaxis.ticks=O.yaxis.noTicks}if(O.x2axis){O.xaxes[1]=c.extend(true,{},O.xaxis,O.x2axis);O.xaxes[1].position="top"}if(O.y2axis){O.yaxes[1]=c.extend(true,{},O.yaxis,O.y2axis);O.yaxes[1].position="right"}if(O.grid.coloredAreas){O.grid.markings=O.grid.coloredAreas}if(O.grid.coloredAreasColor){O.grid.markingsColor=O.grid.coloredAreasColor}if(O.lines){c.extend(true,O.series.lines,O.lines)}if(O.points){c.extend(true,O.series.points,O.points)}if(O.bars){c.extend(true,O.series.bars,O.bars)}if(O.shadowSize!=null){O.series.shadowSize=O.shadowSize}for(aB=0;aB<O.xaxes.length;++aB){V(p,aB+1).options=O.xaxes[aB]}for(aB=0;aB<O.yaxes.length;++aB){V(aw,aB+1).options=O.yaxes[aB]}for(var aD in ak){if(O.hooks[aD]&&O.hooks[aD].length){ak[aD]=ak[aD].concat(O.hooks[aD])}}an(ak.processOptions,[O])}function aj(aB){Q=Y(aB);ax();z()}function Y(aE){var aC=[];for(var aB=0;aB<aE.length;++aB){var aD=c.extend(true,{},O.series);if(aE[aB].data!=null){aD.data=aE[aB].data;delete aE[aB].data;c.extend(true,aD,aE[aB]);aE[aB].data=aD.data}else{aD.data=aE[aB]}aC.push(aD)}return aC}function aA(aC,aD){var aB=aC[aD+"axis"];if(typeof aB=="object"){aB=aB.n}if(typeof aB!="number"){aB=1}return aB}function m(){return c.grep(p.concat(aw),function(aB){return aB})}function C(aE){var aC={},aB,aD;for(aB=0;aB<p.length;++aB){aD=p[aB];if(aD&&aD.used){aC["x"+aD.n]=aD.c2p(aE.left)}}for(aB=0;aB<aw.length;++aB){aD=aw[aB];if(aD&&aD.used){aC["y"+aD.n]=aD.c2p(aE.top)}}if(aC.x1!==undefined){aC.x=aC.x1}if(aC.y1!==undefined){aC.y=aC.y1}return aC}function ar(aF){var aD={},aC,aE,aB;for(aC=0;aC<p.length;++aC){aE=p[aC];if(aE&&aE.used){aB="x"+aE.n;if(aF[aB]==null&&aE.n==1){aB="x"}if(aF[aB]!=null){aD.left=aE.p2c(aF[aB]);break}}}for(aC=0;aC<aw.length;++aC){aE=aw[aC];if(aE&&aE.used){aB="y"+aE.n;if(aF[aB]==null&&aE.n==1){aB="y"}if(aF[aB]!=null){aD.top=aE.p2c(aF[aB]);break}}}return aD}function V(aC,aB){if(!aC[aB-1]){aC[aB-1]={n:aB,direction:aC==p?"x":"y",options:c.extend(true,{},aC==p?O.xaxis:O.yaxis)}}return aC[aB-1]}function ax(){var aG;var aM=Q.length,aB=[],aE=[];for(aG=0;aG<Q.length;++aG){var aJ=Q[aG].color;if(aJ!=null){--aM;if(typeof aJ=="number"){aE.push(aJ)}else{aB.push(c.color.parse(Q[aG].color))}}}for(aG=0;aG<aE.length;++aG){aM=Math.max(aM,aE[aG]+1)}var aC=[],aF=0;aG=0;while(aC.length<aM){var aI;if(O.colors.length==aG){aI=c.color.make(100,100,100)}else{aI=c.color.parse(O.colors[aG])}var aD=aF%2==1?-1:1;aI.scale("rgb",1+aD*Math.ceil(aF/2)*0.2);aC.push(aI);++aG;if(aG>=O.colors.length){aG=0;++aF}}var aH=0,aN;for(aG=0;aG<Q.length;++aG){aN=Q[aG];if(aN.color==null){aN.color=aC[aH].toString();++aH}else{if(typeof aN.color=="number"){aN.color=aC[aN.color].toString()}}if(aN.lines.show==null){var aL,aK=true;for(aL in aN){if(aN[aL]&&aN[aL].show){aK=false;break}}if(aK){aN.lines.show=true}}aN.xaxis=V(p,aA(aN,"x"));aN.yaxis=V(aw,aA(aN,"y"))}}function z(){var aO=Number.POSITIVE_INFINITY,aI=Number.NEGATIVE_INFINITY,aB=Number.MAX_VALUE,aU,aS,aR,aN,aD,aJ,aT,aP,aH,aG,aC,a0,aX,aL;function aF(a3,a2,a1){if(a2<a3.datamin&&a2!=-aB){a3.datamin=a2}if(a1>a3.datamax&&a1!=aB){a3.datamax=a1}}c.each(m(),function(a1,a2){a2.datamin=aO;a2.datamax=aI;a2.used=false});for(aU=0;aU<Q.length;++aU){aJ=Q[aU];aJ.datapoints={points:[]};an(ak.processRawData,[aJ,aJ.data,aJ.datapoints])}for(aU=0;aU<Q.length;++aU){aJ=Q[aU];var aZ=aJ.data,aW=aJ.datapoints.format;if(!aW){aW=[];aW.push({x:true,number:true,required:true});aW.push({y:true,number:true,required:true});if(aJ.bars.show||(aJ.lines.show&&aJ.lines.fill)){aW.push({y:true,number:true,required:false,defaultValue:0});if(aJ.bars.horizontal){delete aW[aW.length-1].y;aW[aW.length-1].x=true}}aJ.datapoints.format=aW}if(aJ.datapoints.pointsize!=null){continue}aJ.datapoints.pointsize=aW.length;aP=aJ.datapoints.pointsize;aT=aJ.datapoints.points;insertSteps=aJ.lines.show&&aJ.lines.steps;aJ.xaxis.used=aJ.yaxis.used=true;for(aS=aR=0;aS<aZ.length;++aS,aR+=aP){aL=aZ[aS];var aE=aL==null;if(!aE){for(aN=0;aN<aP;++aN){a0=aL[aN];aX=aW[aN];if(aX){if(aX.number&&a0!=null){a0=+a0;if(isNaN(a0)){a0=null}else{if(a0==Infinity){a0=aB}else{if(a0==-Infinity){a0=-aB}}}}if(a0==null){if(aX.required){aE=true}if(aX.defaultValue!=null){a0=aX.defaultValue}}}aT[aR+aN]=a0}}if(aE){for(aN=0;aN<aP;++aN){a0=aT[aR+aN];if(a0!=null){aX=aW[aN];if(aX.x){aF(aJ.xaxis,a0,a0)}if(aX.y){aF(aJ.yaxis,a0,a0)}}aT[aR+aN]=null}}else{if(insertSteps&&aR>0&&aT[aR-aP]!=null&&aT[aR-aP]!=aT[aR]&&aT[aR-aP+1]!=aT[aR+1]){for(aN=0;aN<aP;++aN){aT[aR+aP+aN]=aT[aR+aN]}aT[aR+1]=aT[aR-aP+1];aR+=aP}}}}for(aU=0;aU<Q.length;++aU){aJ=Q[aU];an(ak.processDatapoints,[aJ,aJ.datapoints])}for(aU=0;aU<Q.length;++aU){aJ=Q[aU];aT=aJ.datapoints.points,aP=aJ.datapoints.pointsize;var aK=aO,aQ=aO,aM=aI,aV=aI;for(aS=0;aS<aT.length;aS+=aP){if(aT[aS]==null){continue}for(aN=0;aN<aP;++aN){a0=aT[aS+aN];aX=aW[aN];if(!aX||a0==aB||a0==-aB){continue}if(aX.x){if(a0<aK){aK=a0}if(a0>aM){aM=a0}}if(aX.y){if(a0<aQ){aQ=a0}if(a0>aV){aV=a0}}}}if(aJ.bars.show){var aY=aJ.bars.align=="left"?0:-aJ.bars.barWidth/2;if(aJ.bars.horizontal){aQ+=aY;aV+=aY+aJ.bars.barWidth}else{aK+=aY;aM+=aY+aJ.bars.barWidth}}aF(aJ.xaxis,aK,aM);aF(aJ.yaxis,aQ,aV)}c.each(m(),function(a1,a2){if(a2.datamin==aO){a2.datamin=null}if(a2.datamax==aI){a2.datamax=null}})}function j(aB,aC){var aD=document.createElement("canvas");aD.className=aC;aD.width=G;aD.height=I;if(!aB){c(aD).css({position:"absolute",left:0,top:0})}c(aD).appendTo(av);if(!aD.getContext){aD=window.G_vmlCanvasManager.initElement(aD)}aD.getContext("2d").save();return aD}function B(){G=av.width();I=av.height();if(G<=0||I<=0){throw"Invalid dimensions for plot, width = "+G+", height = "+I}}function g(aC){if(aC.width!=G){aC.width=G}if(aC.height!=I){aC.height=I}var aB=aC.getContext("2d");aB.restore();aB.save()}function X(){var aC,aB=av.children("canvas.base"),aD=av.children("canvas.overlay");if(aB.length==0||aD==0){av.html("");av.css({padding:0});if(av.css("position")=="static"){av.css("position","relative")}B();az=j(true,"base");ad=j(false,"overlay");aC=false}else{az=aB.get(0);ad=aD.get(0);aC=true}H=az.getContext("2d");A=ad.getContext("2d");y=c([ad,az]);if(aC){av.data("plot").shutdown();aq.resize();A.clearRect(0,0,G,I);y.unbind();av.children().not([az,ad]).remove()}av.data("plot",aq)}function ah(){if(O.grid.hoverable){y.mousemove(aa);y.mouseleave(l)}if(O.grid.clickable){y.click(R)}an(ak.bindEvents,[y])}function ag(){if(M){clearTimeout(M)}y.unbind("mousemove",aa);y.unbind("mouseleave",l);y.unbind("click",R);an(ak.shutdown,[y])}function r(aG){function aC(aH){return aH}var aF,aB,aD=aG.options.transform||aC,aE=aG.options.inverseTransform;if(aG.direction=="x"){aF=aG.scale=h/Math.abs(aD(aG.max)-aD(aG.min));aB=Math.min(aD(aG.max),aD(aG.min))}else{aF=aG.scale=w/Math.abs(aD(aG.max)-aD(aG.min));aF=-aF;aB=Math.max(aD(aG.max),aD(aG.min))}if(aD==aC){aG.p2c=function(aH){return(aH-aB)*aF}}else{aG.p2c=function(aH){return(aD(aH)-aB)*aF}}if(!aE){aG.c2p=function(aH){return aB+aH/aF}}else{aG.c2p=function(aH){return aE(aB+aH/aF)}}}function L(aD){var aB=aD.options,aF,aJ=aD.ticks||[],aI=[],aE,aK=aB.labelWidth,aG=aB.labelHeight,aC;function aH(aM,aL){return c('<div style="position:absolute;top:-10000px;'+aL+'font-size:smaller"><div class="'+aD.direction+"Axis "+aD.direction+aD.n+'Axis">'+aM.join("")+"</div></div>").appendTo(av)}if(aD.direction=="x"){if(aK==null){aK=Math.floor(G/(aJ.length>0?aJ.length:1))}if(aG==null){aI=[];for(aF=0;aF<aJ.length;++aF){aE=aJ[aF].label;if(aE){aI.push('<div class="tickLabel" style="float:left;width:'+aK+'px">'+aE+"</div>")}}if(aI.length>0){aI.push('<div style="clear:left"></div>');aC=aH(aI,"width:10000px;");aG=aC.height();aC.remove()}}}else{if(aK==null||aG==null){for(aF=0;aF<aJ.length;++aF){aE=aJ[aF].label;if(aE){aI.push('<div class="tickLabel">'+aE+"</div>")}}if(aI.length>0){aC=aH(aI,"");if(aK==null){aK=aC.children().width()}if(aG==null){aG=aC.find("div.tickLabel").height()}aC.remove()}}}if(aK==null){aK=0}if(aG==null){aG=0}aD.labelWidth=aK;aD.labelHeight=aG}function au(aD){var aC=aD.labelWidth,aL=aD.labelHeight,aH=aD.options.position,aF=aD.options.tickLength,aG=O.grid.axisMargin,aJ=O.grid.labelMargin,aK=aD.direction=="x"?p:aw,aE;var aB=c.grep(aK,function(aN){return aN&&aN.options.position==aH&&aN.reserveSpace});if(c.inArray(aD,aB)==aB.length-1){aG=0}if(aF==null){aF="full"}var aI=c.grep(aK,function(aN){return aN&&aN.reserveSpace});var aM=c.inArray(aD,aI)==0;if(!aM&&aF=="full"){aF=5}if(!isNaN(+aF)){aJ+=+aF}if(aD.direction=="x"){aL+=aJ;if(aH=="bottom"){q.bottom+=aL+aG;aD.box={top:I-q.bottom,height:aL}}else{aD.box={top:q.top+aG,height:aL};q.top+=aL+aG}}else{aC+=aJ;if(aH=="left"){aD.box={left:q.left+aG,width:aC};q.left+=aC+aG}else{q.right+=aC+aG;aD.box={left:G-q.right,width:aC}}}aD.position=aH;aD.tickLength=aF;aD.box.padding=aJ;aD.innermost=aM}function U(aB){if(aB.direction=="x"){aB.box.left=q.left;aB.box.width=h}else{aB.box.top=q.top;aB.box.height=w}}function t(){var aC,aE=m();c.each(aE,function(aF,aG){aG.show=aG.options.show;if(aG.show==null){aG.show=aG.used}aG.reserveSpace=aG.show||aG.options.reserveSpace;n(aG)});allocatedAxes=c.grep(aE,function(aF){return aF.reserveSpace});q.left=q.right=q.top=q.bottom=0;if(O.grid.show){c.each(allocatedAxes,function(aF,aG){S(aG);P(aG);ap(aG,aG.ticks);L(aG)});for(aC=allocatedAxes.length-1;aC>=0;--aC){au(allocatedAxes[aC])}var aD=O.grid.minBorderMargin;if(aD==null){aD=0;for(aC=0;aC<Q.length;++aC){aD=Math.max(aD,Q[aC].points.radius+Q[aC].points.lineWidth/2)}}for(var aB in q){q[aB]+=O.grid.borderWidth;q[aB]=Math.max(aD,q[aB])}}h=G-q.left-q.right;w=I-q.bottom-q.top;c.each(aE,function(aF,aG){r(aG)});if(O.grid.show){c.each(allocatedAxes,function(aF,aG){U(aG)});k()}o()}function n(aE){var aF=aE.options,aD=+(aF.min!=null?aF.min:aE.datamin),aB=+(aF.max!=null?aF.max:aE.datamax),aH=aB-aD;if(aH==0){var aC=aB==0?1:0.01;if(aF.min==null){aD-=aC}if(aF.max==null||aF.min!=null){aB+=aC}}else{var aG=aF.autoscaleMargin;if(aG!=null){if(aF.min==null){aD-=aH*aG;if(aD<0&&aE.datamin!=null&&aE.datamin>=0){aD=0}}if(aF.max==null){aB+=aH*aG;if(aB>0&&aE.datamax!=null&&aE.datamax<=0){aB=0}}}}aE.min=aD;aE.max=aB}function S(aG){var aM=aG.options;var aH;if(typeof aM.ticks=="number"&&aM.ticks>0){aH=aM.ticks}else{aH=0.3*Math.sqrt(aG.direction=="x"?G:I)}var aT=(aG.max-aG.min)/aH,aO,aB,aN,aR,aS,aQ,aI;if(aM.mode=="time"){var aJ={second:1000,minute:60*1000,hour:60*60*1000,day:24*60*60*1000,month:30*24*60*60*1000,year:365.2425*24*60*60*1000};var aK=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[0.25,"month"],[0.5,"month"],[1,"month"],[2,"month"],[3,"month"],[6,"month"],[1,"year"]];var aC=0;if(aM.minTickSize!=null){if(typeof aM.tickSize=="number"){aC=aM.tickSize}else{aC=aM.minTickSize[0]*aJ[aM.minTickSize[1]]}}for(var aS=0;aS<aK.length-1;++aS){if(aT<(aK[aS][0]*aJ[aK[aS][1]]+aK[aS+1][0]*aJ[aK[aS+1][1]])/2&&aK[aS][0]*aJ[aK[aS][1]]>=aC){break}}aO=aK[aS][0];aN=aK[aS][1];if(aN=="year"){aQ=Math.pow(10,Math.floor(Math.log(aT/aJ.year)/Math.LN10));aI=(aT/aJ.year)/aQ;if(aI<1.5){aO=1}else{if(aI<3){aO=2}else{if(aI<7.5){aO=5}else{aO=10}}}aO*=aQ}aG.tickSize=aM.tickSize||[aO,aN];aB=function(aX){var a2=[],a0=aX.tickSize[0],a3=aX.tickSize[1],a1=new Date(aX.min);var aW=a0*aJ[a3];if(a3=="second"){a1.setUTCSeconds(a(a1.getUTCSeconds(),a0))}if(a3=="minute"){a1.setUTCMinutes(a(a1.getUTCMinutes(),a0))}if(a3=="hour"){a1.setUTCHours(a(a1.getUTCHours(),a0))}if(a3=="month"){a1.setUTCMonth(a(a1.getUTCMonth(),a0))}if(a3=="year"){a1.setUTCFullYear(a(a1.getUTCFullYear(),a0))}a1.setUTCMilliseconds(0);if(aW>=aJ.minute){a1.setUTCSeconds(0)}if(aW>=aJ.hour){a1.setUTCMinutes(0)}if(aW>=aJ.day){a1.setUTCHours(0)}if(aW>=aJ.day*4){a1.setUTCDate(1)}if(aW>=aJ.year){a1.setUTCMonth(0)}var a5=0,a4=Number.NaN,aY;do{aY=a4;a4=a1.getTime();a2.push(a4);if(a3=="month"){if(a0<1){a1.setUTCDate(1);var aV=a1.getTime();a1.setUTCMonth(a1.getUTCMonth()+1);var aZ=a1.getTime();a1.setTime(a4+a5*aJ.hour+(aZ-aV)*a0);a5=a1.getUTCHours();a1.setUTCHours(0)}else{a1.setUTCMonth(a1.getUTCMonth()+a0)}}else{if(a3=="year"){a1.setUTCFullYear(a1.getUTCFullYear()+a0)}else{a1.setTime(a4+aW)}}}while(a4<aX.max&&a4!=aY);return a2};aR=function(aV,aY){var a0=new Date(aV);if(aM.timeformat!=null){return c.plot.formatDate(a0,aM.timeformat,aM.monthNames)}var aW=aY.tickSize[0]*aJ[aY.tickSize[1]];var aX=aY.max-aY.min;var aZ=(aM.twelveHourClock)?" %p":"";if(aW<aJ.minute){fmt="%h:%M:%S"+aZ}else{if(aW<aJ.day){if(aX<2*aJ.day){fmt="%h:%M"+aZ}else{fmt="%b %d %h:%M"+aZ}}else{if(aW<aJ.month){fmt="%b %d"}else{if(aW<aJ.year){if(aX<aJ.year){fmt="%b"}else{fmt="%b %y"}}else{fmt="%y"}}}}return c.plot.formatDate(a0,fmt,aM.monthNames)}}else{var aU=aM.tickDecimals;var aP=-Math.floor(Math.log(aT)/Math.LN10);if(aU!=null&&aP>aU){aP=aU}aQ=Math.pow(10,-aP);aI=aT/aQ;if(aI<1.5){aO=1}else{if(aI<3){aO=2;if(aI>2.25&&(aU==null||aP+1<=aU)){aO=2.5;++aP}}else{if(aI<7.5){aO=5}else{aO=10}}}aO*=aQ;if(aM.minTickSize!=null&&aO<aM.minTickSize){aO=aM.minTickSize}aG.tickDecimals=Math.max(0,aU!=null?aU:aP);aG.tickSize=aM.tickSize||aO;aB=function(aX){var aZ=[];var a0=a(aX.min,aX.tickSize),aW=0,aV=Number.NaN,aY;do{aY=aV;aV=a0+aW*aX.tickSize;aZ.push(aV);++aW}while(aV<aX.max&&aV!=aY);return aZ};aR=function(aV,aW){return aV.toFixed(aW.tickDecimals)}}if(aM.alignTicksWithAxis!=null){var aF=(aG.direction=="x"?p:aw)[aM.alignTicksWithAxis-1];if(aF&&aF.used&&aF!=aG){var aL=aB(aG);if(aL.length>0){if(aM.min==null){aG.min=Math.min(aG.min,aL[0])}if(aM.max==null&&aL.length>1){aG.max=Math.max(aG.max,aL[aL.length-1])}}aB=function(aX){var aY=[],aV,aW;for(aW=0;aW<aF.ticks.length;++aW){aV=(aF.ticks[aW].v-aF.min)/(aF.max-aF.min);aV=aX.min+aV*(aX.max-aX.min);aY.push(aV)}return aY};if(aG.mode!="time"&&aM.tickDecimals==null){var aE=Math.max(0,-Math.floor(Math.log(aT)/Math.LN10)+1),aD=aB(aG);if(!(aD.length>1&&/\..*0$/.test((aD[1]-aD[0]).toFixed(aE)))){aG.tickDecimals=aE}}}}aG.tickGenerator=aB;if(c.isFunction(aM.tickFormatter)){aG.tickFormatter=function(aV,aW){return""+aM.tickFormatter(aV,aW)}}else{aG.tickFormatter=aR}}function P(aF){var aH=aF.options.ticks,aG=[];if(aH==null||(typeof aH=="number"&&aH>0)){aG=aF.tickGenerator(aF)}else{if(aH){if(c.isFunction(aH)){aG=aH({min:aF.min,max:aF.max})}else{aG=aH}}}var aE,aB;aF.ticks=[];for(aE=0;aE<aG.length;++aE){var aC=null;var aD=aG[aE];if(typeof aD=="object"){aB=+aD[0];if(aD.length>1){aC=aD[1]}}else{aB=+aD}if(aC==null){aC=aF.tickFormatter(aB,aF)}if(!isNaN(aB)){aF.ticks.push({v:aB,label:aC})}}}function ap(aB,aC){if(aB.options.autoscaleMargin&&aC.length>0){if(aB.options.min==null){aB.min=Math.min(aB.min,aC[0].v)}if(aB.options.max==null&&aC.length>1){aB.max=Math.max(aB.max,aC[aC.length-1].v)}}}function W(){H.clearRect(0,0,G,I);var aC=O.grid;if(aC.show&&aC.backgroundColor){N()}if(aC.show&&!aC.aboveData){ac()}for(var aB=0;aB<Q.length;++aB){an(ak.drawSeries,[H,Q[aB]]);d(Q[aB])}an(ak.draw,[H]);if(aC.show&&aC.aboveData){ac()}}function D(aB,aI){var aE,aH,aG,aD,aF=m();for(i=0;i<aF.length;++i){aE=aF[i];if(aE.direction==aI){aD=aI+aE.n+"axis";if(!aB[aD]&&aE.n==1){aD=aI+"axis"}if(aB[aD]){aH=aB[aD].from;aG=aB[aD].to;break}}}if(!aB[aD]){aE=aI=="x"?p[0]:aw[0];aH=aB[aI+"1"];aG=aB[aI+"2"]}if(aH!=null&&aG!=null&&aH>aG){var aC=aH;aH=aG;aG=aC}return{from:aH,to:aG,axis:aE}}function N(){H.save();H.translate(q.left,q.top);H.fillStyle=am(O.grid.backgroundColor,w,0,"rgba(255, 255, 255, 0)");H.fillRect(0,0,h,w);H.restore()}function ac(){var aF;H.save();H.translate(q.left,q.top);var aH=O.grid.markings;if(aH){if(c.isFunction(aH)){var aK=aq.getAxes();aK.xmin=aK.xaxis.min;aK.xmax=aK.xaxis.max;aK.ymin=aK.yaxis.min;aK.ymax=aK.yaxis.max;aH=aH(aK)}for(aF=0;aF<aH.length;++aF){var aD=aH[aF],aC=D(aD,"x"),aI=D(aD,"y");if(aC.from==null){aC.from=aC.axis.min}if(aC.to==null){aC.to=aC.axis.max}if(aI.from==null){aI.from=aI.axis.min}if(aI.to==null){aI.to=aI.axis.max}if(aC.to<aC.axis.min||aC.from>aC.axis.max||aI.to<aI.axis.min||aI.from>aI.axis.max){continue}aC.from=Math.max(aC.from,aC.axis.min);aC.to=Math.min(aC.to,aC.axis.max);aI.from=Math.max(aI.from,aI.axis.min);aI.to=Math.min(aI.to,aI.axis.max);if(aC.from==aC.to&&aI.from==aI.to){continue}aC.from=aC.axis.p2c(aC.from);aC.to=aC.axis.p2c(aC.to);aI.from=aI.axis.p2c(aI.from);aI.to=aI.axis.p2c(aI.to);if(aC.from==aC.to||aI.from==aI.to){H.beginPath();H.strokeStyle=aD.color||O.grid.markingsColor;H.lineWidth=aD.lineWidth||O.grid.markingsLineWidth;H.moveTo(aC.from,aI.from);H.lineTo(aC.to,aI.to);H.stroke()}else{H.fillStyle=aD.color||O.grid.markingsColor;H.fillRect(aC.from,aI.to,aC.to-aC.from,aI.from-aI.to)}}}var aK=m(),aM=O.grid.borderWidth;for(var aE=0;aE<aK.length;++aE){var aB=aK[aE],aG=aB.box,aQ=aB.tickLength,aN,aL,aP,aJ;if(!aB.show||aB.ticks.length==0){continue}H.strokeStyle=aB.options.tickColor||c.color.parse(aB.options.color).scale("a",0.22).toString();H.lineWidth=1;if(aB.direction=="x"){aN=0;if(aQ=="full"){aL=(aB.position=="top"?0:w)}else{aL=aG.top-q.top+(aB.position=="top"?aG.height:0)}}else{aL=0;if(aQ=="full"){aN=(aB.position=="left"?0:h)}else{aN=aG.left-q.left+(aB.position=="left"?aG.width:0)}}if(!aB.innermost){H.beginPath();aP=aJ=0;if(aB.direction=="x"){aP=h}else{aJ=w}if(H.lineWidth==1){aN=Math.floor(aN)+0.5;aL=Math.floor(aL)+0.5}H.moveTo(aN,aL);H.lineTo(aN+aP,aL+aJ);H.stroke()}H.beginPath();for(aF=0;aF<aB.ticks.length;++aF){var aO=aB.ticks[aF].v;aP=aJ=0;if(aO<aB.min||aO>aB.max||(aQ=="full"&&aM>0&&(aO==aB.min||aO==aB.max))){continue}if(aB.direction=="x"){aN=aB.p2c(aO);aJ=aQ=="full"?-w:aQ;if(aB.position=="top"){aJ=-aJ}}else{aL=aB.p2c(aO);aP=aQ=="full"?-h:aQ;if(aB.position=="left"){aP=-aP}}if(H.lineWidth==1){if(aB.direction=="x"){aN=Math.floor(aN)+0.5}else{aL=Math.floor(aL)+0.5}}H.moveTo(aN,aL);H.lineTo(aN+aP,aL+aJ)}H.stroke()}if(aM){H.lineWidth=aM;H.strokeStyle=O.grid.borderColor;H.strokeRect(-aM/2,-aM/2,h+aM,w+aM)}H.restore()}function k(){av.find(".tickLabels").remove();var aG=['<div class="tickLabels" style="font-size:smaller">'];var aJ=m();for(var aD=0;aD<aJ.length;++aD){var aC=aJ[aD],aF=aC.box;if(!aC.show){continue}aG.push('<div class="'+aC.direction+"Axis "+aC.direction+aC.n+'Axis" style="color:'+aC.options.color+'">');for(var aE=0;aE<aC.ticks.length;++aE){var aH=aC.ticks[aE];if(!aH.label||aH.v<aC.min||aH.v>aC.max){continue}var aK={},aI;if(aC.direction=="x"){aI="center";aK.left=Math.round(q.left+aC.p2c(aH.v)-aC.labelWidth/2);if(aC.position=="bottom"){aK.top=aF.top+aF.padding}else{aK.bottom=I-(aF.top+aF.height-aF.padding)}}else{aK.top=Math.round(q.top+aC.p2c(aH.v)-aC.labelHeight/2);if(aC.position=="left"){aK.right=G-(aF.left+aF.width-aF.padding);aI="right"}else{aK.left=aF.left+aF.padding;aI="left"}}aK.width=aC.labelWidth;var aB=["position:absolute","text-align:"+aI];for(var aL in aK){aB.push(aL+":"+aK[aL]+"px")}aG.push('<div class="tickLabel" style="'+aB.join(";")+'">'+aH.label+"</div>")}aG.push("</div>")}aG.push("</div>");av.append(aG.join(""))}function d(aB){if(aB.lines.show){at(aB)}if(aB.bars.show){e(aB)}if(aB.points.show){ao(aB)}}function at(aE){function aD(aP,aQ,aI,aU,aT){var aV=aP.points,aJ=aP.pointsize,aN=null,aM=null;H.beginPath();for(var aO=aJ;aO<aV.length;aO+=aJ){var aL=aV[aO-aJ],aS=aV[aO-aJ+1],aK=aV[aO],aR=aV[aO+1];if(aL==null||aK==null){continue}if(aS<=aR&&aS<aT.min){if(aR<aT.min){continue}aL=(aT.min-aS)/(aR-aS)*(aK-aL)+aL;aS=aT.min}else{if(aR<=aS&&aR<aT.min){if(aS<aT.min){continue}aK=(aT.min-aS)/(aR-aS)*(aK-aL)+aL;aR=aT.min}}if(aS>=aR&&aS>aT.max){if(aR>aT.max){continue}aL=(aT.max-aS)/(aR-aS)*(aK-aL)+aL;aS=aT.max}else{if(aR>=aS&&aR>aT.max){if(aS>aT.max){continue}aK=(aT.max-aS)/(aR-aS)*(aK-aL)+aL;aR=aT.max}}if(aL<=aK&&aL<aU.min){if(aK<aU.min){continue}aS=(aU.min-aL)/(aK-aL)*(aR-aS)+aS;aL=aU.min}else{if(aK<=aL&&aK<aU.min){if(aL<aU.min){continue}aR=(aU.min-aL)/(aK-aL)*(aR-aS)+aS;aK=aU.min}}if(aL>=aK&&aL>aU.max){if(aK>aU.max){continue}aS=(aU.max-aL)/(aK-aL)*(aR-aS)+aS;aL=aU.max}else{if(aK>=aL&&aK>aU.max){if(aL>aU.max){continue}aR=(aU.max-aL)/(aK-aL)*(aR-aS)+aS;aK=aU.max}}if(aL!=aN||aS!=aM){H.moveTo(aU.p2c(aL)+aQ,aT.p2c(aS)+aI)}aN=aK;aM=aR;H.lineTo(aU.p2c(aK)+aQ,aT.p2c(aR)+aI)}H.stroke()}function aF(aI,aQ,aP){var aW=aI.points,aV=aI.pointsize,aN=Math.min(Math.max(0,aP.min),aP.max),aX=0,aU,aT=false,aM=1,aL=0,aR=0;while(true){if(aV>0&&aX>aW.length+aV){break}aX+=aV;var aZ=aW[aX-aV],aK=aW[aX-aV+aM],aY=aW[aX],aJ=aW[aX+aM];if(aT){if(aV>0&&aZ!=null&&aY==null){aR=aX;aV=-aV;aM=2;continue}if(aV<0&&aX==aL+aV){H.fill();aT=false;aV=-aV;aM=1;aX=aL=aR+aV;continue}}if(aZ==null||aY==null){continue}if(aZ<=aY&&aZ<aQ.min){if(aY<aQ.min){continue}aK=(aQ.min-aZ)/(aY-aZ)*(aJ-aK)+aK;aZ=aQ.min}else{if(aY<=aZ&&aY<aQ.min){if(aZ<aQ.min){continue}aJ=(aQ.min-aZ)/(aY-aZ)*(aJ-aK)+aK;aY=aQ.min}}if(aZ>=aY&&aZ>aQ.max){if(aY>aQ.max){continue}aK=(aQ.max-aZ)/(aY-aZ)*(aJ-aK)+aK;aZ=aQ.max}else{if(aY>=aZ&&aY>aQ.max){if(aZ>aQ.max){continue}aJ=(aQ.max-aZ)/(aY-aZ)*(aJ-aK)+aK;aY=aQ.max}}if(!aT){H.beginPath();H.moveTo(aQ.p2c(aZ),aP.p2c(aN));aT=true}if(aK>=aP.max&&aJ>=aP.max){H.lineTo(aQ.p2c(aZ),aP.p2c(aP.max));H.lineTo(aQ.p2c(aY),aP.p2c(aP.max));continue}else{if(aK<=aP.min&&aJ<=aP.min){H.lineTo(aQ.p2c(aZ),aP.p2c(aP.min));H.lineTo(aQ.p2c(aY),aP.p2c(aP.min));continue}}var aO=aZ,aS=aY;if(aK<=aJ&&aK<aP.min&&aJ>=aP.min){aZ=(aP.min-aK)/(aJ-aK)*(aY-aZ)+aZ;aK=aP.min}else{if(aJ<=aK&&aJ<aP.min&&aK>=aP.min){aY=(aP.min-aK)/(aJ-aK)*(aY-aZ)+aZ;aJ=aP.min}}if(aK>=aJ&&aK>aP.max&&aJ<=aP.max){aZ=(aP.max-aK)/(aJ-aK)*(aY-aZ)+aZ;aK=aP.max}else{if(aJ>=aK&&aJ>aP.max&&aK<=aP.max){aY=(aP.max-aK)/(aJ-aK)*(aY-aZ)+aZ;aJ=aP.max}}if(aZ!=aO){H.lineTo(aQ.p2c(aO),aP.p2c(aK))}H.lineTo(aQ.p2c(aZ),aP.p2c(aK));H.lineTo(aQ.p2c(aY),aP.p2c(aJ));if(aY!=aS){H.lineTo(aQ.p2c(aY),aP.p2c(aJ));H.lineTo(aQ.p2c(aS),aP.p2c(aJ))}}}H.save();H.translate(q.left,q.top);H.lineJoin="round";var aG=aE.lines.lineWidth,aB=aE.shadowSize;if(aG>0&&aB>0){H.lineWidth=aB;H.strokeStyle="rgba(0,0,0,0.1)";var aH=Math.PI/18;aD(aE.datapoints,Math.sin(aH)*(aG/2+aB/2),Math.cos(aH)*(aG/2+aB/2),aE.xaxis,aE.yaxis);H.lineWidth=aB/2;aD(aE.datapoints,Math.sin(aH)*(aG/2+aB/4),Math.cos(aH)*(aG/2+aB/4),aE.xaxis,aE.yaxis)}H.lineWidth=aG;H.strokeStyle=aE.color;var aC=ae(aE.lines,aE.color,0,w);if(aC){H.fillStyle=aC;aF(aE.datapoints,aE.xaxis,aE.yaxis)}if(aG>0){aD(aE.datapoints,0,0,aE.xaxis,aE.yaxis)}H.restore()}function ao(aE){function aH(aN,aM,aU,aK,aS,aT,aQ,aJ){var aR=aN.points,aI=aN.pointsize;for(var aL=0;aL<aR.length;aL+=aI){var aP=aR[aL],aO=aR[aL+1];if(aP==null||aP<aT.min||aP>aT.max||aO<aQ.min||aO>aQ.max){continue}H.beginPath();aP=aT.p2c(aP);aO=aQ.p2c(aO)+aK;if(aJ=="circle"){H.arc(aP,aO,aM,0,aS?Math.PI:Math.PI*2,false)}else{aJ(H,aP,aO,aM,aS)}H.closePath();if(aU){H.fillStyle=aU;H.fill()}H.stroke()}}H.save();H.translate(q.left,q.top);var aG=aE.points.lineWidth,aC=aE.shadowSize,aB=aE.points.radius,aF=aE.points.symbol;if(aG>0&&aC>0){var aD=aC/2;H.lineWidth=aD;H.strokeStyle="rgba(0,0,0,0.1)";aH(aE.datapoints,aB,null,aD+aD/2,true,aE.xaxis,aE.yaxis,aF);H.strokeStyle="rgba(0,0,0,0.2)";aH(aE.datapoints,aB,null,aD/2,true,aE.xaxis,aE.yaxis,aF)}H.lineWidth=aG;H.strokeStyle=aE.color;aH(aE.datapoints,aB,ae(aE.points,aE.color),0,false,aE.xaxis,aE.yaxis,aF);H.restore()}function E(aN,aM,aV,aI,aQ,aF,aD,aL,aK,aU,aR,aC){var aE,aT,aJ,aP,aG,aB,aO,aH,aS;if(aR){aH=aB=aO=true;aG=false;aE=aV;aT=aN;aP=aM+aI;aJ=aM+aQ;if(aT<aE){aS=aT;aT=aE;aE=aS;aG=true;aB=false}}else{aG=aB=aO=true;aH=false;aE=aN+aI;aT=aN+aQ;aJ=aV;aP=aM;if(aP<aJ){aS=aP;aP=aJ;aJ=aS;aH=true;aO=false}}if(aT<aL.min||aE>aL.max||aP<aK.min||aJ>aK.max){return}if(aE<aL.min){aE=aL.min;aG=false}if(aT>aL.max){aT=aL.max;aB=false}if(aJ<aK.min){aJ=aK.min;aH=false}if(aP>aK.max){aP=aK.max;aO=false}aE=aL.p2c(aE);aJ=aK.p2c(aJ);aT=aL.p2c(aT);aP=aK.p2c(aP);if(aD){aU.beginPath();aU.moveTo(aE,aJ);aU.lineTo(aE,aP);aU.lineTo(aT,aP);aU.lineTo(aT,aJ);aU.fillStyle=aD(aJ,aP);aU.fill()}if(aC>0&&(aG||aB||aO||aH)){aU.beginPath();aU.moveTo(aE,aJ+aF);if(aG){aU.lineTo(aE,aP+aF)}else{aU.moveTo(aE,aP+aF)}if(aO){aU.lineTo(aT,aP+aF)}else{aU.moveTo(aT,aP+aF)}if(aB){aU.lineTo(aT,aJ+aF)}else{aU.moveTo(aT,aJ+aF)}if(aH){aU.lineTo(aE,aJ+aF)}else{aU.moveTo(aE,aJ+aF)}aU.stroke()}}function e(aD){function aC(aJ,aI,aL,aG,aK,aN,aM){var aO=aJ.points,aF=aJ.pointsize;for(var aH=0;aH<aO.length;aH+=aF){if(aO[aH]==null){continue}E(aO[aH],aO[aH+1],aO[aH+2],aI,aL,aG,aK,aN,aM,H,aD.bars.horizontal,aD.bars.lineWidth)}}H.save();H.translate(q.left,q.top);H.lineWidth=aD.bars.lineWidth;H.strokeStyle=aD.color;var aB=aD.bars.align=="left"?0:-aD.bars.barWidth/2;var aE=aD.bars.fill?function(aF,aG){return ae(aD.bars,aD.color,aF,aG)}:null;aC(aD.datapoints,aB,aB+aD.bars.barWidth,0,aE,aD.xaxis,aD.yaxis);H.restore()}function ae(aD,aB,aC,aF){var aE=aD.fill;if(!aE){return null}if(aD.fillColor){return am(aD.fillColor,aC,aF,aB)}var aG=c.color.parse(aB);aG.a=typeof aE=="number"?aE:0.4;aG.normalize();return aG.toString()}function o(){av.find(".legend").remove();if(!O.legend.show){return}var aH=[],aF=false,aN=O.legend.labelFormatter,aM,aJ;for(var aE=0;aE<Q.length;++aE){aM=Q[aE];aJ=aM.label;if(!aJ){continue}if(aE%O.legend.noColumns==0){if(aF){aH.push("</tr>")}aH.push("<tr>");aF=true}if(aN){aJ=aN(aJ,aM)}aH.push('<td class="legendColorBox"><div style="border:1px solid '+O.legend.labelBoxBorderColor+';padding:1px"><div style="width:4px;height:0;border:5px solid '+aM.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+aJ+"</td>")}if(aF){aH.push("</tr>")}if(aH.length==0){return}var aL='<table style="font-size:smaller;color:'+O.grid.color+'">'+aH.join("")+"</table>";if(O.legend.container!=null){c(O.legend.container).html(aL)}else{var aI="",aC=O.legend.position,aD=O.legend.margin;if(aD[0]==null){aD=[aD,aD]}if(aC.charAt(0)=="n"){aI+="top:"+(aD[1]+q.top)+"px;"}else{if(aC.charAt(0)=="s"){aI+="bottom:"+(aD[1]+q.bottom)+"px;"}}if(aC.charAt(1)=="e"){aI+="right:"+(aD[0]+q.right)+"px;"}else{if(aC.charAt(1)=="w"){aI+="left:"+(aD[0]+q.left)+"px;"}}var aK=c('<div class="legend">'+aL.replace('style="','style="position:absolute;'+aI+";")+"</div>").appendTo(av);if(O.legend.backgroundOpacity!=0){var aG=O.legend.backgroundColor;if(aG==null){aG=O.grid.backgroundColor;if(aG&&typeof aG=="string"){aG=c.color.parse(aG)}else{aG=c.color.extract(aK,"background-color")}aG.a=1;aG=aG.toString()}var aB=aK.children();c('<div style="position:absolute;width:'+aB.width()+"px;height:"+aB.height()+"px;"+aI+"background-color:"+aG+';"> </div>').prependTo(aK).css("opacity",O.legend.backgroundOpacity)}}}var ab=[],M=null;function K(aI,aG,aD){var aO=O.grid.mouseActiveRadius,a0=aO*aO+1,aY=null,aR=false,aW,aU;for(aW=Q.length-1;aW>=0;--aW){if(!aD(Q[aW])){continue}var aP=Q[aW],aH=aP.xaxis,aF=aP.yaxis,aV=aP.datapoints.points,aT=aP.datapoints.pointsize,aQ=aH.c2p(aI),aN=aF.c2p(aG),aC=aO/aH.scale,aB=aO/aF.scale;if(aH.options.inverseTransform){aC=Number.MAX_VALUE}if(aF.options.inverseTransform){aB=Number.MAX_VALUE}if(aP.lines.show||aP.points.show){for(aU=0;aU<aV.length;aU+=aT){var aK=aV[aU],aJ=aV[aU+1];if(aK==null){continue}if(aK-aQ>aC||aK-aQ<-aC||aJ-aN>aB||aJ-aN<-aB){continue}var aM=Math.abs(aH.p2c(aK)-aI),aL=Math.abs(aF.p2c(aJ)-aG),aS=aM*aM+aL*aL;if(aS<a0){a0=aS;aY=[aW,aU/aT]}}}if(aP.bars.show&&!aY){var aE=aP.bars.align=="left"?0:-aP.bars.barWidth/2,aX=aE+aP.bars.barWidth;for(aU=0;aU<aV.length;aU+=aT){var aK=aV[aU],aJ=aV[aU+1],aZ=aV[aU+2];if(aK==null){continue}if(Q[aW].bars.horizontal?(aQ<=Math.max(aZ,aK)&&aQ>=Math.min(aZ,aK)&&aN>=aJ+aE&&aN<=aJ+aX):(aQ>=aK+aE&&aQ<=aK+aX&&aN>=Math.min(aZ,aJ)&&aN<=Math.max(aZ,aJ))){aY=[aW,aU/aT]}}}}if(aY){aW=aY[0];aU=aY[1];aT=Q[aW].datapoints.pointsize;return{datapoint:Q[aW].datapoints.points.slice(aU*aT,(aU+1)*aT),dataIndex:aU,series:Q[aW],seriesIndex:aW}}return null}function aa(aB){if(O.grid.hoverable){u("plothover",aB,function(aC){return aC.hoverable!=false})}}function l(aB){if(O.grid.hoverable){u("plothover",aB,function(aC){return false})}}function R(aB){u("plotclick",aB,function(aC){return aC.clickable!=false})}function u(aC,aB,aD){var aE=y.offset(),aH=aB.pageX-aE.left-q.left,aF=aB.pageY-aE.top-q.top,aJ=C({left:aH,top:aF});aJ.pageX=aB.pageX;aJ.pageY=aB.pageY;var aK=K(aH,aF,aD);if(aK){aK.pageX=parseInt(aK.series.xaxis.p2c(aK.datapoint[0])+aE.left+q.left);aK.pageY=parseInt(aK.series.yaxis.p2c(aK.datapoint[1])+aE.top+q.top)}if(O.grid.autoHighlight){for(var aG=0;aG<ab.length;++aG){var aI=ab[aG];if(aI.auto==aC&&!(aK&&aI.series==aK.series&&aI.point[0]==aK.datapoint[0]&&aI.point[1]==aK.datapoint[1])){T(aI.series,aI.point)}}if(aK){x(aK.series,aK.datapoint,aC)}}av.trigger(aC,[aJ,aK])}function f(){if(!M){M=setTimeout(s,30)}}function s(){M=null;A.save();A.clearRect(0,0,G,I);A.translate(q.left,q.top);var aC,aB;for(aC=0;aC<ab.length;++aC){aB=ab[aC];if(aB.series.bars.show){v(aB.series,aB.point)}else{ay(aB.series,aB.point)}}A.restore();an(ak.drawOverlay,[A])}function x(aD,aB,aF){if(typeof aD=="number"){aD=Q[aD]}if(typeof aB=="number"){var aE=aD.datapoints.pointsize;aB=aD.datapoints.points.slice(aE*aB,aE*(aB+1))}var aC=al(aD,aB);if(aC==-1){ab.push({series:aD,point:aB,auto:aF});f()}else{if(!aF){ab[aC].auto=false}}}function T(aD,aB){if(aD==null&&aB==null){ab=[];f()}if(typeof aD=="number"){aD=Q[aD]}if(typeof aB=="number"){aB=aD.data[aB]}var aC=al(aD,aB);if(aC!=-1){ab.splice(aC,1);f()}}function al(aD,aE){for(var aB=0;aB<ab.length;++aB){var aC=ab[aB];if(aC.series==aD&&aC.point[0]==aE[0]&&aC.point[1]==aE[1]){return aB}}return -1}function ay(aE,aD){var aC=aD[0],aI=aD[1],aH=aE.xaxis,aG=aE.yaxis;if(aC<aH.min||aC>aH.max||aI<aG.min||aI>aG.max){return}var aF=aE.points.radius+aE.points.lineWidth/2;A.lineWidth=aF;A.strokeStyle=c.color.parse(aE.color).scale("a",0.5).toString();var aB=1.5*aF,aC=aH.p2c(aC),aI=aG.p2c(aI);A.beginPath();if(aE.points.symbol=="circle"){A.arc(aC,aI,aB,0,2*Math.PI,false)}else{aE.points.symbol(A,aC,aI,aB,false)}A.closePath();A.stroke()}function v(aE,aB){A.lineWidth=aE.bars.lineWidth;A.strokeStyle=c.color.parse(aE.color).scale("a",0.5).toString();var aD=c.color.parse(aE.color).scale("a",0.5).toString();var aC=aE.bars.align=="left"?0:-aE.bars.barWidth/2;E(aB[0],aB[1],aB[2]||0,aC,aC+aE.bars.barWidth,0,function(){return aD},aE.xaxis,aE.yaxis,A,aE.bars.horizontal,aE.bars.lineWidth)}function am(aJ,aB,aH,aC){if(typeof aJ=="string"){return aJ}else{var aI=H.createLinearGradient(0,aH,0,aB);for(var aE=0,aD=aJ.colors.length;aE<aD;++aE){var aF=aJ.colors[aE];if(typeof aF!="string"){var aG=c.color.parse(aC);if(aF.brightness!=null){aG=aG.scale("rgb",aF.brightness)}if(aF.opacity!=null){aG.a*=aF.opacity}aF=aG.toString()}aI.addColorStop(aE/(aD-1),aF)}return aI}}}c.plot=function(g,e,d){var f=new b(c(g),e,d,c.plot.plugins);return f};c.plot.version="0.7";c.plot.plugins=[];c.plot.formatDate=function(l,f,h){var o=function(d){d=""+d;return d.length==1?"0"+d:d};var e=[];var p=false,j=false;var n=l.getUTCHours();var k=n<12;if(h==null){h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}if(f.search(/%p|%P/)!=-1){if(n>12){n=n-12}else{if(n==0){n=12}}}for(var g=0;g<f.length;++g){var m=f.charAt(g);if(p){switch(m){case"h":m=""+n;break;case"H":m=o(n);break;case"M":m=o(l.getUTCMinutes());break;case"S":m=o(l.getUTCSeconds());break;case"d":m=""+l.getUTCDate();break;case"m":m=""+(l.getUTCMonth()+1);break;case"y":m=""+l.getUTCFullYear();break;case"b":m=""+h[l.getUTCMonth()];break;case"p":m=(k)?("am"):("pm");break;case"P":m=(k)?("AM"):("PM");break;case"0":m="";j=true;break}if(m&&j){m=o(m);j=false}e.push(m);if(!j){p=false}}else{if(m=="%"){p=true}else{e.push(m)}}}return e.join("")};function a(e,d){return d*Math.floor(e/d)}})(jQuery);  
/*  
Flot plugin for adding panning and zooming capabilities to a plot.  
 
The default behaviour is double click and scrollwheel up/down to zoom  
in, drag to pan. The plugin defines plot.zoom({ center }),  
plot.zoomOut() and plot.pan(offset) so you easily can add custom  
controls. It also fires a "plotpan" and "plotzoom" event when  
something happens, useful for synchronizing plots.  
 
Options:  
 
zoom: {  
interactive: false  
trigger: "dblclick" // or "click" for single click  
amount: 1.5 // 2 = 200% (zoom in), 0.5 = 50% (zoom out)  
}  
 
pan: {  
interactive: false  
cursor: "move" // CSS mouse cursor value used when dragging, e.g. "pointer"  
frameRate: 20  
}  
 
xaxis, yaxis, x2axis, y2axis: {  
zoomRange: null // or [number, number] (min range, max range) or false  
panRange: null // or [number, number] (min, max) or false  
}  
 
"interactive" enables the built-in drag/click behaviour. If you enable  
interactive for pan, then you'll have a basic plot that supports  
moving around; the same for zoom.  
 
"amount" specifies the default amount to zoom in (so 1.5 = 150%)  
relative to the current viewport.  
 
"cursor" is a standard CSS mouse cursor string used for visual  
feedback to the user when dragging.  
 
"frameRate" specifies the maximum number of times per second the plot  
will update itself while the user is panning around on it (set to null  
to disable intermediate pans, the plot will then not update until the  
mouse button is released).  
 
"zoomRange" is the interval in which zooming can happen, e.g. with  
zoomRange: [1, 100] the zoom will never scale the axis so that the  
difference between min and max is smaller than 1 or larger than 100.  
You can set either end to null to ignore, e.g. [1, null]. If you set  
zoomRange to false, zooming on that axis will be disabled.  
 
"panRange" confines the panning to stay within a range, e.g. with  
panRange: [-10, 20] panning stops at -10 in one end and at 20 in the  
other. Either can be null, e.g. [-10, null]. If you set  
panRange to false, panning on that axis will be disabled.  
 
Example API usage:  
 
plot = $.plot(...);  
 
// zoom default amount in on the pixel (10, 20)  
plot.zoom({ center: { left: 10, top: 20 } });  
 
// zoom out again  
plot.zoomOut({ center: { left: 10, top: 20 } });  
 
// zoom 200% in on the pixel (10, 20)  
plot.zoom({ amount: 2, center: { left: 10, top: 20 } });  
 
// pan 100 pixels to the left and 20 down  
plot.pan({ left: -100, top: 20 })  
 
Here, "center" specifies where the center of the zooming should  
happen. Note that this is defined in pixel space, not the space of the  
data points (you can use the p2c helpers on the axes in Flot to help  
you convert between these).  
 
"amount" is the amount to zoom the viewport relative to the current  
range, so 1 is 100% (i.e. no change), 1.5 is 150% (zoom in), 0.7 is  
70% (zoom out). You can set the default in the options.  
 
*/  
 
 
// First two dependencies, jquery.event.drag.js and  
// jquery.mousewheel.js, we put them inline here to save people the  
// effort of downloading them.  
 
/*  
jquery.event.drag.js ~ v1.5 ~ Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)  
Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-LICENSE.txt  
*/  
(function(E){E.fn.drag=function(L,K,J){if(K){this.bind("dragstart",L)}if(J){this.bind("dragend",J)}return !L?this.trigger("drag"):this.bind("drag",K?K:L)};var A=E.event,B=A.special,F=B.drag={not:":input",distance:0,which:1,dragging:false,setup:function(J){J=E.extend({distance:F.distance,which:F.which,not:F.not},J||{});J.distance=I(J.distance);A.add(this,"mousedown",H,J);if(this.attachEvent){this.attachEvent("ondragstart",D)}},teardown:function(){A.remove(this,"mousedown",H);if(this===F.dragging){F.dragging=F.proxy=false}G(this,true);if(this.detachEvent){this.detachEvent("ondragstart",D)}}};B.dragstart=B.dragend={setup:function(){},teardown:function(){}};function H(L){var K=this,J,M=L.data||{};if(M.elem){K=L.dragTarget=M.elem;L.dragProxy=F.proxy||K;L.cursorOffsetX=M.pageX-M.left;L.cursorOffsetY=M.pageY-M.top;L.offsetX=L.pageX-L.cursorOffsetX;L.offsetY=L.pageY-L.cursorOffsetY}else{if(F.dragging||(M.which>0&&L.which!=M.which)||E(L.target).is(M.not)){return }}switch(L.type){case"mousedown":E.extend(M,E(K).offset(),{elem:K,target:L.target,pageX:L.pageX,pageY:L.pageY});A.add(document,"mousemove mouseup",H,M);G(K,false);F.dragging=null;return false;case !F.dragging&&"mousemove":if(I(L.pageX-M.pageX)+I(L.pageY-M.pageY)<M.distance){break}L.target=M.target;J=C(L,"dragstart",K);if(J!==false){F.dragging=K;F.proxy=L.dragProxy=E(J||K)[0]}case"mousemove":if(F.dragging){J=C(L,"drag",K);if(B.drop){B.drop.allowed=(J!==false);B.drop.handler(L)}if(J!==false){break}L.type="mouseup"}case"mouseup":A.remove(document,"mousemove mouseup",H);if(F.dragging){if(B.drop){B.drop.handler(L)}C(L,"dragend",K)}G(K,true);F.dragging=F.proxy=M.elem=false;break}return true}function C(M,K,L){M.type=K;var J=E.event.handle.call(L,M);return J===false?false:J||M.result}function I(J){return Math.pow(J,2)}function D(){return(F.dragging===false)}function G(K,J){if(!K){return }K.unselectable=J?"off":"on";K.onselectstart=function(){return J};if(K.style){K.style.MozUserSelect=J?"":"none"}}})(jQuery);  
 
 
/* jquery.mousewheel.min.js  
* Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)  
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)  
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.  
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.  
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.  
*  
* Version: 3.0.2  
*  
* Requires: 1.2.2+  
*/  
(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);  
 
 
 
 
(function ($) {  
var options = {  
xaxis: {  
zoomRange: null, // or [number, number] (min range, max range)  
panRange: null // or [number, number] (min, max)  
},  
zoom: {  
interactive: false,  
trigger: "dblclick", // or "click" for single click  
amount: 1.5 // how much to zoom relative to current position, 2 = 200% (zoom in), 0.5 = 50% (zoom out)  
},  
pan: {  
interactive: false,  
cursor: "move",  
frameRate: 20  
}  
};  
 
function init(plot) {  
function onZoomClick(e, zoomOut) {  
var c = plot.offset();  
c.left = e.pageX - c.left;  
c.top = e.pageY - c.top;  
if (zoomOut)  
plot.zoomOut({ center: c });  
else  
plot.zoom({ center: c });  
}  
 
function onMouseWheel(e, delta) {  
onZoomClick(e, delta < 0);  
return false;  
}  
 
var prevCursor = 'default', prevPageX = 0, prevPageY = 0,  
panTimeout = null;  
 
function onDragStart(e) {  
if (e.which != 1) // only accept left-click  
return false;  
var c = plot.getPlaceholder().css('cursor');  
if (c)  
prevCursor = c;  
plot.getPlaceholder().css('cursor', plot.getOptions().pan.cursor);  
prevPageX = e.pageX;  
prevPageY = e.pageY;  
}  
 
function onDrag(e) {  
var frameRate = plot.getOptions().pan.frameRate;  
if (panTimeout || !frameRate)  
return;  
 
panTimeout = setTimeout(function () {  
plot.pan({ left: prevPageX - e.pageX,  
top: prevPageY - e.pageY });  
prevPageX = e.pageX;  
prevPageY = e.pageY;  
 
panTimeout = null;  
}, 1 / frameRate * 1000);  
}  
 
function onDragEnd(e) {  
if (panTimeout) {  
clearTimeout(panTimeout);  
panTimeout = null;  
}  
 
plot.getPlaceholder().css('cursor', prevCursor);  
plot.pan({ left: prevPageX - e.pageX,  
top: prevPageY - e.pageY });  
}  
 
function bindEvents(plot, eventHolder) {  
var o = plot.getOptions();  
if (o.zoom.interactive) {  
eventHolder[o.zoom.trigger](onZoomClick);  
eventHolder.mousewheel(onMouseWheel);  
}  
 
if (o.pan.interactive) {  
eventHolder.bind("dragstart", { distance: 10 }, onDragStart);  
eventHolder.bind("drag", onDrag);  
eventHolder.bind("dragend", onDragEnd);  
}  
}  
 
plot.zoomOut = function (args) {  
if (!args)  
args = {};  
 
if (!args.amount)  
args.amount = plot.getOptions().zoom.amount  
 
args.amount = 1 / args.amount;  
plot.zoom(args);  
}  
 
plot.zoom = function (args) {  
if (!args)  
args = {};  
 
var c = args.center,  
amount = args.amount || plot.getOptions().zoom.amount,  
w = plot.width(), h = plot.height();  
 
if (!c)  
c = { left: w / 2, top: h / 2 };  
 
var xf = c.left / w,  
yf = c.top / h,  
minmax = {  
x: {  
min: c.left - xf * w / amount,  
max: c.left + (1 - xf) * w / amount  
},  
y: {  
min: c.top - yf * h / amount,  
max: c.top + (1 - yf) * h / amount  
}  
};  
 
$.each(plot.getAxes(), function(_, axis) {  
var opts = axis.options,  
min = minmax[axis.direction].min,  
max = minmax[axis.direction].max,  
zr = opts.zoomRange;  
 
if (zr === false) // no zooming on this axis  
return;  
 
min = axis.c2p(min);  
max = axis.c2p(max);  
if (min > max) {  
// make sure min < max  
var tmp = min;  
min = max;  
max = tmp;  
}  
 
var range = max - min;  
if (zr &&  
((zr[0] != null && range < zr[0]) ||  
(zr[1] != null && range > zr[1])))  
return;  
 
opts.min = min;  
opts.max = max;  
});  
 
plot.setupGrid();  
plot.draw();  
 
if (!args.preventEvent)  
plot.getPlaceholder().trigger("plotzoom", [ plot ]);  
}  
 
plot.pan = function (args) {  
var delta = {  
x: +args.left,  
y: +args.top  
};  
 
if (isNaN(delta.x))  
delta.x = 0;  
if (isNaN(delta.y))  
delta.y = 0;  
 
$.each(plot.getAxes(), function (_, axis) {  
var opts = axis.options,  
min, max, d = delta[axis.direction];  
 
min = axis.c2p(axis.p2c(axis.min) + d),  
max = axis.c2p(axis.p2c(axis.max) + d);  
 
var pr = opts.panRange;  
if (pr === false) // no panning on this axis  
return;  
 
if (pr) {  
// check whether we hit the wall  
if (pr[0] != null && pr[0] > min) {  
d = pr[0] - min;  
min += d;  
max += d;  
}  
 
if (pr[1] != null && pr[1] < max) {  
d = pr[1] - max;  
min += d;  
max += d;  
}  
}  
 
opts.min = min;  
opts.max = max;  
});  
 
plot.setupGrid();  
plot.draw();  
 
if (!args.preventEvent)  
plot.getPlaceholder().trigger("plotpan", [ plot ]);  
}  
 
function shutdown(plot, eventHolder) {  
eventHolder.unbind(plot.getOptions().zoom.trigger, onZoomClick);  
eventHolder.unbind("mousewheel", onMouseWheel);  
eventHolder.unbind("dragstart", onDragStart);  
eventHolder.unbind("drag", onDrag);  
eventHolder.unbind("dragend", onDragEnd);  
if (panTimeout)  
clearTimeout(panTimeout);  
}  
 
plot.hooks.bindEvents.push(bindEvents);  
plot.hooks.shutdown.push(shutdown);  
}  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: 'navigate',  
version: '1.3'  
});  
})(jQuery);  
 
(function(i){i.fn.drag=function(j,k,l){if(k){this.bind("dragstart",j)}if(l){this.bind("dragend",l)}return !j?this.trigger("drag"):this.bind("drag",k?k:j)};var d=i.event,c=d.special,h=c.drag={not:":input",distance:0,which:1,dragging:false,setup:function(j){j=i.extend({distance:h.distance,which:h.which,not:h.not},j||{});j.distance=e(j.distance);d.add(this,"mousedown",f,j);if(this.attachEvent){this.attachEvent("ondragstart",a)}},teardown:function(){d.remove(this,"mousedown",f);if(this===h.dragging){h.dragging=h.proxy=false}g(this,true);if(this.detachEvent){this.detachEvent("ondragstart",a)}}};c.dragstart=c.dragend={setup:function(){},teardown:function(){}};function f(j){var k=this,l,m=j.data||{};if(m.elem){k=j.dragTarget=m.elem;j.dragProxy=h.proxy||k;j.cursorOffsetX=m.pageX-m.left;j.cursorOffsetY=m.pageY-m.top;j.offsetX=j.pageX-j.cursorOffsetX;j.offsetY=j.pageY-j.cursorOffsetY}else{if(h.dragging||(m.which>0&&j.which!=m.which)||i(j.target).is(m.not)){return}}switch(j.type){case"mousedown":i.extend(m,i(k).offset(),{elem:k,target:j.target,pageX:j.pageX,pageY:j.pageY});d.add(document,"mousemove mouseup",f,m);g(k,false);h.dragging=null;return false;case !h.dragging&&"mousemove":if(e(j.pageX-m.pageX)+e(j.pageY-m.pageY)<m.distance){break}j.target=m.target;l=b(j,"dragstart",k);if(l!==false){h.dragging=k;h.proxy=j.dragProxy=i(l||k)[0]}case"mousemove":if(h.dragging){l=b(j,"drag",k);if(c.drop){c.drop.allowed=(l!==false);c.drop.handler(j)}if(l!==false){break}j.type="mouseup"}case"mouseup":d.remove(document,"mousemove mouseup",f);if(h.dragging){if(c.drop){c.drop.handler(j)}b(j,"dragend",k)}g(k,true);h.dragging=h.proxy=m.elem=false;break}return true}function b(m,k,j){m.type=k;var l=i.event.handle.call(j,m);return l===false?false:l||m.result}function e(j){return Math.pow(j,2)}function a(){return(h.dragging===false)}function g(j,k){if(!j){return}j.unselectable=k?"off":"on";j.onselectstart=function(){return k};if(j.style){j.style.MozUserSelect=k?"":"none"}}})(jQuery);(function(f){var e=["DOMMouseScroll","mousewheel"];f.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var a=e.length;a;){this.addEventListener(e[--a],d,false)}}else{this.onmousewheel=d}},teardown:function(){if(this.removeEventListener){for(var a=e.length;a;){this.removeEventListener(e[--a],d,false)}}else{this.onmousewheel=null}}};f.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}});function d(b){var h=[].slice.call(arguments,1),a=0,c=true;b=f.event.fix(b||window.event);b.type="mousewheel";if(b.wheelDelta){a=b.wheelDelta/120}if(b.detail){a=-b.detail/3}h.unshift(b,a);return f.event.handle.apply(this,h)}})(jQuery);(function(b){var a={xaxis:{zoomRange:null,panRange:null},zoom:{interactive:false,trigger:"dblclick",amount:1.5},pan:{interactive:false,cursor:"move",frameRate:20}};function c(o){function m(q,p){var r=o.offset();r.left=q.pageX-r.left;r.top=q.pageY-r.top;if(p){o.zoomOut({center:r})}else{o.zoom({center:r})}}function d(p,q){m(p,q<0);return false}var i="default",g=0,e=0,n=null;function f(p){if(p.which!=1){return false}var q=o.getPlaceholder().css("cursor");if(q){i=q}o.getPlaceholder().css("cursor",o.getOptions().pan.cursor);g=p.pageX;e=p.pageY}function j(q){var p=o.getOptions().pan.frameRate;if(n||!p){return}n=setTimeout(function(){o.pan({left:g-q.pageX,top:e-q.pageY});g=q.pageX;e=q.pageY;n=null},1/p*1000)}function h(p){if(n){clearTimeout(n);n=null}o.getPlaceholder().css("cursor",i);o.pan({left:g-p.pageX,top:e-p.pageY})}function l(q,p){var r=q.getOptions();if(r.zoom.interactive){p[r.zoom.trigger](m);p.mousewheel(d)}if(r.pan.interactive){p.bind("dragstart",{distance:10},f);p.bind("drag",j);p.bind("dragend",h)}}o.zoomOut=function(p){if(!p){p={}}if(!p.amount){p.amount=o.getOptions().zoom.amount}p.amount=1/p.amount;o.zoom(p)};o.zoom=function(q){if(!q){q={}}var x=q.center,r=q.amount||o.getOptions().zoom.amount,p=o.width(),t=o.height();if(!x){x={left:p/2,top:t/2}}var s=x.left/p,v=x.top/t,u={x:{min:x.left-s*p/r,max:x.left+(1-s)*p/r},y:{min:x.top-v*t/r,max:x.top+(1-v)*t/r}};b.each(o.getAxes(),function(z,C){var D=C.options,B=u[C.direction].min,w=u[C.direction].max,E=D.zoomRange;if(E===false){return}B=C.c2p(B);w=C.c2p(w);if(B>w){var A=B;B=w;w=A}var y=w-B;if(E&&((E[0]!=null&&y<E[0])||(E[1]!=null&&y>E[1]))){return}D.min=B;D.max=w});o.setupGrid();o.draw();if(!q.preventEvent){o.getPlaceholder().trigger("plotzoom",[o])}};o.pan=function(p){var q={x:+p.left,y:+p.top};if(isNaN(q.x)){q.x=0}if(isNaN(q.y)){q.y=0}b.each(o.getAxes(),function(s,u){var v=u.options,t,r,w=q[u.direction];t=u.c2p(u.p2c(u.min)+w),r=u.c2p(u.p2c(u.max)+w);var x=v.panRange;if(x===false){return}if(x){if(x[0]!=null&&x[0]>t){w=x[0]-t;t+=w;r+=w}if(x[1]!=null&&x[1]<r){w=x[1]-r;t+=w;r+=w}}v.min=t;v.max=r});o.setupGrid();o.draw();if(!p.preventEvent){o.getPlaceholder().trigger("plotpan",[o])}};function k(q,p){p.unbind(q.getOptions().zoom.trigger,m);p.unbind("mousewheel",d);p.unbind("dragstart",f);p.unbind("drag",j);p.unbind("dragend",h);if(n){clearTimeout(n)}}o.hooks.bindEvents.push(l);o.hooks.shutdown.push(k)}b.plot.plugins.push({init:c,options:a,name:"navigate",version:"1.3"})})(jQuery);  
/*  
Flot plugin for rendering pie charts. The plugin assumes the data is  
coming is as a single data value for each series, and each of those  
values is a positive value or zero (negative numbers don't make  
any sense and will cause strange effects). The data values do  
NOT need to be passed in as percentage values because it  
internally calculates the total and percentages.  
 
* Created by Brian Medendorp, June 2009  
* Updated November 2009 with contributions from: btburnett3, Anthony Aragues and Xavi Ivars  
 
* Changes:  
2009-10-22: lineJoin set to round  
2009-10-23: IE full circle fix, donut  
2009-11-11: Added basic hover from btburnett3 - does not work in IE, and center is off in Chrome and Opera  
2009-11-17: Added IE hover capability submitted by Anthony Aragues  
2009-11-18: Added bug fix submitted by Xavi Ivars (issues with arrays when other JS libraries are included as well)  
 
 
Available options are:  
series: {  
pie: {  
show: true/false  
radius: 0-1 for percentage of fullsize, or a specified pixel length, or 'auto'  
innerRadius: 0-1 for percentage of fullsize or a specified pixel length, for creating a donut effect  
startAngle: 0-2 factor of PI used for starting angle (in radians) i.e 3/2 starts at the top, 0 and 2 have the same result  
tilt: 0-1 for percentage to tilt the pie, where 1 is no tilt, and 0 is completely flat (nothing will show)  
offset: {  
top: integer value to move the pie up or down  
left: integer value to move the pie left or right, or 'auto'  
},  
stroke: {  
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#FFF')  
width: integer pixel width of the stroke  
},  
label: {  
show: true/false, or 'auto'  
formatter: a user-defined function that modifies the text/style of the label text  
radius: 0-1 for percentage of fullsize, or a specified pixel length  
background: {  
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#000')  
opacity: 0-1  
},  
threshold: 0-1 for the percentage value at which to hide labels (if they're too small)  
},  
combine: {  
threshold: 0-1 for the percentage value at which to combine slices (if they're too small)  
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#CCC'), if null, the plugin will automatically use the color of the first slice to be combined  
label: any text value of what the combined slice should be labeled  
}  
highlight: {  
opacity: 0-1  
}  
}  
}  
 
More detail and specific examples can be found in the included HTML file.  
 
*/  
 
(function ($)  
{  
function init(plot) // this is the "body" of the plugin  
{  
var canvas = null;  
var target = null;  
var maxRadius = null;  
var centerLeft = null;  
var centerTop = null;  
var total = 0;  
var redraw = true;  
var redrawAttempts = 10;  
var shrink = 0.95;  
var legendWidth = 0;  
var processed = false;  
var raw = false;  
 
// interactive variables  
var highlights = [];  
 
// add hook to determine if pie plugin in enabled, and then perform necessary operations  
plot.hooks.processOptions.push(checkPieEnabled);  
plot.hooks.bindEvents.push(bindEvents);  
 
// check to see if the pie plugin is enabled  
function checkPieEnabled(plot, options)  
{  
if (options.series.pie.show)  
{  
//disable grid  
options.grid.show = false;  
 
// set labels.show  
if (options.series.pie.label.show=='auto')  
if (options.legend.show)  
options.series.pie.label.show = false;  
else  
options.series.pie.label.show = true;  
 
// set radius  
if (options.series.pie.radius=='auto')  
if (options.series.pie.label.show)  
options.series.pie.radius = 3/4;  
else  
options.series.pie.radius = 1;  
 
// ensure sane tilt  
if (options.series.pie.tilt>1)  
options.series.pie.tilt=1;  
if (options.series.pie.tilt<0)  
options.series.pie.tilt=0;  
 
// add processData hook to do transformations on the data  
plot.hooks.processDatapoints.push(processDatapoints);  
plot.hooks.drawOverlay.push(drawOverlay);  
 
// add draw hook  
plot.hooks.draw.push(draw);  
}  
}  
 
// bind hoverable events  
function bindEvents(plot, eventHolder)  
{  
var options = plot.getOptions();  
 
if (options.series.pie.show && options.grid.hoverable)  
eventHolder.unbind('mousemove').mousemove(onMouseMove);  
 
if (options.series.pie.show && options.grid.clickable)  
eventHolder.unbind('click').click(onClick);  
}  
 
 
// debugging function that prints out an object  
function alertObject(obj)  
{  
var msg = '';  
function traverse(obj, depth)  
{  
if (!depth)  
depth = 0;  
for (var i = 0; i < obj.length; ++i)  
{  
for (var j=0; j<depth; j++)  
msg += '\t';  
 
if( typeof obj[i] == "object")  
{ // its an object  
msg += ''+i+':\n';  
traverse(obj[i], depth+1);  
}  
else  
{ // its a value  
msg += ''+i+': '+obj[i]+'\n';  
}  
}  
}  
traverse(obj);  
alert(msg);  
}  
 
function calcTotal(data)  
{  
for (var i = 0; i < data.length; ++i)  
{  
var item = parseFloat(data[i].data[0][1]);  
if (item)  
total += item;  
}  
}  
 
function processDatapoints(plot, series, data, datapoints)  
{  
if (!processed)  
{  
processed = true;  
 
canvas = plot.getCanvas();  
target = $(canvas).parent();  
options = plot.getOptions();  
 
plot.setData(combine(plot.getData()));  
}  
}  
 
function setupPie()  
{  
legendWidth = target.children().filter('.legend').children().width();  
 
// calculate maximum radius and center point  
maxRadius = Math.min(canvas.width,(canvas.height/options.series.pie.tilt))/2;  
centerTop = (canvas.height/2)+options.series.pie.offset.top;  
centerLeft = (canvas.width/2);  
 
if (options.series.pie.offset.left=='auto')  
if (options.legend.position.match('w'))  
centerLeft += legendWidth/2;  
else  
centerLeft -= legendWidth/2;  
else  
centerLeft += options.series.pie.offset.left;  
 
if (centerLeft<maxRadius)  
centerLeft = maxRadius;  
else if (centerLeft>canvas.width-maxRadius)  
centerLeft = canvas.width-maxRadius;  
}  
 
function fixData(data)  
{  
for (var i = 0; i < data.length; ++i)  
{  
if (typeof(data[i].data)=='number')  
data[i].data = [[1,data[i].data]];  
else if (typeof(data[i].data)=='undefined' || typeof(data[i].data[0])=='undefined')  
{  
if (typeof(data[i].data)!='undefined' && typeof(data[i].data.label)!='undefined')  
data[i].label = data[i].data.label; // fix weirdness coming from flot  
data[i].data = [[1,0]];  
 
}  
}  
return data;  
}  
 
function combine(data)  
{  
data = fixData(data);  
calcTotal(data);  
var combined = 0;  
var numCombined = 0;  
var color = options.series.pie.combine.color;  
 
var newdata = [];  
for (var i = 0; i < data.length; ++i)  
{  
// make sure its a number  
data[i].data[0][1] = parseFloat(data[i].data[0][1]);  
if (!data[i].data[0][1])  
data[i].data[0][1] = 0;  
 
if (data[i].data[0][1]/total<=options.series.pie.combine.threshold)  
{  
combined += data[i].data[0][1];  
numCombined++;  
if (!color)  
color = data[i].color;  
}  
else  
{  
newdata.push({  
data: [[1,data[i].data[0][1]]],  
color: data[i].color,  
label: data[i].label,  
angle: (data[i].data[0][1]*(Math.PI*2))/total,  
percent: (data[i].data[0][1]/total*100)  
});  
}  
}  
if (numCombined>0)  
newdata.push({  
data: [[1,combined]],  
color: color,  
label: options.series.pie.combine.label,  
angle: (combined*(Math.PI*2))/total,  
percent: (combined/total*100)  
});  
return newdata;  
}  
 
function draw(plot, newCtx)  
{  
if (!target) return; // if no series were passed  
ctx = newCtx;  
 
setupPie();  
var slices = plot.getData();  
 
var attempts = 0;  
while (redraw && attempts<redrawAttempts)  
{  
redraw = false;  
if (attempts>0)  
maxRadius *= shrink;  
attempts += 1;  
clear();  
if (options.series.pie.tilt<=0.8)  
drawShadow();  
drawPie();  
}  
if (attempts >= redrawAttempts) {  
clear();  
target.prepend('<div class="error">Could not draw pie with labels contained inside canvas</div>');  
}  
 
if ( plot.setSeries && plot.insertLegend )  
{  
plot.setSeries(slices);  
plot.insertLegend();  
}  
 
// we're actually done at this point, just defining internal functions at this point  
 
function clear()  
{  
ctx.clearRect(0,0,canvas.width,canvas.height);  
target.children().filter('.pieLabel, .pieLabelBackground').remove();  
}  
 
function drawShadow()  
{  
var shadowLeft = 5;  
var shadowTop = 15;  
var edge = 10;  
var alpha = 0.02;  
 
// set radius  
if (options.series.pie.radius>1)  
var radius = options.series.pie.radius;  
else  
var radius = maxRadius * options.series.pie.radius;  
 
if (radius>=(canvas.width/2)-shadowLeft || radius*options.series.pie.tilt>=(canvas.height/2)-shadowTop || radius<=edge)  
return; // shadow would be outside canvas, so don't draw it  
 
ctx.save();  
ctx.translate(shadowLeft,shadowTop);  
ctx.globalAlpha = alpha;  
ctx.fillStyle = '#000';  
 
// center and rotate to starting position  
ctx.translate(centerLeft,centerTop);  
ctx.scale(1, options.series.pie.tilt);  
 
//radius -= edge;  
for (var i=1; i<=edge; i++)  
{  
ctx.beginPath();  
ctx.arc(0,0,radius,0,Math.PI*2,false);  
ctx.fill();  
radius -= i;  
}  
 
ctx.restore();  
}  
 
function drawPie()  
{  
startAngle = Math.PI*options.series.pie.startAngle;  
 
// set radius  
if (options.series.pie.radius>1)  
var radius = options.series.pie.radius;  
else  
var radius = maxRadius * options.series.pie.radius;  
 
// center and rotate to starting position  
ctx.save();  
ctx.translate(centerLeft,centerTop);  
ctx.scale(1, options.series.pie.tilt);  
//ctx.rotate(startAngle); // start at top; -- This doesn't work properly in Opera  
 
// draw slices  
ctx.save();  
var currentAngle = startAngle;  
for (var i = 0; i < slices.length; ++i)  
{  
slices[i].startAngle = currentAngle;  
drawSlice(slices[i].angle, slices[i].color, true);  
}  
ctx.restore();  
 
// draw slice outlines  
ctx.save();  
ctx.lineWidth = options.series.pie.stroke.width;  
currentAngle = startAngle;  
for (var i = 0; i < slices.length; ++i)  
drawSlice(slices[i].angle, options.series.pie.stroke.color, false);  
ctx.restore();  
 
// draw donut hole  
drawDonutHole(ctx);  
 
// draw labels  
if (options.series.pie.label.show)  
drawLabels();  
 
// restore to original state  
ctx.restore();  
 
function drawSlice(angle, color, fill)  
{  
if (angle<=0)  
return;  
 
if (fill)  
ctx.fillStyle = color;  
else  
{  
ctx.strokeStyle = color;  
ctx.lineJoin = 'round';  
}  
 
ctx.beginPath();  
if (Math.abs(angle - Math.PI*2) > 0.000000001)  
ctx.moveTo(0,0); // Center of the pie  
else if ($.browser.msie)  
angle -= 0.0001;  
//ctx.arc(0,0,radius,0,angle,false); // This doesn't work properly in Opera  
ctx.arc(0,0,radius,currentAngle,currentAngle+angle,false);  
ctx.closePath();  
//ctx.rotate(angle); // This doesn't work properly in Opera  
currentAngle += angle;  
 
if (fill)  
ctx.fill();  
else  
ctx.stroke();  
}  
 
function drawLabels()  
{  
var currentAngle = startAngle;  
 
// set radius  
if (options.series.pie.label.radius>1)  
var radius = options.series.pie.label.radius;  
else  
var radius = maxRadius * options.series.pie.label.radius;  
 
for (var i = 0; i < slices.length; ++i)  
{  
if (slices[i].percent >= options.series.pie.label.threshold*100)  
drawLabel(slices[i], currentAngle, i);  
currentAngle += slices[i].angle;  
}  
 
function drawLabel(slice, startAngle, index)  
{  
if (slice.data[0][1]==0)  
return;  
 
// format label text  
var lf = options.legend.labelFormatter, text, plf = options.series.pie.label.formatter;  
if (lf)  
text = lf(slice.label, slice);  
else  
text = slice.label;  
if (plf)  
text = plf(text, slice);  
 
var halfAngle = ((startAngle+slice.angle) + startAngle)/2;  
var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);  
var y = centerTop + Math.round(Math.sin(halfAngle) * radius) * options.series.pie.tilt;  
 
var html = '<span class="pieLabel" id="pieLabel'+index+'" style="position:absolute;top:' + y + 'px;left:' + x + 'px;">' + text + "</span>";  
target.append(html);  
var label = target.children('#pieLabel'+index);  
var labelTop = (y - label.height()/2);  
var labelLeft = (x - label.width()/2);  
label.css('top', labelTop);  
label.css('left', labelLeft);  
 
// check to make sure that the label is not outside the canvas  
if (0-labelTop>0 || 0-labelLeft>0 || canvas.height-(labelTop+label.height())<0 || canvas.width-(labelLeft+label.width())<0)  
redraw = true;  
 
if (options.series.pie.label.background.opacity != 0) {  
// put in the transparent background separately to avoid blended labels and label boxes  
var c = options.series.pie.label.background.color;  
if (c == null) {  
c = slice.color;  
}  
var pos = 'top:'+labelTop+'px;left:'+labelLeft+'px;';  
$('<div class="pieLabelBackground" style="position:absolute;width:' + label.width() + 'px;height:' + label.height() + 'px;' + pos +'background-color:' + c + ';"> </div>').insertBefore(label).css('opacity', options.series.pie.label.background.opacity);  
}  
} // end individual label function  
} // end drawLabels function  
} // end drawPie function  
} // end draw function  
 
// Placed here because it needs to be accessed from multiple locations  
function drawDonutHole(layer)  
{  
// draw donut hole  
if(options.series.pie.innerRadius > 0)  
{  
// subtract the center  
layer.save();  
innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;  
layer.globalCompositeOperation = 'destination-out'; // this does not work with excanvas, but it will fall back to using the stroke color  
layer.beginPath();  
layer.fillStyle = options.series.pie.stroke.color;  
layer.arc(0,0,innerRadius,0,Math.PI*2,false);  
layer.fill();  
layer.closePath();  
layer.restore();  
 
// add inner stroke  
layer.save();  
layer.beginPath();  
layer.strokeStyle = options.series.pie.stroke.color;  
layer.arc(0,0,innerRadius,0,Math.PI*2,false);  
layer.stroke();  
layer.closePath();  
layer.restore();  
// TODO: add extra shadow inside hole (with a mask) if the pie is tilted.  
}  
}  
 
//-- Additional Interactive related functions --  
 
function isPointInPoly(poly, pt)  
{  
for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)  
((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || (poly[j][1] <= pt[1] && pt[1]< poly[i][1]))  
&& (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0])  
&& (c = !c);  
return c;  
}  
 
function findNearbySlice(mouseX, mouseY)  
{  
var slices = plot.getData(),  
options = plot.getOptions(),  
radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;  
 
for (var i = 0; i < slices.length; ++i)  
{  
var s = slices[i];  
 
if(s.pie.show)  
{  
ctx.save();  
ctx.beginPath();  
ctx.moveTo(0,0); // Center of the pie  
//ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here.  
ctx.arc(0,0,radius,s.startAngle,s.startAngle+s.angle,false);  
ctx.closePath();  
x = mouseX-centerLeft;  
y = mouseY-centerTop;  
if(ctx.isPointInPath)  
{  
if (ctx.isPointInPath(mouseX-centerLeft, mouseY-centerTop))  
{  
//alert('found slice!');  
ctx.restore();  
return {datapoint: [s.percent, s.data], dataIndex: 0, series: s, seriesIndex: i};  
}  
}  
else  
{  
// excanvas for IE doesn;t support isPointInPath, this is a workaround.  
p1X = (radius * Math.cos(s.startAngle));  
p1Y = (radius * Math.sin(s.startAngle));  
p2X = (radius * Math.cos(s.startAngle+(s.angle/4)));  
p2Y = (radius * Math.sin(s.startAngle+(s.angle/4)));  
p3X = (radius * Math.cos(s.startAngle+(s.angle/2)));  
p3Y = (radius * Math.sin(s.startAngle+(s.angle/2)));  
p4X = (radius * Math.cos(s.startAngle+(s.angle/1.5)));  
p4Y = (radius * Math.sin(s.startAngle+(s.angle/1.5)));  
p5X = (radius * Math.cos(s.startAngle+s.angle));  
p5Y = (radius * Math.sin(s.startAngle+s.angle));  
arrPoly = [[0,0],[p1X,p1Y],[p2X,p2Y],[p3X,p3Y],[p4X,p4Y],[p5X,p5Y]];  
arrPoint = [x,y];  
// TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?  
if(isPointInPoly(arrPoly, arrPoint))  
{  
ctx.restore();  
return {datapoint: [s.percent, s.data], dataIndex: 0, series: s, seriesIndex: i};  
}  
}  
ctx.restore();  
}  
}  
 
return null;  
}  
 
function onMouseMove(e)  
{  
triggerClickHoverEvent('plothover', e);  
}  
 
function onClick(e)  
{  
triggerClickHoverEvent('plotclick', e);  
}  
 
// trigger click or hover event (they send the same parameters so we share their code)  
function triggerClickHoverEvent(eventname, e)  
{  
var offset = plot.offset(),  
canvasX = parseInt(e.pageX - offset.left),  
canvasY = parseInt(e.pageY - offset.top),  
item = findNearbySlice(canvasX, canvasY);  
 
if (options.grid.autoHighlight)  
{  
// clear auto-highlights  
for (var i = 0; i < highlights.length; ++i)  
{  
var h = highlights[i];  
if (h.auto == eventname && !(item && h.series == item.series))  
unhighlight(h.series);  
}  
}  
 
// highlight the slice  
if (item)  
highlight(item.series, eventname);  
 
// trigger any hover bind events  
var pos = { pageX: e.pageX, pageY: e.pageY };  
target.trigger(eventname, [ pos, item ]);  
}  
 
function highlight(s, auto)  
{  
if (typeof s == "number")  
s = series[s];  
 
var i = indexOfHighlight(s);  
if (i == -1)  
{  
highlights.push({ series: s, auto: auto });  
plot.triggerRedrawOverlay();  
}  
else if (!auto)  
highlights[i].auto = false;  
}  
 
function unhighlight(s)  
{  
if (s == null)  
{  
highlights = [];  
plot.triggerRedrawOverlay();  
}  
 
if (typeof s == "number")  
s = series[s];  
 
var i = indexOfHighlight(s);  
if (i != -1)  
{  
highlights.splice(i, 1);  
plot.triggerRedrawOverlay();  
}  
}  
 
function indexOfHighlight(s)  
{  
for (var i = 0; i < highlights.length; ++i)  
{  
var h = highlights[i];  
if (h.series == s)  
return i;  
}  
return -1;  
}  
 
function drawOverlay(plot, octx)  
{  
//alert(options.series.pie.radius);  
var options = plot.getOptions();  
//alert(options.series.pie.radius);  
 
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;  
 
octx.save();  
octx.translate(centerLeft, centerTop);  
octx.scale(1, options.series.pie.tilt);  
 
for (i = 0; i < highlights.length; ++i)  
drawHighlight(highlights[i].series);  
 
drawDonutHole(octx);  
 
octx.restore();  
 
function drawHighlight(series)  
{  
if (series.angle < 0) return;  
 
//octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();  
octx.fillStyle = "rgba(255, 255, 255, "+options.series.pie.highlight.opacity+")"; // this is temporary until we have access to parseColor  
 
octx.beginPath();  
if (Math.abs(series.angle - Math.PI*2) > 0.000000001)  
octx.moveTo(0,0); // Center of the pie  
octx.arc(0,0,radius,series.startAngle,series.startAngle+series.angle,false);  
octx.closePath();  
octx.fill();  
}  
 
}  
 
} // end init (plugin body)  
 
// define pie specific options and their default values  
var options = {  
series: {  
pie: {  
show: false,  
radius: 'auto', // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)  
innerRadius:0, /* for donut */  
startAngle: 3/2,  
tilt: 1,  
offset: {  
top: 0,  
left: 'auto'  
},  
stroke: {  
color: '#FFF',  
width: 1  
},  
label: {  
show: 'auto',  
formatter: function(label, slice){  
return '<div style="font-size:x-small;text-align:center;padding:2px;color:'+slice.color+';">'+label+'<br/>'+Math.round(slice.percent)+'%</div>';  
}, // formatter function  
radius: 1, // radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)  
background: {  
color: null,  
opacity: 0  
},  
threshold: 0 // percentage at which to hide the label (i.e. the slice is too narrow)  
},  
combine: {  
threshold: -1, // percentage at which to combine little slices into one larger slice  
color: null, // color to give the new slice (auto-generated if null)  
label: 'Other' // label to give the new slice  
},  
highlight: {  
//color: '#FFF', // will add this functionality once parseColor is available  
opacity: 0.5  
}  
}  
}  
};  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: "pie",  
version: "1.0"  
});  
})(jQuery);  
 
(function(b){function c(D){var h=null;var L=null;var n=null;var B=null;var p=null;var M=0;var F=true;var o=10;var w=0.95;var A=0;var d=false;var z=false;var j=[];D.hooks.processOptions.push(g);D.hooks.bindEvents.push(e);function g(O,N){if(N.series.pie.show){N.grid.show=false;if(N.series.pie.label.show=="auto"){if(N.legend.show){N.series.pie.label.show=false}else{N.series.pie.label.show=true}}if(N.series.pie.radius=="auto"){if(N.series.pie.label.show){N.series.pie.radius=3/4}else{N.series.pie.radius=1}}if(N.series.pie.tilt>1){N.series.pie.tilt=1}if(N.series.pie.tilt<0){N.series.pie.tilt=0}O.hooks.processDatapoints.push(E);O.hooks.drawOverlay.push(H);O.hooks.draw.push(r)}}function e(P,N){var O=P.getOptions();if(O.series.pie.show&&O.grid.hoverable){N.unbind("mousemove").mousemove(t)}if(O.series.pie.show&&O.grid.clickable){N.unbind("click").click(l)}}function G(O){var P="";function N(S,T){if(!T){T=0}for(var R=0;R<S.length;++R){for(var Q=0;Q<T;Q++){P+="\t"}if(typeof S[R]=="object"){P+=""+R+":\n";N(S[R],T+1)}else{P+=""+R+": "+S[R]+"\n"}}}N(O);alert(P)}function q(P){for(var N=0;N<P.length;++N){var O=parseFloat(P[N].data[0][1]);if(O){M+=O}}}function E(Q,N,O,P){if(!d){d=true;h=Q.getCanvas();L=b(h).parent();a=Q.getOptions();Q.setData(K(Q.getData()))}}function I(){A=L.children().filter(".legend").children().width();n=Math.min(h.width,(h.height/a.series.pie.tilt))/2;p=(h.height/2)+a.series.pie.offset.top;B=(h.width/2);if(a.series.pie.offset.left=="auto"){if(a.legend.position.match("w")){B+=A/2}else{B-=A/2}}else{B+=a.series.pie.offset.left}if(B<n){B=n}else{if(B>h.width-n){B=h.width-n}}}function v(O){for(var N=0;N<O.length;++N){if(typeof(O[N].data)=="number"){O[N].data=[[1,O[N].data]]}else{if(typeof(O[N].data)=="undefined"||typeof(O[N].data[0])=="undefined"){if(typeof(O[N].data)!="undefined"&&typeof(O[N].data.label)!="undefined"){O[N].label=O[N].data.label}O[N].data=[[1,0]]}}}return O}function K(Q){Q=v(Q);q(Q);var P=0;var S=0;var N=a.series.pie.combine.color;var R=[];for(var O=0;O<Q.length;++O){Q[O].data[0][1]=parseFloat(Q[O].data[0][1]);if(!Q[O].data[0][1]){Q[O].data[0][1]=0}if(Q[O].data[0][1]/M<=a.series.pie.combine.threshold){P+=Q[O].data[0][1];S++;if(!N){N=Q[O].color}}else{R.push({data:[[1,Q[O].data[0][1]]],color:Q[O].color,label:Q[O].label,angle:(Q[O].data[0][1]*(Math.PI*2))/M,percent:(Q[O].data[0][1]/M*100)})}}if(S>0){R.push({data:[[1,P]],color:N,label:a.series.pie.combine.label,angle:(P*(Math.PI*2))/M,percent:(P/M*100)})}return R}function r(S,Q){if(!L){return}ctx=Q;I();var T=S.getData();var P=0;while(F&&P<o){F=false;if(P>0){n*=w}P+=1;N();if(a.series.pie.tilt<=0.8){O()}R()}if(P>=o){N();L.prepend('<div class="error">Could not draw pie with labels contained inside canvas</div>')}if(S.setSeries&&S.insertLegend){S.setSeries(T);S.insertLegend()}function N(){ctx.clearRect(0,0,h.width,h.height);L.children().filter(".pieLabel, .pieLabelBackground").remove()}function O(){var Z=5;var Y=15;var W=10;var X=0.02;if(a.series.pie.radius>1){var U=a.series.pie.radius}else{var U=n*a.series.pie.radius}if(U>=(h.width/2)-Z||U*a.series.pie.tilt>=(h.height/2)-Y||U<=W){return}ctx.save();ctx.translate(Z,Y);ctx.globalAlpha=X;ctx.fillStyle="#000";ctx.translate(B,p);ctx.scale(1,a.series.pie.tilt);for(var V=1;V<=W;V++){ctx.beginPath();ctx.arc(0,0,U,0,Math.PI*2,false);ctx.fill();U-=V}ctx.restore()}function R(){startAngle=Math.PI*a.series.pie.startAngle;if(a.series.pie.radius>1){var U=a.series.pie.radius}else{var U=n*a.series.pie.radius}ctx.save();ctx.translate(B,p);ctx.scale(1,a.series.pie.tilt);ctx.save();var Y=startAngle;for(var W=0;W<T.length;++W){T[W].startAngle=Y;X(T[W].angle,T[W].color,true)}ctx.restore();ctx.save();ctx.lineWidth=a.series.pie.stroke.width;Y=startAngle;for(var W=0;W<T.length;++W){X(T[W].angle,a.series.pie.stroke.color,false)}ctx.restore();J(ctx);if(a.series.pie.label.show){V()}ctx.restore();function X(ab,Z,aa){if(ab<=0){return}if(aa){ctx.fillStyle=Z}else{ctx.strokeStyle=Z;ctx.lineJoin="round"}ctx.beginPath();if(Math.abs(ab-Math.PI*2)>1e-9){ctx.moveTo(0,0)}else{if(b.browser.msie){ab-=0.0001}}ctx.arc(0,0,U,Y,Y+ab,false);ctx.closePath();Y+=ab;if(aa){ctx.fill()}else{ctx.stroke()}}function V(){var ac=startAngle;if(a.series.pie.label.radius>1){var Z=a.series.pie.label.radius}else{var Z=n*a.series.pie.label.radius}for(var ab=0;ab<T.length;++ab){if(T[ab].percent>=a.series.pie.label.threshold*100){aa(T[ab],ac,ab)}ac+=T[ab].angle}function aa(ap,ai,ag){if(ap.data[0][1]==0){return}var ar=a.legend.labelFormatter,aq,ae=a.series.pie.label.formatter;if(ar){aq=ar(ap.label,ap)}else{aq=ap.label}if(ae){aq=ae(aq,ap)}var aj=((ai+ap.angle)+ai)/2;var ao=B+Math.round(Math.cos(aj)*Z);var am=p+Math.round(Math.sin(aj)*Z)*a.series.pie.tilt;var af='<span class="pieLabel" id="pieLabel'+ag+'" style="position:absolute;top:'+am+"px;left:"+ao+'px;">'+aq+"</span>";L.append(af);var an=L.children("#pieLabel"+ag);var ad=(am-an.height()/2);var ah=(ao-an.width()/2);an.css("top",ad);an.css("left",ah);if(0-ad>0||0-ah>0||h.height-(ad+an.height())<0||h.width-(ah+an.width())<0){F=true}if(a.series.pie.label.background.opacity!=0){var ak=a.series.pie.label.background.color;if(ak==null){ak=ap.color}var al="top:"+ad+"px;left:"+ah+"px;";b('<div class="pieLabelBackground" style="position:absolute;width:'+an.width()+"px;height:"+an.height()+"px;"+al+"background-color:"+ak+';"> </div>').insertBefore(an).css("opacity",a.series.pie.label.background.opacity)}}}}}function J(N){if(a.series.pie.innerRadius>0){N.save();innerRadius=a.series.pie.innerRadius>1?a.series.pie.innerRadius:n*a.series.pie.innerRadius;N.globalCompositeOperation="destination-out";N.beginPath();N.fillStyle=a.series.pie.stroke.color;N.arc(0,0,innerRadius,0,Math.PI*2,false);N.fill();N.closePath();N.restore();N.save();N.beginPath();N.strokeStyle=a.series.pie.stroke.color;N.arc(0,0,innerRadius,0,Math.PI*2,false);N.stroke();N.closePath();N.restore()}}function s(Q,R){for(var S=false,P=-1,N=Q.length,O=N-1;++P<N;O=P){((Q[P][1]<=R[1]&&R[1]<Q[O][1])||(Q[O][1]<=R[1]&&R[1]<Q[P][1]))&&(R[0]<(Q[O][0]-Q[P][0])*(R[1]-Q[P][1])/(Q[O][1]-Q[P][1])+Q[P][0])&&(S=!S)}return S}function u(R,P){var T=D.getData(),O=D.getOptions(),N=O.series.pie.radius>1?O.series.pie.radius:n*O.series.pie.radius;for(var Q=0;Q<T.length;++Q){var S=T[Q];if(S.pie.show){ctx.save();ctx.beginPath();ctx.moveTo(0,0);ctx.arc(0,0,N,S.startAngle,S.startAngle+S.angle,false);ctx.closePath();x=R-B;y=P-p;if(ctx.isPointInPath){if(ctx.isPointInPath(R-B,P-p)){ctx.restore();return{datapoint:[S.percent,S.data],dataIndex:0,series:S,seriesIndex:Q}}}else{p1X=(N*Math.cos(S.startAngle));p1Y=(N*Math.sin(S.startAngle));p2X=(N*Math.cos(S.startAngle+(S.angle/4)));p2Y=(N*Math.sin(S.startAngle+(S.angle/4)));p3X=(N*Math.cos(S.startAngle+(S.angle/2)));p3Y=(N*Math.sin(S.startAngle+(S.angle/2)));p4X=(N*Math.cos(S.startAngle+(S.angle/1.5)));p4Y=(N*Math.sin(S.startAngle+(S.angle/1.5)));p5X=(N*Math.cos(S.startAngle+S.angle));p5Y=(N*Math.sin(S.startAngle+S.angle));arrPoly=[[0,0],[p1X,p1Y],[p2X,p2Y],[p3X,p3Y],[p4X,p4Y],[p5X,p5Y]];arrPoint=[x,y];if(s(arrPoly,arrPoint)){ctx.restore();return{datapoint:[S.percent,S.data],dataIndex:0,series:S,seriesIndex:Q}}}ctx.restore()}}return null}function t(N){m("plothover",N)}function l(N){m("plotclick",N)}function m(N,T){var O=D.offset(),R=parseInt(T.pageX-O.left),P=parseInt(T.pageY-O.top),V=u(R,P);if(a.grid.autoHighlight){for(var Q=0;Q<j.length;++Q){var S=j[Q];if(S.auto==N&&!(V&&S.series==V.series)){f(S.series)}}}if(V){k(V.series,N)}var U={pageX:T.pageX,pageY:T.pageY};L.trigger(N,[U,V])}function k(O,P){if(typeof O=="number"){O=series[O]}var N=C(O);if(N==-1){j.push({series:O,auto:P});D.triggerRedrawOverlay()}else{if(!P){j[N].auto=false}}}function f(O){if(O==null){j=[];D.triggerRedrawOverlay()}if(typeof O=="number"){O=series[O]}var N=C(O);if(N!=-1){j.splice(N,1);D.triggerRedrawOverlay()}}function C(P){for(var N=0;N<j.length;++N){var O=j[N];if(O.series==P){return N}}return -1}function H(Q,R){var P=Q.getOptions();var N=P.series.pie.radius>1?P.series.pie.radius:n*P.series.pie.radius;R.save();R.translate(B,p);R.scale(1,P.series.pie.tilt);for(i=0;i<j.length;++i){O(j[i].series)}J(R);R.restore();function O(S){if(S.angle<0){return}R.fillStyle="rgba(255, 255, 255, "+P.series.pie.highlight.opacity+")";R.beginPath();if(Math.abs(S.angle-Math.PI*2)>1e-9){R.moveTo(0,0)}R.arc(0,0,N,S.startAngle,S.startAngle+S.angle,false);R.closePath();R.fill()}}}var a={series:{pie:{show:false,radius:"auto",innerRadius:0,startAngle:3/2,tilt:1,offset:{top:0,left:"auto"},stroke:{color:"#FFF",width:1},label:{show:"auto",formatter:function(d,e){return'<div style="font-size:x-small;text-align:center;padding:2px;color:'+e.color+';">'+d+"<br/>"+Math.round(e.percent)+"%</div>"},radius:1,background:{color:null,opacity:0},threshold:0},combine:{threshold:-1,color:null,label:"Other"},highlight:{opacity:0.5}}}};b.plot.plugins.push({init:c,options:a,name:"pie",version:"1.0"})})(jQuery);  
/*  
Flot plugin for automatically redrawing plots when the placeholder  
size changes, e.g. on window resizes.  
 
It works by listening for changes on the placeholder div (through the  
jQuery resize event plugin) - if the size changes, it will redraw the  
plot.  
 
There are no options. If you need to disable the plugin for some  
plots, you can just fix the size of their placeholders.  
*/  
 
 
/* Inline dependency:  
* jQuery resize event - v1.1 - 3/14/2010  
* http://benalman.com/projects/jquery-resize-plugin/  
*  
* Copyright (c) 2010 "Cowboy" Ben Alman  
* Dual licensed under the MIT and GPL licenses.  
* http://benalman.com/about/license/  
*/  
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);  
 
 
(function ($) {  
var options = { }; // no options  
 
function init(plot) {  
function onResize() {  
var placeholder = plot.getPlaceholder();  
 
// somebody might have hidden us and we can't plot  
// when we don't have the dimensions  
if (placeholder.width() == 0 || placeholder.height() == 0)  
return;  
 
plot.resize();  
plot.setupGrid();  
plot.draw();  
}  
 
function bindEvents(plot, eventHolder) {  
plot.getPlaceholder().resize(onResize);  
}  
 
function shutdown(plot, eventHolder) {  
plot.getPlaceholder().unbind("resize", onResize);  
}  
 
plot.hooks.bindEvents.push(bindEvents);  
plot.hooks.shutdown.push(shutdown);  
}  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: 'resize',  
version: '1.0'  
});  
})(jQuery);  
 
(function(n,p,u){var w=n([]),s=n.resize=n.extend(n.resize,{}),o,l="setTimeout",m="resize",t=m+"-special-event",v="delay",r="throttleWindow";s[v]=250;s[r]=true;n.event.special[m]={setup:function(){if(!s[r]&&this[l]){return false}var a=n(this);w=w.add(a);n.data(this,t,{w:a.width(),h:a.height()});if(w.length===1){q()}},teardown:function(){if(!s[r]&&this[l]){return false}var a=n(this);w=w.not(a);a.removeData(t);if(!w.length){clearTimeout(o)}},add:function(b){if(!s[r]&&this[l]){return false}var c;function a(d,h,g){var f=n(this),e=n.data(this,t);e.w=h!==u?h:f.width();e.h=g!==u?g:f.height();c.apply(this,arguments)}if(n.isFunction(b)){c=b;return a}else{c=b.handler;b.handler=a}}};function q(){o=p[l](function(){w.each(function(){var d=n(this),a=d.width(),b=d.height(),c=n.data(this,t);if(a!==c.w||b!==c.h){d.trigger(m,[c.w=a,c.h=b])}});q()},s[v])}})(jQuery,this);(function(b){var a={};function c(f){function e(){var h=f.getPlaceholder();if(h.width()==0||h.height()==0){return}f.resize();f.setupGrid();f.draw()}function g(i,h){i.getPlaceholder().resize(e)}function d(i,h){i.getPlaceholder().unbind("resize",e)}f.hooks.bindEvents.push(g);f.hooks.shutdown.push(d)}b.plot.plugins.push({init:c,options:a,name:"resize",version:"1.0"})})(jQuery);  
/*  
Flot plugin for selecting regions.  
 
The plugin defines the following options:  
 
selection: {  
mode: null or "x" or "y" or "xy",  
color: color  
}  
 
Selection support is enabled by setting the mode to one of "x", "y" or  
"xy". In "x" mode, the user will only be able to specify the x range,  
similarly for "y" mode. For "xy", the selection becomes a rectangle  
where both ranges can be specified. "color" is color of the selection  
(if you need to change the color later on, you can get to it with  
plot.getOptions().selection.color).  
 
When selection support is enabled, a "plotselected" event will be  
emitted on the DOM element you passed into the plot function. The  
event handler gets a parameter with the ranges selected on the axes,  
like this:  
 
placeholder.bind("plotselected", function(event, ranges) {  
alert("You selected " + ranges.xaxis.from + " to " + ranges.xaxis.to)  
// similar for yaxis - with multiple axes, the extra ones are in  
// x2axis, x3axis, ...  
});  
 
The "plotselected" event is only fired when the user has finished  
making the selection. A "plotselecting" event is fired during the  
process with the same parameters as the "plotselected" event, in case  
you want to know what's happening while it's happening,  
 
A "plotunselected" event with no arguments is emitted when the user  
clicks the mouse to remove the selection.  
 
The plugin allso adds the following methods to the plot object:  
 
- setSelection(ranges, preventEvent)  
 
Set the selection rectangle. The passed in ranges is on the same  
form as returned in the "plotselected" event. If the selection mode  
is "x", you should put in either an xaxis range, if the mode is "y"  
you need to put in an yaxis range and both xaxis and yaxis if the  
selection mode is "xy", like this:  
 
setSelection({ xaxis: { from: 0, to: 10 }, yaxis: { from: 40, to: 60 } });  
 
setSelection will trigger the "plotselected" event when called. If  
you don't want that to happen, e.g. if you're inside a  
"plotselected" handler, pass true as the second parameter. If you  
are using multiple axes, you can specify the ranges on any of those,  
e.g. as x2axis/x3axis/... instead of xaxis, the plugin picks the  
first one it sees.  
 
- clearSelection(preventEvent)  
 
Clear the selection rectangle. Pass in true to avoid getting a  
"plotunselected" event.  
 
- getSelection()  
 
Returns the current selection in the same format as the  
"plotselected" event. If there's currently no selection, the  
function returns null.  
 
*/  
 
(function ($) {  
function init(plot) {  
var selection = {  
first: { x: -1, y: -1}, second: { x: -1, y: -1},  
show: false,  
active: false  
};  
 
// FIXME: The drag handling implemented here should be  
// abstracted out, there's some similar code from a library in  
// the navigation plugin, this should be massaged a bit to fit  
// the Flot cases here better and reused. Doing this would  
// make this plugin much slimmer.  
var savedhandlers = {};  
 
var mouseUpHandler = null;  
 
function onMouseMove(e) {  
if (selection.active) {  
updateSelection(e);  
 
plot.getPlaceholder().trigger("plotselecting", [ getSelection() ]);  
}  
}  
 
function onMouseDown(e) {  
if (e.which != 1) // only accept left-click  
return;  
 
// cancel out any text selections  
document.body.focus();  
 
// prevent text selection and drag in old-school browsers  
if (document.onselectstart !== undefined && savedhandlers.onselectstart == null) {  
savedhandlers.onselectstart = document.onselectstart;  
document.onselectstart = function () { return false; };  
}  
if (document.ondrag !== undefined && savedhandlers.ondrag == null) {  
savedhandlers.ondrag = document.ondrag;  
document.ondrag = function () { return false; };  
}  
 
setSelectionPos(selection.first, e);  
 
selection.active = true;  
 
// this is a bit silly, but we have to use a closure to be  
// able to whack the same handler again  
mouseUpHandler = function (e) { onMouseUp(e); };  
 
$(document).one("mouseup", mouseUpHandler);  
}  
 
function onMouseUp(e) {  
mouseUpHandler = null;  
 
// revert drag stuff for old-school browsers  
if (document.onselectstart !== undefined)  
document.onselectstart = savedhandlers.onselectstart;  
if (document.ondrag !== undefined)  
document.ondrag = savedhandlers.ondrag;  
 
// no more dragging  
selection.active = false;  
updateSelection(e);  
 
if (selectionIsSane())  
triggerSelectedEvent();  
else {  
// this counts as a clear  
plot.getPlaceholder().trigger("plotunselected", [ ]);  
plot.getPlaceholder().trigger("plotselecting", [ null ]);  
}  
 
return false;  
}  
 
function getSelection() {  
if (!selectionIsSane())  
return null;  
 
var r = {}, c1 = selection.first, c2 = selection.second;  
$.each(plot.getAxes(), function (name, axis) {  
if (axis.used) {  
var p1 = axis.c2p(c1[axis.direction]), p2 = axis.c2p(c2[axis.direction]);  
r[name] = { from: Math.min(p1, p2), to: Math.max(p1, p2) };  
}  
});  
return r;  
}  
 
function triggerSelectedEvent() {  
var r = getSelection();  
 
plot.getPlaceholder().trigger("plotselected", [ r ]);  
 
// backwards-compat stuff, to be removed in future  
if (r.xaxis && r.yaxis)  
plot.getPlaceholder().trigger("selected", [ { x1: r.xaxis.from, y1: r.yaxis.from, x2: r.xaxis.to, y2: r.yaxis.to } ]);  
}  
 
function clamp(min, value, max) {  
return value < min ? min: (value > max ? max: value);  
}  
 
function setSelectionPos(pos, e) {  
var o = plot.getOptions();  
var offset = plot.getPlaceholder().offset();  
var plotOffset = plot.getPlotOffset();  
pos.x = clamp(0, e.pageX - offset.left - plotOffset.left, plot.width());  
pos.y = clamp(0, e.pageY - offset.top - plotOffset.top, plot.height());  
 
if (o.selection.mode == "y")  
pos.x = pos == selection.first ? 0 : plot.width();  
 
if (o.selection.mode == "x")  
pos.y = pos == selection.first ? 0 : plot.height();  
}  
 
function updateSelection(pos) {  
if (pos.pageX == null)  
return;  
 
setSelectionPos(selection.second, pos);  
if (selectionIsSane()) {  
selection.show = true;  
plot.triggerRedrawOverlay();  
}  
else  
clearSelection(true);  
}  
 
function clearSelection(preventEvent) {  
if (selection.show) {  
selection.show = false;  
plot.triggerRedrawOverlay();  
if (!preventEvent)  
plot.getPlaceholder().trigger("plotunselected", [ ]);  
}  
}  
 
// function taken from markings support in Flot  
function extractRange(ranges, coord) {  
var axis, from, to, key, axes = plot.getAxes();  
 
for (var k in axes) {  
axis = axes[k];  
if (axis.direction == coord) {  
key = coord + axis.n + "axis";  
if (!ranges[key] && axis.n == 1)  
key = coord + "axis"; // support x1axis as xaxis  
if (ranges[key]) {  
from = ranges[key].from;  
to = ranges[key].to;  
break;  
}  
}  
}  
 
// backwards-compat stuff - to be removed in future  
if (!ranges[key]) {  
axis = coord == "x" ? plot.getXAxes()[0] : plot.getYAxes()[0];  
from = ranges[coord + "1"];  
to = ranges[coord + "2"];  
}  
 
// auto-reverse as an added bonus  
if (from != null && to != null && from > to) {  
var tmp = from;  
from = to;  
to = tmp;  
}  
 
return { from: from, to: to, axis: axis };  
}  
 
function setSelection(ranges, preventEvent) {  
var axis, range, o = plot.getOptions();  
 
if (o.selection.mode == "y") {  
selection.first.x = 0;  
selection.second.x = plot.width();  
}  
else {  
range = extractRange(ranges, "x");  
 
selection.first.x = range.axis.p2c(range.from);  
selection.second.x = range.axis.p2c(range.to);  
}  
 
if (o.selection.mode == "x") {  
selection.first.y = 0;  
selection.second.y = plot.height();  
}  
else {  
range = extractRange(ranges, "y");  
 
selection.first.y = range.axis.p2c(range.from);  
selection.second.y = range.axis.p2c(range.to);  
}  
 
selection.show = true;  
plot.triggerRedrawOverlay();  
if (!preventEvent && selectionIsSane())  
triggerSelectedEvent();  
}  
 
function selectionIsSane() {  
var minSize = 5;  
return Math.abs(selection.second.x - selection.first.x) >= minSize &&  
Math.abs(selection.second.y - selection.first.y) >= minSize;  
}  
 
plot.clearSelection = clearSelection;  
plot.setSelection = setSelection;  
plot.getSelection = getSelection;  
 
plot.hooks.bindEvents.push(function(plot, eventHolder) {  
var o = plot.getOptions();  
if (o.selection.mode != null) {  
eventHolder.mousemove(onMouseMove);  
eventHolder.mousedown(onMouseDown);  
}  
});  
 
 
plot.hooks.drawOverlay.push(function (plot, ctx) {  
// draw selection  
if (selection.show && selectionIsSane()) {  
var plotOffset = plot.getPlotOffset();  
var o = plot.getOptions();  
 
ctx.save();  
ctx.translate(plotOffset.left, plotOffset.top);  
 
var c = $.color.parse(o.selection.color);  
 
ctx.strokeStyle = c.scale('a', 0.8).toString();  
ctx.lineWidth = 1;  
ctx.lineJoin = "round";  
ctx.fillStyle = c.scale('a', 0.4).toString();  
 
var x = Math.min(selection.first.x, selection.second.x),  
y = Math.min(selection.first.y, selection.second.y),  
w = Math.abs(selection.second.x - selection.first.x),  
h = Math.abs(selection.second.y - selection.first.y);  
 
ctx.fillRect(x, y, w, h);  
ctx.strokeRect(x, y, w, h);  
 
ctx.restore();  
}  
});  
 
plot.hooks.shutdown.push(function (plot, eventHolder) {  
eventHolder.unbind("mousemove", onMouseMove);  
eventHolder.unbind("mousedown", onMouseDown);  
 
if (mouseUpHandler)  
$(document).unbind("mouseup", mouseUpHandler);  
});  
 
}  
 
$.plot.plugins.push({  
init: init,  
options: {  
selection: {  
mode: null, // one of null, "x", "y" or "xy"  
color: "#e8cfac"  
}  
},  
name: 'selection',  
version: '1.1'  
});  
})(jQuery);  
 
(function(a){function b(k){var p={first:{x:-1,y:-1},second:{x:-1,y:-1},show:false,active:false};var m={};var r=null;function e(s){if(p.active){l(s);k.getPlaceholder().trigger("plotselecting",[g()])}}function n(s){if(s.which!=1){return}document.body.focus();if(document.onselectstart!==undefined&&m.onselectstart==null){m.onselectstart=document.onselectstart;document.onselectstart=function(){return false}}if(document.ondrag!==undefined&&m.ondrag==null){m.ondrag=document.ondrag;document.ondrag=function(){return false}}d(p.first,s);p.active=true;r=function(t){j(t)};a(document).one("mouseup",r)}function j(s){r=null;if(document.onselectstart!==undefined){document.onselectstart=m.onselectstart}if(document.ondrag!==undefined){document.ondrag=m.ondrag}p.active=false;l(s);if(f()){i()}else{k.getPlaceholder().trigger("plotunselected",[]);k.getPlaceholder().trigger("plotselecting",[null])}return false}function g(){if(!f()){return null}var u={},t=p.first,s=p.second;a.each(k.getAxes(),function(v,w){if(w.used){var y=w.c2p(t[w.direction]),x=w.c2p(s[w.direction]);u[v]={from:Math.min(y,x),to:Math.max(y,x)}}});return u}function i(){var s=g();k.getPlaceholder().trigger("plotselected",[s]);if(s.xaxis&&s.yaxis){k.getPlaceholder().trigger("selected",[{x1:s.xaxis.from,y1:s.yaxis.from,x2:s.xaxis.to,y2:s.yaxis.to}])}}function h(t,u,s){return u<t?t:(u>s?s:u)}function d(w,t){var v=k.getOptions();var u=k.getPlaceholder().offset();var s=k.getPlotOffset();w.x=h(0,t.pageX-u.left-s.left,k.width());w.y=h(0,t.pageY-u.top-s.top,k.height());if(v.selection.mode=="y"){w.x=w==p.first?0:k.width()}if(v.selection.mode=="x"){w.y=w==p.first?0:k.height()}}function l(s){if(s.pageX==null){return}d(p.second,s);if(f()){p.show=true;k.triggerRedrawOverlay()}else{q(true)}}function q(s){if(p.show){p.show=false;k.triggerRedrawOverlay();if(!s){k.getPlaceholder().trigger("plotunselected",[])}}}function c(s,w){var t,y,z,A,x=k.getAxes();for(var u in x){t=x[u];if(t.direction==w){A=w+t.n+"axis";if(!s[A]&&t.n==1){A=w+"axis"}if(s[A]){y=s[A].from;z=s[A].to;break}}}if(!s[A]){t=w=="x"?k.getXAxes()[0]:k.getYAxes()[0];y=s[w+"1"];z=s[w+"2"]}if(y!=null&&z!=null&&y>z){var v=y;y=z;z=v}return{from:y,to:z,axis:t}}function o(t,s){var v,u,w=k.getOptions();if(w.selection.mode=="y"){p.first.x=0;p.second.x=k.width()}else{u=c(t,"x");p.first.x=u.axis.p2c(u.from);p.second.x=u.axis.p2c(u.to)}if(w.selection.mode=="x"){p.first.y=0;p.second.y=k.height()}else{u=c(t,"y");p.first.y=u.axis.p2c(u.from);p.second.y=u.axis.p2c(u.to)}p.show=true;k.triggerRedrawOverlay();if(!s&&f()){i()}}function f(){var s=5;return Math.abs(p.second.x-p.first.x)>=s&&Math.abs(p.second.y-p.first.y)>=s}k.clearSelection=q;k.setSelection=o;k.getSelection=g;k.hooks.bindEvents.push(function(t,s){var u=t.getOptions();if(u.selection.mode!=null){s.mousemove(e);s.mousedown(n)}});k.hooks.drawOverlay.push(function(v,D){if(p.show&&f()){var t=v.getPlotOffset();var s=v.getOptions();D.save();D.translate(t.left,t.top);var z=a.color.parse(s.selection.color);D.strokeStyle=z.scale("a",0.8).toString();D.lineWidth=1;D.lineJoin="round";D.fillStyle=z.scale("a",0.4).toString();var B=Math.min(p.first.x,p.second.x),A=Math.min(p.first.y,p.second.y),C=Math.abs(p.second.x-p.first.x),u=Math.abs(p.second.y-p.first.y);D.fillRect(B,A,C,u);D.strokeRect(B,A,C,u);D.restore()}});k.hooks.shutdown.push(function(t,s){s.unbind("mousemove",e);s.unbind("mousedown",n);if(r){a(document).unbind("mouseup",r)}})}a.plot.plugins.push({init:b,options:{selection:{mode:null,color:"#e8cfac"}},name:"selection",version:"1.1"})})(jQuery);  
/*  
Flot plugin for stacking data sets, i.e. putting them on top of each  
other, for accumulative graphs.  
 
The plugin assumes the data is sorted on x (or y if stacking  
horizontally). For line charts, it is assumed that if a line has an  
undefined gap (from a null point), then the line above it should have  
the same gap - insert zeros instead of "null" if you want another  
behaviour. This also holds for the start and end of the chart. Note  
that stacking a mix of positive and negative values in most instances  
doesn't make sense (so it looks weird).  
 
Two or more series are stacked when their "stack" attribute is set to  
the same key (which can be any number or string or just "true"). To  
specify the default stack, you can set  
 
series: {  
stack: null or true or key (number/string)  
}  
 
or specify it for a specific series  
 
$.plot($("#placeholder"), [{ data: [ ... ], stack: true }])  
 
The stacking order is determined by the order of the data series in  
the array (later series end up on top of the previous).  
 
Internally, the plugin modifies the datapoints in each series, adding  
an offset to the y value. For line series, extra data points are  
inserted through interpolation. If there's a second y value, it's also  
adjusted (e.g for bar charts or filled areas).  
*/  
 
(function ($) {  
var options = {  
series: { stack: null } // or number/string  
};  
 
function init(plot) {  
function findMatchingSeries(s, allseries) {  
var res = null  
for (var i = 0; i < allseries.length; ++i) {  
if (s == allseries[i])  
break;  
 
if (allseries[i].stack == s.stack)  
res = allseries[i];  
}  
 
return res;  
}  
 
function stackData(plot, s, datapoints) {  
if (s.stack == null)  
return;  
 
var other = findMatchingSeries(s, plot.getData());  
if (!other)  
return;  
 
var ps = datapoints.pointsize,  
points = datapoints.points,  
otherps = other.datapoints.pointsize,  
otherpoints = other.datapoints.points,  
newpoints = [],  
px, py, intery, qx, qy, bottom,  
withlines = s.lines.show,  
horizontal = s.bars.horizontal,  
withbottom = ps > 2 && (horizontal ? datapoints.format[2].x : datapoints.format[2].y),  
withsteps = withlines && s.lines.steps,  
fromgap = true,  
keyOffset = horizontal ? 1 : 0,  
accumulateOffset = horizontal ? 0 : 1,  
i = 0, j = 0, l;  
 
while (true) {  
if (i >= points.length)  
break;  
 
l = newpoints.length;  
 
if (points[i] == null) {  
// copy gaps  
for (m = 0; m < ps; ++m)  
newpoints.push(points[i + m]);  
i += ps;  
}  
else if (j >= otherpoints.length) {  
// for lines, we can't use the rest of the points  
if (!withlines) {  
for (m = 0; m < ps; ++m)  
newpoints.push(points[i + m]);  
}  
i += ps;  
}  
else if (otherpoints[j] == null) {  
// oops, got a gap  
for (m = 0; m < ps; ++m)  
newpoints.push(null);  
fromgap = true;  
j += otherps;  
}  
else {  
// cases where we actually got two points  
px = points[i + keyOffset];  
py = points[i + accumulateOffset];  
qx = otherpoints[j + keyOffset];  
qy = otherpoints[j + accumulateOffset];  
bottom = 0;  
 
if (px == qx) {  
for (m = 0; m < ps; ++m)  
newpoints.push(points[i + m]);  
 
newpoints[l + accumulateOffset] += qy;  
bottom = qy;  
 
i += ps;  
j += otherps;  
}  
else if (px > qx) {  
// we got past point below, might need to  
// insert interpolated extra point  
if (withlines && i > 0 && points[i - ps] != null) {  
intery = py + (points[i - ps + accumulateOffset] - py) * (qx - px) / (points[i - ps + keyOffset] - px);  
newpoints.push(qx);  
newpoints.push(intery + qy);  
for (m = 2; m < ps; ++m)  
newpoints.push(points[i + m]);  
bottom = qy;  
}  
 
j += otherps;  
}  
else { // px < qx  
if (fromgap && withlines) {  
// if we come from a gap, we just skip this point  
i += ps;  
continue;  
}  
 
for (m = 0; m < ps; ++m)  
newpoints.push(points[i + m]);  
 
// we might be able to interpolate a point below,  
// this can give us a better y  
if (withlines && j > 0 && otherpoints[j - otherps] != null)  
bottom = qy + (otherpoints[j - otherps + accumulateOffset] - qy) * (px - qx) / (otherpoints[j - otherps + keyOffset] - qx);  
 
newpoints[l + accumulateOffset] += bottom;  
 
i += ps;  
}  
 
fromgap = false;  
 
if (l != newpoints.length && withbottom)  
newpoints[l + 2] += bottom;  
}  
 
// maintain the line steps invariant  
if (withsteps && l != newpoints.length && l > 0  
&& newpoints[l] != null  
&& newpoints[l] != newpoints[l - ps]  
&& newpoints[l + 1] != newpoints[l - ps + 1]) {  
for (m = 0; m < ps; ++m)  
newpoints[l + ps + m] = newpoints[l + m];  
newpoints[l + 1] = newpoints[l - ps + 1];  
}  
}  
 
datapoints.points = newpoints;  
}  
 
plot.hooks.processDatapoints.push(stackData);  
}  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: 'stack',  
version: '1.2'  
});  
})(jQuery);  
 
(function(b){var a={series:{stack:null}};function c(f){function d(k,j){var h=null;for(var g=0;g<j.length;++g){if(k==j[g]){break}if(j[g].stack==k.stack){h=j[g]}}return h}function e(C,v,g){if(v.stack==null){return}var p=d(v,C.getData());if(!p){return}var z=g.pointsize,F=g.points,h=p.datapoints.pointsize,y=p.datapoints.points,t=[],x,w,k,J,I,r,u=v.lines.show,G=v.bars.horizontal,o=z>2&&(G?g.format[2].x:g.format[2].y),n=u&&v.lines.steps,E=true,q=G?1:0,H=G?0:1,D=0,B=0,A;while(true){if(D>=F.length){break}A=t.length;if(F[D]==null){for(m=0;m<z;++m){t.push(F[D+m])}D+=z}else{if(B>=y.length){if(!u){for(m=0;m<z;++m){t.push(F[D+m])}}D+=z}else{if(y[B]==null){for(m=0;m<z;++m){t.push(null)}E=true;B+=h}else{x=F[D+q];w=F[D+H];J=y[B+q];I=y[B+H];r=0;if(x==J){for(m=0;m<z;++m){t.push(F[D+m])}t[A+H]+=I;r=I;D+=z;B+=h}else{if(x>J){if(u&&D>0&&F[D-z]!=null){k=w+(F[D-z+H]-w)*(J-x)/(F[D-z+q]-x);t.push(J);t.push(k+I);for(m=2;m<z;++m){t.push(F[D+m])}r=I}B+=h}else{if(E&&u){D+=z;continue}for(m=0;m<z;++m){t.push(F[D+m])}if(u&&B>0&&y[B-h]!=null){r=I+(y[B-h+H]-I)*(x-J)/(y[B-h+q]-J)}t[A+H]+=r;D+=z}}E=false;if(A!=t.length&&o){t[A+2]+=r}}}}if(n&&A!=t.length&&A>0&&t[A]!=null&&t[A]!=t[A-z]&&t[A+1]!=t[A-z+1]){for(m=0;m<z;++m){t[A+z+m]=t[A+m]}t[A+1]=t[A-z+1]}}g.points=t}f.hooks.processDatapoints.push(e)}b.plot.plugins.push({init:c,options:a,name:"stack",version:"1.2"})})(jQuery);  
/*  
Flot plugin that adds some extra symbols for plotting points.  
 
The symbols are accessed as strings through the standard symbol  
choice:  
 
series: {  
points: {  
symbol: "square" // or "diamond", "triangle", "cross"  
}  
}  
 
*/  
 
(function ($) {  
function processRawData(plot, series, datapoints) {  
// we normalize the area of each symbol so it is approximately the  
// same as a circle of the given radius  
 
var handlers = {  
square: function (ctx, x, y, radius, shadow) {  
// pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2  
var size = radius * Math.sqrt(Math.PI) / 2;  
ctx.rect(x - size, y - size, size + size, size + size);  
},  
diamond: function (ctx, x, y, radius, shadow) {  
// pi * r^2 = 2s^2 => s = r * sqrt(pi/2)  
var size = radius * Math.sqrt(Math.PI / 2);  
ctx.moveTo(x - size, y);  
ctx.lineTo(x, y - size);  
ctx.lineTo(x + size, y);  
ctx.lineTo(x, y + size);  
ctx.lineTo(x - size, y);  
},  
triangle: function (ctx, x, y, radius, shadow) {  
// pi * r^2 = 1/2 * s^2 * sin (pi / 3) => s = r * sqrt(2 * pi / sin(pi / 3))  
var size = radius * Math.sqrt(2 * Math.PI / Math.sin(Math.PI / 3));  
var height = size * Math.sin(Math.PI / 3);  
ctx.moveTo(x - size/2, y + height/2);  
ctx.lineTo(x + size/2, y + height/2);  
if (!shadow) {  
ctx.lineTo(x, y - height/2);  
ctx.lineTo(x - size/2, y + height/2);  
}  
},  
cross: function (ctx, x, y, radius, shadow) {  
// pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2  
var size = radius * Math.sqrt(Math.PI) / 2;  
ctx.moveTo(x - size, y - size);  
ctx.lineTo(x + size, y + size);  
ctx.moveTo(x - size, y + size);  
ctx.lineTo(x + size, y - size);  
}  
}  
 
var s = series.points.symbol;  
if (handlers[s])  
series.points.symbol = handlers[s];  
}  
 
function init(plot) {  
plot.hooks.processDatapoints.push(processRawData);  
}  
 
$.plot.plugins.push({  
init: init,  
name: 'symbols',  
version: '1.0'  
});  
})(jQuery);  
 
(function(b){function a(h,e,g){var d={square:function(k,j,n,i,m){var l=i*Math.sqrt(Math.PI)/2;k.rect(j-l,n-l,l+l,l+l)},diamond:function(k,j,n,i,m){var l=i*Math.sqrt(Math.PI/2);k.moveTo(j-l,n);k.lineTo(j,n-l);k.lineTo(j+l,n);k.lineTo(j,n+l);k.lineTo(j-l,n)},triangle:function(l,k,o,j,n){var m=j*Math.sqrt(2*Math.PI/Math.sin(Math.PI/3));var i=m*Math.sin(Math.PI/3);l.moveTo(k-m/2,o+i/2);l.lineTo(k+m/2,o+i/2);if(!n){l.lineTo(k,o-i/2);l.lineTo(k-m/2,o+i/2)}},cross:function(k,j,n,i,m){var l=i*Math.sqrt(Math.PI)/2;k.moveTo(j-l,n-l);k.lineTo(j+l,n+l);k.moveTo(j-l,n+l);k.lineTo(j+l,n-l)}};var f=e.points.symbol;if(d[f]){e.points.symbol=d[f]}}function c(d){d.hooks.processDatapoints.push(a)}b.plot.plugins.push({init:c,name:"symbols",version:"1.0"})})(jQuery);  
/*  
Flot plugin for thresholding data. Controlled through the option  
"threshold" in either the global series options  
 
series: {  
threshold: {  
below: number  
color: colorspec  
}  
}  
 
or in a specific series  
 
$.plot($("#placeholder"), [{ data: [ ... ], threshold: { ... }}])  
 
The data points below "below" are drawn with the specified color. This  
makes it easy to mark points below 0, e.g. for budget data.  
 
Internally, the plugin works by splitting the data into two series,  
above and below the threshold. The extra series below the threshold  
will have its label cleared and the special "originSeries" attribute  
set to the original series. You may need to check for this in hover  
events.  
*/  
 
(function ($) {  
var options = {  
series: { threshold: null } // or { below: number, color: color spec}  
};  
 
function init(plot) {  
function thresholdData(plot, s, datapoints) {  
if (!s.threshold)  
return;  
 
var ps = datapoints.pointsize, i, x, y, p, prevp,  
thresholded = $.extend({}, s); // note: shallow copy  
 
thresholded.datapoints = { points: [], pointsize: ps };  
thresholded.label = null;  
thresholded.color = s.threshold.color;  
thresholded.threshold = null;  
thresholded.originSeries = s;  
thresholded.data = [];  
 
var below = s.threshold.below,  
origpoints = datapoints.points,  
addCrossingPoints = s.lines.show;  
 
threspoints = [];  
newpoints = [];  
 
for (i = 0; i < origpoints.length; i += ps) {  
x = origpoints[i]  
y = origpoints[i + 1];  
 
prevp = p;  
if (y < below)  
p = threspoints;  
else  
p = newpoints;  
 
if (addCrossingPoints && prevp != p && x != null  
&& i > 0 && origpoints[i - ps] != null) {  
var interx = (x - origpoints[i - ps]) / (y - origpoints[i - ps + 1]) * (below - y) + x;  
prevp.push(interx);  
prevp.push(below);  
for (m = 2; m < ps; ++m)  
prevp.push(origpoints[i + m]);  
 
p.push(null); // start new segment  
p.push(null);  
for (m = 2; m < ps; ++m)  
p.push(origpoints[i + m]);  
p.push(interx);  
p.push(below);  
for (m = 2; m < ps; ++m)  
p.push(origpoints[i + m]);  
}  
 
p.push(x);  
p.push(y);  
}  
 
datapoints.points = newpoints;  
thresholded.datapoints.points = threspoints;  
 
if (thresholded.datapoints.points.length > 0)  
plot.getData().push(thresholded);  
 
// FIXME: there are probably some edge cases left in bars  
}  
 
plot.hooks.processDatapoints.push(thresholdData);  
}  
 
$.plot.plugins.push({  
init: init,  
options: options,  
name: 'threshold',  
version: '1.0'  
});  
})(jQuery);  
 
(function(B){var A={series:{threshold:null}};function C(D){function E(L,S,M){if(!S.threshold){return }var F=M.pointsize,I,O,N,G,K,H=B.extend({},S);H.datapoints={points:[],pointsize:F};H.label=null;H.color=S.threshold.color;H.threshold=null;H.originSeries=S;H.data=[];var P=S.threshold.below,Q=M.points,R=S.lines.show;threspoints=[];newpoints=[];for(I=0;I<Q.length;I+=F){O=Q[I];N=Q[I+1];K=G;if(N<P){G=threspoints}else{G=newpoints}if(R&&K!=G&&O!=null&&I>0&&Q[I-F]!=null){var J=(O-Q[I-F])/(N-Q[I-F+1])*(P-N)+O;K.push(J);K.push(P);for(m=2;m<F;++m){K.push(Q[I+m])}G.push(null);G.push(null);for(m=2;m<F;++m){G.push(Q[I+m])}G.push(J);G.push(P);for(m=2;m<F;++m){G.push(Q[I+m])}}G.push(O);G.push(N)}M.points=newpoints;H.datapoints.points=threspoints;if(H.datapoints.points.length>0){L.getData().push(H)}}D.hooks.processDatapoints.push(E)}B.plot.plugins.push({init:C,options:A,name:"threshold",version:"1.0"})})(jQuery);  
directory:b/js/flotr2 (new)
 
file:a/js/jquery-1.6.4.min.js (deleted)
/*! jQuery v1.6.4 http://jquery.com/ | http://jquery.org/license */  
(function(a,b){function cu(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cr(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cq(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cp(){cn=b}function co(){setTimeout(cp,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bA.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bW(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bP,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bW(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bW(a,c,d,e,"*",g));return l}function bV(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bL),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function by(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bt:bu;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bv(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bd,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bf(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function V(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(Q.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function U(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function M(a,b){return(a&&a!=="*"?a+".":"")+b.replace(y,"`").replace(z,"&")}function L(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(w,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function J(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function D(){return!0}function C(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.4",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;B.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:H?function(a){return a==null?"":H.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?F.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(!b)return-1;if(I)return I.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=G.call(arguments,2),g=function(){return a.apply(c,f.concat(G.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){J["[object "+b+"]"]=b.toLowerCase()}),A=e.uaMatch(z),A.browser&&(e.browser[A.browser]=!0,e.browser.version=A.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?C=function(){c.removeEventListener("DOMContentLoaded",C,!1),e.ready()}:c.attachEvent&&(C=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",C),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g+"With"](this===b?d:this,[h])}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-1000px",top:"-1000px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i=f.expando,j=typeof c=="string",k=a.nodeType,l=k?f.cache:a,m=k?a[f.expando]:a[f.expando]&&f.expando;if((!m||e&&m&&l[m]&&!l[m][i])&&j&&d===b)return;m||(k?a[f.expando]=m=++f.uuid:m=f.expando),l[m]||(l[m]={},k||(l[m].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?l[m][i]=f.extend(l[m][i],c):l[m]=f.extend(l[m],c);g=l[m],e&&(g[i]||(g[i]={}),g=g[i]),d!==b&&(g[f.camelCase(c)]=d);if(c==="events"&&!g[c])return g[i]&&g[i].events;j?(h=g[c],h==null&&(h=g[f.camelCase(c)])):h=g;return h}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e=f.expando,g=a.nodeType,h=g?f.cache:a,i=g?a[f.expando]:f.expando;if(!h[i])return;if(b){d=c?h[i][e]:h[i];if(d){d[b]||(b=f.camelCase(b)),delete d[b];if(!l(d))return}}if(c){delete h[i][e];if(!l(h[i]))return}var j=h[i][e];f.support.deleteExpando||!h.setInterval?delete h[i]:h[i]=null,j?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=j):g&&(f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u,v;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=v:u&&(i=u)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.attr(a,b,""),a.removeAttribute(b),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(u&&f.nodeName(a,"button"))return u.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(u&&f.nodeName(a,"button"))return u.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==null?g:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabIndex=f.propHooks.tabIndex,v={get:function(a,c){var d;return f.prop(a,c)===!0||(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(u=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=/\.(.*)$/,x=/^(?:textarea|input|select)$/i,y=/\./g,z=/ /g,A=/[^\w\s.|`]/g,B=function(a){return a.replace(A,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=C;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=C);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),B).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete  
t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,M(a.origType,a.selector),f.extend({},a,{handler:L,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,M(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?D:C):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=D;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=D;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=D,this.stopPropagation()},isDefaultPrevented:C,isPropagationStopped:C,isImmediatePropagationStopped:C};var E=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},F=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?F:E,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?F:E)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="submit"||c==="image")&&f(b).closest("form").length&&J("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&J("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var G,H=function(a){var b=f.nodeName(a,"input")?a.type:"",c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},I=function(c){var d=c.target,e,g;if(!!x.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=H(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:I,beforedeactivate:I,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&I.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&I.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",H(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in G)f.event.add(this,c+".specialChange",G[c]);return x.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return x.test(this.nodeName)}},G=f.event.special.change.filters,G.focus=G.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var K={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||C,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=w.exec(h),k="",j&&(k=j[0],h=h.replace(w,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,K[h]?(a.push(K[h]+k),h=h+k):h=(K[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+M(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+M(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var N=/Until$/,O=/^(?:parents|prevUntil|prevAll)/,P=/,/,Q=/^.[^:#\[\.,]*$/,R=Array.prototype.slice,S=f.expr.match.POS,T={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(V(this,a,!1),"not",a)},filter:function(a){return this.pushStack(V(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=S.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=S.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(U(c[0])||U(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=R.call(arguments);N.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!T[a]?f.unique(e):e,(this.length>1||P.test(d))&&O.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|object|embed|option|style)/i,bb=/checked\s*(?:[^=]|=\s*.checked.)/i,bc=/\/(java|ecma)script/i,bd=/^\s*<!(?:\[CDATA\[|\-\-)/,be={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!be[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bb.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bf(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bl)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i;b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!ba.test(a[0])&&(f.support.checkClone||!bb.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean  
(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)g[h]&&bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=be[l]||be._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bk(k[i]);else bk(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bc.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bm=/alpha\([^)]*\)/i,bn=/opacity=([^)]*)/,bo=/([A-Z]|^ms)/g,bp=/^-?\d+(?:px)?$/i,bq=/^-?\d/,br=/^([\-+])=([\-+.\de]+)/,bs={position:"absolute",visibility:"hidden",display:"block"},bt=["Left","Right"],bu=["Top","Bottom"],bv,bw,bx;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bv(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=br.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bv)return bv(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return by(a,b,d);f.swap(a,bs,function(){e=by(a,b,d)});return e}},set:function(a,b){if(!bp.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bm,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bv(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bw=function(a,c){var d,e,g;c=c.replace(bo,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bx=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bp.test(d)&&bq.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bv=bw||bx,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bz=/%20/g,bA=/\[\]$/,bB=/\r?\n/g,bC=/#.*$/,bD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bE=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bF=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bG=/^(?:GET|HEAD)$/,bH=/^\/\//,bI=/\?/,bJ=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bK=/^(?:select|textarea)/i,bL=/\s+/,bM=/([?&])_=[^&]*/,bN=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bO=f.fn.load,bP={},bQ={},bR,bS,bT=["*/"]+["*"];try{bR=e.href}catch(bU){bR=c.createElement("a"),bR.href="",bR=bR.href}bS=bN.exec(bR.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bO)return bO.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bJ,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bK.test(this.nodeName)||bE.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bB,"\r\n")}}):{name:b.name,value:c.replace(bB,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?bX(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),bX(a,b);return a},ajaxSettings:{url:bR,isLocal:bF.test(bS[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bT},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bV(bP),ajaxTransport:bV(bQ),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?bZ(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=b$(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bD.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bC,"").replace(bH,bS[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bL),d.crossDomain==null&&(r=bN.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bS[1]&&r[2]==bS[2]&&(r[3]||(r[1]==="http:"?80:443))==(bS[3]||(bS[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bW(bP,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bG.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bI.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bM,"$1_="+x);d.url=y+(y===d.url?(bI.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bT+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bW(bQ,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bz,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cq("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cr(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cq("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cq("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cr(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cj.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=ck.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cq("show",1),slideUp:cq("hide",1),slideToggle:cq("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return d.step(a)}var d=this,e=f.fx;this.startTime=cn||co(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&f.timers.push(g)&&!cl&&(cl=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cn||co(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cl),cl=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cs=/^t(?:able|d|h)$/i,ct=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cu(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cs.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=ct.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!ct.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cu(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cu(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNaN(j)?i:j}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);  
/*! jQuery Mobile v1.0rc2 jquerymobile.com | jquery.org/license */  
(function(a,e){if(a.cleanData){var b=a.cleanData;a.cleanData=function(f){for(var d=0,c;(c=f[d])!=null;d++)a(c).triggerHandler("remove");b(f)}}else{var c=a.fn.remove;a.fn.remove=function(b,d){return this.each(function(){d||(!b||a.filter(b,[this]).length)&&a("*",this).add([this]).each(function(){a(this).triggerHandler("remove")});return c.call(a(this),b,d)})}}a.widget=function(b,d,c){var e=b.split(".")[0],i,b=b.split(".")[1];i=e+"-"+b;if(!c)c=d,d=a.Widget;a.expr[":"][i]=function(d){return!!a.data(d,  
b)};a[e]=a[e]||{};a[e][b]=function(a,b){arguments.length&&this._createWidget(a,b)};d=new d;d.options=a.extend(true,{},d.options);a[e][b].prototype=a.extend(true,d,{namespace:e,widgetName:b,widgetEventPrefix:a[e][b].prototype.widgetEventPrefix||b,widgetBaseClass:i},c);a.widget.bridge(b,a[e][b])};a.widget.bridge=function(b,d){a.fn[b]=function(c){var h=typeof c==="string",i=Array.prototype.slice.call(arguments,1),k=this,c=!h&&i.length?a.extend.apply(null,[true,c].concat(i)):c;if(h&&c.charAt(0)==="_")return k;  
h?this.each(function(){var d=a.data(this,b);if(!d)throw"cannot call methods on "+b+" prior to initialization; attempted to call method '"+c+"'";if(!a.isFunction(d[c]))throw"no such method '"+c+"' for "+b+" widget instance";var h=d[c].apply(d,i);if(h!==d&&h!==e)return k=h,false}):this.each(function(){var e=a.data(this,b);e?e.option(c||{})._init():a.data(this,b,new d(c,this))});return k}};a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)};a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",  
options:{disabled:false},_createWidget:function(b,d){a.data(d,this.widgetName,this);this.element=a(d);this.options=a.extend(true,{},this.options,this._getCreateOptions(),b);var c=this;this.element.bind("remove."+this.widgetName,function(){c.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){var b={};a.metadata&&(b=a.metadata.get(element)[this.widgetName]);return b},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);  
this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(b,d){var c=b;if(arguments.length===0)return a.extend({},this.options);if(typeof b==="string"){if(d===e)return this.options[b];c={};c[b]=d}this._setOptions(c);return this},_setOptions:function(b){var d=this;a.each(b,function(a,b){d._setOption(a,b)});return this},_setOption:function(a,b){this.options[a]=b;a==="disabled"&&  
this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",b);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(b,d,c){var e=this.options[b],d=a.Event(d);d.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase();c=c||{};if(d.originalEvent)for(var b=a.event.props.length,i;b;)i=a.event.props[--b],d[i]=d.originalEvent[i];this.element.trigger(d,  
c);return!(a.isFunction(e)&&e.call(this.element[0],d,c)===false||d.isDefaultPrevented())}}})(jQuery);  
(function(a,e){a.widget("mobile.widget",{_createWidget:function(){a.Widget.prototype._createWidget.apply(this,arguments);this._trigger("init")},_getCreateOptions:function(){var b=this.element,c={};a.each(this.options,function(a){var d=b.jqmData(a.replace(/[A-Z]/g,function(a){return"-"+a.toLowerCase()}));d!==e&&(c[a]=d)});return c},enhanceWithin:function(b){var c=a(b).closest(":jqmData(role='page')").data("page"),c=c&&c.keepNativeSelector()||"";a(this.options.initSelector,b).not(c)[this.widgetName]()}})})(jQuery);  
(function(a){a(window);var e=a("html");a.mobile.media=function(){var b={},c=a("<div id='jquery-mediatest'>"),f=a("<body>").append(c);return function(a){if(!(a in b)){var g=document.createElement("style"),h="@media "+a+" { #jquery-mediatest { position:absolute; } }";g.type="text/css";g.styleSheet?g.styleSheet.cssText=h:g.appendChild(document.createTextNode(h));e.prepend(f).prepend(g);b[a]=c.css("position")==="absolute";f.add(g).remove()}return b[a]}}()})(jQuery);  
(function(a,e){function b(a){var b=a.charAt(0).toUpperCase()+a.substr(1),a=(a+" "+d.join(b+" ")+b).split(" "),c;for(c in a)if(f[a[c]]!==e)return true}var c=a("<body>").prependTo("html"),f=c[0].style,d=["Webkit","Moz","O"],g="palmGetResource"in window,h=window.blackberry;a.mobile.browser={};a.mobile.browser.ie=function(){for(var a=3,b=document.createElement("div"),d=b.all||[];b.innerHTML="<\!--[if gt IE "+ ++a+"]><br><![endif]--\>",d[0];);return a>4?a:!a}();a.extend(a.support,{orientation:"orientation"in  
window&&"onorientationchange"in window,touch:"ontouchend"in document,cssTransitions:"WebKitTransitionEvent"in window,pushState:"pushState"in history&&"replaceState"in history,mediaquery:a.mobile.media("only all"),cssPseudoElement:!!b("content"),touchOverflow:!!b("overflowScrolling"),boxShadow:!!b("boxShadow")&&!h,scrollTop:("pageXOffset"in window||"scrollTop"in document.documentElement||"scrollTop"in c[0])&&!g,dynamicBaseTag:function(){var b=location.protocol+"//"+location.host+location.pathname+  
"ui-dir/",d=a("head base"),f=null,e="",g;d.length?e=d.attr("href"):d=f=a("<base>",{href:b}).appendTo("head");g=a("<a href='testurl' />").prependTo(c)[0].href;d[0].href=e||location.pathname;f&&f.remove();return g.indexOf(b)===0}()});c.remove();g=function(){var a=window.navigator.userAgent;return a.indexOf("Nokia")>-1&&(a.indexOf("Symbian/3")>-1||a.indexOf("Series60/5")>-1)&&a.indexOf("AppleWebKit")>-1&&a.match(/(BrowserNG|NokiaBrowser)\/7\.[0-3]/)}();a.mobile.ajaxBlacklist=window.blackberry&&!window.WebKitPoint||  
window.operamini&&Object.prototype.toString.call(window.operamini)==="[object OperaMini]"||g;g&&a(function(){a("head link[rel='stylesheet']").attr("rel","alternate stylesheet").attr("rel","stylesheet")});a.support.boxShadow||a("html").addClass("ui-mobile-nosupport-boxshadow")})(jQuery);  
(function(a,e,b,c){function f(a){for(;a&&typeof a.originalEvent!=="undefined";)a=a.originalEvent;return a}function d(b){for(var d={},f,c;b;){f=a.data(b,n);for(c in f)if(f[c])d[c]=d.hasVirtualBinding=true;b=b.parentNode}return d}function g(){v&&(clearTimeout(v),v=0);v=setTimeout(function(){E=v=0;u.length=0;D=false;y=true},a.vmouse.resetTimerDuration)}function h(b,d,s){var e,g;if(!(g=s&&s[b])){if(s=!s)a:{for(s=d.target;s;){if((g=a.data(s,n))&&(!b||g[b]))break a;s=s.parentNode}s=null}g=s}if(g){e=d;var s=  
e.type,j,i;e=a.Event(e);e.type=b;g=e.originalEvent;j=a.event.props;if(g)for(i=j.length;i;)b=j[--i],e[b]=g[b];if(s.search(/mouse(down|up)|click/)>-1&&!e.which)e.which=1;if(s.search(/^touch/)!==-1&&(b=f(g),s=b.touches,b=b.changedTouches,s=s&&s.length?s[0]:b&&b.length?b[0]:c))for(g=0,len=z.length;g<len;g++)b=z[g],e[b]=s[b];a(d.target).trigger(e)}return e}function i(b){var d=a.data(b.target,A);if(!D&&(!E||E!==d))if(d=h("v"+b.type,b))d.isDefaultPrevented()&&b.preventDefault(),d.isPropagationStopped()&&  
b.stopPropagation(),d.isImmediatePropagationStopped()&&b.stopImmediatePropagation()}function k(b){var c=f(b).touches,e;if(c&&c.length===1&&(e=b.target,c=d(e),c.hasVirtualBinding))E=s++,a.data(e,A,E),v&&(clearTimeout(v),v=0),w=y=false,e=f(b).touches[0],x=e.pageX,r=e.pageY,h("vmouseover",b,c),h("vmousedown",b,c)}function m(a){y||(w||h("vmousecancel",a,d(a.target)),w=true,g())}function q(b){if(!y){var c=f(b).touches[0],s=w,e=a.vmouse.moveDistanceThreshold;w=w||Math.abs(c.pageX-x)>e||Math.abs(c.pageY-  
r)>e;flags=d(b.target);w&&!s&&h("vmousecancel",b,flags);h("vmousemove",b,flags);g()}}function o(a){if(!y){y=true;var b=d(a.target),c;h("vmouseup",a,b);if(!w&&(c=h("vclick",a,b))&&c.isDefaultPrevented())c=f(a).changedTouches[0],u.push({touchID:E,x:c.clientX,y:c.clientY}),D=true;h("vmouseout",a,b);w=false;g()}}function l(b){var b=a.data(b,n),d;if(b)for(d in b)if(b[d])return true;return false}function j(){}function p(b){var d=b.substr(1);return{setup:function(){l(this)||a.data(this,n,{});a.data(this,  
n)[b]=true;t[b]=(t[b]||0)+1;t[b]===1&&B.bind(d,i);a(this).bind(d,j);if(C)t.touchstart=(t.touchstart||0)+1,t.touchstart===1&&B.bind("touchstart",k).bind("touchend",o).bind("touchmove",q).bind("scroll",m)},teardown:function(){--t[b];t[b]||B.unbind(d,i);C&&(--t.touchstart,t.touchstart||B.unbind("touchstart",k).unbind("touchmove",q).unbind("touchend",o).unbind("scroll",m));var c=a(this),f=a.data(this,n);f&&(f[b]=false);c.unbind(d,j);l(this)||c.removeData(n)}}}var n="virtualMouseBindings",A="virtualTouchID",  
e="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),z="clientX clientY pageX pageY screenX screenY".split(" "),t={},v=0,x=0,r=0,w=false,u=[],D=false,y=false,C="addEventListener"in b,B=a(b),s=1,E=0;a.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(var F=0;F<e.length;F++)a.event.special[e[F]]=p(e[F]);C&&b.addEventListener("click",function(b){var d=u.length,c=b.target,f,s,e,g,j;if(d){f=b.clientX;s=b.clientY;threshold=a.vmouse.clickDistanceThreshold;  
for(e=c;e;){for(g=0;g<d;g++)if(j=u[g],e===c&&Math.abs(j.x-f)<threshold&&Math.abs(j.y-s)<threshold||a.data(e,A)===j.touchID){b.preventDefault();b.stopPropagation();return}e=e.parentNode}}},true)})(jQuery,window,document);  
(function(a,e,b){function c(b,d,c){var f=c.type;c.type=d;a.event.handle.call(b,c);c.type=f}a.each("touchstart touchmove touchend orientationchange throttledresize tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(b,d){a.fn[d]=function(a){return a?this.bind(d,a):this.trigger(d)};a.attrFn[d]=true});var f=a.support.touch,d=f?"touchstart":"mousedown",g=f?"touchend":"mouseup",h=f?"touchmove":"mousemove";a.event.special.scrollstart={enabled:true,setup:function(){function b(a,  
e){f=e;c(d,f?"scrollstart":"scrollstop",a)}var d=this,f,e;a(d).bind("touchmove scroll",function(d){a.event.special.scrollstart.enabled&&(f||b(d,true),clearTimeout(e),e=setTimeout(function(){b(d,false)},50))})}};a.event.special.tap={setup:function(){var b=this,d=a(b);d.bind("vmousedown",function(f){function e(){clearTimeout(p)}function g(){e();d.unbind("vclick",h).unbind("vmouseup",e).unbind("vmousecancel",g)}function h(a){g();j==a.target&&c(b,"tap",a)}if(f.which&&f.which!==1)return false;var j=f.target,  
p;d.bind("vmousecancel",g).bind("vmouseup",e).bind("vclick",h);p=setTimeout(function(){c(b,"taphold",a.Event("taphold"))},750)})}};a.event.special.swipe={scrollSupressionThreshold:10,durationThreshold:1E3,horizontalDistanceThreshold:30,verticalDistanceThreshold:75,setup:function(){var c=a(this);c.bind(d,function(d){function f(b){if(o){var d=b.originalEvent.touches?b.originalEvent.touches[0]:b;l={time:(new Date).getTime(),coords:[d.pageX,d.pageY]};Math.abs(o.coords[0]-l.coords[0])>a.event.special.swipe.scrollSupressionThreshold&&  
b.preventDefault()}}var e=d.originalEvent.touches?d.originalEvent.touches[0]:d,o={time:(new Date).getTime(),coords:[e.pageX,e.pageY],origin:a(d.target)},l;c.bind(h,f).one(g,function(){c.unbind(h,f);o&&l&&l.time-o.time<a.event.special.swipe.durationThreshold&&Math.abs(o.coords[0]-l.coords[0])>a.event.special.swipe.horizontalDistanceThreshold&&Math.abs(o.coords[1]-l.coords[1])<a.event.special.swipe.verticalDistanceThreshold&&o.origin.trigger("swipe").trigger(o.coords[0]>l.coords[0]?"swipeleft":"swiperight");  
o=l=b})})}};(function(a,b){function d(){var a=f();a!==e&&(e=a,c.trigger("orientationchange"))}var c=a(b),f,e;a.event.special.orientationchange={setup:function(){if(a.support.orientation&&a.mobile.orientationChangeEnabled)return false;e=f();c.bind("throttledresize",d)},teardown:function(){if(a.support.orientation&&a.mobile.orientationChangeEnabled)return false;c.unbind("throttledresize",d)},add:function(a){var b=a.handler;a.handler=function(a){a.orientation=f();return b.apply(this,arguments)}}};a.event.special.orientationchange.orientation=  
f=function(){var d=true,d=document.documentElement;return(d=a.support.orientation?b.orientation%180==0:d&&d.clientWidth/d.clientHeight<1.1)?"portrait":"landscape"}})(jQuery,e);(function(){a.event.special.throttledresize={setup:function(){a(this).bind("resize",b)},teardown:function(){a(this).unbind("resize",b)}};var b=function(){f=(new Date).getTime();e=f-d;e>=250?(d=f,a(this).trigger("throttledresize")):(c&&clearTimeout(c),c=setTimeout(b,250-e))},d=0,c,f,e})();a.each({scrollstop:"scrollstart",taphold:"tap",  
swipeleft:"swipe",swiperight:"swipe"},function(b,d){a.event.special[b]={setup:function(){a(this).bind(d,a.noop)}}})})(jQuery,this);  
(function(a,e,b){function c(a){a=a||location.href;return"#"+a.replace(/^[^#]*#?(.*)$/,"$1")}var f="hashchange",d=document,g,h=a.event.special,i=d.documentMode,k="on"+f in e&&(i===b||i>7);a.fn[f]=function(a){return a?this.bind(f,a):this.trigger(f)};a.fn[f].delay=50;h[f]=a.extend(h[f],{setup:function(){if(k)return false;a(g.start)},teardown:function(){if(k)return false;a(g.stop)}});g=function(){function g(){var b=c(),d=n(l);if(b!==l)p(l=b,d),a(e).trigger(f);else if(d!==l)location.href=location.href.replace(/#.*/,  
"")+d;i=setTimeout(g,a.fn[f].delay)}var h={},i,l=c(),j=function(a){return a},p=j,n=j;h.start=function(){i||g()};h.stop=function(){i&&clearTimeout(i);i=b};a.browser.msie&&!k&&function(){var b,e;h.start=function(){if(!b)e=(e=a.fn[f].src)&&e+c(),b=a('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){e||p(c());g()}).attr("src",e||"javascript:0").insertAfter("body")[0].contentWindow,d.onpropertychange=function(){try{if(event.propertyName==="title")b.document.title=d.title}catch(a){}}};  
h.stop=j;n=function(){return c(b.location.href)};p=function(c,e){var g=b.document,h=a.fn[f].domain;if(c!==e)g.title=d.title,g.open(),h&&g.write('<script>document.domain="'+h+'"<\/script>'),g.close(),b.location.hash=c}}();return h}()})(jQuery,this);  
(function(a){a.widget("mobile.page",a.mobile.widget,{options:{theme:"c",domCache:false,keepNativeDefault:":jqmData(role='none'), :jqmData(role='nojs')"},_create:function(){this._trigger("beforecreate");this.element.attr("tabindex","0").addClass("ui-page ui-body-"+this.options.theme)},keepNativeSelector:function(){var e=this.options;return e.keepNative&&a.trim(e.keepNative)&&e.keepNative!==e.keepNativeDefault?[e.keepNative,e.keepNativeDefault].join(", "):e.keepNativeDefault}})})(jQuery);  
(function(a,e){var b={};a.extend(a.mobile,{ns:"",subPageUrlKey:"ui-page",activePageClass:"ui-page-active",activeBtnClass:"ui-btn-active",ajaxEnabled:true,hashListeningEnabled:true,linkBindingEnabled:true,defaultPageTransition:"slide",minScrollBack:250,defaultDialogTransition:"pop",loadingMessage:"loading",pageLoadErrorMessage:"Error Loading Page",autoInitializePage:true,pushStateEnabled:true,orientationChangeEnabled:true,gradeA:function(){return a.support.mediaquery||a.mobile.browser.ie&&a.mobile.browser.ie>=  
7},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},silentScroll:function(b){if(a.type(b)!=="number")b=a.mobile.defaultHomeScroll;a.event.special.scrollstart.enabled=false;  
setTimeout(function(){e.scrollTo(0,b);a(document).trigger("silentscroll",{x:0,y:b})},20);setTimeout(function(){a.event.special.scrollstart.enabled=true},150)},nsNormalizeDict:b,nsNormalize:function(d){return!d?void 0:b[d]||(b[d]=a.camelCase(a.mobile.ns+d))},getInheritedTheme:function(a,b){for(var c=a[0],f="",e=/ui-(bar|body)-([a-z])\b/,m,q;c;){m=c.className||"";if((q=e.exec(m))&&(f=q[2]))break;c=c.parentNode}return f||b||"a"}});a.fn.jqmData=function(b,c){var f;typeof b!="undefined"&&(f=this.data(b?  
a.mobile.nsNormalize(b):b,c));return f};a.jqmData=function(b,c,f){var e;typeof c!="undefined"&&(e=a.data(b,c?a.mobile.nsNormalize(c):c,f));return e};a.fn.jqmRemoveData=function(b){return this.removeData(a.mobile.nsNormalize(b))};a.jqmRemoveData=function(b,c){return a.removeData(b,a.mobile.nsNormalize(c))};a.fn.removeWithDependents=function(){a.removeWithDependents(this)};a.removeWithDependents=function(b){b=a(b);(b.jqmData("dependents")||a()).remove();b.remove()};a.fn.addDependents=function(b){a.addDependents(a(this),  
b)};a.addDependents=function(b,c){var f=a(b).jqmData("dependents")||a();a(b).jqmData("dependents",a.merge(f,c))};a.fn.getEncodedText=function(){return a("<div/>").text(a(this).text()).html()};var c=a.find,f=/:jqmData\(([^)]*)\)/g;a.find=function(b,e,h,i){b=b.replace(f,"[data-"+(a.mobile.ns||"")+"$1]");return c.call(this,b,e,h,i)};a.extend(a.find,c);a.find.matches=function(b,c){return a.find(b,null,null,c)};a.find.matchesSelector=function(b,c){return a.find(c,null,null,[b]).length>0}})(jQuery,this);  
(function(a,e){function b(a){var b=a.find(".ui-title:eq(0)");b.length?b.focus():a.focus()}function c(b){p&&(!p.closest(".ui-page-active").length||b)&&p.removeClass(a.mobile.activeBtnClass);p=null}function f(){z=false;A.length>0&&a.mobile.changePage.apply(null,A.pop())}function d(c,d,f,e){var j=a.mobile.urlHistory.getActive(),h=a.support.touchOverflow&&a.mobile.touchOverflowEnabled,i=j.lastScroll||(h?0:a.mobile.defaultHomeScroll),j=g();window.scrollTo(0,a.mobile.defaultHomeScroll);d&&d.data("page")._trigger("beforehide",  
null,{nextPage:c});h||c.height(j+i);c.data("page")._trigger("beforeshow",null,{prevPage:d||a("")});a.mobile.hidePageLoadingMsg();h&&i&&(c.addClass("ui-mobile-pre-transition"),b(c),c.is(".ui-native-fixed")?c.find(".ui-content").scrollTop(i):c.scrollTop(i));f=(a.mobile.transitionHandlers[f||"none"]||a.mobile.defaultTransitionHandler)(f,e,c,d);f.done(function(){h||(c.height(""),b(c));h||a.mobile.silentScroll(i);d&&(h||d.height(""),d.data("page")._trigger("hide",null,{nextPage:c}));c.data("page")._trigger("show",  
null,{prevPage:d||a("")})});return f}function g(){var b=a.event.special.orientationchange.orientation()==="portrait",c=b?screen.availHeight:screen.availWidth,b=Math.max(b?480:320,a(window).height());return Math.min(c,b)}function h(){(!a.support.touchOverflow||!a.mobile.touchOverflowEnabled)&&a("."+a.mobile.activePageClass).css("min-height",g())}function i(b,c){c&&b.attr("data-"+a.mobile.ns+"role",c);b.page()}function k(a){for(;a;){if(a.nodeName.toLowerCase()=="a")break;a=a.parentNode}return a}function m(b){var b=  
a(b).closest(".ui-page").jqmData("url"),c=r.hrefNoHash;if(!b||!j.isPath(b))b=c;return j.makeUrlAbsolute(b,c)}var q=a(window),o=a("html"),l=a("head"),j={urlParseRE:/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,parseUrl:function(b){if(a.type(b)==="object")return b;b=j.urlParseRE.exec(b||"")||[];return{href:b[0]||"",hrefNoHash:b[1]||"",hrefNoSearch:b[2]||"",domain:b[3]||  
"",protocol:b[4]||"",doubleSlash:b[5]||"",authority:b[6]||"",username:b[8]||"",password:b[9]||"",host:b[10]||"",hostname:b[11]||"",port:b[12]||"",pathname:b[13]||"",directory:b[14]||"",filename:b[15]||"",search:b[16]||"",hash:b[17]||""}},makePathAbsolute:function(a,b){if(a&&a.charAt(0)==="/")return a;for(var a=a||"",c=(b=b?b.replace(/^\/|(\/[^\/]*|[^\/]+)$/g,""):"")?b.split("/"):[],d=a.split("/"),f=0;f<d.length;f++){var e=d[f];switch(e){case ".":break;case "..":c.length&&c.pop();break;default:c.push(e)}}return"/"+  
c.join("/")},isSameDomain:function(a,b){return j.parseUrl(a).domain===j.parseUrl(b).domain},isRelativeUrl:function(a){return j.parseUrl(a).protocol===""},isAbsoluteUrl:function(a){return j.parseUrl(a).protocol!==""},makeUrlAbsolute:function(a,b){if(!j.isRelativeUrl(a))return a;var c=j.parseUrl(a),d=j.parseUrl(b),f=c.protocol||d.protocol,e=c.protocol?c.doubleSlash:c.doubleSlash||d.doubleSlash,g=c.authority||d.authority,h=c.pathname!=="",i=j.makePathAbsolute(c.pathname||d.filename,d.pathname);return f+  
e+g+i+(c.search||!h&&d.search||"")+c.hash},addSearchParams:function(b,c){var d=j.parseUrl(b),f=typeof c==="object"?a.param(c):c,e=d.search||"?";return d.hrefNoSearch+e+(e.charAt(e.length-1)!=="?"?"&":"")+f+(d.hash||"")},convertUrlToDataUrl:function(a){var b=j.parseUrl(a);if(j.isEmbeddedPage(b))return b.hash.split(t)[0].replace(/^#/,"");else if(j.isSameDomain(b,r))return b.hrefNoHash.replace(r.domain,"");return a},get:function(a){if(a===e)a=location.hash;return j.stripHash(a).replace(/[^\/]*\.[^\/*]+$/,  
"")},getFilePath:function(b){var c="&"+a.mobile.subPageUrlKey;return b&&b.split(c)[0].split(t)[0]},set:function(a){location.hash=a},isPath:function(a){return/\//.test(a)},clean:function(a){return a.replace(r.domain,"")},stripHash:function(a){return a.replace(/^#/,"")},cleanHash:function(a){return j.stripHash(a.replace(/\?.*$/,"").replace(t,""))},isExternal:function(a){a=j.parseUrl(a);return a.protocol&&a.domain!==x.domain?true:false},hasProtocol:function(a){return/^(:?\w+:)/.test(a)},isFirstPageUrl:function(b){var b=  
j.parseUrl(j.makeUrlAbsolute(b,r)),c=a.mobile.firstPage,c=c&&c[0]?c[0].id:e;return(b.hrefNoHash===x.hrefNoHash||w&&b.hrefNoHash===r.hrefNoHash)&&(!b.hash||b.hash==="#"||c&&b.hash.replace(/^#/,"")===c)},isEmbeddedPage:function(a){a=j.parseUrl(a);return a.protocol!==""?a.hash&&(a.hrefNoHash===x.hrefNoHash||w&&a.hrefNoHash===r.hrefNoHash):/^#/.test(a.href)}},p=null,n={stack:[],activeIndex:0,getActive:function(){return n.stack[n.activeIndex]},getPrev:function(){return n.stack[n.activeIndex-1]},getNext:function(){return n.stack[n.activeIndex+  
1]},addNew:function(a,b,c,d,f){n.getNext()&&n.clearForward();n.stack.push({url:a,transition:b,title:c,pageUrl:d,role:f});n.activeIndex=n.stack.length-1},clearForward:function(){n.stack=n.stack.slice(0,n.activeIndex+1)},directHashChange:function(b){var c,d,f;this.getActive();a.each(n.stack,function(a,e){b.currentUrl===e.url&&(c=a<n.activeIndex,d=!c,f=a)});this.activeIndex=f!==e?f:this.activeIndex;c?(b.either||b.isBack)(true):d&&(b.either||b.isForward)(false)},ignoreNextHashChange:false},A=[],z=false,  
t="&ui-state=dialog",v=l.children("base"),x=j.parseUrl(location.href),r=v.length?j.parseUrl(j.makeUrlAbsolute(v.attr("href"),x.href)):x,w=x.hrefNoHash!==r.hrefNoHash,u=a.support.dynamicBaseTag?{element:v.length?v:a("<base>",{href:r.hrefNoHash}).prependTo(l),set:function(a){u.element.attr("href",j.makeUrlAbsolute(a,r))},reset:function(){u.element.attr("href",r.hrefNoHash)}}:e,D=true,y,C,B;y=function(){var b=q;a.support.touchOverflow&&a.mobile.touchOverflowEnabled&&(b=a(".ui-page-active"),b=b.is(".ui-native-fixed")?  
b.find(".ui-content"):b);return b};C=function(b){if(D){var c=a.mobile.urlHistory.getActive();if(c)b=b&&b.scrollTop(),c.lastScroll=b<a.mobile.minScrollBack?a.mobile.defaultHomeScroll:b}};B=function(){setTimeout(C,100,a(this))};q.bind(a.support.pushState?"popstate":"hashchange",function(){D=false});q.one(a.support.pushState?"popstate":"hashchange",function(){D=true});q.one("pagecontainercreate",function(){a.mobile.pageContainer.bind("pagechange",function(){var a=y();D=true;a.unbind("scrollstop",B);  
a.bind("scrollstop",B)})});y().bind("scrollstop",B);a.mobile.getScreenHeight=g;a.fn.animationComplete=function(b){return a.support.cssTransitions?a(this).one("webkitAnimationEnd",b):(setTimeout(b,0),a(this))};a.mobile.path=j;a.mobile.base=u;a.mobile.urlHistory=n;a.mobile.dialogHashKey=t;a.mobile.noneTransitionHandler=function(b,c,d,f){f&&f.removeClass(a.mobile.activePageClass);d.addClass(a.mobile.activePageClass);return a.Deferred().resolve(b,c,d,f).promise()};a.mobile.defaultTransitionHandler=a.mobile.noneTransitionHandler;  
a.mobile.transitionHandlers={none:a.mobile.defaultTransitionHandler};a.mobile.allowCrossDomainPages=false;a.mobile.getDocumentUrl=function(b){return b?a.extend({},x):x.href};a.mobile.getDocumentBase=function(b){return b?a.extend({},r):r.href};a.mobile._bindPageRemove=function(){var b=a(this);!b.data("page").options.domCache&&b.is(":jqmData(external-page='true')")&&b.bind("pagehide.remove",function(){var b=a(this),c=new a.Event("pageremove");b.trigger(c);c.isDefaultPrevented()||b.removeWithDependents()})};  
a.mobile.loadPage=function(b,c){var d=a.Deferred(),f=a.extend({},a.mobile.loadPage.defaults,c),g=null,h=null,l=j.makeUrlAbsolute(b,a.mobile.activePage&&m(a.mobile.activePage)||r.hrefNoHash);if(f.data&&f.type==="get")l=j.addSearchParams(l,f.data),f.data=e;if(f.data&&f.type==="post")f.reloadPage=true;var t=j.getFilePath(l),o=j.convertUrlToDataUrl(l);f.pageContainer=f.pageContainer||a.mobile.pageContainer;g=f.pageContainer.children(":jqmData(url='"+o+"')");g.length===0&&o&&!j.isPath(o)&&(g=f.pageContainer.children("#"+  
o).attr("data-"+a.mobile.ns+"url",o));if(g.length===0)if(a.mobile.firstPage&&j.isFirstPageUrl(t))a.mobile.firstPage.parent().length&&(g=a(a.mobile.firstPage));else if(j.isEmbeddedPage(t))return d.reject(l,c),d.promise();u&&u.reset();if(g.length){if(!f.reloadPage)return i(g,f.role),d.resolve(l,c,g),d.promise();h=g}var n=f.pageContainer,k=new a.Event("pagebeforeload"),p={url:b,absUrl:l,dataUrl:o,deferred:d,options:f};n.trigger(k,p);if(k.isDefaultPrevented())return d.promise();if(f.showLoadMsg)var v=  
setTimeout(function(){a.mobile.showPageLoadingMsg()},f.loadMsgDelay);!a.mobile.allowCrossDomainPages&&!j.isSameDomain(x,l)?d.reject(l,c):a.ajax({url:t,type:f.type,data:f.data,dataType:"html",success:function(e,n,k){var m=a("<div></div>"),r=e.match(/<title[^>]*>([^<]*)/)&&RegExp.$1,q=RegExp("\\bdata-"+a.mobile.ns+"url=[\"']?([^\"'>]*)[\"']?");RegExp("(<[^>]+\\bdata-"+a.mobile.ns+"role=[\"']?page[\"']?[^>]*>)").test(e)&&RegExp.$1&&q.test(RegExp.$1)&&RegExp.$1&&(b=t=j.getFilePath(RegExp.$1));u&&u.set(t);  
m.get(0).innerHTML=e;g=m.find(":jqmData(role='page'), :jqmData(role='dialog')").first();g.length||(g=a("<div data-"+a.mobile.ns+"role='page'>"+e.split(/<\/?body[^>]*>/gmi)[1]+"</div>"));r&&!g.jqmData("title")&&(~r.indexOf("&")&&(r=a("<div>"+r+"</div>").text()),g.jqmData("title",r));if(!a.support.dynamicBaseTag){var x=j.get(t);g.find("[src], link[href], a[rel='external'], :jqmData(ajax='false'), a[target]").each(function(){var b=a(this).is("[href]")?"href":a(this).is("[src]")?"src":"action",c=a(this).attr(b),  
c=c.replace(location.protocol+"//"+location.host+location.pathname,"");/^(\w+:|#|\/)/.test(c)||a(this).attr(b,x+c)})}g.attr("data-"+a.mobile.ns+"url",j.convertUrlToDataUrl(t)).attr("data-"+a.mobile.ns+"external-page",true).appendTo(f.pageContainer);g.one("pagecreate",a.mobile._bindPageRemove);i(g,f.role);l.indexOf("&"+a.mobile.subPageUrlKey)>-1&&(g=f.pageContainer.children(":jqmData(url='"+o+"')"));f.showLoadMsg&&(clearTimeout(v),a.mobile.hidePageLoadingMsg());p.xhr=k;p.textStatus=n;p.page=g;f.pageContainer.trigger("pageload",  
p);d.resolve(l,c,g,h)},error:function(b,e,g){u&&u.set(j.get());p.xhr=b;p.textStatus=e;p.errorThrown=g;b=new a.Event("pageloadfailed");f.pageContainer.trigger(b,p);b.isDefaultPrevented()||(f.showLoadMsg&&(clearTimeout(v),a.mobile.hidePageLoadingMsg(),a("<div class='ui-loader ui-overlay-shadow ui-body-e ui-corner-all'><h1>"+a.mobile.pageLoadErrorMessage+"</h1></div>").css({display:"block",opacity:0.96,top:q.scrollTop()+100}).appendTo(f.pageContainer).delay(800).fadeOut(400,function(){a(this).remove()})),  
d.reject(l,c))}});return d.promise()};a.mobile.loadPage.defaults={type:"get",data:e,reloadPage:false,role:e,showLoadMsg:false,pageContainer:e,loadMsgDelay:50};a.mobile.changePage=function(b,g){if(z)A.unshift(arguments);else{var h=a.extend({},a.mobile.changePage.defaults,g);h.pageContainer=h.pageContainer||a.mobile.pageContainer;h.fromPage=h.fromPage||a.mobile.activePage;var l=h.pageContainer,k=new a.Event("pagebeforechange"),p={toPage:b,options:h};l.trigger(k,p);if(!k.isDefaultPrevented())if(b=p.toPage,  
z=true,typeof b=="string")a.mobile.loadPage(b,h).done(function(b,c,d,f){z=false;c.duplicateCachedPage=f;a.mobile.changePage(d,c)}).fail(function(){z=false;c(true);f();h.pageContainer.trigger("pagechangefailed",p)});else{if(b[0]===a.mobile.firstPage[0]&&!h.dataUrl)h.dataUrl=x.hrefNoHash;var k=h.fromPage,m=h.dataUrl&&j.convertUrlToDataUrl(h.dataUrl)||b.jqmData("url"),v=m;j.getFilePath(m);var r=n.getActive(),q=n.activeIndex===0,w=0,u=document.title,y=h.role==="dialog"||b.jqmData("role")==="dialog";if(k&&  
k[0]===b[0]&&!h.allowSamePageTransition)z=false,l.trigger("pagechange",p);else{i(b,h.role);h.fromHashChange&&n.directHashChange({currentUrl:m,isBack:function(){w=-1},isForward:function(){w=1}});try{a(document.activeElement||"").add("input:focus, textarea:focus, select:focus").blur()}catch(B){}y&&r&&(m=(r.url||"")+t);if(h.changeHash!==false&&m)n.ignoreNextHashChange=true,j.set(m);var C=!r?u:b.jqmData("title")||b.children(":jqmData(role='header')").find(".ui-title").getEncodedText();C&&u==document.title&&  
(u=C);b.jqmData("title")||b.jqmData("title",u);h.transition=h.transition||(w&&!q?r.transition:e)||(y?a.mobile.defaultDialogTransition:a.mobile.defaultPageTransition);w||n.addNew(m,h.transition,u,v,h.role);document.title=n.getActive().title;a.mobile.activePage=b;h.reverse=h.reverse||w<0;d(b,k,h.transition,h.reverse).done(function(){c();h.duplicateCachedPage&&h.duplicateCachedPage.remove();o.removeClass("ui-mobile-rendering");f();l.trigger("pagechange",p)})}}}};a.mobile.changePage.defaults={transition:e,  
reverse:false,changeHash:true,fromHashChange:false,role:e,duplicateCachedPage:e,pageContainer:e,showLoadMsg:true,dataUrl:e,fromPage:e,allowSamePageTransition:false};a.mobile._registerInternalEvents=function(){a("form").live("submit",function(b){var c=a(this);if(a.mobile.ajaxEnabled&&!c.is(":jqmData(ajax='false')")){var d=c.attr("method"),f=c.attr("target"),e=c.attr("action");if(!e&&(e=m(c),e===r.hrefNoHash))e=x.hrefNoSearch;e=j.makeUrlAbsolute(e,m(c));!j.isExternal(e)&&!f&&(a.mobile.changePage(e,  
{type:d&&d.length&&d.toLowerCase()||"get",data:c.serialize(),transition:c.jqmData("transition"),direction:c.jqmData("direction"),reloadPage:true}),b.preventDefault())}});a(document).bind("vclick",function(b){if(!(b.which>1)&&a.mobile.linkBindingEnabled&&(b=k(b.target))&&j.parseUrl(b.getAttribute("href")||"#").hash!=="#")c(true),p=a(b).closest(".ui-btn").not(".ui-disabled"),p.addClass(a.mobile.activeBtnClass),a("."+a.mobile.activePageClass+" .ui-btn").not(b).blur()});a(document).bind("click",function(b){if(a.mobile.linkBindingEnabled){var d=  
k(b.target);if(d&&!(b.which>1)){var f=a(d),g=function(){window.setTimeout(function(){c(true)},200)};if(f.is(":jqmData(rel='back')"))return window.history.back(),false;var h=m(f),d=j.makeUrlAbsolute(f.attr("href")||"#",h);if(!a.mobile.ajaxEnabled&&!j.isEmbeddedPage(d))g();else{if(d.search("#")!=-1)if(d=d.replace(/[^#]*#/,""))d=j.isPath(d)?j.makeUrlAbsolute(d,h):j.makeUrlAbsolute("#"+d,x.hrefNoHash);else{b.preventDefault();return}var h=f.is("[rel='external']")||f.is(":jqmData(ajax='false')")||f.is("[target]"),  
i=a.mobile.allowCrossDomainPages&&x.protocol==="file:"&&d.search(/^https?:/)!=-1;h||j.isExternal(d)&&!i?g():(g=f.jqmData("transition"),h=(h=f.jqmData("direction"))&&h==="reverse"||f.jqmData("back"),f=f.attr("data-"+a.mobile.ns+"rel")||e,a.mobile.changePage(d,{transition:g,reverse:h,role:f}),b.preventDefault())}}}});a(".ui-page").live("pageshow.prefetch",function(){var b=[];a(this).find("a:jqmData(prefetch)").each(function(){var c=a(this),d=c.attr("href");d&&a.inArray(d,b)===-1&&(b.push(d),a.mobile.loadPage(d,  
{role:c.attr("data-"+a.mobile.ns+"rel")}))})});a.mobile._handleHashChange=function(b){var c=j.stripHash(b),d={transition:a.mobile.urlHistory.stack.length===0?"none":e,changeHash:false,fromHashChange:true};if(!a.mobile.hashListeningEnabled||n.ignoreNextHashChange)n.ignoreNextHashChange=false;else{if(n.stack.length>1&&c.indexOf(t)>-1)if(a.mobile.activePage.is(".ui-dialog"))n.directHashChange({currentUrl:c,either:function(b){var f=a.mobile.urlHistory.getActive();c=f.pageUrl;a.extend(d,{role:f.role,transition:f.transition,  
reverse:b})}});else{n.directHashChange({currentUrl:c,isBack:function(){window.history.back()},isForward:function(){window.history.forward()}});return}c?(c=typeof c==="string"&&!j.isPath(c)?j.makeUrlAbsolute("#"+c,r):c,a.mobile.changePage(c,d)):a.mobile.changePage(a.mobile.firstPage,d)}};q.bind("hashchange",function(){a.mobile._handleHashChange(location.hash)});a(document).bind("pageshow",h);a(window).bind("throttledresize",h)}})(jQuery);  
(function(a,e){var b={},c=a(e),f=a.mobile.path.parseUrl(location.href);a.extend(b,{initialFilePath:f.pathname+f.search,initialHref:f.hrefNoHash,hashchangeFired:false,state:function(){return{hash:location.hash||"#"+b.initialFilePath,title:document.title,initialHref:b.initialHref}},resetUIKeys:function(b){var c="&"+a.mobile.subPageUrlKey,f=b.indexOf(a.mobile.dialogHashKey);f>-1?b=b.slice(0,f)+"#"+b.slice(f):b.indexOf(c)>-1&&(b=b.split(c).join("#"+c));return b},nextHashChangePrevented:function(c){a.mobile.urlHistory.ignoreNextHashChange=  
c;b.onHashChangeDisabled=c},onHashChange:function(){if(!b.onHashChangeDisabled){var c,f;c=location.hash;var e=a.mobile.path.isPath(c),i=e?location.href:a.mobile.getDocumentUrl();c=e?c.replace("#",""):c;f=b.state();c=a.mobile.path.makeUrlAbsolute(c,i);e&&(c=b.resetUIKeys(c));history.replaceState(f,document.title,c)}},onPopState:function(c){var f=c.originalEvent.state;f&&(b.nextHashChangePrevented(true),setTimeout(function(){b.nextHashChangePrevented(false);a.mobile._handleHashChange(f.hash)},100))},  
init:function(){c.bind("hashchange",b.onHashChange);c.bind("popstate",b.onPopState);location.hash===""&&history.replaceState(b.state(),document.title,location.href)}});a(function(){a.mobile.pushStateEnabled&&a.support.pushState&&b.init()})})(jQuery,this);  
(function(a){function e(b,c,f,d){var e=new a.Deferred,h=c?" reverse":"",i="ui-mobile-viewport-transitioning viewport-"+b;f.animationComplete(function(){f.add(d).removeClass("out in reverse "+b);d&&d[0]!==f[0]&&d.removeClass(a.mobile.activePageClass);f.parent().removeClass(i);e.resolve(b,c,f,d)});f.parent().addClass(i);d&&d.addClass(b+" out"+h);f.addClass(a.mobile.activePageClass+" "+b+" in"+h);return e.promise()}a.mobile.css3TransitionHandler=e;if(a.mobile.defaultTransitionHandler===a.mobile.noneTransitionHandler)a.mobile.defaultTransitionHandler=  
e})(jQuery,this);  
(function(a){a.mobile.page.prototype.options.degradeInputs={color:false,date:false,datetime:false,"datetime-local":false,email:false,month:false,number:false,range:"number",search:"text",tel:false,time:false,url:false,week:false};a(document).bind("pagecreate create",function(e){var b=a(e.target).closest(':jqmData(role="page")').data("page"),c;if(b)c=b.options,a(e.target).find("input").not(b.keepNativeSelector()).each(function(){var b=a(this),d=this.getAttribute("type"),e=c.degradeInputs[d]||"text";  
if(c.degradeInputs[d]){var h=a("<div>").html(b.clone()).html(),i=h.indexOf(" type=")>-1;b.replaceWith(h.replace(i?/\s+type=["']?\w+['"]?/:/\/?>/,' type="'+e+'" data-'+a.mobile.ns+'type="'+d+'"'+(i?"":">")))}})})})(jQuery);  
(function(a,e){a.widget("mobile.dialog",a.mobile.widget,{options:{closeBtnText:"Close",overlayTheme:"a",initSelector:":jqmData(role='dialog')"},_create:function(){var b=this,c=this.element,f=a("<a href='#' data-"+a.mobile.ns+"icon='delete' data-"+a.mobile.ns+"iconpos='notext'>"+this.options.closeBtnText+"</a>");c.addClass("ui-overlay-"+this.options.overlayTheme);c.attr("role","dialog").addClass("ui-dialog").find(":jqmData(role='header')").addClass("ui-corner-top ui-overlay-shadow").prepend(f).end().find(":jqmData(role='content'),:jqmData(role='footer')").addClass("ui-overlay-shadow").last().addClass("ui-corner-bottom");  
f.bind("vclick",function(){b.close()});c.bind("vclick submit",function(b){var b=a(b.target).closest(b.type==="vclick"?"a":"form"),c;b.length&&!b.jqmData("transition")&&(c=a.mobile.urlHistory.getActive()||{},b.attr("data-"+a.mobile.ns+"transition",c.transition||a.mobile.defaultDialogTransition).attr("data-"+a.mobile.ns+"direction","reverse"))}).bind("pagehide",function(){a(this).find("."+a.mobile.activeBtnClass).removeClass(a.mobile.activeBtnClass)})},close:function(){e.history.back()}});a(a.mobile.dialog.prototype.options.initSelector).live("pagecreate",  
function(){a(this).dialog()})})(jQuery,this);  
(function(a){a.mobile.page.prototype.options.backBtnText="Back";a.mobile.page.prototype.options.addBackBtn=false;a.mobile.page.prototype.options.backBtnTheme=null;a.mobile.page.prototype.options.headerTheme="a";a.mobile.page.prototype.options.footerTheme="a";a.mobile.page.prototype.options.contentTheme=null;a(":jqmData(role='page'), :jqmData(role='dialog')").live("pagecreate",function(){var e=a(this).data("page").options,b=e.theme;a(":jqmData(role='header'), :jqmData(role='footer'), :jqmData(role='content')",this).each(function(){var c=  
a(this),f=c.jqmData("role"),d=c.jqmData("theme"),g=d||e.contentTheme||b,h;c.addClass("ui-"+f);if(f==="header"||f==="footer"){var i=d||(f==="header"?e.headerTheme:e.footerTheme)||b;c.addClass("ui-bar-"+i).attr("role",f==="header"?"banner":"contentinfo");d=c.children("a");g=d.hasClass("ui-btn-left");h=d.hasClass("ui-btn-right");g=g||d.eq(0).not(".ui-btn-right").addClass("ui-btn-left").length;h||d.eq(1).addClass("ui-btn-right");e.addBackBtn&&f==="header"&&a(".ui-page").length>1&&c.jqmData("url")!==a.mobile.path.stripHash(location.hash)&&  
!g&&a("<a href='#' class='ui-btn-left' data-"+a.mobile.ns+"rel='back' data-"+a.mobile.ns+"icon='arrow-l'>"+e.backBtnText+"</a>").attr("data-"+a.mobile.ns+"theme",e.backBtnTheme||i).prependTo(c);c.children("h1, h2, h3, h4, h5, h6").addClass("ui-title").attr({tabindex:"0",role:"heading","aria-level":"1"})}else f==="content"&&(g&&c.addClass("ui-body-"+g),c.attr("role","main"))})})})(jQuery);  
(function(a){a.widget("mobile.collapsible",a.mobile.widget,{options:{expandCueText:" click to expand contents",collapseCueText:" click to collapse contents",collapsed:true,heading:"h1,h2,h3,h4,h5,h6,legend",theme:null,contentTheme:null,iconTheme:"d",initSelector:":jqmData(role='collapsible')"},_create:function(){var e=this.element,b=this.options,c=e.addClass("ui-collapsible"),f=e.children(b.heading).first(),d=c.wrapInner("<div class='ui-collapsible-content'></div>").find(".ui-collapsible-content"),  
g=e.closest(":jqmData(role='collapsible-set')").addClass("ui-collapsible-set"),e=g.children(":jqmData(role='collapsible')");f.is("legend")&&(f=a("<div role='heading'>"+f.html()+"</div>").insertBefore(f),f.next().remove());if(g.length){if(!b.theme)b.theme=g.jqmData("theme");if(!b.contentTheme)b.contentTheme=g.jqmData("content-theme")}d.addClass(b.contentTheme?"ui-body-"+b.contentTheme:"");f.insertBefore(d).addClass("ui-collapsible-heading").append("<span class='ui-collapsible-heading-status'></span>").wrapInner("<a href='#' class='ui-collapsible-heading-toggle'></a>").find("a").first().buttonMarkup({shadow:false,  
corners:false,iconPos:"left",icon:"plus",theme:b.theme});g.length?(g.jqmData("collapsiblebound")||g.jqmData("collapsiblebound",true).bind("expand",function(b){a(b.target).closest(".ui-collapsible").siblings(".ui-collapsible").trigger("collapse")}),e.first().find("a").first().addClass("ui-corner-top").find(".ui-btn-inner").addClass("ui-corner-top"),e.last().jqmData("collapsible-last",true).find("a").first().addClass("ui-corner-bottom").find(".ui-btn-inner").addClass("ui-corner-bottom"),c.jqmData("collapsible-last")&&  
f.find("a").first().add(f.find(".ui-btn-inner")).addClass("ui-corner-bottom")):f.find("a").first().add(f.find(".ui-btn-inner")).addClass("ui-corner-top ui-corner-bottom");c.bind("expand collapse",function(e){if(!e.isDefaultPrevented()){e.preventDefault();var i=a(this),e=e.type==="collapse",k=b.contentTheme;f.toggleClass("ui-collapsible-heading-collapsed",e).find(".ui-collapsible-heading-status").text(e?b.expandCueText:b.collapseCueText).end().find(".ui-icon").toggleClass("ui-icon-minus",!e).toggleClass("ui-icon-plus",  
e);i.toggleClass("ui-collapsible-collapsed",e);d.toggleClass("ui-collapsible-content-collapsed",e).attr("aria-hidden",e);if(k&&(!g.length||c.jqmData("collapsible-last")))f.find("a").first().add(f.find(".ui-btn-inner")).toggleClass("ui-corner-bottom",e),d.toggleClass("ui-corner-bottom",!e);d.trigger("updatelayout")}}).trigger(b.collapsed?"collapse":"expand");f.bind("click",function(a){var b=f.is(".ui-collapsible-heading-collapsed")?"expand":"collapse";c.trigger(b);a.preventDefault()})}});a(document).bind("pagecreate create",  
function(e){a(a.mobile.collapsible.prototype.options.initSelector,e.target).collapsible()})})(jQuery);(function(a){a.fn.fieldcontain=function(){return this.addClass("ui-field-contain ui-body ui-br")};a(document).bind("pagecreate create",function(e){a(":jqmData(role='fieldcontain')",e.target).fieldcontain()})})(jQuery);  
(function(a){a.fn.grid=function(e){return this.each(function(){var b=a(this),c=a.extend({grid:null},e),f=b.children(),d={solo:1,a:2,b:3,c:4,d:5},c=c.grid;if(!c)if(f.length<=5)for(var g in d)d[g]===f.length&&(c=g);else c="a";d=d[c];b.addClass("ui-grid-"+c);f.filter(":nth-child("+d+"n+1)").addClass("ui-block-a");d>1&&f.filter(":nth-child("+d+"n+2)").addClass("ui-block-b");d>2&&f.filter(":nth-child(3n+3)").addClass("ui-block-c");d>3&&f.filter(":nth-child(4n+4)").addClass("ui-block-d");d>4&&f.filter(":nth-child(5n+5)").addClass("ui-block-e")})}})(jQuery);  
(function(a,e){a.widget("mobile.navbar",a.mobile.widget,{options:{iconpos:"top",grid:null,initSelector:":jqmData(role='navbar')"},_create:function(){var b=this.element,c=b.find("a"),f=c.filter(":jqmData(icon)").length?this.options.iconpos:e;b.addClass("ui-navbar").attr("role","navigation").find("ul").grid({grid:this.options.grid});f||b.addClass("ui-navbar-noicons");c.buttonMarkup({corners:false,shadow:false,iconpos:f});b.delegate("a","vclick",function(){c.not(".ui-state-persist").removeClass(a.mobile.activeBtnClass);  
a(this).addClass(a.mobile.activeBtnClass)})}});a(document).bind("pagecreate create",function(b){a(a.mobile.navbar.prototype.options.initSelector,b.target).navbar()})})(jQuery);  
(function(a){var e={};a.widget("mobile.listview",a.mobile.widget,{options:{theme:"c",countTheme:"c",headerTheme:"b",dividerTheme:"b",splitIcon:"arrow-r",splitTheme:"b",inset:false,initSelector:":jqmData(role='listview')"},_create:function(){var a=this;a.element.addClass(function(c,f){return f+" ui-listview "+(a.options.inset?" ui-listview-inset ui-corner-all ui-shadow ":"")});a.refresh(true)},_removeCorners:function(a,c){a=a.add(a.find(".ui-btn-inner, .ui-li-link-alt, .ui-li-thumb"));c==="top"?a.removeClass("ui-corner-top ui-corner-tr ui-corner-tl"):  
c==="bottom"?a.removeClass("ui-corner-bottom ui-corner-br ui-corner-bl"):a.removeClass("ui-corner-top ui-corner-tr ui-corner-tl ui-corner-bottom ui-corner-br ui-corner-bl")},_refreshCorners:function(a){var c,f;this.options.inset&&(c=this.element.children("li"),f=a?c.not(".ui-screen-hidden"):c.filter(":visible"),this._removeCorners(c),c=f.first().addClass("ui-corner-top"),c.add(c.find(".ui-btn-inner").not(".ui-li-link-alt span:first-child")).addClass("ui-corner-top").end().find(".ui-li-link-alt, .ui-li-link-alt span:first-child").addClass("ui-corner-tr").end().find(".ui-li-thumb").not(".ui-li-icon").addClass("ui-corner-tl"),  
f=f.last().addClass("ui-corner-bottom"),f.add(f.find(".ui-btn-inner")).find(".ui-li-link-alt").addClass("ui-corner-br").end().find(".ui-li-thumb").not(".ui-li-icon").addClass("ui-corner-bl"));a||this.element.trigger("updatelayout")},_findFirstElementByTagName:function(a,c,f,d){var e={};for(e[f]=e[d]=true;a;){if(e[a.nodeName])return a;a=a[c]}return null},_addThumbClasses:function(b){var c,f,d=b.length;for(c=0;c<d;c++)f=a(this._findFirstElementByTagName(b[c].firstChild,"nextSibling","img","IMG")),f.length&&  
(f.addClass("ui-li-thumb"),a(this._findFirstElementByTagName(f[0].parentNode,"parentNode","li","LI")).addClass(f.is(".ui-li-icon")?"ui-li-has-icon":"ui-li-has-thumb"))},refresh:function(b){this.parentPage=this.element.closest(".ui-page");this._createSubPages();var c=this.options,f=this.element,d=f.jqmData("dividertheme")||c.dividerTheme,e=f.jqmData("splittheme"),h=f.jqmData("spliticon"),i=f.children("li"),k=a.support.cssPseudoElement||!a.nodeName(f[0],"ol")?0:1,m,q,o,l,j;k&&f.find(".ui-li-dec").remove();  
for(var p=0,n=i.length;p<n;p++){m=i.eq(p);q="ui-li";if(b||!m.hasClass("ui-li"))o=m.jqmData("theme")||c.theme,l=m.children("a"),l.length?(j=m.jqmData("icon"),m.buttonMarkup({wrapperEls:"div",shadow:false,corners:false,iconpos:"right",icon:l.length>1||j===false?false:j||"arrow-r",theme:o}),j!=false&&l.length==1&&m.addClass("ui-li-has-arrow"),l.first().addClass("ui-link-inherit"),l.length>1&&(q+=" ui-li-has-alt",l=l.last(),j=e||l.jqmData("theme")||c.splitTheme,l.appendTo(m).attr("title",l.getEncodedText()).addClass("ui-li-link-alt").empty().buttonMarkup({shadow:false,  
corners:false,theme:o,icon:false,iconpos:false}).find(".ui-btn-inner").append(a(document.createElement("span")).buttonMarkup({shadow:true,corners:true,theme:j,iconpos:"notext",icon:h||l.jqmData("icon")||c.splitIcon})))):m.jqmData("role")==="list-divider"?(q+=" ui-li-divider ui-btn ui-bar-"+d,m.attr("role","heading"),k&&(k=1)):q+=" ui-li-static ui-body-"+o;k&&q.indexOf("ui-li-divider")<0&&(o=m.is(".ui-li-static:first")?m:m.find(".ui-link-inherit"),o.addClass("ui-li-jsnumbering").prepend("<span class='ui-li-dec'>"+  
k++ +". </span>"));m.addClass(q).children(".ui-btn-inner").addClass(q)}f.find("h1, h2, h3, h4, h5, h6").addClass("ui-li-heading").end().find("p, dl").addClass("ui-li-desc").end().find(".ui-li-aside").each(function(){var b=a(this);b.prependTo(b.parent())}).end().find(".ui-li-count").each(function(){a(this).closest("li").addClass("ui-li-has-count")}).addClass("ui-btn-up-"+(f.jqmData("counttheme")||this.options.countTheme)+" ui-btn-corner-all");this._addThumbClasses(i);this._addThumbClasses(f.find(".ui-link-inherit"));  
this._refreshCorners(b)},_idStringEscape:function(a){return a.replace(/[^a-zA-Z0-9]/g,"-")},_createSubPages:function(){var b=this.element,c=b.closest(".ui-page"),f=c.jqmData("url"),d=f||c[0][a.expando],g=b.attr("id"),h=this.options,i="data-"+a.mobile.ns,k=this,m=c.find(":jqmData(role='footer')").jqmData("id"),q;typeof e[d]==="undefined"&&(e[d]=-1);g=g||++e[d];a(b.find("li>ul, li>ol").toArray().reverse()).each(function(c){var d=a(this),e=d.attr("id")||g+"-"+c,c=d.parent(),k=a(d.prevAll().toArray().reverse()),  
k=k.length?k:a("<span>"+a.trim(c.contents()[0].nodeValue)+"</span>"),n=k.first().getEncodedText(),e=(f||"")+"&"+a.mobile.subPageUrlKey+"="+e,A=d.jqmData("theme")||h.theme,z=d.jqmData("counttheme")||b.jqmData("counttheme")||h.countTheme;q=true;d.detach().wrap("<div "+i+"role='page' "+i+"url='"+e+"' "+i+"theme='"+A+"' "+i+"count-theme='"+z+"'><div "+i+"role='content'></div></div>").parent().before("<div "+i+"role='header' "+i+"theme='"+h.headerTheme+"'><div class='ui-title'>"+n+"</div></div>").after(m?  
a("<div "+i+"role='footer' "+i+"id='"+m+"'>"):"").parent().appendTo(a.mobile.pageContainer).page();d=c.find("a:first");d.length||(d=a("<a/>").html(k||n).prependTo(c.empty()));d.attr("href","#"+e)}).listview();q&&c.is(":jqmData(external-page='true')")&&c.data("page").options.domCache===false&&c.unbind("pagehide.remove").bind("pagehide.remove",function(b,d){var e=d.nextPage;d.nextPage&&(e=e.jqmData("url"),e.indexOf(f+"&"+a.mobile.subPageUrlKey)!==0&&(k.childPages().remove(),c.remove()))})},childPages:function(){var b=  
this.parentPage.jqmData("url");return a(":jqmData(url^='"+b+"&"+a.mobile.subPageUrlKey+"')")}});a(document).bind("pagecreate create",function(b){a(a.mobile.listview.prototype.options.initSelector,b.target).listview()})})(jQuery);  
(function(a){a.mobile.listview.prototype.options.filter=false;a.mobile.listview.prototype.options.filterPlaceholder="Filter items...";a.mobile.listview.prototype.options.filterTheme="c";a.mobile.listview.prototype.options.filterCallback=function(a,b){return a.toLowerCase().indexOf(b)===-1};a(":jqmData(role='listview')").live("listviewcreate",function(){var e=a(this),b=e.data("listview");if(b.options.filter){var c=a("<form>",{"class":"ui-listview-filter ui-bar-"+b.options.filterTheme,role:"search"});  
a("<input>",{placeholder:b.options.filterPlaceholder}).attr("data-"+a.mobile.ns+"type","search").jqmData("lastval","").bind("keyup change",function(){var c=a(this),d=this.value.toLowerCase(),g=null,g=c.jqmData("lastval")+"",h=false,i="";c.jqmData("lastval",d);i=d.substr(0,g.length-1).replace(g,"");g=d.length<g.length||i.length!=d.length-g.length?e.children():e.children(":not(.ui-screen-hidden)");if(d){for(var k=g.length-1;k>=0;k--)c=a(g[k]),i=c.jqmData("filtertext")||c.text(),c.is("li:jqmData(role=list-divider)")?  
(c.toggleClass("ui-filter-hidequeue",!h),h=false):b.options.filterCallback(i,d)?c.toggleClass("ui-filter-hidequeue",true):h=true;g.filter(":not(.ui-filter-hidequeue)").toggleClass("ui-screen-hidden",false);g.filter(".ui-filter-hidequeue").toggleClass("ui-screen-hidden",true).toggleClass("ui-filter-hidequeue",false)}else g.toggleClass("ui-screen-hidden",false);b._refreshCorners()}).appendTo(c).textinput();a(this).jqmData("inset")&&c.addClass("ui-listview-filter-inset");c.bind("submit",function(){return false}).insertBefore(e)}})})(jQuery);  
(function(a){a(document).bind("pagecreate create",function(e){a(":jqmData(role='nojs')",e.target).addClass("ui-nojs")})})(jQuery);  
(function(a,e){a.widget("mobile.checkboxradio",a.mobile.widget,{options:{theme:null,initSelector:"input[type='checkbox'],input[type='radio']"},_create:function(){var b=this,c=this.element,f=c.closest("form,fieldset,:jqmData(role='page')").find("label").filter("[for='"+c[0].id+"']"),d=c.attr("type"),g=d+"-on",h=d+"-off",i=c.parents(":jqmData(type='horizontal')").length?e:h;if(!(d!=="checkbox"&&d!=="radio")){a.extend(this,{label:f,inputtype:d,checkedClass:"ui-"+g+(i?"":" "+a.mobile.activeBtnClass),  
uncheckedClass:"ui-"+h,checkedicon:"ui-icon-"+g,uncheckedicon:"ui-icon-"+h});if(!this.options.theme)this.options.theme=this.element.jqmData("theme");f.buttonMarkup({theme:this.options.theme,icon:i,shadow:false});c.add(f).wrapAll("<div class='ui-"+d+"'></div>");f.bind({vmouseover:function(b){a(this).parent().is(".ui-disabled")&&b.stopPropagation()},vclick:function(a){if(c.is(":disabled"))a.preventDefault();else return b._cacheVals(),c.prop("checked",d==="radio"&&true||!c.prop("checked")),c.triggerHandler("click"),  
b._getInputSet().not(c).prop("checked",false),b._updateAll(),false}});c.bind({vmousedown:function(){b._cacheVals()},vclick:function(){var c=a(this);c.is(":checked")?(c.prop("checked",true),b._getInputSet().not(c).prop("checked",false)):c.prop("checked",false);b._updateAll()},focus:function(){f.addClass("ui-focus")},blur:function(){f.removeClass("ui-focus")}});this.refresh()}},_cacheVals:function(){this._getInputSet().each(function(){var b=a(this);b.jqmData("cacheVal",b.is(":checked"))})},_getInputSet:function(){return this.inputtype==  
"checkbox"?this.element:this.element.closest("form,fieldset,:jqmData(role='page')").find("input[name='"+this.element.attr("name")+"'][type='"+this.inputtype+"']")},_updateAll:function(){var b=this;this._getInputSet().each(function(){var c=a(this);(c.is(":checked")||b.inputtype==="checkbox")&&c.trigger("change")}).checkboxradio("refresh")},refresh:function(){var b=this.element,c=this.label,f=c.find(".ui-icon");a(b[0]).prop("checked")?(c.addClass(this.checkedClass).removeClass(this.uncheckedClass),  
f.addClass(this.checkedicon).removeClass(this.uncheckedicon)):(c.removeClass(this.checkedClass).addClass(this.uncheckedClass),f.removeClass(this.checkedicon).addClass(this.uncheckedicon));b.is(":disabled")?this.disable():this.enable()},disable:function(){this.element.prop("disabled",true).parent().addClass("ui-disabled")},enable:function(){this.element.prop("disabled",false).parent().removeClass("ui-disabled")}});a(document).bind("pagecreate create",function(b){a.mobile.checkboxradio.prototype.enhanceWithin(b.target)})})(jQuery);  
(function(a,e){a.widget("mobile.button",a.mobile.widget,{options:{theme:null,icon:null,iconpos:null,inline:null,corners:true,shadow:true,iconshadow:true,initSelector:"button, [type='button'], [type='submit'], [type='reset'], [type='image']"},_create:function(){var b=this.element,c=this.options,f,d;this.button=a("<div></div>").text(b.text()||b.val()).insertBefore(b).buttonMarkup({theme:c.theme,icon:c.icon,iconpos:c.iconpos,inline:c.inline,corners:c.corners,shadow:c.shadow,iconshadow:c.iconshadow}).append(b.addClass("ui-btn-hidden"));  
c=b.attr("type");f=b.attr("name");c!=="button"&&c!=="reset"&&f&&b.bind("vclick",function(){d===e&&(d=a("<input>",{type:"hidden",name:b.attr("name"),value:b.attr("value")}).insertBefore(b),a(document).submit(function(){d.remove()}))});this.refresh()},enable:function(){this.element.attr("disabled",false);this.button.removeClass("ui-disabled").attr("aria-disabled",false);return this._setOption("disabled",false)},disable:function(){this.element.attr("disabled",true);this.button.addClass("ui-disabled").attr("aria-disabled",  
true);return this._setOption("disabled",true)},refresh:function(){var a=this.element;a.prop("disabled")?this.disable():this.enable();this.button.data("textWrapper").text(a.text()||a.val())}});a(document).bind("pagecreate create",function(b){a.mobile.button.prototype.enhanceWithin(b.target)})})(jQuery);  
(function(a,e){a.widget("mobile.slider",a.mobile.widget,{options:{theme:null,trackTheme:null,disabled:false,initSelector:"input[type='range'], :jqmData(type='range'), :jqmData(role='slider')"},_create:function(){var b=this,c=this.element,f=a.mobile.getInheritedTheme(c,"c"),d=this.options.theme||f,g=this.options.trackTheme||f,h=c[0].nodeName.toLowerCase(),f=h=="select"?"ui-slider-switch":"",i=c.attr("id"),k=i+"-label",i=a("[for='"+i+"']").attr("id",k),m=function(){return h=="input"?parseFloat(c.val()):  
c[0].selectedIndex},q=h=="input"?parseFloat(c.attr("min")):0,o=h=="input"?parseFloat(c.attr("max")):c.find("option").length-1,l=window.parseFloat(c.attr("step")||1),j=a("<div class='ui-slider "+f+" ui-btn-down-"+g+" ui-btn-corner-all' role='application'></div>"),p=a("<a href='#' class='ui-slider-handle'></a>").appendTo(j).buttonMarkup({corners:true,theme:d,shadow:true}).attr({role:"slider","aria-valuemin":q,"aria-valuemax":o,"aria-valuenow":m(),"aria-valuetext":m(),title:m(),"aria-labelledby":k});  
a.extend(this,{slider:j,handle:p,dragging:false,beforeStart:null,userModified:false,mouseMoved:false});h=="select"&&(j.wrapInner("<div class='ui-slider-inneroffset'></div>"),p.addClass("ui-slider-handle-snapping"),c.find("option"),c.find("option").each(function(b){var c=!b?"b":"a",d=!b?"right":"left",b=!b?" ui-btn-down-"+g:" "+a.mobile.activeBtnClass;a("<div class='ui-slider-labelbg ui-slider-labelbg-"+c+b+" ui-btn-corner-"+d+"'></div>").prependTo(j);a("<span class='ui-slider-label ui-slider-label-"+  
c+b+" ui-btn-corner-"+d+"' role='img'>"+a(this).getEncodedText()+"</span>").prependTo(p)}));i.addClass("ui-slider");c.addClass(h==="input"?"ui-slider-input":"ui-slider-switch").change(function(){b.mouseMoved||b.refresh(m(),true)}).keyup(function(){b.refresh(m(),true,true)}).blur(function(){b.refresh(m(),true)});a(document).bind("vmousemove",function(a){if(b.dragging)return b.mouseMoved=true,h==="select"&&p.removeClass("ui-slider-handle-snapping"),b.refresh(a),b.userModified=b.beforeStart!==c[0].selectedIndex,  
false});j.bind("vmousedown",function(a){b.dragging=true;b.userModified=false;b.mouseMoved=false;if(h==="select")b.beforeStart=c[0].selectedIndex;b.refresh(a);return false});j.add(document).bind("vmouseup",function(){if(b.dragging)return b.dragging=false,h==="select"&&(p.addClass("ui-slider-handle-snapping"),b.mouseMoved?b.userModified?b.refresh(b.beforeStart==0?1:0):b.refresh(b.beforeStart):b.refresh(b.beforeStart==0?1:0)),b.mouseMoved=false});j.insertAfter(c);this.handle.bind("vmousedown",function(){a(this).focus()}).bind("vclick",  
false);this.handle.bind("keydown",function(c){var d=m();if(!b.options.disabled){switch(c.keyCode){case a.mobile.keyCode.HOME:case a.mobile.keyCode.END:case a.mobile.keyCode.PAGE_UP:case a.mobile.keyCode.PAGE_DOWN:case a.mobile.keyCode.UP:case a.mobile.keyCode.RIGHT:case a.mobile.keyCode.DOWN:case a.mobile.keyCode.LEFT:if(c.preventDefault(),!b._keySliding)b._keySliding=true,a(this).addClass("ui-state-active")}switch(c.keyCode){case a.mobile.keyCode.HOME:b.refresh(q);break;case a.mobile.keyCode.END:b.refresh(o);  
break;case a.mobile.keyCode.PAGE_UP:case a.mobile.keyCode.UP:case a.mobile.keyCode.RIGHT:b.refresh(d+l);break;case a.mobile.keyCode.PAGE_DOWN:case a.mobile.keyCode.DOWN:case a.mobile.keyCode.LEFT:b.refresh(d-l)}}}).keyup(function(){if(b._keySliding)b._keySliding=false,a(this).removeClass("ui-state-active")});this.refresh(e,e,true)},refresh:function(a,c,f){(this.options.disabled||this.element.attr("disabled"))&&this.disable();var d=this.element,e,h=d[0].nodeName.toLowerCase(),i=h==="input"?parseFloat(d.attr("min")):  
0,k=h==="input"?parseFloat(d.attr("max")):d.find("option").length-1;if(typeof a==="object"){if(!this.dragging||a.pageX<this.slider.offset().left-8||a.pageX>this.slider.offset().left+this.slider.width()+8)return;e=Math.round((a.pageX-this.slider.offset().left)/this.slider.width()*100)}else a==null&&(a=h==="input"?parseFloat(d.val()):d[0].selectedIndex),e=(parseFloat(a)-i)/(k-i)*100;if(!isNaN(e)&&(e<0&&(e=0),e>100&&(e=100),a=Math.round(e/100*(k-i))+i,a<i&&(a=i),a>k&&(a=k),this.handle.css("left",e+"%"),  
this.handle.attr({"aria-valuenow":h==="input"?a:d.find("option").eq(a).attr("value"),"aria-valuetext":h==="input"?a:d.find("option").eq(a).getEncodedText(),title:a}),h==="select"&&(a===0?this.slider.addClass("ui-slider-switch-a").removeClass("ui-slider-switch-b"):this.slider.addClass("ui-slider-switch-b").removeClass("ui-slider-switch-a")),!f))f=false,h==="input"?(f=d.val()!==a,d.val(a)):(f=d[0].selectedIndex!==a,d[0].selectedIndex=a),!c&&f&&d.trigger("change")},enable:function(){this.element.attr("disabled",  
false);this.slider.removeClass("ui-disabled").attr("aria-disabled",false);return this._setOption("disabled",false)},disable:function(){this.element.attr("disabled",true);this.slider.addClass("ui-disabled").attr("aria-disabled",true);return this._setOption("disabled",true)}});a(document).bind("pagecreate create",function(b){a.mobile.slider.prototype.enhanceWithin(b.target)})})(jQuery);  
(function(a){a.widget("mobile.textinput",a.mobile.widget,{options:{theme:null,initSelector:"input[type='text'], input[type='search'], :jqmData(type='search'), input[type='number'], :jqmData(type='number'), input[type='password'], input[type='email'], input[type='url'], input[type='tel'], textarea, input[type='time'], input[type='date'], input[type='month'], input[type='week'], input[type='datetime'], input[type='datetime-local'], input[type='color'], input:not([type])"},_create:function(){var e=this.element,  
b=this.options.theme||a.mobile.getInheritedTheme(this.element,"c"),c=" ui-body-"+b,f,d;a("label[for='"+e.attr("id")+"']").addClass("ui-input-text");f=e.addClass("ui-input-text ui-body-"+b);typeof e[0].autocorrect!=="undefined"&&!a.support.touchOverflow&&(e[0].setAttribute("autocorrect","off"),e[0].setAttribute("autocomplete","off"));e.is("[type='search'],:jqmData(type='search')")?(f=e.wrap("<div class='ui-input-search ui-shadow-inset ui-btn-corner-all ui-btn-shadow ui-icon-searchfield"+c+"'></div>").parent(),  
d=a("<a href='#' class='ui-input-clear' title='clear text'>clear text</a>").tap(function(a){e.val("").focus();e.trigger("change");d.addClass("ui-input-clear-hidden");a.preventDefault()}).appendTo(f).buttonMarkup({icon:"delete",iconpos:"notext",corners:true,shadow:true}),b=function(){setTimeout(function(){d.toggleClass("ui-input-clear-hidden",!e.val())},0)},b(),e.bind("paste cut keyup focus change blur",b)):e.addClass("ui-corner-all ui-shadow-inset"+c);e.focus(function(){f.addClass("ui-focus")}).blur(function(){f.removeClass("ui-focus")});  
if(e.is("textarea")){var g=function(){var a=e[0].scrollHeight;e[0].clientHeight<a&&e.height(a+15)},h;e.keyup(function(){clearTimeout(h);h=setTimeout(g,100)});a.trim(e.val())&&(a(window).load(g),a(document).one("pagechange",g))}},disable:function(){(this.element.attr("disabled",true).is("[type='search'],:jqmData(type='search')")?this.element.parent():this.element).addClass("ui-disabled")},enable:function(){(this.element.attr("disabled",false).is("[type='search'],:jqmData(type='search')")?this.element.parent():  
this.element).removeClass("ui-disabled")}});a(document).bind("pagecreate create",function(e){a.mobile.textinput.prototype.enhanceWithin(e.target)})})(jQuery);  
(function(a){var e=function(b){var c=b.selectID,f=b.label,d=b.select.closest(".ui-page"),e=a("<div>",{"class":"ui-selectmenu-screen ui-screen-hidden"}).appendTo(d),h=b._selectOptions(),i=b.isMultiple=b.select[0].multiple,k=c+"-button",m=c+"-menu",q=a("<div data-"+a.mobile.ns+"role='dialog' data-"+a.mobile.ns+"theme='"+b.options.theme+"' data-"+a.mobile.ns+"overlay-theme='"+b.options.overlayTheme+"'><div data-"+a.mobile.ns+"role='header'><div class='ui-title'>"+f.getEncodedText()+"</div></div><div data-"+  
a.mobile.ns+"role='content'></div></div>").appendTo(a.mobile.pageContainer).page(),o=a("<div>",{"class":"ui-selectmenu ui-selectmenu-hidden ui-overlay-shadow ui-corner-all ui-body-"+b.options.overlayTheme+" "+a.mobile.defaultDialogTransition}).insertAfter(e),l=a("<ul>",{"class":"ui-selectmenu-list",id:m,role:"listbox","aria-labelledby":k}).attr("data-"+a.mobile.ns+"theme",b.options.theme).appendTo(o),j=a("<div>",{"class":"ui-header ui-bar-"+b.options.theme}).prependTo(o),p=a("<h1>",{"class":"ui-title"}).appendTo(j),  
n=a("<a>",{text:b.options.closeText,href:"#","class":"ui-btn-left"}).attr("data-"+a.mobile.ns+"iconpos","notext").attr("data-"+a.mobile.ns+"icon","delete").appendTo(j).buttonMarkup(),A=q.find(".ui-content"),z=q.find(".ui-header a");a.extend(b,{select:b.select,selectID:c,buttonId:k,menuId:m,thisPage:d,menuPage:q,label:f,screen:e,selectOptions:h,isMultiple:i,theme:b.options.theme,listbox:o,list:l,header:j,headerTitle:p,headerClose:n,menuPageContent:A,menuPageClose:z,placeholder:"",build:function(){var b=  
this;b.refresh();b.select.attr("tabindex","-1").focus(function(){a(this).blur();b.button.focus()});b.button.bind("vclick keydown",function(c){if(c.type=="vclick"||c.keyCode&&(c.keyCode===a.mobile.keyCode.ENTER||c.keyCode===a.mobile.keyCode.SPACE))b.open(),c.preventDefault()});b.list.attr("role","listbox").delegate(".ui-li>a","focusin",function(){a(this).attr("tabindex","0")}).delegate(".ui-li>a","focusout",function(){a(this).attr("tabindex","-1")}).delegate("li:not(.ui-disabled, .ui-li-divider)",  
"click",function(c){var d=b.select[0].selectedIndex,f=b.list.find("li:not(.ui-li-divider)").index(this),e=b._selectOptions().eq(f)[0];e.selected=b.isMultiple?!e.selected:true;b.isMultiple&&a(this).find(".ui-icon").toggleClass("ui-icon-checkbox-on",e.selected).toggleClass("ui-icon-checkbox-off",!e.selected);(b.isMultiple||d!==f)&&b.select.trigger("change");b.isMultiple||b.close();c.preventDefault()}).keydown(function(b){var c=a(b.target),d=c.closest("li");switch(b.keyCode){case 38:return b=d.prev(),  
b.length&&(c.blur().attr("tabindex","-1"),b.find("a").first().focus()),false;case 40:return b=d.next(),b.length&&(c.blur().attr("tabindex","-1"),b.find("a").first().focus()),false;case 13:case 32:return c.trigger("click"),false}});b.menuPage.bind("pagehide",function(){b.list.appendTo(b.listbox);b._focusButton();a.mobile._bindPageRemove.call(b.thisPage)});b.screen.bind("vclick",function(){b.close()});b.headerClose.click(function(){if(b.menuType=="overlay")return b.close(),false});b.thisPage.addDependents(this.menuPage)},  
_isRebuildRequired:function(){var a=this.list.find("li");return this._selectOptions().text()!==a.text()},refresh:function(b){var c=this;this._selectOptions();this.selected();var d=this.selectedIndices();(b||this._isRebuildRequired())&&c._buildList();c.setButtonText();c.setButtonCount();c.list.find("li:not(.ui-li-divider)").removeClass(a.mobile.activeBtnClass).attr("aria-selected",false).each(function(b){a.inArray(b,d)>-1&&(b=a(this),b.attr("aria-selected",true),c.isMultiple?b.find(".ui-icon").removeClass("ui-icon-checkbox-off").addClass("ui-icon-checkbox-on"):  
b.addClass(a.mobile.activeBtnClass))})},close:function(){if(!this.options.disabled&&this.isOpen)this.menuType=="page"?window.history.back():(this.screen.addClass("ui-screen-hidden"),this.listbox.addClass("ui-selectmenu-hidden").removeAttr("style").removeClass("in"),this.list.appendTo(this.listbox),this._focusButton()),this.isOpen=false},open:function(){if(!this.options.disabled){var b=this,c=b.list.parent().outerHeight(),d=b.list.parent().outerWidth(),f=a(".ui-page-active"),e=a.support.touchOverflow&&  
a.mobile.touchOverflowEnabled,f=f.is(".ui-native-fixed")?f.find(".ui-content"):f;scrollTop=e?f.scrollTop():a(window).scrollTop();btnOffset=b.button.offset().top;screenHeight=window.innerHeight;screenWidth=window.innerWidth;b.button.addClass(a.mobile.activeBtnClass);setTimeout(function(){b.button.removeClass(a.mobile.activeBtnClass)},300);if(c>screenHeight-80||!a.support.scrollTop){b.thisPage.unbind("pagehide.remove");if(scrollTop==0&&btnOffset>screenHeight)b.thisPage.one("pagehide",function(){a(this).jqmData("lastScroll",  
btnOffset)});b.menuPage.one("pageshow",function(){a(window).one("silentscroll",function(){b.list.find(a.mobile.activeBtnClass).focus()});b.isOpen=true});b.menuType="page";b.menuPageContent.append(b.list);b.menuPage.find("div .ui-title").text(b.label.text());a.mobile.changePage(b.menuPage,{transition:a.mobile.defaultDialogTransition})}else{b.menuType="overlay";b.screen.height(a(document).height()).removeClass("ui-screen-hidden");var f=btnOffset-scrollTop,g=scrollTop+screenHeight-btnOffset,h=c/2,e=  
parseFloat(b.list.parent().css("max-width")),c=f>c/2&&g>c/2?btnOffset+b.button.outerHeight()/2-h:f>g?scrollTop+screenHeight-c-30:scrollTop+30;d<e?e=(screenWidth-d)/2:(e=b.button.offset().left+b.button.outerWidth()/2-d/2,e<30?e=30:e+d>screenWidth&&(e=screenWidth-d-30));b.listbox.append(b.list).removeClass("ui-selectmenu-hidden").css({top:c,left:e}).addClass("in");b.list.find(a.mobile.activeBtnClass).focus();b.isOpen=true}}},_buildList:function(){var b=this,c=this.options,d=this.placeholder,f=[],e=  
[],g=b.isMultiple?"checkbox-off":"false";b.list.empty().filter(".ui-listview").listview("destroy");b.select.find("option").each(function(h){var j=a(this),i=j.parent(),l=j.getEncodedText(),o="<a href='#'>"+l+"</a>",k=[],n=[];i.is("optgroup")&&(i=i.attr("label"),a.inArray(i,f)===-1&&(e.push("<li data-"+a.mobile.ns+"role='list-divider'>"+i+"</li>"),f.push(i)));if(!this.getAttribute("value")||l.length==0||j.jqmData("placeholder"))c.hidePlaceholderMenuItems&&k.push("ui-selectmenu-placeholder"),d=b.placeholder=  
l;this.disabled&&(k.push("ui-disabled"),n.push("aria-disabled='true'"));e.push("<li data-"+a.mobile.ns+"option-index='"+h+"' data-"+a.mobile.ns+"icon='"+g+"' class='"+k.join(" ")+"' "+n.join(" ")+">"+o+"</li>")});b.list.html(e.join(" "));b.list.find("li").attr({role:"option",tabindex:"-1"}).first().attr("tabindex","0");this.isMultiple||this.headerClose.hide();!this.isMultiple&&!d.length?this.header.hide():this.headerTitle.text(this.placeholder);b.list.listview()},_button:function(){return a("<a>",  
{href:"#",role:"button",id:this.buttonId,"aria-haspopup":"true","aria-owns":this.menuId})}})};a("select").live("selectmenubeforecreate",function(){var b=a(this).data("selectmenu");b.options.nativeMenu||e(b)})})(jQuery);  
(function(a){a.widget("mobile.selectmenu",a.mobile.widget,{options:{theme:null,disabled:false,icon:"arrow-d",iconpos:"right",inline:null,corners:true,shadow:true,iconshadow:true,menuPageTheme:"b",overlayTheme:"a",hidePlaceholderMenuItems:true,closeText:"Close",nativeMenu:true,initSelector:"select:not(:jqmData(role='slider'))"},_button:function(){return a("<div/>")},_setDisabled:function(a){this.element.attr("disabled",a);this.button.attr("aria-disabled",a);return this._setOption("disabled",a)},_focusButton:function(){var a=  
this;setTimeout(function(){a.button.focus()},40)},_selectOptions:function(){return this.select.find("option")},_preExtension:function(){this.select=this.element.wrap("<div class='ui-select'>");this.selectID=this.select.attr("id");this.label=a("label[for='"+this.selectID+"']").addClass("ui-select");this.isMultiple=this.select[0].multiple;if(!this.options.theme)this.options.theme=a.mobile.getInheritedTheme(this.select,"c")},_create:function(){this._preExtension();this._trigger("beforeCreate");this.button=  
this._button();var e=this,b=this.options,c=this.button.text(a(this.select[0].options.item(this.select[0].selectedIndex==-1?0:this.select[0].selectedIndex)).text()).insertBefore(this.select).buttonMarkup({theme:b.theme,icon:b.icon,iconpos:b.iconpos,inline:b.inline,corners:b.corners,shadow:b.shadow,iconshadow:b.iconshadow});b.nativeMenu&&window.opera&&window.opera.version&&this.select.addClass("ui-select-nativeonly");if(this.isMultiple)this.buttonCount=a("<span>").addClass("ui-li-count ui-btn-up-c ui-btn-corner-all").hide().appendTo(c.addClass("ui-li-has-count"));  
(b.disabled||this.element.attr("disabled"))&&this.disable();this.select.change(function(){e.refresh()});this.build()},build:function(){var e=this;this.select.appendTo(e.button).bind("vmousedown",function(){e.button.addClass(a.mobile.activeBtnClass)}).bind("focus vmouseover",function(){e.button.trigger("vmouseover")}).bind("vmousemove",function(){e.button.removeClass(a.mobile.activeBtnClass)}).bind("change blur vmouseout",function(){e.button.trigger("vmouseout").removeClass(a.mobile.activeBtnClass)}).bind("change blur",  
function(){e.button.removeClass("ui-btn-down-"+e.options.theme)})},selected:function(){return this._selectOptions().filter(":selected")},selectedIndices:function(){var a=this;return this.selected().map(function(){return a._selectOptions().index(this)}).get()},setButtonText:function(){var e=this,b=this.selected();this.button.find(".ui-btn-text").text(function(){return!e.isMultiple?b.text():b.length?b.map(function(){return a(this).text()}).get().join(", "):e.placeholder})},setButtonCount:function(){var a=  
this.selected();this.isMultiple&&this.buttonCount[a.length>1?"show":"hide"]().text(a.length)},refresh:function(){this.setButtonText();this.setButtonCount()},open:a.noop,close:a.noop,disable:function(){this._setDisabled(true);this.button.addClass("ui-disabled")},enable:function(){this._setDisabled(false);this.button.removeClass("ui-disabled")}});a(document).bind("pagecreate create",function(e){a.mobile.selectmenu.prototype.enhanceWithin(e.target)})})(jQuery);  
(function(a,e){function b(b){for(var c;b;){if((c=b.className&&b.className.split(" "))&&a.inArray("ui-btn",c)>-1&&a.inArray("ui-disabled",c)<0)break;b=b.parentNode}return b}a.fn.buttonMarkup=function(b){for(var b=b||{},d=0;d<this.length;d++){var g=this.eq(d),h=g[0],i=a.extend({},a.fn.buttonMarkup.defaults,{icon:b.icon!==e?b.icon:g.jqmData("icon"),iconpos:b.iconpos!==e?b.iconpos:g.jqmData("iconpos"),theme:b.theme!==e?b.theme:g.jqmData("theme"),inline:b.inline!==e?b.inline:g.jqmData("inline"),shadow:b.shadow!==  
e?b.shadow:g.jqmData("shadow"),corners:b.corners!==e?b.corners:g.jqmData("corners"),iconshadow:b.iconshadow!==e?b.iconshadow:g.jqmData("iconshadow")},b),k="ui-btn-inner",m,q,o=document.createElement(i.wrapperEls),l=document.createElement(i.wrapperEls),j=i.icon?document.createElement("span"):null;c&&c();if(!i.theme)i.theme=a.mobile.getInheritedTheme(g,"c");m="ui-btn ui-btn-up-"+i.theme;i.inline&&(m+=" ui-btn-inline");if(i.icon)i.icon="ui-icon-"+i.icon,i.iconpos=i.iconpos||"left",q="ui-icon "+i.icon,  
i.iconshadow&&(q+=" ui-icon-shadow");i.iconpos&&(m+=" ui-btn-icon-"+i.iconpos,i.iconpos=="notext"&&!g.attr("title")&&g.attr("title",g.getEncodedText()));i.corners&&(m+=" ui-btn-corner-all",k+=" ui-btn-corner-all");i.shadow&&(m+=" ui-shadow");g.attr("data-"+a.mobile.ns+"theme",i.theme).addClass(m);o.className=k;o.setAttribute("aria-hidden","true");l.className="ui-btn-text";o.appendChild(l);if(j)j.className=q,o.appendChild(j);for(;h.firstChild;)l.appendChild(h.firstChild);h.appendChild(o);g.data("textWrapper",  
a(l))}return this};a.fn.buttonMarkup.defaults={corners:true,shadow:true,iconshadow:true,inline:false,wrapperEls:"span"};var c=function(){a(document).bind({vmousedown:function(c){var c=b(c.target),d;c&&(c=a(c),d=c.attr("data-"+a.mobile.ns+"theme"),c.removeClass("ui-btn-up-"+d).addClass("ui-btn-down-"+d))},"vmousecancel vmouseup":function(c){var c=b(c.target),d;c&&(c=a(c),d=c.attr("data-"+a.mobile.ns+"theme"),c.removeClass("ui-btn-down-"+d).addClass("ui-btn-up-"+d))},"vmouseover focus":function(c){var c=  
b(c.target),d;c&&(c=a(c),d=c.attr("data-"+a.mobile.ns+"theme"),c.removeClass("ui-btn-up-"+d).addClass("ui-btn-hover-"+d))},"vmouseout blur":function(c){var c=b(c.target),d;c&&(c=a(c),d=c.attr("data-"+a.mobile.ns+"theme"),c.removeClass("ui-btn-hover-"+d+" ui-btn-down-"+d).addClass("ui-btn-up-"+d))}});c=null};a(document).bind("pagecreate create",function(b){a(":jqmData(role='button'), .ui-bar > a, .ui-header > a, .ui-footer > a, .ui-bar > :jqmData(role='controlgroup') > a",b.target).not(".ui-btn, :jqmData(role='none'), :jqmData(role='nojs')").buttonMarkup()})})(jQuery);  
(function(a){a.fn.controlgroup=function(e){return this.each(function(){function b(a){a.removeClass("ui-btn-corner-all ui-shadow").eq(0).addClass(g[0]).end().filter(":last").addClass(g[1]).addClass("ui-controlgroup-last")}var c=a(this),f=a.extend({direction:c.jqmData("type")||"vertical",shadow:false,excludeInvisible:true},e),d=c.find(">legend"),g=f.direction=="horizontal"?["ui-corner-left","ui-corner-right"]:["ui-corner-top","ui-corner-bottom"];c.find("input:eq(0)").attr("type");d.length&&(c.wrapInner("<div class='ui-controlgroup-controls'></div>"),  
a("<div role='heading' class='ui-controlgroup-label'>"+d.html()+"</div>").insertBefore(c.children(0)),d.remove());c.addClass("ui-corner-all ui-controlgroup ui-controlgroup-"+f.direction);b(c.find(".ui-btn"+(f.excludeInvisible?":visible":"")));b(c.find(".ui-btn-inner"));f.shadow&&c.addClass("ui-shadow")})};a(document).bind("pagecreate create",function(e){a(":jqmData(role='controlgroup')",e.target).controlgroup({excludeInvisible:false})})})(jQuery);  
(function(a){a(document).bind("pagecreate create",function(e){a(e.target).find("a").not(".ui-btn, .ui-link-inherit, :jqmData(role='none'), :jqmData(role='nojs')").addClass("ui-link")})})(jQuery);  
(function(a,e){a.fn.fixHeaderFooter=function(){return!a.support.scrollTop||a.support.touchOverflow&&a.mobile.touchOverflowEnabled?this:this.each(function(){var b=a(this);b.jqmData("fullscreen")&&b.addClass("ui-page-fullscreen");b.find(".ui-header:jqmData(position='fixed')").addClass("ui-header-fixed ui-fixed-inline fade");b.find(".ui-footer:jqmData(position='fixed')").addClass("ui-footer-fixed ui-fixed-inline fade")})};a.mobile.fixedToolbars=function(){function b(){!i&&h==="overlay"&&(g||a.mobile.fixedToolbars.hide(true),  
a.mobile.fixedToolbars.startShowTimer())}function c(a){var b=0,c,d;if(a){d=document.body;c=a.offsetParent;for(b=a.offsetTop;a&&a!=d;){b+=a.scrollTop||0;if(a==c)b+=c.offsetTop,c=a.offsetParent;a=a.parentNode}}return b}function f(b){var d=a(window).scrollTop(),e=c(b[0]),f=b.css("top")=="auto"?0:parseFloat(b.css("top")),g=window.innerHeight,h=b.outerHeight(),i=b.parents(".ui-page:not(.ui-page-fullscreen)").length;return b.is(".ui-header-fixed")?(f=d-e+f,f<e&&(f=0),b.css("top",i?f:d)):b.css("top",i?d+  
g-h-(e-f):d+g-h)}if(a.support.scrollTop&&(!a.support.touchOverflow||!a.mobile.touchOverflowEnabled)){var d,g,h="inline",i=false,k=null,m=false,q=true;a(function(){var c=a(document),d=a(window);c.bind("vmousedown",function(){q&&(k=h)}).bind("vclick",function(b){q&&!a(b.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length&&!m&&(a.mobile.fixedToolbars.toggle(k),k=null)}).bind("silentscroll",b);(c.scrollTop()===0?d:c).bind("scrollstart",function(){m=true;k===  
null&&(k=h);var b=k=="overlay";if(i=b||!!g)a.mobile.fixedToolbars.clearShowTimer(),b&&a.mobile.fixedToolbars.hide(true)}).bind("scrollstop",function(b){a(b.target).closest("a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed").length||(m=false,i&&(a.mobile.fixedToolbars.startShowTimer(),i=false),k=null)});d.bind("resize updatelayout",b)});a(".ui-page").live("pagebeforeshow",function(b,c){var e=a(b.target).find(":jqmData(role='footer')"),g=e.data("id"),h=c.prevPage,h=h&&h.find(":jqmData(role='footer')"),  
h=h.length&&h.jqmData("id")===g;g&&h&&(d=e,f(d.removeClass("fade in out").appendTo(a.mobile.pageContainer)))}).live("pageshow",function(){var b=a(this);d&&d.length&&setTimeout(function(){f(d.appendTo(b).addClass("fade"));d=null},500);a.mobile.fixedToolbars.show(true,this)});a(".ui-collapsible-contain").live("collapse expand",b);return{show:function(b,d){a.mobile.fixedToolbars.clearShowTimer();h="overlay";return(d?a(d):a.mobile.activePage?a.mobile.activePage:a(".ui-page-active")).children(".ui-header-fixed:first, .ui-footer-fixed:not(.ui-footer-duplicate):last").each(function(){var d=  
a(this),e=a(window).scrollTop(),g=c(d[0]),h=window.innerHeight,i=d.outerHeight(),e=d.is(".ui-header-fixed")&&e<=g+i||d.is(".ui-footer-fixed")&&g<=e+h;d.addClass("ui-fixed-overlay").removeClass("ui-fixed-inline");!e&&!b&&d.animationComplete(function(){d.removeClass("in")}).addClass("in");f(d)})},hide:function(b){h="inline";return(a.mobile.activePage?a.mobile.activePage:a(".ui-page-active")).children(".ui-header-fixed:first, .ui-footer-fixed:not(.ui-footer-duplicate):last").each(function(){var c=a(this),  
d=c.css("top"),d=d=="auto"?0:parseFloat(d);c.addClass("ui-fixed-inline").removeClass("ui-fixed-overlay");if(d<0||c.is(".ui-header-fixed")&&d!==0)b?c.css("top",0):c.css("top")!=="auto"&&parseFloat(c.css("top"))!==0&&c.animationComplete(function(){c.removeClass("out reverse").css("top",0)}).addClass("out reverse")})},startShowTimer:function(){a.mobile.fixedToolbars.clearShowTimer();var b=[].slice.call(arguments);g=setTimeout(function(){g=e;a.mobile.fixedToolbars.show.apply(null,b)},100)},clearShowTimer:function(){g&&  
clearTimeout(g);g=e},toggle:function(b){b&&(h=b);return h==="overlay"?a.mobile.fixedToolbars.hide():a.mobile.fixedToolbars.show()},setTouchToggleEnabled:function(a){q=a}}}}();a(document).bind("pagecreate create",function(b){a(":jqmData(position='fixed')",b.target).length&&a(b.target).each(function(){if(!a.support.scrollTop||a.support.touchOverflow&&a.mobile.touchOverflowEnabled)return this;var b=a(this);b.jqmData("fullscreen")&&b.addClass("ui-page-fullscreen");b.find(".ui-header:jqmData(position='fixed')").addClass("ui-header-fixed ui-fixed-inline fade");  
b.find(".ui-footer:jqmData(position='fixed')").addClass("ui-footer-fixed ui-fixed-inline fade")})})})(jQuery);  
(function(a){a.mobile.touchOverflowEnabled=false;a.mobile.touchOverflowZoomEnabled=false;a(document).bind("pagecreate",function(e){a.support.touchOverflow&&a.mobile.touchOverflowEnabled&&(e=a(e.target),e.is(":jqmData(role='page')")&&e.each(function(){var b=a(this),c=b.find(":jqmData(role='header'), :jqmData(role='footer')").filter(":jqmData(position='fixed')"),e=b.jqmData("fullscreen"),d=c.length?b.find(".ui-content"):b;b.addClass("ui-mobile-touch-overflow");d.bind("scrollstop",function(){d.scrollTop()>  
0&&window.scrollTo(0,a.mobile.defaultHomeScroll)});c.length&&(b.addClass("ui-native-fixed"),e&&(b.addClass("ui-native-fullscreen"),c.addClass("fade in"),a(document).bind("vclick",function(){c.removeClass("ui-native-bars-hidden").toggleClass("in out").animationComplete(function(){a(this).not(".in").addClass("ui-native-bars-hidden")})})))}))})})(jQuery);  
(function(a,e){function b(){var b=a("meta[name='viewport']");b.length?b.attr("content",b.attr("content")+", user-scalable=no"):a("head").prepend("<meta>",{name:"viewport",content:"user-scalable=no"})}var c=a("html");a("head");var f=a(e);a(e.document).trigger("mobileinit");if(a.mobile.gradeA()){if(a.mobile.ajaxBlacklist)a.mobile.ajaxEnabled=false;c.addClass("ui-mobile ui-mobile-rendering");var d=a("<div class='ui-loader ui-body-a ui-corner-all'><span class='ui-icon ui-icon-loading spin'></span><h1></h1></div>");  
a.extend(a.mobile,{showPageLoadingMsg:function(){if(a.mobile.loadingMessage){var b=a("."+a.mobile.activeBtnClass).first();d.find("h1").text(a.mobile.loadingMessage).end().appendTo(a.mobile.pageContainer).css({top:a.support.scrollTop&&f.scrollTop()+f.height()/2||b.length&&b.offset().top||100})}c.addClass("ui-loading")},hidePageLoadingMsg:function(){c.removeClass("ui-loading")},initializePage:function(){var b=a(":jqmData(role='page')");b.length||(b=a("body").wrapInner("<div data-"+a.mobile.ns+"role='page'></div>").children(0));  
b.add(":jqmData(role='dialog')").each(function(){var b=a(this);b.jqmData("url")||b.attr("data-"+a.mobile.ns+"url",b.attr("id")||location.pathname+location.search)});a.mobile.firstPage=b.first();a.mobile.pageContainer=b.first().parent().addClass("ui-mobile-viewport");f.trigger("pagecontainercreate");a.mobile.showPageLoadingMsg();!a.mobile.hashListeningEnabled||!a.mobile.path.stripHash(location.hash)?a.mobile.changePage(a.mobile.firstPage,{transition:"none",reverse:true,changeHash:false,fromHashChange:true}):  
f.trigger("hashchange",[true])}});a.support.touchOverflow&&a.mobile.touchOverflowEnabled&&!a.mobile.touchOverflowZoomEnabled&&b();a.mobile._registerInternalEvents();a(function(){e.scrollTo(0,1);a.mobile.defaultHomeScroll=!a.support.scrollTop||a(e).scrollTop()===1?0:1;a.mobile.autoInitializePage&&a.mobile.initializePage();f.load(a.mobile.silentScroll)})}})(jQuery,this);  
 
directory:b/js/yepnope (new)
 
file:a/labs/OpenStreetMap.js (deleted)
/**  
* Namespace: Util.OSM  
*/  
OpenLayers.Util.OSM = {};  
 
/**  
* Constant: MISSING_TILE_URL  
* {String} URL of image to display for missing tiles  
*/  
OpenLayers.Util.OSM.MISSING_TILE_URL = "/404.php";  
 
/**  
* Property: originalOnImageLoadError  
* {Function} Original onImageLoadError function.  
*/  
OpenLayers.Util.OSM.originalOnImageLoadError = OpenLayers.Util.onImageLoadError;  
 
/**  
* Function: onImageLoadError  
*/  
OpenLayers.Util.onImageLoadError = function() {  
if (this.src.match(/^http:\/\/[abc]\.[a-z]+\.openstreetmap\.org\//)) {  
this.src = OpenLayers.Util.OSM.MISSING_TILE_URL;  
} else if (this.src.match(/^http:\/\/[def]\.tah\.openstreetmap\.org\//)) {  
// do nothing - this layer is transparent  
} else {  
OpenLayers.Util.OSM.originalOnImageLoadError;  
}  
};  
 
/**  
* Class: OpenLayers.Layer.OSM.Mapnik  
*  
* Inherits from:  
* - <OpenLayers.Layer.OSM>  
*/  
OpenLayers.Layer.OSM.Mapnik = OpenLayers.Class(OpenLayers.Layer.OSM, {  
/**  
* Constructor: OpenLayers.Layer.OSM.Mapnik  
*  
* Parameters:  
* name - {String}  
* options - {Object} Hashtable of extra options to tag onto the layer  
*/  
initialize: function(name, options) {  
var url = [  
"http://a.tiles.bigtincan.com/${z}/${x}/${y}.png",  
"http://b.tiles.bigtincan.com/${z}/${x}/${y}.png",  
"http://c.tiles.bigtincan.com/${z}/${x}/${y}.png"  
];  
options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);  
var newArguments = [name, url, options];  
OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);  
},  
 
CLASS_NAME: "OpenLayers.Layer.OSM.Mapnik"  
});  
 
OpenLayers.Layer.OSM.NearMap = OpenLayers.Class(OpenLayers.Layer.OSM, {  
/**  
* Constructor: OpenLayers.Layer.OSM.Mapnik  
*  
* Parameters:  
* name - {String}  
* options - {Object} Hashtable of extra options to tag onto the layer  
*/  
initialize: function(name, options) {  
var url = [  
"http://nearmap:findreality@web0.nearmap.com/maps/hl=en&nml=Vert&x=${x}&y=${y}&z=${z}",  
"http://nearmap:findreality@web1.nearmap.com/maps/hl=en&nml=Vert&x=${x}&y=${y}&z=${z}",  
"http://nearmap:findreality@web2.nearmap.com/maps/hl=en&nml=Vert&x=${x}&y=${y}&z=${z}",  
"http://nearmap:findreality@web3.nearmap.com/maps/hl=en&nml=Vert&x=${x}&y=${y}&z=${z}"  
];  
options = OpenLayers.Util.extend({ numZoomLevels: 22 }, options);  
var newArguments = [name, url, options];  
OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);  
},  
 
CLASS_NAME: "OpenLayers.Layer.OSM.NearMap"  
});  
 
/**  
* Class: OpenLayers.Layer.OSM.Osmarender  
*  
* Inherits from:  
* - <OpenLayers.Layer.OSM>  
*/  
OpenLayers.Layer.OSM.Osmarender = OpenLayers.Class(OpenLayers.Layer.OSM, {  
/**  
* Constructor: OpenLayers.Layer.OSM.Osmarender  
*  
* Parameters:  
* name - {String}  
* options - {Object} Hashtable of extra options to tag onto the layer  
*/  
initialize: function(name, options) {  
var url = [  
"http://a.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",  
"http://b.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",  
"http://c.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png"  
];  
options = OpenLayers.Util.extend({ numZoomLevels: 18 }, options);  
var newArguments = [name, url, options];  
OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);  
},  
 
CLASS_NAME: "OpenLayers.Layer.OSM.Osmarender"  
});  
 
/**  
* Class: OpenLayers.Layer.OSM.CycleMap  
*  
* Inherits from:  
* - <OpenLayers.Layer.OSM>  
*/  
OpenLayers.Layer.OSM.CycleMap = OpenLayers.Class(OpenLayers.Layer.OSM, {  
/**  
* Constructor: OpenLayers.Layer.OSM.CycleMap  
*  
* Parameters:  
* name - {String}  
* options - {Object} Hashtable of extra options to tag onto the layer  
*/  
initialize: function(name, options) {  
var url = [  
"http://a.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png",  
"http://b.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png",  
"http://c.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png"  
];  
options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);  
var newArguments = [name, url, options];  
OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);  
},  
 
CLASS_NAME: "OpenLayers.Layer.OSM.CycleMap"  
});  
 
/**  
* Class: OpenLayers.Layer.OSM.Maplint  
*  
* Inherits from:  
* - <OpenLayers.Layer.OSM>  
*/  
OpenLayers.Layer.OSM.Maplint = OpenLayers.Class(OpenLayers.Layer.OSM, {  
/**  
* Constructor: OpenLayers.Layer.OSM.Maplint  
*  
* Parameters:  
* name - {String}  
* options - {Object} Hashtable of extra options to tag onto the layer  
*/  
initialize: function(name, options) {  
var url = [  
"http://d.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png",  
"http://e.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png",  
"http://f.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png"  
];  
options = OpenLayers.Util.extend({ numZoomLevels: 18, isBaseLayer: false, visibility: false }, options);  
var newArguments = [name, url, options];  
OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);  
},  
 
CLASS_NAME: "OpenLayers.Layer.OSM.Maplint"  
});  
 
  <?php
 
  setlocale(LC_CTYPE, 'C');
  // source: http://stackoverflow.com/questions/81934/easy-way-to-export-a-sql-table-without-access-to-the-server-or-phpmyadmin#81951
  include ('../include/common.inc.php');
  $query = $conn->prepare('
  SELECT * from myway_timingdeltas'
  , array(PDO::ATTR_CURSOR => PDO::FETCH_ORI_NEXT));
  $query->execute();
  $errors = $conn->errorInfo();
  if ($errors[2] != "") {
  die("Export terminated, db error" . print_r($errors, true));
  }
 
  $headers = Array("date", "delay", "distance", "origin", "destination");
 
  $fp = fopen('php://output', 'w');
  if ($fp && $query) {
  //header('Content-Type: text/csv');
  header('Pragma: no-cache');
  header('Expires: 0');
  fputcsv($fp, $headers);
  while ($r = $query->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT)) {
  $row = Array();
  foreach ($headers as $i => $fieldName) {
  switch ($fieldName) {
  case "date":
  $row[] = date("r",strtotime($r['date']." ".$r['time']));
  break;
  case "delay":
  $row[] = $r['timing_delta'];
  break;
  case "distance":
  $row[] = $r['stop_sequence'];
  break;
  case "origin":
  $row[] = $r['myway_stop'];
  break;
  case "destination":
  $row[] = $r['route_name'];
  break;
  default:
  break;
  }
  }
  fputcsv($fp, array_values($row));
  }
  die;
  }
  ?>
 
 
file:b/labs/busdelay.php (new)
  <!DOCTYPE html>
  <meta charset="utf-8">
  <title>Tesseract</title>
  <style>
 
 
  #charts {
  padding: 10px 0;
  }
 
  .chart {
  display: inline-block;
  height: 151px;
  margin-bottom: 20px;
  }
 
  .reset {
  padding-left: 1em;
  font-size: smaller;
  color: #ccc;
  }
 
  .background.bar {
  fill: #ccc;
  }
 
  .foreground.bar {
  fill: steelblue;
  }
 
  .axis path, .axis line {
  fill: none;
  stroke: #000;
  shape-rendering: crispEdges;
  }
 
  .axis text {
  font: 10px sans-serif;
  }
 
  .brush rect.extent {
  fill: steelblue;
  fill-opacity: .125;
  }
 
  .brush .resize path {
  fill: #eee;
  stroke: #666;
  }
 
  #hour-chart {
  width: 260px;
  }
 
  #delay-chart {
  width: 230px;
  }
 
  #distance-chart {
  width: 420px;
  }
 
  #date-chart {
  width: 920px;
  }
 
  #flight-list {
  min-height: 1024px;
  }
 
  #flight-list .date,
  #flight-list .day {
  margin-bottom: .4em;
  }
 
  #flight-list .flight {
  line-height: 1.5em;
  background: #eee;
  width: 640px;
  margin-bottom: 1px;
  }
 
  #flight-list .time {
  color: #999;
  }
 
  #flight-list .flight div {
  display: inline-block;
  width: 100px;
  }
 
  #flight-list div.distance,
  #flight-list div.delay {
  width: 160px;
  padding-right: 10px;
  text-align: right;
  }
 
  #flight-list .early {
  color: green;
  }
 
  aside {
  position: absolute;
  left: 740px;
  font-size: smaller;
  width: 220px;
  }
 
  </style>
 
 
  <div id="charts">
  <div id="hour-chart" class="chart">
  <div class="title">Time of Day</div>
  </div>
  <div id="delay-chart" class="chart">
  <div class="title">Arrival Delay (min.)</div>
  </div>
  <div id="distance-chart" class="chart">
  <div class="title">Distance (mi.)</div>
  </div>
  <div id="date-chart" class="chart">
  <div class="title">Date</div>
  </div>
  </div>
 
  <aside id="totals"><span id="active">-</span> of <span id="total">-</span> flights selected.</aside>
 
  <div id="lists">
  <div id="flight-list" class="list"></div>
  </div>
 
 
  </div>
 
 
  <script src="../js/tesseract/tesseract.min.js"></script>
  <script src="../js/d3/d3.v2.min.js"></script>
  <script>
 
  d3.csv("busdelay.csv.php", function(flights) {
 
  // Various formatters.
  var formatNumber = d3.format(",d"),
  formatChange = d3.format("+,d"),
  formatDate = d3.time.format("%B %d, %Y"),
  formatTime = d3.time.format("%I:%M %p");
 
  // A nest operator, for grouping the flight list.
  var nestByDate = d3.nest()
  .key(function(d) { return d3.time.day(d.date); });
 
  // A little coercion, since the CSV is untyped.
  flights.forEach(function(d, i) {
  d.index = i;
  d.date = parseDate(d.date);
  d.delay = +d.delay;
  d.distance = +d.distance;
  });
 
  // Create the tesseract and relevant dimensions and groups.
  flight = tesseract(flights),
  all = flight.groupAll(),
  date = flight.dimension(function(d) { return d3.time.day(d.date); }),
  dates = date.group(),
  hour = flight.dimension(function(d) { return d.date.getHours() + d.date.getMinutes() / 60; }),
  hours = hour.group(Math.floor),
  //delay = flight.dimension(function(d) { return Math.max(-60, Math.min(149, d.delay)); }),
  delay = flight.dimension(function(d) { return d.delay; }),
  delays = delay.group(function(d) { return Math.floor(d / 10) * 10; }),
  distance = flight.dimension(function(d) { return Math.min(60, d.distance); }),
  distances = distance.group(function(d) { return Math.floor(d / 50) * 50; });
 
  var charts = [
 
  barChart()
  .dimension(hour)
  .group(hours)
  .x(d3.scale.linear()
  .domain([0, 24])
  .rangeRound([0, 10 * 24])),
 
  barChart()
  .dimension(delay)
  .group(delays)
  .x(d3.scale.linear()
  .domain([-650, 650])
  .rangeRound([0, 10 * 21])),
 
  barChart()
  .dimension(distance)
  .group(distances)
  .x(d3.scale.linear()
  .domain([0, 60])
  .rangeRound([0, 10 * 40])),
 
  barChart()
  .dimension(date)
  .group(dates)
  .round(d3.time.day.round)
  .x(d3.time.scale()
  .domain([new Date(2011, 4, 1), new Date(2012, 1, 4)])
  .rangeRound([0, 10 * 90]))
  .filter([new Date(2011, 4, 4), new Date(2012, 4, 4)])
 
  ];
 
  // Given our array of charts, which we assume are in the same order as the
  // .chart elements in the DOM, bind the charts to the DOM and render them.
  // We also listen to the chart's brush events to update the display.
  var chart = d3.selectAll(".chart")
  .data(charts)
  .each(function(chart) { chart.on("brush", renderAll).on("brushend", renderAll); });
 
  // Render the initial lists.
  var list = d3.selectAll(".list")
  .data([flightList]);
 
  // Render the total.
  d3.selectAll("#total")
  .text(formatNumber(flight.size()));
 
  renderAll();
 
  // Renders the specified chart or list.
  function render(method) {
  d3.select(this).call(method);
  }
 
  // Whenever the brush moves, re-rendering everything.
  function renderAll() {
  chart.each(render);
  list.each(render);
  d3.select("#active").text(formatNumber(all.value()));
  }
 
  // Like d3.time.format, but faster.
  function parseDate(d) {
  return new Date(d);
  }
 
  window.filter = function(filters) {
  filters.forEach(function(d, i) { charts[i].filter(d); });
  renderAll();
  };
 
  window.reset = function(i) {
  charts[i].filter(null);
  renderAll();
  };
 
  function flightList(div) {
  var flightsByDate = nestByDate.entries(date.top(40));
 
  div.each(function() {
  var date = d3.select(this).selectAll(".date")
  .data(flightsByDate, function(d) { return d.key; });
 
  date.enter().append("div")
  .attr("class", "date")
  .append("div")
  .attr("class", "day")
  .text(function(d) { return formatDate(d.values[0].date); });
 
  date.exit().remove();
 
  var flight = date.order().selectAll(".flight")
  .data(function(d) { return d.values; }, function(d) { return d.index; });
 
  var flightEnter = flight.enter().append("div")
  .attr("class", "flight");
 
  flightEnter.append("div")
  .attr("class", "time")
  .text(function(d) { return formatTime(d.date); });
 
  flightEnter.append("div")
  .attr("class", "origin")
  .text(function(d) { return d.origin; });
 
  flightEnter.append("div")
  .attr("class", "destination")
  .text(function(d) { return d.destination; });
 
  flightEnter.append("div")
  .attr("class", "distance")
  .text(function(d) { return formatNumber(d.distance) + " mi."; });
 
  flightEnter.append("div")
  .attr("class", "delay")
  .classed("early", function(d) { return d.delay < 0; })
  .text(function(d) { return formatChange(d.delay) + " min."; });
 
  flight.exit().remove();
 
  flight.order();
  });
  }
 
  function barChart() {
  if (!barChart.id) barChart.id = 0;
 
  var margin = {top: 10, right: 10, bottom: 20, left: 10},
  x,
  y = d3.scale.linear().range([100, 0]),
  id = barChart.id++,
  axis = d3.svg.axis().orient("bottom"),
  brush = d3.svg.brush(),
  brushDirty,
  dimension,
  group,
  round;
 
  function chart(div) {
  var width = x.range()[1],
  height = y.range()[0];
 
  y.domain([0, group.top(1)[0].value]);
 
  div.each(function() {
  var div = d3.select(this),
  g = div.select("g");
 
  // Create the skeletal chart.
  if (g.empty()) {
  div.select(".title").append("a")
  .attr("href", "javascript:reset(" + id + ")")
  .attr("class", "reset")
  .text("reset")
  .style("display", "none");
 
  g = div.append("svg")
  .attr("width", width + margin.left + margin.right)
  .attr("height", height + margin.top + margin.bottom)
  .append("g")
  .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
 
  g.append("clipPath")
  .attr("id", "clip-" + id)
  .append("rect")
  .attr("width", width)
  .attr("height", height);
 
  g.selectAll(".bar")
  .data(["background", "foreground"])
  .enter().append("path")
  .attr("class", function(d) { return d + " bar"; })
  .datum(group.all());
 
  g.selectAll(".foreground.bar")
  .attr("clip-path", "url(#clip-" + id + ")");
 
  g.append("g")
  .attr("class", "axis")
  .attr("transform", "translate(0," + height + ")")
  .call(axis);
 
  // Initialize the brush component with pretty resize handles.
  var gBrush = g.append("g").attr("class", "brush").call(brush);
  gBrush.selectAll("rect").attr("height", height);
  gBrush.selectAll(".resize").append("path").attr("d", resizePath);
  }
 
  // Only redraw the brush if set externally.
  if (brushDirty) {
  brushDirty = false;
  g.selectAll(".brush").call(brush);
  div.select(".title a").style("display", brush.empty() ? "none" : null);
  if (brush.empty()) {
  g.selectAll("#clip-" + id + " rect")
  .attr("x", 0)
  .attr("width", width);
  } else {
  var extent = brush.extent();
  g.selectAll("#clip-" + id + " rect")
  .attr("x", x(extent[0]))
  .attr("width", x(extent[1]) - x(extent[0]));
  }
  }
 
  g.selectAll(".bar").attr("d", barPath);
  });
 
  function barPath(groups) {
  var path = [],
  i = -1,
  n = groups.length,
  d;
  while (++i < n) {
  d = groups[i];
  path.push("M", x(d.key), ",", height, "V", y(d.value), "h9V", height);
  }
  return path.join("");
  }
 
  function resizePath(d) {
  var e = +(d == "e"),
  x = e ? 1 : -1,
  y = height / 3;
  return "M" + (.5 * x) + "," + y
  + "A6,6 0 0 " + e + " " + (6.5 * x) + "," + (y + 6)
  + "V" + (2 * y - 6)
  + "A6,6 0 0 " + e + " " + (.5 * x) + "," + (2 * y)
  + "Z"
  + "M" + (2.5 * x) + "," + (y + 8)
  + "V" + (2 * y - 8)
  + "M" + (4.5 * x) + "," + (y + 8)
  + "V" + (2 * y - 8);
  }
  }
 
  brush.on("brushstart.chart", function() {
  var div = d3.select(this.parentNode.parentNode.parentNode);
  div.select(".title a").style("display", null);
  });
 
  brush.on("brush.chart", function() {
  var g = d3.select(this.parentNode),
  extent = brush.extent();
  if (round) g.select(".brush")
  .call(brush.extent(extent = extent.map(round)))
  .selectAll(".resize")
  .style("display", null);
  g.select("#clip-" + id + " rect")
  .attr("x", x(extent[0]))
  .attr("width", x(extent[1]) - x(extent[0]));
  dimension.filterRange(extent);
  });
 
  brush.on("brushend.chart", function() {
  if (brush.empty()) {
  var div = d3.select(this.parentNode.parentNode.parentNode);
  div.select(".title a").style("display", "none");
  div.select("#clip-" + id + " rect").attr("x", null).attr("width", "100%");
  dimension.filterAll();
  }
  });
 
  chart.margin = function(_) {
  if (!arguments.length) return margin;
  margin = _;
  return chart;
  };
 
  chart.x = function(_) {
  if (!arguments.length) return x;
  x = _;
  axis.scale(x);
  brush.x(x);
  return chart;
  };
 
  chart.y = function(_) {
  if (!arguments.length) return y;
  y = _;
  return chart;
  };
 
  chart.dimension = function(_) {
  if (!arguments.length) return dimension;
  dimension = _;
  return chart;
  };
 
  chart.filter = function(_) {
  if (_) {
  brush.extent(_);
  dimension.filterRange(_);
  } else {
  brush.clear();
  dimension.filterAll();
  }
  brushDirty = true;
  return chart;
  };
 
  chart.group = function(_) {
  if (!arguments.length) return group;
  group = _;
  return chart;
  };
 
  chart.round = function(_) {
  if (!arguments.length) return round;
  round = _;
  return chart;
  };
 
  return d3.rebind(chart, brush, "on");
  }
  });
 
  </script>
 
file:a/labs/busstopdensity.php (deleted)
<?php  
include ('../include/common.inc.php');  
//include_header("Bus Stop Density", "busstopdensity")  
?>  
 
<style type="text/css">  
 
#map_container{  
width:100%;  
height:100%;  
}  
#status, #legend {  
background-color: #eeeeee;  
padding: 3px 5px 3px 5px;  
opacity: .9;  
}  
</style>  
 
<div id="map_container"></div>  
<div id="status">  
Status:&nbsp; <span id="log"> <img alt="progess bar" src="progress_bar.gif" width="150" height="16"/></span>  
</div>  
<script type="text/javascript" src="http://www.google.com/jsapi?autoload={%22modules%22:[{%22name%22:%22maps%22,version:3,other_params:%22sensor=false%22},{%22name%22:%22jquery%22,%22version%22:%221.4.2%22}]}"></script>  
<script type="text/javascript">  
//<![CDATA[  
//Google Map API v3  
 
var googleMap = null;  
var previousPos = null;  
 
$(function($){//Called when page is loaded  
googleMap = new google.maps.Map(document.getElementById("map_container"), {  
zoom: 17,  
minZoom: 12,  
center: new google.maps.LatLng(-35.25,149.125),  
mapTypeId: google.maps.MapTypeId.SATELLITE});  
//Set status bar  
googleMap.controls[google.maps.ControlPosition.TOP_LEFT].push($("#status").get(0));  
//Set legend  
googleMap.controls[google.maps.ControlPosition.BOTTOM_LEFT].push($("#legend").get(0));  
 
google.maps.event.addListener(googleMap, "zoom_changed", function(){  
google.maps.event.trigger(googleMap, "mousemove", previousPos);  
});//onzoomend  
 
//Add a listener when mouse moves  
google.maps.event.addListener(googleMap, "mousemove", function(event){  
var latLng = event.latLng;  
var xy = googleMap.getProjection().fromLatLngToPoint(latLng);  
var ratio = Math.pow(2,googleMap.getZoom());  
$("#log").html("Zoom:" + googleMap.getZoom() + " WGS84:(" + latLng.lat().toFixed(5) + ", " + latLng.lng().toFixed(5) + ") Px:(" + Math.floor(xy.x * ratio) + "," + Math.floor(xy.y *ratio) + ")");  
previousPos = event;  
});//onmouseover  
 
//Add a listener when mouse leaves the map area  
google.maps.event.addListener(googleMap, "mouseout", function(event){  
$("#log").html("");  
});//onmouseout  
 
//Add tile overlay  
var myOverlay = new google.maps.ImageMapType({  
getTileUrl: function(coord, zoom) {  
return 'busstopdensity.tile.php?x=' + coord.x + '&y=' + coord.y + '&zoom=' +zoom;  
},  
tileSize: new google.maps.Size(256, 256),  
isPng: true,  
opacity:1.0  
});  
googleMap.overlayMapTypes.insertAt(0, myOverlay);  
$("#log").html("Map loaded!");  
});//onload  
//]]>  
</script>  
<?php  
include_footer()  
?>  
 
 
<?php  
include ('../include/common.inc.php');  
$debugOkay = Array();  
 
/*  
*DISCLAIMER  
* http://blog.gmapify.fr/create-beautiful-tiled-heat-maps-with-php-and-gd  
*THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF *USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
*  
* @author: Olivier G. <olbibigo_AT_gmail_DOT_com>  
* @version: 1.0  
* @history:  
* 1.0 creation  
*/  
set_time_limit(120);//2mn  
ini_set('memory_limit', '256M');  
error_reporting(E_ALL ^ E_DEPRECATED);  
require_once ($labsPath . 'lib/GoogleMapUtility.php');  
require_once ($labsPath . 'lib/HeatMap.php');  
 
//Root folder to store generated tiles  
define('TILE_DIR', 'tiles/');  
//Covered geographic areas  
define('MIN_LAT', -35.48);  
define('MAX_LAT', -35.15);  
define('MIN_LNG', 148.98);  
define('MAX_LNG', 149.25);  
define('TILE_SIZE_FACTOR', 0.5);  
define('SPOT_RADIUS', 30);  
define('SPOT_DIMMING_LEVEL', 50);  
 
//Input parameters  
if(isset($_GET['x']))  
$X = (int)$_GET['x'];  
else  
exit("x missing");  
if(isset($_GET['y']))  
$Y = (int)$_GET['y'];  
else  
exit("y missing");  
if(isset($_GET['zoom']))  
$zoom = (int)$_GET['zoom'];  
else  
exit("zoom missing");  
if ($zoom < 12) { //enforce minimum zoom  
header('Content-type: image/png');  
echo file_get_contents(TILE_DIR.'empty.png');  
}  
$dir = TILE_DIR.$zoom;  
$tilename = $dir.'/'.$X.'_'.$Y.'.png';  
//HTTP headers (data type and caching rule)  
header("Cache-Control: must-revalidate");  
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 86400) . " GMT");  
if(!file_exists($tilename)){  
$rect = GoogleMapUtility::getTileRect($X, $Y, $zoom);  
//A tile can contain part of a spot with center in an adjacent tile (overlaps).  
//Knowing the spot radius (in pixels) and zoom level, a smart way to process tiles would be to compute the box (in decimal degrees) containing only spots that can be drawn on current tile. We choose a simpler solution by increeasing geo bounds by 2*TILE_SIZE_FACTOR whatever the zoom level and spot radius.  
$extend_X = $rect->width * TILE_SIZE_FACTOR;//in decimal degrees  
$extend_Y = $rect->height * TILE_SIZE_FACTOR;//in decimal degrees  
$swlat = $rect->y - $extend_Y;  
$swlng = $rect->x - $extend_X;  
$nelat = $swlat + $rect->height + 2 * $extend_Y;  
$nelng = $swlng + $rect->width + 2 * $extend_X;  
 
if( ($nelat <= MIN_LAT) || ($swlat >= MAX_LAT) || ($nelng <= MIN_LNG) || ($swlng >= MAX_LNG)){  
//No geodata so return generic empty tile  
echo file_get_contents(TILE_DIR.'empty.png');  
exit();  
}  
 
//Get McDonald's spots  
$spots = fGetPOI('Select * from stops where  
(stop_lon > '.$swlng.' AND stop_lon < '.$nelng.')  
AND (stop_lat < '.$nelat.' AND stop_lat > '.$swlat.')', $im, $X, $Y, $zoom, SPOT_RADIUS);  
 
 
if(empty($spots)){  
//No geodata so return generic empty tile  
header('Content-type: image/png');  
echo file_get_contents(TILE_DIR.'empty.png');  
}else{  
if(!file_exists($dir)){  
mkdir($dir, 0705);  
}  
//All the magics is in HeatMap class :)  
$im = HeatMap::createImage($spots, GoogleMapUtility::TILE_SIZE, GoogleMapUtility::TILE_SIZE, heatMap::$WITH_ALPHA, SPOT_RADIUS, SPOT_DIMMING_LEVEL, HeatMap::$GRADIENT_FIRE);  
//Store tile for reuse and output it  
header('content-type:image/png;');  
imagepng($im, $tilename);  
echo file_get_contents($tilename);  
imagedestroy($im);  
unset($im);  
}  
}else{  
//Output stored tile  
header('content-type:image/png;');  
echo file_get_contents($tilename);  
}  
/////////////  
//Functions//  
/////////////  
function fGetPOI($query, &$im, $X, $Y, $zoom, $offset){  
global $conn;  
$nbPOIInsideTile = 0;  
 
$spots = Array();  
$query = $conn->prepare($query);  
$query->execute();  
if (!$query) {  
databaseError($conn->errorInfo());  
return Array();  
}  
foreach( $query->fetchAll() as $row){  
$point = GoogleMapUtility::getOffsetPixelCoords($row['stop_lat'], $row['stop_lon'], $zoom, $X, $Y);  
//Count result only in the tile  
if( ($point->x > -$offset) && ($point->x < (GoogleMapUtility::TILE_SIZE+$offset)) && ($point->y > -$offset) && ($point->y < (GoogleMapUtility::TILE_SIZE+$offset))){  
$spots[] = new HeatMapPoint($point->x, $point->y);  
}  
 
}//while  
return $spots;  
}//fAddPOI  
?>  
 
 
file:a/labs/googlemaps.php (deleted)
<!DOCTYPE html>  
<html>  
<head>  
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />  
<style type="text/css">  
html { height: 100% }  
body { height: 100%; margin: 0px; padding: 0px }  
#map_canvas { height: 100% }  
</style>  
<script type="text/javascript"  
src="http://maps.google.com/maps/api/js?sensor=false">  
</script>  
<script type="text/javascript">  
function initialize() {  
var latlng = new google.maps.LatLng(-35.25, 149.125);  
var myOptions = {  
zoom: 10,  
center: latlng,  
mapTypeId: google.maps.MapTypeId.ROADMAP  
};  
var map = new google.maps.Map(document.getElementById("map_canvas"),  
myOptions);  
}  
</script>  
</head>  
<body onload="initialize()">  
<div id="map_canvas" style="width:100%; height:100%"></div>  
</body>  
</html>  
 Binary files a/labs/gradient/classic.png and /dev/null differ
file:a/labs/gradient/fire.png (deleted)
 Binary files a/labs/gradient/fire.png and /dev/null differ
 Binary files a/labs/gradient/pgaitch.png and /dev/null differ
/*  
 
OpenLayers.js -- OpenLayers Map Viewer Library  
 
Copyright 2005-2010 OpenLayers Contributors, released under the Clear BSD  
license. Please see http://svn.openlayers.org/trunk/openlayers/license.txt  
for the full text of the license.  
 
Includes compressed code under the following licenses:  
 
(For uncompressed versions of the code used please see the  
OpenLayers SVN repository: <http://openlayers.org/>)  
 
*/  
 
/* Contains portions of Prototype.js:  
*  
* Prototype JavaScript framework, version 1.4.0  
* (c) 2005 Sam Stephenson <sam@conio.net>  
*  
* Prototype is freely distributable under the terms of an MIT-style license.  
* For details, see the Prototype web site: http://prototype.conio.net/  
*  
*--------------------------------------------------------------------------*/  
 
/**  
*  
* Contains portions of Rico <http://openrico.org/>  
*  
* Copyright 2005 Sabre Airline Solutions  
*  
* Licensed under the Apache License, Version 2.0 (the "License"); you  
* may not use this file except in compliance with the License. You  
* may obtain a copy of the License at  
*  
* http://www.apache.org/licenses/LICENSE-2.0  
*  
* Unless required by applicable law or agreed to in writing, software  
* distributed under the License is distributed on an "AS IS" BASIS,  
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or  
* implied. See the License for the specific language governing  
* permissions and limitations under the License.  
*  
**/  
 
/**  
* Contains XMLHttpRequest.js <http://code.google.com/p/xmlhttprequest/>  
* Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com)  
*  
* Licensed under the Apache License, Version 2.0 (the "License");  
* you may not use this file except in compliance with the License.  
* You may obtain a copy of the License at  
* http://www.apache.org/licenses/LICENSE-2.0  
*/  
 
/**  
* Contains portions of Gears <http://code.google.com/apis/gears/>  
*  
* Copyright 2007, Google Inc.  
*  
* Redistribution and use in source and binary forms, with or without  
* modification, are permitted provided that the following conditions are met:  
*  
* 1. Redistributions of source code must retain the above copyright notice,  
* this list of conditions and the following disclaimer.  
* 2. Redistributions in binary form must reproduce the above copyright notice,  
* this list of conditions and the following disclaimer in the documentation  
* and/or other materials provided with the distribution.  
* 3. Neither the name of Google Inc. nor the names of its contributors may be  
* used to endorse or promote products derived from this software without  
* specific prior written permission.  
*  
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED  
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF  
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO  
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;  
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,  
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR  
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF  
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
*  
* Sets up google.gears.*, which is *the only* supported way to access Gears.  
*  
* Circumvent this file at your own risk!  
*  
* In the future, Gears may automatically define google.gears.* without this  
* file. Gears may use these objects to transparently fix bugs and compatibility  
* issues. Applications that use the code below will continue to work seamlessly  
* when that happens.  
*/  
var OpenLayers={singleFile:true};(function(){var singleFile=(typeof OpenLayers=="object"&&OpenLayers.singleFile);var scriptLocation;window.OpenLayers={_scriptName:(!singleFile)?"lib/OpenLayers.js":"OpenLayers.js",_getScriptLocation:function(){if(scriptLocation!=undefined){return scriptLocation;}  
scriptLocation="";var isOL=new RegExp("(^|(.*?\\/))("+OpenLayers._scriptName+")(\\?|$)");var scripts=document.getElementsByTagName('script');for(var i=0,len=scripts.length;i<len;i++){var src=scripts[i].getAttribute('src');if(src){var match=src.match(isOL);if(match){scriptLocation=match[1];break;}}}  
return scriptLocation;}};if(!singleFile){var jsfiles=new Array("OpenLayers/Util.js","OpenLayers/BaseTypes.js","OpenLayers/BaseTypes/Class.js","OpenLayers/BaseTypes/Bounds.js","OpenLayers/BaseTypes/Element.js","OpenLayers/BaseTypes/LonLat.js","OpenLayers/BaseTypes/Pixel.js","OpenLayers/BaseTypes/Size.js","OpenLayers/Console.js","OpenLayers/Tween.js","Rico/Corner.js","Rico/Color.js","OpenLayers/Ajax.js","OpenLayers/Events.js","OpenLayers/Request.js","OpenLayers/Request/XMLHttpRequest.js","OpenLayers/Projection.js","OpenLayers/Map.js","OpenLayers/Layer.js","OpenLayers/Icon.js","OpenLayers/Marker.js","OpenLayers/Marker/Box.js","OpenLayers/Popup.js","OpenLayers/Tile.js","OpenLayers/Tile/Image.js","OpenLayers/Tile/Image/IFrame.js","OpenLayers/Tile/WFS.js","OpenLayers/Layer/Image.js","OpenLayers/Layer/SphericalMercator.js","OpenLayers/Layer/EventPane.js","OpenLayers/Layer/FixedZoomLevels.js","OpenLayers/Layer/Google.js","OpenLayers/Layer/Google/v3.js","OpenLayers/Layer/VirtualEarth.js","OpenLayers/Layer/Yahoo.js","OpenLayers/Layer/HTTPRequest.js","OpenLayers/Layer/Grid.js","OpenLayers/Layer/MapGuide.js","OpenLayers/Layer/MapServer.js","OpenLayers/Layer/MapServer/Untiled.js","OpenLayers/Layer/KaMap.js","OpenLayers/Layer/KaMapCache.js","OpenLayers/Layer/MultiMap.js","OpenLayers/Layer/Markers.js","OpenLayers/Layer/Text.js","OpenLayers/Layer/WorldWind.js","OpenLayers/Layer/ArcGIS93Rest.js","OpenLayers/Layer/WMS.js","OpenLayers/Layer/WMS/Untiled.js","OpenLayers/Layer/WMS/Post.js","OpenLayers/Layer/WMTS.js","OpenLayers/Layer/ArcIMS.js","OpenLayers/Layer/GeoRSS.js","OpenLayers/Layer/Boxes.js","OpenLayers/Layer/XYZ.js","OpenLayers/Layer/TMS.js","OpenLayers/Layer/TileCache.js","OpenLayers/Layer/Zoomify.js","OpenLayers/Popup/Anchored.js","OpenLayers/Popup/AnchoredBubble.js","OpenLayers/Popup/Framed.js","OpenLayers/Popup/FramedCloud.js","OpenLayers/Feature.js","OpenLayers/Feature/Vector.js","OpenLayers/Feature/WFS.js","OpenLayers/Handler.js","OpenLayers/Handler/Click.js","OpenLayers/Handler/Hover.js","OpenLayers/Handler/Point.js","OpenLayers/Handler/Path.js","OpenLayers/Handler/Polygon.js","OpenLayers/Handler/Feature.js","OpenLayers/Handler/Drag.js","OpenLayers/Handler/RegularPolygon.js","OpenLayers/Handler/Box.js","OpenLayers/Handler/MouseWheel.js","OpenLayers/Handler/Keyboard.js","OpenLayers/Control.js","OpenLayers/Control/Attribution.js","OpenLayers/Control/Button.js","OpenLayers/Control/ZoomBox.js","OpenLayers/Control/ZoomToMaxExtent.js","OpenLayers/Control/DragPan.js","OpenLayers/Control/Navigation.js","OpenLayers/Control/MouseDefaults.js","OpenLayers/Control/MousePosition.js","OpenLayers/Control/OverviewMap.js","OpenLayers/Control/KeyboardDefaults.js","OpenLayers/Control/PanZoom.js","OpenLayers/Control/PanZoomBar.js","OpenLayers/Control/ArgParser.js","OpenLayers/Control/Permalink.js","OpenLayers/Control/Scale.js","OpenLayers/Control/ScaleLine.js","OpenLayers/Control/Snapping.js","OpenLayers/Control/Split.js","OpenLayers/Control/LayerSwitcher.js","OpenLayers/Control/DrawFeature.js","OpenLayers/Control/DragFeature.js","OpenLayers/Control/ModifyFeature.js","OpenLayers/Control/Panel.js","OpenLayers/Control/SelectFeature.js","OpenLayers/Control/NavigationHistory.js","OpenLayers/Control/Measure.js","OpenLayers/Control/WMSGetFeatureInfo.js","OpenLayers/Control/WMTSGetFeatureInfo.js","OpenLayers/Control/Graticule.js","OpenLayers/Control/TransformFeature.js","OpenLayers/Control/SLDSelect.js","OpenLayers/Geometry.js","OpenLayers/Geometry/Rectangle.js","OpenLayers/Geometry/Collection.js","OpenLayers/Geometry/Point.js","OpenLayers/Geometry/MultiPoint.js","OpenLayers/Geometry/Curve.js","OpenLayers/Geometry/LineString.js","OpenLayers/Geometry/LinearRing.js","OpenLayers/Geometry/Polygon.js","OpenLayers/Geometry/MultiLineString.js","OpenLayers/Geometry/MultiPolygon.js","OpenLayers/Geometry/Surface.js","OpenLayers/Renderer.js","OpenLayers/Renderer/Elements.js","OpenLayers/Renderer/SVG.js","OpenLayers/Renderer/Canvas.js","OpenLayers/Renderer/VML.js","OpenLayers/Layer/Vector.js","OpenLayers/Layer/Vector/RootContainer.js","OpenLayers/Strategy.js","OpenLayers/Strategy/Filter.js","OpenLayers/Strategy/Fixed.js","OpenLayers/Strategy/Cluster.js","OpenLayers/Strategy/Paging.js","OpenLayers/Strategy/BBOX.js","OpenLayers/Strategy/Save.js","OpenLayers/Strategy/Refresh.js","OpenLayers/Filter.js","OpenLayers/Filter/FeatureId.js","OpenLayers/Filter/Logical.js","OpenLayers/Filter/Comparison.js","OpenLayers/Filter/Spatial.js","OpenLayers/Protocol.js","OpenLayers/Protocol/HTTP.js","OpenLayers/Protocol/SQL.js","OpenLayers/Protocol/SQL/Gears.js","OpenLayers/Protocol/WFS.js","OpenLayers/Protocol/WFS/v1.js","OpenLayers/Protocol/WFS/v1_0_0.js","OpenLayers/Protocol/WFS/v1_1_0.js","OpenLayers/Protocol/SOS.js","OpenLayers/Protocol/SOS/v1_0_0.js","OpenLayers/Layer/PointTrack.js","OpenLayers/Layer/GML.js","OpenLayers/Style.js","OpenLayers/Style2.js","OpenLayers/StyleMap.js","OpenLayers/Rule.js","OpenLayers/Format.js","OpenLayers/Format/XML.js","OpenLayers/Format/Context.js","OpenLayers/Format/ArcXML.js","OpenLayers/Format/ArcXML/Features.js","OpenLayers/Format/GML.js","OpenLayers/Format/GML/Base.js","OpenLayers/Format/GML/v2.js","OpenLayers/Format/GML/v3.js","OpenLayers/Format/Atom.js","OpenLayers/Format/KML.js","OpenLayers/Format/GeoRSS.js","OpenLayers/Format/WFS.js","OpenLayers/Format/WFSCapabilities.js","OpenLayers/Format/WFSCapabilities/v1.js","OpenLayers/Format/WFSCapabilities/v1_0_0.js","OpenLayers/Format/WFSCapabilities/v1_1_0.js","OpenLayers/Format/WFSDescribeFeatureType.js","OpenLayers/Format/WMSDescribeLayer.js","OpenLayers/Format/WMSDescribeLayer/v1_1.js","OpenLayers/Format/WKT.js","OpenLayers/Format/OSM.js","OpenLayers/Format/GPX.js","OpenLayers/Format/Filter.js","OpenLayers/Format/Filter/v1.js","OpenLayers/Format/Filter/v1_0_0.js","OpenLayers/Format/Filter/v1_1_0.js","OpenLayers/Format/SLD.js","OpenLayers/Format/SLD/v1.js","OpenLayers/Format/SLD/v1_0_0.js","OpenLayers/Format/OWSCommon/v1.js","OpenLayers/Format/OWSCommon/v1_0_0.js","OpenLayers/Format/OWSCommon/v1_1_0.js","OpenLayers/Format/CSWGetDomain.js","OpenLayers/Format/CSWGetDomain/v2_0_2.js","OpenLayers/Format/CSWGetRecords.js","OpenLayers/Format/CSWGetRecords/v2_0_2.js","OpenLayers/Format/WFST.js","OpenLayers/Format/WFST/v1.js","OpenLayers/Format/WFST/v1_0_0.js","OpenLayers/Format/WFST/v1_1_0.js","OpenLayers/Format/Text.js","OpenLayers/Format/JSON.js","OpenLayers/Format/GeoJSON.js","OpenLayers/Format/WMC.js","OpenLayers/Format/WMC/v1.js","OpenLayers/Format/WMC/v1_0_0.js","OpenLayers/Format/WMC/v1_1_0.js","OpenLayers/Format/WMSCapabilities.js","OpenLayers/Format/WMSCapabilities/v1.js","OpenLayers/Format/WMSCapabilities/v1_1.js","OpenLayers/Format/WMSCapabilities/v1_1_0.js","OpenLayers/Format/WMSCapabilities/v1_1_1.js","OpenLayers/Format/WMSCapabilities/v1_3.js","OpenLayers/Format/WMSCapabilities/v1_3_0.js","OpenLayers/Format/WMSGetFeatureInfo.js","OpenLayers/Format/SOSCapabilities.js","OpenLayers/Format/SOSCapabilities/v1_0_0.js","OpenLayers/Format/SOSGetObservation.js","OpenLayers/Format/SOSGetFeatureOfInterest.js","OpenLayers/Format/OWSContext.js","OpenLayers/Format/OWSContext/v0_3_1.js","OpenLayers/Format/WMTSCapabilities.js","OpenLayers/Format/WMTSCapabilities/v1_0_0.js","OpenLayers/Layer/WFS.js","OpenLayers/Control/GetFeature.js","OpenLayers/Control/MouseToolbar.js","OpenLayers/Control/NavToolbar.js","OpenLayers/Control/PanPanel.js","OpenLayers/Control/Pan.js","OpenLayers/Control/ZoomIn.js","OpenLayers/Control/ZoomOut.js","OpenLayers/Control/ZoomPanel.js","OpenLayers/Control/EditingToolbar.js","OpenLayers/Symbolizer.js","OpenLayers/Symbolizer/Point.js","OpenLayers/Symbolizer/Line.js","OpenLayers/Symbolizer/Polygon.js","OpenLayers/Symbolizer/Text.js","OpenLayers/Symbolizer/Raster.js","OpenLayers/Lang.js","OpenLayers/Lang/en.js");var agent=navigator.userAgent;var docWrite=(agent.match("MSIE")||agent.match("Safari"));if(docWrite){var allScriptTags=new Array(jsfiles.length);}  
var host=OpenLayers._getScriptLocation()+"lib/";for(var i=0,len=jsfiles.length;i<len;i++){if(docWrite){allScriptTags[i]="<script src='"+host+jsfiles[i]+"'></script>";}else{var s=document.createElement("script");s.src=host+jsfiles[i];var h=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;h.appendChild(s);}}  
if(docWrite){document.write(allScriptTags.join(""));}}})();OpenLayers.VERSION_NUMBER="OpenLayers 2.10 -- $Revision: 10721 $";OpenLayers.String={startsWith:function(str,sub){return(str.indexOf(sub)==0);},contains:function(str,sub){return(str.indexOf(sub)!=-1);},trim:function(str){return str.replace(/^\s\s*/,'').replace(/\s\s*$/,'');},camelize:function(str){var oStringList=str.split('-');var camelizedString=oStringList[0];for(var i=1,len=oStringList.length;i<len;i++){var s=oStringList[i];camelizedString+=s.charAt(0).toUpperCase()+s.substring(1);}  
return camelizedString;},format:function(template,context,args){if(!context){context=window;}  
var replacer=function(str,match){var replacement;var subs=match.split(/\.+/);for(var i=0;i<subs.length;i++){if(i==0){replacement=context;}  
replacement=replacement[subs[i]];}  
if(typeof replacement=="function"){replacement=args?replacement.apply(null,args):replacement();}  
if(typeof replacement=='undefined'){return'undefined';}else{return replacement;}};return template.replace(OpenLayers.String.tokenRegEx,replacer);},tokenRegEx:/\$\{([\w.]+?)\}/g,numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(value){return OpenLayers.String.numberRegEx.test(value);},numericIf:function(value){return OpenLayers.String.isNumeric(value)?parseFloat(value):value;}};if(!String.prototype.startsWith){String.prototype.startsWith=function(sStart){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.String.startsWith'}));return OpenLayers.String.startsWith(this,sStart);};}  
if(!String.prototype.contains){String.prototype.contains=function(str){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.String.contains'}));return OpenLayers.String.contains(this,str);};}  
if(!String.prototype.trim){String.prototype.trim=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.String.trim'}));return OpenLayers.String.trim(this);};}  
if(!String.prototype.camelize){String.prototype.camelize=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.String.camelize'}));return OpenLayers.String.camelize(this);};}  
OpenLayers.Number={decimalSeparator:".",thousandsSeparator:",",limitSigDigs:function(num,sig){var fig=0;if(sig>0){fig=parseFloat(num.toPrecision(sig));}  
return fig;},format:function(num,dec,tsep,dsep){dec=(typeof dec!="undefined")?dec:0;tsep=(typeof tsep!="undefined")?tsep:OpenLayers.Number.thousandsSeparator;dsep=(typeof dsep!="undefined")?dsep:OpenLayers.Number.decimalSeparator;if(dec!=null){num=parseFloat(num.toFixed(dec));}  
var parts=num.toString().split(".");if(parts.length==1&&dec==null){dec=0;}  
var integer=parts[0];if(tsep){var thousands=/(-?[0-9]+)([0-9]{3})/;while(thousands.test(integer)){integer=integer.replace(thousands,"$1"+tsep+"$2");}}  
var str;if(dec==0){str=integer;}else{var rem=parts.length>1?parts[1]:"0";if(dec!=null){rem=rem+new Array(dec-rem.length+1).join("0");}  
str=integer+dsep+rem;}  
return str;}};if(!Number.prototype.limitSigDigs){Number.prototype.limitSigDigs=function(sig){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.Number.limitSigDigs'}));return OpenLayers.Number.limitSigDigs(this,sig);};}  
OpenLayers.Function={bind:function(func,object){var args=Array.prototype.slice.apply(arguments,[2]);return function(){var newArgs=args.concat(Array.prototype.slice.apply(arguments,[0]));return func.apply(object,newArgs);};},bindAsEventListener:function(func,object){return function(event){return func.call(object,event||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(object){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.Function.bindAsEventListener'}));return OpenLayers.Function.bindAsEventListener(this,object);};}  
OpenLayers.Array={filter:function(array,callback,caller){var selected=[];if(Array.prototype.filter){selected=array.filter(callback,caller);}else{var len=array.length;if(typeof callback!="function"){throw new TypeError();}  
for(var i=0;i<len;i++){if(i in array){var val=array[i];if(callback.call(caller,val,i,array)){selected.push(val);}}}}  
return selected;}};OpenLayers.Date={toISOString:(function(){if("toISOString"in Date.prototype){return function(date){return date.toISOString();}}else{function pad(num,len){var str=num+"";while(str.length<len){str="0"+str;}  
return str;}  
return function(date){var str;if(isNaN(date.getTime())){str="Invalid Date";}else{str=date.getUTCFullYear()+"-"+  
pad(date.getUTCMonth()+1,2)+"-"+  
pad(date.getUTCDate(),2)+"T"+  
pad(date.getUTCHours(),2)+":"+  
pad(date.getUTCMinutes(),2)+":"+  
pad(date.getUTCSeconds(),2)+"."+  
pad(date.getUTCMilliseconds(),3)+"Z";}  
return str;}}})(),parse:function(str){var date;var elapsed=Date.parse(str);if(!isNaN(elapsed)){date=new Date(elapsed);}else{var match=str.match(/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))?$/);var date;if(match&&(match[1]||match[7])){var year=parseInt(match[1],10)||0;var month=(parseInt(match[2],10)-1)||0;var day=parseInt(match[3],10)||1;date=new Date(Date.UTC(year,month,day));var type=match[7];if(type){var hours=parseInt(match[4],10);var minutes=parseInt(match[5],10);var secFrac=parseFloat(match[6]);var seconds=secFrac|0;var milliseconds=Math.round(1000*(secFrac-seconds));date.setUTCHours(hours,minutes,seconds,milliseconds);if(type!=="Z"){var hoursOffset=parseInt(type,10);var minutesOffset=parseInt(match[8])||0;var offset=-1000*(60*(hoursOffset*60)+minutesOffset*60);date=new Date(date.getTime()+offset);}}}else{date=new Date("invalid");}}  
return date;}};OpenLayers.Class=function(){var Class=function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments);}};var extended={};var parent,initialize,Type;for(var i=0,len=arguments.length;i<len;++i){Type=arguments[i];if(typeof Type=="function"){if(i==0&&len>1){initialize=Type.prototype.initialize;Type.prototype.initialize=function(){};extended=new Type();if(initialize===undefined){delete Type.prototype.initialize;}else{Type.prototype.initialize=initialize;}}  
parent=Type.prototype;}else{parent=Type;}  
OpenLayers.Util.extend(extended,parent);}  
Class.prototype=extended;return Class;};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 superClass=arguments[0];var proto=new superClass(OpenLayers.Class.isPrototype);for(var i=1,len=arguments.length;i<len;i++){if(typeof arguments[i]=="function"){var mixin=arguments[i];arguments[i]=new mixin(OpenLayers.Class.isPrototype);}  
OpenLayers.Util.extend(proto,arguments[i]);}  
return proto;};OpenLayers.Util={};OpenLayers.Util.getElement=function(){var elements=[];for(var i=0,len=arguments.length;i<len;i++){var element=arguments[i];if(typeof element=='string'){element=document.getElementById(element);}  
if(arguments.length==1){return element;}  
elements.push(element);}  
return elements;};OpenLayers.Util.isElement=function(o){return!!(o&&o.nodeType===1);};if(typeof window.$==="undefined"){window.$=OpenLayers.Util.getElement;}  
OpenLayers.Util.extend=function(destination,source){destination=destination||{};if(source){for(var property in source){var value=source[property];if(value!==undefined){destination[property]=value;}}  
var sourceIsEvt=typeof window.Event=="function"&&source instanceof window.Event;if(!sourceIsEvt&&source.hasOwnProperty&&source.hasOwnProperty('toString')){destination.toString=source.toString;}}  
return destination;};OpenLayers.Util.removeItem=function(array,item){for(var i=array.length-1;i>=0;i--){if(array[i]==item){array.splice(i,1);}}  
return array;};OpenLayers.Util.clearArray=function(array){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'array = []'}));array.length=0;};OpenLayers.Util.indexOf=function(array,obj){if(typeof array.indexOf=="function"){return array.indexOf(obj);}else{for(var i=0,len=array.length;i<len;i++){if(array[i]==obj){return i;}}  
return-1;}};OpenLayers.Util.modifyDOMElement=function(element,id,px,sz,position,border,overflow,opacity){if(id){element.id=id;}  
if(px){element.style.left=px.x+"px";element.style.top=px.y+"px";}  
if(sz){element.style.width=sz.w+"px";element.style.height=sz.h+"px";}  
if(position){element.style.position=position;}  
if(border){element.style.border=border;}  
if(overflow){element.style.overflow=overflow;}  
if(parseFloat(opacity)>=0.0&&parseFloat(opacity)<1.0){element.style.filter='alpha(opacity='+(opacity*100)+')';element.style.opacity=opacity;}else if(parseFloat(opacity)==1.0){element.style.filter='';element.style.opacity='';}};OpenLayers.Util.createDiv=function(id,px,sz,imgURL,position,border,overflow,opacity){var dom=document.createElement('div');if(imgURL){dom.style.backgroundImage='url('+imgURL+')';}  
if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv");}  
if(!position){position="absolute";}  
OpenLayers.Util.modifyDOMElement(dom,id,px,sz,position,border,overflow,opacity);return dom;};OpenLayers.Util.createImage=function(id,px,sz,imgURL,position,border,opacity,delayDisplay){var image=document.createElement("img");if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv");}  
if(!position){position="relative";}  
OpenLayers.Util.modifyDOMElement(image,id,px,sz,position,border,null,opacity);if(delayDisplay){image.style.display="none";OpenLayers.Event.observe(image,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,image));OpenLayers.Event.observe(image,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,image));}  
image.style.alt=id;image.galleryImg="no";if(imgURL){image.src=imgURL;}  
return image;};OpenLayers.Util.setOpacity=function(element,opacity){OpenLayers.Util.modifyDOMElement(element,null,null,null,null,null,null,opacity);};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 urls=this.urls;if(urls&&urls instanceof Array&&urls.length>1){var src=this.src.toString();var current_url,k;for(k=0;current_url=urls[k];k++){if(src.indexOf(current_url)!=-1){break;}}  
var guess=Math.floor(urls.length*Math.random());var new_url=urls[guess];k=0;while(new_url==current_url&&k++<4){guess=Math.floor(urls.length*Math.random());new_url=urls[guess];}  
this.src=src.replace(current_url,new_url);}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 arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);var filter=false;try{filter=!!(document.body.filters);}catch(e){}  
OpenLayers.Util.alphaHackNeeded=(filter&&(version>=5.5)&&(version<7));}  
return OpenLayers.Util.alphaHackNeeded;};OpenLayers.Util.modifyAlphaImageDiv=function(div,id,px,sz,imgURL,position,border,sizing,opacity){OpenLayers.Util.modifyDOMElement(div,id,px,sz,position,null,null,opacity);var img=div.childNodes[0];if(imgURL){img.src=imgURL;}  
OpenLayers.Util.modifyDOMElement(img,div.id+"_innerImage",null,sz,"relative",border);if(OpenLayers.Util.alphaHack()){if(div.style.display!="none"){div.style.display="inline-block";}  
if(sizing==null){sizing="scale";}  
div.style.filter="progid:DXImageTransform.Microsoft"+".AlphaImageLoader(src='"+img.src+"', "+"sizingMethod='"+sizing+"')";if(parseFloat(div.style.opacity)>=0.0&&parseFloat(div.style.opacity)<1.0){div.style.filter+=" alpha(opacity="+div.style.opacity*100+")";}  
img.style.filter="alpha(opacity=0)";}};OpenLayers.Util.createAlphaImageDiv=function(id,px,sz,imgURL,position,border,sizing,opacity,delayDisplay){var div=OpenLayers.Util.createDiv();var img=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);div.appendChild(img);if(delayDisplay){img.style.display="none";OpenLayers.Event.observe(img,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,div));OpenLayers.Event.observe(img,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,div));}  
OpenLayers.Util.modifyAlphaImageDiv(div,id,px,sz,imgURL,position,border,sizing,opacity);return div;};OpenLayers.Util.upperCaseObject=function(object){var uObject={};for(var key in object){uObject[key.toUpperCase()]=object[key];}  
return uObject;};OpenLayers.Util.applyDefaults=function(to,from){to=to||{};var fromIsEvt=typeof window.Event=="function"&&from instanceof window.Event;for(var key in from){if(to[key]===undefined||(!fromIsEvt&&from.hasOwnProperty&&from.hasOwnProperty(key)&&!to.hasOwnProperty(key))){to[key]=from[key];}}  
if(!fromIsEvt&&from&&from.hasOwnProperty&&from.hasOwnProperty('toString')&&!to.hasOwnProperty('toString')){to.toString=from.toString;}  
return to;};OpenLayers.Util.getParameterString=function(params){var paramsArray=[];for(var key in params){var value=params[key];if((value!=null)&&(typeof value!='function')){var encodedValue;if(typeof value=='object'&&value.constructor==Array){var encodedItemArray=[];var item;for(var itemIndex=0,len=value.length;itemIndex<len;itemIndex++){item=value[itemIndex];encodedItemArray.push(encodeURIComponent((item===null||item===undefined)?"":item));}  
encodedValue=encodedItemArray.join(",");}  
else{encodedValue=encodeURIComponent(value);}  
paramsArray.push(encodeURIComponent(key)+"="+encodedValue);}}  
return paramsArray.join("&");};OpenLayers.Util.urlAppend=function(url,paramStr){var newUrl=url;if(paramStr){var parts=(url+" ").split(/[?&]/);newUrl+=(parts.pop()===" "?paramStr:parts.length?"&"+paramStr:"?"+paramStr);}  
return newUrl;};OpenLayers.ImgPath='';OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||(OpenLayers._getScriptLocation()+"img/");};OpenLayers.Util.Try=function(){var returnValue=null;for(var i=0,len=arguments.length;i<len;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}  
return returnValue;};OpenLayers.Util.getNodes=function(p,tagName){var nodes=OpenLayers.Util.Try(function(){return OpenLayers.Util._getNodes(p.documentElement.childNodes,tagName);},function(){return OpenLayers.Util._getNodes(p.childNodes,tagName);});return nodes;};OpenLayers.Util._getNodes=function(nodes,tagName){var retArray=[];for(var i=0,len=nodes.length;i<len;i++){if(nodes[i].nodeName==tagName){retArray.push(nodes[i]);}}  
return retArray;};OpenLayers.Util.getTagText=function(parent,item,index){var result=OpenLayers.Util.getNodes(parent,item);if(result&&(result.length>0))  
{if(!index){index=0;}  
if(result[index].childNodes.length>1){return result.childNodes[1].nodeValue;}  
else if(result[index].childNodes.length==1){return result[index].firstChild.nodeValue;}}else{return"";}};OpenLayers.Util.getXmlNodeValue=function(node){var val=null;OpenLayers.Util.Try(function(){val=node.text;if(!val){val=node.textContent;}  
if(!val){val=node.firstChild.nodeValue;}},function(){val=node.textContent;});return val;};OpenLayers.Util.mouseLeft=function(evt,div){var target=(evt.relatedTarget)?evt.relatedTarget:evt.toElement;while(target!=div&&target!=null){target=target.parentNode;}  
return(target!=div);};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(number,precision){if(precision==null){precision=OpenLayers.Util.DEFAULT_PRECISION;}  
var number;if(precision==0){number=parseFloat(number);}else{number=parseFloat(parseFloat(number).toPrecision(precision));}  
return number;};OpenLayers.Util.rad=function(x){return x*Math.PI/180;};OpenLayers.Util.deg=function(x){return x*180/Math.PI;};OpenLayers.Util.VincentyConstants={a:6378137,b:6356752.3142,f:1/298.257223563};OpenLayers.Util.distVincenty=function(p1,p2){var ct=OpenLayers.Util.VincentyConstants;var a=ct.a,b=ct.b,f=ct.f;var L=OpenLayers.Util.rad(p2.lon-p1.lon);var U1=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p1.lat)));var U2=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p2.lat)));var sinU1=Math.sin(U1),cosU1=Math.cos(U1);var sinU2=Math.sin(U2),cosU2=Math.cos(U2);var lambda=L,lambdaP=2*Math.PI;var iterLimit=20;while(Math.abs(lambda-lambdaP)>1e-12&&--iterLimit>0){var sinLambda=Math.sin(lambda),cosLambda=Math.cos(lambda);var sinSigma=Math.sqrt((cosU2*sinLambda)*(cosU2*sinLambda)+  
(cosU1*sinU2-sinU1*cosU2*cosLambda)*(cosU1*sinU2-sinU1*cosU2*cosLambda));if(sinSigma==0){return 0;}  
var cosSigma=sinU1*sinU2+cosU1*cosU2*cosLambda;var sigma=Math.atan2(sinSigma,cosSigma);var alpha=Math.asin(cosU1*cosU2*sinLambda/sinSigma);var cosSqAlpha=Math.cos(alpha)*Math.cos(alpha);var cos2SigmaM=cosSigma-2*sinU1*sinU2/cosSqAlpha;var C=f/16*cosSqAlpha*(4+f*(4-3*cosSqAlpha));lambdaP=lambda;lambda=L+(1-C)*f*Math.sin(alpha)*(sigma+C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)));}  
if(iterLimit==0){return NaN;}  
var uSq=cosSqAlpha*(a*a-b*b)/(b*b);var A=1+uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq)));var B=uSq/1024*(256+uSq*(-128+uSq*(74-47*uSq)));var deltaSigma=B*sinSigma*(cos2SigmaM+B/4*(cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)-  
B/6*cos2SigmaM*(-3+4*sinSigma*sinSigma)*(-3+4*cos2SigmaM*cos2SigmaM)));var s=b*A*(sigma-deltaSigma);var d=s.toFixed(3)/1000;return d;};OpenLayers.Util.destinationVincenty=function(lonlat,brng,dist){var u=OpenLayers.Util;var ct=u.VincentyConstants;var a=ct.a,b=ct.b,f=ct.f;var lon1=lonlat.lon;var lat1=lonlat.lat;var s=dist;var alpha1=u.rad(brng);var sinAlpha1=Math.sin(alpha1);var cosAlpha1=Math.cos(alpha1);var tanU1=(1-f)*Math.tan(u.rad(lat1));var cosU1=1/Math.sqrt((1+tanU1*tanU1)),sinU1=tanU1*cosU1;var sigma1=Math.atan2(tanU1,cosAlpha1);var sinAlpha=cosU1*sinAlpha1;var cosSqAlpha=1-sinAlpha*sinAlpha;var uSq=cosSqAlpha*(a*a-b*b)/(b*b);var A=1+uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq)));var B=uSq/1024*(256+uSq*(-128+uSq*(74-47*uSq)));var sigma=s/(b*A),sigmaP=2*Math.PI;while(Math.abs(sigma-sigmaP)>1e-12){var cos2SigmaM=Math.cos(2*sigma1+sigma);var sinSigma=Math.sin(sigma);var cosSigma=Math.cos(sigma);var deltaSigma=B*sinSigma*(cos2SigmaM+B/4*(cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)-  
B/6*cos2SigmaM*(-3+4*sinSigma*sinSigma)*(-3+4*cos2SigmaM*cos2SigmaM)));sigmaP=sigma;sigma=s/(b*A)+deltaSigma;}  
var tmp=sinU1*sinSigma-cosU1*cosSigma*cosAlpha1;var lat2=Math.atan2(sinU1*cosSigma+cosU1*sinSigma*cosAlpha1,(1-f)*Math.sqrt(sinAlpha*sinAlpha+tmp*tmp));var lambda=Math.atan2(sinSigma*sinAlpha1,cosU1*cosSigma-sinU1*sinSigma*cosAlpha1);var C=f/16*cosSqAlpha*(4+f*(4-3*cosSqAlpha));var L=lambda-(1-C)*f*sinAlpha*(sigma+C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)));var revAz=Math.atan2(sinAlpha,-tmp);return new OpenLayers.LonLat(lon1+u.deg(L),u.deg(lat2));};OpenLayers.Util.getParameters=function(url){url=url||window.location.href;var paramsString="";if(OpenLayers.String.contains(url,'?')){var start=url.indexOf('?')+1;var end=OpenLayers.String.contains(url,"#")?url.indexOf('#'):url.length;paramsString=url.substring(start,end);}  
var parameters={};var pairs=paramsString.split(/[&;]/);for(var i=0,len=pairs.length;i<len;++i){var keyValue=pairs[i].split('=');if(keyValue[0]){var key=decodeURIComponent(keyValue[0]);var value=keyValue[1]||'';value=decodeURIComponent(value.replace(/\+/g," ")).split(",");if(value.length==1){value=value[0];}  
parameters[key]=value;}}  
return parameters;};OpenLayers.Util.getArgs=function(url){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.Util.getParameters'}));return OpenLayers.Util.getParameters(url);};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(prefix){if(prefix==null){prefix="id_";}  
OpenLayers.Util.lastSeqID+=1;return prefix+OpenLayers.Util.lastSeqID;};OpenLayers.INCHES_PER_UNIT={'inches':1.0,'ft':12.0,'mi':63360.0,'m':39.3701,'km':39370.1,'dd':4374754,'yd':36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT["degrees"]=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT["nmi"]=1852*OpenLayers.INCHES_PER_UNIT.m;OpenLayers.METERS_PER_INCH=0.02540005080010160020;OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{"Inch":OpenLayers.INCHES_PER_UNIT.inches,"Meter":1.0/OpenLayers.METERS_PER_INCH,"Foot":0.30480060960121920243/OpenLayers.METERS_PER_INCH,"IFoot":0.30480000000000000000/OpenLayers.METERS_PER_INCH,"ClarkeFoot":0.3047972651151/OpenLayers.METERS_PER_INCH,"SearsFoot":0.30479947153867624624/OpenLayers.METERS_PER_INCH,"GoldCoastFoot":0.30479971018150881758/OpenLayers.METERS_PER_INCH,"IInch":0.02540000000000000000/OpenLayers.METERS_PER_INCH,"MicroInch":0.00002540000000000000/OpenLayers.METERS_PER_INCH,"Mil":0.00000002540000000000/OpenLayers.METERS_PER_INCH,"Centimeter":0.01000000000000000000/OpenLayers.METERS_PER_INCH,"Kilometer":1000.00000000000000000000/OpenLayers.METERS_PER_INCH,"Yard":0.91440182880365760731/OpenLayers.METERS_PER_INCH,"SearsYard":0.914398414616029/OpenLayers.METERS_PER_INCH,"IndianYard":0.91439853074444079983/OpenLayers.METERS_PER_INCH,"IndianYd37":0.91439523/OpenLayers.METERS_PER_INCH,"IndianYd62":0.9143988/OpenLayers.METERS_PER_INCH,"IndianYd75":0.9143985/OpenLayers.METERS_PER_INCH,"IndianFoot":0.30479951/OpenLayers.METERS_PER_INCH,"IndianFt37":0.30479841/OpenLayers.METERS_PER_INCH,"IndianFt62":0.3047996/OpenLayers.METERS_PER_INCH,"IndianFt75":0.3047995/OpenLayers.METERS_PER_INCH,"Mile":1609.34721869443738887477/OpenLayers.METERS_PER_INCH,"IYard":0.91440000000000000000/OpenLayers.METERS_PER_INCH,"IMile":1609.34400000000000000000/OpenLayers.METERS_PER_INCH,"NautM":1852.00000000000000000000/OpenLayers.METERS_PER_INCH,"Lat-66":110943.316488932731/OpenLayers.METERS_PER_INCH,"Lat-83":110946.25736872234125/OpenLayers.METERS_PER_INCH,"Decimeter":0.10000000000000000000/OpenLayers.METERS_PER_INCH,"Millimeter":0.00100000000000000000/OpenLayers.METERS_PER_INCH,"Dekameter":10.00000000000000000000/OpenLayers.METERS_PER_INCH,"Decameter":10.00000000000000000000/OpenLayers.METERS_PER_INCH,"Hectometer":100.00000000000000000000/OpenLayers.METERS_PER_INCH,"GermanMeter":1.0000135965/OpenLayers.METERS_PER_INCH,"CaGrid":0.999738/OpenLayers.METERS_PER_INCH,"ClarkeChain":20.1166194976/OpenLayers.METERS_PER_INCH,"GunterChain":20.11684023368047/OpenLayers.METERS_PER_INCH,"BenoitChain":20.116782494375872/OpenLayers.METERS_PER_INCH,"SearsChain":20.11676512155/OpenLayers.METERS_PER_INCH,"ClarkeLink":0.201166194976/OpenLayers.METERS_PER_INCH,"GunterLink":0.2011684023368047/OpenLayers.METERS_PER_INCH,"BenoitLink":0.20116782494375872/OpenLayers.METERS_PER_INCH,"SearsLink":0.2011676512155/OpenLayers.METERS_PER_INCH,"Rod":5.02921005842012/OpenLayers.METERS_PER_INCH,"IntnlChain":20.1168/OpenLayers.METERS_PER_INCH,"IntnlLink":0.201168/OpenLayers.METERS_PER_INCH,"Perch":5.02921005842012/OpenLayers.METERS_PER_INCH,"Pole":5.02921005842012/OpenLayers.METERS_PER_INCH,"Furlong":201.1684023368046/OpenLayers.METERS_PER_INCH,"Rood":3.778266898/OpenLayers.METERS_PER_INCH,"CapeFoot":0.3047972615/OpenLayers.METERS_PER_INCH,"Brealey":375.00000000000000000000/OpenLayers.METERS_PER_INCH,"ModAmFt":0.304812252984505969011938/OpenLayers.METERS_PER_INCH,"Fathom":1.8288/OpenLayers.METERS_PER_INCH,"NautM-UK":1853.184/OpenLayers.METERS_PER_INCH,"50kilometers":50000.0/OpenLayers.METERS_PER_INCH,"150kilometers":150000.0/OpenLayers.METERS_PER_INCH});OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{"mm":OpenLayers.INCHES_PER_UNIT["Meter"]/1000.0,"cm":OpenLayers.INCHES_PER_UNIT["Meter"]/100.0,"dm":OpenLayers.INCHES_PER_UNIT["Meter"]*100.0,"km":OpenLayers.INCHES_PER_UNIT["Meter"]*1000.0,"kmi":OpenLayers.INCHES_PER_UNIT["nmi"],"fath":OpenLayers.INCHES_PER_UNIT["Fathom"],"ch":OpenLayers.INCHES_PER_UNIT["IntnlChain"],"link":OpenLayers.INCHES_PER_UNIT["IntnlLink"],"us-in":OpenLayers.INCHES_PER_UNIT["inches"],"us-ft":OpenLayers.INCHES_PER_UNIT["Foot"],"us-yd":OpenLayers.INCHES_PER_UNIT["Yard"],"us-ch":OpenLayers.INCHES_PER_UNIT["GunterChain"],"us-mi":OpenLayers.INCHES_PER_UNIT["Mile"],"ind-yd":OpenLayers.INCHES_PER_UNIT["IndianYd37"],"ind-ft":OpenLayers.INCHES_PER_UNIT["IndianFt37"],"ind-ch":20.11669506/OpenLayers.METERS_PER_INCH});OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(scale){var normScale=(scale>1.0)?(1.0/scale):scale;return normScale;};OpenLayers.Util.getResolutionFromScale=function(scale,units){var resolution;if(scale){if(units==null){units="degrees";}  
var normScale=OpenLayers.Util.normalizeScale(scale);resolution=1/(normScale*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH);}  
return resolution;};OpenLayers.Util.getScaleFromResolution=function(resolution,units){if(units==null){units="degrees";}  
var scale=resolution*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH;return scale;};OpenLayers.Util.safeStopPropagation=function(evt){OpenLayers.Event.stop(evt,true);};OpenLayers.Util.pagePosition=function(forElement){var valueT=0,valueL=0;var element=forElement;var child=forElement;while(element){if(element==document.body){if(OpenLayers.Element.getStyle(child,'position')=='absolute'){break;}}  
valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;child=element;try{element=element.offsetParent;}catch(e){OpenLayers.Console.error(OpenLayers.i18n("pagePositionFailed",{'elemId':element.id}));break;}}  
element=forElement;while(element){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;element=element.parentNode;}  
return[valueL,valueT];};OpenLayers.Util.isEquivalentUrl=function(url1,url2,options){options=options||{};OpenLayers.Util.applyDefaults(options,{ignoreCase:true,ignorePort80:true,ignoreHash:true});var urlObj1=OpenLayers.Util.createUrlObject(url1,options);var urlObj2=OpenLayers.Util.createUrlObject(url2,options);for(var key in urlObj1){if(key!=="args"){if(urlObj1[key]!=urlObj2[key]){return false;}}}  
for(var key in urlObj1.args){if(urlObj1.args[key]!=urlObj2.args[key]){return false;}  
delete urlObj2.args[key];}  
for(var key in urlObj2.args){return false;}  
return true;};OpenLayers.Util.createUrlObject=function(url,options){options=options||{};if(!(/^\w+:\/\//).test(url)){var loc=window.location;var port=loc.port?":"+loc.port:"";var fullUrl=loc.protocol+"//"+loc.host.split(":").shift()+port;if(url.indexOf("/")===0){url=fullUrl+url;}else{var parts=loc.pathname.split("/");parts.pop();url=fullUrl+parts.join("/")+"/"+url;}}  
if(options.ignoreCase){url=url.toLowerCase();}  
var a=document.createElement('a');a.href=url;var urlObject={};urlObject.host=a.host.split(":").shift();urlObject.protocol=a.protocol;if(options.ignorePort80){urlObject.port=(a.port=="80"||a.port=="0")?"":a.port;}else{urlObject.port=(a.port==""||a.port=="0")?"80":a.port;}  
urlObject.hash=(options.ignoreHash||a.hash==="#")?"":a.hash;var queryString=a.search;if(!queryString){var qMark=url.indexOf("?");queryString=(qMark!=-1)?url.substr(qMark):"";}  
urlObject.args=OpenLayers.Util.getParameters(queryString);urlObject.pathname=(a.pathname.charAt(0)=="/")?a.pathname:"/"+a.pathname;return urlObject;};OpenLayers.Util.removeTail=function(url){var head=null;var qMark=url.indexOf("?");var hashMark=url.indexOf("#");if(qMark==-1){head=(hashMark!=-1)?url.substr(0,hashMark):url;}else{head=(hashMark!=-1)?url.substr(0,Math.min(qMark,hashMark)):url.substr(0,qMark);}  
return head;};OpenLayers.Util.getBrowserName=function(){var browserName="";var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("opera")!=-1){browserName="opera";}else if(ua.indexOf("msie")!=-1){browserName="msie";}else if(ua.indexOf("safari")!=-1){browserName="safari";}else if(ua.indexOf("mozilla")!=-1){if(ua.indexOf("firefox")!=-1){browserName="firefox";}else{browserName="mozilla";}}  
return browserName;};OpenLayers.Util.getRenderedDimensions=function(contentHTML,size,options){var w,h;var container=document.createElement("div");container.style.visibility="hidden";var containerElement=(options&&options.containerElement)?options.containerElement:document.body;if(size){if(size.w){w=size.w;container.style.width=w+"px";}else if(size.h){h=size.h;container.style.height=h+"px";}}  
if(options&&options.displayClass){container.className=options.displayClass;}  
var content=document.createElement("div");content.innerHTML=contentHTML;content.style.overflow="visible";if(content.childNodes){for(var i=0,l=content.childNodes.length;i<l;i++){if(!content.childNodes[i].style)continue;content.childNodes[i].style.overflow="visible";}}  
container.appendChild(content);containerElement.appendChild(container);var parentHasPositionAbsolute=false;var parent=container.parentNode;while(parent&&parent.tagName.toLowerCase()!="body"){var parentPosition=OpenLayers.Element.getStyle(parent,"position");if(parentPosition=="absolute"){parentHasPositionAbsolute=true;break;}else if(parentPosition&&parentPosition!="static"){break;}  
parent=parent.parentNode;}  
if(!parentHasPositionAbsolute){container.style.position="absolute";}  
if(!w){w=parseInt(content.scrollWidth);container.style.width=w+"px";}  
if(!h){h=parseInt(content.scrollHeight);}  
container.removeChild(content);containerElement.removeChild(container);return new OpenLayers.Size(w,h);};OpenLayers.Util.getScrollbarWidth=function(){var scrollbarWidth=OpenLayers.Util._scrollbarWidth;if(scrollbarWidth==null){var scr=null;var inn=null;var wNoScroll=0;var wScroll=0;scr=document.createElement('div');scr.style.position='absolute';scr.style.top='-1000px';scr.style.left='-1000px';scr.style.width='100px';scr.style.height='50px';scr.style.overflow='hidden';inn=document.createElement('div');inn.style.width='100%';inn.style.height='200px';scr.appendChild(inn);document.body.appendChild(scr);wNoScroll=inn.offsetWidth;scr.style.overflow='scroll';wScroll=inn.offsetWidth;document.body.removeChild(document.body.lastChild);OpenLayers.Util._scrollbarWidth=(wNoScroll-wScroll);scrollbarWidth=OpenLayers.Util._scrollbarWidth;}  
return scrollbarWidth;};OpenLayers.Util.getFormattedLonLat=function(coordinate,axis,dmsOption){if(!dmsOption){dmsOption='dms';}  
var abscoordinate=Math.abs(coordinate)  
var coordinatedegrees=Math.floor(abscoordinate);var coordinateminutes=(abscoordinate-coordinatedegrees)/(1/60);var tempcoordinateminutes=coordinateminutes;coordinateminutes=Math.floor(coordinateminutes);var coordinateseconds=(tempcoordinateminutes-coordinateminutes)/(1/60);coordinateseconds=Math.round(coordinateseconds*10);coordinateseconds/=10;if(coordinatedegrees<10){coordinatedegrees="0"+coordinatedegrees;}  
var str=coordinatedegrees+"\u00B0";if(dmsOption.indexOf('dm')>=0){if(coordinateminutes<10){coordinateminutes="0"+coordinateminutes;}  
str+=coordinateminutes+"'";if(dmsOption.indexOf('dms')>=0){if(coordinateseconds<10){coordinateseconds="0"+coordinateseconds;}  
str+=coordinateseconds+'"';}}  
if(axis=="lon"){str+=coordinate<0?OpenLayers.i18n("W"):OpenLayers.i18n("E");}else{str+=coordinate<0?OpenLayers.i18n("S"):OpenLayers.i18n("N");}  
return str;};OpenLayers.Rico=new Object();OpenLayers.Rico.Corner={round:function(e,options){e=OpenLayers.Util.getElement(e);this._setOptions(options);var color=this.options.color;if(this.options.color=="fromElement"){color=this._background(e);}  
var bgColor=this.options.bgColor;if(this.options.bgColor=="fromParent"){bgColor=this._background(e.offsetParent);}  
this._roundCornersImpl(e,color,bgColor);},changeColor:function(theDiv,newColor){theDiv.style.backgroundColor=newColor;var spanElements=theDiv.parentNode.getElementsByTagName("span");for(var currIdx=0;currIdx<spanElements.length;currIdx++){spanElements[currIdx].style.backgroundColor=newColor;}},changeOpacity:function(theDiv,newOpacity){var mozillaOpacity=newOpacity;var ieOpacity='alpha(opacity='+newOpacity*100+')';theDiv.style.opacity=mozillaOpacity;theDiv.style.filter=ieOpacity;var spanElements=theDiv.parentNode.getElementsByTagName("span");for(var currIdx=0;currIdx<spanElements.length;currIdx++){spanElements[currIdx].style.opacity=mozillaOpacity;spanElements[currIdx].style.filter=ieOpacity;}},reRound:function(theDiv,options){var topRico=theDiv.parentNode.childNodes[0];var bottomRico=theDiv.parentNode.childNodes[2];theDiv.parentNode.removeChild(topRico);theDiv.parentNode.removeChild(bottomRico);this.round(theDiv.parentNode,options);},_roundCornersImpl:function(e,color,bgColor){if(this.options.border){this._renderBorder(e,bgColor);}  
if(this._isTopRounded()){this._roundTopCorners(e,color,bgColor);}  
if(this._isBottomRounded()){this._roundBottomCorners(e,color,bgColor);}},_renderBorder:function(el,bgColor){var borderValue="1px solid "+this._borderColor(bgColor);var borderL="border-left: "+borderValue;var borderR="border-right: "+borderValue;var style="style='"+borderL+";"+borderR+"'";el.innerHTML="<div "+style+">"+el.innerHTML+"</div>";},_roundTopCorners:function(el,color,bgColor){var corner=this._createCorner(bgColor);for(var i=0;i<this.options.numSlices;i++){corner.appendChild(this._createCornerSlice(color,bgColor,i,"top"));}  
el.style.paddingTop=0;el.insertBefore(corner,el.firstChild);},_roundBottomCorners:function(el,color,bgColor){var corner=this._createCorner(bgColor);for(var i=(this.options.numSlices-1);i>=0;i--){corner.appendChild(this._createCornerSlice(color,bgColor,i,"bottom"));}  
el.style.paddingBottom=0;el.appendChild(corner);},_createCorner:function(bgColor){var corner=document.createElement("div");corner.style.backgroundColor=(this._isTransparent()?"transparent":bgColor);return corner;},_createCornerSlice:function(color,bgColor,n,position){var slice=document.createElement("span");var inStyle=slice.style;inStyle.backgroundColor=color;inStyle.display="block";inStyle.height="1px";inStyle.overflow="hidden";inStyle.fontSize="1px";var borderColor=this._borderColor(color,bgColor);if(this.options.border&&n==0){inStyle.borderTopStyle="solid";inStyle.borderTopWidth="1px";inStyle.borderLeftWidth="0px";inStyle.borderRightWidth="0px";inStyle.borderBottomWidth="0px";inStyle.height="0px";inStyle.borderColor=borderColor;}  
else if(borderColor){inStyle.borderColor=borderColor;inStyle.borderStyle="solid";inStyle.borderWidth="0px 1px";}  
if(!this.options.compact&&(n==(this.options.numSlices-1))){inStyle.height="2px";}  
this._setMargin(slice,n,position);this._setBorder(slice,n,position);return slice;},_setOptions:function(options){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false};OpenLayers.Util.extend(this.options,options||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent()){this.options.blend=false;}},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top")){return"";}  
if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0){return"";}  
if(this.options.corners.indexOf("tl")>=0){return"left";}else if(this.options.corners.indexOf("tr")>=0){return"right";}  
return"";},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom")){return"";}  
if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0){return"";}  
if(this.options.corners.indexOf("bl")>=0){return"left";}else if(this.options.corners.indexOf("br")>=0){return"right";}  
return"";},_borderColor:function(color,bgColor){if(color=="transparent"){return bgColor;}else if(this.options.border){return this.options.border;}else if(this.options.blend){return this._blend(bgColor,color);}else{return"";}},_setMargin:function(el,n,corners){var marginSize=this._marginSize(n);var whichSide=corners=="top"?this._whichSideTop():this._whichSideBottom();if(whichSide=="left"){el.style.marginLeft=marginSize+"px";el.style.marginRight="0px";}  
else if(whichSide=="right"){el.style.marginRight=marginSize+"px";el.style.marginLeft="0px";}  
else{el.style.marginLeft=marginSize+"px";el.style.marginRight=marginSize+"px";}},_setBorder:function(el,n,corners){var borderSize=this._borderSize(n);var whichSide=corners=="top"?this._whichSideTop():this._whichSideBottom();if(whichSide=="left"){el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth="0px";}  
else if(whichSide=="right"){el.style.borderRightWidth=borderSize+"px";el.style.borderLeftWidth="0px";}  
else{el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth=borderSize+"px";}  
if(this.options.border!=false){el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth=borderSize+"px";}},_marginSize:function(n){if(this._isTransparent()){return 0;}  
var marginSizes=[5,3,2,1];var blendedMarginSizes=[3,2,1,0];var compactMarginSizes=[2,1];var smBlendedMarginSizes=[1,0];if(this.options.compact&&this.options.blend){return smBlendedMarginSizes[n];}else if(this.options.compact){return compactMarginSizes[n];}else if(this.options.blend){return blendedMarginSizes[n];}else{return marginSizes[n];}},_borderSize:function(n){var transparentBorderSizes=[5,3,2,1];var blendedBorderSizes=[2,1,1,1];var compactBorderSizes=[1,0];var actualBorderSizes=[0,2,0,0];if(this.options.compact&&(this.options.blend||this._isTransparent())){return 1;}else if(this.options.compact){return compactBorderSizes[n];}else if(this.options.blend){return blendedBorderSizes[n];}else if(this.options.border){return actualBorderSizes[n];}else if(this._isTransparent()){return transparentBorderSizes[n];}  
return 0;},_hasString:function(str){for(var i=1;i<arguments.length;i++)if(str.indexOf(arguments[i])>=0){return true;}return false;},_blend:function(c1,c2){var cc1=OpenLayers.Rico.Color.createFromHex(c1);cc1.blend(OpenLayers.Rico.Color.createFromHex(c2));return cc1;},_background:function(el){try{return OpenLayers.Rico.Color.createColorFromBackground(el).asHex();}catch(err){return"#ffffff";}},_isTransparent:function(){return this.options.color=="transparent";},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr");},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br");},_hasSingleTextChild:function(el){return el.childNodes.length==1&&el.childNodes[0].nodeType==3;}};(function(){if(window.google&&google.gears){return;}  
var factory=null;if(typeof GearsFactory!='undefined'){factory=new GearsFactory();}else{try{factory=new ActiveXObject('Gears.Factory');if(factory.getBuildInfo().indexOf('ie_mobile')!=-1){factory.privateSetGlobalObject(this);}}catch(e){if((typeof navigator.mimeTypes!='undefined')&&navigator.mimeTypes["application/x-googlegears"]){factory=document.createElement("object");factory.style.display="none";factory.width=0;factory.height=0;factory.type="application/x-googlegears";document.documentElement.appendChild(factory);}}}  
if(!factory){return;}  
if(!window.google){google={};}  
if(!google.gears){google.gears={factory:factory};}})();OpenLayers.Element={visible:function(element){return OpenLayers.Util.getElement(element).style.display!='none';},toggle:function(){for(var i=0,len=arguments.length;i<len;i++){var element=OpenLayers.Util.getElement(arguments[i]);var display=OpenLayers.Element.visible(element)?'hide':'show';OpenLayers.Element[display](element);}},hide:function(){for(var i=0,len=arguments.length;i<len;i++){var element=OpenLayers.Util.getElement(arguments[i]);if(element){element.style.display='none';}}},show:function(){for(var i=0,len=arguments.length;i<len;i++){var element=OpenLayers.Util.getElement(arguments[i]);if(element){element.style.display='';}}},remove:function(element){element=OpenLayers.Util.getElement(element);element.parentNode.removeChild(element);},getHeight:function(element){element=OpenLayers.Util.getElement(element);return element.offsetHeight;},getDimensions:function(element){element=OpenLayers.Util.getElement(element);if(OpenLayers.Element.getStyle(element,'display')!='none'){return{width:element.offsetWidth,height:element.offsetHeight};}  
var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;var originalDisplay=els.display;els.visibility='hidden';els.position='absolute';els.display='';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display=originalDisplay;els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},hasClass:function(element,name){var names=element.className;return(!!names&&new RegExp("(^|\\s)"+name+"(\\s|$)").test(names));},addClass:function(element,name){if(!OpenLayers.Element.hasClass(element,name)){element.className+=(element.className?" ":"")+name;}  
return element;},removeClass:function(element,name){var names=element.className;if(names){element.className=OpenLayers.String.trim(names.replace(new RegExp("(^|\\s+)"+name+"(\\s+|$)")," "));}  
return element;},toggleClass:function(element,name){if(OpenLayers.Element.hasClass(element,name)){OpenLayers.Element.removeClass(element,name);}else{OpenLayers.Element.addClass(element,name);}  
return element;},getStyle:function(element,style){element=OpenLayers.Util.getElement(element);var value=null;if(element&&element.style){value=element.style[OpenLayers.String.camelize(style)];if(!value){if(document.defaultView&&document.defaultView.getComputedStyle){var css=document.defaultView.getComputedStyle(element,null);value=css?css.getPropertyValue(style):null;}else if(element.currentStyle){value=element.currentStyle[OpenLayers.String.camelize(style)];}}  
var positions=['left','top','right','bottom'];if(window.opera&&(OpenLayers.Util.indexOf(positions,style)!=-1)&&(OpenLayers.Element.getStyle(element,'position')=='static')){value='auto';}}  
return value=='auto'?null:value;}};OpenLayers.Size=OpenLayers.Class({w:0.0,h:0.0,initialize:function(w,h){this.w=parseFloat(w);this.h=parseFloat(h);},toString:function(){return("w="+this.w+",h="+this.h);},clone:function(){return new OpenLayers.Size(this.w,this.h);},equals:function(sz){var equals=false;if(sz!=null){equals=((this.w==sz.w&&this.h==sz.h)||(isNaN(this.w)&&isNaN(this.h)&&isNaN(sz.w)&&isNaN(sz.h)));}  
return equals;},CLASS_NAME:"OpenLayers.Size"});OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(error){alert(error);},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"};(function(){var scripts=document.getElementsByTagName("script");for(var i=0,len=scripts.length;i<len;++i){if(scripts[i].src.indexOf("firebug.js")!=-1){if(console){OpenLayers.Util.extend(OpenLayers.Console,console);break;}}}})();OpenLayers.Icon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(url,size,offset,calculateOffset){this.url=url;this.size=(size)?size:new OpenLayers.Size(20,20);this.offset=offset?offset:new OpenLayers.Pixel(-(this.size.w/2),-(this.size.h/2));this.calculateOffset=calculateOffset;var id=OpenLayers.Util.createUniqueID("OL_Icon_");this.imageDiv=OpenLayers.Util.createAlphaImageDiv(id);},destroy:function(){this.erase();OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);this.imageDiv.innerHTML="";this.imageDiv=null;},clone:function(){return new OpenLayers.Icon(this.url,this.size,this.offset,this.calculateOffset);},setSize:function(size){if(size!=null){this.size=size;}  
this.draw();},setUrl:function(url){if(url!=null){this.url=url;}  
this.draw();},draw:function(px){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,this.size,this.url,"absolute");this.moveTo(px);return this.imageDiv;},erase:function(){if(this.imageDiv!=null&&this.imageDiv.parentNode!=null){OpenLayers.Element.remove(this.imageDiv);}},setOpacity:function(opacity){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,null,null,null,null,null,opacity);},moveTo:function(px){if(px!=null){this.px=px;}  
if(this.imageDiv!=null){if(this.px==null){this.display(false);}else{if(this.calculateOffset){this.offset=this.calculateOffset(this.size);}  
var offsetPx=this.px.offset(this.offset);OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,offsetPx);}}},display:function(display){this.imageDiv.style.display=(display)?"":"none";},isDrawn:function(){var isDrawn=(this.imageDiv&&this.imageDiv.parentNode&&(this.imageDiv.parentNode.nodeType!=11));return isDrawn;},CLASS_NAME:"OpenLayers.Icon"});OpenLayers.Popup=OpenLayers.Class({events:null,id:"",lonlat:null,div:null,contentSize:null,size:null,contentHTML:null,backgroundColor:"",opacity:"",border:"",contentDiv:null,groupDiv:null,closeDiv:null,autoSize:false,minSize:null,maxSize:null,displayClass:"olPopup",contentDisplayClass:"olPopupContent",padding:0,disableFirefoxOverflowHack:false,fixPadding:function(){if(typeof this.padding=="number"){this.padding=new OpenLayers.Bounds(this.padding,this.padding,this.padding,this.padding);}},panMapIfOutOfView:false,keepInMap:false,closeOnMove:false,map:null,initialize:function(id,lonlat,contentSize,contentHTML,closeBox,closeBoxCallback){if(id==null){id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");}  
this.id=id;this.lonlat=lonlat;this.contentSize=(contentSize!=null)?contentSize:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);if(contentHTML!=null){this.contentHTML=contentHTML;}  
this.backgroundColor=OpenLayers.Popup.COLOR;this.opacity=OpenLayers.Popup.OPACITY;this.border=OpenLayers.Popup.BORDER;this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"hidden");this.div.className=this.displayClass;var groupDivId=this.id+"_GroupDiv";this.groupDiv=OpenLayers.Util.createDiv(groupDivId,null,null,null,"relative",null,"hidden");var id=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(id,null,this.contentSize.clone(),null,"relative");this.contentDiv.className=this.contentDisplayClass;this.groupDiv.appendChild(this.contentDiv);this.div.appendChild(this.groupDiv);if(closeBox){this.addCloseBox(closeBoxCallback);}  
this.registerEvents();},destroy:function(){this.id=null;this.lonlat=null;this.size=null;this.contentHTML=null;this.backgroundColor=null;this.opacity=null;this.border=null;if(this.closeOnMove&&this.map){this.map.events.unregister("movestart",this,this.hide);}  
this.events.destroy();this.events=null;if(this.closeDiv){OpenLayers.Event.stopObservingElement(this.closeDiv);this.groupDiv.removeChild(this.closeDiv);}  
this.closeDiv=null;this.div.removeChild(this.groupDiv);this.groupDiv=null;if(this.map!=null){this.map.removePopup(this);}  
this.map=null;this.div=null;this.autoSize=null;this.minSize=null;this.maxSize=null;this.padding=null;this.panMapIfOutOfView=null;},draw:function(px){if(px==null){if((this.lonlat!=null)&&(this.map!=null)){px=this.map.getLayerPxFromLonLat(this.lonlat);}}  
if(this.closeOnMove){this.map.events.register("movestart",this,this.hide);}  
if(!this.disableFirefoxOverflowHack&&OpenLayers.Util.getBrowserName()=='firefox'){this.map.events.register("movestart",this,function(){var style=document.defaultView.getComputedStyle(this.contentDiv,null);var currentOverflow=style.getPropertyValue("overflow");if(currentOverflow!="hidden"){this.contentDiv._oldOverflow=currentOverflow;this.contentDiv.style.overflow="hidden";}});this.map.events.register("moveend",this,function(){var oldOverflow=this.contentDiv._oldOverflow;if(oldOverflow){this.contentDiv.style.overflow=oldOverflow;this.contentDiv._oldOverflow=null;}});}  
this.moveTo(px);if(!this.autoSize&&!this.size){this.setSize(this.contentSize);}  
this.setBackgroundColor();this.setOpacity();this.setBorder();this.setContentHTML();if(this.panMapIfOutOfView){this.panIntoView();}  
return this.div;},updatePosition:function(){if((this.lonlat)&&(this.map)){var px=this.map.getLayerPxFromLonLat(this.lonlat);if(px){this.moveTo(px);}}},moveTo:function(px){if((px!=null)&&(this.div!=null)){this.div.style.left=px.x+"px";this.div.style.top=px.y+"px";}},visible:function(){return OpenLayers.Element.visible(this.div);},toggle:function(){if(this.visible()){this.hide();}else{this.show();}},show:function(){OpenLayers.Element.show(this.div);if(this.panMapIfOutOfView){this.panIntoView();}},hide:function(){OpenLayers.Element.hide(this.div);},setSize:function(contentSize){this.size=contentSize.clone();var contentDivPadding=this.getContentDivPadding();var wPadding=contentDivPadding.left+contentDivPadding.right;var hPadding=contentDivPadding.top+contentDivPadding.bottom;this.fixPadding();wPadding+=this.padding.left+this.padding.right;hPadding+=this.padding.top+this.padding.bottom;if(this.closeDiv){var closeDivWidth=parseInt(this.closeDiv.style.width);wPadding+=closeDivWidth+contentDivPadding.right;}  
this.size.w+=wPadding;this.size.h+=hPadding;if(OpenLayers.Util.getBrowserName()=="msie"){this.contentSize.w+=contentDivPadding.left+contentDivPadding.right;this.contentSize.h+=contentDivPadding.bottom+contentDivPadding.top;}  
if(this.div!=null){this.div.style.width=this.size.w+"px";this.div.style.height=this.size.h+"px";}  
if(this.contentDiv!=null){this.contentDiv.style.width=contentSize.w+"px";this.contentDiv.style.height=contentSize.h+"px";}},updateSize:function(){var preparedHTML="<div class='"+this.contentDisplayClass+"'>"+  
this.contentDiv.innerHTML+"</div>";var containerElement=(this.map)?this.map.layerContainerDiv:document.body;var realSize=OpenLayers.Util.getRenderedDimensions(preparedHTML,null,{displayClass:this.displayClass,containerElement:containerElement});var safeSize=this.getSafeContentSize(realSize);var newSize=null;if(safeSize.equals(realSize)){newSize=realSize;}else{var fixedSize=new OpenLayers.Size();fixedSize.w=(safeSize.w<realSize.w)?safeSize.w:null;fixedSize.h=(safeSize.h<realSize.h)?safeSize.h:null;if(fixedSize.w&&fixedSize.h){newSize=safeSize;}else{var clippedSize=OpenLayers.Util.getRenderedDimensions(preparedHTML,fixedSize,{displayClass:this.contentDisplayClass,containerElement:containerElement});var currentOverflow=OpenLayers.Element.getStyle(this.contentDiv,"overflow");if((currentOverflow!="hidden")&&(clippedSize.equals(safeSize))){var scrollBar=OpenLayers.Util.getScrollbarWidth();if(fixedSize.w){clippedSize.h+=scrollBar;}else{clippedSize.w+=scrollBar;}}  
newSize=this.getSafeContentSize(clippedSize);}}  
this.setSize(newSize);},setBackgroundColor:function(color){if(color!=undefined){this.backgroundColor=color;}  
if(this.div!=null){this.div.style.backgroundColor=this.backgroundColor;}},setOpacity:function(opacity){if(opacity!=undefined){this.opacity=opacity;}  
if(this.div!=null){this.div.style.opacity=this.opacity;this.div.style.filter='alpha(opacity='+this.opacity*100+')';}},setBorder:function(border){if(border!=undefined){this.border=border;}  
if(this.div!=null){this.div.style.border=this.border;}},setContentHTML:function(contentHTML){if(contentHTML!=null){this.contentHTML=contentHTML;}  
if((this.contentDiv!=null)&&(this.contentHTML!=null)&&(this.contentHTML!=this.contentDiv.innerHTML)){this.contentDiv.innerHTML=this.contentHTML;if(this.autoSize){this.registerImageListeners();this.updateSize();}}},registerImageListeners:function(){var onImgLoad=function(){this.popup.updateSize();if(this.popup.visible()&&this.popup.panMapIfOutOfView){this.popup.panIntoView();}  
OpenLayers.Event.stopObserving(this.img,"load",this.img._onImageLoad);};var images=this.contentDiv.getElementsByTagName("img");for(var i=0,len=images.length;i<len;i++){var img=images[i];if(img.width==0||img.height==0){var context={'popup':this,'img':img};img._onImgLoad=OpenLayers.Function.bind(onImgLoad,context);OpenLayers.Event.observe(img,'load',img._onImgLoad);}}},getSafeContentSize:function(size){var safeContentSize=size.clone();var contentDivPadding=this.getContentDivPadding();var wPadding=contentDivPadding.left+contentDivPadding.right;var hPadding=contentDivPadding.top+contentDivPadding.bottom;this.fixPadding();wPadding+=this.padding.left+this.padding.right;hPadding+=this.padding.top+this.padding.bottom;if(this.closeDiv){var closeDivWidth=parseInt(this.closeDiv.style.width);wPadding+=closeDivWidth+contentDivPadding.right;}  
if(this.minSize){safeContentSize.w=Math.max(safeContentSize.w,(this.minSize.w-wPadding));safeContentSize.h=Math.max(safeContentSize.h,(this.minSize.h-hPadding));}  
if(this.maxSize){safeContentSize.w=Math.min(safeContentSize.w,(this.maxSize.w-wPadding));safeContentSize.h=Math.min(safeContentSize.h,(this.maxSize.h-hPadding));}  
if(this.map&&this.map.size){var extraX=0,extraY=0;if(this.keepInMap&&!this.panMapIfOutOfView){var px=this.map.getPixelFromLonLat(this.lonlat);switch(this.relativePosition){case"tr":extraX=px.x;extraY=this.map.size.h-px.y;break;case"tl":extraX=this.map.size.w-px.x;extraY=this.map.size.h-px.y;break;case"bl":extraX=this.map.size.w-px.x;extraY=px.y;break;case"br":extraX=px.x;extraY=px.y;break;default:extraX=px.x;extraY=this.map.size.h-px.y;break;}}  
var maxY=this.map.size.h-  
this.map.paddingForPopups.top-  
this.map.paddingForPopups.bottom-  
hPadding-extraY;var maxX=this.map.size.w-  
this.map.paddingForPopups.left-  
this.map.paddingForPopups.right-  
wPadding-extraX;safeContentSize.w=Math.min(safeContentSize.w,maxX);safeContentSize.h=Math.min(safeContentSize.h,maxY);}  
return safeContentSize;},getContentDivPadding:function(){var contentDivPadding=this._contentDivPadding;if(!contentDivPadding){if(this.div.parentNode==null){this.div.style.display="none";document.body.appendChild(this.div);}  
contentDivPadding=new OpenLayers.Bounds(OpenLayers.Element.getStyle(this.contentDiv,"padding-left"),OpenLayers.Element.getStyle(this.contentDiv,"padding-bottom"),OpenLayers.Element.getStyle(this.contentDiv,"padding-right"),OpenLayers.Element.getStyle(this.contentDiv,"padding-top"));this._contentDivPadding=contentDivPadding;if(this.div.parentNode==document.body){document.body.removeChild(this.div);this.div.style.display="";}}  
return contentDivPadding;},addCloseBox:function(callback){this.closeDiv=OpenLayers.Util.createDiv(this.id+"_close",null,new OpenLayers.Size(17,17));this.closeDiv.className="olPopupCloseBox";var contentDivPadding=this.getContentDivPadding();this.closeDiv.style.right=contentDivPadding.right+"px";this.closeDiv.style.top=contentDivPadding.top+"px";this.groupDiv.appendChild(this.closeDiv);var closePopup=callback||function(e){this.hide();OpenLayers.Event.stop(e);};OpenLayers.Event.observe(this.closeDiv,"click",OpenLayers.Function.bindAsEventListener(closePopup,this));},panIntoView:function(){var mapSize=this.map.getSize();var origTL=this.map.getViewPortPxFromLayerPx(new OpenLayers.Pixel(parseInt(this.div.style.left),parseInt(this.div.style.top)));var newTL=origTL.clone();if(origTL.x<this.map.paddingForPopups.left){newTL.x=this.map.paddingForPopups.left;}else  
if((origTL.x+this.size.w)>(mapSize.w-this.map.paddingForPopups.right)){newTL.x=mapSize.w-this.map.paddingForPopups.right-this.size.w;}  
if(origTL.y<this.map.paddingForPopups.top){newTL.y=this.map.paddingForPopups.top;}else  
if((origTL.y+this.size.h)>(mapSize.h-this.map.paddingForPopups.bottom)){newTL.y=mapSize.h-this.map.paddingForPopups.bottom-this.size.h;}  
var dx=origTL.x-newTL.x;var dy=origTL.y-newTL.y;this.map.pan(dx,dy);},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(evt){this.mousedown=true;OpenLayers.Event.stop(evt,true);},onmousemove:function(evt){if(this.mousedown){OpenLayers.Event.stop(evt,true);}},onmouseup:function(evt){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(evt,true);}},onclick:function(evt){OpenLayers.Event.stop(evt,true);},onmouseout:function(evt){this.mousedown=false;},ondblclick:function(evt){OpenLayers.Event.stop(evt,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.Protocol=OpenLayers.Class({format:null,options:null,autoDestroy:true,defaultFilter:null,initialize:function(options){options=options||{};OpenLayers.Util.extend(this,options);this.options=options;},mergeWithDefaultFilter:function(filter){var merged;if(filter&&this.defaultFilter){merged=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,filters:[this.defaultFilter,filter]});}else{merged=filter||this.defaultFilter||undefined;}  
return merged;},destroy:function(){this.options=null;this.format=null;},read:function(options){options=options||{};options.filter=this.mergeWithDefaultFilter(options.filter);},create:function(){},update:function(){},"delete":function(){},commit:function(){},abort:function(response){},createCallback:function(method,response,options){return OpenLayers.Function.bind(function(){method.apply(this,[response,options]);},this);},CLASS_NAME:"OpenLayers.Protocol"});OpenLayers.Protocol.Response=OpenLayers.Class({code:null,requestType:null,last:true,features:null,reqFeatures:null,priv:null,initialize:function(options){OpenLayers.Util.extend(this,options);},success:function(){return this.code>0;},CLASS_NAME:"OpenLayers.Protocol.Response"});OpenLayers.Protocol.Response.SUCCESS=1;OpenLayers.Protocol.Response.FAILURE=0;OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:false,size:null,resolution:null,map:null,initialize:function(containerID,options){this.container=OpenLayers.Util.getElement(containerID);},destroy:function(){this.container=null;this.extent=null;this.size=null;this.resolution=null;this.map=null;},supported:function(){return false;},setExtent:function(extent,resolutionChanged){this.extent=extent.clone();if(resolutionChanged){this.resolution=null;}},setSize:function(size){this.size=size.clone();this.resolution=null;},getResolution:function(){this.resolution=this.resolution||this.map.getResolution();return this.resolution;},drawFeature:function(feature,style){if(style==null){style=feature.style;}  
if(feature.geometry){var bounds=feature.geometry.getBounds();if(bounds){if(!bounds.intersectsBounds(this.extent)){style={display:"none"};}  
var rendered=this.drawGeometry(feature.geometry,style,feature.id);if(style.display!="none"&&style.label&&rendered!==false){var location=feature.geometry.getCentroid();if(style.labelXOffset||style.labelYOffset){xOffset=isNaN(style.labelXOffset)?0:style.labelXOffset;yOffset=isNaN(style.labelYOffset)?0:style.labelYOffset;var res=this.getResolution();location.move(xOffset*res,yOffset*res);}  
this.drawText(feature.id,style,location);}else{this.removeText(feature.id);}  
return rendered;}}},drawGeometry:function(geometry,style,featureId){},drawText:function(featureId,style,location){},removeText:function(featureId){},clear:function(){},getFeatureIdFromEvent:function(evt){},eraseFeatures:function(features){if(!(features instanceof Array)){features=[features];}  
for(var i=0,len=features.length;i<len;++i){var feature=features[i];this.eraseGeometry(feature.geometry,feature.id);this.removeText(feature.id);}},eraseGeometry:function(geometry,featureId){},moveRoot:function(renderer){},getRenderLayerId:function(){return this.container.id;},applyDefaultSymbolizer:function(symbolizer){var result=OpenLayers.Util.extend({},OpenLayers.Renderer.defaultSymbolizer);if(symbolizer.stroke===false){delete result.strokeWidth;delete result.strokeColor;}  
if(symbolizer.fill===false){delete result.fillColor;}  
OpenLayers.Util.extend(result,symbolizer);return result;},CLASS_NAME:"OpenLayers.Renderer"});OpenLayers.Renderer.defaultSymbolizer={fillColor:"#000000",strokeColor:"#000000",strokeWidth:2,fillOpacity:1,strokeOpacity:1,pointRadius:0};OpenLayers.Strategy=OpenLayers.Class({layer:null,options:null,active:null,autoActivate:true,autoDestroy:true,initialize:function(options){OpenLayers.Util.extend(this,options);this.options=options;this.active=false;},destroy:function(){this.deactivate();this.layer=null;this.options=null;},setLayer:function(layer){this.layer=layer;},activate:function(){if(!this.active){this.active=true;return true;}  
return false;},deactivate:function(){if(this.active){this.active=false;return true;}  
return false;},CLASS_NAME:"OpenLayers.Strategy"});OpenLayers.Symbolizer=OpenLayers.Class({zIndex:0,initialize:function(config){OpenLayers.Util.extend(this,config);},clone:function(){var Type=eval(this.CLASS_NAME);return new Type(OpenLayers.Util.extend({},this));},CLASS_NAME:"OpenLayers.Symbolizer"});OpenLayers.Rico.Color=OpenLayers.Class({initialize:function(red,green,blue){this.rgb={r:red,g:green,b:blue};},setRed:function(r){this.rgb.r=r;},setGreen:function(g){this.rgb.g=g;},setBlue:function(b){this.rgb.b=b;},setHue:function(h){var hsb=this.asHSB();hsb.h=h;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b);},setSaturation:function(s){var hsb=this.asHSB();hsb.s=s;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b);},setBrightness:function(b){var hsb=this.asHSB();hsb.b=b;this.rgb=OpenLayers.Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b);},darken:function(percent){var hsb=this.asHSB();this.rgb=OpenLayers.Rico.Color.HSBtoRGB(hsb.h,hsb.s,Math.max(hsb.b-percent,0));},brighten:function(percent){var hsb=this.asHSB();this.rgb=OpenLayers.Rico.Color.HSBtoRGB(hsb.h,hsb.s,Math.min(hsb.b+percent,1));},blend:function(other){this.rgb.r=Math.floor((this.rgb.r+other.rgb.r)/2);this.rgb.g=Math.floor((this.rgb.g+other.rgb.g)/2);this.rgb.b=Math.floor((this.rgb.b+other.rgb.b)/2);},isBright:function(){var hsb=this.asHSB();return this.asHSB().b>0.5;},isDark:function(){return!this.isBright();},asRGB:function(){return"rgb("+this.rgb.r+","+this.rgb.g+","+this.rgb.b+")";},asHex:function(){return"#"+this.rgb.r.toColorPart()+this.rgb.g.toColorPart()+this.rgb.b.toColorPart();},asHSB:function(){return OpenLayers.Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b);},toString:function(){return this.asHex();}});OpenLayers.Rico.Color.createFromHex=function(hexCode){if(hexCode.length==4){var shortHexCode=hexCode;var hexCode='#';for(var i=1;i<4;i++){hexCode+=(shortHexCode.charAt(i)+  
shortHexCode.charAt(i));}}  
if(hexCode.indexOf('#')==0){hexCode=hexCode.substring(1);}  
var red=hexCode.substring(0,2);var green=hexCode.substring(2,4);var blue=hexCode.substring(4,6);return new OpenLayers.Rico.Color(parseInt(red,16),parseInt(green,16),parseInt(blue,16));};OpenLayers.Rico.Color.createColorFromBackground=function(elem){var actualColor=RicoUtil.getElementsComputedStyle(OpenLayers.Util.getElement(elem),"backgroundColor","background-color");if(actualColor=="transparent"&&elem.parentNode){return OpenLayers.Rico.Color.createColorFromBackground(elem.parentNode);}  
if(actualColor==null){return new OpenLayers.Rico.Color(255,255,255);}  
if(actualColor.indexOf("rgb(")==0){var colors=actualColor.substring(4,actualColor.length-1);var colorArray=colors.split(",");return new OpenLayers.Rico.Color(parseInt(colorArray[0]),parseInt(colorArray[1]),parseInt(colorArray[2]));}  
else if(actualColor.indexOf("#")==0){return OpenLayers.Rico.Color.createFromHex(actualColor);}  
else{return new OpenLayers.Rico.Color(255,255,255);}};OpenLayers.Rico.Color.HSBtoRGB=function(hue,saturation,brightness){var red=0;var green=0;var blue=0;if(saturation==0){red=parseInt(brightness*255.0+0.5);green=red;blue=red;}  
else{var h=(hue-Math.floor(hue))*6.0;var f=h-Math.floor(h);var p=brightness*(1.0-saturation);var q=brightness*(1.0-saturation*f);var t=brightness*(1.0-(saturation*(1.0-f)));switch(parseInt(h)){case 0:red=(brightness*255.0+0.5);green=(t*255.0+0.5);blue=(p*255.0+0.5);break;case 1:red=(q*255.0+0.5);green=(brightness*255.0+0.5);blue=(p*255.0+0.5);break;case 2:red=(p*255.0+0.5);green=(brightness*255.0+0.5);blue=(t*255.0+0.5);break;case 3:red=(p*255.0+0.5);green=(q*255.0+0.5);blue=(brightness*255.0+0.5);break;case 4:red=(t*255.0+0.5);green=(p*255.0+0.5);blue=(brightness*255.0+0.5);break;case 5:red=(brightness*255.0+0.5);green=(p*255.0+0.5);blue=(q*255.0+0.5);break;}}  
return{r:parseInt(red),g:parseInt(green),b:parseInt(blue)};};OpenLayers.Rico.Color.RGBtoHSB=function(r,g,b){var hue;var saturation;var brightness;var cmax=(r>g)?r:g;if(b>cmax){cmax=b;}  
var cmin=(r<g)?r:g;if(b<cmin){cmin=b;}  
brightness=cmax/255.0;if(cmax!=0){saturation=(cmax-cmin)/cmax;}else{saturation=0;}  
if(saturation==0){hue=0;}else{var redc=(cmax-r)/(cmax-cmin);var greenc=(cmax-g)/(cmax-cmin);var bluec=(cmax-b)/(cmax-cmin);if(r==cmax){hue=bluec-greenc;}else if(g==cmax){hue=2.0+redc-bluec;}else{hue=4.0+greenc-redc;}  
hue=hue/6.0;if(hue<0){hue=hue+1.0;}}  
return{h:hue,s:saturation,b:brightness};};OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(left,bottom,right,top){if(left!=null){this.left=OpenLayers.Util.toFloat(left);}  
if(bottom!=null){this.bottom=OpenLayers.Util.toFloat(bottom);}  
if(right!=null){this.right=OpenLayers.Util.toFloat(right);}  
if(top!=null){this.top=OpenLayers.Util.toFloat(top);}},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top);},equals:function(bounds){var equals=false;if(bounds!=null){equals=((this.left==bounds.left)&&(this.right==bounds.right)&&(this.top==bounds.top)&&(this.bottom==bounds.bottom));}  
return equals;},toString:function(){return("left-bottom=("+this.left+","+this.bottom+")"  
+" right-top=("+this.right+","+this.top+")");},toArray:function(reverseAxisOrder){if(reverseAxisOrder===true){return[this.bottom,this.left,this.top,this.right];}else{return[this.left,this.bottom,this.right,this.top];}},toBBOX:function(decimal,reverseAxisOrder){if(decimal==null){decimal=6;}  
var mult=Math.pow(10,decimal);var xmin=Math.round(this.left*mult)/mult;var ymin=Math.round(this.bottom*mult)/mult;var xmax=Math.round(this.right*mult)/mult;var ymax=Math.round(this.top*mult)/mult;if(reverseAxisOrder===true){return ymin+","+xmin+","+ymax+","+xmax;}else{return xmin+","+ymin+","+xmax+","+ymax;}},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(ratio,origin){if(origin==null){origin=this.getCenterLonLat();}  
var origx,origy;if(origin.CLASS_NAME=="OpenLayers.LonLat"){origx=origin.lon;origy=origin.lat;}else{origx=origin.x;origy=origin.y;}  
var left=(this.left-origx)*ratio+origx;var bottom=(this.bottom-origy)*ratio+origy;var right=(this.right-origx)*ratio+origx;var top=(this.top-origy)*ratio+origy;return new OpenLayers.Bounds(left,bottom,right,top);},add:function(x,y){if((x==null)||(y==null)){var msg=OpenLayers.i18n("boundsAddError");OpenLayers.Console.error(msg);return null;}  
return new OpenLayers.Bounds(this.left+x,this.bottom+y,this.right+x,this.top+y);},extend:function(object){var bounds=null;if(object){switch(object.CLASS_NAME){case"OpenLayers.LonLat":bounds=new OpenLayers.Bounds(object.lon,object.lat,object.lon,object.lat);break;case"OpenLayers.Geometry.Point":bounds=new OpenLayers.Bounds(object.x,object.y,object.x,object.y);break;case"OpenLayers.Bounds":bounds=object;break;}  
if(bounds){this.centerLonLat=null;if((this.left==null)||(bounds.left<this.left)){this.left=bounds.left;}  
if((this.bottom==null)||(bounds.bottom<this.bottom)){this.bottom=bounds.bottom;}  
if((this.right==null)||(bounds.right>this.right)){this.right=bounds.right;}  
if((this.top==null)||(bounds.top>this.top)){this.top=bounds.top;}}}},containsLonLat:function(ll,inclusive){return this.contains(ll.lon,ll.lat,inclusive);},containsPixel:function(px,inclusive){return this.contains(px.x,px.y,inclusive);},contains:function(x,y,inclusive){if(inclusive==null){inclusive=true;}  
if(x==null||y==null){return false;}  
x=OpenLayers.Util.toFloat(x);y=OpenLayers.Util.toFloat(y);var contains=false;if(inclusive){contains=((x>=this.left)&&(x<=this.right)&&(y>=this.bottom)&&(y<=this.top));}else{contains=((x>this.left)&&(x<this.right)&&(y>this.bottom)&&(y<this.top));}  
return contains;},intersectsBounds:function(bounds,inclusive){if(inclusive==null){inclusive=true;}  
var intersects=false;var mightTouch=(this.left==bounds.right||this.right==bounds.left||this.top==bounds.bottom||this.bottom==bounds.top);if(inclusive||!mightTouch){var inBottom=(((bounds.bottom>=this.bottom)&&(bounds.bottom<=this.top))||((this.bottom>=bounds.bottom)&&(this.bottom<=bounds.top)));var inTop=(((bounds.top>=this.bottom)&&(bounds.top<=this.top))||((this.top>bounds.bottom)&&(this.top<bounds.top)));var inLeft=(((bounds.left>=this.left)&&(bounds.left<=this.right))||((this.left>=bounds.left)&&(this.left<=bounds.right)));var inRight=(((bounds.right>=this.left)&&(bounds.right<=this.right))||((this.right>=bounds.left)&&(this.right<=bounds.right)));intersects=((inBottom||inTop)&&(inLeft||inRight));}  
return intersects;},containsBounds:function(bounds,partial,inclusive){if(partial==null){partial=false;}  
if(inclusive==null){inclusive=true;}  
var bottomLeft=this.contains(bounds.left,bounds.bottom,inclusive);var bottomRight=this.contains(bounds.right,bounds.bottom,inclusive);var topLeft=this.contains(bounds.left,bounds.top,inclusive);var topRight=this.contains(bounds.right,bounds.top,inclusive);return(partial)?(bottomLeft||bottomRight||topLeft||topRight):(bottomLeft&&bottomRight&&topLeft&&topRight);},determineQuadrant:function(lonlat){var quadrant="";var center=this.getCenterLonLat();quadrant+=(lonlat.lat<center.lat)?"b":"t";quadrant+=(lonlat.lon<center.lon)?"l":"r";return quadrant;},transform:function(source,dest){this.centerLonLat=null;var ll=OpenLayers.Projection.transform({'x':this.left,'y':this.bottom},source,dest);var lr=OpenLayers.Projection.transform({'x':this.right,'y':this.bottom},source,dest);var ul=OpenLayers.Projection.transform({'x':this.left,'y':this.top},source,dest);var ur=OpenLayers.Projection.transform({'x':this.right,'y':this.top},source,dest);this.left=Math.min(ll.x,ul.x);this.bottom=Math.min(ll.y,lr.y);this.right=Math.max(lr.x,ur.x);this.top=Math.max(ul.y,ur.y);return this;},wrapDateLine:function(maxExtent,options){options=options||{};var leftTolerance=options.leftTolerance||0;var rightTolerance=options.rightTolerance||0;var newBounds=this.clone();if(maxExtent){while(newBounds.left<maxExtent.left&&(newBounds.right-rightTolerance)<=maxExtent.left){newBounds=newBounds.add(maxExtent.getWidth(),0);}  
while((newBounds.left+leftTolerance)>=maxExtent.right&&newBounds.right>maxExtent.right){newBounds=newBounds.add(-maxExtent.getWidth(),0);}}  
return newBounds;},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(str){var bounds=str.split(",");return OpenLayers.Bounds.fromArray(bounds);};OpenLayers.Bounds.fromArray=function(bbox){return new OpenLayers.Bounds(parseFloat(bbox[0]),parseFloat(bbox[1]),parseFloat(bbox[2]),parseFloat(bbox[3]));};OpenLayers.Bounds.fromSize=function(size){return new OpenLayers.Bounds(0,size.h,size.w,0);};OpenLayers.Bounds.oppositeQuadrant=function(quadrant){var opp="";opp+=(quadrant.charAt(0)=='t')?'b':'t';opp+=(quadrant.charAt(1)=='l')?'r':'l';return opp;};OpenLayers.LonLat=OpenLayers.Class({lon:0.0,lat:0.0,initialize:function(lon,lat){this.lon=OpenLayers.Util.toFloat(lon);this.lat=OpenLayers.Util.toFloat(lat);},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(lon,lat){if((lon==null)||(lat==null)){var msg=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(msg);return null;}  
return new OpenLayers.LonLat(this.lon+OpenLayers.Util.toFloat(lon),this.lat+OpenLayers.Util.toFloat(lat));},equals:function(ll){var equals=false;if(ll!=null){equals=((this.lon==ll.lon&&this.lat==ll.lat)||(isNaN(this.lon)&&isNaN(this.lat)&&isNaN(ll.lon)&&isNaN(ll.lat)));}  
return equals;},transform:function(source,dest){var point=OpenLayers.Projection.transform({'x':this.lon,'y':this.lat},source,dest);this.lon=point.x;this.lat=point.y;return this;},wrapDateLine:function(maxExtent){var newLonLat=this.clone();if(maxExtent){while(newLonLat.lon<maxExtent.left){newLonLat.lon+=maxExtent.getWidth();}  
while(newLonLat.lon>maxExtent.right){newLonLat.lon-=maxExtent.getWidth();}}  
return newLonLat;},CLASS_NAME:"OpenLayers.LonLat"});OpenLayers.LonLat.fromString=function(str){var pair=str.split(",");return new OpenLayers.LonLat(pair[0],pair[1]);};OpenLayers.Pixel=OpenLayers.Class({x:0.0,y:0.0,initialize:function(x,y){this.x=parseFloat(x);this.y=parseFloat(y);},toString:function(){return("x="+this.x+",y="+this.y);},clone:function(){return new OpenLayers.Pixel(this.x,this.y);},equals:function(px){var equals=false;if(px!=null){equals=((this.x==px.x&&this.y==px.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(px.x)&&isNaN(px.y)));}  
return equals;},add:function(x,y){if((x==null)||(y==null)){var msg=OpenLayers.i18n("pixelAddError");OpenLayers.Console.error(msg);return null;}  
return new OpenLayers.Pixel(this.x+x,this.y+y);},offset:function(px){var newPx=this.clone();if(px){newPx=this.add(px.x,px.y);}  
return newPx;},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(options){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,options);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 key in this.handlers){if(this.handlers.hasOwnProperty(key)&&typeof this.handlers[key].destroy=="function"){this.handlers[key].destroy();}}  
this.handlers=null;}  
if(this.map){this.map.removeControl(this);this.map=null;}},setMap:function(map){this.map=map;if(this.handler){this.handler.setMap(map);}},draw:function(px){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(px!=null){this.position=px.clone();}  
this.moveTo(this.position);return this.div;},moveTo:function(px){if((px!=null)&&(this.div!=null)){this.div.style.left=px.x+"px";this.div.style.top=px.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(code){var lang;if(!code){code=(OpenLayers.Util.getBrowserName()=="msie")?navigator.userLanguage:navigator.language;}  
var parts=code.split('-');parts[0]=parts[0].toLowerCase();if(typeof OpenLayers.Lang[parts[0]]=="object"){lang=parts[0];}  
if(parts[1]){var testLang=parts[0]+'-'+parts[1].toUpperCase();if(typeof OpenLayers.Lang[testLang]=="object"){lang=testLang;}}  
if(!lang){OpenLayers.Console.warn('Failed to find OpenLayers.Lang.'+parts.join("-")+' dictionary, falling back to default language');lang=OpenLayers.Lang.defaultCode;}  
OpenLayers.Lang.code=lang;},translate:function(key,context){var dictionary=OpenLayers.Lang[OpenLayers.Lang.getCode()];var message=dictionary[key];if(!message){message=key;}  
if(context){message=OpenLayers.String.format(message,context);}  
return message;}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:true,anchor:null,initialize:function(id,lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback){var newArguments=[id,lonlat,contentSize,contentHTML,closeBox,closeBoxCallback];OpenLayers.Popup.prototype.initialize.apply(this,newArguments);this.anchor=(anchor!=null)?anchor:{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(px){var oldRelativePosition=this.relativePosition;this.relativePosition=this.calculateRelativePosition(px);var newPx=this.calculateNewPx(px);var newArguments=new Array(newPx);OpenLayers.Popup.prototype.moveTo.apply(this,newArguments);if(this.relativePosition!=oldRelativePosition){this.updateRelativePosition();}},setSize:function(contentSize){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if((this.lonlat)&&(this.map)){var px=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(px);}},calculateRelativePosition:function(px){var lonlat=this.map.getLonLatFromLayerPx(px);var extent=this.map.getExtent();var quadrant=extent.determineQuadrant(lonlat);return OpenLayers.Bounds.oppositeQuadrant(quadrant);},updateRelativePosition:function(){},calculateNewPx:function(px){var newPx=px.offset(this.anchor.offset);var size=this.size||this.contentSize;var top=(this.relativePosition.charAt(0)=='t');newPx.y+=(top)?-(size.h+this.anchor.size.h):this.anchor.size.h;var left=(this.relativePosition.charAt(1)=='l');newPx.x+=(left)?-(size.w+this.anchor.size.w):this.anchor.size.w;return newPx;},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.Protocol.SOS=function(options){options=OpenLayers.Util.applyDefaults(options,OpenLayers.Protocol.SOS.DEFAULTS);var cls=OpenLayers.Protocol.SOS["v"+options.version.replace(/\./g,"_")];if(!cls){throw"Unsupported SOS version: "+options.version;}  
return new cls(options);};OpenLayers.Protocol.SOS.DEFAULTS={"version":"1.0.0"};OpenLayers.Protocol.SQL=OpenLayers.Class(OpenLayers.Protocol,{databaseName:'ol',tableName:"ol_vector_features",postReadFiltering:true,initialize:function(options){OpenLayers.Protocol.prototype.initialize.apply(this,[options]);},destroy:function(){OpenLayers.Protocol.prototype.destroy.apply(this);},supported:function(){return false;},evaluateFilter:function(feature,filter){return filter&&this.postReadFiltering?filter.evaluate(feature):true;},CLASS_NAME:"OpenLayers.Protocol.SQL"});OpenLayers.Protocol.WFS=function(options){options=OpenLayers.Util.applyDefaults(options,OpenLayers.Protocol.WFS.DEFAULTS);var cls=OpenLayers.Protocol.WFS["v"+options.version.replace(/\./g,"_")];if(!cls){throw"Unsupported WFS version: "+options.version;}  
return new cls(options);};OpenLayers.Protocol.WFS.fromWMSLayer=function(layer,options){var typeName,featurePrefix;var param=layer.params["LAYERS"];var parts=(param instanceof Array?param[0]:param).split(":");if(parts.length>1){featurePrefix=parts[0];}  
typeName=parts.pop();var protocolOptions={url:layer.url,featureType:typeName,featurePrefix:featurePrefix,srsName:layer.projection&&layer.projection.getCode()||layer.map&&layer.map.getProjectionObject().getCode(),version:"1.1.0"};return new OpenLayers.Protocol.WFS(OpenLayers.Util.applyDefaults(options,protocolOptions));};OpenLayers.Protocol.WFS.DEFAULTS={"version":"1.0.0"};OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{canvas:null,features:null,initialize:function(containerID){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this.features={};},eraseGeometry:function(geometry,featureId){this.eraseFeatures(this.features[featureId][0]);},supported:function(){var canvas=document.createElement("canvas");return!!canvas.getContext;},setExtent:function(extent){this.extent=extent.clone();this.resolution=null;this.redraw();},setSize:function(size){this.size=size.clone();this.root.style.width=size.w+"px";this.root.style.height=size.h+"px";this.root.width=size.w;this.root.height=size.h;this.resolution=null;},drawFeature:function(feature,style){style=style||feature.style;style=this.applyDefaultSymbolizer(style);this.features[feature.id]=[feature,style];this.redraw();},drawGeometry:function(geometry,style){var className=geometry.CLASS_NAME;if((className=="OpenLayers.Geometry.Collection")||(className=="OpenLayers.Geometry.MultiPoint")||(className=="OpenLayers.Geometry.MultiLineString")||(className=="OpenLayers.Geometry.MultiPolygon")){for(var i=0;i<geometry.components.length;i++){this.drawGeometry(geometry.components[i],style);}  
return;}  
switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":this.drawPoint(geometry,style);break;case"OpenLayers.Geometry.LineString":this.drawLineString(geometry,style);break;case"OpenLayers.Geometry.LinearRing":this.drawLinearRing(geometry,style);break;case"OpenLayers.Geometry.Polygon":this.drawPolygon(geometry,style);break;default:break;}},drawExternalGraphic:function(pt,style){var img=new Image();if(style.graphicTitle){img.title=style.graphicTitle;}  
var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var xOffset=(style.graphicXOffset!=undefined)?style.graphicXOffset:-(0.5*width);var yOffset=(style.graphicYOffset!=undefined)?style.graphicYOffset:-(0.5*height);var context={img:img,x:(pt[0]+xOffset),y:(pt[1]+yOffset),width:width,height:height,opacity:style.graphicOpacity||style.fillOpacity,canvas:this.canvas};img.onload=OpenLayers.Function.bind(function(){this.canvas.globalAlpha=this.opacity;this.canvas.drawImage(this.img,this.x,this.y,this.width,this.height);},context);img.src=style.externalGraphic;},setCanvasStyle:function(type,style){if(type=="fill"){this.canvas.globalAlpha=style['fillOpacity'];this.canvas.fillStyle=style['fillColor'];}else if(type=="stroke"){this.canvas.globalAlpha=style['strokeOpacity'];this.canvas.strokeStyle=style['strokeColor'];this.canvas.lineWidth=style['strokeWidth'];}else{this.canvas.globalAlpha=0;this.canvas.lineWidth=1;}},drawPoint:function(geometry,style){if(style.graphic!==false){var pt=this.getLocalXY(geometry);if(style.externalGraphic){this.drawExternalGraphic(pt,style);}else{if(style.fill!==false){this.setCanvasStyle("fill",style);this.canvas.beginPath();this.canvas.arc(pt[0],pt[1],style.pointRadius,0,Math.PI*2,true);this.canvas.fill();}  
if(style.stroke!==false){this.setCanvasStyle("stroke",style);this.canvas.beginPath();this.canvas.arc(pt[0],pt[1],style.pointRadius,0,Math.PI*2,true);this.canvas.stroke();this.setCanvasStyle("reset");}}}},drawLineString:function(geometry,style){if(style.stroke!==false){this.setCanvasStyle("stroke",style);this.canvas.beginPath();var start=this.getLocalXY(geometry.components[0]);this.canvas.moveTo(start[0],start[1]);for(var i=1;i<geometry.components.length;i++){var pt=this.getLocalXY(geometry.components[i]);this.canvas.lineTo(pt[0],pt[1]);}  
this.canvas.stroke();}  
this.setCanvasStyle("reset");},drawLinearRing:function(geometry,style){if(style.fill!==false){this.setCanvasStyle("fill",style);this.canvas.beginPath();var start=this.getLocalXY(geometry.components[0]);this.canvas.moveTo(start[0],start[1]);for(var i=1;i<geometry.components.length-1;i++){var pt=this.getLocalXY(geometry.components[i]);this.canvas.lineTo(pt[0],pt[1]);}  
this.canvas.fill();}  
if(style.stroke!==false){this.setCanvasStyle("stroke",style);this.canvas.beginPath();var start=this.getLocalXY(geometry.components[0]);this.canvas.moveTo(start[0],start[1]);for(var i=1;i<geometry.components.length;i++){var pt=this.getLocalXY(geometry.components[i]);this.canvas.lineTo(pt[0],pt[1]);}  
this.canvas.stroke();}  
this.setCanvasStyle("reset");},drawPolygon:function(geometry,style){this.drawLinearRing(geometry.components[0],style);for(var i=1;i<geometry.components.length;i++){this.drawLinearRing(geometry.components[i],{fillOpacity:0,strokeWidth:0,strokeOpacity:0,strokeColor:'#000000',fillColor:'#000000'});}},drawText:function(location,style){style=OpenLayers.Util.extend({fontColor:"#000000",labelAlign:"cm"},style);var pt=this.getLocalXY(location);this.setCanvasStyle("reset");this.canvas.fillStyle=style.fontColor;this.canvas.globalAlpha=style.fontOpacity||1.0;var fontStyle=style.fontWeight+" "+style.fontSize+" "+style.fontFamily;if(this.canvas.fillText){var labelAlign=OpenLayers.Renderer.Canvas.LABEL_ALIGN[style.labelAlign[0]]||"center";this.canvas.font=fontStyle;this.canvas.textAlign=labelAlign;this.canvas.fillText(style.label,pt[0],pt[1]);}else if(this.canvas.mozDrawText){this.canvas.mozTextStyle=fontStyle;var len=this.canvas.mozMeasureText(style.label);switch(style.labelAlign[0]){case"l":break;case"r":pt[0]-=len;break;case"c":default:pt[0]-=len/2;}  
this.canvas.translate(pt[0],pt[1]);this.canvas.mozDrawText(style.label);this.canvas.translate(-1*pt[0],-1*pt[1]);}  
this.setCanvasStyle("reset");},getLocalXY:function(point){var resolution=this.getResolution();var extent=this.extent;var x=(point.x/resolution+(-extent.left/resolution));var y=((extent.top/resolution)-point.y/resolution);return[x,y];},clear:function(){this.canvas.clearRect(0,0,this.root.width,this.root.height);this.features={};},getFeatureIdFromEvent:function(evt){var loc=this.map.getLonLatFromPixel(evt.xy);var resolution=this.getResolution();var bounds=new OpenLayers.Bounds(loc.lon-resolution*5,loc.lat-resolution*5,loc.lon+resolution*5,loc.lat+resolution*5);var geom=bounds.toGeometry();for(var feat in this.features){if(!this.features.hasOwnProperty(feat)){continue;}  
if(this.features[feat][0].geometry.intersects(geom)){return feat;}}  
return null;},eraseFeatures:function(features){if(!(features instanceof Array)){features=[features];}  
for(var i=0;i<features.length;++i){delete this.features[features[i].id];}  
this.redraw();},redraw:function(){if(!this.locked){this.canvas.clearRect(0,0,this.root.width,this.root.height);var labelMap=[];var feature,style;for(var id in this.features){if(!this.features.hasOwnProperty(id)){continue;}  
feature=this.features[id][0];style=this.features[id][1];if(!feature.geometry){continue;}  
this.drawGeometry(feature.geometry,style);if(style.label){labelMap.push([feature,style]);}}  
var item;for(var i=0,len=labelMap.length;i<len;++i){item=labelMap[i];this.drawText(item[0].geometry.getCentroid(),item[1]);}}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});OpenLayers.Renderer.Canvas.LABEL_ALIGN={"l":"left","r":"right"};OpenLayers.ElementsIndexer=OpenLayers.Class({maxZIndex:null,order:null,indices:null,compare:null,initialize:function(yOrdering){this.compare=yOrdering?OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER:OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;this.order=[];this.indices={};this.maxZIndex=0;},insert:function(newNode){if(this.exists(newNode)){this.remove(newNode);}  
var nodeId=newNode.id;this.determineZIndex(newNode);var leftIndex=-1;var rightIndex=this.order.length;var middle;while(rightIndex-leftIndex>1){middle=parseInt((leftIndex+rightIndex)/2);var placement=this.compare(this,newNode,OpenLayers.Util.getElement(this.order[middle]));if(placement>0){leftIndex=middle;}else{rightIndex=middle;}}  
this.order.splice(rightIndex,0,nodeId);this.indices[nodeId]=this.getZIndex(newNode);return this.getNextElement(rightIndex);},remove:function(node){var nodeId=node.id;var arrayIndex=OpenLayers.Util.indexOf(this.order,nodeId);if(arrayIndex>=0){this.order.splice(arrayIndex,1);delete this.indices[nodeId];if(this.order.length>0){var lastId=this.order[this.order.length-1];this.maxZIndex=this.indices[lastId];}else{this.maxZIndex=0;}}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0;},exists:function(node){return(this.indices[node.id]!=null);},getZIndex:function(node){return node._style.graphicZIndex;},determineZIndex:function(node){var zIndex=node._style.graphicZIndex;if(zIndex==null){zIndex=this.maxZIndex;node._style.graphicZIndex=zIndex;}else if(zIndex>this.maxZIndex){this.maxZIndex=zIndex;}},getNextElement:function(index){var nextIndex=index+1;if(nextIndex<this.order.length){var nextElement=OpenLayers.Util.getElement(this.order[nextIndex]);if(nextElement==undefined){nextElement=this.getNextElement(nextIndex);}  
return nextElement;}else{return null;}},CLASS_NAME:"OpenLayers.ElementsIndexer"});OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(indexer,newNode,nextNode){var newZIndex=indexer.getZIndex(newNode);var returnVal=0;if(nextNode){var nextZIndex=indexer.getZIndex(nextNode);returnVal=newZIndex-nextZIndex;}  
return returnVal;},Z_ORDER_DRAWING_ORDER:function(indexer,newNode,nextNode){var returnVal=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(indexer,newNode,nextNode);if(nextNode&&returnVal==0){returnVal=1;}  
return returnVal;},Z_ORDER_Y_ORDER:function(indexer,newNode,nextNode){var returnVal=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(indexer,newNode,nextNode);if(nextNode&&returnVal===0){var result=nextNode._boundsBottom-newNode._boundsBottom;returnVal=(result===0)?1:result;}  
return returnVal;}};OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,vectorRoot:null,textRoot:null,xmlns:null,indexer:null,BACKGROUND_ID_SUFFIX:"_background",LABEL_ID_SUFFIX:"_label",initialize:function(containerID,options){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.rendererRoot=this.createRenderRoot();this.root=this.createRoot("_root");this.vectorRoot=this.createRoot("_vroot");this.textRoot=this.createRoot("_troot");this.root.appendChild(this.vectorRoot);this.root.appendChild(this.textRoot);this.rendererRoot.appendChild(this.root);this.container.appendChild(this.rendererRoot);if(options&&(options.zIndexing||options.yOrdering)){this.indexer=new OpenLayers.ElementsIndexer(options.yOrdering);}},destroy:function(){this.clear();this.rendererRoot=null;this.root=null;this.xmlns=null;OpenLayers.Renderer.prototype.destroy.apply(this,arguments);},clear:function(){var child;var root=this.vectorRoot;if(root){while(child=root.firstChild){root.removeChild(child);}}  
root=this.textRoot;if(root){while(child=root.firstChild){root.removeChild(child);}}  
if(this.indexer){this.indexer.clear();}},getNodeType:function(geometry,style){},drawGeometry:function(geometry,style,featureId){var className=geometry.CLASS_NAME;var rendered=true;if((className=="OpenLayers.Geometry.Collection")||(className=="OpenLayers.Geometry.MultiPoint")||(className=="OpenLayers.Geometry.MultiLineString")||(className=="OpenLayers.Geometry.MultiPolygon")){for(var i=0,len=geometry.components.length;i<len;i++){rendered=this.drawGeometry(geometry.components[i],style,featureId)&&rendered;}  
return rendered;};rendered=false;if(style.display!="none"){if(style.backgroundGraphic){this.redrawBackgroundNode(geometry.id,geometry,style,featureId);}  
rendered=this.redrawNode(geometry.id,geometry,style,featureId);}  
if(rendered==false){var node=document.getElementById(geometry.id);if(node){if(node._style.backgroundGraphic){node.parentNode.removeChild(document.getElementById(geometry.id+this.BACKGROUND_ID_SUFFIX));}  
node.parentNode.removeChild(node);}}  
return rendered;},redrawNode:function(id,geometry,style,featureId){style=this.applyDefaultSymbolizer(style);var node=this.nodeFactory(id,this.getNodeType(geometry,style));node._featureId=featureId;node._boundsBottom=geometry.getBounds().bottom;node._geometryClass=geometry.CLASS_NAME;node._style=style;var drawResult=this.drawGeometryNode(node,geometry,style);if(drawResult===false){return false;}  
node=drawResult.node;if(this.indexer){var insert=this.indexer.insert(node);if(insert){this.vectorRoot.insertBefore(node,insert);}else{this.vectorRoot.appendChild(node);}}else{if(node.parentNode!==this.vectorRoot){this.vectorRoot.appendChild(node);}}  
this.postDraw(node);return drawResult.complete;},redrawBackgroundNode:function(id,geometry,style,featureId){var backgroundStyle=OpenLayers.Util.extend({},style);backgroundStyle.externalGraphic=backgroundStyle.backgroundGraphic;backgroundStyle.graphicXOffset=backgroundStyle.backgroundXOffset;backgroundStyle.graphicYOffset=backgroundStyle.backgroundYOffset;backgroundStyle.graphicZIndex=backgroundStyle.backgroundGraphicZIndex;backgroundStyle.graphicWidth=backgroundStyle.backgroundWidth||backgroundStyle.graphicWidth;backgroundStyle.graphicHeight=backgroundStyle.backgroundHeight||backgroundStyle.graphicHeight;backgroundStyle.backgroundGraphic=null;backgroundStyle.backgroundXOffset=null;backgroundStyle.backgroundYOffset=null;backgroundStyle.backgroundGraphicZIndex=null;return this.redrawNode(id+this.BACKGROUND_ID_SUFFIX,geometry,backgroundStyle,null);},drawGeometryNode:function(node,geometry,style){style=style||node._style;var options={'isFilled':style.fill===undefined?true:style.fill,'isStroked':style.stroke===undefined?!!style.strokeWidth:style.stroke};var drawn;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.graphic===false){options.isFilled=false;options.isStroked=false;}  
drawn=this.drawPoint(node,geometry);break;case"OpenLayers.Geometry.LineString":options.isFilled=false;drawn=this.drawLineString(node,geometry);break;case"OpenLayers.Geometry.LinearRing":drawn=this.drawLinearRing(node,geometry);break;case"OpenLayers.Geometry.Polygon":drawn=this.drawPolygon(node,geometry);break;case"OpenLayers.Geometry.Surface":drawn=this.drawSurface(node,geometry);break;case"OpenLayers.Geometry.Rectangle":drawn=this.drawRectangle(node,geometry);break;default:break;}  
node._options=options;if(drawn!=false){return{node:this.setStyle(node,style,options,geometry),complete:drawn};}else{return false;}},postDraw:function(node){},drawPoint:function(node,geometry){},drawLineString:function(node,geometry){},drawLinearRing:function(node,geometry){},drawPolygon:function(node,geometry){},drawRectangle:function(node,geometry){},drawCircle:function(node,geometry){},drawSurface:function(node,geometry){},removeText:function(featureId){var label=document.getElementById(featureId+this.LABEL_ID_SUFFIX);if(label){this.textRoot.removeChild(label);}},getFeatureIdFromEvent:function(evt){var target=evt.target;var useElement=target&&target.correspondingUseElement;var node=useElement?useElement:(target||evt.srcElement);var featureId=node._featureId;return featureId;},eraseGeometry:function(geometry,featureId){if((geometry.CLASS_NAME=="OpenLayers.Geometry.MultiPoint")||(geometry.CLASS_NAME=="OpenLayers.Geometry.MultiLineString")||(geometry.CLASS_NAME=="OpenLayers.Geometry.MultiPolygon")||(geometry.CLASS_NAME=="OpenLayers.Geometry.Collection")){for(var i=0,len=geometry.components.length;i<len;i++){this.eraseGeometry(geometry.components[i],featureId);}}else{var element=OpenLayers.Util.getElement(geometry.id);if(element&&element.parentNode){if(element.geometry){element.geometry.destroy();element.geometry=null;}  
element.parentNode.removeChild(element);if(this.indexer){this.indexer.remove(element);}  
if(element._style.backgroundGraphic){var backgroundId=geometry.id+this.BACKGROUND_ID_SUFFIX;var bElem=OpenLayers.Util.getElement(backgroundId);if(bElem&&bElem.parentNode){bElem.parentNode.removeChild(bElem);}}}}},nodeFactory:function(id,type){var node=OpenLayers.Util.getElement(id);if(node){if(!this.nodeTypeCompare(node,type)){node.parentNode.removeChild(node);node=this.nodeFactory(id,type);}}else{node=this.createNode(type,id);}  
return node;},nodeTypeCompare:function(node,type){},createNode:function(type,id){},moveRoot:function(renderer){var root=this.root;if(renderer.root.parentNode==this.rendererRoot){root=renderer.root;}  
root.parentNode.removeChild(root);renderer.rendererRoot.appendChild(root);},getRenderLayerId:function(){return this.root.parentNode.parentNode.id;},isComplexSymbol:function(graphicName){return(graphicName!="circle")&&!!graphicName;},CLASS_NAME:"OpenLayers.Renderer.Elements"});OpenLayers.Renderer.symbol={"star":[350,75,379,161,469,161,397,215,423,301,350,250,277,301,303,215,231,161,321,161,350,75],"cross":[4,0,6,0,6,4,10,4,10,6,6,6,6,10,4,10,4,6,0,6,0,4,4,4,4,0],"x":[0,0,25,0,50,35,75,0,100,0,65,50,100,100,75,100,50,65,25,100,0,100,35,50,0,0],"square":[0,0,0,1,1,1,1,0,0,0],"triangle":[0,10,10,10,5,0,0,10]};OpenLayers.Strategy.Cluster=OpenLayers.Class(OpenLayers.Strategy,{distance:20,threshold:null,features:null,clusters:null,clustering:false,resolution:null,initialize:function(options){OpenLayers.Strategy.prototype.initialize.apply(this,[options]);},activate:function(){var activated=OpenLayers.Strategy.prototype.activate.call(this);if(activated){this.layer.events.on({"beforefeaturesadded":this.cacheFeatures,"moveend":this.cluster,scope:this});}  
return activated;},deactivate:function(){var deactivated=OpenLayers.Strategy.prototype.deactivate.call(this);if(deactivated){this.clearCache();this.layer.events.un({"beforefeaturesadded":this.cacheFeatures,"moveend":this.cluster,scope:this});}  
return deactivated;},cacheFeatures:function(event){var propagate=true;if(!this.clustering){this.clearCache();this.features=event.features;this.cluster();propagate=false;}  
return propagate;},clearCache:function(){this.features=null;},cluster:function(event){if((!event||event.zoomChanged)&&this.features){var resolution=this.layer.map.getResolution();if(resolution!=this.resolution||!this.clustersExist()){this.resolution=resolution;var clusters=[];var feature,clustered,cluster;for(var i=0;i<this.features.length;++i){feature=this.features[i];if(feature.geometry){clustered=false;for(var j=clusters.length-1;j>=0;--j){cluster=clusters[j];if(this.shouldCluster(cluster,feature)){this.addToCluster(cluster,feature);clustered=true;break;}}  
if(!clustered){clusters.push(this.createCluster(this.features[i]));}}}  
this.layer.removeAllFeatures();if(clusters.length>0){if(this.threshold>1){var clone=clusters.slice();clusters=[];var candidate;for(var i=0,len=clone.length;i<len;++i){candidate=clone[i];if(candidate.attributes.count<this.threshold){Array.prototype.push.apply(clusters,candidate.cluster);}else{clusters.push(candidate);}}}  
this.clustering=true;this.layer.addFeatures(clusters);this.clustering=false;}  
this.clusters=clusters;}}},clustersExist:function(){var exist=false;if(this.clusters&&this.clusters.length>0&&this.clusters.length==this.layer.features.length){exist=true;for(var i=0;i<this.clusters.length;++i){if(this.clusters[i]!=this.layer.features[i]){exist=false;break;}}}  
return exist;},shouldCluster:function(cluster,feature){var cc=cluster.geometry.getBounds().getCenterLonLat();var fc=feature.geometry.getBounds().getCenterLonLat();var distance=(Math.sqrt(Math.pow((cc.lon-fc.lon),2)+Math.pow((cc.lat-fc.lat),2))/this.resolution);return(distance<=this.distance);},addToCluster:function(cluster,feature){cluster.cluster.push(feature);cluster.attributes.count+=1;},createCluster:function(feature){var center=feature.geometry.getBounds().getCenterLonLat();var cluster=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(center.lon,center.lat),{count:1});cluster.cluster=[feature];return cluster;},CLASS_NAME:"OpenLayers.Strategy.Cluster"});OpenLayers.Strategy.Fixed=OpenLayers.Class(OpenLayers.Strategy,{preload:false,initialize:function(options){OpenLayers.Strategy.prototype.initialize.apply(this,[options]);},destroy:function(){OpenLayers.Strategy.prototype.destroy.apply(this,arguments);},activate:function(){if(OpenLayers.Strategy.prototype.activate.apply(this,arguments)){this.layer.events.on({"refresh":this.load,scope:this});if(this.layer.visibility==true||this.preload){this.load();}else{this.layer.events.on({"visibilitychanged":this.load,scope:this});}  
return true;}  
return false;},deactivate:function(){var deactivated=OpenLayers.Strategy.prototype.deactivate.call(this);if(deactivated){this.layer.events.un({"refresh":this.load,"visibilitychanged":this.load,scope:this});}  
return deactivated;},load:function(options){this.layer.events.triggerEvent("loadstart");this.layer.protocol.read(OpenLayers.Util.applyDefaults({callback:this.merge,filter:this.layer.filter,scope:this},options));this.layer.events.un({"visibilitychanged":this.load,scope:this});},merge:function(resp){this.layer.destroyFeatures();var features=resp.features;if(features&&features.length>0){var remote=this.layer.projection;var local=this.layer.map.getProjectionObject();if(!local.equals(remote)){var geom;for(var i=0,len=features.length;i<len;++i){geom=features[i].geometry;if(geom){geom.transform(remote,local);}}}  
this.layer.addFeatures(features);}  
this.layer.events.triggerEvent("loadend");},CLASS_NAME:"OpenLayers.Strategy.Fixed"});OpenLayers.Strategy.Paging=OpenLayers.Class(OpenLayers.Strategy,{features:null,length:10,num:null,paging:false,initialize:function(options){OpenLayers.Strategy.prototype.initialize.apply(this,[options]);},activate:function(){var activated=OpenLayers.Strategy.prototype.activate.call(this);if(activated){this.layer.events.on({"beforefeaturesadded":this.cacheFeatures,scope:this});}  
return activated;},deactivate:function(){var deactivated=OpenLayers.Strategy.prototype.deactivate.call(this);if(deactivated){this.clearCache();this.layer.events.un({"beforefeaturesadded":this.cacheFeatures,scope:this});}  
return deactivated;},cacheFeatures:function(event){if(!this.paging){this.clearCache();this.features=event.features;this.pageNext(event);}},clearCache:function(){if(this.features){for(var i=0;i<this.features.length;++i){this.features[i].destroy();}}  
this.features=null;this.num=null;},pageCount:function(){var numFeatures=this.features?this.features.length:0;return Math.ceil(numFeatures/this.length);},pageNum:function(){return this.num;},pageLength:function(newLength){if(newLength&&newLength>0){this.length=newLength;}  
return this.length;},pageNext:function(event){var changed=false;if(this.features){if(this.num===null){this.num=-1;}  
var start=(this.num+1)*this.length;changed=this.page(start,event);}  
return changed;},pagePrevious:function(){var changed=false;if(this.features){if(this.num===null){this.num=this.pageCount();}  
var start=(this.num-1)*this.length;changed=this.page(start);}  
return changed;},page:function(start,event){var changed=false;if(this.features){if(start>=0&&start<this.features.length){var num=Math.floor(start/this.length);if(num!=this.num){this.paging=true;var features=this.features.slice(start,start+this.length);this.layer.removeFeatures(this.layer.features);this.num=num;if(event&&event.features){event.features=features;}else{this.layer.addFeatures(features);}  
this.paging=false;changed=true;}}}  
return changed;},CLASS_NAME:"OpenLayers.Strategy.Paging"});OpenLayers.Strategy.Refresh=OpenLayers.Class(OpenLayers.Strategy,{force:false,interval:0,timer:null,initialize:function(options){OpenLayers.Strategy.prototype.initialize.apply(this,[options]);},activate:function(){var activated=OpenLayers.Strategy.prototype.activate.call(this);if(activated){if(this.layer.visibility===true){this.start();}  
this.layer.events.on({"visibilitychanged":this.reset,scope:this});}  
return activated;},deactivate:function(){var deactivated=OpenLayers.Strategy.prototype.deactivate.call(this);if(deactivated){this.stop();}  
return deactivated;},reset:function(){if(this.layer.visibility===true){this.start();}else{this.stop();}},start:function(){if(this.interval&&typeof this.interval==="number"&&this.interval>0){this.timer=window.setInterval(OpenLayers.Function.bind(this.refresh,this),this.interval);}},refresh:function(){if(this.layer&&this.layer.refresh&&typeof this.layer.refresh=="function"){this.layer.refresh({force:this.force});}},stop:function(){if(this.timer!==null){window.clearInterval(this.timer);this.timer=null;}},CLASS_NAME:"OpenLayers.Strategy.Refresh"});OpenLayers.Strategy.Save=OpenLayers.Class(OpenLayers.Strategy,{EVENT_TYPES:["start","success","fail"],events:null,auto:false,timer:null,initialize:function(options){OpenLayers.Strategy.prototype.initialize.apply(this,[options]);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);},activate:function(){var activated=OpenLayers.Strategy.prototype.activate.call(this);if(activated){if(this.auto){if(typeof this.auto==="number"){this.timer=window.setInterval(OpenLayers.Function.bind(this.save,this),this.auto*1000);}else{this.layer.events.on({"featureadded":this.triggerSave,"afterfeaturemodified":this.triggerSave,scope:this});}}}  
return activated;},deactivate:function(){var deactivated=OpenLayers.Strategy.prototype.deactivate.call(this);if(deactivated){if(this.auto){if(typeof this.auto==="number"){window.clearInterval(this.timer);}else{this.layer.events.un({"featureadded":this.triggerSave,"afterfeaturemodified":this.triggerSave,scope:this});}}}  
return deactivated;},triggerSave:function(event){var feature=event.feature;if(feature.state===OpenLayers.State.INSERT||feature.state===OpenLayers.State.UPDATE||feature.state===OpenLayers.State.DELETE){this.save([event.feature]);}},save:function(features){if(!features){features=this.layer.features;}  
this.events.triggerEvent("start",{features:features});var remote=this.layer.projection;var local=this.layer.map.getProjectionObject();if(!local.equals(remote)){var len=features.length;var clones=new Array(len);var orig,clone;for(var i=0;i<len;++i){orig=features[i];clone=orig.clone();clone.fid=orig.fid;clone.state=orig.state;if(orig.url){clone.url=orig.url;}  
clone._original=orig;clone.geometry.transform(local,remote);clones[i]=clone;}  
features=clones;}  
this.layer.protocol.commit(features,{callback:this.onCommit,scope:this});},onCommit:function(response){var evt={"response":response};if(response.success()){var features=response.reqFeatures;var state,feature;var destroys=[];var insertIds=response.insertIds||[];var j=0;for(var i=0,len=features.length;i<len;++i){feature=features[i];feature=feature._original||feature;state=feature.state;if(state){if(state==OpenLayers.State.DELETE){destroys.push(feature);}else if(state==OpenLayers.State.INSERT){feature.fid=insertIds[j];++j;}  
feature.state=null;}}  
if(destroys.length>0){this.layer.destroyFeatures(destroys);}  
this.events.triggerEvent("success",evt);}else{this.events.triggerEvent("fail",evt);}},CLASS_NAME:"OpenLayers.Strategy.Save"});OpenLayers.Symbolizer.Line=OpenLayers.Class(OpenLayers.Symbolizer,{strokeColor:null,strokeOpacity:null,strokeWidth:null,strokeLinecap:null,strokeDashstyle:null,initialize:function(config){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments);},CLASS_NAME:"OpenLayers.Symbolizer.Line"});OpenLayers.Symbolizer.Point=OpenLayers.Class(OpenLayers.Symbolizer,{strokeColor:null,strokeOpacity:null,strokeWidth:null,strokeLinecap:null,strokeDashstyle:null,fillColor:null,fillOpacity:null,pointRadius:null,externalGraphic:null,graphicWidth:null,graphicHeight:null,graphicOpacity:null,graphicXOffset:null,graphicYOffset:null,rotation:null,graphicName:null,initialize:function(config){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments);},CLASS_NAME:"OpenLayers.Symbolizer.Point"});OpenLayers.Symbolizer.Polygon=OpenLayers.Class(OpenLayers.Symbolizer,{strokeColor:null,strokeOpacity:null,strokeWidth:null,strokeLinecap:null,strokeDashstyle:null,fillColor:null,fillOpacity:null,initialize:function(config){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments);},CLASS_NAME:"OpenLayers.Symbolizer.Polygon"});OpenLayers.Symbolizer.Raster=OpenLayers.Class(OpenLayers.Symbolizer,{initialize:function(config){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments);},CLASS_NAME:"OpenLayers.Symbolizer.Raster"});OpenLayers.Symbolizer.Text=OpenLayers.Class(OpenLayers.Symbolizer,{label:null,fontFamily:null,fontSize:null,fontWeight:null,fontStyle:null,initialize:function(config){OpenLayers.Symbolizer.prototype.initialize.apply(this,arguments);},CLASS_NAME:"OpenLayers.Symbolizer.Text"});OpenLayers.Tween=OpenLayers.Class({INTERVAL:10,easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,interval:null,playing:false,initialize:function(easing){this.easing=(easing)?easing:OpenLayers.Easing.Expo.easeOut;},start:function(begin,finish,duration,options){this.playing=true;this.begin=begin;this.finish=finish;this.duration=duration;this.callbacks=options.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 value={};for(var i in this.begin){var b=this.begin[i];var f=this.finish[i];if(b==null||f==null||isNaN(b)||isNaN(f)){OpenLayers.Console.error('invalid value for Tween');}  
var c=f-b;value[i]=this.easing.apply(this,[this.time,b,c,this.duration]);}  
this.time++;if(this.callbacks&&this.callbacks.eachStep){this.callbacks.eachStep.call(this,value);}  
if(this.time>this.duration){this.stop();}},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};OpenLayers.Easing.Linear={easeIn:function(t,b,c,d){return c*t/d+b;},easeOut:function(t,b,c,d){return c*t/d+b;},easeInOut:function(t,b,c,d){return c*t/d+b;},CLASS_NAME:"OpenLayers.Easing.Linear"};OpenLayers.Easing.Expo={easeIn:function(t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOut:function(t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOut:function(t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;},CLASS_NAME:"OpenLayers.Easing.Expo"};OpenLayers.Easing.Quad={easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOut:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Control.ArgParser=OpenLayers.Class(OpenLayers.Control,{center:null,zoom:null,layers:null,displayProjection:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var i=0,len=this.map.controls.length;i<len;i++){var control=this.map.controls[i];if((control!=this)&&(control.CLASS_NAME=="OpenLayers.Control.ArgParser")){if(control.displayProjection!=this.displayProjection){this.displayProjection=control.displayProjection;}  
break;}}  
if(i==this.map.controls.length){var args=OpenLayers.Util.getParameters();if(args.layers){this.layers=args.layers;this.map.events.register('addlayer',this,this.configureLayers);this.configureLayers();}  
if(args.lat&&args.lon){this.center=new OpenLayers.LonLat(parseFloat(args.lon),parseFloat(args.lat));if(args.zoom){this.zoom=parseInt(args.zoom);}  
this.map.events.register('changebaselayer',this,this.setCenter);this.setCenter();}}},setCenter:function(){if(this.map.baseLayer){this.map.events.unregister('changebaselayer',this,this.setCenter);if(this.displayProjection){this.center.transform(this.displayProjection,this.map.getProjectionObject());}  
this.map.setCenter(this.center,this.zoom);}},configureLayers:function(){if(this.layers.length==this.map.layers.length){this.map.events.unregister('addlayer',this,this.configureLayers);for(var i=0,len=this.layers.length;i<len;i++){var layer=this.map.layers[i];var c=this.layers.charAt(i);if(c=="B"){this.map.setBaseLayer(layer);}else if((c=="T")||(c=="F")){layer.setVisibility(c=="T");}}}},CLASS_NAME:"OpenLayers.Control.ArgParser"});OpenLayers.Control.Attribution=OpenLayers.Class(OpenLayers.Control,{separator:", ",initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);},destroy:function(){this.map.events.un({"removelayer":this.updateAttribution,"addlayer":this.updateAttribution,"changelayer":this.updateAttribution,"changebaselayer":this.updateAttribution,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.map.events.on({'changebaselayer':this.updateAttribution,'changelayer':this.updateAttribution,'addlayer':this.updateAttribution,'removelayer':this.updateAttribution,scope:this});this.updateAttribution();return this.div;},updateAttribution:function(){var attributions=[];if(this.map&&this.map.layers){for(var i=0,len=this.map.layers.length;i<len;i++){var layer=this.map.layers[i];if(layer.attribution&&layer.getVisibility()){if(OpenLayers.Util.indexOf(attributions,layer.attribution)===-1){attributions.push(layer.attribution);}}}  
this.div.innerHTML=attributions.join(this.separator);}},CLASS_NAME:"OpenLayers.Control.Attribution"});OpenLayers.Control.Button=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){},CLASS_NAME:"OpenLayers.Control.Button"});OpenLayers.Control.Graticule=OpenLayers.Class(OpenLayers.Control,{autoActivate:true,intervals:[45,30,20,10,5,2,1,0.5,0.2,0.1,0.05,0.01,0.005,0.002,0.001],displayInLayerSwitcher:true,visible:true,numPoints:50,targetSize:200,layerName:null,labelled:true,labelFormat:'dm',lineSymbolizer:{strokeColor:"#333",strokeWidth:1,strokeOpacity:0.5},labelSymbolizer:{},gratLayer:null,initialize:function(options){options=options||{};options.layerName=options.layerName||OpenLayers.i18n("graticule");OpenLayers.Control.prototype.initialize.apply(this,[options]);this.labelSymbolizer.stroke=false;this.labelSymbolizer.fill=false;this.labelSymbolizer.label="${label}";this.labelSymbolizer.labelAlign="${labelAlign}";this.labelSymbolizer.labelXOffset="${xOffset}";this.labelSymbolizer.labelYOffset="${yOffset}";},destroy:function(){this.deactivate();OpenLayers.Control.prototype.destroy.apply(this,arguments);if(this.gratLayer){this.gratLayer.destroy();this.gratLayer=null;}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.gratLayer){var gratStyle=new OpenLayers.Style({},{rules:[new OpenLayers.Rule({'symbolizer':{"Point":this.labelSymbolizer,"Line":this.lineSymbolizer}})]});this.gratLayer=new OpenLayers.Layer.Vector(this.layerName,{styleMap:new OpenLayers.StyleMap({'default':gratStyle}),visibility:this.visible,displayInLayerSwitcher:this.displayInLayerSwitcher});}  
return this.div;},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){this.map.addLayer(this.gratLayer);this.map.events.register('moveend',this,this.update);this.update();return true;}else{return false;}},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.map.events.unregister('moveend',this,this.update);this.map.removeLayer(this.gratLayer);return true;}else{return false;}},update:function(){var mapBounds=this.map.getExtent();if(!mapBounds){return;}  
this.gratLayer.destroyFeatures();var llProj=new OpenLayers.Projection("EPSG:4326");var mapProj=this.map.getProjectionObject();var mapRes=this.map.getResolution();if(mapProj.proj&&mapProj.proj.projName=="longlat"){this.numPoints=1;}  
var mapCenter=this.map.getCenter();var mapCenterLL=new OpenLayers.Pixel(mapCenter.lon,mapCenter.lat);OpenLayers.Projection.transform(mapCenterLL,mapProj,llProj);var testSq=this.targetSize*mapRes;testSq*=testSq;var llInterval;for(var i=0;i<this.intervals.length;++i){llInterval=this.intervals[i];var delta=llInterval/2;var p1=mapCenterLL.offset(new OpenLayers.Pixel(-delta,-delta));var p2=mapCenterLL.offset(new OpenLayers.Pixel(delta,delta));OpenLayers.Projection.transform(p1,llProj,mapProj);OpenLayers.Projection.transform(p2,llProj,mapProj);var distSq=(p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y);if(distSq<=testSq){break;}}  
mapCenterLL.x=Math.floor(mapCenterLL.x/llInterval)*llInterval;mapCenterLL.y=Math.floor(mapCenterLL.y/llInterval)*llInterval;var iter=0;var centerLonPoints=[mapCenterLL.clone()];var newPoint=mapCenterLL.clone();var mapXY;do{newPoint=newPoint.offset(new OpenLayers.Pixel(0,llInterval));mapXY=OpenLayers.Projection.transform(newPoint.clone(),llProj,mapProj);centerLonPoints.unshift(newPoint);}while(mapBounds.containsPixel(mapXY)&&++iter<1000);newPoint=mapCenterLL.clone();do{newPoint=newPoint.offset(new OpenLayers.Pixel(0,-llInterval));mapXY=OpenLayers.Projection.transform(newPoint.clone(),llProj,mapProj);centerLonPoints.push(newPoint);}while(mapBounds.containsPixel(mapXY)&&++iter<1000);iter=0;var centerLatPoints=[mapCenterLL.clone()];newPoint=mapCenterLL.clone();do{newPoint=newPoint.offset(new OpenLayers.Pixel(-llInterval,0));mapXY=OpenLayers.Projection.transform(newPoint.clone(),llProj,mapProj);centerLatPoints.unshift(newPoint);}while(mapBounds.containsPixel(mapXY)&&++iter<1000);newPoint=mapCenterLL.clone();do{newPoint=newPoint.offset(new OpenLayers.Pixel(llInterval,0));mapXY=OpenLayers.Projection.transform(newPoint.clone(),llProj,mapProj);centerLatPoints.push(newPoint);}while(mapBounds.containsPixel(mapXY)&&++iter<1000);var lines=[];for(var i=0;i<centerLatPoints.length;++i){var lon=centerLatPoints[i].x;var pointList=[];var labelPoint=null;var latEnd=Math.min(centerLonPoints[0].y,90);var latStart=Math.max(centerLonPoints[centerLonPoints.length-1].y,-90);var latDelta=(latEnd-latStart)/this.numPoints;var lat=latStart;for(var j=0;j<=this.numPoints;++j){var gridPoint=new OpenLayers.Geometry.Point(lon,lat);gridPoint.transform(llProj,mapProj);pointList.push(gridPoint);lat+=latDelta;if(gridPoint.y>=mapBounds.bottom&&!labelPoint){labelPoint=gridPoint;}}  
if(this.labelled){var labelPos=new OpenLayers.Geometry.Point(labelPoint.x,mapBounds.bottom);var labelAttrs={value:lon,label:this.labelled?OpenLayers.Util.getFormattedLonLat(lon,"lon",this.labelFormat):"",labelAlign:"cb",xOffset:0,yOffset:2};this.gratLayer.addFeatures(new OpenLayers.Feature.Vector(labelPos,labelAttrs));}  
var geom=new OpenLayers.Geometry.LineString(pointList);lines.push(new OpenLayers.Feature.Vector(geom));}  
for(var j=0;j<centerLonPoints.length;++j){lat=centerLonPoints[j].y;if(lat<-90||lat>90){continue;}  
var pointList=[];var lonStart=centerLatPoints[0].x;var lonEnd=centerLatPoints[centerLatPoints.length-1].x;var lonDelta=(lonEnd-lonStart)/this.numPoints;var lon=lonStart;var labelPoint=null;for(var i=0;i<=this.numPoints;++i){var gridPoint=new OpenLayers.Geometry.Point(lon,lat);gridPoint.transform(llProj,mapProj);pointList.push(gridPoint);lon+=lonDelta;if(gridPoint.x<mapBounds.right){labelPoint=gridPoint;}}  
if(this.labelled){var labelPos=new OpenLayers.Geometry.Point(mapBounds.right,labelPoint.y);var labelAttrs={value:lat,label:this.labelled?OpenLayers.Util.getFormattedLonLat(lat,"lat",this.labelFormat):"",labelAlign:"rb",xOffset:-2,yOffset:2};this.gratLayer.addFeatures(new OpenLayers.Feature.Vector(labelPos,labelAttrs));}  
var geom=new OpenLayers.Geometry.LineString(pointList);lines.push(new OpenLayers.Feature.Vector(geom));}  
this.gratLayer.addFeatures(lines);},CLASS_NAME:"OpenLayers.Control.Graticule"});OpenLayers.Control.LayerSwitcher=OpenLayers.Class(OpenLayers.Control,{roundedCorner:true,roundedCornerColor:"darkblue",layerStates:null,layersDiv:null,baseLayersDiv:null,baseLayers:null,dataLbl:null,dataLayersDiv:null,dataLayers:null,minimizeDiv:null,maximizeDiv:null,ascending:true,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.layerStates=[];},destroy:function(){OpenLayers.Event.stopObservingElement(this.div);OpenLayers.Event.stopObservingElement(this.minimizeDiv);OpenLayers.Event.stopObservingElement(this.maximizeDiv);this.clearLayersArray("base");this.clearLayersArray("data");this.map.events.un({"addlayer":this.redraw,"changelayer":this.redraw,"removelayer":this.redraw,"changebaselayer":this.redraw,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.on({"addlayer":this.redraw,"changelayer":this.redraw,"removelayer":this.redraw,"changebaselayer":this.redraw,scope:this});},draw:function(){OpenLayers.Control.prototype.draw.apply(this);this.loadContents();if(!this.outsideViewport){this.minimizeControl();}  
this.redraw();return this.div;},clearLayersArray:function(layersType){var layers=this[layersType+"Layers"];if(layers){for(var i=0,len=layers.length;i<len;i++){var layer=layers[i];OpenLayers.Event.stopObservingElement(layer.inputElem);OpenLayers.Event.stopObservingElement(layer.labelSpan);}}  
this[layersType+"LayersDiv"].innerHTML="";this[layersType+"Layers"]=[];},checkRedraw:function(){var redraw=false;if(!this.layerStates.length||(this.map.layers.length!=this.layerStates.length)){redraw=true;}else{for(var i=0,len=this.layerStates.length;i<len;i++){var layerState=this.layerStates[i];var layer=this.map.layers[i];if((layerState.name!=layer.name)||(layerState.inRange!=layer.inRange)||(layerState.id!=layer.id)||(layerState.visibility!=layer.visibility)){redraw=true;break;}}}  
return redraw;},redraw:function(){if(!this.checkRedraw()){return this.div;}  
this.clearLayersArray("base");this.clearLayersArray("data");var containsOverlays=false;var containsBaseLayers=false;var len=this.map.layers.length;this.layerStates=new Array(len);for(var i=0;i<len;i++){var layer=this.map.layers[i];this.layerStates[i]={'name':layer.name,'visibility':layer.visibility,'inRange':layer.inRange,'id':layer.id};}  
var layers=this.map.layers.slice();if(!this.ascending){layers.reverse();}  
for(var i=0,len=layers.length;i<len;i++){var layer=layers[i];var baseLayer=layer.isBaseLayer;if(layer.displayInLayerSwitcher){if(baseLayer){containsBaseLayers=true;}else{containsOverlays=true;}  
var checked=(baseLayer)?(layer==this.map.baseLayer):layer.getVisibility();var inputElem=document.createElement("input");inputElem.id=this.id+"_input_"+layer.name;inputElem.name=(baseLayer)?this.id+"_baseLayers":layer.name;inputElem.type=(baseLayer)?"radio":"checkbox";inputElem.value=layer.name;inputElem.checked=checked;inputElem.defaultChecked=checked;if(!baseLayer&&!layer.inRange){inputElem.disabled=true;}  
var context={'inputElem':inputElem,'layer':layer,'layerSwitcher':this};OpenLayers.Event.observe(inputElem,"mouseup",OpenLayers.Function.bindAsEventListener(this.onInputClick,context));var labelSpan=document.createElement("span");OpenLayers.Element.addClass(labelSpan,"labelSpan")  
if(!baseLayer&&!layer.inRange){labelSpan.style.color="gray";}  
labelSpan.innerHTML=layer.name;labelSpan.style.verticalAlign=(baseLayer)?"bottom":"baseline";OpenLayers.Event.observe(labelSpan,"click",OpenLayers.Function.bindAsEventListener(this.onInputClick,context));var br=document.createElement("br");var groupArray=(baseLayer)?this.baseLayers:this.dataLayers;groupArray.push({'layer':layer,'inputElem':inputElem,'labelSpan':labelSpan});var groupDiv=(baseLayer)?this.baseLayersDiv:this.dataLayersDiv;groupDiv.appendChild(inputElem);groupDiv.appendChild(labelSpan);groupDiv.appendChild(br);}}  
this.dataLbl.style.display=(containsOverlays)?"":"none";this.baseLbl.style.display=(containsBaseLayers)?"":"none";return this.div;},onInputClick:function(e){if(!this.inputElem.disabled){if(this.inputElem.type=="radio"){this.inputElem.checked=true;this.layer.map.setBaseLayer(this.layer);}else{this.inputElem.checked=!this.inputElem.checked;this.layerSwitcher.updateMap();}}  
OpenLayers.Event.stop(e);},onLayerClick:function(e){this.updateMap();},updateMap:function(){for(var i=0,len=this.baseLayers.length;i<len;i++){var layerEntry=this.baseLayers[i];if(layerEntry.inputElem.checked){this.map.setBaseLayer(layerEntry.layer,false);}}  
for(var i=0,len=this.dataLayers.length;i<len;i++){var layerEntry=this.dataLayers[i];layerEntry.layer.setVisibility(layerEntry.inputElem.checked);}},maximizeControl:function(e){this.div.style.width="";this.div.style.height="";this.showControls(false);if(e!=null){OpenLayers.Event.stop(e);}},minimizeControl:function(e){this.div.style.width="0px";this.div.style.height="0px";this.showControls(true);if(e!=null){OpenLayers.Event.stop(e);}},showControls:function(minimize){this.maximizeDiv.style.display=minimize?"":"none";this.minimizeDiv.style.display=minimize?"none":"";this.layersDiv.style.display=minimize?"none":"";},loadContents:function(){OpenLayers.Event.observe(this.div,"mouseup",OpenLayers.Function.bindAsEventListener(this.mouseUp,this));OpenLayers.Event.observe(this.div,"click",this.ignoreEvent);OpenLayers.Event.observe(this.div,"mousedown",OpenLayers.Function.bindAsEventListener(this.mouseDown,this));OpenLayers.Event.observe(this.div,"dblclick",this.ignoreEvent);this.layersDiv=document.createElement("div");this.layersDiv.id=this.id+"_layersDiv";OpenLayers.Element.addClass(this.layersDiv,"layersDiv");this.baseLbl=document.createElement("div");this.baseLbl.innerHTML=OpenLayers.i18n("baseLayer");OpenLayers.Element.addClass(this.baseLbl,"baseLbl");this.baseLayersDiv=document.createElement("div");OpenLayers.Element.addClass(this.baseLayersDiv,"baseLayersDiv");this.dataLbl=document.createElement("div");this.dataLbl.innerHTML=OpenLayers.i18n("overlays");OpenLayers.Element.addClass(this.dataLbl,"dataLbl");this.dataLayersDiv=document.createElement("div");OpenLayers.Element.addClass(this.dataLayersDiv,"dataLayersDiv");if(this.ascending){this.layersDiv.appendChild(this.baseLbl);this.layersDiv.appendChild(this.baseLayersDiv);this.layersDiv.appendChild(this.dataLbl);this.layersDiv.appendChild(this.dataLayersDiv);}else{this.layersDiv.appendChild(this.dataLbl);this.layersDiv.appendChild(this.dataLayersDiv);this.layersDiv.appendChild(this.baseLbl);this.layersDiv.appendChild(this.baseLayersDiv);}  
this.div.appendChild(this.layersDiv);if(this.roundedCorner){OpenLayers.Rico.Corner.round(this.div,{corners:"tl bl",bgColor:"transparent",color:this.roundedCornerColor,blend:false});OpenLayers.Rico.Corner.changeOpacity(this.layersDiv,0.75);}  
var imgLocation=OpenLayers.Util.getImagesLocation();var sz=new OpenLayers.Size(18,18);var img=imgLocation+'layer-switcher-maximize.png';this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MaximizeDiv",null,sz,img,"absolute");OpenLayers.Element.addClass(this.maximizeDiv,"maximizeDiv");this.maximizeDiv.style.display="none";OpenLayers.Event.observe(this.maximizeDiv,"click",OpenLayers.Function.bindAsEventListener(this.maximizeControl,this));this.div.appendChild(this.maximizeDiv);var img=imgLocation+'layer-switcher-minimize.png';var sz=new OpenLayers.Size(18,18);this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MinimizeDiv",null,sz,img,"absolute");OpenLayers.Element.addClass(this.minimizeDiv,"minimizeDiv");this.minimizeDiv.style.display="none";OpenLayers.Event.observe(this.minimizeDiv,"click",OpenLayers.Function.bindAsEventListener(this.minimizeControl,this));this.div.appendChild(this.minimizeDiv);},ignoreEvent:function(evt){OpenLayers.Event.stop(evt);},mouseDown:function(evt){this.isMouseDown=true;this.ignoreEvent(evt);},mouseUp:function(evt){if(this.isMouseDown){this.isMouseDown=false;this.ignoreEvent(evt);}},CLASS_NAME:"OpenLayers.Control.LayerSwitcher"});OpenLayers.Control.MouseDefaults=OpenLayers.Class(OpenLayers.Control,{performedDrag:false,wheelObserver:null,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments);},destroy:function(){if(this.handler){this.handler.destroy();}  
this.handler=null;this.map.events.un({"click":this.defaultClick,"dblclick":this.defaultDblClick,"mousedown":this.defaultMouseDown,"mouseup":this.defaultMouseUp,"mousemove":this.defaultMouseMove,"mouseout":this.defaultMouseOut,scope:this});OpenLayers.Event.stopObserving(window,"DOMMouseScroll",this.wheelObserver);OpenLayers.Event.stopObserving(window,"mousewheel",this.wheelObserver);OpenLayers.Event.stopObserving(document,"mousewheel",this.wheelObserver);this.wheelObserver=null;OpenLayers.Control.prototype.destroy.apply(this,arguments);},draw:function(){this.map.events.on({"click":this.defaultClick,"dblclick":this.defaultDblClick,"mousedown":this.defaultMouseDown,"mouseup":this.defaultMouseUp,"mousemove":this.defaultMouseMove,"mouseout":this.defaultMouseOut,scope:this});this.registerWheelEvents();},registerWheelEvents:function(){this.wheelObserver=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this);OpenLayers.Event.observe(window,"DOMMouseScroll",this.wheelObserver);OpenLayers.Event.observe(window,"mousewheel",this.wheelObserver);OpenLayers.Event.observe(document,"mousewheel",this.wheelObserver);},defaultClick:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}  
var notAfterDrag=!this.performedDrag;this.performedDrag=false;return notAfterDrag;},defaultDblClick:function(evt){var newCenter=this.map.getLonLatFromViewPortPx(evt.xy);this.map.setCenter(newCenter,this.map.zoom+1);OpenLayers.Event.stop(evt);return false;},defaultMouseDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}  
this.mouseDragStart=evt.xy.clone();this.performedDrag=false;if(evt.shiftKey){this.map.div.style.cursor="crosshair";this.zoomBox=OpenLayers.Util.createDiv('zoomBox',this.mouseDragStart,null,null,"absolute","2px solid red");this.zoomBox.style.backgroundColor="white";this.zoomBox.style.filter="alpha(opacity=50)";this.zoomBox.style.opacity="0.50";this.zoomBox.style.fontSize="1px";this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE["Popup"]-1;this.map.viewPortDiv.appendChild(this.zoomBox);}  
document.onselectstart=OpenLayers.Function.False;OpenLayers.Event.stop(evt);},defaultMouseMove:function(evt){this.mousePosition=evt.xy.clone();if(this.mouseDragStart!=null){if(this.zoomBox){var deltaX=Math.abs(this.mouseDragStart.x-evt.xy.x);var deltaY=Math.abs(this.mouseDragStart.y-evt.xy.y);this.zoomBox.style.width=Math.max(1,deltaX)+"px";this.zoomBox.style.height=Math.max(1,deltaY)+"px";if(evt.xy.x<this.mouseDragStart.x){this.zoomBox.style.left=evt.xy.x+"px";}  
if(evt.xy.y<this.mouseDragStart.y){this.zoomBox.style.top=evt.xy.y+"px";}}else{var deltaX=this.mouseDragStart.x-evt.xy.x;var deltaY=this.mouseDragStart.y-evt.xy.y;var size=this.map.getSize();var newXY=new OpenLayers.Pixel(size.w/2+deltaX,size.h/2+deltaY);var newCenter=this.map.getLonLatFromViewPortPx(newXY);this.map.setCenter(newCenter,null,true);this.mouseDragStart=evt.xy.clone();this.map.div.style.cursor="move";}  
this.performedDrag=true;}},defaultMouseUp:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}  
if(this.zoomBox){this.zoomBoxEnd(evt);}else{if(this.performedDrag){this.map.setCenter(this.map.center);}}  
document.onselectstart=null;this.mouseDragStart=null;this.map.div.style.cursor="";},defaultMouseOut:function(evt){if(this.mouseDragStart!=null&&OpenLayers.Util.mouseLeft(evt,this.map.div)){if(this.zoomBox){this.removeZoomBox();}  
this.mouseDragStart=null;}},defaultWheelUp:function(evt){if(this.map.getZoom()<=this.map.getNumZoomLevels()){this.map.setCenter(this.map.getLonLatFromPixel(evt.xy),this.map.getZoom()+1);}},defaultWheelDown:function(evt){if(this.map.getZoom()>0){this.map.setCenter(this.map.getLonLatFromPixel(evt.xy),this.map.getZoom()-1);}},zoomBoxEnd:function(evt){if(this.mouseDragStart!=null){if(Math.abs(this.mouseDragStart.x-evt.xy.x)>5||Math.abs(this.mouseDragStart.y-evt.xy.y)>5){var start=this.map.getLonLatFromViewPortPx(this.mouseDragStart);var end=this.map.getLonLatFromViewPortPx(evt.xy);var top=Math.max(start.lat,end.lat);var bottom=Math.min(start.lat,end.lat);var left=Math.min(start.lon,end.lon);var right=Math.max(start.lon,end.lon);var bounds=new OpenLayers.Bounds(left,bottom,right,top);this.map.zoomToExtent(bounds);}else{var end=this.map.getLonLatFromViewPortPx(evt.xy);this.map.setCenter(new OpenLayers.LonLat((end.lon),(end.lat)),this.map.getZoom()+1);}  
this.removeZoomBox();}},removeZoomBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null;},onWheelEvent:function(e){var inMap=false;var elem=OpenLayers.Event.element(e);while(elem!=null){if(this.map&&elem==this.map.div){inMap=true;break;}  
elem=elem.parentNode;}  
if(inMap){var delta=0;if(!e){e=window.event;}  
if(e.wheelDelta){delta=e.wheelDelta/120;if(window.opera&&window.opera.version()<9.2){delta=-delta;}}else if(e.detail){delta=-e.detail/3;}  
if(delta){e.xy=this.mousePosition;if(delta<0){this.defaultWheelDown(e);}else{this.defaultWheelUp(e);}}  
OpenLayers.Event.stop(e);}},CLASS_NAME:"OpenLayers.Control.MouseDefaults"});OpenLayers.Control.MousePosition=OpenLayers.Class(OpenLayers.Control,{autoActivate:true,element:null,prefix:'',separator:', ',suffix:'',numDigits:5,granularity:10,emptyString:null,lastXy:null,displayProjection:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);},destroy:function(){this.deactivate();OpenLayers.Control.prototype.destroy.apply(this,arguments);},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){this.map.events.register('mousemove',this,this.redraw);this.map.events.register('mouseout',this,this.reset);this.redraw();return true;}else{return false;}},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.map.events.unregister('mousemove',this,this.redraw);this.map.events.unregister('mouseout',this,this.reset);this.element.innerHTML="";return true;}else{return false;}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.div.left="";this.div.top="";this.element=this.div;}  
return this.div;},redraw:function(evt){var lonLat;if(evt==null){this.reset();return;}else{if(this.lastXy==null||Math.abs(evt.xy.x-this.lastXy.x)>this.granularity||Math.abs(evt.xy.y-this.lastXy.y)>this.granularity)  
{this.lastXy=evt.xy;return;}  
lonLat=this.map.getLonLatFromPixel(evt.xy);if(!lonLat){return;}  
if(this.displayProjection){lonLat.transform(this.map.getProjectionObject(),this.displayProjection);}  
this.lastXy=evt.xy;}  
var newHtml=this.formatOutput(lonLat);if(newHtml!=this.element.innerHTML){this.element.innerHTML=newHtml;}},reset:function(evt){if(this.emptyString!=null){this.element.innerHTML=this.emptyString;}},formatOutput:function(lonLat){var digits=parseInt(this.numDigits);var newHtml=this.prefix+  
lonLat.lon.toFixed(digits)+  
this.separator+  
lonLat.lat.toFixed(digits)+  
this.suffix;return newHtml;},CLASS_NAME:"OpenLayers.Control.MousePosition"});OpenLayers.Control.Pan=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,direction:null,type:OpenLayers.Control.TYPE_BUTTON,initialize:function(direction,options){this.direction=direction;this.CLASS_NAME+=this.direction;OpenLayers.Control.prototype.initialize.apply(this,[options]);},trigger:function(){switch(this.direction){case OpenLayers.Control.Pan.NORTH:this.map.pan(0,-this.slideFactor);break;case OpenLayers.Control.Pan.SOUTH:this.map.pan(0,this.slideFactor);break;case OpenLayers.Control.Pan.WEST:this.map.pan(-this.slideFactor,0);break;case OpenLayers.Control.Pan.EAST:this.map.pan(this.slideFactor,0);break;}},CLASS_NAME:"OpenLayers.Control.Pan"});OpenLayers.Control.Pan.NORTH="North";OpenLayers.Control.Pan.SOUTH="South";OpenLayers.Control.Pan.EAST="East";OpenLayers.Control.Pan.WEST="West";OpenLayers.Control.PanZoom=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,slideRatio:null,buttons:null,position:null,initialize:function(options){this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,OpenLayers.Control.PanZoom.Y);OpenLayers.Control.prototype.initialize.apply(this,arguments);},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);this.removeButtons();this.buttons=null;this.position=null;},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);px=this.position;this.buttons=[];var sz=new OpenLayers.Size(18,18);var centered=new OpenLayers.Pixel(px.x+sz.w/2,px.y);this._addButton("panup","north-mini.png",centered,sz);px.y=centered.y+sz.h;this._addButton("panleft","west-mini.png",px,sz);this._addButton("panright","east-mini.png",px.add(sz.w,0),sz);this._addButton("pandown","south-mini.png",centered.add(0,sz.h*2),sz);this._addButton("zoomin","zoom-plus-mini.png",centered.add(0,sz.h*3+5),sz);this._addButton("zoomworld","zoom-world-mini.png",centered.add(0,sz.h*4+5),sz);this._addButton("zoomout","zoom-minus-mini.png",centered.add(0,sz.h*5+5),sz);return this.div;},_addButton:function(id,img,xy,sz){var imgLocation=OpenLayers.Util.getImagesLocation()+img;var btn=OpenLayers.Util.createAlphaImageDiv(this.id+"_"+id,xy,sz,imgLocation,"absolute");this.div.appendChild(btn);OpenLayers.Event.observe(btn,"mousedown",OpenLayers.Function.bindAsEventListener(this.buttonDown,btn));OpenLayers.Event.observe(btn,"dblclick",OpenLayers.Function.bindAsEventListener(this.doubleClick,btn));OpenLayers.Event.observe(btn,"click",OpenLayers.Function.bindAsEventListener(this.doubleClick,btn));btn.action=id;btn.map=this.map;if(!this.slideRatio){var slideFactorPixels=this.slideFactor;var getSlideFactor=function(){return slideFactorPixels;};}else{var slideRatio=this.slideRatio;var getSlideFactor=function(dim){return this.map.getSize()[dim]*slideRatio;};}  
btn.getSlideFactor=getSlideFactor;this.buttons.push(btn);return btn;},_removeButton:function(btn){OpenLayers.Event.stopObservingElement(btn);btn.map=null;btn.getSlideFactor=null;this.div.removeChild(btn);OpenLayers.Util.removeItem(this.buttons,btn);},removeButtons:function(){for(var i=this.buttons.length-1;i>=0;--i){this._removeButton(this.buttons[i]);}},doubleClick:function(evt){OpenLayers.Event.stop(evt);return false;},buttonDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){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(evt);},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,autoActivate:true,defaultControl:null,saveState:false,activeState:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.controls=[];this.activeState={};},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var i=this.controls.length-1;i>=0;i--){if(this.controls[i].events){this.controls[i].events.un({"activate":this.redraw,"deactivate":this.redraw,scope:this});}  
OpenLayers.Event.stopObservingElement(this.controls[i].panel_div);this.controls[i].panel_div=null;}  
this.activeState=null;},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){var control;for(var i=0,len=this.controls.length;i<len;i++){control=this.controls[i];if(control===this.defaultControl||(this.saveState&&this.activeState[control.id])){control.activate();}}  
if(this.saveState===true){this.defaultControl=null;}  
this.redraw();return true;}else{return false;}},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){var control;for(var i=0,len=this.controls.length;i<len;i++){control=this.controls[i];this.activeState[control.id]=control.deactivate();}  
return true;}else{return false;}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.addControlsToMap(this.controls);return this.div;},redraw:function(){if(this.div.children.length>0){for(var l=this.div.children.length,i=l-1;i>=0;i--){this.div.removeChild(this.div.children[i]);}}  
this.div.innerHTML="";if(this.active){for(var i=0,len=this.controls.length;i<len;i++){var element=this.controls[i].panel_div;if(this.controls[i].active){element.className=this.controls[i].displayClass+"ItemActive";}else{element.className=this.controls[i].displayClass+"ItemInactive";}  
this.div.appendChild(element);}}},activateControl:function(control){if(!this.active){return false;}  
if(control.type==OpenLayers.Control.TYPE_BUTTON){control.trigger();this.redraw();return;}  
if(control.type==OpenLayers.Control.TYPE_TOGGLE){if(control.active){control.deactivate();}else{control.activate();}  
this.redraw();return;}  
var c;for(var i=0,len=this.controls.length;i<len;i++){c=this.controls[i];if(c!=control&&(c.type===OpenLayers.Control.TYPE_TOOL||c.type==null)){c.deactivate();}}  
control.activate();},addControls:function(controls){if(!(controls instanceof Array)){controls=[controls];}  
this.controls=this.controls.concat(controls);for(var i=0,len=controls.length;i<len;i++){var element=document.createElement("div");controls[i].panel_div=element;if(controls[i].title!=""){controls[i].panel_div.title=controls[i].title;}  
OpenLayers.Event.observe(controls[i].panel_div,"click",OpenLayers.Function.bind(this.onClick,this,controls[i]));OpenLayers.Event.observe(controls[i].panel_div,"dblclick",OpenLayers.Function.bind(this.onDoubleClick,this,controls[i]));OpenLayers.Event.observe(controls[i].panel_div,"mousedown",OpenLayers.Function.bindAsEventListener(OpenLayers.Event.stop));}  
if(this.map){this.addControlsToMap(controls);this.redraw();}},addControlsToMap:function(controls){var control;for(var i=0,len=controls.length;i<len;i++){control=controls[i];if(control.autoActivate===true){control.autoActivate=false;this.map.addControl(control);control.autoActivate=true;}else{this.map.addControl(control);control.deactivate();}  
control.events.on({"activate":this.redraw,"deactivate":this.redraw,scope:this});}},onClick:function(ctrl,evt){OpenLayers.Event.stop(evt?evt:window.event);this.activateControl(ctrl);},onDoubleClick:function(ctrl,evt){OpenLayers.Event.stop(evt?evt:window.event);},getControlsBy:function(property,match){var test=(typeof match.test=="function");var found=OpenLayers.Array.filter(this.controls,function(item){return item[property]==match||(test&&match.test(item[property]));});return found;},getControlsByName:function(match){return this.getControlsBy("name",match);},getControlsByClass:function(match){return this.getControlsBy("CLASS_NAME",match);},CLASS_NAME:"OpenLayers.Control.Panel"});OpenLayers.Control.Scale=OpenLayers.Class(OpenLayers.Control,{element:null,geodesic:false,initialize:function(element,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.element=OpenLayers.Util.getElement(element);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.element=document.createElement("div");this.div.appendChild(this.element);}  
this.map.events.register('moveend',this,this.updateScale);this.updateScale();return this.div;},updateScale:function(){var scale;if(this.geodesic===true){var units=this.map.getUnits();if(!units){return;}  
var inches=OpenLayers.INCHES_PER_UNIT;scale=(this.map.getGeodesicPixelSize().w||0.000001)*inches["km"]*OpenLayers.DOTS_PER_INCH;}else{scale=this.map.getScale();}  
if(!scale){return;}  
if(scale>=9500&&scale<=950000){scale=Math.round(scale/1000)+"K";}else if(scale>=950000){scale=Math.round(scale/1000000)+"M";}else{scale=Math.round(scale);}  
this.element.innerHTML=OpenLayers.i18n("scale",{'scaleDenom':scale});},CLASS_NAME:"OpenLayers.Control.Scale"});OpenLayers.Control.ScaleLine=OpenLayers.Class(OpenLayers.Control,{maxWidth:100,topOutUnits:"km",topInUnits:"m",bottomOutUnits:"mi",bottomInUnits:"ft",eTop:null,eBottom:null,geodesic:false,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.eTop){this.eTop=document.createElement("div");this.eTop.className=this.displayClass+"Top";var theLen=this.topInUnits.length;this.div.appendChild(this.eTop);if((this.topOutUnits=="")||(this.topInUnits=="")){this.eTop.style.visibility="hidden";}else{this.eTop.style.visibility="visible";}  
this.eBottom=document.createElement("div");this.eBottom.className=this.displayClass+"Bottom";this.div.appendChild(this.eBottom);if((this.bottomOutUnits=="")||(this.bottomInUnits=="")){this.eBottom.style.visibility="hidden";}else{this.eBottom.style.visibility="visible";}}  
this.map.events.register('moveend',this,this.update);this.update();return this.div;},getBarLen:function(maxLen){var digits=parseInt(Math.log(maxLen)/Math.log(10));var pow10=Math.pow(10,digits);var firstChar=parseInt(maxLen/pow10);var barLen;if(firstChar>5){barLen=5;}else if(firstChar>2){barLen=2;}else{barLen=1;}  
return barLen*pow10;},update:function(){var res=this.map.getResolution();if(!res){return;}  
var curMapUnits=this.map.getUnits();var inches=OpenLayers.INCHES_PER_UNIT;var maxSizeData=this.maxWidth*res*inches[curMapUnits];var geodesicRatio=1;if(this.geodesic===true){var maxSizeGeodesic=(this.map.getGeodesicPixelSize().w||0.000001)*this.maxWidth;var maxSizeKilometers=maxSizeData/inches["km"];geodesicRatio=maxSizeGeodesic/maxSizeKilometers;maxSizeData*=geodesicRatio;}  
var topUnits;var bottomUnits;if(maxSizeData>100000){topUnits=this.topOutUnits;bottomUnits=this.bottomOutUnits;}else{topUnits=this.topInUnits;bottomUnits=this.bottomInUnits;}  
var topMax=maxSizeData/inches[topUnits];var bottomMax=maxSizeData/inches[bottomUnits];var topRounded=this.getBarLen(topMax);var bottomRounded=this.getBarLen(bottomMax);topMax=topRounded/inches[curMapUnits]*inches[topUnits];bottomMax=bottomRounded/inches[curMapUnits]*inches[bottomUnits];var topPx=topMax/res/geodesicRatio;var bottomPx=bottomMax/res/geodesicRatio;if(this.eBottom.style.visibility=="visible"){this.eBottom.style.width=Math.round(bottomPx)+"px";this.eBottom.innerHTML=bottomRounded+" "+bottomUnits;}  
if(this.eTop.style.visibility=="visible"){this.eTop.style.width=Math.round(topPx)+"px";this.eTop.innerHTML=topRounded+" "+topUnits;}},CLASS_NAME:"OpenLayers.Control.ScaleLine"});OpenLayers.Control.ZoomIn=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomIn();},CLASS_NAME:"OpenLayers.Control.ZoomIn"});OpenLayers.Control.ZoomOut=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){this.map.zoomOut();},CLASS_NAME:"OpenLayers.Control.ZoomOut"});OpenLayers.Control.ZoomToMaxExtent=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){if(this.map){this.map.zoomToMaxExtent();}},CLASS_NAME:"OpenLayers.Control.ZoomToMaxExtent"});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(event){return event.target||event.srcElement;},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},isRightClick:function(event){return(((event.which)&&(event.which==3))||((event.button)&&(event.button==2)));},stop:function(event,allowDefault){if(!allowDefault){if(event.preventDefault){event.preventDefault();}else{event.returnValue=false;}}  
if(event.stopPropagation){event.stopPropagation();}else{event.cancelBubble=true;}},findElement:function(event,tagName){var element=OpenLayers.Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase()))){element=element.parentNode;}  
return element;},observe:function(elementParam,name,observer,useCapture){var element=OpenLayers.Util.getElement(elementParam);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent)){name='keydown';}  
if(!this.observers){this.observers={};}  
if(!element._eventCacheID){var idPrefix="eventCacheID_";if(element.id){idPrefix=element.id+"_"+idPrefix;}  
element._eventCacheID=OpenLayers.Util.createUniqueID(idPrefix);}  
var cacheID=element._eventCacheID;if(!this.observers[cacheID]){this.observers[cacheID]=[];}  
this.observers[cacheID].push({'element':element,'name':name,'observer':observer,'useCapture':useCapture});if(element.addEventListener){element.addEventListener(name,observer,useCapture);}else if(element.attachEvent){element.attachEvent('on'+name,observer);}},stopObservingElement:function(elementParam){var element=OpenLayers.Util.getElement(elementParam);var cacheID=element._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[cacheID]);},_removeElementObservers:function(elementObservers){if(elementObservers){for(var i=elementObservers.length-1;i>=0;i--){var entry=elementObservers[i];var args=new Array(entry.element,entry.name,entry.observer,entry.useCapture);var removed=OpenLayers.Event.stopObserving.apply(this,args);}}},stopObserving:function(elementParam,name,observer,useCapture){useCapture=useCapture||false;var element=OpenLayers.Util.getElement(elementParam);var cacheID=element._eventCacheID;if(name=='keypress'){if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent){name='keydown';}}  
var foundEntry=false;var elementObservers=OpenLayers.Event.observers[cacheID];if(elementObservers){var i=0;while(!foundEntry&&i<elementObservers.length){var cacheEntry=elementObservers[i];if((cacheEntry.name==name)&&(cacheEntry.observer==observer)&&(cacheEntry.useCapture==useCapture)){elementObservers.splice(i,1);if(elementObservers.length==0){delete OpenLayers.Event.observers[cacheID];}  
foundEntry=true;break;}  
i++;}}  
if(foundEntry){if(element.removeEventListener){element.removeEventListener(name,observer,useCapture);}else if(element&&element.detachEvent){element.detachEvent('on'+name,observer);}}  
return foundEntry;},unloadCache:function(){if(OpenLayers.Event&&OpenLayers.Event.observers){for(var cacheID in OpenLayers.Event.observers){var elementObservers=OpenLayers.Event.observers[cacheID];OpenLayers.Event._removeElementObservers.apply(this,[elementObservers]);}  
OpenLayers.Event.observers=false;}},CLASS_NAME:"OpenLayers.Event"};OpenLayers.Event.observe(window,'unload',OpenLayers.Event.unloadCache,false);if(window.Event){OpenLayers.Util.applyDefaults(window.Event,OpenLayers.Event);}else{var Event=OpenLayers.Event;}  
OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:["mouseover","mouseout","mousedown","mouseup","mousemove","click","dblclick","rightclick","dblrightclick","resize","focus","blur"],listeners:null,object:null,element:null,eventTypes:null,eventHandler:null,fallThrough:null,includeXY:false,clearMouseListener:null,initialize:function(object,element,eventTypes,fallThrough,options){OpenLayers.Util.extend(this,options);this.object=object;this.fallThrough=fallThrough;this.listeners={};this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,this);this.clearMouseListener=OpenLayers.Function.bind(this.clearMouseCache,this);this.eventTypes=[];if(eventTypes!=null){for(var i=0,len=eventTypes.length;i<len;i++){this.addEventType(eventTypes[i]);}}  
if(element!=null){this.attachToElement(element);}},destroy:function(){if(this.element){OpenLayers.Event.stopObservingElement(this.element);if(this.element.hasScrollEvent){OpenLayers.Event.stopObserving(window,"scroll",this.clearMouseListener);}}  
this.element=null;this.listeners=null;this.object=null;this.eventTypes=null;this.fallThrough=null;this.eventHandler=null;},addEventType:function(eventName){if(!this.listeners[eventName]){this.eventTypes.push(eventName);this.listeners[eventName]=[];}},attachToElement:function(element){if(this.element){OpenLayers.Event.stopObservingElement(this.element);}  
this.element=element;for(var i=0,len=this.BROWSER_EVENTS.length;i<len;i++){var eventType=this.BROWSER_EVENTS[i];this.addEventType(eventType);OpenLayers.Event.observe(element,eventType,this.eventHandler);}  
OpenLayers.Event.observe(element,"dragstart",OpenLayers.Event.stop);},on:function(object){for(var type in object){if(type!="scope"){this.register(type,object.scope,object[type]);}}},register:function(type,obj,func){if((func!=null)&&(OpenLayers.Util.indexOf(this.eventTypes,type)!=-1)){if(obj==null){obj=this.object;}  
var listeners=this.listeners[type];listeners.push({obj:obj,func:func});}},registerPriority:function(type,obj,func){if(func!=null){if(obj==null){obj=this.object;}  
var listeners=this.listeners[type];if(listeners!=null){listeners.unshift({obj:obj,func:func});}}},un:function(object){for(var type in object){if(type!="scope"){this.unregister(type,object.scope,object[type]);}}},unregister:function(type,obj,func){if(obj==null){obj=this.object;}  
var listeners=this.listeners[type];if(listeners!=null){for(var i=0,len=listeners.length;i<len;i++){if(listeners[i].obj==obj&&listeners[i].func==func){listeners.splice(i,1);break;}}}},remove:function(type){if(this.listeners[type]!=null){this.listeners[type]=[];}},triggerEvent:function(type,evt){var listeners=this.listeners[type];if(!listeners||listeners.length==0){return;}  
if(evt==null){evt={};}  
evt.object=this.object;evt.element=this.element;if(!evt.type){evt.type=type;}  
var listeners=listeners.slice(),continueChain;for(var i=0,len=listeners.length;i<len;i++){var callback=listeners[i];continueChain=callback.func.apply(callback.obj,[evt]);if((continueChain!=undefined)&&(continueChain==false)){break;}}  
if(!this.fallThrough){OpenLayers.Event.stop(evt,true);}  
return continueChain;},handleBrowserEvent:function(evt){if(this.includeXY){evt.xy=this.getMousePosition(evt);}  
this.triggerEvent(evt.type,evt);},clearMouseCache:function(){this.element.scrolls=null;this.element.lefttop=null;this.element.offsets=null;},getMousePosition:function(evt){if(!this.includeXY){this.clearMouseCache();}else if(!this.element.hasScrollEvent){OpenLayers.Event.observe(window,"scroll",this.clearMouseListener);this.element.hasScrollEvent=true;}  
if(!this.element.scrolls){this.element.scrolls=[(document.documentElement.scrollLeft||document.body.scrollLeft),(document.documentElement.scrollTop||document.body.scrollTop)];}  
if(!this.element.lefttop){this.element.lefttop=[(document.documentElement.clientLeft||0),(document.documentElement.clientTop||0)];}  
if(!this.element.offsets){this.element.offsets=OpenLayers.Util.pagePosition(this.element);this.element.offsets[0]+=this.element.scrolls[0];this.element.offsets[1]+=this.element.scrolls[1];}  
return new OpenLayers.Pixel((evt.clientX+this.element.scrolls[0])-this.element.offsets[0]  
-this.element.lefttop[0],(evt.clientY+this.element.scrolls[1])-this.element.offsets[1]  
-this.element.lefttop[1]);},CLASS_NAME:"OpenLayers.Events"});OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:false,initialize:function(options){OpenLayers.Util.extend(this,options);this.options=options;},destroy:function(){},read:function(data){OpenLayers.Console.userError(OpenLayers.i18n("readNotImplemented"));},write:function(object){OpenLayers.Console.userError(OpenLayers.i18n("writeNotImplemented"));},CLASS_NAME:"OpenLayers.Format"});OpenLayers.Lang["ar"]=OpenLayers.Util.applyDefaults({'permalink':"وصلة دائمة",'baseLayer':"الطبقة الاساسية",'readNotImplemented':"القراءة غير محققة.",'writeNotImplemented':"الكتابة غير محققة",'errorLoadingGML':"خطأ عند تحميل الملف جي ام ال ${url}",'scale':"النسبة = 1 : ${scaleDenom}",'W':"غ",'E':"شر",'N':"شم",'S':"ج"});OpenLayers.Lang["be-tarask"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Неапрацаваны вынік запыту ${statusText}",'permalink':"Сталая спасылка",'overlays':"Слаі",'baseLayer':"Базавы слой",'sameProjection':"Аглядная мапа працуе толькі калі яна мае тую ж праекцыю, што і асноўная мапа",'readNotImplemented':"Функцыянальнасьць чытаньня ня створаная.",'writeNotImplemented':"Функцыянальнасьць запісу ня створаная.",'noFID':"Немагчыма абнавіць магчымасьць, для якога не існуе FID.",'errorLoadingGML':"Памылка загрузкі файла GML ${url}",'browserNotSupported':"Ваш браўзэр не падтрымлівае вэктарную графіку. У цяперашні момант падтрымліваюцца: ${renderers}",'componentShouldBe':"addFeatures : кампанэнт павінен быць ${geomType}",'getFeatureError':"getFeatureFromEvent выкліканы для слоя бяз рэндэру. Звычайна гэта азначае, што Вы зьнішчылі слой, але пакінулі зьвязаны зь ім апрацоўшчык.",'minZoomLevelError':"Уласьцівасьць minZoomLevel прызначана толькі для выкарыстаньня са слаямі вытворнымі ад FixedZoomLevels. Тое, што гэты wfs-слой правяраецца на minZoomLevel — рэха прошлага. Але мы ня можам выдаліць гэтую магчымасьць, таму што ад яе залежаць некаторыя заснаваныя на OL дастасаваньні. Тым ня менш, праверка minZoomLevel будзе выдаленая ў вэрсіі 3.0. Калі ласка, выкарыстоўваеце замест яе ўстаноўкі мінімальнага/максымальнага памераў, як апісана тут: http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS-транзакцыя: ПОСЬПЕХ ${response}",'commitFailed':"WFS-транзакцыя: ПАМЫЛКА ${response}",'googleWarning':"Не атрымалася загрузіць слой Google. \x3cbr\x3e\x3cbr\x3eКаб пазбавіцца гэтага паведамленьня, выберыце новы базавы слой у сьпісе ў верхнім правым куце.\x3cbr\x3e\x3cbr\x3e Хутчэй за ўсё, прычына ў тым, што скрыпт бібліятэкі Google Maps ня быў уключаныя альбо не ўтрымлівае слушны API-ключ для Вашага сайта.\x3cbr\x3e\x3cbr\x3eРаспрацоўшчыкам: Для таго, каб даведацца як зрабіць так, каб усё працавала, \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3eнацісьніце тут\x3c/a\x3e",'getLayerWarning':"Немагчыма загрузіць слой ${layerType}.\x3cbr\x3e\x3cbr\x3eКаб пазбавіцца гэтага паведамленьня, выберыце новы базавы слой у сьпісе ў верхнім правым куце.\x3cbr\x3e\x3cbr\x3eХутчэй за ўсё, прычына ў тым, што скрыпт бібліятэкі ${layerLib} ня быў слушна ўключаны.\x3cbr\x3e\x3cbr\x3eРаспрацоўшчыкам: Для таго, каб даведацца як зрабіць так, каб усё працавала, \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3eнацісьніце тут\x3c/a\x3e",'scale':"Маштаб = 1 : ${scaleDenom}",'W':"З",'E':"У",'N':"Пн",'S':"Пд",'layerAlreadyAdded':"Вы паспрабавалі дадаць слой ${layerName} на мапу, але ён ужо дададзены",'reprojectDeprecated':"Вы выкарыстоўваеце ўстаноўку \'reproject\' для слоя ${layerName}. Гэтая ўстаноўка зьяўляецца састарэлай: яна выкарыстоўвалася для падтрымкі паказу зьвестак на камэрцыйных базавых мапах, але гэта функцыя цяпер рэалізаваная ў убудаванай падтрымцы сфэрычнай праекцыі Мэркатара. Дадатковая інфармацыя ёсьць на http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Гэты мэтад састарэлы і будзе выдалены ў вэрсіі 3.0. Калі ласка, замест яго выкарыстоўвайце ${newMethod}.",'boundsAddError':"Вам неабходна падаць абодва значэньні x і y для функцыі складаньня.",'lonlatAddError':"Вам неабходна падаць абодва значэньні lon і lat для функцыі складаньня.",'pixelAddError':"Вам неабходна падаць абодва значэньні x і y для функцыі складаньня.",'unsupportedGeometryType':"Тып геамэтрыі не падтрымліваецца: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition failed: верагодна элемэнт з ідэнтыфікатарам ${elemId} займае няслушнае месца.",'filterEvaluateNotImplemented':"evaluate не рэалізаваны для гэтага тыпу фільтру."});OpenLayers.Lang["bg"]=OpenLayers.Util.applyDefaults({'permalink':"Постоянна препратка",'baseLayer':"Основен слой",'errorLoadingGML':"Грешка при зареждане на GML файл ${url}",'scale':"Мащаб = 1 : ${scaleDenom}",'layerAlreadyAdded':"Опитахте да добавите слой ${layerName} в картата, но той вече е добавен",'methodDeprecated':"Този метод е остарял и ще бъде премахват в 3.0. Вместо него използвайте ${newMethod}."});OpenLayers.Lang["br"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Distro evel reked anveret ${statusText}",'permalink':"Peurliamm",'overlays':"Gwiskadoù",'baseLayer':"Gwiskad diazez",'sameProjection':"Ne\'z ar gartenn lec\'hiañ en-dro nemet pa vez heñvel ar banndres anezhi ha hini ar gartenn bennañ",'readNotImplemented':"N\'eo ket emplementet al lenn.",'writeNotImplemented':"N\'eo ket emplementet ar skrivañ.",'noFID':"N\'haller ket hizivaat un elfenn ma n\'eus ket a niverenn-anaout (FID) eviti.",'errorLoadingGML':"Fazi e-ser kargañ ar restr GML ${url}",'browserNotSupported':"N\'eo ket skoret an daskor vektorel gant ho merdeer. Setu aze an daskorerioù skoret evit ar poent :\n${renderers}",'componentShouldBe':"addFeatures : bez\' e tlefe ar parzh besañ eus ar seurt ${geomType}",'getFeatureError':"Galvet eo bet getFeatureFromEvent called war ur gwiskad hep daskorer. Kement-se a dalvez ez eus bet freuzet ur gwiskad hag hoc\'h eus miret un embreger bennak stag outañ.",'minZoomLevelError':"Ne zleer implijout ar perzh minZoomLevel nemet evit gwiskadoù FixedZoomLevels-descendent. Ar fed ma wiria ar gwiskad WHS-se hag-eñ ez eus eus minZoomLevel zo un aspadenn gozh. Koulskoude n\'omp ket evit e ziverkañ kuit da derriñ arloadoù diazezet war OL a c\'hallfe bezañ stag outañ. Setu perak eo dispredet -- Lamet kuit e vo ar gwiriañ minZoomLevel a-is er stumm 3.0. Ober gant an arventennoù bihanañ/brasañ evel deskrivet amañ e plas : http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Treuzgread WFS : MAT EO ${response}",'commitFailed':"Treuzgread WFS Transaction: C\'HWITET ${response}",'googleWarning':"N\'eus ket bet gallet kargañ ar gwiskad Google ent reizh.\x3cbr\x3e\x3cbr\x3eEvit en em zizober eus ar c\'hemenn-mañ, dibabit ur BaseLayer nevez en diuzer gwiskadoù er c\'horn dehoù el laez.\x3cbr\x3e\x3cbr\x3eSur a-walc\'h eo peogwir n\'eo ket bet ensoc\'het levraoueg Google Maps pe neuze ne glot ket an alc\'hwez API gant ho lec\'hienn.\x3cbr\x3e\x3cbr\x3eDiorroerien : Evit reizhañ an dra-se, \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3eclick here\x3c/a\x3e",'getLayerWarning':"N\'haller ket kargañ ar gwiskad ${layerType} ent reizh.\x3cbr\x3e\x3cbr\x3eEvit en em zizober eus ar c\'hemenn-mañ, dibabit ur BaseLayer nevez en diuzer gwiskadoù er c\'horn dehoù el laez.\x3cbr\x3e\x3cbr\x3eSur a-walc\'h eo peogwir n\'eo ket bet ensoc\'het mat al levraoueg ${layerLib}.\x3cbr\x3e\x3cbr\x3eDiorroerien : Evit gouzout penaos reizhañ an dra-se, \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3eclick here\x3c/a\x3e",'scale':"Skeul = 1 : ${scaleDenom}",'W':"K",'E':"R",'N':"N",'S':"S",'layerAlreadyAdded':"Klasket hoc\'h eus ouzhpennañ ar gwiskad : ${layerName} d\'ar gartenn, met ouzhpennet e oa bet c\'hoazh",'reprojectDeprecated':"Emaoc\'h oc\'h implijout an dibarzh \'reproject\' war ar gwiskad ${layerName}. Dispredet eo an dibarzh-mañ : bet eo hag e talveze da ziskwel roadennoù war-c\'horre kartennoù diazez kenwerzhel, un dra hag a c\'haller ober bremañ gant an arc\'hwel dre skor banndres boullek Mercator. Muioc\'h a ditouroù a c\'haller da gaout war http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Dispredet eo an daore-se ha tennet e vo kuit eus ar stumm 3.0. Grit gant ${newMethod} e plas.",'boundsAddError':"Rekis eo tremen an div dalvoudenn x ha y d\'an arc\'hwel add.",'lonlatAddError':"Rekis eo tremen an div dalvoudenn hedred ha ledred d\'an arc\'hwel add.",'pixelAddError':"Rekis eo tremen an div dalvoudenn x ha y d\'an arc\'hwel add.",'unsupportedGeometryType':"Seurt mentoniezh anskoret : ${geomType}",'pagePositionFailed':"C\'hwitet eo OpenLayers.Util.pagePosition : marteze emañ lec\'hiet fall an elfenn id ${elemId}.",'filterEvaluateNotImplemented':"N\'eo ket bet emplementet ar priziañ evit seurt siloù c\'hoazh."});OpenLayers.Lang["el"]=OpenLayers.Util.applyDefaults({'scale':"Κλίμακα ~ 1 : ${scaleDenom}"});OpenLayers.Lang.en={'unhandledRequest':"Unhandled request return ${statusText}",'permalink':"Permalink",'overlays':"Overlays",'baseLayer':"Base Layer",'sameProjection':"The overview map only works when it is in the same projection as the main map",'readNotImplemented':"Read not implemented.",'writeNotImplemented':"Write not implemented.",'noFID':"Can't update a feature for which there is no FID.",'errorLoadingGML':"Error in loading GML file ${url}",'browserNotSupported':"Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",'componentShouldBe':"addFeatures : component should be an ${geomType}",'getFeatureError':"getFeatureFromEvent called on layer with no renderer. This usually means you "+"destroyed a layer, but not some handler which is associated with it.",'minZoomLevelError':"The minZoomLevel property is only intended for use "+"with the FixedZoomLevels-descendent layers. That this "+"wfs layer checks for minZoomLevel is a relic of the"+"past. We cannot, however, remove it without possibly "+"breaking OL based applications that may depend on it."+" Therefore we are deprecating it -- the minZoomLevel "+"check below will be removed at 3.0. Please instead "+"use min/max resolution setting as described here: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS Transaction: SUCCESS ${response}",'commitFailed':"WFS Transaction: FAILED ${response}",'googleWarning':"The Google Layer was unable to load correctly.<br><br>"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.<br><br>"+"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.<br><br>"+"Developers: For help getting this working correctly, "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>click here</a>",'getLayerWarning':"The ${layerType} Layer was unable to load correctly.<br><br>"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.<br><br>"+"Most likely, this is because the ${layerLib} library "+"script was not correctly included.<br><br>"+"Developers: For help getting this working correctly, "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>click here</a>",'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.Lang["fi"]=OpenLayers.Util.applyDefaults({'permalink':"Ikilinkki",'overlays':"Kerrokset",'baseLayer':"Peruskerros",'sameProjection':"Yleiskuvakarttaa voi käyttää vain, kun sillä on sama projektio kuin pääkartalla.",'W':"L",'E':"I",'N':"P",'S':"E"});OpenLayers.Lang["fur"]=OpenLayers.Util.applyDefaults({'permalink':"Leam Permanent",'overlays':"Livei parsore",'baseLayer':"Livel di base",'browserNotSupported':"Il to sgarfadôr nol supuarte la renderizazion vetoriâl. Al moment a son supuartâts:\n${renderers}",'scale':"Scjale = 1 : ${scaleDenom}",'W':"O",'E':"E",'N':"N",'S':"S"});OpenLayers.Lang["gl"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Solicitude non xerada; a resposta foi: ${statusText}",'permalink':"Ligazón permanente",'overlays':"Capas superpostas",'baseLayer':"Capa base",'sameProjection':"A vista xeral do mapa só funciona cando está na mesma proxección có mapa principal",'readNotImplemented':"Lectura non implementada.",'writeNotImplemented':"Escritura non implementada.",'noFID':"Non se pode actualizar a funcionalidade para a que non hai FID.",'errorLoadingGML':"Erro ao cargar o ficheiro GML ${url}",'browserNotSupported':"O seu navegador non soporta a renderización de vectores. Os renderizadores soportados actualmente son:\n${renderers}",'componentShouldBe':"addFeatures: o compoñente debera ser de tipo ${geomType}",'getFeatureError':"getFeatureFromEvent ten sido chamado a unha capa sen renderizador. Isto normalmente significa que destruíu unha capa, mais non o executador que está asociado con ela.",'minZoomLevelError':"A propiedade minZoomLevel é só para uso conxuntamente coas capas FixedZoomLevels-descendent. O feito de que esa capa wfs verifique o minZoomLevel é unha reliquia do pasado. Non podemos, con todo, eliminala sen a posibilidade de non romper as aplicacións baseadas en OL que poidan depender dela. Por iso a estamos deixando obsoleta (a comprobación minZoomLevel de embaixo será eliminada na versión 3.0). Por favor, no canto diso use o axuste de resolución mín/máx tal e como está descrito aquí: http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transacción WFS: ÉXITO ${response}",'commitFailed':"Transacción WFS: FALLIDA ${response}",'googleWarning':"A capa do Google non puido cargarse correctamente.\x3cbr\x3e\x3cbr\x3ePara evitar esta mensaxe, escolla unha nova capa base no seleccionador de capas na marxe superior dereita.\x3cbr\x3e\x3cbr\x3eProbablemente, isto acontece porque a escritura da libraría do Google Maps ou ben non foi incluída ou ben non contén a clave API correcta para o seu sitio.\x3cbr\x3e\x3cbr\x3eDesenvolvedores: para axudar a facer funcionar isto correctamente, \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3epremede aquí\x3c/a\x3e",'getLayerWarning':"A capa ${layerType} foi incapaz de cargarse correctamente.\x3cbr\x3e\x3cbr\x3ePara evitar esta mensaxe, escolla unha nova capa base no seleccionador de capas na marxe superior dereita.\x3cbr\x3e\x3cbr\x3eProbablemente, isto acontece porque a escritura da libraría ${layerLib} non foi ben incluída.\x3cbr\x3e\x3cbr\x3eDesenvolvedores: para axudar a facer funcionar isto correctamente, \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3epremede aquí\x3c/a\x3e",'scale':"Escala = 1 : ${scaleDenom}",'W':"O",'E':"L",'N':"N",'S':"S",'layerAlreadyAdded':"Intentou engadir a capa: ${layerName} ao mapa, pero xa fora engadida",'reprojectDeprecated':"Está usando a opción \"reproject\" na capa ${layerName}. Esta opción está obsoleta: o seu uso foi deseñado para a visualización de datos sobre mapas base comerciais, pero esta funcionalidade debera agora ser obtida utilizando a proxección Spherical Mercator. Hai dispoñible máis información en http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Este método está obsoleto e será eliminado na versión 3.0. Por favor, no canto deste use ${newMethod}.",'boundsAddError':"Debe achegar os valores x e y á función add.",'lonlatAddError':"Debe achegar tanto o valor lon coma o lat á función add.",'pixelAddError':"Debe achegar os valores x e y á función add.",'unsupportedGeometryType':"Tipo xeométrico non soportado: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition fallou: o elemento con id ${elemId} pode non estar na súa posición.",'filterEvaluateNotImplemented':"avaliar non está implementado para este tipo de filtro."});OpenLayers.Lang["gsw"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Nit behandleti Aafrogsruckmäldig ${statusText}",'permalink':"Permalink",'overlays':"Iberlagerige",'baseLayer':"Grundcharte",'sameProjection':"D Ibersichts-Charte funktioniert nume, wänn si di glych Projäktion brucht wie d Hauptcharte",'readNotImplemented':"Läse nit implementiert.",'writeNotImplemented':"Schrybe nit implementiert.",'noFID':"E Feature, wu s kei FID derfir git, cha nit aktualisiert wäre.",'errorLoadingGML':"Fähler bim Lade vu dr GML-Datei ${url}",'browserNotSupported':"Dyy Browser unterstitzt kei Vektordarstellig. Aktuäll unterstitzti Renderer:\n${renderers}",'componentShouldBe':"addFeatures : Komponänt sott dr Typ ${geomType} syy",'getFeatureError':"getFeatureFromEvent isch uf eme Layer ohni Renderer ufgruefe wore. Des heisst normalerwys, ass Du e Layer kaputt gmacht hesch, aber nit dr Handler, wu derzue ghert.",'minZoomLevelError':"D minZoomLevel-Eigeschaft isch nume dänk fir d Layer, wu vu dr FixedZoomLevels abstamme. Ass dää wfs-Layer minZoomLevel prieft, scih e Relikt us dr Vergangeheit. Mir chenne s aber nit ändere ohni OL_basierti Aawändige villicht kaputt gehn, wu dervu abhänge. Us däm Grund het die Funktion d Eigeschaft \'deprecated\' iberchuu. D minZoomLevel-Priefig unte wird in dr Version 3.0 usegnuu. Bitte verwänd statt däm e min/max-Uflesig wie s do bschriben isch: http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS-Transaktion: ERFOLGRYCH ${response}",'commitFailed':"WFS-Transaktion: FÄHLGSCHLAA ${response}",'googleWarning':"Dr Google-Layer het nit korräkt chenne glade wäre.\x3cbr\x3e\x3cbr\x3eGo die Mäldig nimi z kriege, wehl e andere Hintergrundlayer us em LayerSwitcher im rächte obere Ecke.\x3cbr\x3e\x3cbr\x3eDää Fähler git s seli hyfig, wel s Skript vu dr Google-Maps-Bibliothek nit yybunde woren isch oder wel s kei giltige API-Schlissel fir Dyy URL din het.\x3cbr\x3e\x3cbr\x3eEntwickler: Fir Hilf zum korräkte Yybinde vum Google-Layer \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3edoo drucke\x3c/a\x3e",'getLayerWarning':"Dr ${layerType}-Layer het nit korräkt chenne glade wäre.\x3cbr\x3e\x3cbr\x3eGo die Mäldig nimi z kriege, wehl e andere Hintergrundlayer us em LayerSwitcher im rächte obere Ecke.\x3cbr\x3e\x3cbr\x3eDää Fähler git s seli hyfig, wel s Skript vu dr \'${layerLib}\'-Bibliothek nit yybunde woren isch oder wel s kei giltige API-Schlissel fir Dyy URL din het.\x3cbr\x3e\x3cbr\x3eEntwickler: Fir Hilf zum korräkte Yybinde vu Layer \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3edoo drucke\x3c/a\x3e",'scale':"Maßstab = 1 : ${scaleDenom}",'W':"W",'E':"O",'N':"N",'S':"S",'layerAlreadyAdded':"Du hesch versuecht dää Layer in d Charte yyzfiege: ${layerName}, aber är isch schoi yygfiegt",'reprojectDeprecated':"Du bruchsch d \'reproject\'-Option bim ${layerName}-Layer. Die Option isch nimi giltig: si isch aagleit wore go Date iber kommerziälli Grundcharte lege, aber des sott mer jetz mache mit dr Unterstitzig vu Spherical Mercator. Meh Informatione git s uf http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Die Methode isch veraltet un wird us dr Version 3.0 usegnuu. Bitte verwäbnd statt däm ${newMethod}.",'boundsAddError':"Du muesch e x-Wärt un e y-Wärt yygee bi dr Zuefieg-Funktion",'lonlatAddError':"Du meusch e Lengi- un e Breiti-Grad yygee bi dr Zuefieg-Funktion.",'pixelAddError':"Du muesch x- un y-Wärt aagee bi dr Zuefieg-Funktion.",'unsupportedGeometryType':"Nit unterstitze Geometrii-Typ: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition fählgschlaa: Elemänt mit ID ${elemId} isch villicht falsch gsetzt.",'filterEvaluateNotImplemented':"evaluiere isch nit implemäntiert in däm Filtertyp."});OpenLayers.Lang["hr"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Nepodržani zahtjev ${statusText}",'permalink':"Permalink",'overlays':"Overlays",'baseLayer':"Osnovna karta",'sameProjection':"Pregledna karta radi jedino kao je u istoj projekciji kao i glava karta",'readNotImplemented':"Čitanje nije implementirano.",'writeNotImplemented':"Pisanje nije implementirano.",'noFID':"Ne mogu ažurirati značajku za koju ne postoji FID.",'errorLoadingGML':"Greška u učitavanju GML datoteke ${url}",'browserNotSupported':"Vaš preglednik ne podržava vektorsko renderiranje. Trenutno podržani rendereri su: ${renderers}",'componentShouldBe':"addFeatures : komponenta bi trebala biti ${geomType}",'getFeatureError':"getFeatureFromEvent je pozvao Layer bez renderera. Ovo obično znači da ste uništiili Layer, a ne neki Handler koji je povezan s njim.",'commitSuccess':"WFS Transakcija: USPJEŠNA ${response}",'commitFailed':"WFS Transakcija: NEUSPJEŠNA ${response}",'scale':"Mjerilo = 1 : ${scaleDenom}",'layerAlreadyAdded':"Pokušali ste dodati layer: ${layerName} na kartu, ali je već dodan",'methodDeprecated':"Ova metoda nije odobrena i biti će maknuta u 3.0. Koristite ${newMethod}.",'boundsAddError':"Morate dati obje vrijednosti , x i y da bi dodali funkciju.",'lonlatAddError':"Morate dati obje vrijednosti , (lon i lat) da bi dodali funkciju.",'pixelAddError':"Morate dati obje vrijednosti , x i y da bi dodali funkciju.",'unsupportedGeometryType':"Nepodržani tip geometrije: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition nije uspjelo: element sa id ${elemId} može biti krivo smješten."});OpenLayers.Lang["hsb"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Wotmołwa njewobdźěłaneho naprašowanja ${statusText}",'permalink':"Trajny wotkaz",'overlays':"Naworštowanja",'baseLayer':"Zakładna runina",'sameProjection':"Přehladowa karta jenož funguje, hdyž je w samsnej projekciji kaž hłowna karta",'readNotImplemented':"Čitanje njeimplementowane.",'writeNotImplemented':"Pisanje njeimplementowane.",'noFID':"Funkcija, za kotruž FID njeje, njeda so aktualizować.",'errorLoadingGML':"Zmylk při začitowanju dataje ${url}",'browserNotSupported':"Twój wobhladowak wektorowe rysowanje njepodpěruje. Tuchwilu podpěrowane rysowaki su:\n${renderers}",'componentShouldBe':"addFeatures: komponenta měła ${geomType} być",'getFeatureError':"getFeatureFromEvent bu na woršće bjez rysowak zawołany. To zwjetša woznamjenja, zo sy worštu zničił, ale nic wobdźěłak, kotryž je z njej zwjazany.",'minZoomLevelError':"Kajkosć minZoomLevel je jenož za wužiwanje z worštami myslena, kotrež wot FixedZoomLevels pochadźeja. Zo tuta woršta wfs za minZoomLevel přepruwuje, je relikt zańdźenosće. Njemóžemy wšak ju wotstronić, bjeztoho zo aplikacije, kotrež na OpenLayers bazěruja a snano tutu kajkosć wužiwaja, hižo njefunguja. Tohodla smy ju jako zestarjenu woznamjenili -- přepruwowanje za minZoomLevel budu so we wersiji 3.0 wotstronjeć. Prošu wužij město toho nastajenje min/max, kaž je tu wopisane: http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS-Transakcija: WUSPĚŠNA ${response}",'commitFailed':"WFS-Transakcija: NJEPORADŹENA ${response}",'googleWarning':"Woršta Google njemóžeše so korektnje začitać.\x3cbr\x3e\x3cbr\x3eZo by tutu zdźělenku wotbył, wubjer nowy BaseLayer z wuběra worštow horjeka naprawo.\x3cbr\x3e\x3cbr\x3eNajskerje so to stawa, dokelž skript biblioteki Google Maps pak njebu zapřijaty pak njewobsahuje korektny kluč API za twoje sydło.\x3cbr\x3e\x3cbr\x3eWuwiwarjo: Za pomoc ke korektnemu fungowanju worštow\n\x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3etu kliknyć\x3c/a\x3e",'getLayerWarning':"Woršta ${layerType} njemóžeše so korektnje začitać.\x3cbr\x3e\x3cbr\x3eZo by tutu zdźělenku wotbył, wubjer nowy BaseLayer z wuběra worštow horjeka naprawo.\x3cbr\x3e\x3cbr\x3eNajskerje so to stawa, dokelž skript biblioteki ${layerLib} njebu korektnje zapřijaty.\x3cbr\x3e\x3cbr\x3eWuwiwarjo: Za pomoc ke korektnemu fungowanju worštow\n\x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3etu kliknyć\x3c/a\x3e",'scale':"Měritko = 1 : ${scaleDenom}",'W':"Z",'E':"W",'N':"S",'S':"J",'layerAlreadyAdded':"Sy spytał runinu ${layerName} karće dodać, ale je so hižo dodała",'reprojectDeprecated':"Wužiwaš opciju \"reproject\" wořšty ${layerName}. Tuta opcija je zestarjena: jeje wužiwanje bě myslene, zo by zwobraznjenje datow nad komercielnymi bazowymi kartami podpěrało, ale funkcionalnosć měła so nětko z pomocu Sperical Mercator docpěć. Dalše informacije steja na http://trac.openlayers.org/wiki/SphericalMercator k dispoziciji.",'methodDeprecated':"Tuta metoda je so njeschwaliła a budźe so w 3.0 wotstronjeć. Prošu wužij ${newMethod} město toho.",'boundsAddError':"Dyrbiš hódnotu x kaž tež y funkciji \"add\" přepodać.",'lonlatAddError':"Dyrbiš hódnotu lon kaž tež lat funkciji \"add\" přepodać.",'pixelAddError':"Dyrbiš hódnotu x kaž tež y funkciji \"add\" přepodać.",'unsupportedGeometryType':"Njepodpěrowany geometrijowy typ: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition je so njeporadźił: element z id ${elemId} bu snano wopak zaměstnjeny.",'filterEvaluateNotImplemented':"wuhódnoćenje njeje za tutón filtrowy typ implementowany."});OpenLayers.Lang["hu"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Nem kezelt kérés visszatérése ${statusText}",'permalink':"Permalink",'overlays':"Rávetítések",'baseLayer':"Alapréteg",'sameProjection':"Az áttekintő térkép csak abban az esetben működik, ha ugyanazon a vetületen van, mint a fő térkép.",'readNotImplemented':"Olvasás nincs végrehajtva.",'writeNotImplemented':"Írás nincs végrehajtva.",'noFID':"Nem frissíthető olyan jellemző, amely nem rendelkezik FID-del.",'errorLoadingGML':"Hiba GML-fájl betöltésekor ${url}",'browserNotSupported':"A böngészője nem támogatja a vektoros renderelést. A jelenleg támogatott renderelők:\n${renderers}",'componentShouldBe':"addFeatures : az összetevőnek ilyen típusúnak kell lennie: ${geomType}",'getFeatureError':"getFeatureFromEvent réteget hívott meg renderelő nélkül. Ez rendszerint azt jelenti, hogy megsemmisített egy fóliát, de néhány ahhoz társított kezelőt nem.",'minZoomLevelError':"A minZoomLevel tulajdonságot csak a következővel való használatra szánták: FixedZoomLevels-leszármazott fóliák. Ez azt jelenti, hogy a minZoomLevel wfs fólia jelölőnégyzetei már a múlté. Mi azonban nem távolíthatjuk el annak a veszélye nélkül, hogy az esetlegesen ettől függő OL alapú alkalmazásokat tönkretennénk. Ezért ezt érvénytelenítjük -- a minZoomLevel az alul levő jelölőnégyzet a 3.0-s verzióból el lesz távolítva. Kérjük, helyette használja a min/max felbontás beállítást, amelyről az alábbi helyen talál leírást: http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS tranzakció: SIKERES ${response}",'commitFailed':"WFS tranzakció: SIKERTELEN ${response}",'googleWarning':"A Google fólia betöltése sikertelen.\x3cbr\x3e\x3cbr\x3eAhhoz, hogy ez az üzenet eltűnjön, válasszon egy új BaseLayer fóliát a jobb felső sarokban található fóliakapcsoló segítségével.\x3cbr\x3e\x3cbr\x3eNagy valószínűséggel ez azért van, mert a Google Maps könyvtár parancsfájlja nem található, vagy nem tartalmazza az Ön oldalához tartozó megfelelő API-kulcsot.\x3cbr\x3e\x3cbr\x3eFejlesztőknek: A helyes működtetésre vonatkozó segítség az alábbi helyen érhető el, \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3ekattintson ide\x3c/a\x3e",'getLayerWarning':"A(z) ${layerType} fólia nem töltődött be helyesen.\x3cbr\x3e\x3cbr\x3eAhhoz, hogy ez az üzenet eltűnjön, válasszon egy új BaseLayer fóliát a jobb felső sarokban található fóliakapcsoló segítségével.\x3cbr\x3e\x3cbr\x3eNagy valószínűséggel ez azért van, mert a(z) ${layerLib} könyvtár parancsfájlja helytelen.\x3cbr\x3e\x3cbr\x3eFejlesztőknek: A helyes működtetésre vonatkozó segítség az alábbi helyen érhető el, \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3ekattintson ide\x3c/a\x3e",'scale':"Lépték = 1 : ${scaleDenom}",'W':"Ny",'E':"K",'N':"É",'S':"D",'layerAlreadyAdded':"Megpróbálta hozzáadni a(z) ${layerName} fóliát a térképhez, de az már hozzá van adva",'reprojectDeprecated':"Ön a \'reproject\' beállítást használja a(z) ${layerName} fólián. Ez a beállítás érvénytelen: használata az üzleti alaptérképek fölötti adatok megjelenítésének támogatására szolgált, de ezt a funkció ezentúl a Gömbi Mercator használatával érhető el. További információ az alábbi helyen érhető el: http://trac.openlayers.org/wiki/SphericalMercator",'methodDeprecated':"Ez a módszer érvénytelenítve lett és a 3.0-s verzióból el lesz távolítva. Használja a(z) ${newMethod} módszert helyette.",'boundsAddError':"Az x és y értékeknek egyaránt meg kell felelnie, hogy a funkciót hozzáadhassa.",'lonlatAddError':"A hossz. és szél. értékeknek egyaránt meg kell felelnie, hogy a funkciót hozzáadhassa.",'pixelAddError':"Az x és y értékeknek egyaránt meg kell felelnie, hogy a funkciót hozzáadhassa.",'unsupportedGeometryType':"Nem támogatott geometriatípus: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition sikertelen: lehetséges, hogy a(z) ${elemId} azonosítójú elem téves helyre került.",'filterEvaluateNotImplemented':"ennél a szűrőtípusnál kiértékelés nem hajtódik végre."});OpenLayers.Lang["ia"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Le responsa a un requesta non esseva maneate: ${statusText}",'permalink':"Permaligamine",'overlays':"Superpositiones",'baseLayer':"Strato de base",'sameProjection':"Le mini-carta functiona solmente si illo es in le mesme projection que le carta principal",'readNotImplemented':"Lectura non implementate.",'writeNotImplemented':"Scriptura non implementate.",'noFID':"Non pote actualisar un elemento sin FID.",'errorLoadingGML':"Error al cargamento del file GML ${url}",'browserNotSupported':"Tu navigator non supporta le rendition de vectores. Le renditores actualmente supportate es:\n${renderers}",'componentShouldBe':"addFeatures: le componente debe esser del typo ${geomType}",'getFeatureError':"getFeatureFromEvent ha essite appellate in un strato sin renditor. Isto significa generalmente que tu ha destruite un strato, ma lassava un gestor associate con illo.",'minZoomLevelError':"Le proprietate minZoomLevel es solmente pro uso con le stratos descendente de FixedZoomLevels. Le facto que iste strato WFS verifica minZoomLevel es un reliquia del passato. Nonobstante, si nos lo remove immediatemente, nos pote rumper applicationes a base de OL que depende de illo. Ergo nos lo declara obsolete; le verification de minZoomLevel in basso essera removite in version 3.0. Per favor usa in su loco le configuration de resolutiones min/max como describite a: http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transaction WFS: SUCCESSO ${response}",'commitFailed':"Transaction WFS: FALLEVA ${response}",'googleWarning':"Le strato Google non poteva esser cargate correctemente.\x3cbr\x3e\x3cbr\x3ePro disfacer te de iste message, selige un nove BaseLayer in le selector de strato in alto a dextra.\x3cbr\x3e\x3cbr\x3eMulto probabilemente, isto es proque le script del libreria de Google Maps non esseva includite o non contine le clave API correcte pro tu sito.\x3cbr\x3e\x3cbr\x3eDisveloppatores: Pro adjuta de corriger isto, \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3eclicca hic\x3c/a",'getLayerWarning':"Le strato ${layerType} non poteva esser cargate correctemente.\x3cbr\x3e\x3cbr\x3ePro disfacer te de iste message, selige un nove BaseLayer in le selector de strato in alto a dextra.\x3cbr\x3e\x3cbr\x3eMulto probabilemente, isto es proque le script del libreria de ${layerLib} non esseva correctemente includite.\x3cbr\x3e\x3cbr\x3eDisveloppatores: Pro adjuta de corriger isto, \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3eclicca hic\x3c/a\x3e",'scale':"Scala = 1 : ${scaleDenom}",'W':"W",'E':"E",'N':"N",'S':"S",'layerAlreadyAdded':"Tu tentava adder le strato: ${layerName} al carta, ma illo es ja presente",'reprojectDeprecated':"Tu usa le option \'reproject\' in le strato ${layerName} layer. Iste option es obsolescente: illo esseva pro poter monstrar datos super cartas de base commercial, ma iste functionalitate pote ora esser attingite con le uso de Spherical Mercator. Ulterior information es disponibile a http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Iste methodo ha essite declarate obsolescente e essera removite in version 3.0. Per favor usa ${newMethod} in su loco.",'boundsAddError':"Tu debe passar le duo valores x e y al function add.",'lonlatAddError':"Tu debe passar le duo valores lon e lat al function add.",'pixelAddError':"Tu debe passar le duo valores x e y al function add.",'unsupportedGeometryType':"Typo de geometria non supportate: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition falleva: le elemento con id ${elemId} pote esser mal placiate.",'filterEvaluateNotImplemented':"\"evaluate\" non es implementate pro iste typo de filtro."});OpenLayers.Lang["id"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Permintaan yang tak tertangani menghasilkan ${statusText}",'permalink':"Pranala permanen",'overlays':"Hamparan",'baseLayer':"Lapisan Dasar",'sameProjection':"Peta tinjauan hanya bekerja bila dalam proyeksi yang sama dengan peta utama",'readNotImplemented':"Membaca tidak diterapkan.",'writeNotImplemented':"Menyimpan tidak diterapkan.",'noFID':"Tidak dapat memperbarui fitur yang tidak memiliki FID.",'errorLoadingGML':"Kesalahan dalam memuat berkas GML ${url}",'browserNotSupported':"Peramban Anda tidak mendukung penggambaran vektor. Penggambar yang didukung saat ini adalah:\n${renderers}",'componentShouldBe':"addFeatures : komponen harus berupa ${geomType}",'getFeatureError':"getFeatureFromEvent diterapkan pada lapisan tanpa penggambar. Ini biasanya berarti Anda menghapus sebuah lapisan, tetapi tidak menghapus penangan yang terkait dengannya.",'minZoomLevelError':"Properti minZoomLevel hanya ditujukan bekerja dengan lapisan FixedZoomLevels-descendent. Pengecekan minZoomLevel oleh lapisan wfs adalah peninggalan masa lalu. Kami tidak dapat menghapusnya tanpa kemungkinan merusak aplikasi berbasis OL yang mungkin bergantung padanya. Karenanya, kami menganggapnya tidak berlaku -- Cek minZoomLevel di bawah ini akan dihapus pada 3.0. Silakan gunakan penyetelan resolusi min/maks seperti dijabarkan di sini: http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS Transaksi: BERHASIL ${respon}",'commitFailed':"WFS Transaksi: GAGAL ${respon}",'googleWarning':"Lapisan Google tidak dapat dimuat dengan benar.\x3cbr\x3e\x3cbr\x3eUntuk menghilangkan pesan ini, pilih suatu BaseLayer baru melalui penukar lapisan (layer switcher) di ujung kanan atas.\x3cbr\x3e\x3cbr\x3eKemungkinan besar ini karena pustaka skrip Google Maps tidak disertakan atau tidak mengandung kunci API yang tepat untuk situs Anda.\x3cbr\x3e\x3cbr\x3ePengembang: Untuk bantuan mengatasi masalah ini, \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3eklik di sini\x3c/a\x3e",'getLayerWarning':"Lapisan ${layerType} tidak dapat dimuat dengan benar.\x3cbr\x3e\x3cbr\x3eUntuk menghilangkan pesan ini, pilih suatu BaseLayer baru melalui penukar lapisan (layer switcher) di ujung kanan atas.\x3cbr\x3e\x3cbr\x3eKemungkinan besar ini karena pustaka skrip Google Maps tidak disertakan dengan benar.\x3cbr\x3e\x3cbr\x3ePengembang: Untuk bantuan mengatasi masalah ini, \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3eklik di sini\x3c/a\x3e",'scale':"Sekala = 1 : ${scaleDenom}",'W':"B",'E':"T",'N':"U",'S':"S",'layerAlreadyAdded':"Anda mencoba menambahkan lapisan: ${layerName} ke dalam peta, tapi lapisan itu telah ditambahkan",'reprojectDeprecated':"Anda menggunakan opsi \'reproject\' pada lapisan ${layerName}. Opsi ini telah ditinggalkan: penggunaannya dirancang untuk mendukung tampilan data melalui peta dasar komersial, tapi fungsionalitas tersebut saat ini harus dilakukan dengan menggunakan dukungan Spherical Mercator. Informasi lebih lanjut tersedia di http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Metode ini telah usang dan akan dihapus di 3.0. Sebaliknya, harap gunakan ${newMethod}.",'boundsAddError':"Anda harus memberikan kedua nilai x dan y ke fungsi penambah.",'lonlatAddError':"Anda harus memberikan kedua nilai lon dan lat ke fungsi penambah.",'pixelAddError':"Anda harus memberikan kedua nilai x dan y ke fungsi penambah.",'unsupportedGeometryType':"Tipe geometri tak didukung: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition gagal: elemen dengan id ${elemId} mungkin salah tempat.",'filterEvaluateNotImplemented':"evaluasi tidak tersedia untuk tipe filter ini."});OpenLayers.Lang["io"]=OpenLayers.Util.applyDefaults({'scale':"Skalo = 1 : ${scaleDenom}"});OpenLayers.Lang["is"]=OpenLayers.Util.applyDefaults({'permalink':"Varanlegur tengill",'overlays':"Þekjur",'baseLayer':"Grunnlag",'sameProjection':"Yfirlitskortið virkar aðeins ef það er í sömu vörpun og aðalkortið",'readNotImplemented':"Skrifun er óútfærð.",'writeNotImplemented':"Lestur er óútfærður.",'errorLoadingGML':"Villa kom upp við að hlaða inn GML skránni ${url}",'scale':"Skali = 1 : ${scaleDenom}",'layerAlreadyAdded':"Þú reyndir að bæta laginu ${layerName} á kortið en það er þegar búið að bæta því við",'methodDeprecated':"Þetta fall hefur verið úrelt og verður fjarlægt í 3.0. Notaðu ${newMethod} í staðin."});OpenLayers.Lang["ja"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"未処理の要求は ${statusText} を返します",'permalink':"パーマリンク",'overlays':"オーバーレイ",'baseLayer':"基底レイヤー",'sameProjection':"概観地図はメインの地図と同じ投影法をとる場合のみ機能します",'readNotImplemented':"読み込みは実装されていません。",'writeNotImplemented':"書き込みは実装されていません。",'noFID':"FID のない地物は更新できません。",'errorLoadingGML':"GML ファイル ${url} の読み込みエラー",'browserNotSupported':"あなたのブラウザはベクターグラフィックスの描写に対応していません。現時点で対応しているソフトウェアは以下のものです。\n${renderers}",'componentShouldBe':"addFeatures: 要素は ${geomType} であるべきです",'getFeatureError':"getFeatureFromEvent がレンダラーのないレイヤーから呼ばれました。通常、これはあなたがレイヤーを、それに関連づけられたいくつかのハンドラを除いて、破壊してしまったことを意味します。",'minZoomLevelError':"minZoomLevel プロパティは FixedZoomLevels を継承するレイヤーでの使用のみを想定しています。この minZoomLevel に対する WFS レイヤーの検査は歴史的なものです。しかしながら、この検査を除去するとそれに依存する OpenLayers ベースのアプリケーションを破壊してしまう可能性があります。よって廃止が予定されており、この minZoomLevel 検査はバージョン3.0で除去されます。代わりに、http://trac.openlayers.org/wiki/SettingZoomLevels で解説されている、最小および最大解像度設定を使用してください。",'commitSuccess':"WFS トランザクション: 成功 ${response}",'commitFailed':"WFS トランザクション: 失敗 ${response}",'googleWarning':"Google レイヤーが正しく読み込みを行えませんでした。\x3cbr\x3e\x3cbr\x3eこのメッセージを消すには、右上の隅にあるレイヤー切り替え部分で新しい基底レイヤーを選んでください。\x3cbr\x3e\x3cbr\x3eおそらく、これは Google マップ用ライブラリのスクリプトが組み込まれていないか、あなたのサイトに対応する正しい API キーが設定されていないためです。\x3cbr\x3e\x3cbr\x3e開発者の方へ: 正しい動作をさせるために\x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3eこちらのウィキ\x3c/a\x3eを参照してください。",'getLayerWarning':"${layerType} レイヤーが正しく読み込みを行えませんでした。\x3cbr\x3e\x3cbr\x3eこのメッセージを消すには、右上の隅にあるレイヤー切り替え部分で新しい基底レイヤーを選んでください。\x3cbr\x3e\x3cbr\x3eおそらく、これは ${layerLib} ライブラリのスクリプトが正しく組み込まれていないためです。\x3cbr\x3e\x3cbr\x3e開発者の方へ: 正しい動作をさせるために\x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3eこちらのウィキ\x3c/a\x3eを参照してください。",'scale':"縮尺 = 1 : ${scaleDenom}",'W':"西",'E':"東",'N':"北",'S':"南",'layerAlreadyAdded':"あなたは「${layerName}」を地図に追加しようと試みましたが、そのレイヤーは既に追加されています",'reprojectDeprecated':"あなたは「${layerName}」レイヤーで reproject オプションを使っています。このオプションは商用の基底地図上に情報を表示する目的で設計されましたが、現在ではその機能は Spherical Mercator サポートを利用して実現されており、このオプションの使用は非推奨です。追加の情報は http://trac.openlayers.org/wiki/SphericalMercator で入手できます。",'methodDeprecated':"このメソッドは廃止が予定されており、バージョン3.0で除去されます。代わりに ${newMethod} を使用してください。",'boundsAddError':"x と y 両方の値を add 関数に渡さなければなりません。",'lonlatAddError':"lon と lat 両方の値を add 関数に渡さなければなりません。",'pixelAddError':"x と y の値両方を add 関数に渡さなければなりません。",'unsupportedGeometryType':"未対応の形状型: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition が失敗しました: id ${elemId} をもつ要素が誤った位置にある可能性があります。",'filterEvaluateNotImplemented':"このフィルター型について evaluate は実装されていません。"});OpenLayers.Lang["km"]=OpenLayers.Util.applyDefaults({'permalink':"តំណភ្ជាប់អចិន្ត្រៃយ៍",'baseLayer':"ស្រទាប់បាត​",'errorLoadingGML':"កំហុសកំឡុងពេលផ្ទុកឯកសារ GML ${url}",'scale':"មាត្រដ្ឋាន = ១ ៖ ${scaleDenom}"});OpenLayers.Lang["ksh"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Met dä Antwoot op en Aanfrooch ham_mer nix aanjefange: ${statusText}",'permalink':"Lengk op Duuer",'overlays':"Drövver jelaat",'baseLayer':"Jrund-Nivoh",'sameProjection':"De Övverseeschs_Kaat deiht et bloß, wann se de sälve Projäxjuhn bruche deiht, wi de Houp_Kaat",'readNotImplemented':"„\x3ccode lang=\"en\"\x3eread\x3c/code\x3e“ is em Projramm nit fürjesinn.",'writeNotImplemented':"„\x3ccode lang=\"en\"\x3ewrite\x3c/code\x3e“ is em Projramm nit fürjesinn.",'noFID':"En Saach, woh kein \x3ci lang=\"en\"\x3eFID\x3c/i\x3e för doh es, löht sesch nit ändere.",'errorLoadingGML':"Fähler beim \x3ci lang=\"en\"\x3eGML\x3c/i\x3e-Datei-Laade vun \x3ccode\x3e${url}\x3c/code\x3e",'browserNotSupported':"Dinge Brauser kann kein Väktore ußjävve. De Zoote Ußjaabe, di em Momang jon, sen:\n${renderers}",'componentShouldBe':"\x3ccode lang=\"en\"\x3eaddFeatures\x3c/code\x3e: dä Aandeil sullt vun dä Zoot „\x3ccode lang=\"en\"\x3e${geomType}\x3c/code\x3e“ sin.",'getFeatureError':"\x3ccode lang=\"en\"\x3egetFeatureFromEvent\x3c/code\x3e es vun enem Nivoh opjeroofe woode, woh et kei Projramm zom Ußjävve jit. Dat bedügg för jewöhnlesch, dat De e Nivoh kapott jemaat häs, ävver nit e Projramm för domet ömzejonn, wat domet verbonge es.",'minZoomLevelError':"De Eijeschaff „\x3ccode lang=\"en\"\x3eminZoomLevel\x3c/code\x3e“ es bloß doför jedaach, dat mer se met dä Nivvohß bruch, di vun \x3ccode lang=\"en\"\x3eFixedZoomLevels\x3c/code\x3e affhange don. Dat dat \x3ci lang=\"en\"\x3eWFS\x3c/i\x3e-Nivvoh övverhoup de Eijeschaff „\x3ccode lang=\"en\"\x3eminZoomLevel\x3c/code\x3e“ pröhfe deiht, es noch övveresch vun fröhjer. Mer künne dat ävver jez nit fott lohße, oohne dat mer Jevaa loufe, dat Aanwendunge vun OpenLayers nit mieh loufe, di sesch doh velleijsch noch drop am verlohße sin. Dröm sare mer, dat mer et nit mieh han welle, un de „\x3ccode lang=\"en\"\x3eminZoomLevel\x3c/code\x3e“-Eijeschaff weed hee vun de Version 3.0 af nit mieh jeprööf wäde. Nemm doför de Enstellung för de hühßte un de kleinßte Oplöhsung, esu wi et en http://trac.openlayers.org/wiki/SettingZoomLevels opjeschrevve es.",'commitSuccess':"Dä \x3ci lang=\"en\"\x3eWFS\x3c/i\x3e-Vörjang es joot jeloufe: ${response}",'commitFailed':"Dä \x3ci lang=\"en\"\x3eWFS\x3c/i\x3e-Vörjang es scheif jejange: ${response}",'googleWarning':"Dat Nivvoh \x3ccode lang=\"en\"\x3eGoogle\x3c/code\x3e kunnt nit reschtesch jelaade wääde.\x3cbr /\x3e\x3cbr /\x3eÖm hee di Nohreesch loß ze krijje, donn en ander Jrund-Nivvoh ußsöhke, rähß bovve en de Äk.\x3cbr /\x3e\x3cbr /\x3eWascheinlesch es dat wiel dat \x3ci lang=\"en\"\x3eGoogle-Maps\x3c/i\x3e-Skrepp entweeder nit reschtesch enjebonge wood, udder nit dä reschtejje \x3ci lang=\"en\"\x3eAPI\x3c/i\x3e-Schlößel för Ding Web-ßait scheke deiht.\x3cbr /\x3e\x3cbr /\x3eFör Projrammierer jidd_et Hölp do_drövver, \x3ca href=\"http://trac.openlayers.org/wiki/Google\" target=\"_blank\"\x3ewi mer dat aan et Loufe brengk\x3c/a\x3e.",'getLayerWarning':"Dat Nivvoh \x3ccode\x3e${layerType}\x3c/code\x3e kunnt nit reschtesch jelaade wääde.\x3cbr /\x3e\x3cbr /\x3eÖm hee di Nohreesch loß ze krijje, donn en ander Jrund-Nivvoh ußsöhkre, rähß bovve en de Äk.\x3cbr /\x3e\x3cbr /\x3eWascheinlesch es dat, wiel dat Skrepp \x3ccode\x3e${layerLib}\x3c/code\x3e nit reschtesch enjebonge wood.\x3cbr /\x3e\x3cbr /\x3eFör Projrammierer jidd_Et Hölp do_drövver, \x3ca href=\"http://trac.openlayers.org/wiki/${layerLib}\" target=\"_blank\"\x3ewi mer dat aan et Loufe brengk\x3c/a\x3e.",'scale':"Mohßshtaab = 1 : ${scaleDenom}",'W':"W",'E':"O",'N':"N",'S':"S",'layerAlreadyAdded':"Do häß versöhk, dat Nivvoh \x3ccode\x3e${layerName}\x3c/code\x3e en di Kaat eren ze bränge, et wohr ävver ald do dren.",'reprojectDeprecated':"Do bruchs de Ußwahl \x3ccode\x3ereproject\x3c/code\x3e op däm Nivvoh \x3ccode\x3e${layerName}\x3c/code\x3e. Di Ußwahl es nit mieh jähn jesinn. Se wohr doför jedaach, öm Date op jeschääfsmäßesch eruß jejovve Kaate bovve drop ze moole, wat ävver enzwesche besser met dä Öngershtözung för de ßfääresche Mäkaator Beldscher jeiht. Doh kanns De mieh drövver fenge op dä Sigg: http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Hee di Metood es nim_mih aktoäll un et weed se en dä Version 3.0 nit mieh jävve. Nemm \x3ccode\x3e${newMethod}\x3c/code\x3e doföör.",'boundsAddError':"Do moß beeds vun de \x3ccode\x3ex\x3c/code\x3e un \x3ccode\x3ey\x3c/code\x3e Wääte aan de Fungkßjohn \x3ccode\x3eadd\x3c/code\x3e jävve.",'lonlatAddError':"Do moß beeds \x3ccode\x3elon\x3c/code\x3e un \x3ccode\x3elat\x3c/code\x3e aan de Fungkßjohn \x3ccode\x3eadd\x3c/code\x3e jävve.",'pixelAddError':"Do moß beeds \x3ccode\x3ex\x3c/code\x3e un \x3ccode\x3ey\x3c/code\x3e aan de Fungkßjohn \x3ccode\x3eadd\x3c/code\x3e jävve.",'unsupportedGeometryType':"De Zoot Jommetrii dom_mer nit ongershtöze: \x3ccode\x3e${geomType}\x3c/code\x3e",'pagePositionFailed':"\x3ccode lang=\"en\"\x3eOpenLayers.Util.pagePosition\x3c/code\x3e es donevve jejange: dat Denge met dä Kännong \x3ccode\x3e${elemId}\x3c/code\x3e künnt am verkeehte Plaz sin.",'filterEvaluateNotImplemented':"„\x3ccode lang=\"en\"\x3eevaluate\x3c/code\x3e“ es för di Zoot Fellter nit enjereschdt."});OpenLayers.Lang["nds"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Unbehannelt Trüchmellels för de Anfraag ${statusText}",'permalink':"Permalink",'overlays':"Overlays",'baseLayer':"Achtergrundkoort",'sameProjection':"De Översichtskoort geiht blot, wenn de sülve Projekschoon as bi de Hööftkoort bruukt warrt",'readNotImplemented':"Lesen is nich inricht.",'writeNotImplemented':"Schrieven is nich inricht.",'noFID':"En Feature, dat keen FID hett, kann nich aktuell maakt warrn.",'errorLoadingGML':"Fehler bi’t Laden vun de GML-Datei ${url}",'browserNotSupported':"Dien Browser ünnerstütt keen Vektorbiller. Ünnerstütt Renderers:\n${renderers}",'componentShouldBe':"addFeatures : Kumponent schull man den Typ ${geomType} hebben",'getFeatureError':"getFeatureFromEvent is von en Laag ahn Render opropen worrn. Dat bedüüdt normalerwies, dat en Laag wegmaakt worrn is, aver nich de Handler, de dor op verwiest.",'commitSuccess':"WFS-Transakschoon: hett klappt ${response}",'commitFailed':"WFS-Transakschoon: hett nich klappt ${response}",'scale':"Skaal = 1 : ${scaleDenom}",'layerAlreadyAdded':"Du versöchst de Laag „${layerName}“ to de Koort totofögen, man de is al toföögt",'methodDeprecated':"Disse Methood is oold un schall dat in 3.0 nich mehr geven. Bruuk dor man beter ${newMethod} för.",'boundsAddError':"De Weert x un y, de mööt all beid an de add-Funkschoon övergeven warrn.",'lonlatAddError':"De Weert lon un lat, de mööt all beid an de add-Funkschoon övergeven warrn.",'pixelAddError':"De Weert x un y, de mööt all beid an de add-Funkschoon övergeven warrn.",'unsupportedGeometryType':"Nich ünnerstütt Geometrie-Typ: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition güng nich: Element mit de Id ${elemId} is villicht an’n verkehrten Platz."});OpenLayers.Lang["nn"]=OpenLayers.Util.applyDefaults({'scale':"Skala = 1 : ${scaleDenom}",'layerAlreadyAdded':"Du freista å leggja til laget «${layerName}» på kartet, men det har alt vorte lagt til.",'boundsAddError':"Du er nøydd til å gje både ein x- og ein y-verdi til «add»-funksjonen.",'lonlatAddError':"Du er nøydd til å gje både lon- og lat-verdiar til «add»-funksjonen.",'pixelAddError':"Du er nøydd til å gje både ein x- og ein y-verdi til «add»-funksjonen."});OpenLayers.Lang["oc"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Requèsta pas gerida, retorna ${statusText}",'permalink':"Permaligam",'overlays':"Calques",'baseLayer':"Calc de basa",'sameProjection':"La carta de situacion fonciona pas que quora sa projeccion es la meteissa que la de la carta principala",'readNotImplemented':"Lectura pas implementada.",'writeNotImplemented':"Escritura pas implementada.",'noFID':"Impossible de metre a jorn un objècte sens identificant (fid).",'errorLoadingGML':"Error al cargament del fichièr GML ${url}",'browserNotSupported':"Vòstre navegidor supòrta pas lo rendut vectorial. Los renderers actualament suportats son : \n${renderers}",'componentShouldBe':"addFeatures : lo compausant deuriá èsser de tipe ${geomType}",'getFeatureError':"getFeatureFromEvent es estat apelat sus un calc sens renderer. Aquò significa generalament qu\'avètz destruch aqueste jaç, mas qu\'avètz conservat un handler que li èra associat.",'minZoomLevelError':"La proprietat minZoomLevel deu èsser utilizada solament per de jaces FixedZoomLevels-descendent. Lo fach qu\'aqueste jaç WFS verifique la preséncia de minZoomLevel es una relica del passat. Çaquelà, la podèm suprimir sens copar d\'aplicacions que ne poirián dependre. Es per aquò que la depreciam -- la verificacion del minZoomLevel serà suprimida en version 3.0. A la plaça, mercés d\'utilizar los paramètres de resolucions min/max tal coma descrich sus : http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transaccion WFS : SUCCES ${response}",'commitFailed':"Transaccion WFS : FRACAS ${response}",'googleWarning':"Lo jaç Google es pas estat en mesura de se cargar corrèctament.\x3cbr\x3e\x3cbr\x3ePer suprimir aqueste messatge, causissètz una BaseLayer novèla dins lo selector de jaç en naut a drecha.\x3cbr\x3e\x3cbr\x3eAquò es possiblament causat par la non-inclusion de la librariá Google Maps, o alara perque que la clau de l\'API correspond pas a vòstre site.\x3cbr\x3e\x3cbr\x3eDesvolopaires : per saber cossí corregir aquò, \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3eclicatz aicí\x3c/a\x3e",'getLayerWarning':"Lo jaç ${layerType} es pas en mesura de se cargar corrèctament.\x3cbr\x3e\x3cbr\x3ePer suprimir aqueste messatge, causissètz una BaseLayer novèla dins lo selector de jaç en naut a drecha.\x3cbr\x3e\x3cbr\x3eAquò es possiblament causat per la non-inclusion de la librariá ${layerLib}.\x3cbr\x3e\x3cbr\x3eDesvolopaires : per saber cossí corregir aquí, \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3eclicatz aicí\x3c/a\x3e",'scale':"Escala ~ 1 : ${scaleDenom}",'W':"O",'E':"È",'N':"N",'S':"S",'layerAlreadyAdded':"Avètz ensajat d\'apondre a la carta lo calc : ${layerName}, mas ja es present",'reprojectDeprecated':"Utilizatz l\'opcion \'reproject\' sul jaç ${layerName}. Aquesta opcion es despreciada : Son usatge permetiá d\'afichar de donadas al dessús de jaces raster comercials. Aquesta foncionalitat ara es suportada en utilizant lo supòrt de la projeccion Mercator Esferica. Mai d\'informacion es disponibla sus http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Aqueste metòde es despreciada, e serà suprimida a la version 3.0. Mercés d\'utilizar ${newMethod} a la plaça.",'boundsAddError':"Vos cal passar las doas valors x e y a la foncion add.",'lonlatAddError':"Vos cal passar las doas valors lon e lat a la foncion add.",'pixelAddError':"Vos cal passar las doas valors x e y a la foncion add.",'unsupportedGeometryType':"Tipe de geometria pas suportat : ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition a fracassat : l\'element d\'id ${elemId} poiriá èsser mal posicionat.",'filterEvaluateNotImplemented':"evaluar es pas encara estat implementat per aqueste tipe de filtre."});OpenLayers.Lang["pt"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Servidor devolveu erro não contemplado ${statusText}",'permalink':"Ligação permanente",'overlays':"Sobreposições",'baseLayer':"Camada Base",'sameProjection':"O mapa panorâmico só funciona quando está na mesma projeção que o mapa principal",'readNotImplemented':"Leitura não implementada.",'writeNotImplemented':"Escrita não implementada.",'noFID':"Não é possível atualizar um elemento para a qual não há FID.",'errorLoadingGML':"Erro ao carregar ficheiro GML ${url}",'browserNotSupported':"O seu navegador não suporta renderização vetorial. Actualmente os renderizadores suportados são:\n${renderers}",'componentShouldBe':"addFeatures: componente deve ser um(a) ${geomType}",'getFeatureError':"getFeatureFromEvent foi chamado numa camada sem renderizador. Isto normalmente significa que destruiu uma camada, mas não um manipulador \'\'(handler)\'\' que lhe está associado.",'minZoomLevelError':"A propriedade minZoomLevel só deve ser usada com as camadas descendentes da FixedZoomLevels. A verificação da propriedade por esta camada wfs é uma relíquia do passado. No entanto, não podemos removê-la sem correr o risco de afectar aplicações OL que dependam dela. Portanto, estamos a torná-la obsoleta -- a verificação minZoomLevel será removida na versão 3.0. Em vez dela, por favor, use as opções de resolução min/max descritas aqui: http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transacção WFS: SUCESSO ${response}",'commitFailed':"Transacção WFS: FALHOU ${response}",'googleWarning':"A Camada Google não foi correctamente carregada.\x3cbr\x3e\x3cbr\x3ePara deixar de receber esta mensagem, seleccione uma nova Camada-Base no \'\'switcher\'\' de camadas no canto superior direito.\x3cbr\x3e\x3cbr\x3eProvavelmente, isto acontece porque o \'\'script\'\' da biblioteca do Google Maps não foi incluído ou não contém a chave API correcta para o seu sítio.\x3cbr\x3e\x3cbr\x3eProgramadores: Para ajuda sobre como solucionar o problema \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3eclique aqui\x3c/a\x3e .",'getLayerWarning':"A camada ${layerType} não foi correctamente carregada.\x3cbr\x3e\x3cbr\x3ePara desactivar esta mensagem, seleccione uma nova Camada-Base no \'\'switcher\'\' de camadas no canto superior direito.\x3cbr\x3e\x3cbr\x3eProvavelmente, isto acontece porque o \'\'script\'\' da biblioteca ${layerLib} não foi incluído correctamente.\x3cbr\x3e\x3cbr\x3eProgramadores: Para ajuda sobre como solucionar o problema \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3eclique aqui\x3c/a\x3e .",'scale':"Escala = 1 : ${scaleDenom}",'W':"O",'E':"E",'N':"N",'S':"S",'layerAlreadyAdded':"Você tentou adicionar a camada: ${layerName} ao mapa, mas ela já tinha sido adicionada antes",'reprojectDeprecated':"Está usando a opção \'reproject\' na camada ${layerName}. Esta opção é obsoleta: foi concebida para permitir a apresentação de dados sobre mapas-base comerciais, mas esta funcionalidade é agora suportada pelo Mercator Esférico. Mais informação está disponível em http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Este método foi declarado obsoleto e será removido na versão 3.0. Por favor, use ${newMethod} em vez disso.",'boundsAddError':"Você deve passar tanto o valor x como o y à função de adição.",'lonlatAddError':"Você deve passar tanto o valor lon como o lat à função de adição.",'pixelAddError':"Você deve passar tanto o valor x como o y à função de adição.",'unsupportedGeometryType':"Tipo de geometria não suportado: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition falhou: o elemento com o id ${elemId} poderá estar mal-posicionado.",'filterEvaluateNotImplemented':"avaliar não está implementado para este tipo de filtro."});OpenLayers.Lang["ru"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Необработанный запрос вернул ${statusText}",'permalink':"Постоянная ссылка",'overlays':"Слои",'baseLayer':"Основной слой",'sameProjection':"Обзорная карта работает только тогда, когда имеет ту же проекцию, что и основная",'readNotImplemented':"Чтение не реализовано.",'writeNotImplemented':"Запись не реализована.",'noFID':"Невозможно обновить объект, для которого нет FID.",'errorLoadingGML':"Ошибка при загрузке файла GML ${url}",'browserNotSupported':"Ваш браузер не поддерживает векторную графику. На данный момент поддерживаются:\n${renderers}",'componentShouldBe':"addFeatures: компонент должен быть ${geomType}",'getFeatureError':"getFeatureFromEvent вызван для слоя без рендерера. Обычно это говорит о том, что вы уничтожили слой, но оставили связанный с ним обработчик.",'minZoomLevelError':"Свойство minZoomLevel предназначено только для использования со слоями, являющимися потомками FixedZoomLevels. То, что этот WFS-слой проверяется на minZoomLevel — реликт прошлого. Однако мы не можем удалить эту функцию, так как, возможно, от неё зависят некоторые основанные на OpenLayers приложения. Функция объявлена устаревшей — проверка minZoomLevel будет удалена в 3.0. Пожалуйста, используйте вместо неё настройку мин/макс разрешения, описанную здесь: http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Транзакция WFS: УСПЕШНО ${response}",'commitFailed':"Транзакция WFS: ОШИБКА ${response}",'googleWarning':"Слой Google не удалось нормально загрузить.\x3cbr\x3e\x3cbr\x3eЧтобы избавиться от этого сообщения, выбите другой основной слой в переключателе в правом верхнем углу.\x3cbr\x3e\x3cbr\x3eСкорее всего, причина в том, что библиотека Google Maps не была включена или не содержит корректного API-ключа для вашего сайта.\x3cbr\x3e\x3cbr\x3eРазработчикам: чтобы узнать, как сделать, чтобы всё заработало, \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3eщёлкните тут\x3c/a\x3e",'getLayerWarning':"Слой ${layerType} не удалось нормально загрузить. \x3cbr\x3e\x3cbr\x3eЧтобы избавиться от этого сообщения, выбите другой основной слой в переключателе в правом верхнем углу.\x3cbr\x3e\x3cbr\x3eСкорее всего, причина в том, что библиотека ${layerLib} не была включена или была включена некорректно.\x3cbr\x3e\x3cbr\x3eРазработчикам: чтобы узнать, как сделать, чтобы всё заработало, \x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3eщёлкните тут\x3c/a\x3e",'scale':"Масштаб = 1 : ${scaleDenom}",'W':"З",'E':"В",'N':"С",'S':"Ю",'layerAlreadyAdded':"Вы попытались добавить слой «${layerName}» на карту, но он уже был добавлен",'reprojectDeprecated':"Вы используете опцию \'reproject\' для слоя ${layerName}. Эта опция является устаревшей: ее использование предполагалось для поддержки показа данных поверх коммерческих базовых карт, но теперь этот функционал несёт встроенная поддержка сферической проекции Меркатора. Больше сведений доступно на http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Этот метод считается устаревшим и будет удалён в версии 3.0. Пожалуйста, пользуйтесь ${newMethod}.",'boundsAddError':"Функции add надо передавать оба значения, x и y.",'lonlatAddError':"Функции add надо передавать оба значения, lon и lat.",'pixelAddError':"Функции add надо передавать оба значения, x и y.",'unsupportedGeometryType':"Неподдерживаемый тип геометрии: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition failed: элемент с id ${elemId} может находиться не в нужном месте.",'filterEvaluateNotImplemented':"evaluate не реализовано для фильтра данного типа."});OpenLayers.Lang["sk"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Neobslúžené požiadavky vracajú ${statusText}",'permalink':"Trvalý odkaz",'overlays':"Prekrytia",'baseLayer':"Základná vrstva",'sameProjection':"Prehľadová mapka funguje iba vtedy, keď je v rovnakej projekcii ako hlavná mapa",'readNotImplemented':"Čítanie nie je implementované.",'writeNotImplemented':"Zápis nie je implementovaný.",'noFID':"Nie je možné aktualizovať vlastnosť, pre ktorú neexistuje FID.",'errorLoadingGML':"Chyba pri načítaní súboru GML ${url}",'browserNotSupported':"Váš prehliadač nepodporuje vykresľovanie vektorov. Momentálne podporované vykresľovače sú:\n${renderers}",'componentShouldBe':"addFeatures: komponent by mal byť ${geomType}",'getFeatureError':"getFeatureFromEvent bola zavolaná na vrstve bez vykresľovača. To zvyčajne znamená, že ste odstránili vrstvu, ale nie niektorú z obslúh, ktorá je s ňou asociovaná.",'minZoomLevelError':"Vlastnosť minZoomLevel je určený iba na použitie s vrstvami odvodenými od FixedZoomLevels. To, že táto wfs vrstva kontroluje minZoomLevel je pozostatok z minulosti. Nemôžeme ho však odstrániť, aby sme sa vyhli možnému porušeniu aplikácií založených na Open Layers, ktoré na tomto môže závisieť. Preto ho označujeme ako zavrhovaný - dolu uvedená kontrola minZoomLevel bude odstránená vo verzii 3.0. Použite prosím namiesto toho kontrolu min./max. rozlíšenia podľa tu uvedeného popisu: http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transakcia WFS: ÚSPEŠNÁ ${response}",'commitFailed':"Transakcia WFS: ZLYHALA ${response}",'googleWarning':"Vrstvu Google nebolo možné správne načítať.\x3cbr\x3e\x3cbr\x3eAby ste sa tejto správy zbavili vyberte novú BaseLayer v prepínači vrstiev v pravom hornom rohu.\x3cbr\x3e\x3cbr\x3eToto sa stalo pravdepodobne preto, že skript knižnice Google Maps buď nebol načítaný alebo neobsahuje správny kľúč API pre vašu lokalitu.\x3cbr\x3e\x3cbr\x3eVývojári: Tu môžete získať \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3epomoc so sfunkčnením\x3c/a\x3e",'getLayerWarning':"Vrstvu ${layerType} nebolo možné správne načítať.\x3cbr\x3e\x3cbr\x3eAby ste sa tejto správy zbavili vyberte novú BaseLayer v prepínači vrstiev v pravom hornom rohu.\x3cbr\x3e\x3cbr\x3eToto sa stalo pravdepodobne preto, že skript knižnice ${layerType} buď nebol načítaný alebo neobsahuje správny kľúč API pre vašu lokalitu.\x3cbr\x3e\x3cbr\x3eVývojári: Tu môžete získať \x3ca href=\'http://trac.openlayers.org/wiki/${layerType}\' target=\'_blank\'\x3epomoc so sfunkčnením\x3c/a\x3e",'scale':"Mierka = 1 : ${scaleDenom}",'layerAlreadyAdded':"Pokúsili ste sa do mapy pridať vrstvu ${layerName}, ale tá už bola pridaná",'reprojectDeprecated':"Používate voľby „reproject“ vrstvy ${layerType}. Táto voľba je zzavrhovaná: jej použitie bolo navrhnuté na podporu zobrazovania údajov nad komerčnými základovými mapami, ale túto funkcionalitu je teraz možné dosiahnuť pomocou Spherical Mercator. Ďalšie informácie získate na stránke http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Táto metóda je zavrhovaná a bude odstránená vo verzii 3.0. Použite prosím namiesto nej metódu ${newMethod}.",'boundsAddError':"Sčítacej funkcii musíte dať hodnoty x aj y.",'lonlatAddError':"Sčítacej funkcii musíte dať hodnoty lon (zem. dĺžka) aj lat (zem. šírka).",'pixelAddError':"Sčítacej funkcii musíte dať hodnoty x aj y.",'unsupportedGeometryType':"Nepodporovaný typ geometrie: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition zlyhalo: prvok s id ${elemId} môže byť zle umiestnený.",'filterEvaluateNotImplemented':"evaluate nie je implementovaný pre tento typ filtra"});OpenLayers.Lang["te"]=OpenLayers.Util.applyDefaults({'permalink':"స్థిరలింకు",'W':"ప",'E':"తూ",'N':"ఉ",'S':"ద"});OpenLayers.Lang["vi"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Không xử lý được phản hồi ${statusText} cho yêu cầu",'permalink':"Liên kết thường trực",'overlays':"Lấp bản đồ",'baseLayer':"Lớp nền",'sameProjection':"Bản đồ toàn cảnh chỉ hoạt động khi cùng phép chiếu với bản đồ chính",'readNotImplemented':"Chưa hỗ trợ chức năng đọc.",'writeNotImplemented':"Chưa hỗ trợ chức năng viết.",'noFID':"Không thể cập nhật tính năng thiếu FID.",'errorLoadingGML':"Lỗi tải tập tin GML tại ${url}",'browserNotSupported':"Trình duyệt của bạn không hỗ trợ chức năng vẽ bằng vectơ. Hiện hỗ trợ các bộ kết xuất:\n${renderers}",'componentShouldBe':"addFeatures: bộ phận cần phải là ${geomType}",'getFeatureError':"getFeatureFromEvent được gọi từ lớp không có bộ kết xuất. Thường thì có lẽ lớp bị xóa nhưng một phần xử lý của nó vẫn còn.",'minZoomLevelError':"Chỉ nên sử dụng thuộc tính minZoomLevel với các lớp FixedZoomLevels-descendent. Việc lớp wfs này tìm cho minZoomLevel là di tích còn lại từ xưa. Tuy nhiên, nếu chúng tôi dời nó thì sẽ vỡ các chương trình OpenLayers mà dựa trên nó. Bởi vậy chúng tôi phản đối sử dụng nó\x26nbsp;– bước tìm cho minZoomLevel sẽ được dời vào phiên bản 3.0. Xin sử dụng thiết lập độ phân tích tối thiểu / tối đa thay thế, theo hướng dẫn này: http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Giao dịch WFS: THÀNH CÔNG ${response}",'commitFailed':"Giao dịch WFS: THẤT BẠI ${response}",'googleWarning':"Không thể tải lớp Google đúng đắn.\x3cbr\x3e\x3cbr\x3eĐể tránh thông báo này lần sau, hãy chọn BaseLayer mới dùng điều khiển chọn lớp ở góc trên phải.\x3cbr\x3e\x3cbr\x3eChắc script thư viện Google Maps hoặc không được bao gồm hoặc không chứa khóa API hợp với website của bạn.\x3cbr\x3e\x3cbr\x3e\x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3eTrợ giúp về tính năng này\x3c/a\x3e cho người phát triển.",'getLayerWarning':"Không thể tải lớp ${layerType} đúng đắn.\x3cbr\x3e\x3cbr\x3eĐể tránh thông báo này lần sau, hãy chọn BaseLayer mới dùng điều khiển chọn lớp ở góc trên phải.\x3cbr\x3e\x3cbr\x3eChắc script thư viện ${layerLib} không được bao gồm đúng kiểu.\x3cbr\x3e\x3cbr\x3e\x3ca href=\'http://trac.openlayers.org/wiki/${layerLib}\' target=\'_blank\'\x3eTrợ giúp về tính năng này\x3c/a\x3e cho người phát triển.",'scale':"Tỷ lệ = 1 : ${scaleDenom}",'W':"T",'E':"Đ",'N':"B",'S':"N",'layerAlreadyAdded':"Bạn muốn thêm lớp ${layerName} vào bản đồ, nhưng lớp này đã được thêm",'reprojectDeprecated':"Bạn đang áp dụng chế độ “reproject” vào lớp ${layerName}. Chế độ này đã bị phản đối: nó có mục đích hỗ trợ lấp dữ liệu trên các nền bản đồ thương mại; nên thực hiện hiệu ứng đó dùng tính năng Mercator Hình cầu. Có sẵn thêm chi tiết tại http://trac.openlayers.org/wiki/SphericalMercator .",'methodDeprecated':"Phương thức này đã bị phản đối và sẽ bị dời vào phiên bản 3.0. Xin hãy sử dụng ${newMethod} thay thế.",'boundsAddError':"Cần phải cho cả giá trị x và y vào hàm add.",'lonlatAddError':"Cần phải cho cả giá trị lon và lat vào hàm add.",'pixelAddError':"Cần phải cho cả giá trị x và y vào hàm add.",'unsupportedGeometryType':"Không hỗ trợ kiểu địa lý: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition bị thất bại: nguyên tố với ID ${elemId} có thể ở chỗ sai.",'filterEvaluateNotImplemented':"chưa hỗ trợ evaluate cho loại bộ lọc này."});OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:false,initialize:function(id,lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback){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(px){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);this.setContentHTML();this.setBackgroundColor();this.setOpacity();return this.div;},updateRelativePosition:function(){this.setRicoCorners();},setSize:function(contentSize){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.setRicoCorners();},setBackgroundColor:function(color){if(color!=undefined){this.backgroundColor=color;}  
if(this.div!=null){if(this.contentDiv!=null){this.div.style.background="transparent";OpenLayers.Rico.Corner.changeColor(this.groupDiv,this.backgroundColor);}}},setOpacity:function(opacity){OpenLayers.Popup.Anchored.prototype.setOpacity.call(this,opacity);if(this.div!=null){if(this.groupDiv!=null){OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,this.opacity);}}},setBorder:function(border){this.border=0;},setRicoCorners:function(){var corners=this.getCornersToRound(this.relativePosition);var options={corners:corners,color:this.backgroundColor,bgColor:"transparent",blend:false};if(!this.rounded){OpenLayers.Rico.Corner.round(this.div,options);this.rounded=true;}else{OpenLayers.Rico.Corner.reRound(this.groupDiv,options);this.setBackgroundColor();this.setOpacity();}},getCornersToRound:function(){var corners=['tl','tr','bl','br'];var corner=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(corners,corner);return corners.join(" ");},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;OpenLayers.Popup.Framed=OpenLayers.Class(OpenLayers.Popup.Anchored,{imageSrc:null,imageSize:null,isAlphaImage:false,positionBlocks:null,blocks:null,fixedRelativePosition:false,initialize:function(id,lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback){OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);if(this.fixedRelativePosition){this.updateRelativePosition();this.calculateRelativePosition=function(px){return this.relativePosition;};}  
this.contentDiv.style.position="absolute";this.contentDiv.style.zIndex=1;if(closeBox){this.closeDiv.style.zIndex=1;}  
this.groupDiv.style.position="absolute";this.groupDiv.style.top="0px";this.groupDiv.style.left="0px";this.groupDiv.style.height="100%";this.groupDiv.style.width="100%";},destroy:function(){this.imageSrc=null;this.imageSize=null;this.isAlphaImage=null;this.fixedRelativePosition=false;this.positionBlocks=null;for(var i=0;i<this.blocks.length;i++){var block=this.blocks[i];if(block.image){block.div.removeChild(block.image);}  
block.image=null;if(block.div){this.groupDiv.removeChild(block.div);}  
block.div=null;}  
this.blocks=null;OpenLayers.Popup.Anchored.prototype.destroy.apply(this,arguments);},setBackgroundColor:function(color){},setBorder:function(){},setOpacity:function(opacity){},setSize:function(contentSize){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.updateBlocks();},updateRelativePosition:function(){this.padding=this.positionBlocks[this.relativePosition].padding;if(this.closeDiv){var contentDivPadding=this.getContentDivPadding();this.closeDiv.style.right=contentDivPadding.right+  
this.padding.right+"px";this.closeDiv.style.top=contentDivPadding.top+  
this.padding.top+"px";}  
this.updateBlocks();},calculateNewPx:function(px){var newPx=OpenLayers.Popup.Anchored.prototype.calculateNewPx.apply(this,arguments);newPx=newPx.offset(this.positionBlocks[this.relativePosition].offset);return newPx;},createBlocks:function(){this.blocks=[];var firstPosition=null;for(var key in this.positionBlocks){firstPosition=key;break;}  
var position=this.positionBlocks[firstPosition];for(var i=0;i<position.blocks.length;i++){var block={};this.blocks.push(block);var divId=this.id+'_FrameDecorationDiv_'+i;block.div=OpenLayers.Util.createDiv(divId,null,null,null,"absolute",null,"hidden",null);var imgId=this.id+'_FrameDecorationImg_'+i;var imageCreator=(this.isAlphaImage)?OpenLayers.Util.createAlphaImageDiv:OpenLayers.Util.createImage;block.image=imageCreator(imgId,null,this.imageSize,this.imageSrc,"absolute",null,null,null);block.div.appendChild(block.image);this.groupDiv.appendChild(block.div);}},updateBlocks:function(){if(!this.blocks){this.createBlocks();}  
if(this.size&&this.relativePosition){var position=this.positionBlocks[this.relativePosition];for(var i=0;i<position.blocks.length;i++){var positionBlock=position.blocks[i];var block=this.blocks[i];var l=positionBlock.anchor.left;var b=positionBlock.anchor.bottom;var r=positionBlock.anchor.right;var t=positionBlock.anchor.top;var w=(isNaN(positionBlock.size.w))?this.size.w-(r+l):positionBlock.size.w;var h=(isNaN(positionBlock.size.h))?this.size.h-(b+t):positionBlock.size.h;block.div.style.width=(w<0?0:w)+'px';block.div.style.height=(h<0?0:h)+'px';block.div.style.left=(l!=null)?l+'px':'';block.div.style.bottom=(b!=null)?b+'px':'';block.div.style.right=(r!=null)?r+'px':'';block.div.style.top=(t!=null)?t+'px':'';block.image.style.left=positionBlock.position.x+'px';block.image.style.top=positionBlock.position.y+'px';}  
this.contentDiv.style.left=this.padding.left+"px";this.contentDiv.style.top=this.padding.top+"px";}},CLASS_NAME:"OpenLayers.Popup.Framed"});OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,initialize:function(projCode,options){OpenLayers.Util.extend(this,options);this.projCode=projCode;if(window.Proj4js){this.proj=new Proj4js.Proj(projCode);}},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(projection){if(projection&&projection.getCode){return this.getCode()==projection.getCode();}else{return false;}},destroy:function(){delete this.proj;delete this.projCode;},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};OpenLayers.Projection.addTransform=function(from,to,method){if(!OpenLayers.Projection.transforms[from]){OpenLayers.Projection.transforms[from]={};}  
OpenLayers.Projection.transforms[from][to]=method;};OpenLayers.Projection.transform=function(point,source,dest){if(source.proj&&dest.proj){point=Proj4js.transform(source.proj,dest.proj,point);}else if(source&&dest&&OpenLayers.Projection.transforms[source.getCode()]&&OpenLayers.Projection.transforms[source.getCode()][dest.getCode()]){OpenLayers.Projection.transforms[source.getCode()][dest.getCode()](point);}  
return point;};OpenLayers.Protocol.WFS.v1=OpenLayers.Class(OpenLayers.Protocol,{version:null,srsName:"EPSG:4326",featureType:null,featureNS:null,geometryName:"the_geom",schema:null,featurePrefix:"feature",formatOptions:null,readFormat:null,initialize:function(options){OpenLayers.Protocol.prototype.initialize.apply(this,[options]);if(!options.format){this.format=OpenLayers.Format.WFST(OpenLayers.Util.extend({version:this.version,featureType:this.featureType,featureNS:this.featureNS,featurePrefix:this.featurePrefix,geometryName:this.geometryName,srsName:this.srsName,schema:this.schema},this.formatOptions));}  
if(!this.featureNS&&this.featurePrefix){var readNode=this.format.readNode;this.format.readNode=function(node,obj){if(!this.featureNS&&node.prefix==this.featurePrefix){this.featureNS=node.namespaceURI;this.setNamespace("feature",this.featureNS);}  
return readNode.apply(this,arguments);};}},destroy:function(){if(this.options&&!this.options.format){this.format.destroy();}  
this.format=null;OpenLayers.Protocol.prototype.destroy.apply(this);},read:function(options){OpenLayers.Protocol.prototype.read.apply(this,arguments);options=OpenLayers.Util.extend({},options);OpenLayers.Util.applyDefaults(options,this.options||{});var response=new OpenLayers.Protocol.Response({requestType:"read"});var data=OpenLayers.Format.XML.prototype.write.apply(this.format,[this.format.writeNode("wfs:GetFeature",options)]);response.priv=OpenLayers.Request.POST({url:options.url,callback:this.createCallback(this.handleRead,response,options),params:options.params,headers:options.headers,data:data});return response;},handleRead:function(response,options){if(options.callback){var request=response.priv;if(request.status>=200&&request.status<300){response.features=this.parseFeatures(request);response.code=OpenLayers.Protocol.Response.SUCCESS;}else{response.code=OpenLayers.Protocol.Response.FAILURE;}  
options.callback.call(options.scope,response);}},parseFeatures:function(request){var doc=request.responseXML;if(!doc||!doc.documentElement){doc=request.responseText;}  
if(!doc||doc.length<=0){return null;}  
return(this.readFormat!==null)?this.readFormat.read(doc):this.format.read(doc);},commit:function(features,options){options=OpenLayers.Util.extend({},options);OpenLayers.Util.applyDefaults(options,this.options);var response=new OpenLayers.Protocol.Response({requestType:"commit",reqFeatures:features});response.priv=OpenLayers.Request.POST({url:options.url,data:this.format.write(features,options),callback:this.createCallback(this.handleCommit,response,options)});return response;},handleCommit:function(response,options){if(options.callback){var request=response.priv;var data=request.responseXML;if(!data||!data.documentElement){data=request.responseText;}  
var obj=this.format.read(data)||{};response.insertIds=obj.insertIds||[];response.code=(obj.success)?OpenLayers.Protocol.Response.SUCCESS:OpenLayers.Protocol.Response.FAILURE;options.callback.call(options.scope,response);}},filterDelete:function(filter,options){options=OpenLayers.Util.extend({},options);OpenLayers.Util.applyDefaults(options,this.options);var response=new OpenLayers.Protocol.Response({requestType:"commit"});var root=this.format.createElementNSPlus("wfs:Transaction",{attributes:{service:"WFS",version:this.version}});var deleteNode=this.format.createElementNSPlus("wfs:Delete",{attributes:{typeName:(options.featureNS?this.featurePrefix+":":"")+  
options.featureType}});if(options.featureNS){deleteNode.setAttribute("xmlns:"+this.featurePrefix,options.featureNS);}  
var filterNode=this.format.writeNode("ogc:Filter",filter);deleteNode.appendChild(filterNode);root.appendChild(deleteNode);var data=OpenLayers.Format.XML.prototype.write.apply(this.format,[root]);return OpenLayers.Request.POST({url:this.url,callback:options.callback||function(){},data:data});},abort:function(response){if(response){response.priv.abort();}},CLASS_NAME:"OpenLayers.Protocol.WFS.v1"});OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15000,translationParameters:null,symbolMetrics:null,isGecko:null,supportUse:null,initialize:function(containerID){if(!this.supported()){return;}  
OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.translationParameters={x:0,y:0};this.supportUse=(navigator.userAgent.toLowerCase().indexOf("applewebkit/5")==-1);this.isGecko=(navigator.userAgent.toLowerCase().indexOf("gecko/")!=-1);this.symbolMetrics={};},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments);},supported:function(){var svgFeature="http://www.w3.org/TR/SVG11/feature#";return(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(svgFeature+"SVG","1.1")||document.implementation.hasFeature(svgFeature+"BasicStructure","1.1")));},inValidRange:function(x,y,xyOnly){var left=x+(xyOnly?0:this.translationParameters.x);var top=y+(xyOnly?0:this.translationParameters.y);return(left>=-this.MAX_PIXEL&&left<=this.MAX_PIXEL&&top>=-this.MAX_PIXEL&&top<=this.MAX_PIXEL);},setExtent:function(extent,resolutionChanged){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var resolution=this.getResolution();var left=-extent.left/resolution;var top=extent.top/resolution;if(resolutionChanged){this.left=left;this.top=top;var extentString="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",extentString);this.translate(0,0);return true;}else{var inRange=this.translate(left-this.left,top-this.top);if(!inRange){this.setExtent(extent,true);}  
return inRange;}},translate:function(x,y){if(!this.inValidRange(x,y,true)){return false;}else{var transformString="";if(x||y){transformString="translate("+x+","+y+")";}  
this.root.setAttributeNS(null,"transform",transformString);this.translationParameters={x:x,y:y};return true;}},setSize:function(size){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h);},getNodeType:function(geometry,style){var nodeType=null;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.externalGraphic){nodeType="image";}else if(this.isComplexSymbol(style.graphicName)){nodeType=this.supportUse===false?"svg":"use";}else{nodeType="circle";}  
break;case"OpenLayers.Geometry.Rectangle":nodeType="rect";break;case"OpenLayers.Geometry.LineString":nodeType="polyline";break;case"OpenLayers.Geometry.LinearRing":nodeType="polygon";break;case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":nodeType="path";break;default:break;}  
return nodeType;},setStyle:function(node,style,options){style=style||node._style;options=options||node._options;var r=parseFloat(node.getAttributeNS(null,"r"));var widthFactor=1;var pos;if(node._geometryClass=="OpenLayers.Geometry.Point"&&r){node.style.visibility="";if(style.graphic===false){node.style.visibility="hidden";}else if(style.externalGraphic){pos=this.getPosition(node);if(style.graphicTitle){node.setAttributeNS(null,"title",style.graphicTitle);}  
if(style.graphicWidth&&style.graphicHeight){node.setAttributeNS(null,"preserveAspectRatio","none");}  
var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var xOffset=(style.graphicXOffset!=undefined)?style.graphicXOffset:-(0.5*width);var yOffset=(style.graphicYOffset!=undefined)?style.graphicYOffset:-(0.5*height);var opacity=style.graphicOpacity||style.fillOpacity;node.setAttributeNS(null,"x",(pos.x+xOffset).toFixed());node.setAttributeNS(null,"y",(pos.y+yOffset).toFixed());node.setAttributeNS(null,"width",width);node.setAttributeNS(null,"height",height);node.setAttributeNS(this.xlinkns,"href",style.externalGraphic);node.setAttributeNS(null,"style","opacity: "+opacity);}else if(this.isComplexSymbol(style.graphicName)){var offset=style.pointRadius*3;var size=offset*2;var id=this.importSymbol(style.graphicName);pos=this.getPosition(node);widthFactor=this.symbolMetrics[id][0]*3/size;var parent=node.parentNode;var nextSibling=node.nextSibling;if(parent){parent.removeChild(node);}  
if(this.supportUse===false){var src=document.getElementById(id);node.firstChild&&node.removeChild(node.firstChild);node.appendChild(src.firstChild.cloneNode(true));node.setAttributeNS(null,"viewBox",src.getAttributeNS(null,"viewBox"));}else{node.setAttributeNS(this.xlinkns,"href","#"+id);}  
node.setAttributeNS(null,"width",size);node.setAttributeNS(null,"height",size);node.setAttributeNS(null,"x",pos.x-offset);node.setAttributeNS(null,"y",pos.y-offset);if(nextSibling){parent.insertBefore(node,nextSibling);}else if(parent){parent.appendChild(node);}}else{node.setAttributeNS(null,"r",style.pointRadius);}  
var rotation=style.rotation;if((rotation!==undefined||node._rotation!==undefined)&&pos){node._rotation=rotation;rotation|=0;if(node.nodeName!=="svg"){node.setAttributeNS(null,"transform","rotate("+rotation+" "+pos.x+" "+  
pos.y+")");}else{var metrics=this.symbolMetrics[id];node.firstChild.setAttributeNS(null,"transform","rotate("+style.rotation+" "+metrics[1]+" "+metrics[2]+")");}}}  
if(options.isFilled){node.setAttributeNS(null,"fill",style.fillColor);node.setAttributeNS(null,"fill-opacity",style.fillOpacity);}else{node.setAttributeNS(null,"fill","none");}  
if(options.isStroked){node.setAttributeNS(null,"stroke",style.strokeColor);node.setAttributeNS(null,"stroke-opacity",style.strokeOpacity);node.setAttributeNS(null,"stroke-width",style.strokeWidth*widthFactor);node.setAttributeNS(null,"stroke-linecap",style.strokeLinecap||"round");node.setAttributeNS(null,"stroke-linejoin","round");style.strokeDashstyle&&node.setAttributeNS(null,"stroke-dasharray",this.dashStyle(style,widthFactor));}else{node.setAttributeNS(null,"stroke","none");}  
if(style.pointerEvents){node.setAttributeNS(null,"pointer-events",style.pointerEvents);}  
if(style.cursor!=null){node.setAttributeNS(null,"cursor",style.cursor);}  
return node;},dashStyle:function(style,widthFactor){var w=style.strokeWidth*widthFactor;var str=style.strokeDashstyle;switch(str){case'solid':return'none';case'dot':return[1,4*w].join();case'dash':return[4*w,4*w].join();case'dashdot':return[4*w,4*w,1,4*w].join();case'longdash':return[8*w,4*w].join();case'longdashdot':return[8*w,4*w,1,4*w].join();default:return OpenLayers.String.trim(str).replace(/\s+/g,",");}},createNode:function(type,id){var node=document.createElementNS(this.xmlns,type);if(id){node.setAttributeNS(null,"id",id);}  
return node;},nodeTypeCompare:function(node,type){return(type==node.nodeName);},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_svgRoot","svg");},createRoot:function(suffix){return this.nodeFactory(this.container.id+suffix,"g");},createDefs:function(){var defs=this.nodeFactory(this.container.id+"_defs","defs");this.rendererRoot.appendChild(defs);return defs;},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1);},drawCircle:function(node,geometry,radius){var resolution=this.getResolution();var x=(geometry.x/resolution+this.left);var y=(this.top-geometry.y/resolution);if(this.inValidRange(x,y)){node.setAttributeNS(null,"cx",x);node.setAttributeNS(null,"cy",y);node.setAttributeNS(null,"r",radius);return node;}else{return false;}},drawLineString:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return(componentsResult.complete?node:null);}else{return false;}},drawLinearRing:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return(componentsResult.complete?node:null);}else{return false;}},drawPolygon:function(node,geometry){var d="";var draw=true;var complete=true;var linearRingResult,path;for(var j=0,len=geometry.components.length;j<len;j++){d+=" M";linearRingResult=this.getComponentsString(geometry.components[j].components," ");path=linearRingResult.path;if(path){d+=" "+path;complete=linearRingResult.complete&&complete;}else{draw=false;}}  
d+=" z";if(draw){node.setAttributeNS(null,"d",d);node.setAttributeNS(null,"fill-rule","evenodd");return complete?node:null;}else{return false;}},drawRectangle:function(node,geometry){var resolution=this.getResolution();var x=(geometry.x/resolution+this.left);var y=(this.top-geometry.y/resolution);if(this.inValidRange(x,y)){node.setAttributeNS(null,"x",x);node.setAttributeNS(null,"y",y);node.setAttributeNS(null,"width",geometry.width/resolution);node.setAttributeNS(null,"height",geometry.height/resolution);return node;}else{return false;}},drawSurface:function(node,geometry){var d=null;var draw=true;for(var i=0,len=geometry.components.length;i<len;i++){if((i%3)==0&&(i/3)==0){var component=this.getShortString(geometry.components[i]);if(!component){draw=false;}  
d="M "+component;}else if((i%3)==1){var component=this.getShortString(geometry.components[i]);if(!component){draw=false;}  
d+=" C "+component;}else{var component=this.getShortString(geometry.components[i]);if(!component){draw=false;}  
d+=" "+component;}}  
d+=" Z";if(draw){node.setAttributeNS(null,"d",d);return node;}else{return false;}},drawText:function(featureId,style,location){var resolution=this.getResolution();var x=(location.x/resolution+this.left);var y=(location.y/resolution-this.top);var label=this.nodeFactory(featureId+this.LABEL_ID_SUFFIX,"text");var tspan=this.nodeFactory(featureId+this.LABEL_ID_SUFFIX+"_tspan","tspan");label.setAttributeNS(null,"x",x);label.setAttributeNS(null,"y",-y);if(style.fontColor){label.setAttributeNS(null,"fill",style.fontColor);}  
if(style.fontOpacity){label.setAttributeNS(null,"opacity",style.fontOpacity);}  
if(style.fontFamily){label.setAttributeNS(null,"font-family",style.fontFamily);}  
if(style.fontSize){label.setAttributeNS(null,"font-size",style.fontSize);}  
if(style.fontWeight){label.setAttributeNS(null,"font-weight",style.fontWeight);}  
if(style.labelSelect===true){label.setAttributeNS(null,"pointer-events","visible");label._featureId=featureId;tspan._featureId=featureId;tspan._geometry=location;tspan._geometryClass=location.CLASS_NAME;}else{label.setAttributeNS(null,"pointer-events","none");}  
var align=style.labelAlign||"cm";label.setAttributeNS(null,"text-anchor",OpenLayers.Renderer.SVG.LABEL_ALIGN[align[0]]||"middle");if(this.isGecko){label.setAttributeNS(null,"dominant-baseline",OpenLayers.Renderer.SVG.LABEL_ALIGN[align[1]]||"central");}else{tspan.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[align[1]]||"-35%");}  
tspan.textContent=style.label;if(!label.parentNode){label.appendChild(tspan);this.textRoot.appendChild(label);}},getComponentsString:function(components,separator){var renderCmp=[];var complete=true;var len=components.length;var strings=[];var str,component;for(var i=0;i<len;i++){component=components[i];renderCmp.push(component);str=this.getShortString(component);if(str){strings.push(str);}else{if(i>0){if(this.getShortString(components[i-1])){strings.push(this.clipLine(components[i],components[i-1]));}}  
if(i<len-1){if(this.getShortString(components[i+1])){strings.push(this.clipLine(components[i],components[i+1]));}}  
complete=false;}}  
return{path:strings.join(separator||","),complete:complete};},clipLine:function(badComponent,goodComponent){if(goodComponent.equals(badComponent)){return"";}  
var resolution=this.getResolution();var maxX=this.MAX_PIXEL-this.translationParameters.x;var maxY=this.MAX_PIXEL-this.translationParameters.y;var x1=goodComponent.x/resolution+this.left;var y1=this.top-goodComponent.y/resolution;var x2=badComponent.x/resolution+this.left;var y2=this.top-badComponent.y/resolution;var k;if(x2<-maxX||x2>maxX){k=(y2-y1)/(x2-x1);x2=x2<0?-maxX:maxX;y2=y1+(x2-x1)*k;}  
if(y2<-maxY||y2>maxY){k=(x2-x1)/(y2-y1);y2=y2<0?-maxY:maxY;x2=x1+(y2-y1)*k;}  
return x2+","+y2;},getShortString:function(point){var resolution=this.getResolution();var x=(point.x/resolution+this.left);var y=(this.top-point.y/resolution);if(this.inValidRange(x,y)){return x+","+y;}else{return false;}},getPosition:function(node){return({x:parseFloat(node.getAttributeNS(null,"cx")),y:parseFloat(node.getAttributeNS(null,"cy"))});},importSymbol:function(graphicName){if(!this.defs){this.defs=this.createDefs();}  
var id=this.container.id+"-"+graphicName;if(document.getElementById(id)!=null){return id;}  
var symbol=OpenLayers.Renderer.symbol[graphicName];if(!symbol){throw new Error(graphicName+' is not a valid symbol name');}  
var symbolNode=this.nodeFactory(id,"symbol");var node=this.nodeFactory(null,"polygon");symbolNode.appendChild(node);var symbolExtent=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var points=[];var x,y;for(var i=0;i<symbol.length;i=i+2){x=symbol[i];y=symbol[i+1];symbolExtent.left=Math.min(symbolExtent.left,x);symbolExtent.bottom=Math.min(symbolExtent.bottom,y);symbolExtent.right=Math.max(symbolExtent.right,x);symbolExtent.top=Math.max(symbolExtent.top,y);points.push(x,",",y);}  
node.setAttributeNS(null,"points",points.join(" "));var width=symbolExtent.getWidth();var height=symbolExtent.getHeight();var viewBox=[symbolExtent.left-width,symbolExtent.bottom-height,width*3,height*3];symbolNode.setAttributeNS(null,"viewBox",viewBox.join(" "));this.symbolMetrics[id]=[Math.max(width,height),symbolExtent.getCenterLonLat().lon,symbolExtent.getCenterLonLat().lat];this.defs.appendChild(symbolNode);return symbolNode.id;},getFeatureIdFromEvent:function(evt){var featureId=OpenLayers.Renderer.Elements.prototype.getFeatureIdFromEvent.apply(this,arguments);if(this.supportUse===false&&!featureId){var target=evt.target;featureId=target.parentNode&&target!=this.rendererRoot&&target.parentNode._featureId;}  
return featureId;},CLASS_NAME:"OpenLayers.Renderer.SVG"});OpenLayers.Renderer.SVG.LABEL_ALIGN={"l":"start","r":"end","b":"bottom","t":"hanging"};OpenLayers.Renderer.SVG.LABEL_VSHIFT={"t":"-70%","b":"0"};OpenLayers.Renderer.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(containerID){if(!this.supported()){return;}  
if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);var style=document.createStyleSheet();var shapes=['shape','rect','oval','fill','stroke','imagedata','group','textbox'];for(var i=0,len=shapes.length;i<len;i++){style.addRule('olv\\:'+shapes[i],"behavior: url(#default#VML); "+"position: absolute; display: inline-block;");}}  
OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments);},supported:function(){return!!(document.namespaces);},setExtent:function(extent,resolutionChanged){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var resolution=this.getResolution();var left=(extent.left/resolution)|0;var top=(extent.top/resolution-this.size.h)|0;if(resolutionChanged||!this.offset){this.offset={x:left,y:top};left=0;top=0;}else{left=left-this.offset.x;top=top-this.offset.y;}  
var org=left+" "+top;this.root.coordorigin=org;var roots=[this.root,this.vectorRoot,this.textRoot];var root;for(var i=0,len=roots.length;i<len;++i){root=roots[i];var size=this.size.w+" "+this.size.h;root.coordsize=size;}  
this.root.style.flip="y";return true;},setSize:function(size){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);var roots=[this.rendererRoot,this.root,this.vectorRoot,this.textRoot];var w=this.size.w+"px";var h=this.size.h+"px";var root;for(var i=0,len=roots.length;i<len;++i){root=roots[i];root.style.width=w;root.style.height=h;}},getNodeType:function(geometry,style){var nodeType=null;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.externalGraphic){nodeType="olv:rect";}else if(this.isComplexSymbol(style.graphicName)){nodeType="olv:shape";}else{nodeType="olv:oval";}  
break;case"OpenLayers.Geometry.Rectangle":nodeType="olv:rect";break;case"OpenLayers.Geometry.LineString":case"OpenLayers.Geometry.LinearRing":case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":nodeType="olv:shape";break;default:break;}  
return nodeType;},setStyle:function(node,style,options,geometry){style=style||node._style;options=options||node._options;var fillColor=style.fillColor;if(node._geometryClass==="OpenLayers.Geometry.Point"){if(style.externalGraphic){if(style.graphicTitle){node.title=style.graphicTitle;}  
var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var resolution=this.getResolution();var xOffset=(style.graphicXOffset!=undefined)?style.graphicXOffset:-(0.5*width);var yOffset=(style.graphicYOffset!=undefined)?style.graphicYOffset:-(0.5*height);node.style.left=(((geometry.x/resolution-this.offset.x)+xOffset)|0)+"px";node.style.top=(((geometry.y/resolution-this.offset.y)-(yOffset+height))|0)+"px";node.style.width=width+"px";node.style.height=height+"px";node.style.flip="y";fillColor="none";options.isStroked=false;}else if(this.isComplexSymbol(style.graphicName)){var cache=this.importSymbol(style.graphicName);node.path=cache.path;node.coordorigin=cache.left+","+cache.bottom;var size=cache.size;node.coordsize=size+","+size;this.drawCircle(node,geometry,style.pointRadius);node.style.flip="y";}else{this.drawCircle(node,geometry,style.pointRadius);}}  
if(options.isFilled){node.fillcolor=fillColor;}else{node.filled="false";}  
var fills=node.getElementsByTagName("fill");var fill=(fills.length==0)?null:fills[0];if(!options.isFilled){if(fill){node.removeChild(fill);}}else{if(!fill){fill=this.createNode('olv:fill',node.id+"_fill");}  
fill.opacity=style.fillOpacity;if(node._geometryClass==="OpenLayers.Geometry.Point"&&style.externalGraphic){if(style.graphicOpacity){fill.opacity=style.graphicOpacity;}  
fill.src=style.externalGraphic;fill.type="frame";if(!(style.graphicWidth&&style.graphicHeight)){fill.aspect="atmost";}}  
if(fill.parentNode!=node){node.appendChild(fill);}}  
var rotation=style.rotation;if((rotation!==undefined||node._rotation!==undefined)){node._rotation=rotation;if(style.externalGraphic){this.graphicRotate(node,xOffset,yOffset,style);fill.opacity=0;}else if(node._geometryClass==="OpenLayers.Geometry.Point"){node.style.rotation=rotation||0;}}  
var strokes=node.getElementsByTagName("stroke");var stroke=(strokes.length==0)?null:strokes[0];if(!options.isStroked){node.stroked=false;if(stroke){stroke.on=false;}}else{if(!stroke){stroke=this.createNode('olv:stroke',node.id+"_stroke");node.appendChild(stroke);}  
stroke.on=true;stroke.color=style.strokeColor;stroke.weight=style.strokeWidth+"px";stroke.opacity=style.strokeOpacity;stroke.endcap=style.strokeLinecap=='butt'?'flat':(style.strokeLinecap||'round');if(style.strokeDashstyle){stroke.dashstyle=this.dashStyle(style);}}  
if(style.cursor!="inherit"&&style.cursor!=null){node.style.cursor=style.cursor;}  
return node;},graphicRotate:function(node,xOffset,yOffset,style){var style=style||node._style;var rotation=style.rotation||0;var aspectRatio,size;if(!(style.graphicWidth&&style.graphicHeight)){var img=new Image();img.onreadystatechange=OpenLayers.Function.bind(function(){if(img.readyState=="complete"||img.readyState=="interactive"){aspectRatio=img.width/img.height;size=Math.max(style.pointRadius*2,style.graphicWidth||0,style.graphicHeight||0);xOffset=xOffset*aspectRatio;style.graphicWidth=size*aspectRatio;style.graphicHeight=size;this.graphicRotate(node,xOffset,yOffset,style);}},this);img.src=style.externalGraphic;return;}else{size=Math.max(style.graphicWidth,style.graphicHeight);aspectRatio=style.graphicWidth/style.graphicHeight;}  
var width=Math.round(style.graphicWidth||size*aspectRatio);var height=Math.round(style.graphicHeight||size);node.style.width=width+"px";node.style.height=height+"px";var image=document.getElementById(node.id+"_image");if(!image){image=this.createNode("olv:imagedata",node.id+"_image");node.appendChild(image);}  
image.style.width=width+"px";image.style.height=height+"px";image.src=style.externalGraphic;image.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader("+"src='', sizingMethod='scale')";var rot=rotation*Math.PI/180;var sintheta=Math.sin(rot);var costheta=Math.cos(rot);var filter="progid:DXImageTransform.Microsoft.Matrix(M11="+costheta+",M12="+(-sintheta)+",M21="+sintheta+",M22="+costheta+",SizingMethod='auto expand')\n";var opacity=style.graphicOpacity||style.fillOpacity;if(opacity&&opacity!=1){filter+="progid:DXImageTransform.Microsoft.BasicImage(opacity="+  
opacity+")\n";}  
node.style.filter=filter;var centerPoint=new OpenLayers.Geometry.Point(-xOffset,-yOffset);var imgBox=new OpenLayers.Bounds(0,0,width,height).toGeometry();imgBox.rotate(style.rotation,centerPoint);var imgBounds=imgBox.getBounds();node.style.left=Math.round(parseInt(node.style.left)+imgBounds.left)+"px";node.style.top=Math.round(parseInt(node.style.top)-imgBounds.bottom)+"px";},postDraw:function(node){node.style.visibility="visible";var fillColor=node._style.fillColor;var strokeColor=node._style.strokeColor;if(fillColor=="none"&&node.fillcolor!=fillColor){node.fillcolor=fillColor;}  
if(strokeColor=="none"&&node.strokecolor!=strokeColor){node.strokecolor=strokeColor;}},setNodeDimension:function(node,geometry){var bbox=geometry.getBounds();if(bbox){var resolution=this.getResolution();var scaledBox=new OpenLayers.Bounds((bbox.left/resolution-this.offset.x)|0,(bbox.bottom/resolution-this.offset.y)|0,(bbox.right/resolution-this.offset.x)|0,(bbox.top/resolution-this.offset.y)|0);node.style.left=scaledBox.left+"px";node.style.top=scaledBox.top+"px";node.style.width=scaledBox.getWidth()+"px";node.style.height=scaledBox.getHeight()+"px";node.coordorigin=scaledBox.left+" "+scaledBox.top;node.coordsize=scaledBox.getWidth()+" "+scaledBox.getHeight();}},dashStyle:function(style){var dash=style.strokeDashstyle;switch(dash){case'solid':case'dot':case'dash':case'dashdot':case'longdash':case'longdashdot':return dash;default:var parts=dash.split(/[ ,]/);if(parts.length==2){if(1*parts[0]>=2*parts[1]){return"longdash";}  
return(parts[0]==1||parts[1]==1)?"dot":"dash";}else if(parts.length==4){return(1*parts[0]>=2*parts[1])?"longdashdot":"dashdot";}  
return"solid";}},createNode:function(type,id){var node=document.createElement(type);if(id){node.id=id;}  
node.unselectable='on';node.onselectstart=OpenLayers.Function.False;return node;},nodeTypeCompare:function(node,type){var subType=type;var splitIndex=subType.indexOf(":");if(splitIndex!=-1){subType=subType.substr(splitIndex+1);}  
var nodeName=node.nodeName;splitIndex=nodeName.indexOf(":");if(splitIndex!=-1){nodeName=nodeName.substr(splitIndex+1);}  
return(subType==nodeName);},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div");},createRoot:function(suffix){return this.nodeFactory(this.container.id+suffix,"olv:group");},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1);},drawCircle:function(node,geometry,radius){if(!isNaN(geometry.x)&&!isNaN(geometry.y)){var resolution=this.getResolution();node.style.left=(((geometry.x/resolution-this.offset.x)|0)-radius)+"px";node.style.top=(((geometry.y/resolution-this.offset.y)|0)-radius)+"px";var diameter=radius*2;node.style.width=diameter+"px";node.style.height=diameter+"px";return node;}  
return false;},drawLineString:function(node,geometry){return this.drawLine(node,geometry,false);},drawLinearRing:function(node,geometry){return this.drawLine(node,geometry,true);},drawLine:function(node,geometry,closeLine){this.setNodeDimension(node,geometry);var resolution=this.getResolution();var numComponents=geometry.components.length;var parts=new Array(numComponents);var comp,x,y;for(var i=0;i<numComponents;i++){comp=geometry.components[i];x=(comp.x/resolution-this.offset.x)|0;y=(comp.y/resolution-this.offset.y)|0;parts[i]=" "+x+","+y+" l ";}  
var end=(closeLine)?" x e":" e";node.path="m"+parts.join("")+end;return node;},drawPolygon:function(node,geometry){this.setNodeDimension(node,geometry);var resolution=this.getResolution();var path=[];var linearRing,i,j,len,ilen,comp,x,y;for(j=0,len=geometry.components.length;j<len;j++){linearRing=geometry.components[j];path.push("m");for(i=0,ilen=linearRing.components.length;i<ilen;i++){comp=linearRing.components[i];x=(comp.x/resolution-this.offset.x)|0;y=(comp.y/resolution-this.offset.y)|0;path.push(" "+x+","+y);if(i==0){path.push(" l");}}  
path.push(" x ");}  
path.push("e");node.path=path.join("");return node;},drawRectangle:function(node,geometry){var resolution=this.getResolution();node.style.left=((geometry.x/resolution-this.offset.x)|0)+"px";node.style.top=((geometry.y/resolution-this.offset.y)|0)+"px";node.style.width=((geometry.width/resolution)|0)+"px";node.style.height=((geometry.height/resolution)|0)+"px";return node;},drawText:function(featureId,style,location){var label=this.nodeFactory(featureId+this.LABEL_ID_SUFFIX,"olv:rect");var textbox=this.nodeFactory(featureId+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox");var resolution=this.getResolution();label.style.left=((location.x/resolution-this.offset.x)|0)+"px";label.style.top=((location.y/resolution-this.offset.y)|0)+"px";label.style.flip="y";textbox.innerText=style.label;if(style.fontColor){textbox.style.color=style.fontColor;}  
if(style.fontOpacity){textbox.style.filter='alpha(opacity='+(style.fontOpacity*100)+')';}  
if(style.fontFamily){textbox.style.fontFamily=style.fontFamily;}  
if(style.fontSize){textbox.style.fontSize=style.fontSize;}  
if(style.fontWeight){textbox.style.fontWeight=style.fontWeight;}  
if(style.labelSelect===true){label._featureId=featureId;textbox._featureId=featureId;textbox._geometry=location;textbox._geometryClass=location.CLASS_NAME;}  
textbox.style.whiteSpace="nowrap";textbox.inset="1px,0px,0px,0px";if(!label.parentNode){label.appendChild(textbox);this.textRoot.appendChild(label);}  
var align=style.labelAlign||"cm";if(align.length==1){align+="m";}  
var xshift=textbox.clientWidth*(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(0,1)]);var yshift=textbox.clientHeight*(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(1,1)]);label.style.left=parseInt(label.style.left)-xshift-1+"px";label.style.top=parseInt(label.style.top)+yshift+"px";},drawSurface:function(node,geometry){this.setNodeDimension(node,geometry);var resolution=this.getResolution();var path=[];var comp,x,y;for(var i=0,len=geometry.components.length;i<len;i++){comp=geometry.components[i];x=(comp.x/resolution-this.offset.x)|0;y=(comp.y/resolution-this.offset.y)|0;if((i%3)==0&&(i/3)==0){path.push("m");}else if((i%3)==1){path.push(" c");}  
path.push(" "+x+","+y);}  
path.push(" x e");node.path=path.join("");return node;},moveRoot:function(renderer){var layer=this.map.getLayer(renderer.container.id);if(layer instanceof OpenLayers.Layer.Vector.RootContainer){layer=this.map.getLayer(this.container.id);}  
layer&&layer.renderer.clear();OpenLayers.Renderer.Elements.prototype.moveRoot.apply(this,arguments);layer&&layer.redraw();},importSymbol:function(graphicName){var id=this.container.id+"-"+graphicName;var cache=this.symbolCache[id];if(cache){return cache;}  
var symbol=OpenLayers.Renderer.symbol[graphicName];if(!symbol){throw new Error(graphicName+' is not a valid symbol name');}  
var symbolExtent=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var pathitems=["m"];for(var i=0;i<symbol.length;i=i+2){var x=symbol[i];var y=symbol[i+1];symbolExtent.left=Math.min(symbolExtent.left,x);symbolExtent.bottom=Math.min(symbolExtent.bottom,y);symbolExtent.right=Math.max(symbolExtent.right,x);symbolExtent.top=Math.max(symbolExtent.top,y);pathitems.push(x);pathitems.push(y);if(i==0){pathitems.push("l");}}  
pathitems.push("x e");var path=pathitems.join(" ");var diff=(symbolExtent.getWidth()-symbolExtent.getHeight())/2;if(diff>0){symbolExtent.bottom=symbolExtent.bottom-diff;symbolExtent.top=symbolExtent.top+diff;}else{symbolExtent.left=symbolExtent.left+diff;symbolExtent.right=symbolExtent.right-diff;}  
cache={path:path,size:symbolExtent.getWidth(),left:symbolExtent.left,bottom:symbolExtent.bottom};this.symbolCache[id]=cache;return cache;},CLASS_NAME:"OpenLayers.Renderer.VML"});OpenLayers.Renderer.VML.LABEL_SHIFT={"l":0,"c":.5,"r":1,"t":0,"m":.5,"b":1};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(layer,position,bounds,url,size){this.layer=layer;this.position=position.clone();this.bounds=bounds.clone();this.url=url;this.size=size.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(obj){if(obj==null){obj=new OpenLayers.Tile(this.layer,this.position,this.bounds,this.url,this.size);}  
OpenLayers.Util.applyDefaults(obj,this);return obj;},draw:function(){var maxExtent=this.layer.maxExtent;var withinMaxExtent=(maxExtent&&this.bounds.intersectsBounds(maxExtent,false));this.shouldDraw=(withinMaxExtent||this.layer.displayOutsideMaxExtent);this.clear();return this.shouldDraw;},moveTo:function(bounds,position,redraw){if(redraw==null){redraw=true;}  
this.bounds=bounds.clone();this.position=position.clone();if(redraw){this.draw();}},clear:function(){},getBoundsFromBaseLayer:function(position){var msg=OpenLayers.i18n('reprojectDeprecated',{'layerName':this.layer.name});OpenLayers.Console.warn(msg);var topLeft=this.layer.map.getLonLatFromLayerPx(position);var bottomRightPx=position.clone();bottomRightPx.x+=this.size.w;bottomRightPx.y+=this.size.h;var bottomRight=this.layer.map.getLonLatFromLayerPx(bottomRightPx);if(topLeft.lon>bottomRight.lon){if(topLeft.lon<0){topLeft.lon=-180-(topLeft.lon+180);}else{bottomRight.lon=180+bottomRight.lon+180;}}  
var bounds=new OpenLayers.Bounds(topLeft.lon,bottomRight.lat,bottomRight.lon,topLeft.lat);return bounds;},showTile:function(){if(this.shouldDraw){this.show();}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Control.MouseToolbar=OpenLayers.Class(OpenLayers.Control.MouseDefaults,{mode:null,buttons:null,direction:"vertical",buttonClicked:null,initialize:function(position,direction){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.position=new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,OpenLayers.Control.MouseToolbar.Y);if(position){this.position=position;}  
if(direction){this.direction=direction;}  
this.measureDivs=[];},destroy:function(){for(var btnId in this.buttons){var btn=this.buttons[btnId];btn.map=null;btn.events.destroy();}  
OpenLayers.Control.MouseDefaults.prototype.destroy.apply(this,arguments);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);OpenLayers.Control.MouseDefaults.prototype.draw.apply(this,arguments);this.buttons={};var sz=new OpenLayers.Size(28,28);var centered=new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,0);this._addButton("zoombox","drag-rectangle-off.png","drag-rectangle-on.png",centered,sz,"Shift->Drag to zoom to area");centered=centered.add((this.direction=="vertical"?0:sz.w),(this.direction=="vertical"?sz.h:0));this._addButton("pan","panning-hand-off.png","panning-hand-on.png",centered,sz,"Drag the map to pan.");centered=centered.add((this.direction=="vertical"?0:sz.w),(this.direction=="vertical"?sz.h:0));this.switchModeTo("pan");return this.div;},_addButton:function(id,img,activeImg,xy,sz,title){var imgLocation=OpenLayers.Util.getImagesLocation()+img;var activeImgLocation=OpenLayers.Util.getImagesLocation()+activeImg;var btn=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MouseToolbar_"+id,xy,sz,imgLocation,"absolute");this.div.appendChild(btn);btn.imgLocation=imgLocation;btn.activeImgLocation=activeImgLocation;btn.events=new OpenLayers.Events(this,btn,null,true);btn.events.on({"mousedown":this.buttonDown,"mouseup":this.buttonUp,"dblclick":OpenLayers.Event.stop,scope:this});btn.action=id;btn.title=title;btn.alt=title;btn.map=this.map;this.buttons[id]=btn;return btn;},buttonDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}  
this.buttonClicked=evt.element.action;OpenLayers.Event.stop(evt);},buttonUp:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}  
if(this.buttonClicked!=null){if(this.buttonClicked==evt.element.action){this.switchModeTo(evt.element.action);}  
OpenLayers.Event.stop(evt);this.buttonClicked=null;}},defaultDblClick:function(evt){this.switchModeTo("pan");this.performedDrag=false;var newCenter=this.map.getLonLatFromViewPortPx(evt.xy);this.map.setCenter(newCenter,this.map.zoom+1);OpenLayers.Event.stop(evt);return false;},defaultMouseDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}  
this.mouseDragStart=evt.xy.clone();this.performedDrag=false;this.startViaKeyboard=false;if(evt.shiftKey&&this.mode!="zoombox"){this.switchModeTo("zoombox");this.startViaKeyboard=true;}else if(evt.altKey&&this.mode!="measure"){this.switchModeTo("measure");}else if(!this.mode){this.switchModeTo("pan");}  
switch(this.mode){case"zoombox":this.map.div.style.cursor="crosshair";this.zoomBox=OpenLayers.Util.createDiv('zoomBox',this.mouseDragStart,null,null,"absolute","2px solid red");this.zoomBox.style.backgroundColor="white";this.zoomBox.style.filter="alpha(opacity=50)";this.zoomBox.style.opacity="0.50";this.zoomBox.style.fontSize="1px";this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE["Popup"]-1;this.map.viewPortDiv.appendChild(this.zoomBox);this.performedDrag=true;break;case"measure":var distance="";if(this.measureStart){var measureEnd=this.map.getLonLatFromViewPortPx(this.mouseDragStart);distance=OpenLayers.Util.distVincenty(this.measureStart,measureEnd);distance=Math.round(distance*100)/100;distance=distance+"km";this.measureStartBox=this.measureBox;}  
this.measureStart=this.map.getLonLatFromViewPortPx(this.mouseDragStart);;this.measureBox=OpenLayers.Util.createDiv(null,this.mouseDragStart.add(-2-parseInt(this.map.layerContainerDiv.style.left),-2-parseInt(this.map.layerContainerDiv.style.top)),null,null,"absolute");this.measureBox.style.width="4px";this.measureBox.style.height="4px";this.measureBox.style.fontSize="1px";this.measureBox.style.backgroundColor="red";this.measureBox.style.zIndex=this.map.Z_INDEX_BASE["Popup"]-1;this.map.layerContainerDiv.appendChild(this.measureBox);if(distance){this.measureBoxDistance=OpenLayers.Util.createDiv(null,this.mouseDragStart.add(-2-parseInt(this.map.layerContainerDiv.style.left),2-parseInt(this.map.layerContainerDiv.style.top)),null,null,"absolute");this.measureBoxDistance.innerHTML=distance;this.measureBoxDistance.style.zIndex=this.map.Z_INDEX_BASE["Popup"]-1;this.map.layerContainerDiv.appendChild(this.measureBoxDistance);this.measureDivs.push(this.measureBoxDistance);}  
this.measureBox.style.zIndex=this.map.Z_INDEX_BASE["Popup"]-1;this.map.layerContainerDiv.appendChild(this.measureBox);this.measureDivs.push(this.measureBox);break;default:this.map.div.style.cursor="move";break;}  
document.onselectstart=OpenLayers.Function.False;OpenLayers.Event.stop(evt);},switchModeTo:function(mode){if(mode!=this.mode){if(this.mode&&this.buttons[this.mode]){OpenLayers.Util.modifyAlphaImageDiv(this.buttons[this.mode],null,null,null,this.buttons[this.mode].imgLocation);}  
if(this.mode=="measure"&&mode!="measure"){for(var i=0,len=this.measureDivs.length;i<len;i++){if(this.measureDivs[i]){this.map.layerContainerDiv.removeChild(this.measureDivs[i]);}}  
this.measureDivs=[];this.measureStart=null;}  
this.mode=mode;if(this.buttons[mode]){OpenLayers.Util.modifyAlphaImageDiv(this.buttons[mode],null,null,null,this.buttons[mode].activeImgLocation);}  
switch(this.mode){case"zoombox":this.map.div.style.cursor="crosshair";break;default:this.map.div.style.cursor="";break;}}},leaveMode:function(){this.switchModeTo("pan");},defaultMouseMove:function(evt){if(this.mouseDragStart!=null){switch(this.mode){case"zoombox":var deltaX=Math.abs(this.mouseDragStart.x-evt.xy.x);var deltaY=Math.abs(this.mouseDragStart.y-evt.xy.y);this.zoomBox.style.width=Math.max(1,deltaX)+"px";this.zoomBox.style.height=Math.max(1,deltaY)+"px";if(evt.xy.x<this.mouseDragStart.x){this.zoomBox.style.left=evt.xy.x+"px";}  
if(evt.xy.y<this.mouseDragStart.y){this.zoomBox.style.top=evt.xy.y+"px";}  
break;default:var deltaX=this.mouseDragStart.x-evt.xy.x;var deltaY=this.mouseDragStart.y-evt.xy.y;var size=this.map.getSize();var newXY=new OpenLayers.Pixel(size.w/2+deltaX,size.h/2+deltaY);var newCenter=this.map.getLonLatFromViewPortPx(newXY);this.map.setCenter(newCenter,null,true);this.mouseDragStart=evt.xy.clone();}  
this.performedDrag=true;}},defaultMouseUp:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}  
switch(this.mode){case"zoombox":this.zoomBoxEnd(evt);if(this.startViaKeyboard){this.leaveMode();}  
break;case"pan":if(this.performedDrag){this.map.setCenter(this.map.center);}}  
document.onselectstart=null;this.mouseDragStart=null;this.map.div.style.cursor="default";},defaultMouseOut:function(evt){if(this.mouseDragStart!=null&&OpenLayers.Util.mouseLeft(evt,this.map.div)){if(this.zoomBox){this.removeZoomBox();if(this.startViaKeyboard){this.leaveMode();}}  
this.mouseDragStart=null;this.map.div.style.cursor="default";}},defaultClick:function(evt){if(this.performedDrag){this.performedDrag=false;return false;}},CLASS_NAME:"OpenLayers.Control.MouseToolbar"});OpenLayers.Control.MouseToolbar.X=6;OpenLayers.Control.MouseToolbar.Y=300;OpenLayers.Control.NavigationHistory=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOGGLE,previous:null,previousOptions:null,next:null,nextOptions:null,limit:50,autoActivate:true,clearOnDeactivate:false,registry:null,nextStack:null,previousStack:null,listeners:null,restoring:false,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.registry=OpenLayers.Util.extend({"moveend":this.getState},this.registry);var previousOptions={trigger:OpenLayers.Function.bind(this.previousTrigger,this),displayClass:this.displayClass+" "+this.displayClass+"Previous"};OpenLayers.Util.extend(previousOptions,this.previousOptions);this.previous=new OpenLayers.Control.Button(previousOptions);var nextOptions={trigger:OpenLayers.Function.bind(this.nextTrigger,this),displayClass:this.displayClass+" "+this.displayClass+"Next"};OpenLayers.Util.extend(nextOptions,this.nextOptions);this.next=new OpenLayers.Control.Button(nextOptions);this.clear();},onPreviousChange:function(state,length){if(state&&!this.previous.active){this.previous.activate();}else if(!state&&this.previous.active){this.previous.deactivate();}},onNextChange:function(state,length){if(state&&!this.next.active){this.next.activate();}else if(!state&&this.next.active){this.next.deactivate();}},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this);this.previous.destroy();this.next.destroy();this.deactivate();for(var prop in this){this[prop]=null;}},setMap:function(map){this.map=map;this.next.setMap(map);this.previous.setMap(map);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.next.draw();this.previous.draw();},previousTrigger:function(){var current=this.previousStack.shift();var state=this.previousStack.shift();if(state!=undefined){this.nextStack.unshift(current);this.previousStack.unshift(state);this.restoring=true;this.restore(state);this.restoring=false;this.onNextChange(this.nextStack[0],this.nextStack.length);this.onPreviousChange(this.previousStack[1],this.previousStack.length-1);}else{this.previousStack.unshift(current);}  
return state;},nextTrigger:function(){var state=this.nextStack.shift();if(state!=undefined){this.previousStack.unshift(state);this.restoring=true;this.restore(state);this.restoring=false;this.onNextChange(this.nextStack[0],this.nextStack.length);this.onPreviousChange(this.previousStack[1],this.previousStack.length-1);}  
return state;},clear:function(){this.previousStack=[];this.previous.deactivate();this.nextStack=[];this.next.deactivate();},getState:function(){return{center:this.map.getCenter(),resolution:this.map.getResolution(),projection:this.map.getProjectionObject(),units:this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units};},restore:function(state){var center,zoom;if(this.map.getProjectionObject()==state.projection){zoom=this.map.getZoomForResolution(state.resolution);center=state.center;}else{center=state.center.clone();center.transform(state.projection,this.map.getProjectionObject());var sourceUnits=state.units;var targetUnits=this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units;var resolutionFactor=sourceUnits&&targetUnits?OpenLayers.INCHES_PER_UNIT[sourceUnits]/OpenLayers.INCHES_PER_UNIT[targetUnits]:1;zoom=this.map.getZoomForResolution(resolutionFactor*state.resolution);}  
this.map.setCenter(center,zoom);},setListeners:function(){this.listeners={};for(var type in this.registry){this.listeners[type]=OpenLayers.Function.bind(function(){if(!this.restoring){var state=this.registry[type].apply(this,arguments);this.previousStack.unshift(state);if(this.previousStack.length>1){this.onPreviousChange(this.previousStack[1],this.previousStack.length-1);}  
if(this.previousStack.length>(this.limit+1)){this.previousStack.pop();}  
if(this.nextStack.length>0){this.nextStack=[];this.onNextChange(null,0);}}  
return true;},this);}},activate:function(){var activated=false;if(this.map){if(OpenLayers.Control.prototype.activate.apply(this)){if(this.listeners==null){this.setListeners();}  
for(var type in this.listeners){this.map.events.register(type,this,this.listeners[type]);}  
activated=true;if(this.previousStack.length==0){this.initStack();}}}  
return activated;},initStack:function(){if(this.map.getCenter()){this.listeners.moveend();}},deactivate:function(){var deactivated=false;if(this.map){if(OpenLayers.Control.prototype.deactivate.apply(this)){for(var type in this.listeners){this.map.events.unregister(type,this,this.listeners[type]);}  
if(this.clearOnDeactivate){this.clear();}  
deactivated=true;}}  
return deactivated;},CLASS_NAME:"OpenLayers.Control.NavigationHistory"});OpenLayers.Control.PanPanel=OpenLayers.Class(OpenLayers.Control.Panel,{slideFactor:50,initialize:function(options){OpenLayers.Control.Panel.prototype.initialize.apply(this,[options]);this.addControls([new OpenLayers.Control.Pan(OpenLayers.Control.Pan.NORTH,{slideFactor:this.slideFactor}),new OpenLayers.Control.Pan(OpenLayers.Control.Pan.SOUTH,{slideFactor:this.slideFactor}),new OpenLayers.Control.Pan(OpenLayers.Control.Pan.EAST,{slideFactor:this.slideFactor}),new OpenLayers.Control.Pan(OpenLayers.Control.Pan.WEST,{slideFactor:this.slideFactor})]);},CLASS_NAME:"OpenLayers.Control.PanPanel"});OpenLayers.Control.PanZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{zoomStopWidth:18,zoomStopHeight:11,slider:null,sliderEvents:null,zoombarDiv:null,divEvents:null,zoomWorldIcon:false,forceFixedZoomLevel:false,mouseDragStart:null,zoomStart:null,initialize:function(){OpenLayers.Control.PanZoom.prototype.initialize.apply(this,arguments);},destroy:function(){this._removeZoomBar();this.map.events.un({"changebaselayer":this.redraw,scope:this});OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments);delete this.mouseDragStart;delete this.zoomStart;},setMap:function(map){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments);this.map.events.register("changebaselayer",this,this.redraw);},redraw:function(){if(this.div!=null){this.removeButtons();this._removeZoomBar();}  
this.draw();},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);px=this.position.clone();this.buttons=[];var sz=new OpenLayers.Size(18,18);var centered=new OpenLayers.Pixel(px.x+sz.w/2,px.y);var wposition=sz.w;if(this.zoomWorldIcon){centered=new OpenLayers.Pixel(px.x+sz.w,px.y);}  
this._addButton("panup","north-mini.png",centered,sz);px.y=centered.y+sz.h;this._addButton("panleft","west-mini.png",px,sz);if(this.zoomWorldIcon){this._addButton("zoomworld","zoom-world-mini.png",px.add(sz.w,0),sz);wposition*=2;}  
this._addButton("panright","east-mini.png",px.add(wposition,0),sz);this._addButton("pandown","south-mini.png",centered.add(0,sz.h*2),sz);this._addButton("zoomin","zoom-plus-mini.png",centered.add(0,sz.h*3+5),sz);centered=this._addZoomBar(centered.add(0,sz.h*4+5));this._addButton("zoomout","zoom-minus-mini.png",centered,sz);return this.div;},_addZoomBar:function(centered){var imgLocation=OpenLayers.Util.getImagesLocation();var id=this.id+"_"+this.map.id;var zoomsToEnd=this.map.getNumZoomLevels()-1-this.map.getZoom();var slider=OpenLayers.Util.createAlphaImageDiv(id,centered.add(-1,zoomsToEnd*this.zoomStopHeight),new OpenLayers.Size(20,9),imgLocation+"slider.png","absolute");this.slider=slider;this.sliderEvents=new OpenLayers.Events(this,slider,null,true,{includeXY:true});this.sliderEvents.on({"mousedown":this.zoomBarDown,"mousemove":this.zoomBarDrag,"mouseup":this.zoomBarUp,"dblclick":this.doubleClick,"click":this.doubleClick});var sz=new OpenLayers.Size();sz.h=this.zoomStopHeight*this.map.getNumZoomLevels();sz.w=this.zoomStopWidth;var div=null;if(OpenLayers.Util.alphaHack()){var id=this.id+"_"+this.map.id;div=OpenLayers.Util.createAlphaImageDiv(id,centered,new OpenLayers.Size(sz.w,this.zoomStopHeight),imgLocation+"zoombar.png","absolute",null,"crop");div.style.height=sz.h+"px";}else{div=OpenLayers.Util.createDiv('OpenLayers_Control_PanZoomBar_Zoombar'+this.map.id,centered,sz,imgLocation+"zoombar.png");}  
this.zoombarDiv=div;this.divEvents=new OpenLayers.Events(this,div,null,true,{includeXY:true});this.divEvents.on({"mousedown":this.divClick,"mousemove":this.passEventToSlider,"dblclick":this.doubleClick,"click":this.doubleClick});this.div.appendChild(div);this.startTop=parseInt(div.style.top);this.div.appendChild(slider);this.map.events.register("zoomend",this,this.moveZoomBar);centered=centered.add(0,this.zoomStopHeight*this.map.getNumZoomLevels());return centered;},_removeZoomBar:function(){this.sliderEvents.un({"mousedown":this.zoomBarDown,"mousemove":this.zoomBarDrag,"mouseup":this.zoomBarUp,"dblclick":this.doubleClick,"click":this.doubleClick});this.sliderEvents.destroy();this.divEvents.un({"mousedown":this.divClick,"mousemove":this.passEventToSlider,"dblclick":this.doubleClick,"click":this.doubleClick});this.divEvents.destroy();this.div.removeChild(this.zoombarDiv);this.zoombarDiv=null;this.div.removeChild(this.slider);this.slider=null;this.map.events.unregister("zoomend",this,this.moveZoomBar);},passEventToSlider:function(evt){this.sliderEvents.handleBrowserEvent(evt);},divClick:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}  
var y=evt.xy.y;var top=OpenLayers.Util.pagePosition(evt.object)[1];var levels=(y-top)/this.zoomStopHeight;if(this.forceFixedZoomLevel||!this.map.fractionalZoom){levels=Math.floor(levels);}  
var zoom=(this.map.getNumZoomLevels()-1)-levels;zoom=Math.min(Math.max(zoom,0),this.map.getNumZoomLevels()-1);this.map.zoomTo(zoom);OpenLayers.Event.stop(evt);},zoomBarDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}  
this.map.events.on({"mousemove":this.passEventToSlider,"mouseup":this.passEventToSlider,scope:this});this.mouseDragStart=evt.xy.clone();this.zoomStart=evt.xy.clone();this.div.style.cursor="move";this.zoombarDiv.offsets=null;OpenLayers.Event.stop(evt);},zoomBarDrag:function(evt){if(this.mouseDragStart!=null){var deltaY=this.mouseDragStart.y-evt.xy.y;var offsets=OpenLayers.Util.pagePosition(this.zoombarDiv);if((evt.clientY-offsets[1])>0&&(evt.clientY-offsets[1])<parseInt(this.zoombarDiv.style.height)-2){var newTop=parseInt(this.slider.style.top)-deltaY;this.slider.style.top=newTop+"px";this.mouseDragStart=evt.xy.clone();}  
OpenLayers.Event.stop(evt);}},zoomBarUp:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}  
if(this.mouseDragStart){this.div.style.cursor="";this.map.events.un({"mouseup":this.passEventToSlider,"mousemove":this.passEventToSlider,scope:this});var deltaY=this.zoomStart.y-evt.xy.y;var zoomLevel=this.map.zoom;if(!this.forceFixedZoomLevel&&this.map.fractionalZoom){zoomLevel+=deltaY/this.zoomStopHeight;zoomLevel=Math.min(Math.max(zoomLevel,0),this.map.getNumZoomLevels()-1);}else{zoomLevel+=Math.round(deltaY/this.zoomStopHeight);}  
this.map.zoomTo(zoomLevel);this.mouseDragStart=null;this.zoomStart=null;OpenLayers.Event.stop(evt);}},moveZoomBar:function(){var newTop=((this.map.getNumZoomLevels()-1)-this.map.getZoom())*this.zoomStopHeight+this.startTop+1;this.slider.style.top=newTop+"px";},CLASS_NAME:"OpenLayers.Control.PanZoomBar"});OpenLayers.Control.Permalink=OpenLayers.Class(OpenLayers.Control,{argParserClass:OpenLayers.Control.ArgParser,element:null,base:'',displayProjection:null,initialize:function(element,base,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.element=OpenLayers.Util.getElement(element);this.base=base||document.location.href;},destroy:function(){if(this.element.parentNode==this.div){this.div.removeChild(this.element);}  
this.element=null;this.map.events.unregister('moveend',this,this.updateLink);OpenLayers.Control.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var i=0,len=this.map.controls.length;i<len;i++){var control=this.map.controls[i];if(control.CLASS_NAME==this.argParserClass.CLASS_NAME){if(control.displayProjection!=this.displayProjection){this.displayProjection=control.displayProjection;}  
break;}}  
if(i==this.map.controls.length){this.map.addControl(new this.argParserClass({'displayProjection':this.displayProjection}));}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.div.className=this.displayClass;this.element=document.createElement("a");this.element.innerHTML=OpenLayers.i18n("permalink");this.element.href="";this.div.appendChild(this.element);}  
this.map.events.on({'moveend':this.updateLink,'changelayer':this.updateLink,'changebaselayer':this.updateLink,scope:this});this.updateLink();return this.div;},updateLink:function(){var href=this.base;if(href.indexOf('?')!=-1){href=href.substring(0,href.indexOf('?'));}  
href+='?'+OpenLayers.Util.getParameterString(this.createParams());this.element.href=href;},createParams:function(center,zoom,layers){center=center||this.map.getCenter();var params=OpenLayers.Util.getParameters(this.base);if(center){params.zoom=zoom||this.map.getZoom();var lat=center.lat;var lon=center.lon;if(this.displayProjection){var mapPosition=OpenLayers.Projection.transform({x:lon,y:lat},this.map.getProjectionObject(),this.displayProjection);lon=mapPosition.x;lat=mapPosition.y;}  
params.lat=Math.round(lat*100000)/100000;params.lon=Math.round(lon*100000)/100000;layers=layers||this.map.layers;params.layers='';for(var i=0,len=layers.length;i<len;i++){var layer=layers[i];if(layer.isBaseLayer){params.layers+=(layer==this.map.baseLayer)?"B":"0";}else{params.layers+=(layer.getVisibility())?"T":"F";}}}  
return params;},CLASS_NAME:"OpenLayers.Control.Permalink"});OpenLayers.Control.ZoomPanel=OpenLayers.Class(OpenLayers.Control.Panel,{initialize:function(options){OpenLayers.Control.Panel.prototype.initialize.apply(this,[options]);this.addControls([new OpenLayers.Control.ZoomIn(),new OpenLayers.Control.ZoomToMaxExtent(),new OpenLayers.Control.ZoomOut()]);},CLASS_NAME:"OpenLayers.Control.ZoomPanel"});OpenLayers.Format.CSWGetDomain=function(options){options=OpenLayers.Util.applyDefaults(options,OpenLayers.Format.CSWGetDomain.DEFAULTS);var cls=OpenLayers.Format.CSWGetDomain["v"+options.version.replace(/\./g,"_")];if(!cls){throw"Unsupported CSWGetDomain version: "+options.version;}  
return new cls(options);};OpenLayers.Format.CSWGetDomain.DEFAULTS={"version":"2.0.2"};OpenLayers.Format.CSWGetRecords=function(options){options=OpenLayers.Util.applyDefaults(options,OpenLayers.Format.CSWGetRecords.DEFAULTS);var cls=OpenLayers.Format.CSWGetRecords["v"+options.version.replace(/\./g,"_")];if(!cls){throw"Unsupported CSWGetRecords version: "+options.version;}  
return new cls(options);};OpenLayers.Format.CSWGetRecords.DEFAULTS={"version":"2.0.2"};OpenLayers.Format.JSON=OpenLayers.Class(OpenLayers.Format,{indent:" ",space:" ",newline:"\n",level:0,pretty:false,initialize:function(options){OpenLayers.Format.prototype.initialize.apply(this,[options]);},read:function(json,filter){try{if(/^[\],:{}\s]*$/.test(json.replace(/\\["\\\/bfnrtu]/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){var object=eval('('+json+')');if(typeof filter==='function'){function walk(k,v){if(v&&typeof v==='object'){for(var i in v){if(v.hasOwnProperty(i)){v[i]=walk(i,v[i]);}}}  
return filter(k,v);}  
object=walk('',object);}  
if(this.keepData){this.data=object;}  
return object;}}catch(e){}  
return null;},write:function(value,pretty){this.pretty=!!pretty;var json=null;var type=typeof value;if(this.serialize[type]){try{json=this.serialize[type].apply(this,[value]);}catch(err){OpenLayers.Console.error("Trouble serializing: "+err);}}  
return json;},writeIndent:function(){var pieces=[];if(this.pretty){for(var i=0;i<this.level;++i){pieces.push(this.indent);}}  
return pieces.join('');},writeNewline:function(){return(this.pretty)?this.newline:'';},writeSpace:function(){return(this.pretty)?this.space:'';},serialize:{'object':function(object){if(object==null){return"null";}  
if(object.constructor==Date){return this.serialize.date.apply(this,[object]);}  
if(object.constructor==Array){return this.serialize.array.apply(this,[object]);}  
var pieces=['{'];this.level+=1;var key,keyJSON,valueJSON;var addComma=false;for(key in object){if(object.hasOwnProperty(key)){keyJSON=OpenLayers.Format.JSON.prototype.write.apply(this,[key,this.pretty]);valueJSON=OpenLayers.Format.JSON.prototype.write.apply(this,[object[key],this.pretty]);if(keyJSON!=null&&valueJSON!=null){if(addComma){pieces.push(',');}  
pieces.push(this.writeNewline(),this.writeIndent(),keyJSON,':',this.writeSpace(),valueJSON);addComma=true;}}}  
this.level-=1;pieces.push(this.writeNewline(),this.writeIndent(),'}');return pieces.join('');},'array':function(array){var json;var pieces=['['];this.level+=1;for(var i=0,len=array.length;i<len;++i){json=OpenLayers.Format.JSON.prototype.write.apply(this,[array[i],this.pretty]);if(json!=null){if(i>0){pieces.push(',');}  
pieces.push(this.writeNewline(),this.writeIndent(),json);}}  
this.level-=1;pieces.push(this.writeNewline(),this.writeIndent(),']');return pieces.join('');},'string':function(string){var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};if(/["\\\x00-\x1f]/.test(string)){return'"'+string.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;}  
c=b.charCodeAt();return'\\u00'+  
Math.floor(c/16).toString(16)+  
(c%16).toString(16);})+'"';}  
return'"'+string+'"';},'number':function(number){return isFinite(number)?String(number):"null";},'boolean':function(bool){return String(bool);},'date':function(date){function format(number){return(number<10)?'0'+number:number;}  
return'"'+date.getFullYear()+'-'+  
format(date.getMonth()+1)+'-'+  
format(date.getDate())+'T'+  
format(date.getHours())+':'+  
format(date.getMinutes())+':'+  
format(date.getSeconds())+'"';}},CLASS_NAME:"OpenLayers.Format.JSON"});OpenLayers.Format.WFST=function(options){options=OpenLayers.Util.applyDefaults(options,OpenLayers.Format.WFST.DEFAULTS);var cls=OpenLayers.Format.WFST["v"+options.version.replace(/\./g,"_")];if(!cls){throw"Unsupported WFST version: "+options.version;}  
return new cls(options);};OpenLayers.Format.WFST.DEFAULTS={"version":"1.0.0"};OpenLayers.Format.XML=OpenLayers.Class(OpenLayers.Format,{namespaces:null,namespaceAlias:null,defaultPrefix:null,readers:{},writers:{},xmldom:null,initialize:function(options){if(window.ActiveXObject){this.xmldom=new ActiveXObject("Microsoft.XMLDOM");}  
OpenLayers.Format.prototype.initialize.apply(this,[options]);this.namespaces=OpenLayers.Util.extend({},this.namespaces);this.namespaceAlias={};for(var alias in this.namespaces){this.namespaceAlias[this.namespaces[alias]]=alias;}},destroy:function(){this.xmldom=null;OpenLayers.Format.prototype.destroy.apply(this,arguments);},setNamespace:function(alias,uri){this.namespaces[alias]=uri;this.namespaceAlias[uri]=alias;},read:function(text){var index=text.indexOf('<');if(index>0){text=text.substring(index);}  
var node=OpenLayers.Util.Try(OpenLayers.Function.bind((function(){var xmldom;if(window.ActiveXObject&&!this.xmldom){xmldom=new ActiveXObject("Microsoft.XMLDOM");}else{xmldom=this.xmldom;}  
xmldom.loadXML(text);return xmldom;}),this),function(){return new DOMParser().parseFromString(text,'text/xml');},function(){var req=new XMLHttpRequest();req.open("GET","data:"+"text/xml"+";charset=utf-8,"+encodeURIComponent(text),false);if(req.overrideMimeType){req.overrideMimeType("text/xml");}  
req.send(null);return req.responseXML;});if(this.keepData){this.data=node;}  
return node;},write:function(node){var data;if(this.xmldom){data=node.xml;}else{var serializer=new XMLSerializer();if(node.nodeType==1){var doc=document.implementation.createDocument("","",null);if(doc.importNode){node=doc.importNode(node,true);}  
doc.appendChild(node);data=serializer.serializeToString(doc);}else{data=serializer.serializeToString(node);}}  
return data;},createElementNS:function(uri,name){var element;if(this.xmldom){if(typeof uri=="string"){element=this.xmldom.createNode(1,name,uri);}else{element=this.xmldom.createNode(1,name,"");}}else{element=document.createElementNS(uri,name);}  
return element;},createTextNode:function(text){var node;if(typeof text!=="string"){text=String(text);}  
if(this.xmldom){node=this.xmldom.createTextNode(text);}else{node=document.createTextNode(text);}  
return node;},getElementsByTagNameNS:function(node,uri,name){var elements=[];if(node.getElementsByTagNameNS){elements=node.getElementsByTagNameNS(uri,name);}else{var allNodes=node.getElementsByTagName("*");var potentialNode,fullName;for(var i=0,len=allNodes.length;i<len;++i){potentialNode=allNodes[i];fullName=(potentialNode.prefix)?(potentialNode.prefix+":"+name):name;if((name=="*")||(fullName==potentialNode.nodeName)){if((uri=="*")||(uri==potentialNode.namespaceURI)){elements.push(potentialNode);}}}}  
return elements;},getAttributeNodeNS:function(node,uri,name){var attributeNode=null;if(node.getAttributeNodeNS){attributeNode=node.getAttributeNodeNS(uri,name);}else{var attributes=node.attributes;var potentialNode,fullName;for(var i=0,len=attributes.length;i<len;++i){potentialNode=attributes[i];if(potentialNode.namespaceURI==uri){fullName=(potentialNode.prefix)?(potentialNode.prefix+":"+name):name;if(fullName==potentialNode.nodeName){attributeNode=potentialNode;break;}}}}  
return attributeNode;},getAttributeNS:function(node,uri,name){var attributeValue="";if(node.getAttributeNS){attributeValue=node.getAttributeNS(uri,name)||"";}else{var attributeNode=this.getAttributeNodeNS(node,uri,name);if(attributeNode){attributeValue=attributeNode.nodeValue;}}  
return attributeValue;},getChildValue:function(node,def){var value=def||"";if(node){for(var child=node.firstChild;child;child=child.nextSibling){switch(child.nodeType){case 3:case 4:value+=child.nodeValue;}}}  
return value;},concatChildValues:function(node,def){var value="";var child=node.firstChild;var childValue;while(child){childValue=child.nodeValue;if(childValue){value+=childValue;}  
child=child.nextSibling;}  
if(value==""&&def!=undefined){value=def;}  
return value;},isSimpleContent:function(node){var simple=true;for(var child=node.firstChild;child;child=child.nextSibling){if(child.nodeType===1){simple=false;break;}}  
return simple;},contentType:function(node){var simple=false,complex=false;var type=OpenLayers.Format.XML.CONTENT_TYPE.EMPTY;for(var child=node.firstChild;child;child=child.nextSibling){switch(child.nodeType){case 1:complex=true;break;case 8:break;default:simple=true;}  
if(complex&&simple){break;}}  
if(complex&&simple){type=OpenLayers.Format.XML.CONTENT_TYPE.MIXED;}else if(complex){return OpenLayers.Format.XML.CONTENT_TYPE.COMPLEX;}else if(simple){return OpenLayers.Format.XML.CONTENT_TYPE.SIMPLE;}  
return type;},hasAttributeNS:function(node,uri,name){var found=false;if(node.hasAttributeNS){found=node.hasAttributeNS(uri,name);}else{found=!!this.getAttributeNodeNS(node,uri,name);}  
return found;},setAttributeNS:function(node,uri,name,value){if(node.setAttributeNS){node.setAttributeNS(uri,name,value);}else{if(this.xmldom){if(uri){var attribute=node.ownerDocument.createNode(2,name,uri);attribute.nodeValue=value;node.setAttributeNode(attribute);}else{node.setAttribute(name,value);}}else{throw"setAttributeNS not implemented";}}},createElementNSPlus:function(name,options){options=options||{};var uri=options.uri||this.namespaces[options.prefix];if(!uri){var loc=name.indexOf(":");uri=this.namespaces[name.substring(0,loc)];}  
if(!uri){uri=this.namespaces[this.defaultPrefix];}  
var node=this.createElementNS(uri,name);if(options.attributes){this.setAttributes(node,options.attributes);}  
var value=options.value;if(value!=null){node.appendChild(this.createTextNode(value));}  
return node;},setAttributes:function(node,obj){var value,uri;for(var name in obj){if(obj[name]!=null&&obj[name].toString){value=obj[name].toString();uri=this.namespaces[name.substring(0,name.indexOf(":"))]||null;this.setAttributeNS(node,uri,name,value);}}},readNode:function(node,obj){if(!obj){obj={};}  
var group=this.readers[node.namespaceURI?this.namespaceAlias[node.namespaceURI]:this.defaultPrefix];if(group){var local=node.localName||node.nodeName.split(":").pop();var reader=group[local]||group["*"];if(reader){reader.apply(this,[node,obj]);}}  
return obj;},readChildNodes:function(node,obj){if(!obj){obj={};}  
var children=node.childNodes;var child;for(var i=0,len=children.length;i<len;++i){child=children[i];if(child.nodeType==1){this.readNode(child,obj);}}  
return obj;},writeNode:function(name,obj,parent){var prefix,local;var split=name.indexOf(":");if(split>0){prefix=name.substring(0,split);local=name.substring(split+1);}else{if(parent){prefix=this.namespaceAlias[parent.namespaceURI];}else{prefix=this.defaultPrefix;}  
local=name;}  
var child=this.writers[prefix][local].apply(this,[obj]);if(parent){parent.appendChild(child);}  
return child;},getChildEl:function(node,name,uri){return node&&this.getThisOrNextEl(node.firstChild,name,uri);},getNextEl:function(node,name,uri){return node&&this.getThisOrNextEl(node.nextSibling,name,uri);},getThisOrNextEl:function(node,name,uri){outer:for(var sibling=node;sibling;sibling=sibling.nextSibling){switch(sibling.nodeType){case 1:if((!name||name===(sibling.localName||sibling.nodeName.split(":").pop()))&&(!uri||uri===sibling.namespaceURI)){break outer;}  
sibling=null;break outer;case 3:if(/^\s*$/.test(sibling.nodeValue)){break;}  
case 4:case 6:case 12:case 10:case 11:sibling=null;break outer;}}  
return sibling||null;},lookupNamespaceURI:function(node,prefix){var uri=null;if(node){if(node.lookupNamespaceURI){uri=node.lookupNamespaceURI(prefix);}else{outer:switch(node.nodeType){case 1:if(node.namespaceURI!==null&&node.prefix===prefix){uri=node.namespaceURI;break outer;}  
var len=node.attributes.length;if(len){var attr;for(var i=0;i<len;++i){attr=node.attributes[i];if(attr.prefix==="xmlns"&&attr.name==="xmlns:"+prefix){uri=attr.value||null;break outer;}else if(attr.name==="xmlns"&&prefix===null){uri=attr.value||null;break outer;}}}  
uri=this.lookupNamespaceURI(node.parentNode,prefix);break outer;case 2:uri=this.lookupNamespaceURI(node.ownerElement,prefix);break outer;case 9:uri=this.lookupNamespaceURI(node.documentElement,prefix);break outer;case 6:case 12:case 10:case 11:break outer;default:uri=this.lookupNamespaceURI(node.parentNode,prefix);break outer;}}}  
return uri;},CLASS_NAME:"OpenLayers.Format.XML"});OpenLayers.Format.XML.CONTENT_TYPE={EMPTY:0,SIMPLE:1,COMPLEX:2,MIXED:3};OpenLayers.Format.XML.lookupNamespaceURI=OpenLayers.Function.bind(OpenLayers.Format.XML.prototype.lookupNamespaceURI,OpenLayers.Format.XML.prototype);OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:false,evt:null,initialize:function(control,callbacks,options){OpenLayers.Util.extend(this,options);this.control=control;this.callbacks=callbacks;var map=this.map||control.map;if(map){this.setMap(map);}  
this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},setMap:function(map){this.map=map;},checkModifiers:function(evt){if(this.keyMask==null){return true;}  
var keyModifiers=(evt.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(evt.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(evt.altKey?OpenLayers.Handler.MOD_ALT:0);return(keyModifiers==this.keyMask);},activate:function(){if(this.active){return false;}  
var events=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var i=0,len=events.length;i<len;i++){if(this[events[i]]){this.register(events[i],this[events[i]]);}}  
this.active=true;return true;},deactivate:function(){if(!this.active){return false;}  
var events=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var i=0,len=events.length;i<len;i++){if(this[events[i]]){this.unregister(events[i],this[events[i]]);}}  
this.active=false;return true;},callback:function(name,args){if(name&&this.callbacks[name]){this.callbacks[name].apply(this.control,args);}},register:function(name,method){this.map.events.registerPriority(name,this,method);this.map.events.registerPriority(name,this,this.setEvent);},unregister:function(name,method){this.map.events.unregister(name,this,method);this.map.events.unregister(name,this,this.setEvent);},setEvent:function(evt){this.evt=evt;return true;},destroy:function(){this.deactivate();this.control=this.map=null;},CLASS_NAME:"OpenLayers.Handler"});OpenLayers.Handler.MOD_NONE=0;OpenLayers.Handler.MOD_SHIFT=1;OpenLayers.Handler.MOD_CTRL=2;OpenLayers.Handler.MOD_ALT=4;OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1000},EVENT_TYPES:["preaddlayer","addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer"],id:null,fractionalZoom:false,events:null,allOverlays:false,div:null,dragging:false,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,viewRequestID:0,tileSize:null,projection:"EPSG:4326",units:'degrees',resolutions:null,maxResolution:1.40625,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:true,panTween:null,eventListeners:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,paddingForPopups:null,initialize:function(div,options){if(arguments.length===1&&typeof div==="object"){options=div;div=options&&options.div;}  
this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+'theme/default/style.css';OpenLayers.Util.extend(this,options);this.layers=[];this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(div);if(!this.div){this.div=document.createElement("div");this.div.style.height="1px";this.div.style.width="1px";}  
OpenLayers.Element.addClass(this.div,'olMap');var id=this.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(id,null,null,null,"relative",null,"hidden");this.viewPortDiv.style.width="100%";this.viewPortDiv.style.height="100%";this.viewPortDiv.className="olMapViewport";this.div.appendChild(this.viewPortDiv);id=this.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(id);this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE['Popup']-1;this.viewPortDiv.appendChild(this.layerContainerDiv);this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES,this.fallThrough,{includeXY:true});this.updateSize();if(this.eventListeners instanceof Object){this.events.on(this.eventListeners);}  
this.events.register("movestart",this,this.updateSize);if(OpenLayers.String.contains(navigator.appName,"Microsoft")){this.events.register("resize",this,this.updateSize);}else{this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,this);OpenLayers.Event.observe(window,'resize',this.updateSizeDestroy);}  
if(this.theme){var addNode=true;var nodes=document.getElementsByTagName('link');for(var i=0,len=nodes.length;i<len;++i){if(OpenLayers.Util.isEquivalentUrl(nodes.item(i).href,this.theme)){addNode=false;break;}}  
if(addNode){var cssNode=document.createElement('link');cssNode.setAttribute('rel','stylesheet');cssNode.setAttribute('type','text/css');cssNode.setAttribute('href',this.theme);document.getElementsByTagName('head')[0].appendChild(cssNode);}}  
if(this.controls==null){if(OpenLayers.Control!=null){this.controls=[new OpenLayers.Control.Navigation(),new OpenLayers.Control.PanZoom(),new OpenLayers.Control.ArgParser(),new OpenLayers.Control.Attribution()];}else{this.controls=[];}}  
for(var i=0,len=this.controls.length;i<len;i++){this.addControlToMap(this.controls[i]);}  
this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,'unload',this.unloadDestroy);if(options&&options.layers){this.addLayers(options.layers);if(options.center){this.setCenter(options.center,options.zoom);}}},render:function(div){this.div=OpenLayers.Util.getElement(div);OpenLayers.Element.addClass(this.div,'olMap');this.events.attachToElement(this.div);this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);this.div.appendChild(this.viewPortDiv);this.updateSize();},unloadDestroy:null,updateSizeDestroy:null,destroy:function(){if(!this.unloadDestroy){return false;}  
if(this.panTween){this.panTween.stop();this.panTween=null;}  
OpenLayers.Event.stopObserving(window,'unload',this.unloadDestroy);this.unloadDestroy=null;if(this.updateSizeDestroy){OpenLayers.Event.stopObserving(window,'resize',this.updateSizeDestroy);}else{this.events.unregister("resize",this,this.updateSize);}  
this.paddingForPopups=null;if(this.controls!=null){for(var i=this.controls.length-1;i>=0;--i){this.controls[i].destroy();}  
this.controls=null;}  
if(this.layers!=null){for(var i=this.layers.length-1;i>=0;--i){this.layers[i].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(options){OpenLayers.Util.extend(this,options);},getTileSize:function(){return this.tileSize;},getBy:function(array,property,match){var test=(typeof match.test=="function");var found=OpenLayers.Array.filter(this[array],function(item){return item[property]==match||(test&&match.test(item[property]));});return found;},getLayersBy:function(property,match){return this.getBy("layers",property,match);},getLayersByName:function(match){return this.getLayersBy("name",match);},getLayersByClass:function(match){return this.getLayersBy("CLASS_NAME",match);},getControlsBy:function(property,match){return this.getBy("controls",property,match);},getControlsByClass:function(match){return this.getControlsBy("CLASS_NAME",match);},getLayer:function(id){var foundLayer=null;for(var i=0,len=this.layers.length;i<len;i++){var layer=this.layers[i];if(layer.id==id){foundLayer=layer;break;}}  
return foundLayer;},setLayerZIndex:function(layer,zIdx){layer.setZIndex(this.Z_INDEX_BASE[layer.isBaseLayer?'BaseLayer':'Overlay']  
+zIdx*5);},resetLayersZIndex:function(){for(var i=0,len=this.layers.length;i<len;i++){var layer=this.layers[i];this.setLayerZIndex(layer,i);}},addLayer:function(layer){for(var i=0,len=this.layers.length;i<len;i++){if(this.layers[i]==layer){var msg=OpenLayers.i18n('layerAlreadyAdded',{'layerName':layer.name});OpenLayers.Console.warn(msg);return false;}}  
if(this.allOverlays){layer.isBaseLayer=false;}  
if(this.events.triggerEvent("preaddlayer",{layer:layer})===false){return;}  
layer.div.className="olLayerDiv";layer.div.style.overflow="";this.setLayerZIndex(layer,this.layers.length);if(layer.isFixed){this.viewPortDiv.appendChild(layer.div);}else{this.layerContainerDiv.appendChild(layer.div);}  
this.layers.push(layer);layer.setMap(this);if(layer.isBaseLayer||(this.allOverlays&&!this.baseLayer)){if(this.baseLayer==null){this.setBaseLayer(layer);}else{layer.setVisibility(false);}}else{layer.redraw();}  
this.events.triggerEvent("addlayer",{layer:layer});layer.afterAdd();},addLayers:function(layers){for(var i=0,len=layers.length;i<len;i++){this.addLayer(layers[i]);}},removeLayer:function(layer,setNewBaseLayer){if(setNewBaseLayer==null){setNewBaseLayer=true;}  
if(layer.isFixed){this.viewPortDiv.removeChild(layer.div);}else{this.layerContainerDiv.removeChild(layer.div);}  
OpenLayers.Util.removeItem(this.layers,layer);layer.removeMap(this);layer.map=null;if(this.baseLayer==layer){this.baseLayer=null;if(setNewBaseLayer){for(var i=0,len=this.layers.length;i<len;i++){var iLayer=this.layers[i];if(iLayer.isBaseLayer||this.allOverlays){this.setBaseLayer(iLayer);break;}}}}  
this.resetLayersZIndex();this.events.triggerEvent("removelayer",{layer:layer});},getNumLayers:function(){return this.layers.length;},getLayerIndex:function(layer){return OpenLayers.Util.indexOf(this.layers,layer);},setLayerIndex:function(layer,idx){var base=this.getLayerIndex(layer);if(idx<0){idx=0;}else if(idx>this.layers.length){idx=this.layers.length;}  
if(base!=idx){this.layers.splice(base,1);this.layers.splice(idx,0,layer);for(var i=0,len=this.layers.length;i<len;i++){this.setLayerZIndex(this.layers[i],i);}  
this.events.triggerEvent("changelayer",{layer:layer,property:"order"});if(this.allOverlays){if(idx===0){this.setBaseLayer(layer);}else if(this.baseLayer!==this.layers[0]){this.setBaseLayer(this.layers[0]);}}}},raiseLayer:function(layer,delta){var idx=this.getLayerIndex(layer)+delta;this.setLayerIndex(layer,idx);},setBaseLayer:function(newBaseLayer){if(newBaseLayer!=this.baseLayer){if(OpenLayers.Util.indexOf(this.layers,newBaseLayer)!=-1){var center=this.getCenter();var newResolution=OpenLayers.Util.getResolutionFromScale(this.getScale(),newBaseLayer.units);if(this.baseLayer!=null&&!this.allOverlays){this.baseLayer.setVisibility(false);}  
this.baseLayer=newBaseLayer;this.viewRequestID++;if(!this.allOverlays||this.baseLayer.visibility){this.baseLayer.setVisibility(true);}  
if(center!=null){var newZoom=this.getZoomForResolution(newResolution||this.resolution,true);this.setCenter(center,newZoom,false,true);}  
this.events.triggerEvent("changebaselayer",{layer:this.baseLayer});}}},addControl:function(control,px){this.controls.push(control);this.addControlToMap(control,px);},addControls:function(controls,pixels){var pxs=(arguments.length===1)?[]:pixels;for(var i=0,len=controls.length;i<len;i++){var ctrl=controls[i];var px=(pxs[i])?pxs[i]:null;this.addControl(ctrl,px);}},addControlToMap:function(control,px){control.outsideViewport=(control.div!=null);if(this.displayProjection&&!control.displayProjection){control.displayProjection=this.displayProjection;}  
control.setMap(this);var div=control.draw(px);if(div){if(!control.outsideViewport){div.style.zIndex=this.Z_INDEX_BASE['Control']+  
this.controls.length;this.viewPortDiv.appendChild(div);}}  
if(control.autoActivate){control.activate();}},getControl:function(id){var returnControl=null;for(var i=0,len=this.controls.length;i<len;i++){var control=this.controls[i];if(control.id==id){returnControl=control;break;}}  
return returnControl;},removeControl:function(control){if((control)&&(control==this.getControl(control.id))){if(control.div&&(control.div.parentNode==this.viewPortDiv)){this.viewPortDiv.removeChild(control.div);}  
OpenLayers.Util.removeItem(this.controls,control);}},addPopup:function(popup,exclusive){if(exclusive){for(var i=this.popups.length-1;i>=0;--i){this.removePopup(this.popups[i]);}}  
popup.map=this;this.popups.push(popup);var popupDiv=popup.draw();if(popupDiv){popupDiv.style.zIndex=this.Z_INDEX_BASE['Popup']+  
this.popups.length;this.layerContainerDiv.appendChild(popupDiv);}},removePopup:function(popup){OpenLayers.Util.removeItem(this.popups,popup);if(popup.div){try{this.layerContainerDiv.removeChild(popup.div);}  
catch(e){}}  
popup.map=null;},getSize:function(){var size=null;if(this.size!=null){size=this.size.clone();}  
return size;},updateSize:function(){var newSize=this.getCurrentSize();if(newSize&&!isNaN(newSize.h)&&!isNaN(newSize.w)){this.events.clearMouseCache();var oldSize=this.getSize();if(oldSize==null){this.size=oldSize=newSize;}  
if(!newSize.equals(oldSize)){this.size=newSize;for(var i=0,len=this.layers.length;i<len;i++){this.layers[i].onMapResize();}  
var center=this.getCenter();if(this.baseLayer!=null&&center!=null){var zoom=this.getZoom();this.zoom=null;this.setCenter(center,zoom);}}}},getCurrentSize:function(){var size=new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(size.w==0&&size.h==0||isNaN(size.w)&&isNaN(size.h)){size.w=this.div.offsetWidth;size.h=this.div.offsetHeight;}  
if(size.w==0&&size.h==0||isNaN(size.w)&&isNaN(size.h)){size.w=parseInt(this.div.style.width);size.h=parseInt(this.div.style.height);}  
return size;},calculateBounds:function(center,resolution){var extent=null;if(center==null){center=this.getCenter();}  
if(resolution==null){resolution=this.getResolution();}  
if((center!=null)&&(resolution!=null)){var size=this.getSize();var w_deg=size.w*resolution;var h_deg=size.h*resolution;extent=new OpenLayers.Bounds(center.lon-w_deg/2,center.lat-h_deg/2,center.lon+w_deg/2,center.lat+h_deg/2);}  
return extent;},getCenter:function(){var center=null;if(this.center){center=this.center.clone();}  
return center;},getZoom:function(){return this.zoom;},pan:function(dx,dy,options){options=OpenLayers.Util.applyDefaults(options,{animate:true,dragging:false});var centerPx=this.getViewPortPxFromLonLat(this.getCenter());var newCenterPx=centerPx.add(dx,dy);if(!options.dragging||!newCenterPx.equals(centerPx)){var newCenterLonLat=this.getLonLatFromViewPortPx(newCenterPx);if(options.animate){this.panTo(newCenterLonLat);}else{this.setCenter(newCenterLonLat,null,options.dragging);}}},panTo:function(lonlat){if(this.panMethod&&this.getExtent().scale(this.panRatio).containsLonLat(lonlat)){if(!this.panTween){this.panTween=new OpenLayers.Tween(this.panMethod);}  
var center=this.getCenter();if(lonlat.lon==center.lon&&lonlat.lat==center.lat){return;}  
var from={lon:center.lon,lat:center.lat};var to={lon:lonlat.lon,lat:lonlat.lat};this.panTween.start(from,to,this.panDuration,{callbacks:{start:OpenLayers.Function.bind(function(lonlat){this.events.triggerEvent("movestart");},this),eachStep:OpenLayers.Function.bind(function(lonlat){lonlat=new OpenLayers.LonLat(lonlat.lon,lonlat.lat);this.moveTo(lonlat,this.zoom,{'dragging':true,'noEvent':true});},this),done:OpenLayers.Function.bind(function(lonlat){lonlat=new OpenLayers.LonLat(lonlat.lon,lonlat.lat);this.moveTo(lonlat,this.zoom,{'noEvent':true});this.events.triggerEvent("moveend");},this)}});}else{this.setCenter(lonlat);}},setCenter:function(lonlat,zoom,dragging,forceZoomChange){this.moveTo(lonlat,zoom,{'dragging':dragging,'forceZoomChange':forceZoomChange,'caller':'setCenter'});},moveTo:function(lonlat,zoom,options){if(!options){options={};}  
if(zoom!=null){zoom=parseFloat(zoom);if(!this.fractionalZoom){zoom=Math.round(zoom);}}  
var dragging=options.dragging;var forceZoomChange=options.forceZoomChange;var noEvent=options.noEvent;if(this.panTween&&options.caller=="setCenter"){this.panTween.stop();}  
if(!this.center&&!this.isValidLonLat(lonlat)){lonlat=this.maxExtent.getCenterLonLat();}  
if(this.restrictedExtent!=null){if(lonlat==null){lonlat=this.getCenter();}  
if(zoom==null){zoom=this.getZoom();}  
var resolution=this.getResolutionForZoom(zoom);var extent=this.calculateBounds(lonlat,resolution);if(!this.restrictedExtent.containsBounds(extent)){var maxCenter=this.restrictedExtent.getCenterLonLat();if(extent.getWidth()>this.restrictedExtent.getWidth()){lonlat=new OpenLayers.LonLat(maxCenter.lon,lonlat.lat);}else if(extent.left<this.restrictedExtent.left){lonlat=lonlat.add(this.restrictedExtent.left-  
extent.left,0);}else if(extent.right>this.restrictedExtent.right){lonlat=lonlat.add(this.restrictedExtent.right-  
extent.right,0);}  
if(extent.getHeight()>this.restrictedExtent.getHeight()){lonlat=new OpenLayers.LonLat(lonlat.lon,maxCenter.lat);}else if(extent.bottom<this.restrictedExtent.bottom){lonlat=lonlat.add(0,this.restrictedExtent.bottom-  
extent.bottom);}  
else if(extent.top>this.restrictedExtent.top){lonlat=lonlat.add(0,this.restrictedExtent.top-  
extent.top);}}}  
var zoomChanged=forceZoomChange||((this.isValidZoomLevel(zoom))&&(zoom!=this.getZoom()));var centerChanged=(this.isValidLonLat(lonlat))&&(!lonlat.equals(this.center));if(zoomChanged||centerChanged||!dragging){if(!this.dragging&&!noEvent){this.events.triggerEvent("movestart");}  
if(centerChanged){if((!zoomChanged)&&(this.center)){this.centerLayerContainer(lonlat);}  
this.center=lonlat.clone();}  
if((zoomChanged)||(this.layerContainerOrigin==null)){this.layerContainerOrigin=this.center.clone();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px";}  
if(zoomChanged){this.zoom=zoom;this.resolution=this.getResolutionForZoom(zoom);this.viewRequestID++;}  
var bounds=this.getExtent();if(this.baseLayer.visibility){this.baseLayer.moveTo(bounds,zoomChanged,dragging);if(dragging){this.baseLayer.events.triggerEvent("move");}else{this.baseLayer.events.triggerEvent("moveend",{"zoomChanged":zoomChanged});}}  
bounds=this.baseLayer.getExtent();for(var i=0,len=this.layers.length;i<len;i++){var layer=this.layers[i];if(layer!==this.baseLayer&&!layer.isBaseLayer){var inRange=layer.calculateInRange();if(layer.inRange!=inRange){layer.inRange=inRange;if(!inRange){layer.display(false);}  
this.events.triggerEvent("changelayer",{layer:layer,property:"visibility"});}  
if(inRange&&layer.visibility){layer.moveTo(bounds,zoomChanged,dragging);if(dragging){layer.events.triggerEvent("move");}else{layer.events.triggerEvent("moveend",{"zoomChanged":zoomChanged});}}}}  
if(zoomChanged){for(var i=0,len=this.popups.length;i<len;i++){this.popups[i].updatePosition();}}  
this.events.triggerEvent("move");if(zoomChanged){this.events.triggerEvent("zoomend");}}  
if(!dragging&&!noEvent){this.events.triggerEvent("moveend");}  
this.dragging=!!dragging;},centerLayerContainer:function(lonlat){var originPx=this.getViewPortPxFromLonLat(this.layerContainerOrigin);var newPx=this.getViewPortPxFromLonLat(lonlat);if((originPx!=null)&&(newPx!=null)){this.layerContainerDiv.style.left=Math.round(originPx.x-newPx.x)+"px";this.layerContainerDiv.style.top=Math.round(originPx.y-newPx.y)+"px";}},isValidZoomLevel:function(zoomLevel){return((zoomLevel!=null)&&(zoomLevel>=0)&&(zoomLevel<this.getNumZoomLevels()));},isValidLonLat:function(lonlat){var valid=false;if(lonlat!=null){var maxExtent=this.getMaxExtent();valid=maxExtent.containsLonLat(lonlat);}  
return valid;},getProjection:function(){var projection=this.getProjectionObject();return projection?projection.getCode():null;},getProjectionObject:function(){var projection=null;if(this.baseLayer!=null){projection=this.baseLayer.projection;}  
return projection;},getMaxResolution:function(){var maxResolution=null;if(this.baseLayer!=null){maxResolution=this.baseLayer.maxResolution;}  
return maxResolution;},getMaxExtent:function(options){var maxExtent=null;if(options&&options.restricted&&this.restrictedExtent){maxExtent=this.restrictedExtent;}else if(this.baseLayer!=null){maxExtent=this.baseLayer.maxExtent;}  
return maxExtent;},getNumZoomLevels:function(){var numZoomLevels=null;if(this.baseLayer!=null){numZoomLevels=this.baseLayer.numZoomLevels;}  
return numZoomLevels;},getExtent:function(){var extent=null;if(this.baseLayer!=null){extent=this.baseLayer.getExtent();}  
return extent;},getResolution:function(){var resolution=null;if(this.baseLayer!=null){resolution=this.baseLayer.getResolution();}else if(this.allOverlays===true&&this.layers.length>0){resolution=this.layers[0].getResolution();}  
return resolution;},getUnits:function(){var units=null;if(this.baseLayer!=null){units=this.baseLayer.units;}  
return units;},getScale:function(){var scale=null;if(this.baseLayer!=null){var res=this.getResolution();var units=this.baseLayer.units;scale=OpenLayers.Util.getScaleFromResolution(res,units);}  
return scale;},getZoomForExtent:function(bounds,closest){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForExtent(bounds,closest);}  
return zoom;},getResolutionForZoom:function(zoom){var resolution=null;if(this.baseLayer){resolution=this.baseLayer.getResolutionForZoom(zoom);}  
return resolution;},getZoomForResolution:function(resolution,closest){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForResolution(resolution,closest);}  
return zoom;},zoomTo:function(zoom){if(this.isValidZoomLevel(zoom)){this.setCenter(null,zoom);}},zoomIn:function(){this.zoomTo(this.getZoom()+1);},zoomOut:function(){this.zoomTo(this.getZoom()-1);},zoomToExtent:function(bounds,closest){var center=bounds.getCenterLonLat();if(this.baseLayer.wrapDateLine){var maxExtent=this.getMaxExtent();bounds=bounds.clone();while(bounds.right<bounds.left){bounds.right+=maxExtent.getWidth();}  
center=bounds.getCenterLonLat().wrapDateLine(maxExtent);}  
this.setCenter(center,this.getZoomForExtent(bounds,closest));},zoomToMaxExtent:function(options){var restricted=(options)?options.restricted:true;var maxExtent=this.getMaxExtent({'restricted':restricted});this.zoomToExtent(maxExtent);},zoomToScale:function(scale,closest){var res=OpenLayers.Util.getResolutionFromScale(scale,this.baseLayer.units);var size=this.getSize();var w_deg=size.w*res;var h_deg=size.h*res;var center=this.getCenter();var extent=new OpenLayers.Bounds(center.lon-w_deg/2,center.lat-h_deg/2,center.lon+w_deg/2,center.lat+h_deg/2);this.zoomToExtent(extent,closest);},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if(this.baseLayer!=null){lonlat=this.baseLayer.getLonLatFromViewPortPx(viewPortPx);}  
return lonlat;},getViewPortPxFromLonLat:function(lonlat){var px=null;if(this.baseLayer!=null){px=this.baseLayer.getViewPortPxFromLonLat(lonlat);}  
return px;},getLonLatFromPixel:function(px){return this.getLonLatFromViewPortPx(px);},getPixelFromLonLat:function(lonlat){var px=this.getViewPortPxFromLonLat(lonlat);px.x=Math.round(px.x);px.y=Math.round(px.y);return px;},getGeodesicPixelSize:function(px){var lonlat=px?this.getLonLatFromPixel(px):(this.getCenter()||new OpenLayers.LonLat(0,0));var res=this.getResolution();var left=lonlat.add(-res/2,0);var right=lonlat.add(res/2,0);var bottom=lonlat.add(0,-res/2);var top=lonlat.add(0,res/2);var dest=new OpenLayers.Projection("EPSG:4326");var source=this.getProjectionObject()||dest;if(!source.equals(dest)){left.transform(source,dest);right.transform(source,dest);bottom.transform(source,dest);top.transform(source,dest);}  
return new OpenLayers.Size(OpenLayers.Util.distVincenty(left,right),OpenLayers.Util.distVincenty(bottom,top));},getViewPortPxFromLayerPx:function(layerPx){var viewPortPx=null;if(layerPx!=null){var dX=parseInt(this.layerContainerDiv.style.left);var dY=parseInt(this.layerContainerDiv.style.top);viewPortPx=layerPx.add(dX,dY);}  
return viewPortPx;},getLayerPxFromViewPortPx:function(viewPortPx){var layerPx=null;if(viewPortPx!=null){var dX=-parseInt(this.layerContainerDiv.style.left);var dY=-parseInt(this.layerContainerDiv.style.top);layerPx=viewPortPx.add(dX,dY);if(isNaN(layerPx.x)||isNaN(layerPx.y)){layerPx=null;}}  
return layerPx;},getLonLatFromLayerPx:function(px){px=this.getViewPortPxFromLayerPx(px);return this.getLonLatFromViewPortPx(px);},getLayerPxFromLonLat:function(lonlat){var px=this.getPixelFromLonLat(lonlat);return this.getLayerPxFromViewPortPx(px);},CLASS_NAME:"OpenLayers.Map"});OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;OpenLayers.Marker=OpenLayers.Class({icon:null,lonlat:null,events:null,map:null,initialize:function(lonlat,icon){this.lonlat=lonlat;var newIcon=(icon)?icon:OpenLayers.Marker.defaultIcon();if(this.icon==null){this.icon=newIcon;}else{this.icon.url=newIcon.url;this.icon.size=newIcon.size;this.icon.offset=newIcon.offset;this.icon.calculateOffset=newIcon.calculateOffset;}  
this.events=new OpenLayers.Events(this,this.icon.imageDiv,null);},destroy:function(){this.erase();this.map=null;this.events.destroy();this.events=null;if(this.icon!=null){this.icon.destroy();this.icon=null;}},draw:function(px){return this.icon.draw(px);},erase:function(){if(this.icon!=null){this.icon.erase();}},moveTo:function(px){if((px!=null)&&(this.icon!=null)){this.icon.moveTo(px);}  
this.lonlat=this.map.getLonLatFromLayerPx(px);},isDrawn:function(){var isDrawn=(this.icon&&this.icon.isDrawn());return isDrawn;},onScreen:function(){var onScreen=false;if(this.map){var screenBounds=this.map.getExtent();onScreen=screenBounds.containsLonLat(this.lonlat);}  
return onScreen;},inflate:function(inflate){if(this.icon){var newSize=new OpenLayers.Size(this.icon.size.w*inflate,this.icon.size.h*inflate);this.icon.setSize(newSize);}},setOpacity:function(opacity){this.icon.setOpacity(opacity);},setUrl:function(url){this.icon.setUrl(url);},display:function(display){this.icon.display(display);},CLASS_NAME:"OpenLayers.Marker"});OpenLayers.Marker.defaultIcon=function(){var url=OpenLayers.Util.getImagesLocation()+"marker.png";var size=new OpenLayers.Size(21,25);var calculateOffset=function(size){return new OpenLayers.Pixel(-(size.w/2),-size.h);};return new OpenLayers.Icon(url,size,null,calculateOffset);};OpenLayers.Popup.FramedCloud=OpenLayers.Class(OpenLayers.Popup.Framed,{contentDisplayClass:"olFramedCloudPopupContent",autoSize:true,panMapIfOutOfView:true,imageSize:new OpenLayers.Size(1276,736),isAlphaImage:false,fixedRelativePosition:false,positionBlocks:{"tl":{'offset':new OpenLayers.Pixel(44,0),'padding':new OpenLayers.Bounds(8,40,8,9),'blocks':[{size:new OpenLayers.Size('auto','auto'),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,'auto'),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size('auto',19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,18),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-1238,-632)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(0,-688)}]},"tr":{'offset':new OpenLayers.Pixel(-45,0),'padding':new OpenLayers.Bounds(8,40,8,9),'blocks':[{size:new OpenLayers.Size('auto','auto'),anchor:new OpenLayers.Bounds(0,51,22,0),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,'auto'),anchor:new OpenLayers.Bounds(null,50,0,0),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size('auto',19),anchor:new OpenLayers.Bounds(0,32,22,null),position:new OpenLayers.Pixel(0,-631)},{size:new OpenLayers.Size(22,19),anchor:new OpenLayers.Bounds(null,32,0,null),position:new OpenLayers.Pixel(-1238,-631)},{size:new OpenLayers.Size(81,35),anchor:new OpenLayers.Bounds(0,0,null,null),position:new OpenLayers.Pixel(-215,-687)}]},"bl":{'offset':new OpenLayers.Pixel(45,0),'padding':new OpenLayers.Bounds(8,9,8,40),'blocks':[{size:new OpenLayers.Size('auto','auto'),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,'auto'),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size('auto',21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-1238,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(null,null,0,0),position:new OpenLayers.Pixel(-101,-674)}]},"br":{'offset':new OpenLayers.Pixel(-44,0),'padding':new OpenLayers.Bounds(8,9,8,40),'blocks':[{size:new OpenLayers.Size('auto','auto'),anchor:new OpenLayers.Bounds(0,21,22,32),position:new OpenLayers.Pixel(0,0)},{size:new OpenLayers.Size(22,'auto'),anchor:new OpenLayers.Bounds(null,21,0,32),position:new OpenLayers.Pixel(-1238,0)},{size:new OpenLayers.Size('auto',21),anchor:new OpenLayers.Bounds(0,0,22,null),position:new OpenLayers.Pixel(0,-629)},{size:new OpenLayers.Size(22,21),anchor:new OpenLayers.Bounds(null,0,0,null),position:new OpenLayers.Pixel(-1238,-629)},{size:new OpenLayers.Size(81,33),anchor:new OpenLayers.Bounds(0,null,null,0),position:new OpenLayers.Pixel(-311,-674)}]}},minSize:new OpenLayers.Size(105,10),maxSize:new OpenLayers.Size(1200,660),initialize:function(id,lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback){this.imageSrc=OpenLayers.Util.getImagesLocation()+'cloud-popup-relative.png';OpenLayers.Popup.Framed.prototype.initialize.apply(this,arguments);this.contentDiv.className=this.contentDisplayClass;},destroy:function(){OpenLayers.Popup.Framed.prototype.destroy.apply(this,arguments);},CLASS_NAME:"OpenLayers.Popup.FramedCloud"});OpenLayers.Request={DEFAULT_CONFIG:{method:"GET",url:window.location.href,async:true,user:undefined,password:undefined,params:null,proxy:OpenLayers.ProxyHost,headers:{},data:null,callback:function(){},success:null,failure:null,scope:null},events:new OpenLayers.Events(this,null,["complete","success","failure"]),issue:function(config){var defaultConfig=OpenLayers.Util.extend(this.DEFAULT_CONFIG,{proxy:OpenLayers.ProxyHost});config=OpenLayers.Util.applyDefaults(config,defaultConfig);var request=new OpenLayers.Request.XMLHttpRequest();var url=config.url;if(config.params){var paramString=OpenLayers.Util.getParameterString(config.params);if(paramString.length>0){var separator=(url.indexOf('?')>-1)?'&':'?';url+=separator+paramString;}}  
if(config.proxy&&(url.indexOf("http")==0)){if(typeof config.proxy=="function"){url=config.proxy(url);}else{url=config.proxy+encodeURIComponent(url);}}  
request.open(config.method,url,config.async,config.user,config.password);for(var header in config.headers){request.setRequestHeader(header,config.headers[header]);}  
var events=this.events;var self=this;request.onreadystatechange=function(){if(request.readyState==OpenLayers.Request.XMLHttpRequest.DONE){var proceed=events.triggerEvent("complete",{request:request,config:config,requestUrl:url});if(proceed!==false){self.runCallbacks({request:request,config:config,requestUrl:url});}}};if(config.async===false){request.send(config.data);}else{window.setTimeout(function(){if(request._aborted!==true){request.send(config.data);}},0);}  
return request;},runCallbacks:function(options){var request=options.request;var config=options.config;var complete=(config.scope)?OpenLayers.Function.bind(config.callback,config.scope):config.callback;var success;if(config.success){success=(config.scope)?OpenLayers.Function.bind(config.success,config.scope):config.success;}  
var failure;if(config.failure){failure=(config.scope)?OpenLayers.Function.bind(config.failure,config.scope):config.failure;}  
complete(request);if(!request.status||(request.status>=200&&request.status<300)){this.events.triggerEvent("success",options);if(success){success(request);}}  
if(request.status&&(request.status<200||request.status>=300)){this.events.triggerEvent("failure",options);if(failure){failure(request);}}},GET:function(config){config=OpenLayers.Util.extend(config,{method:"GET"});return OpenLayers.Request.issue(config);},POST:function(config){config=OpenLayers.Util.extend(config,{method:"POST"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml";}  
return OpenLayers.Request.issue(config);},PUT:function(config){config=OpenLayers.Util.extend(config,{method:"PUT"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml";}  
return OpenLayers.Request.issue(config);},DELETE:function(config){config=OpenLayers.Util.extend(config,{method:"DELETE"});return OpenLayers.Request.issue(config);},HEAD:function(config){config=OpenLayers.Util.extend(config,{method:"HEAD"});return OpenLayers.Request.issue(config);},OPTIONS:function(config){config=OpenLayers.Util.extend(config,{method:"OPTIONS"});return OpenLayers.Request.issue(config);}};OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:false,lastRatio:1,isFirstDraw:true,backBufferTile:null,initialize:function(layer,position,bounds,url,size){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=url;this.frame=document.createElement('div');this.frame.style.overflow='hidden';this.frame.style.position='absolute';this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack();},destroy:function(){if(this.imgDiv!=null){if(this.layerAlphaHack){OpenLayers.Event.stopObservingElement(this.imgDiv.childNodes[0]);}  
OpenLayers.Event.stopObservingElement(this.imgDiv);if(this.imgDiv.parentNode==this.frame){this.frame.removeChild(this.imgDiv);this.imgDiv.map=null;}  
this.imgDiv.urls=null;this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif";}  
this.imgDiv=null;if((this.frame!=null)&&(this.frame.parentNode==this.layer.div)){this.layer.div.removeChild(this.frame);}  
this.frame=null;if(this.backBufferTile){this.backBufferTile.destroy();this.backBufferTile=null;}  
this.layer.events.unregister("loadend",this,this.resetBackBuffer);OpenLayers.Tile.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Tile.Image(this.layer,this.position,this.bounds,this.url,this.size);}  
obj=OpenLayers.Tile.prototype.clone.apply(this,[obj]);obj.imgDiv=null;return obj;},draw:function(){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject){this.bounds=this.getBoundsFromBaseLayer(this.position);}  
var drawTile=OpenLayers.Tile.prototype.draw.apply(this,arguments);if((OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1)||this.layer.singleTile){if(drawTile){if(!this.backBufferTile){this.backBufferTile=this.clone();this.backBufferTile.hide();this.backBufferTile.isBackBuffer=true;this.events.register('loadend',this,this.resetBackBuffer);this.layer.events.register("loadend",this,this.resetBackBuffer);}  
this.startTransition();}else{if(this.backBufferTile){this.backBufferTile.clear();}}}else{if(drawTile&&this.isFirstDraw){this.events.register('loadend',this,this.showTile);this.isFirstDraw=false;}}  
if(!drawTile){return false;}  
if(this.isLoading){this.events.triggerEvent("reload");}else{this.isLoading=true;this.events.triggerEvent("loadstart");}  
return this.renderTile();},resetBackBuffer:function(){this.showTile();if(this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles)){this.isFirstDraw=false;var maxExtent=this.layer.maxExtent;var withinMaxExtent=(maxExtent&&this.bounds.intersectsBounds(maxExtent,false));if(withinMaxExtent){this.backBufferTile.position=this.position;this.backBufferTile.bounds=this.bounds;this.backBufferTile.size=this.size;this.backBufferTile.imageSize=this.layer.getImageSize(this.bounds)||this.size;this.backBufferTile.imageOffset=this.layer.imageOffset;this.backBufferTile.resolution=this.layer.getResolution();this.backBufferTile.renderTile();}  
this.backBufferTile.hide();}},renderTile:function(){if(this.imgDiv==null){this.initImgDiv();}  
this.imgDiv.viewRequestID=this.layer.map.viewRequestID;if(this.layer.async){this.layer.getURLasync(this.bounds,this,"url",this.positionImage);}else{if(this.layer.url instanceof Array){this.imgDiv.urls=this.layer.url.slice();}  
this.url=this.layer.getURL(this.bounds);this.positionImage();}  
return true;},positionImage:function(){if(this.layer===null){return;}  
OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var imageSize=this.layer.getImageSize(this.bounds);if(this.layerAlphaHack){OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,imageSize,this.url);}else{OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,imageSize);this.imgDiv.src=this.url;}},clear:function(){if(this.imgDiv){this.hide();if(OpenLayers.Tile.Image.useBlankTile){this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif";}}},initImgDiv:function(){var offset=this.layer.imageOffset;var size=this.layer.getImageSize(this.bounds);if(this.layerAlphaHack){this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,offset,size,null,"relative",null,null,null,true);}else{this.imgDiv=OpenLayers.Util.createImage(null,offset,size,null,"relative",null,null,true);}  
this.imgDiv.className='olTileImage';this.frame.style.zIndex=this.isBackBuffer?0:1;this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);if(this.layer.opacity!=null){OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity);}  
this.imgDiv.map=this.layer.map;var onload=function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("loadend");}};if(this.layerAlphaHack){OpenLayers.Event.observe(this.imgDiv.childNodes[0],'load',OpenLayers.Function.bind(onload,this));}else{OpenLayers.Event.observe(this.imgDiv,'load',OpenLayers.Function.bind(onload,this));}  
var onerror=function(){if(this.imgDiv._attempts>OpenLayers.IMAGE_RELOAD_ATTEMPTS){onload.call(this);}};OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(onerror,this));},checkImgURL:function(){if(this.layer){var loaded=this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src;if(!OpenLayers.Util.isEquivalentUrl(loaded,this.url)){this.hide();}}},startTransition:function(){if(!this.backBufferTile||!this.backBufferTile.imgDiv){return;}  
var ratio=1;if(this.backBufferTile.resolution){ratio=this.backBufferTile.resolution/this.layer.getResolution();}  
if(ratio!=this.lastRatio){if(this.layer.transitionEffect=='resize'){var upperLeft=new OpenLayers.LonLat(this.backBufferTile.bounds.left,this.backBufferTile.bounds.top);var size=new OpenLayers.Size(this.backBufferTile.size.w*ratio,this.backBufferTile.size.h*ratio);var px=this.layer.map.getLayerPxFromLonLat(upperLeft);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,px,size);var imageSize=this.backBufferTile.imageSize;imageSize=new OpenLayers.Size(imageSize.w*ratio,imageSize.h*ratio);var imageOffset=this.backBufferTile.imageOffset;if(imageOffset){imageOffset=new OpenLayers.Pixel(imageOffset.x*ratio,imageOffset.y*ratio);}  
OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,imageOffset,imageSize);this.backBufferTile.show();}}else{if(this.layer.singleTile){this.backBufferTile.show();}else{this.backBufferTile.hide();}}  
this.lastRatio=ratio;},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.Control.OverviewMap=OpenLayers.Class(OpenLayers.Control,{element:null,ovmap:null,size:new OpenLayers.Size(180,90),layers:null,minRectSize:15,minRectDisplayClass:"RectReplacement",minRatio:8,maxRatio:32,mapOptions:null,autoPan:false,handlers:null,resolutionFactor:1,maximized:false,initialize:function(options){this.layers=[];this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,[options]);},destroy:function(){if(!this.mapDiv){return;}  
if(this.handlers.click){this.handlers.click.destroy();}  
if(this.handlers.drag){this.handlers.drag.destroy();}  
this.mapDiv.removeChild(this.extentRectangle);this.extentRectangle=null;if(this.rectEvents){this.rectEvents.destroy();this.rectEvents=null;}  
if(this.ovmap){this.ovmap.destroy();this.ovmap=null;}  
this.element.removeChild(this.mapDiv);this.mapDiv=null;this.div.removeChild(this.element);this.element=null;if(this.maximizeDiv){OpenLayers.Event.stopObservingElement(this.maximizeDiv);this.div.removeChild(this.maximizeDiv);this.maximizeDiv=null;}  
if(this.minimizeDiv){OpenLayers.Event.stopObservingElement(this.minimizeDiv);this.div.removeChild(this.minimizeDiv);this.minimizeDiv=null;}  
this.map.events.un({"moveend":this.update,"changebaselayer":this.baseLayerDraw,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!(this.layers.length>0)){if(this.map.baseLayer){var layer=this.map.baseLayer.clone();this.layers=[layer];}else{this.map.events.register("changebaselayer",this,this.baseLayerDraw);return this.div;}}  
this.element=document.createElement('div');this.element.className=this.displayClass+'Element';this.element.style.display='none';this.mapDiv=document.createElement('div');this.mapDiv.style.width=this.size.w+'px';this.mapDiv.style.height=this.size.h+'px';this.mapDiv.style.position='relative';this.mapDiv.style.overflow='hidden';this.mapDiv.id=OpenLayers.Util.createUniqueID('overviewMap');this.extentRectangle=document.createElement('div');this.extentRectangle.style.position='absolute';this.extentRectangle.style.zIndex=1000;this.extentRectangle.className=this.displayClass+'ExtentRectangle';this.mapDiv.appendChild(this.extentRectangle);this.element.appendChild(this.mapDiv);this.div.appendChild(this.element);if(!this.outsideViewport){this.div.className+=" "+this.displayClass+'Container';var imgLocation=OpenLayers.Util.getImagesLocation();var img=imgLocation+'layer-switcher-maximize.png';this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv(this.displayClass+'MaximizeButton',null,new OpenLayers.Size(18,18),img,'absolute');this.maximizeDiv.style.display='none';this.maximizeDiv.className=this.displayClass+'MaximizeButton';OpenLayers.Event.observe(this.maximizeDiv,'click',OpenLayers.Function.bindAsEventListener(this.maximizeControl,this));this.div.appendChild(this.maximizeDiv);var img=imgLocation+'layer-switcher-minimize.png';this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv('OpenLayers_Control_minimizeDiv',null,new OpenLayers.Size(18,18),img,'absolute');this.minimizeDiv.style.display='none';this.minimizeDiv.className=this.displayClass+'MinimizeButton';OpenLayers.Event.observe(this.minimizeDiv,'click',OpenLayers.Function.bindAsEventListener(this.minimizeControl,this));this.div.appendChild(this.minimizeDiv);var eventsToStop=['dblclick','mousedown'];for(var i=0,len=eventsToStop.length;i<len;i++){OpenLayers.Event.observe(this.maximizeDiv,eventsToStop[i],OpenLayers.Event.stop);OpenLayers.Event.observe(this.minimizeDiv,eventsToStop[i],OpenLayers.Event.stop);}  
this.minimizeControl();}else{this.element.style.display='';}  
if(this.map.getExtent()){this.update();}  
this.map.events.register('moveend',this,this.update);if(this.maximized){this.maximizeControl();}  
return this.div;},baseLayerDraw:function(){this.draw();this.map.events.unregister("changebaselayer",this,this.baseLayerDraw);},rectDrag:function(px){var deltaX=this.handlers.drag.last.x-px.x;var deltaY=this.handlers.drag.last.y-px.y;if(deltaX!=0||deltaY!=0){var rectTop=this.rectPxBounds.top;var rectLeft=this.rectPxBounds.left;var rectHeight=Math.abs(this.rectPxBounds.getHeight());var rectWidth=this.rectPxBounds.getWidth();var newTop=Math.max(0,(rectTop-deltaY));newTop=Math.min(newTop,this.ovmap.size.h-this.hComp-rectHeight);var newLeft=Math.max(0,(rectLeft-deltaX));newLeft=Math.min(newLeft,this.ovmap.size.w-this.wComp-rectWidth);this.setRectPxBounds(new OpenLayers.Bounds(newLeft,newTop+rectHeight,newLeft+rectWidth,newTop));}},mapDivClick:function(evt){var pxCenter=this.rectPxBounds.getCenterPixel();var deltaX=evt.xy.x-pxCenter.x;var deltaY=evt.xy.y-pxCenter.y;var top=this.rectPxBounds.top;var left=this.rectPxBounds.left;var height=Math.abs(this.rectPxBounds.getHeight());var width=this.rectPxBounds.getWidth();var newTop=Math.max(0,(top+deltaY));newTop=Math.min(newTop,this.ovmap.size.h-height);var newLeft=Math.max(0,(left+deltaX));newLeft=Math.min(newLeft,this.ovmap.size.w-width);this.setRectPxBounds(new OpenLayers.Bounds(newLeft,newTop+height,newLeft+width,newTop));this.updateMapToRect();},maximizeControl:function(e){this.element.style.display='';this.showToggle(false);if(e!=null){OpenLayers.Event.stop(e);}},minimizeControl:function(e){this.element.style.display='none';this.showToggle(true);if(e!=null){OpenLayers.Event.stop(e);}},showToggle:function(minimize){this.maximizeDiv.style.display=minimize?'':'none';this.minimizeDiv.style.display=minimize?'none':'';},update:function(){if(this.ovmap==null){this.createMap();}  
if(this.autoPan||!this.isSuitableOverview()){this.updateOverview();}  
this.updateRectToMap();},isSuitableOverview:function(){var mapExtent=this.map.getExtent();var maxExtent=this.map.maxExtent;var testExtent=new OpenLayers.Bounds(Math.max(mapExtent.left,maxExtent.left),Math.max(mapExtent.bottom,maxExtent.bottom),Math.min(mapExtent.right,maxExtent.right),Math.min(mapExtent.top,maxExtent.top));if(this.ovmap.getProjection()!=this.map.getProjection()){testExtent=testExtent.transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject());}  
var resRatio=this.ovmap.getResolution()/this.map.getResolution();return((resRatio>this.minRatio)&&(resRatio<=this.maxRatio)&&(this.ovmap.getExtent().containsBounds(testExtent)));},updateOverview:function(){var mapRes=this.map.getResolution();var targetRes=this.ovmap.getResolution();var resRatio=targetRes/mapRes;if(resRatio>this.maxRatio){targetRes=this.minRatio*mapRes;}else if(resRatio<=this.minRatio){targetRes=this.maxRatio*mapRes;}  
var center;if(this.ovmap.getProjection()!=this.map.getProjection()){center=this.map.center.clone();center.transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject());}else{center=this.map.center;}  
this.ovmap.setCenter(center,this.ovmap.getZoomForResolution(targetRes*this.resolutionFactor));this.updateRectToMap();},createMap:function(){var options=OpenLayers.Util.extend({controls:[],maxResolution:'auto',fallThrough:false},this.mapOptions);this.ovmap=new OpenLayers.Map(this.mapDiv,options);OpenLayers.Event.stopObserving(window,'unload',this.ovmap.unloadDestroy);this.ovmap.addLayers(this.layers);this.ovmap.zoomToMaxExtent();this.wComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-left-width'))+  
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-right-width'));this.wComp=(this.wComp)?this.wComp:2;this.hComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-top-width'))+  
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-bottom-width'));this.hComp=(this.hComp)?this.hComp:2;this.handlers.drag=new OpenLayers.Handler.Drag(this,{move:this.rectDrag,done:this.updateMapToRect},{map:this.ovmap});this.handlers.click=new OpenLayers.Handler.Click(this,{"click":this.mapDivClick},{"single":true,"double":false,"stopSingle":true,"stopDouble":true,"pixelTolerance":1,map:this.ovmap});this.handlers.click.activate();this.rectEvents=new OpenLayers.Events(this,this.extentRectangle,null,true);this.rectEvents.register("mouseover",this,function(e){if(!this.handlers.drag.active&&!this.map.dragging){this.handlers.drag.activate();}});this.rectEvents.register("mouseout",this,function(e){if(!this.handlers.drag.dragging){this.handlers.drag.deactivate();}});if(this.ovmap.getProjection()!=this.map.getProjection()){var sourceUnits=this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units;var targetUnits=this.ovmap.getProjectionObject().getUnits()||this.ovmap.units||this.ovmap.baseLayer.units;this.resolutionFactor=sourceUnits&&targetUnits?OpenLayers.INCHES_PER_UNIT[sourceUnits]/OpenLayers.INCHES_PER_UNIT[targetUnits]:1;}},updateRectToMap:function(){var bounds;if(this.ovmap.getProjection()!=this.map.getProjection()){bounds=this.map.getExtent().transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject());}else{bounds=this.map.getExtent();}  
var pxBounds=this.getRectBoundsFromMapBounds(bounds);if(pxBounds){this.setRectPxBounds(pxBounds);}},updateMapToRect:function(){var lonLatBounds=this.getMapBoundsFromRectBounds(this.rectPxBounds);if(this.ovmap.getProjection()!=this.map.getProjection()){lonLatBounds=lonLatBounds.transform(this.ovmap.getProjectionObject(),this.map.getProjectionObject());}  
this.map.panTo(lonLatBounds.getCenterLonLat());},setRectPxBounds:function(pxBounds){var top=Math.max(pxBounds.top,0);var left=Math.max(pxBounds.left,0);var bottom=Math.min(pxBounds.top+Math.abs(pxBounds.getHeight()),this.ovmap.size.h-this.hComp);var right=Math.min(pxBounds.left+pxBounds.getWidth(),this.ovmap.size.w-this.wComp);var width=Math.max(right-left,0);var height=Math.max(bottom-top,0);if(width<this.minRectSize||height<this.minRectSize){this.extentRectangle.className=this.displayClass+  
this.minRectDisplayClass;var rLeft=left+(width/2)-(this.minRectSize/2);var rTop=top+(height/2)-(this.minRectSize/2);this.extentRectangle.style.top=Math.round(rTop)+'px';this.extentRectangle.style.left=Math.round(rLeft)+'px';this.extentRectangle.style.height=this.minRectSize+'px';this.extentRectangle.style.width=this.minRectSize+'px';}else{this.extentRectangle.className=this.displayClass+'ExtentRectangle';this.extentRectangle.style.top=Math.round(top)+'px';this.extentRectangle.style.left=Math.round(left)+'px';this.extentRectangle.style.height=Math.round(height)+'px';this.extentRectangle.style.width=Math.round(width)+'px';}  
this.rectPxBounds=new OpenLayers.Bounds(Math.round(left),Math.round(bottom),Math.round(right),Math.round(top));},getRectBoundsFromMapBounds:function(lonLatBounds){var leftBottomLonLat=new OpenLayers.LonLat(lonLatBounds.left,lonLatBounds.bottom);var rightTopLonLat=new OpenLayers.LonLat(lonLatBounds.right,lonLatBounds.top);var leftBottomPx=this.getOverviewPxFromLonLat(leftBottomLonLat);var rightTopPx=this.getOverviewPxFromLonLat(rightTopLonLat);var bounds=null;if(leftBottomPx&&rightTopPx){bounds=new OpenLayers.Bounds(leftBottomPx.x,leftBottomPx.y,rightTopPx.x,rightTopPx.y);}  
return bounds;},getMapBoundsFromRectBounds:function(pxBounds){var leftBottomPx=new OpenLayers.Pixel(pxBounds.left,pxBounds.bottom);var rightTopPx=new OpenLayers.Pixel(pxBounds.right,pxBounds.top);var leftBottomLonLat=this.getLonLatFromOverviewPx(leftBottomPx);var rightTopLonLat=this.getLonLatFromOverviewPx(rightTopPx);return new OpenLayers.Bounds(leftBottomLonLat.lon,leftBottomLonLat.lat,rightTopLonLat.lon,rightTopLonLat.lat);},getLonLatFromOverviewPx:function(overviewMapPx){var size=this.ovmap.size;var res=this.ovmap.getResolution();var center=this.ovmap.getExtent().getCenterLonLat();var delta_x=overviewMapPx.x-(size.w/2);var delta_y=overviewMapPx.y-(size.h/2);return new OpenLayers.LonLat(center.lon+delta_x*res,center.lat-delta_y*res);},getOverviewPxFromLonLat:function(lonlat){var res=this.ovmap.getResolution();var extent=this.ovmap.getExtent();var px=null;if(extent){px=new OpenLayers.Pixel(Math.round(1/res*(lonlat.lon-extent.left)),Math.round(1/res*(extent.top-lonlat.lat)));}  
return px;},CLASS_NAME:'OpenLayers.Control.OverviewMap'});OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:OpenLayers.Popup.AnchoredBubble,popup:null,initialize:function(layer,lonlat,data){this.layer=layer;this.lonlat=lonlat;this.data=(data!=null)?data:{};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 onScreen=false;if((this.layer!=null)&&(this.layer.map!=null)){var screenBounds=this.layer.map.getExtent();onScreen=screenBounds.containsLonLat(this.lonlat);}  
return onScreen;},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(closeBox){if(this.lonlat!=null){var id=this.id+"_popup";var anchor=(this.marker)?this.marker.icon:null;if(!this.popup){this.popup=new this.popupClass(id,this.lonlat,this.data.popupSize,this.data.popupContentHTML,anchor,closeBox);}  
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.Format.CSWGetDomain.v2_0_2=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",csw:"http://www.opengis.net/cat/csw/2.0.2"},defaultPrefix:"csw",version:"2.0.2",schemaLocation:"http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd",PropertyName:null,ParameterName:null,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
if(data&&data.nodeType==9){data=data.documentElement;}  
var obj={};this.readNode(data,obj);return obj;},readers:{"csw":{"GetDomainResponse":function(node,obj){this.readChildNodes(node,obj);},"DomainValues":function(node,obj){if(!(obj.DomainValues instanceof Array)){obj.DomainValues=[];}  
var attrs=node.attributes;var domainValue={};for(var i=0,len=attrs.length;i<len;++i){domainValue[attrs[i].name]=attrs[i].nodeValue;}  
this.readChildNodes(node,domainValue);obj.DomainValues.push(domainValue);},"PropertyName":function(node,obj){obj.PropertyName=this.getChildValue(node);},"ParameterName":function(node,obj){obj.ParameterName=this.getChildValue(node);},"ListOfValues":function(node,obj){if(!(obj.ListOfValues instanceof Array)){obj.ListOfValues=[];}  
this.readChildNodes(node,obj.ListOfValues);},"Value":function(node,obj){var attrs=node.attributes;var value={}  
for(var i=0,len=attrs.length;i<len;++i){value[attrs[i].name]=attrs[i].nodeValue;}  
value.value=this.getChildValue(node);obj.push({Value:value});},"ConceptualScheme":function(node,obj){obj.ConceptualScheme={};this.readChildNodes(node,obj.ConceptualScheme);},"Name":function(node,obj){obj.Name=this.getChildValue(node);},"Document":function(node,obj){obj.Document=this.getChildValue(node);},"Authority":function(node,obj){obj.Authority=this.getChildValue(node);},"RangeOfValues":function(node,obj){obj.RangeOfValues={};this.readChildNodes(node,obj.RangeOfValues);},"MinValue":function(node,obj){var attrs=node.attributes;var value={}  
for(var i=0,len=attrs.length;i<len;++i){value[attrs[i].name]=attrs[i].nodeValue;}  
value.value=this.getChildValue(node);obj.MinValue=value;},"MaxValue":function(node,obj){var attrs=node.attributes;var value={}  
for(var i=0,len=attrs.length;i<len;++i){value[attrs[i].name]=attrs[i].nodeValue;}  
value.value=this.getChildValue(node);obj.MaxValue=value;}}},write:function(options){var node=this.writeNode("csw:GetDomain",options);return OpenLayers.Format.XML.prototype.write.apply(this,[node]);},writers:{"csw":{"GetDomain":function(options){var node=this.createElementNSPlus("csw:GetDomain",{attributes:{service:"CSW",version:this.version}});if(options.PropertyName||this.PropertyName){this.writeNode("csw:PropertyName",options.PropertyName||this.PropertyName,node);}else if(options.ParameterName||this.ParameterName){this.writeNode("csw:ParameterName",options.ParameterName||this.ParameterName,node);}  
this.readChildNodes(node,options);return node;},"PropertyName":function(value){var node=this.createElementNSPlus("csw:PropertyName",{value:value});return node;},"ParameterName":function(value){var node=this.createElementNSPlus("csw:ParameterName",{value:value});return node;}}},CLASS_NAME:"OpenLayers.Format.CSWGetDomain.v2_0_2"});OpenLayers.Format.Context=OpenLayers.Class({version:null,layerOptions:null,layerParams:null,parser:null,initialize:function(options){OpenLayers.Util.extend(this,options);this.options=options;},read:function(data,options){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var root=data.documentElement;var version=this.version;if(!version){version=root.getAttribute("version");}  
var parser=this.getParser(version);var context=parser.read(data,options);var map;if(options&&options.map){this.context=context;if(options.map instanceof OpenLayers.Map){map=this.mergeContextToMap(context,options.map);}else{var mapOptions=options.map;if(OpenLayers.Util.isElement(mapOptions)||typeof mapOptions=="string"){mapOptions={div:mapOptions};}  
map=this.contextToMap(context,mapOptions);}}else{map=context;}  
return map;},getLayerFromContext:function(layerContext){var i,len;var options={queryable:layerContext.queryable,visibility:layerContext.visibility,maxExtent:layerContext.maxExtent,metadata:OpenLayers.Util.applyDefaults(layerContext.metadata,{styles:layerContext.styles}),numZoomLevels:layerContext.numZoomLevels,units:layerContext.units,isBaseLayer:layerContext.isBaseLayer,opacity:layerContext.opacity,displayInLayerSwitcher:layerContext.displayInLayerSwitcher,singleTile:layerContext.singleTile,tileSize:(layerContext.tileSize)?new OpenLayers.Size(layerContext.tileSize.width,layerContext.tileSize.height):undefined,minScale:layerContext.minScale||layerContext.maxScaleDenominator,maxScale:layerContext.maxScale||layerContext.minScaleDenominator};if(this.layerOptions){OpenLayers.Util.applyDefaults(options,this.layerOptions);}  
var params={layers:layerContext.name,transparent:layerContext.transparent,version:layerContext.version};if(layerContext.formats&&layerContext.formats.length>0){params.format=layerContext.formats[0].value;for(i=0,len=layerContext.formats.length;i<len;i++){var format=layerContext.formats[i];if(format.current==true){params.format=format.value;break;}}}  
if(layerContext.styles&&layerContext.styles.length>0){for(i=0,len=layerContext.styles.length;i<len;i++){var style=layerContext.styles[i];if(style.current==true){if(style.href){params.sld=style.href;}else if(style.body){params.sld_body=style.body;}else{params.styles=style.name;}  
break;}}}  
if(this.layerParams){OpenLayers.Util.applyDefaults(params,this.layerParams);}  
var layer=null;var service=layerContext.service;if(service==OpenLayers.Format.Context.serviceTypes.WFS){options.strategies=[new OpenLayers.Strategy.BBOX()];options.protocol=new OpenLayers.Protocol.WFS({url:layerContext.url,featurePrefix:layerContext.name.split(":")[0],featureType:layerContext.name.split(":").pop()});layer=new OpenLayers.Layer.Vector(layerContext.title||layerContext.name,options);}else if(service==OpenLayers.Format.Context.serviceTypes.KML){options.strategies=[new OpenLayers.Strategy.Fixed()];options.protocol=new OpenLayers.Protocol.HTTP({url:layerContext.url,format:new OpenLayers.Format.KML()});layer=new OpenLayers.Layer.Vector(layerContext.title||layerContext.name,options);}else if(service==OpenLayers.Format.Context.serviceTypes.GML){options.strategies=[new OpenLayers.Strategy.Fixed()];options.protocol=new OpenLayers.Protocol.HTTP({url:layerContext.url,format:new OpenLayers.Format.GML()});layer=new OpenLayers.Layer.Vector(layerContext.title||layerContext.name,options);}else if(layerContext.features){layer=new OpenLayers.Layer.Vector(layerContext.title||layerContext.name,options);layer.addFeatures(layerContext.features);}else if(layerContext.categoryLayer!==true){layer=new OpenLayers.Layer.WMS(layerContext.title||layerContext.name,layerContext.url,params,options);}  
return layer;},getLayersFromContext:function(layersContext){var layers=[];for(var i=0,len=layersContext.length;i<len;i++){var layer=this.getLayerFromContext(layersContext[i]);if(layer!==null){layers.push(layer);}}  
return layers;},contextToMap:function(context,options){options=OpenLayers.Util.applyDefaults({maxExtent:context.maxExtent,projection:context.projection},options);var map=new OpenLayers.Map(options);map.addLayers(this.getLayersFromContext(context.layersContext));map.setCenter(context.bounds.getCenterLonLat(),map.getZoomForExtent(context.bounds,true));return map;},mergeContextToMap:function(context,map){map.addLayers(this.getLayersFromContext(context.layersContext));return map;},write:function(obj,options){obj=this.toContext(obj);var version=options&&options.version;var parser=this.getParser(version);var context=parser.write(obj,options);return context;},CLASS_NAME:"OpenLayers.Format.Context"});OpenLayers.Format.Context.serviceTypes={"WMS":"urn:ogc:serviceType:WMS","WFS":"urn:ogc:serviceType:WFS","WCS":"urn:ogc:serviceType:WCS","GML":"urn:ogc:serviceType:GML","SLD":"urn:ogc:serviceType:SLD","FES":"urn:ogc:serviceType:FES","KML":"urn:ogc:serviceType:KML"};if(!OpenLayers.Format.OWSCommon){OpenLayers.Format.OWSCommon={};}  
OpenLayers.Format.OWSCommon.v1=OpenLayers.Class(OpenLayers.Format.XML,{regExes:{trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)},readers:{"ows":{"ServiceIdentification":function(node,obj){obj.serviceIdentification={};this.readChildNodes(node,obj.serviceIdentification);},"Title":function(node,obj){obj.title=this.getChildValue(node);},"Abstract":function(node,serviceIdentification){serviceIdentification["abstract"]=this.getChildValue(node);},"Keywords":function(node,serviceIdentification){serviceIdentification.keywords={};this.readChildNodes(node,serviceIdentification.keywords);},"Keyword":function(node,keywords){keywords[this.getChildValue(node)]=true;},"ServiceType":function(node,serviceIdentification){serviceIdentification.serviceType={codeSpace:node.getAttribute('codeSpace'),value:this.getChildValue(node)};},"ServiceTypeVersion":function(node,serviceIdentification){serviceIdentification.serviceTypeVersion=this.getChildValue(node);},"Fees":function(node,serviceIdentification){serviceIdentification.fees=this.getChildValue(node);},"AccessConstraints":function(node,serviceIdentification){serviceIdentification.accessConstraints=this.getChildValue(node);},"ServiceProvider":function(node,obj){obj.serviceProvider={};this.readChildNodes(node,obj.serviceProvider);},"ProviderName":function(node,serviceProvider){serviceProvider.providerName=this.getChildValue(node);},"ProviderSite":function(node,serviceProvider){serviceProvider.providerSite=this.getAttributeNS(node,this.namespaces.xlink,"href");},"ServiceContact":function(node,serviceProvider){serviceProvider.serviceContact={};this.readChildNodes(node,serviceProvider.serviceContact);},"IndividualName":function(node,serviceContact){serviceContact.individualName=this.getChildValue(node);},"PositionName":function(node,serviceContact){serviceContact.positionName=this.getChildValue(node);},"ContactInfo":function(node,serviceContact){serviceContact.contactInfo={};this.readChildNodes(node,serviceContact.contactInfo);},"Phone":function(node,contactInfo){contactInfo.phone={};this.readChildNodes(node,contactInfo.phone);},"Voice":function(node,phone){phone.voice=this.getChildValue(node);},"Address":function(node,contactInfo){contactInfo.address={};this.readChildNodes(node,contactInfo.address);},"DeliveryPoint":function(node,address){address.deliveryPoint=this.getChildValue(node);},"City":function(node,address){address.city=this.getChildValue(node);},"AdministrativeArea":function(node,address){address.administrativeArea=this.getChildValue(node);},"PostalCode":function(node,address){address.postalCode=this.getChildValue(node);},"Country":function(node,address){address.country=this.getChildValue(node);},"ElectronicMailAddress":function(node,address){address.electronicMailAddress=this.getChildValue(node);},"Role":function(node,serviceContact){serviceContact.role=this.getChildValue(node);},"OperationsMetadata":function(node,obj){obj.operationsMetadata={};this.readChildNodes(node,obj.operationsMetadata);},"Operation":function(node,operationsMetadata){var name=node.getAttribute("name");operationsMetadata[name]={};this.readChildNodes(node,operationsMetadata[name]);},"DCP":function(node,operation){operation.dcp={};this.readChildNodes(node,operation.dcp);},"HTTP":function(node,dcp){dcp.http={};this.readChildNodes(node,dcp.http);},"Get":function(node,http){http.get=this.getAttributeNS(node,this.namespaces.xlink,"href");},"Post":function(node,http){http.post=this.getAttributeNS(node,this.namespaces.xlink,"href");},"Parameter":function(node,operation){if(!operation.parameters){operation.parameters={};}  
var name=node.getAttribute("name");operation.parameters[name]={};this.readChildNodes(node,operation.parameters[name]);},"Value":function(node,allowedValues){allowedValues[this.getChildValue(node)]=true;},"OutputFormat":function(node,obj){obj.formats.push({value:this.getChildValue(node)});this.readChildNodes(node,obj);},"WGS84BoundingBox":function(node,obj){var boundingBox={};boundingBox.crs=node.getAttribute("crs");if(obj.BoundingBox){obj.BoundingBox.push(boundingBox);}else{obj.projection=boundingBox.crs;boundingBox=obj;}  
this.readChildNodes(node,boundingBox);},"BoundingBox":function(node,obj){this.readers['ows']['WGS84BoundingBox'].apply(this,[node,obj]);},"LowerCorner":function(node,obj){var str=this.getChildValue(node).replace(this.regExes.trimSpace,"");str=str.replace(this.regExes.trimComma,",");var pointList=str.split(this.regExes.splitSpace);obj.left=pointList[0];obj.bottom=pointList[1];},"UpperCorner":function(node,obj){var str=this.getChildValue(node).replace(this.regExes.trimSpace,"");str=str.replace(this.regExes.trimComma,",");var pointList=str.split(this.regExes.splitSpace);obj.right=pointList[0];obj.top=pointList[1];obj.bounds=new OpenLayers.Bounds(obj.left,obj.bottom,obj.right,obj.top);delete obj.left;delete obj.bottom;delete obj.right;delete obj.top;}}},writers:{"ows":{"BoundingBox":function(options){var node=this.createElementNSPlus("ows:BoundingBox",{attributes:{crs:options.projection}});this.writeNode("ows:LowerCorner",options,node);this.writeNode("ows:UpperCorner",options,node);return node;},"LowerCorner":function(options){var node=this.createElementNSPlus("ows:LowerCorner",{value:options.bounds.left+" "+options.bounds.bottom});return node;},"UpperCorner":function(options){var node=this.createElementNSPlus("ows:UpperCorner",{value:options.bounds.right+" "+options.bounds.top});return node;},"Title":function(title){var node=this.createElementNSPlus("ows:Title",{value:title});return node;},"OutputFormat":function(format){var node=this.createElementNSPlus("ows:OutputFormat",{value:format});return node;}}},CLASS_NAME:"OpenLayers.Format.OWSCommon.v1"});OpenLayers.Format.SOSCapabilities=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:"1.0.0",version:null,parser:null,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);this.options=options;},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var root=data.documentElement;var version=this.version||root.getAttribute("version")||this.defaultVersion;if(!this.parser||this.parser.version!==version){var constr=OpenLayers.Format.SOSCapabilities["v"+version.replace(/\./g,"_")];if(!constr){throw"Can't find a SOS capabilities parser for version "+version;}  
var parser=new constr(this.options);}  
var capabilities=parser.read(data);capabilities.version=version;return capabilities;},CLASS_NAME:"OpenLayers.Format.SOSCapabilities"});OpenLayers.Format.WFSCapabilities=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:"1.1.0",version:null,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);this.options=options;},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var root=data.documentElement;var version=this.version;if(!version){version=root.getAttribute("version");if(!version){version=this.defaultVersion;}}  
var constr=OpenLayers.Format.WFSCapabilities["v"+version.replace(/\./g,"_")];if(!constr){throw"Can't find a WFS capabilities parser for version "+version;}  
var parser=new constr(this.options);var capabilities=parser.read(data);capabilities.version=version;return capabilities;},CLASS_NAME:"OpenLayers.Format.WFSCapabilities"});OpenLayers.Format.WFSDescribeFeatureType=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xsd:"http://www.w3.org/2001/XMLSchema"},initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},readers:{"xsd":{"schema":function(node,obj){var complexTypes=[];var customTypes={};var schema={complexTypes:complexTypes,customTypes:customTypes};this.readChildNodes(node,schema);var attributes=node.attributes;var attr,name;for(var i=0,len=attributes.length;i<len;++i){attr=attributes[i];name=attr.name;if(name.indexOf("xmlns")==0){this.setNamespace(name.split(":")[1]||"",attr.value);}else{obj[name]=attr.value;}}  
obj.featureTypes=complexTypes;obj.targetPrefix=this.namespaceAlias[obj.targetNamespace];var complexType,customType;for(var i=0,len=complexTypes.length;i<len;++i){complexType=complexTypes[i];customType=customTypes[complexType.typeName];if(customTypes[complexType.typeName]){complexType.typeName=customType.name;}}},"complexType":function(node,obj){var complexType={"typeName":node.getAttribute("name")};this.readChildNodes(node,complexType);obj.complexTypes.push(complexType);},"complexContent":function(node,obj){this.readChildNodes(node,obj);},"extension":function(node,obj){this.readChildNodes(node,obj);},"sequence":function(node,obj){var sequence={elements:[]};this.readChildNodes(node,sequence);obj.properties=sequence.elements;},"element":function(node,obj){if(obj.elements){var element={};var attributes=node.attributes;var attr;for(var i=0,len=attributes.length;i<len;++i){attr=attributes[i];element[attr.name]=attr.value;}  
var type=element.type;if(!type){type={};this.readChildNodes(node,type);element.restriction=type;element.type=type.base;}  
var fullType=type.base||type;element.localType=fullType.split(":").pop();obj.elements.push(element);}  
if(obj.complexTypes){var type=node.getAttribute("type");var localType=type.split(":").pop();obj.customTypes[localType]={"name":node.getAttribute("name"),"type":type};}},"simpleType":function(node,obj){this.readChildNodes(node,obj);},"restriction":function(node,obj){obj.base=node.getAttribute("base");this.readRestriction(node,obj);}}},readRestriction:function(node,obj){var children=node.childNodes;var child,nodeName,value;for(var i=0,len=children.length;i<len;++i){child=children[i];if(child.nodeType==1){nodeName=child.nodeName.split(":").pop();value=child.getAttribute("value");if(!obj[nodeName]){obj[nodeName]=value;}else{if(typeof obj[nodeName]=="string"){obj[nodeName]=[obj[nodeName]];}  
obj[nodeName].push(value);}}}},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
if(data&&data.nodeType==9){data=data.documentElement;}  
var schema={};this.readNode(data,schema);return schema;},CLASS_NAME:"OpenLayers.Format.WFSDescribeFeatureType"});OpenLayers.Format.WFST.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs",gml:"http://www.opengis.net/gml",ogc:"http://www.opengis.net/ogc"},defaultPrefix:"wfs",version:null,schemaLocations:null,srsName:null,extractAttributes:true,xy:true,stateName:null,initialize:function(options){this.stateName={};this.stateName[OpenLayers.State.INSERT]="wfs:Insert";this.stateName[OpenLayers.State.UPDATE]="wfs:Update";this.stateName[OpenLayers.State.DELETE]="wfs:Delete";OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},getSrsName:function(feature,options){var srsName=options&&options.srsName;if(!srsName){if(feature&&feature.layer){srsName=feature.layer.projection.getCode();}else{srsName=this.srsName;}}  
return srsName;},read:function(data,options){options=options||{};OpenLayers.Util.applyDefaults(options,{output:"features"});if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
if(data&&data.nodeType==9){data=data.documentElement;}  
var obj={};if(data){this.readNode(data,obj);}  
if(obj.features&&options.output==="features"){obj=obj.features;}  
return obj;},readers:{"wfs":{"FeatureCollection":function(node,obj){obj.features=[];this.readChildNodes(node,obj);}}},write:function(features){var node=this.writeNode("wfs:Transaction",features);var value=this.schemaLocationAttr();if(value){this.setAttributeNS(node,this.namespaces["xsi"],"xsi:schemaLocation",value)}  
return OpenLayers.Format.XML.prototype.write.apply(this,[node]);},writers:{"wfs":{"GetFeature":function(options){var node=this.createElementNSPlus("wfs:GetFeature",{attributes:{service:"WFS",version:this.version,outputFormat:options&&options.outputFormat,maxFeatures:options&&options.maxFeatures,"xsi:schemaLocation":this.schemaLocationAttr(options)}});if(typeof this.featureType=="string"){this.writeNode("Query",options,node);}else{for(var i=0,len=this.featureType.length;i<len;i++){options.featureType=this.featureType[i];this.writeNode("Query",options,node);}}  
return node;},"Transaction":function(features){var node=this.createElementNSPlus("wfs:Transaction",{attributes:{service:"WFS",version:this.version}});if(features){var name,feature;for(var i=0,len=features.length;i<len;++i){feature=features[i];name=this.stateName[feature.state];if(name){this.writeNode(name,feature,node);}}}  
return node;},"Insert":function(feature){var node=this.createElementNSPlus("wfs:Insert");this.srsName=this.getSrsName(feature);this.writeNode("feature:_typeName",feature,node);return node;},"Update":function(feature){var node=this.createElementNSPlus("wfs:Update",{attributes:{typeName:(this.featureNS?this.featurePrefix+":":"")+  
this.featureType}});if(this.featureNS){node.setAttribute("xmlns:"+this.featurePrefix,this.featureNS);}  
if(this.geometryName!==null){this.writeNode("Property",{name:this.geometryName,value:feature},node);}  
for(var key in feature.attributes){if(feature.attributes[key]!==undefined){this.writeNode("Property",{name:key,value:feature.attributes[key]},node);}}  
this.writeNode("ogc:Filter",new OpenLayers.Filter.FeatureId({fids:[feature.fid]}),node);return node;},"Property":function(obj){var node=this.createElementNSPlus("wfs:Property");this.writeNode("Name",obj.name,node);if(obj.value!==null){this.writeNode("Value",obj.value,node);}  
return node;},"Name":function(name){return this.createElementNSPlus("wfs:Name",{value:name});},"Value":function(obj){var node;if(obj instanceof OpenLayers.Feature.Vector){node=this.createElementNSPlus("wfs:Value");this.srsName=this.getSrsName(obj);var geom=this.writeNode("feature:_geometry",obj.geometry).firstChild;node.appendChild(geom);}else{node=this.createElementNSPlus("wfs:Value",{value:obj});}  
return node;},"Delete":function(feature){var node=this.createElementNSPlus("wfs:Delete",{attributes:{typeName:(this.featureNS?this.featurePrefix+":":"")+  
this.featureType}});if(this.featureNS){node.setAttribute("xmlns:"+this.featurePrefix,this.featureNS);}  
this.writeNode("ogc:Filter",new OpenLayers.Filter.FeatureId({fids:[feature.fid]}),node);return node;}}},schemaLocationAttr:function(options){options=OpenLayers.Util.extend({featurePrefix:this.featurePrefix,schema:this.schema},options);var schemaLocations=OpenLayers.Util.extend({},this.schemaLocations);if(options.schema){schemaLocations[options.featurePrefix]=options.schema;}  
var parts=[];var uri;for(var key in schemaLocations){uri=this.namespaces[key];if(uri){parts.push(uri+" "+schemaLocations[key]);}}  
var value=parts.join(" ")||undefined;return value;},setFilterProperty:function(filter){if(filter.filters){for(var i=0,len=filter.filters.length;i<len;++i){this.setFilterProperty(filter.filters[i]);}}else{if(filter instanceof OpenLayers.Filter.Spatial){filter.property=this.geometryName;}}},CLASS_NAME:"OpenLayers.Format.WFST.v1"});OpenLayers.Format.WMSCapabilities=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:"1.1.1",version:null,parser:null,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);this.options=options;},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var root=data.documentElement;var version=this.version||root.getAttribute("version")||this.defaultVersion;if(!this.parser||this.parser.version!==version){var constr=OpenLayers.Format.WMSCapabilities["v"+version.replace(/\./g,"_")];if(!constr){throw"Can't find a WMS capabilities parser for version "+version;}  
this.parser=new constr(this.options);}  
var capabilities=this.parser.read(data);capabilities.version=version;return capabilities;},CLASS_NAME:"OpenLayers.Format.WMSCapabilities"});OpenLayers.Format.WMSDescribeLayer=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:"1.1.1",version:null,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);this.options=options;},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var root=data.documentElement;var version=this.version;if(!version){version=root.getAttribute("version");if(!version){version=this.defaultVersion;}}  
if(version=="1.1.1"||version=="1.1.0"){version="1.1";}  
var constructor=OpenLayers.Format.WMSDescribeLayer["v"+version.replace(/\./g,"_")];if(!constructor){throw"Can't find a WMS DescribeLayer parser for version "+  
version;}  
var parser=new constructor(this.options);var describelayer=parser.read(data);describelayer.version=version;return describelayer;},CLASS_NAME:"OpenLayers.Format.WMSDescribeLayer"});OpenLayers.Format.WMSGetFeatureInfo=OpenLayers.Class(OpenLayers.Format.XML,{layerIdentifier:'_layer',featureIdentifier:'_feature',regExes:{trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)},gmlFormat:null,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,arguments);OpenLayers.Util.extend(this,options);this.options=options;},read:function(data){var result;if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var root=data.documentElement;if(root){var scope=this;var read=this["read_"+root.nodeName];if(read){result=read.call(this,root);}else{result=new OpenLayers.Format.GML((this.options?this.options:{})).read(data);}}else{result=data;}  
return result;},read_msGMLOutput:function(data){var response=[];var layerNodes=this.getSiblingNodesByTagCriteria(data,this.layerIdentifier);if(layerNodes){for(var i=0,len=layerNodes.length;i<len;++i){var node=layerNodes[i];var layerName=node.nodeName;if(node.prefix){layerName=layerName.split(':')[1];}  
var layerName=layerName.replace(this.layerIdentifier,'');var featureNodes=this.getSiblingNodesByTagCriteria(node,this.featureIdentifier);if(featureNodes){for(var j=0;j<featureNodes.length;j++){var featureNode=featureNodes[j];var geomInfo=this.parseGeometry(featureNode);var attributes=this.parseAttributes(featureNode);var feature=new OpenLayers.Feature.Vector(geomInfo.geometry,attributes,null);feature.bounds=geomInfo.bounds;feature.type=layerName;response.push(feature);}}}}  
return response;},read_FeatureInfoResponse:function(data){var response=[];var featureNodes=this.getElementsByTagNameNS(data,'*','FIELDS');for(var i=0,len=featureNodes.length;i<len;i++){var featureNode=featureNodes[i];var geom=null;var attributes={};for(var j=0,jlen=featureNode.attributes.length;j<jlen;j++){var attribute=featureNode.attributes[j];attributes[attribute.nodeName]=attribute.nodeValue;}  
response.push(new OpenLayers.Feature.Vector(geom,attributes,null));}  
return response;},getSiblingNodesByTagCriteria:function(node,criteria){var nodes=[];var children,tagName,n,matchNodes,child;if(node&&node.hasChildNodes()){children=node.childNodes;n=children.length;for(var k=0;k<n;k++){child=children[k];while(child&&child.nodeType!=1){child=child.nextSibling;k++;}  
tagName=(child?child.nodeName:'');if(tagName.length>0&&tagName.indexOf(criteria)>-1){nodes.push(child);}else{matchNodes=this.getSiblingNodesByTagCriteria(child,criteria);if(matchNodes.length>0){(nodes.length==0)?nodes=matchNodes:nodes.push(matchNodes);}}}}  
return nodes;},parseAttributes:function(node){var attributes={};if(node.nodeType==1){var children=node.childNodes;var n=children.length;for(var i=0;i<n;++i){var child=children[i];if(child.nodeType==1){var grandchildren=child.childNodes;if(grandchildren.length==1){var grandchild=grandchildren[0];if(grandchild.nodeType==3||grandchild.nodeType==4){var name=(child.prefix)?child.nodeName.split(":")[1]:child.nodeName;var value=grandchild.nodeValue.replace(this.regExes.trimSpace,"");attributes[name]=value;}}}}}  
return attributes;},parseGeometry:function(node){if(!this.gmlFormat){this.gmlFormat=new OpenLayers.Format.GML();}  
var feature=this.gmlFormat.parseFeature(node);var geometry,bounds=null;if(feature){geometry=feature.geometry&&feature.geometry.clone();bounds=feature.bounds&&feature.bounds.clone();feature.destroy();}  
return{geometry:geometry,bounds:bounds};},CLASS_NAME:"OpenLayers.Format.WMSGetFeatureInfo"});OpenLayers.Format.WMTSCapabilities=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:"1.0.0",version:null,parser:null,yx:{"urn:ogc:def:crs:EPSG::4326":true},initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);this.options=options;},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var root=data.documentElement;var version=this.version||root.getAttribute("version")||this.defaultVersion;if(!this.parser||this.parser.version!==version){var constr=OpenLayers.Format.WMTSCapabilities["v"+version.replace(/\./g,"_")];if(!constr){throw new Error("Can't find a WMTS capabilities parser for version "+version);}  
this.parser=new constr(this.options);}  
return this.parser.read(data);},createLayer:function(capabilities,config){var layer;var required={layer:true,matrixSet:true};for(var prop in required){if(!(prop in config)){throw new Error("Missing property '"+prop+"' in layer configuration.");}}  
var contents=capabilities.contents;var matrixSet=contents.tileMatrixSets[config.matrixSet];var layers=contents.layers;var layerDef;for(var i=0,ii=contents.layers.length;i<ii;++i){if(contents.layers[i].identifier===config.layer){layerDef=contents.layers[i];break;}}  
if(layerDef&&matrixSet){var style;for(var i=0,ii=layerDef.styles.length;i<ii;++i){style=layerDef.styles[i];if(style.isDefault){break;}}  
layer=new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults(config,{url:capabilities.operationsMetadata.GetTile.dcp.http.get,name:layerDef.title,style:style,matrixIds:matrixSet.matrixIds}));}  
return layer;},CLASS_NAME:"OpenLayers.Format.WMTSCapabilities"});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(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.pixelTolerance!=null){this.mousedown=function(evt){this.down=evt.xy;return true;};}},mousedown:null,mouseup:function(evt){var propagate=true;if(this.checkModifiers(evt)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(evt)){propagate=this.rightclick(evt);}  
return propagate;},rightclick:function(evt){if(this.passesTolerance(evt)){if(this.rightclickTimerId!=null){this.clearTimer();this.callback('dblrightclick',[evt]);return!this.stopDouble;}else{var clickEvent=this['double']?OpenLayers.Util.extend({},evt):this.callback('rightclick',[evt]);var delayedRightCall=OpenLayers.Function.bind(this.delayedRightCall,this,clickEvent);this.rightclickTimerId=window.setTimeout(delayedRightCall,this.delay);}}  
return!this.stopSingle;},delayedRightCall:function(evt){this.rightclickTimerId=null;if(evt){this.callback('rightclick',[evt]);}  
return!this.stopSingle;},dblclick:function(evt){if(this.passesTolerance(evt)){if(this["double"]){this.callback('dblclick',[evt]);}  
this.clearTimer();}  
return!this.stopDouble;},click:function(evt){if(this.passesTolerance(evt)){if(this.timerId!=null){this.clearTimer();}else{var clickEvent=this.single?OpenLayers.Util.extend({},evt):null;this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,clickEvent),this.delay);}}  
return!this.stopSingle;},passesTolerance:function(evt){var passes=true;if(this.pixelTolerance!=null&&this.down){var dpx=Math.sqrt(Math.pow(this.down.x-evt.xy.x,2)+  
Math.pow(this.down.y-evt.xy.y,2));if(dpx>this.pixelTolerance){passes=false;}}  
return passes;},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(evt){this.timerId=null;if(evt){this.callback('click',[evt]);}},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();this.down=null;deactivated=true;}  
return deactivated;},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(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);},down:function(evt){},move:function(evt){},up:function(evt){},out:function(evt){},mousedown:function(evt){var propagate=true;this.dragging=false;if(this.checkModifiers(evt)&&OpenLayers.Event.isLeftClick(evt)){this.started=true;this.start=evt.xy;this.last=evt.xy;OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown");this.down(evt);this.callback("down",[evt.xy]);OpenLayers.Event.stop(evt);if(!this.oldOnselectstart){this.oldOnselectstart=(document.onselectstart)?document.onselectstart:OpenLayers.Function.True;}  
document.onselectstart=OpenLayers.Function.False;propagate=!this.stopDown;}else{this.started=false;this.start=null;this.last=null;}  
return propagate;},mousemove:function(evt){if(this.started&&!this.timeoutId&&(evt.xy.x!=this.last.x||evt.xy.y!=this.last.y)){if(this.documentDrag===true&&this.documentEvents){if(evt.element===document){this.adjustXY(evt);this.setEvent(evt);}else{this.destroyDocumentEvents();}}  
if(this.interval>0){this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval);}  
this.dragging=true;this.move(evt);this.callback("move",[evt.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(evt){if(this.started){if(this.documentDrag===true&&this.documentEvents){this.adjustXY(evt);this.destroyDocumentEvents();}  
var dragged=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(evt);this.callback("up",[evt.xy]);if(dragged){this.callback("done",[evt.xy]);}  
document.onselectstart=this.oldOnselectstart;}  
return true;},mouseout:function(evt){if(this.started&&OpenLayers.Util.mouseLeft(evt,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 dragged=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(evt);this.callback("out",[]);if(dragged){this.callback("done",[evt.xy]);}  
if(document.onselectstart){document.onselectstart=this.oldOnselectstart;}}}  
return true;},click:function(evt){return(this.start==this.last);},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;activated=true;}  
return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.started=false;this.dragging=false;this.start=null;this.last=null;deactivated=true;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");}  
return deactivated;},adjustXY:function(evt){var pos=OpenLayers.Util.pagePosition(this.map.div);evt.xy.x-=pos[0];evt.xy.y-=pos[1];},destroyDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown");this.documentEvents.destroy();this.documentEvents=null;},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{'click':{'in':'click','out':'clickout'},'mousemove':{'in':'over','out':'out'},'dblclick':{'in':'dblclick','out':null},'mousedown':{'in':null,'out':null},'mouseup':{'in':null,'out':null}},feature:null,lastFeature:null,down:null,up:null,clickTolerance:4,geometryTypes:null,stopClick:true,stopDown:true,stopUp:false,initialize:function(control,layer,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,[control,callbacks,options]);this.layer=layer;},mousedown:function(evt){this.down=evt.xy;return this.handle(evt)?!this.stopDown:true;},mouseup:function(evt){this.up=evt.xy;return this.handle(evt)?!this.stopUp:true;},click:function(evt){return this.handle(evt)?!this.stopClick:true;},mousemove:function(evt){if(!this.callbacks['over']&&!this.callbacks['out']){return true;}  
this.handle(evt);return true;},dblclick:function(evt){return!this.handle(evt);},geometryTypeMatches:function(feature){return this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)>-1;},handle:function(evt){if(this.feature&&!this.feature.layer){this.feature=null;}  
var type=evt.type;var handled=false;var previouslyIn=!!(this.feature);var click=(type=="click"||type=="dblclick");this.feature=this.layer.getFeatureFromEvent(evt);if(this.feature&&!this.feature.layer){this.feature=null;}  
if(this.lastFeature&&!this.lastFeature.layer){this.lastFeature=null;}  
if(this.feature){var inNew=(this.feature!=this.lastFeature);if(this.geometryTypeMatches(this.feature)){if(previouslyIn&&inNew){if(this.lastFeature){this.triggerCallback(type,'out',[this.lastFeature]);}  
this.triggerCallback(type,'in',[this.feature]);}else if(!previouslyIn||click){this.triggerCallback(type,'in',[this.feature]);}  
this.lastFeature=this.feature;handled=true;}else{if(this.lastFeature&&(previouslyIn&&inNew||click)){this.triggerCallback(type,'out',[this.lastFeature]);}  
this.feature=null;}}else{if(this.lastFeature&&(previouslyIn||click)){this.triggerCallback(type,'out',[this.lastFeature]);}}  
return handled;},triggerCallback:function(type,mode,args){var key=this.EVENTMAP[type][mode];if(key){if(type=='click'&&this.up&&this.down){var dpx=Math.sqrt(Math.pow(this.up.x-this.down.x,2)+  
Math.pow(this.up.y-this.down.y,2));if(dpx<=this.clickTolerance){this.callback(key,args);}}else{this.callback(key,args);}}},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.moveLayerToTop();this.map.events.on({"removelayer":this.handleMapEvents,"changelayer":this.handleMapEvents,scope:this});activated=true;}  
return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.moveLayerBack();this.feature=null;this.lastFeature=null;this.down=null;this.up=null;this.map.events.un({"removelayer":this.handleMapEvents,"changelayer":this.handleMapEvents,scope:this});deactivated=true;}  
return deactivated;},handleMapEvents:function(evt){if(!evt.property||evt.property=="order"){this.moveLayerToTop();}},moveLayerToTop:function(){var index=Math.max(this.map.Z_INDEX_BASE['Feature']-1,this.layer.getZIndex())+1;this.layer.setZIndex(index);},moveLayerBack:function(){var index=this.layer.getZIndex()-1;if(index>=this.map.Z_INDEX_BASE['Feature']){this.layer.setZIndex(index);}else{this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer));}},CLASS_NAME:"OpenLayers.Handler.Feature"});OpenLayers.Handler.Hover=OpenLayers.Class(OpenLayers.Handler,{delay:500,pixelTolerance:null,stopMove:false,px:null,timerId:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);},mousemove:function(evt){if(this.passesTolerance(evt.xy)){this.clearTimer();this.callback('move',[evt]);this.px=evt.xy;evt=OpenLayers.Util.extend({},evt);this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,evt),this.delay);}  
return!this.stopMove;},mouseout:function(evt){if(OpenLayers.Util.mouseLeft(evt,this.map.div)){this.clearTimer();this.callback('move',[evt]);}  
return true;},passesTolerance:function(px){var passes=true;if(this.pixelTolerance&&this.px){var dpx=Math.sqrt(Math.pow(this.px.x-px.x,2)+  
Math.pow(this.px.y-px.y,2));if(dpx<this.pixelTolerance){passes=false;}}  
return passes;},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null;}},delayedCall:function(evt){this.callback('pause',[evt]);},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();deactivated=true;}  
return deactivated;},CLASS_NAME:"OpenLayers.Handler.Hover"});OpenLayers.Handler.Keyboard=OpenLayers.Class(OpenLayers.Handler,{KEY_EVENTS:["keydown","keyup"],eventListener:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.eventListener=OpenLayers.Function.bindAsEventListener(this.handleKeyEvent,this);},destroy:function(){this.deactivate();this.eventListener=null;OpenLayers.Handler.prototype.destroy.apply(this,arguments);},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){for(var i=0,len=this.KEY_EVENTS.length;i<len;i++){OpenLayers.Event.observe(document,this.KEY_EVENTS[i],this.eventListener);}  
return true;}else{return false;}},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){for(var i=0,len=this.KEY_EVENTS.length;i<len;i++){OpenLayers.Event.stopObserving(document,this.KEY_EVENTS[i],this.eventListener);}  
deactivated=true;}  
return deactivated;},handleKeyEvent:function(evt){if(this.checkModifiers(evt)){this.callback(evt.type,[evt]);}},CLASS_NAME:"OpenLayers.Handler.Keyboard"});OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,interval:0,delta:0,cumulative:true,initialize:function(control,callbacks,options){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(e){if(!this.map||!this.checkModifiers(e)){return;}  
var overScrollableDiv=false;var overLayerDiv=false;var overMapDiv=false;var elem=OpenLayers.Event.element(e);while((elem!=null)&&!overMapDiv&&!overScrollableDiv){if(!overScrollableDiv){try{if(elem.currentStyle){overflow=elem.currentStyle["overflow"];}else{var style=document.defaultView.getComputedStyle(elem,null);var overflow=style.getPropertyValue("overflow");}  
overScrollableDiv=(overflow&&(overflow=="auto")||(overflow=="scroll"));}catch(err){}}  
if(!overLayerDiv){for(var i=0,len=this.map.layers.length;i<len;i++){if(elem==this.map.layers[i].div||elem==this.map.layers[i].pane){overLayerDiv=true;break;}}}  
overMapDiv=(elem==this.map.div);elem=elem.parentNode;}  
if(!overScrollableDiv&&overMapDiv){if(overLayerDiv){var delta=0;if(!e){e=window.event;}  
if(e.wheelDelta){delta=e.wheelDelta/120;if(window.opera&&window.opera.version()<9.2){delta=-delta;}}else if(e.detail){delta=-e.detail/3;}  
this.delta=this.delta+delta;if(this.interval){window.clearTimeout(this._timeoutId);this._timeoutId=window.setTimeout(OpenLayers.Function.bind(function(){this.wheelZoom(e);},this),this.interval);}else{this.wheelZoom(e);}}  
OpenLayers.Event.stop(e);}},wheelZoom:function(e){var delta=this.delta;this.delta=0;if(delta){if(this.mousePosition){e.xy=this.mousePosition;}  
if(!e.xy){e.xy=this.map.getPixelFromLonLat(this.map.getCenter());}  
if(delta<0){this.callback("down",[e,this.cumulative?delta:-1]);}else{this.callback("up",[e,this.cumulative?delta:1]);}}},mousemove:function(evt){this.mousePosition=evt.xy;},activate:function(evt){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var wheelListener=this.wheelListener;OpenLayers.Event.observe(window,"DOMMouseScroll",wheelListener);OpenLayers.Event.observe(window,"mousewheel",wheelListener);OpenLayers.Event.observe(document,"mousewheel",wheelListener);return true;}else{return false;}},deactivate:function(evt){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){var wheelListener=this.wheelListener;OpenLayers.Event.stopObserving(window,"DOMMouseScroll",wheelListener);OpenLayers.Event.stopObserving(window,"mousewheel",wheelListener);OpenLayers.Event.stopObserving(document,"mousewheel",wheelListener);return true;}else{return false;}},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:null,alwaysInRange:null,EVENT_TYPES:["loadstart","loadend","loadcancel","visibilitychanged","move","moveend"],RESOLUTION_PROPERTIES:['scales','resolutions','maxScale','minScale','maxResolution','minResolution','numZoomLevels','maxZoomLevel'],events:null,map:null,isBaseLayer:false,alpha:false,displayInLayerSwitcher:true,visibility:true,attribution:null,inRange:false,imageSize:null,imageOffset:null,options:null,eventListeners:null,gutter:0,projection:null,units:null,scales:null,resolutions:null,maxExtent:null,minExtent:null,maxResolution:null,minResolution:null,numZoomLevels:null,minScale:null,maxScale:null,displayOutsideMaxExtent:false,wrapDateLine:false,transitionEffect:null,SUPPORTED_TRANSITIONS:['resize'],metadata:{},initialize:function(name,options){this.addOptions(options);this.name=name;if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.div=OpenLayers.Util.createDiv(this.id);this.div.style.width="100%";this.div.style.height="100%";this.div.dir="ltr";this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners);}}  
if(this.wrapDateLine){this.displayOutsideMaxExtent=true;}},destroy:function(setNewBaseLayer){if(setNewBaseLayer==null){setNewBaseLayer=true;}  
if(this.map!=null){this.map.removeLayer(this,setNewBaseLayer);}  
this.projection=null;this.map=null;this.name=null;this.div=null;this.options=null;if(this.events){if(this.eventListeners){this.events.un(this.eventListeners);}  
this.events.destroy();}  
this.eventListeners=null;this.events=null;},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer(this.name,this.getOptions());}  
OpenLayers.Util.applyDefaults(obj,this);obj.map=null;return obj;},getOptions:function(){var options={};for(var o in this.options){options[o]=this[o];}  
return options;},setName:function(newName){if(newName!=this.name){this.name=newName;if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"name"});}}},addOptions:function(newOptions){if(this.options==null){this.options={};}  
OpenLayers.Util.extend(this.options,newOptions);OpenLayers.Util.extend(this,newOptions);if(typeof this.projection=="string"){this.projection=new OpenLayers.Projection(this.projection);}  
if(this.projection&&this.projection.getUnits()){this.units=this.projection.getUnits();}  
if(this.map){var properties=this.RESOLUTION_PROPERTIES.concat(["projection","units","minExtent","maxExtent"]);for(var o in newOptions){if(newOptions.hasOwnProperty(o)&&OpenLayers.Util.indexOf(properties,o)>=0){this.initResolutions();break;}}}},onMapResize:function(){},redraw:function(){var redrawn=false;if(this.map){this.inRange=this.calculateInRange();var extent=this.getExtent();if(extent&&this.inRange&&this.visibility){var zoomChanged=true;this.moveTo(extent,zoomChanged,false);this.events.triggerEvent("moveend",{"zoomChanged":zoomChanged});redrawn=true;}}  
return redrawn;},moveTo:function(bounds,zoomChanged,dragging){var display=this.visibility;if(!this.isBaseLayer){display=display&&this.inRange;}  
this.display(display);},setMap:function(map){if(this.map==null){this.map=map;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 show=((this.visibility)&&(this.inRange));this.div.style.display=show?"":"none";}  
this.setTileSize();}},afterAdd:function(){},removeMap:function(map){},getImageSize:function(bounds){return(this.imageSize||this.tileSize);},setTileSize:function(size){var tileSize=(size)?size:((this.tileSize)?this.tileSize:this.map.getTileSize());this.tileSize=tileSize;if(this.gutter){this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter);this.imageSize=new OpenLayers.Size(tileSize.w+(2*this.gutter),tileSize.h+(2*this.gutter));}},getVisibility:function(){return this.visibility;},setVisibility:function(visibility){if(visibility!=this.visibility){this.visibility=visibility;this.display(visibility);this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"});}  
this.events.triggerEvent("visibilitychanged");}},display:function(display){if(display!=(this.div.style.display!="none")){this.div.style.display=(display&&this.calculateInRange())?"block":"none";}},calculateInRange:function(){var inRange=false;if(this.alwaysInRange){inRange=true;}else{if(this.map){var resolution=this.map.getResolution();inRange=((resolution>=this.minResolution)&&(resolution<=this.maxResolution));}}  
return inRange;},setIsBaseLayer:function(isBaseLayer){if(isBaseLayer!=this.isBaseLayer){this.isBaseLayer=isBaseLayer;if(this.map!=null){this.map.events.triggerEvent("changebaselayer",{layer:this});}}},initResolutions:function(){var i,len;var props={},alwaysInRange=true;for(i=0,len=this.RESOLUTION_PROPERTIES.length;i<len;i++){var p=this.RESOLUTION_PROPERTIES[i];props[p]=this.options[p];if(alwaysInRange&&this.options[p]){alwaysInRange=false;}}  
if(this.alwaysInRange==null){this.alwaysInRange=alwaysInRange;}  
if(props.resolutions==null){props.resolutions=this.resolutionsFromScales(props.scales);}  
if(props.resolutions==null){props.resolutions=this.calculateResolutions(props);}  
if(props.resolutions==null){for(i=0,len=this.RESOLUTION_PROPERTIES.length;i<len;i++){var p=this.RESOLUTION_PROPERTIES[i];props[p]=this.options[p]!=null?this.options[p]:this.map[p];}  
if(props.resolutions==null){props.resolutions=this.resolutionsFromScales(props.scales);}  
if(props.resolutions==null){props.resolutions=this.calculateResolutions(props);}}  
var maxResolution;if(this.options.maxResolution&&this.options.maxResolution!=="auto"){maxResolution=this.options.maxResolution;}  
if(this.options.minScale){maxResolution=OpenLayers.Util.getResolutionFromScale(this.options.minScale,this.units);}  
var minResolution;if(this.options.minResolution&&this.options.minResolution!=="auto"){minResolution=this.options.minResolution;}  
if(this.options.maxScale){minResolution=OpenLayers.Util.getResolutionFromScale(this.options.maxScale,this.units);}  
if(props.resolutions){props.resolutions.sort(function(a,b){return(b-a);});if(!maxResolution){maxResolution=props.resolutions[0];}  
if(!minResolution){var lastIdx=props.resolutions.length-1;minResolution=props.resolutions[lastIdx];}}  
this.resolutions=props.resolutions;if(this.resolutions){len=this.resolutions.length;this.scales=new Array(len);for(i=0;i<len;i++){this.scales[i]=OpenLayers.Util.getScaleFromResolution(this.resolutions[i],this.units);}  
this.numZoomLevels=len;}  
this.minResolution=minResolution;if(minResolution){this.maxScale=OpenLayers.Util.getScaleFromResolution(minResolution,this.units);}  
this.maxResolution=maxResolution;if(maxResolution){this.minScale=OpenLayers.Util.getScaleFromResolution(maxResolution,this.units);}},resolutionsFromScales:function(scales){if(scales==null){return;}  
var resolutions,i,len;len=scales.length;resolutions=new Array(len);for(i=0;i<len;i++){resolutions[i]=OpenLayers.Util.getResolutionFromScale(scales[i],this.units);}  
return resolutions;},calculateResolutions:function(props){var maxResolution=props.maxResolution;if(props.minScale!=null){maxResolution=OpenLayers.Util.getResolutionFromScale(props.minScale,this.units);}else if(maxResolution=="auto"&&this.maxExtent!=null){var viewSize=this.map.getSize();var wRes=this.maxExtent.getWidth()/viewSize.w;var hRes=this.maxExtent.getHeight()/viewSize.h;maxResolution=Math.max(wRes,hRes);}  
var minResolution=props.minResolution;if(props.maxScale!=null){minResolution=OpenLayers.Util.getResolutionFromScale(props.maxScale,this.units);}else if(props.minResolution=="auto"&&this.minExtent!=null){var viewSize=this.map.getSize();var wRes=this.minExtent.getWidth()/viewSize.w;var hRes=this.minExtent.getHeight()/viewSize.h;minResolution=Math.max(wRes,hRes);}  
var maxZoomLevel=props.maxZoomLevel;var numZoomLevels=props.numZoomLevels;if(typeof minResolution==="number"&&typeof maxResolution==="number"&&numZoomLevels===undefined){var ratio=maxResolution/minResolution;numZoomLevels=Math.floor(Math.log(ratio)/Math.log(2))+1;}else if(numZoomLevels===undefined&&maxZoomLevel!=null){numZoomLevels=maxZoomLevel+1;}  
if(typeof numZoomLevels!=="number"||numZoomLevels<=0||(typeof maxResolution!=="number"&&typeof minResolution!=="number")){return;}  
var resolutions=new Array(numZoomLevels);var base=2;if(typeof minResolution=="number"&&typeof maxResolution=="number"){base=Math.pow((maxResolution/minResolution),(1/(numZoomLevels-1)));}  
var i;if(typeof maxResolution==="number"){for(i=0;i<numZoomLevels;i++){resolutions[i]=maxResolution/Math.pow(base,i);}}else{for(i=0;i<numZoomLevels;i++){resolutions[numZoomLevels-1-i]=minResolution*Math.pow(base,i);}}  
return resolutions;},getResolution:function(){var zoom=this.map.getZoom();return this.getResolutionForZoom(zoom);},getExtent:function(){return this.map.calculateBounds();},getZoomForExtent:function(extent,closest){var viewSize=this.map.getSize();var idealResolution=Math.max(extent.getWidth()/viewSize.w,extent.getHeight()/viewSize.h);return this.getZoomForResolution(idealResolution,closest);},getDataExtent:function(){},getResolutionForZoom:function(zoom){zoom=Math.max(0,Math.min(zoom,this.resolutions.length-1));var resolution;if(this.map.fractionalZoom){var low=Math.floor(zoom);var high=Math.ceil(zoom);resolution=this.resolutions[low]-  
((zoom-low)*(this.resolutions[low]-this.resolutions[high]));}else{resolution=this.resolutions[Math.round(zoom)];}  
return resolution;},getZoomForResolution:function(resolution,closest){var zoom;if(this.map.fractionalZoom){var lowZoom=0;var highZoom=this.resolutions.length-1;var highRes=this.resolutions[lowZoom];var lowRes=this.resolutions[highZoom];var res;for(var i=0,len=this.resolutions.length;i<len;++i){res=this.resolutions[i];if(res>=resolution){highRes=res;lowZoom=i;}  
if(res<=resolution){lowRes=res;highZoom=i;break;}}  
var dRes=highRes-lowRes;if(dRes>0){zoom=lowZoom+((highRes-resolution)/dRes);}else{zoom=lowZoom;}}else{var diff;var minDiff=Number.POSITIVE_INFINITY;for(var i=0,len=this.resolutions.length;i<len;i++){if(closest){diff=Math.abs(this.resolutions[i]-resolution);if(diff>minDiff){break;}  
minDiff=diff;}else{if(this.resolutions[i]<resolution){break;}}}  
zoom=Math.max(0,i-1);}  
return zoom;},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if(viewPortPx!=null){var size=this.map.getSize();var center=this.map.getCenter();if(center){var res=this.map.getResolution();var delta_x=viewPortPx.x-(size.w/2);var delta_y=viewPortPx.y-(size.h/2);lonlat=new OpenLayers.LonLat(center.lon+delta_x*res,center.lat-delta_y*res);if(this.wrapDateLine){lonlat=lonlat.wrapDateLine(this.maxExtent);}}}  
return lonlat;},getViewPortPxFromLonLat:function(lonlat){var px=null;if(lonlat!=null){var resolution=this.map.getResolution();var extent=this.map.getExtent();px=new OpenLayers.Pixel((1/resolution*(lonlat.lon-extent.left)),(1/resolution*(extent.top-lonlat.lat)));}  
return px;},setOpacity:function(opacity){if(opacity!=this.opacity){this.opacity=opacity;for(var i=0,len=this.div.childNodes.length;i<len;++i){var element=this.div.childNodes[i].firstChild;OpenLayers.Util.modifyDOMElement(element,null,null,null,null,null,null,opacity);}  
if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"});}}},getZIndex:function(){return this.div.style.zIndex;},setZIndex:function(zIndex){this.div.style.zIndex=zIndex;},adjustBounds:function(bounds){if(this.gutter){var mapGutter=this.gutter*this.map.getResolution();bounds=new OpenLayers.Bounds(bounds.left-mapGutter,bounds.bottom-mapGutter,bounds.right+mapGutter,bounds.top+mapGutter);}  
if(this.wrapDateLine){var wrappingOptions={'rightTolerance':this.getResolution()};bounds=bounds.wrapDateLine(this.maxExtent,wrappingOptions);}  
return bounds;},CLASS_NAME:"OpenLayers.Layer"});OpenLayers.Marker.Box=OpenLayers.Class(OpenLayers.Marker,{bounds:null,div:null,initialize:function(bounds,borderColor,borderWidth){this.bounds=bounds;this.div=OpenLayers.Util.createDiv();this.div.style.overflow='hidden';this.events=new OpenLayers.Events(this,this.div,null);this.setBorder(borderColor,borderWidth);},destroy:function(){this.bounds=null;this.div=null;OpenLayers.Marker.prototype.destroy.apply(this,arguments);},setBorder:function(color,width){if(!color){color="red";}  
if(!width){width=2;}  
this.div.style.border=width+"px solid "+color;},draw:function(px,sz){OpenLayers.Util.modifyDOMElement(this.div,null,px,sz);return this.div;},onScreen:function(){var onScreen=false;if(this.map){var screenBounds=this.map.getExtent();onScreen=screenBounds.containsBounds(this.bounds,true,true);}  
return onScreen;},display:function(display){this.div.style.display=(display)?"":"none";},CLASS_NAME:"OpenLayers.Marker.Box"});(function(){var oXMLHttpRequest=window.XMLHttpRequest;var bGecko=!!window.controllers,bIE=window.document.all&&!window.opera,bIE7=bIE&&window.navigator.userAgent.match(/MSIE ([\.0-9]+)/)&&RegExp.$1==7;function cXMLHttpRequest(){this._object=oXMLHttpRequest&&!bIE7?new oXMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");this._listeners=[];};if(bGecko&&oXMLHttpRequest.wrapped)  
cXMLHttpRequest.wrapped=oXMLHttpRequest.wrapped;cXMLHttpRequest.UNSENT=0;cXMLHttpRequest.OPENED=1;cXMLHttpRequest.HEADERS_RECEIVED=2;cXMLHttpRequest.LOADING=3;cXMLHttpRequest.DONE=4;cXMLHttpRequest.prototype.readyState=cXMLHttpRequest.UNSENT;cXMLHttpRequest.prototype.responseText='';cXMLHttpRequest.prototype.responseXML=null;cXMLHttpRequest.prototype.status=0;cXMLHttpRequest.prototype.statusText='';cXMLHttpRequest.prototype.onreadystatechange=null;cXMLHttpRequest.onreadystatechange=null;cXMLHttpRequest.onopen=null;cXMLHttpRequest.onsend=null;cXMLHttpRequest.onabort=null;cXMLHttpRequest.prototype.open=function(sMethod,sUrl,bAsync,sUser,sPassword){delete this._headers;if(arguments.length<3)  
bAsync=true;this._async=bAsync;var oRequest=this,nState=this.readyState,fOnUnload;if(bIE&&bAsync){fOnUnload=function(){if(nState!=cXMLHttpRequest.DONE){fCleanTransport(oRequest);oRequest.abort();}};window.attachEvent("onunload",fOnUnload);}  
if(cXMLHttpRequest.onopen)  
cXMLHttpRequest.onopen.apply(this,arguments);if(arguments.length>4)  
this._object.open(sMethod,sUrl,bAsync,sUser,sPassword);else  
if(arguments.length>3)  
this._object.open(sMethod,sUrl,bAsync,sUser);else  
this._object.open(sMethod,sUrl,bAsync);if(!bGecko&&!bIE){this.readyState=cXMLHttpRequest.OPENED;fReadyStateChange(this);}  
this._object.onreadystatechange=function(){if(bGecko&&!bAsync)  
return;oRequest.readyState=oRequest._object.readyState;fSynchronizeValues(oRequest);if(oRequest._aborted){oRequest.readyState=cXMLHttpRequest.UNSENT;return;}  
if(oRequest.readyState==cXMLHttpRequest.DONE){fCleanTransport(oRequest);if(bIE&&bAsync)  
window.detachEvent("onunload",fOnUnload);}  
if(nState!=oRequest.readyState)  
fReadyStateChange(oRequest);nState=oRequest.readyState;}};cXMLHttpRequest.prototype.send=function(vData){if(cXMLHttpRequest.onsend)  
cXMLHttpRequest.onsend.apply(this,arguments);if(vData&&vData.nodeType){vData=window.XMLSerializer?new window.XMLSerializer().serializeToString(vData):vData.xml;if(!this._headers["Content-Type"])  
this._object.setRequestHeader("Content-Type","application/xml");}  
this._object.send(vData);if(bGecko&&!this._async){this.readyState=cXMLHttpRequest.OPENED;fSynchronizeValues(this);while(this.readyState<cXMLHttpRequest.DONE){this.readyState++;fReadyStateChange(this);if(this._aborted)  
return;}}};cXMLHttpRequest.prototype.abort=function(){if(cXMLHttpRequest.onabort)  
cXMLHttpRequest.onabort.apply(this,arguments);if(this.readyState>cXMLHttpRequest.UNSENT)  
this._aborted=true;this._object.abort();fCleanTransport(this);};cXMLHttpRequest.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders();};cXMLHttpRequest.prototype.getResponseHeader=function(sName){return this._object.getResponseHeader(sName);};cXMLHttpRequest.prototype.setRequestHeader=function(sName,sValue){if(!this._headers)  
this._headers={};this._headers[sName]=sValue;return this._object.setRequestHeader(sName,sValue);};cXMLHttpRequest.prototype.addEventListener=function(sName,fHandler,bUseCapture){for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++)  
if(oListener[0]==sName&&oListener[1]==fHandler&&oListener[2]==bUseCapture)  
return;this._listeners.push([sName,fHandler,bUseCapture]);};cXMLHttpRequest.prototype.removeEventListener=function(sName,fHandler,bUseCapture){for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++)  
if(oListener[0]==sName&&oListener[1]==fHandler&&oListener[2]==bUseCapture)  
break;if(oListener)  
this._listeners.splice(nIndex,1);};cXMLHttpRequest.prototype.dispatchEvent=function(oEvent){var oEventPseudo={'type':oEvent.type,'target':this,'currentTarget':this,'eventPhase':2,'bubbles':oEvent.bubbles,'cancelable':oEvent.cancelable,'timeStamp':oEvent.timeStamp,'stopPropagation':function(){},'preventDefault':function(){},'initEvent':function(){}};if(oEventPseudo.type=="readystatechange"&&this.onreadystatechange)  
(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[oEventPseudo]);for(var nIndex=0,oListener;oListener=this._listeners[nIndex];nIndex++)  
if(oListener[0]==oEventPseudo.type&&!oListener[2])  
(oListener[1].handleEvent||oListener[1]).apply(this,[oEventPseudo]);};cXMLHttpRequest.prototype.toString=function(){return'['+"object"+' '+"XMLHttpRequest"+']';};cXMLHttpRequest.toString=function(){return'['+"XMLHttpRequest"+']';};function fReadyStateChange(oRequest){if(cXMLHttpRequest.onreadystatechange)  
cXMLHttpRequest.onreadystatechange.apply(oRequest);oRequest.dispatchEvent({'type':"readystatechange",'bubbles':false,'cancelable':false,'timeStamp':new Date+0});};function fGetDocument(oRequest){var oDocument=oRequest.responseXML,sResponse=oRequest.responseText;if(bIE&&sResponse&&oDocument&&!oDocument.documentElement&&oRequest.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)){oDocument=new window.ActiveXObject("Microsoft.XMLDOM");oDocument.async=false;oDocument.validateOnParse=false;oDocument.loadXML(sResponse);}  
if(oDocument)  
if((bIE&&oDocument.parseError!=0)||!oDocument.documentElement||(oDocument.documentElement&&oDocument.documentElement.tagName=="parsererror"))  
return null;return oDocument;};function fSynchronizeValues(oRequest){try{oRequest.responseText=oRequest._object.responseText;}catch(e){}  
try{oRequest.responseXML=fGetDocument(oRequest._object);}catch(e){}  
try{oRequest.status=oRequest._object.status;}catch(e){}  
try{oRequest.statusText=oRequest._object.statusText;}catch(e){}};function fCleanTransport(oRequest){oRequest._object.onreadystatechange=new window.Function;};if(!window.Function.prototype.apply){window.Function.prototype.apply=function(oRequest,oArguments){if(!oArguments)  
oArguments=[];oRequest.__func=this;oRequest.__func(oArguments[0],oArguments[1],oArguments[2],oArguments[3],oArguments[4]);delete oRequest.__func;};};OpenLayers.Request.XMLHttpRequest=cXMLHttpRequest;})();OpenLayers.Tile.Image.IFrame=OpenLayers.Class(OpenLayers.Tile.Image,{initialize:function(layer,position,bounds,url,size){OpenLayers.Tile.Image.prototype.initialize.apply(this,arguments);this.layerAlphaHack=false;},destroy:function(){if(this.imgDiv!=null){OpenLayers.Event.stopObservingElement(this.imgDiv.firstChild);}  
OpenLayers.Tile.Image.prototype.destroy.apply(this,arguments);},clear:function(){if(this.imgDiv){var iFrame=this.imgDiv.firstChild;OpenLayers.Event.stopObservingElement(iFrame);this.imgDiv.removeChild(iFrame);}},clone:function(obj){if(obj==null){obj=new OpenLayers.Tile.Image.IFrame(this.layer,this.position,this.bounds,this.url,this.size);}  
obj=OpenLayers.Tile.Image.prototype.clone.apply(this,[obj]);return obj;},renderTile:function(){if(OpenLayers.Tile.Image.prototype.renderTile.apply(this,arguments)){var form=this.createRequestForm();this.imgDiv.appendChild(form);form.submit();this.imgDiv.removeChild(form);}},initImgDiv:function(){this.imgDiv=this.createImgDiv();OpenLayers.Util.modifyDOMElement(this.imgDiv,this.id,null,this.layer.getImageSize(),"relative");this.imgDiv.className='olTileImage';this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);if(this.layer.opacity!=null){OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity);}  
this.imgDiv.map=this.layer.map;},createImgDiv:function(){var eventPane=document.createElement("div");if(OpenLayers.Util.getBrowserName()=="msie"){eventPane.style.backgroundColor='#FFFFFF';eventPane.style.filter='chroma(color=#FFFFFF)';}  
OpenLayers.Util.modifyDOMElement(eventPane,null,new OpenLayers.Pixel(0,0),this.layer.getImageSize(),"absolute");var imgDiv=document.createElement("div");imgDiv.appendChild(eventPane);return imgDiv;},createIFrame:function(){var id=this.id+'_iFrame';var iframe;if(OpenLayers.Util.getBrowserName()=="msie"){iframe=document.createElement('<iframe name="'+id+'">');iframe.style.backgroundColor='#FFFFFF';iframe.style.filter='chroma(color=#FFFFFF)';}  
else{iframe=document.createElement('iframe');iframe.style.backgroundColor='transparent';iframe.name=id;}  
iframe.id=id;iframe.scrolling='no';iframe.marginWidth='0px';iframe.marginHeight='0px';iframe.frameBorder='0';OpenLayers.Util.modifyDOMElement(iframe,id,new OpenLayers.Pixel(0,0),this.layer.getImageSize(),"absolute");var onload=function(){this.show();if(this.isLoading){this.isLoading=false;this.events.triggerEvent("loadend");}};OpenLayers.Event.observe(iframe,'load',OpenLayers.Function.bind(onload,this));return iframe;},createRequestForm:function(){var form=document.createElement('form');form.method='POST';var cacheId=this.layer.params["_OLSALT"];cacheId=(cacheId?cacheId+"_":"")+this.bounds.toBBOX();form.action=OpenLayers.Util.urlAppend(this.layer.url,cacheId);this.imgDiv.insertBefore(this.createIFrame(),this.imgDiv.firstChild);form.target=this.id+'_iFrame';var imageSize=this.layer.getImageSize();var params=OpenLayers.Util.extend({"BBOX":this.encodeBBOX?this.bounds.toBBOX():this.bounds.toArray(),"WIDTH":imageSize.w,"HEIGHT":imageSize.h},this.layer.params);for(var par in params){var field=document.createElement('input');field.type='hidden';field.name=par;field.value=params[par];form.appendChild(field);}  
return form;},CLASS_NAME:"OpenLayers.Tile.Image.IFrame"});OpenLayers.ProxyHost="";OpenLayers.nullHandler=function(request){OpenLayers.Console.userError(OpenLayers.i18n("unhandledRequest",{'statusText':request.statusText}));};OpenLayers.loadURL=function(uri,params,caller,onComplete,onFailure){if(typeof params=='string'){params=OpenLayers.Util.getParameters(params);}  
var success=(onComplete)?onComplete:OpenLayers.nullHandler;var failure=(onFailure)?onFailure:OpenLayers.nullHandler;return OpenLayers.Request.GET({url:uri,params:params,success:success,failure:failure,scope:caller});};OpenLayers.parseXMLString=function(text){var index=text.indexOf('<');if(index>0){text=text.substring(index);}  
var ajaxResponse=OpenLayers.Util.Try(function(){var xmldom=new ActiveXObject('Microsoft.XMLDOM');xmldom.loadXML(text);return xmldom;},function(){return new DOMParser().parseFromString(text,'text/xml');},function(){var req=new XMLHttpRequest();req.open("GET","data:"+"text/xml"+";charset=utf-8,"+encodeURIComponent(text),false);if(req.overrideMimeType){req.overrideMimeType("text/xml");}  
req.send(null);return req.responseXML;});return ajaxResponse;};OpenLayers.Ajax={emptyFunction:function(){},getTransport:function(){return OpenLayers.Util.Try(function(){return new XMLHttpRequest();},function(){return new ActiveXObject('Msxml2.XMLHTTP');},function(){return new ActiveXObject('Microsoft.XMLHTTP');})||false;},activeRequestCount:0};OpenLayers.Ajax.Responders={responders:[],register:function(responderToAdd){for(var i=0;i<this.responders.length;i++){if(responderToAdd==this.responders[i]){return;}}  
this.responders.push(responderToAdd);},unregister:function(responderToRemove){OpenLayers.Util.removeItem(this.reponders,responderToRemove);},dispatch:function(callback,request,transport){var responder;for(var i=0;i<this.responders.length;i++){responder=this.responders[i];if(responder[callback]&&typeof responder[callback]=='function'){try{responder[callback].apply(responder,[request,transport]);}catch(e){}}}}};OpenLayers.Ajax.Responders.register({onCreate:function(){OpenLayers.Ajax.activeRequestCount++;},onComplete:function(){OpenLayers.Ajax.activeRequestCount--;}});OpenLayers.Ajax.Base=OpenLayers.Class({initialize:function(options){this.options={method:'post',asynchronous:true,contentType:'application/xml',parameters:''};OpenLayers.Util.extend(this.options,options||{});this.options.method=this.options.method.toLowerCase();if(typeof this.options.parameters=='string'){this.options.parameters=OpenLayers.Util.getParameters(this.options.parameters);}}});OpenLayers.Ajax.Request=OpenLayers.Class(OpenLayers.Ajax.Base,{_complete:false,initialize:function(url,options){OpenLayers.Ajax.Base.prototype.initialize.apply(this,[options]);if(OpenLayers.ProxyHost&&OpenLayers.String.startsWith(url,"http")){url=OpenLayers.ProxyHost+encodeURIComponent(url);}  
this.transport=OpenLayers.Ajax.getTransport();this.request(url);},request:function(url){this.url=url;this.method=this.options.method;var params=OpenLayers.Util.extend({},this.options.parameters);if(this.method!='get'&&this.method!='post'){params['_method']=this.method;this.method='post';}  
this.parameters=params;if(params=OpenLayers.Util.getParameterString(params)){if(this.method=='get'){this.url+=((this.url.indexOf('?')>-1)?'&':'?')+params;}else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){params+='&_=';}}  
try{var response=new OpenLayers.Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(response);}  
OpenLayers.Ajax.Responders.dispatch('onCreate',this,response);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){window.setTimeout(OpenLayers.Function.bind(this.respondToReadyState,this,1),10);}  
this.transport.onreadystatechange=OpenLayers.Function.bind(this.onStateChange,this);this.setRequestHeaders();this.body=this.method=='post'?(this.options.postBody||params):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange();}}catch(e){this.dispatchException(e);}},onStateChange:function(){var readyState=this.transport.readyState;if(readyState>1&&!((readyState==4)&&this._complete)){this.respondToReadyState(this.transport.readyState);}},setRequestHeaders:function(){var headers={'X-Requested-With':'XMLHttpRequest','Accept':'text/javascript, text/html, application/xml, text/xml, */*','OpenLayers':true};if(this.method=='post'){headers['Content-type']=this.options.contentType+  
(this.options.encoding?'; charset='+this.options.encoding:'');if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){headers['Connection']='close';}}  
if(typeof this.options.requestHeaders=='object'){var extras=this.options.requestHeaders;if(typeof extras.push=='function'){for(var i=0,length=extras.length;i<length;i+=2){headers[extras[i]]=extras[i+1];}}else{for(var i in extras){headers[i]=extras[i];}}}  
for(var name in headers){this.transport.setRequestHeader(name,headers[name]);}},success:function(){var status=this.getStatus();return!status||(status>=200&&status<300);},getStatus:function(){try{return this.transport.status||0;}catch(e){return 0;}},respondToReadyState:function(readyState){var state=OpenLayers.Ajax.Request.Events[readyState];var response=new OpenLayers.Ajax.Response(this);if(state=='Complete'){try{this._complete=true;(this.options['on'+response.status]||this.options['on'+(this.success()?'Success':'Failure')]||OpenLayers.Ajax.emptyFunction)(response);}catch(e){this.dispatchException(e);}  
var contentType=response.getHeader('Content-type');}  
try{(this.options['on'+state]||OpenLayers.Ajax.emptyFunction)(response);OpenLayers.Ajax.Responders.dispatch('on'+state,this,response);}catch(e){this.dispatchException(e);}  
if(state=='Complete'){this.transport.onreadystatechange=OpenLayers.Ajax.emptyFunction;}},getHeader:function(name){try{return this.transport.getResponseHeader(name);}catch(e){return null;}},dispatchException:function(exception){var handler=this.options.onException;if(handler){handler(this,exception);OpenLayers.Ajax.Responders.dispatch('onException',this,exception);}else{var listener=false;var responders=OpenLayers.Ajax.Responders.responders;for(var i=0;i<responders.length;i++){if(responders[i].onException){listener=true;break;}}  
if(listener){OpenLayers.Ajax.Responders.dispatch('onException',this,exception);}else{throw exception;}}}});OpenLayers.Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];OpenLayers.Ajax.Response=OpenLayers.Class({status:0,statusText:'',initialize:function(request){this.request=request;var transport=this.transport=request.transport,readyState=this.readyState=transport.readyState;if((readyState>2&&!(!!(window.attachEvent&&!window.opera)))||readyState==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=transport.responseText==null?'':String(transport.responseText);}  
if(readyState==4){var xml=transport.responseXML;this.responseXML=xml===undefined?null:xml;}},getStatus:OpenLayers.Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||'';}catch(e){return'';}},getHeader:OpenLayers.Ajax.Request.prototype.getHeader,getResponseHeader:function(name){return this.transport.getResponseHeader(name);}});OpenLayers.Ajax.getElementsByTagNameNS=function(parentnode,nsuri,nsprefix,tagname){var elem=null;if(parentnode.getElementsByTagNameNS){elem=parentnode.getElementsByTagNameNS(nsuri,tagname);}else{elem=parentnode.getElementsByTagName(nsprefix+':'+tagname);}  
return elem;};OpenLayers.Ajax.serializeXMLToString=function(xmldom){var serializer=new XMLSerializer();var data=serializer.serializeToString(xmldom);return data;};OpenLayers.Control.DragFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,onStart:function(feature,pixel){},onDrag:function(feature,pixel){},onComplete:function(feature,pixel){},documentDrag:false,layer:null,feature:null,dragCallbacks:{},featureCallbacks:{},lastPixel:null,initialize:function(layer,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.layer=layer;this.handlers={drag:new OpenLayers.Handler.Drag(this,OpenLayers.Util.extend({down:this.downFeature,move:this.moveFeature,up:this.upFeature,out:this.cancel,done:this.doneDragging},this.dragCallbacks),{documentDrag:this.documentDrag}),feature:new OpenLayers.Handler.Feature(this,this.layer,OpenLayers.Util.extend({over:this.overFeature,out:this.outFeature},this.featureCallbacks),{geometryTypes:this.geometryTypes})};},destroy:function(){this.layer=null;OpenLayers.Control.prototype.destroy.apply(this,[]);},activate:function(){return(this.handlers.feature.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments));},deactivate:function(){this.handlers.drag.deactivate();this.handlers.feature.deactivate();this.feature=null;this.dragging=false;this.lastPixel=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over");return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},overFeature:function(feature){if(!this.handlers.drag.dragging){this.feature=feature;this.handlers.drag.activate();this.over=true;OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass+"Over");}else{if(this.feature.id==feature.id){this.over=true;}else{this.over=false;}}},downFeature:function(pixel){this.lastPixel=pixel;this.onStart(this.feature,pixel);},moveFeature:function(pixel){var res=this.map.getResolution();this.feature.geometry.move(res*(pixel.x-this.lastPixel.x),res*(this.lastPixel.y-pixel.y));this.layer.drawFeature(this.feature);this.lastPixel=pixel;this.onDrag(this.feature,pixel);},upFeature:function(pixel){if(!this.over){this.handlers.drag.deactivate();}},doneDragging:function(pixel){this.onComplete(this.feature,pixel);},outFeature:function(feature){if(!this.handlers.drag.dragging){this.over=false;this.handlers.drag.deactivate();OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over");this.feature=null;}else{if(this.feature.id==feature.id){this.over=false;}}},cancel:function(){this.handlers.drag.deactivate();this.over=false;},setMap:function(map){this.handlers.drag.setMap(map);this.handlers.feature.setMap(map);OpenLayers.Control.prototype.setMap.apply(this,arguments);},CLASS_NAME:"OpenLayers.Control.DragFeature"});OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:false,interval:25,documentDrag:false,draw:function(){this.handler=new OpenLayers.Handler.Drag(this,{"move":this.panMap,"done":this.panMapDone},{interval:this.interval,documentDrag:this.documentDrag});},panMap:function(xy){this.panned=true;this.map.pan(this.handler.last.x-xy.x,this.handler.last.y-xy.y,{dragging:this.handler.dragging,animate:false});},panMapDone:function(xy){if(this.panned){this.panMap(xy);this.panned=false;}},CLASS_NAME:"OpenLayers.Control.DragPan"});OpenLayers.Control.KeyboardDefaults=OpenLayers.Class(OpenLayers.Control,{autoActivate:true,slideFactor:75,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments);},destroy:function(){if(this.handler){this.handler.destroy();}  
this.handler=null;OpenLayers.Control.prototype.destroy.apply(this,arguments);},draw:function(){this.handler=new OpenLayers.Handler.Keyboard(this,{"keydown":this.defaultKeyPress});},defaultKeyPress:function(evt){switch(evt.keyCode){case OpenLayers.Event.KEY_LEFT:this.map.pan(-this.slideFactor,0);break;case OpenLayers.Event.KEY_RIGHT:this.map.pan(this.slideFactor,0);break;case OpenLayers.Event.KEY_UP:this.map.pan(0,-this.slideFactor);break;case OpenLayers.Event.KEY_DOWN:this.map.pan(0,this.slideFactor);break;case 33:var size=this.map.getSize();this.map.pan(0,-0.75*size.h);break;case 34:var size=this.map.getSize();this.map.pan(0,0.75*size.h);break;case 35:var size=this.map.getSize();this.map.pan(0.75*size.w,0);break;case 36:var size=this.map.getSize();this.map.pan(-0.75*size.w,0);break;case 43:case 61:case 187:case 107:this.map.zoomIn();break;case 45:case 109:case 189:case 95:this.map.zoomOut();break;}},CLASS_NAME:"OpenLayers.Control.KeyboardDefaults"});OpenLayers.Control.WMSGetFeatureInfo=OpenLayers.Class(OpenLayers.Control,{hover:false,drillDown:false,maxFeatures:10,clickCallback:"click",layers:null,queryVisible:false,url:null,layerUrls:null,infoFormat:'text/html',vendorParams:{},format:null,formatOptions:null,handlerOptions:null,handler:null,hoverRequest:null,EVENT_TYPES:["beforegetfeatureinfo","nogetfeatureinfo","getfeatureinfo"],initialize:function(options){this.EVENT_TYPES=OpenLayers.Control.WMSGetFeatureInfo.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);options=options||{};options.handlerOptions=options.handlerOptions||{};OpenLayers.Control.prototype.initialize.apply(this,[options]);if(!this.format){this.format=new OpenLayers.Format.WMSGetFeatureInfo(options.formatOptions);}  
if(this.drillDown===true){this.hover=false;}  
if(this.hover){this.handler=new OpenLayers.Handler.Hover(this,{'move':this.cancelHover,'pause':this.getInfoForHover},OpenLayers.Util.extend(this.handlerOptions.hover||{},{'delay':250}));}else{var callbacks={};callbacks[this.clickCallback]=this.getInfoForClick;this.handler=new OpenLayers.Handler.Click(this,callbacks,this.handlerOptions.click||{});}},activate:function(){if(!this.active){this.handler.activate();}  
return OpenLayers.Control.prototype.activate.apply(this,arguments);},deactivate:function(){return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},getInfoForClick:function(evt){this.events.triggerEvent("beforegetfeatureinfo",{xy:evt.xy});OpenLayers.Element.addClass(this.map.viewPortDiv,"olCursorWait");this.request(evt.xy,{});},getInfoForHover:function(evt){this.events.triggerEvent("beforegetfeatureinfo",{xy:evt.xy});this.request(evt.xy,{hover:true});},cancelHover:function(){if(this.hoverRequest){this.hoverRequest.abort();this.hoverRequest=null;}},findLayers:function(){var candidates=this.layers||this.map.layers;var layers=[];var layer,url;for(var i=0,len=candidates.length;i<len;++i){layer=candidates[i];if(layer instanceof OpenLayers.Layer.WMS&&(!this.queryVisible||layer.getVisibility())){url=layer.url instanceof Array?layer.url[0]:layer.url;if(this.drillDown===false&&!this.url){this.url=url;}  
if(this.drillDown===true||this.urlMatches(url)){layers.push(layer);}}}  
return layers;},urlMatches:function(url){var matches=OpenLayers.Util.isEquivalentUrl(this.url,url);if(!matches&&this.layerUrls){for(var i=0,len=this.layerUrls.length;i<len;++i){if(OpenLayers.Util.isEquivalentUrl(this.layerUrls[i],url)){matches=true;break;}}}  
return matches;},buildWMSOptions:function(url,layers,clickPosition,format){var layerNames=[],styleNames=[];for(var i=0,len=layers.length;i<len;i++){layerNames=layerNames.concat(layers[i].params.LAYERS);styleNames=styleNames.concat(this.getStyleNames(layers[i]));}  
var params=OpenLayers.Util.extend({service:"WMS",version:layers[0].params.VERSION,request:"GetFeatureInfo",layers:layerNames,query_layers:layerNames,styles:styleNames,bbox:this.map.getExtent().toBBOX(null,layers[0].reverseAxisOrder()),feature_count:this.maxFeatures,height:this.map.getSize().h,width:this.map.getSize().w,format:format,info_format:this.infoFormat},(parseFloat(layers[0].params.VERSION)>=1.3)?{crs:this.map.getProjection(),i:clickPosition.x,j:clickPosition.y}:{srs:this.map.getProjection(),x:clickPosition.x,y:clickPosition.y});OpenLayers.Util.applyDefaults(params,this.vendorParams);return{url:url,params:OpenLayers.Util.upperCaseObject(params),callback:function(request){this.handleResponse(clickPosition,request);},scope:this};},getStyleNames:function(layer){var styleNames;if(layer.params.STYLES){styleNames=layer.params.STYLES;}else{if(layer.params.LAYERS instanceof Array){styleNames=new Array(layer.params.LAYERS.length);}else{styleNames=layer.params.LAYERS.replace(/[^,]/g,"");}}  
return styleNames;},request:function(clickPosition,options){var layers=this.findLayers();if(layers.length==0){this.events.triggerEvent("nogetfeatureinfo");OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait");return;}  
options=options||{};if(this.drillDown===false){var wmsOptions=this.buildWMSOptions(this.url,layers,clickPosition,layers[0].params.FORMAT);var request=OpenLayers.Request.GET(wmsOptions);if(options.hover===true){this.hoverRequest=request;}}else{this._requestCount=0;this._numRequests=0;this.features=[];var services={},url;for(var i=0,len=layers.length;i<len;i++){var layer=layers[i];var service,found=false;url=layer.url instanceof Array?layer.url[0]:layer.url;if(url in services){services[url].push(layer);}else{this._numRequests++;services[url]=[layer];}}  
var layers;for(var url in services){layers=services[url];var wmsOptions=this.buildWMSOptions(url,layers,clickPosition,layers[0].params.FORMAT);OpenLayers.Request.GET(wmsOptions);}}},triggerGetFeatureInfo:function(request,xy,features){this.events.triggerEvent("getfeatureinfo",{text:request.responseText,features:features,request:request,xy:xy});OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait");},handleResponse:function(xy,request){var doc=request.responseXML;if(!doc||!doc.documentElement){doc=request.responseText;}  
var features=this.format.read(doc);if(this.drillDown===false){this.triggerGetFeatureInfo(request,xy,features);}else{this._requestCount++;this._features=(this._features||[]).concat(features);if(this._requestCount===this._numRequests){this.triggerGetFeatureInfo(request,xy,this._features.concat());delete this._features;delete this._requestCount;delete this._numRequests;}}},CLASS_NAME:"OpenLayers.Control.WMSGetFeatureInfo"});OpenLayers.Control.WMTSGetFeatureInfo=OpenLayers.Class(OpenLayers.Control,{hover:false,requestEncoding:"KVP",drillDown:false,maxFeatures:10,clickCallback:"click",layers:null,queryVisible:true,infoFormat:'text/html',vendorParams:{},format:null,formatOptions:null,handlerOptions:null,handler:null,hoverRequest:null,EVENT_TYPES:["beforegetfeatureinfo","getfeatureinfo","exception"],pending:0,initialize:function(options){this.EVENT_TYPES=OpenLayers.Control.WMTSGetFeatureInfo.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);options=options||{};options.handlerOptions=options.handlerOptions||{};OpenLayers.Control.prototype.initialize.apply(this,[options]);if(!this.format){this.format=new OpenLayers.Format.WMSGetFeatureInfo(options.formatOptions);}  
if(this.drillDown===true){this.hover=false;}  
if(this.hover){this.handler=new OpenLayers.Handler.Hover(this,{move:this.cancelHover,pause:this.getInfoForHover},OpenLayers.Util.extend(this.handlerOptions.hover||{},{delay:250}));}else{var callbacks={};callbacks[this.clickCallback]=this.getInfoForClick;this.handler=new OpenLayers.Handler.Click(this,callbacks,this.handlerOptions.click||{});}},activate:function(){if(!this.active){this.handler.activate();}  
return OpenLayers.Control.prototype.activate.apply(this,arguments);},deactivate:function(){return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},getInfoForClick:function(evt){this.request(evt.xy,{});},getInfoForHover:function(evt){this.request(evt.xy,{hover:true});},cancelHover:function(){if(this.hoverRequest){--this.pending;if(this.pending<=0){OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait");this.pending=0;}  
this.hoverRequest.abort();this.hoverRequest=null;}},findLayers:function(){var candidates=this.layers||this.map.layers;var layers=[];var layer;for(var i=candidates.length-1;i>=0;--i){layer=candidates[i];if(layer instanceof OpenLayers.Layer.WMTS&&layer.requestEncoding===this.requestEncoding&&(!this.queryVisible||layer.getVisibility())){layers.push(layer);if(!this.drillDown||this.hover){break;}}}  
return layers;},buildRequestOptions:function(layer,xy){var loc=this.map.getLonLatFromPixel(xy);var getTileUrl=layer.getURL(new OpenLayers.Bounds(loc.lon,loc.lat,loc.lon,loc.lat));var params=OpenLayers.Util.getParameters(getTileUrl);var tileInfo=layer.getTileInfo(loc);OpenLayers.Util.extend(params,{service:"WMTS",version:layer.version,request:"GetFeatureInfo",infoFormat:this.infoFormat,i:tileInfo.i,j:tileInfo.j});OpenLayers.Util.applyDefaults(params,this.vendorParams);return{url:layer.url instanceof Array?layer.url[0]:layer.url,params:OpenLayers.Util.upperCaseObject(params),callback:function(request){this.handleResponse(xy,request,layer);},scope:this};},request:function(xy,options){options=options||{};var layers=this.findLayers();if(layers.length>0){var issue,layer;for(var i=0,len=layers.length;i<len;i++){layer=layers[i];issue=this.events.triggerEvent("beforegetfeatureinfo",{xy:xy,layer:layer});if(issue!==false){++this.pending;var requestOptions=this.buildRequestOptions(layer,xy);var request=OpenLayers.Request.GET(requestOptions);if(options.hover===true){this.hoverRequest=request;}}}  
if(this.pending>0){OpenLayers.Element.addClass(this.map.viewPortDiv,"olCursorWait");}}},handleResponse:function(xy,request,layer){--this.pending;if(this.pending<=0){OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait");this.pending=0;}  
if(request.status&&(request.status<200||request.status>=300)){this.events.triggerEvent("exception",{xy:xy,request:request,layer:layer});}else{var doc=request.responseXML;if(!doc||!doc.documentElement){doc=request.responseText;}  
var features,except;try{features=this.format.read(doc);}catch(error){except=true;this.events.triggerEvent("exception",{xy:xy,request:request,error:error,layer:layer});}  
if(!except){this.events.triggerEvent("getfeatureinfo",{text:request.responseText,features:features,request:request,xy:xy,layer:layer});}}},setMap:function(map){this.handler.setMap(map);OpenLayers.Control.prototype.setMap.apply(this,arguments);},CLASS_NAME:"OpenLayers.Control.WMTSGetFeatureInfo"});OpenLayers.State={UNKNOWN:'Unknown',INSERT:'Insert',UPDATE:'Update',DELETE:'Delete'};OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,url:null,renderIntent:"default",initialize:function(geometry,attributes,style){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,attributes]);this.lonlat=null;this.geometry=geometry?geometry:null;this.state=null;this.attributes={};if(attributes){this.attributes=OpenLayers.Util.extend(this.attributes,attributes);}  
this.style=style?style:null;},destroy:function(){if(this.layer){this.layer.removeFeatures(this);this.layer=null;}  
this.geometry=null;OpenLayers.Feature.prototype.destroy.apply(this,arguments);},clone:function(){return new OpenLayers.Feature.Vector(this.geometry?this.geometry.clone():null,this.attributes,this.style);},onScreen:function(boundsOnly){var onScreen=false;if(this.layer&&this.layer.map){var screenBounds=this.layer.map.getExtent();if(boundsOnly){var featureBounds=this.geometry.getBounds();onScreen=screenBounds.intersectsBounds(featureBounds);}else{var screenPoly=screenBounds.toGeometry();onScreen=screenPoly.intersects(this.geometry);}}  
return onScreen;},getVisibility:function(){return!(this.style&&this.style.display=='none'||!this.layer||this.layer&&this.layer.styleMap&&this.layer.styleMap.createSymbolizer(this,this.renderIntent).display=='none'||this.layer&&!this.layer.getVisibility());},createMarker:function(){return null;},destroyMarker:function(){},createPopup:function(){return null;},atPoint:function(lonlat,toleranceLon,toleranceLat){var atPoint=false;if(this.geometry){atPoint=this.geometry.atPoint(lonlat,toleranceLon,toleranceLat);}  
return atPoint;},destroyPopup:function(){},move:function(location){if(!this.layer||!this.geometry.move){return;}  
var pixel;if(location.CLASS_NAME=="OpenLayers.LonLat"){pixel=this.layer.getViewPortPxFromLonLat(location);}else{pixel=location;}  
var lastPixel=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());var res=this.layer.map.getResolution();this.geometry.move(res*(pixel.x-lastPixel.x),res*(lastPixel.y-pixel.y));this.layer.drawFeature(this);return lastPixel;},toState:function(state){if(state==OpenLayers.State.UPDATE){switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=state;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break;}}else if(state==OpenLayers.State.INSERT){switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=state;break;}}else if(state==OpenLayers.State.DELETE){switch(this.state){case OpenLayers.State.INSERT:break;case OpenLayers.State.DELETE:break;case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=state;break;}}else if(state==OpenLayers.State.UNKNOWN){this.state=state;}},CLASS_NAME:"OpenLayers.Feature.Vector"});OpenLayers.Feature.Vector.style={'default':{fillColor:"#ee9900",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},'select':{fillColor:"blue",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"},'temporary':{fillColor:"#66cccc",fillOpacity:0.2,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#66cccc",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},'delete':{display:"none"}};OpenLayers.Feature.WFS=OpenLayers.Class(OpenLayers.Feature,{initialize:function(layer,xmlNode){var newArguments=arguments;var data=this.processXMLNode(xmlNode);newArguments=new Array(layer,data.lonlat,data);OpenLayers.Feature.prototype.initialize.apply(this,newArguments);this.createMarker();this.layer.addMarker(this.marker);},destroy:function(){if(this.marker!=null){this.layer.removeMarker(this.marker);}  
OpenLayers.Feature.prototype.destroy.apply(this,arguments);},processXMLNode:function(xmlNode){var point=OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,"http://www.opengis.net/gml","gml","Point");var text=OpenLayers.Util.getXmlNodeValue(OpenLayers.Ajax.getElementsByTagNameNS(point[0],"http://www.opengis.net/gml","gml","coordinates")[0]);var floats=text.split(",");return{lonlat:new OpenLayers.LonLat(parseFloat(floats[0]),parseFloat(floats[1])),id:null};},CLASS_NAME:"OpenLayers.Feature.WFS"});OpenLayers.Format.OWSCommon.v1_0_0=OpenLayers.Class(OpenLayers.Format.OWSCommon.v1,{namespaces:{ows:"http://www.opengis.net/ows/1.0",xlink:"http://www.w3.org/1999/xlink"},readers:{"ows":OpenLayers.Format.OWSCommon.v1.prototype.readers["ows"]},writers:{"ows":OpenLayers.Format.OWSCommon.v1.prototype.writers["ows"]},CLASS_NAME:"OpenLayers.Format.OWSCommon.v1_1_0"});OpenLayers.Format.OWSCommon.v1_1_0=OpenLayers.Class(OpenLayers.Format.OWSCommon.v1,{namespaces:{ows:"http://www.opengis.net/ows/1.1",xlink:"http://www.w3.org/1999/xlink"},readers:{"ows":OpenLayers.Util.applyDefaults({"AllowedValues":function(node,parameter){parameter.allowedValues={};this.readChildNodes(node,parameter.allowedValues);},"AnyValue":function(node,parameter){parameter.anyValue=true;},"Range":function(node,allowedValues){allowedValues.range={};this.readChildNodes(node,allowedValues.range);},"MinimumValue":function(node,range){range.minValue=this.getChildValue(node);},"MaximumValue":function(node,range){range.maxValue=this.getChildValue(node);},"Identifier":function(node,obj){obj.identifier=this.getChildValue(node);},"SupportedCRS":function(node,obj){obj.supportedCRS=this.getChildValue(node);}},OpenLayers.Format.OWSCommon.v1.prototype.readers["ows"])},CLASS_NAME:"OpenLayers.Format.OWSCommon.v1_1_0"});OpenLayers.Format.OWSContext=OpenLayers.Class(OpenLayers.Format.Context,{defaultVersion:"0.3.1",getParser:function(version){var v=version||this.version||this.defaultVersion;if(v==="0.3.0"){v=this.defaultVersion;}  
if(!this.parser||this.parser.VERSION!=v){var format=OpenLayers.Format.OWSContext["v"+v.replace(/\./g,"_")];if(!format){throw"Can't find a OWSContext parser for version "+v;}  
this.parser=new format(this.options);}  
return this.parser;},toContext:function(obj){var context={};if(obj.CLASS_NAME=="OpenLayers.Map"){context.bounds=obj.getExtent();context.maxExtent=obj.maxExtent;context.projection=obj.projection;context.size=obj.getSize();context.layers=obj.layers;}  
return context;},CLASS_NAME:"OpenLayers.Format.OWSContext"});OpenLayers.Format.WFSCapabilities.v1=OpenLayers.Class(OpenLayers.Format.WFSCapabilities,{initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);this.options=options;},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var capabilities={};var root=data.documentElement;this.runChildNodes(capabilities,root);return capabilities;},runChildNodes:function(obj,node){var children=node.childNodes;var childNode,processor;for(var i=0;i<children.length;++i){childNode=children[i];if(childNode.nodeType==1){processor=this["read_cap_"+childNode.nodeName];if(processor){processor.apply(this,[obj,childNode]);}}}},read_cap_FeatureTypeList:function(request,node){var featureTypeList={featureTypes:[]};this.runChildNodes(featureTypeList,node);request.featureTypeList=featureTypeList;},read_cap_FeatureType:function(featureTypeList,node,parentLayer){var featureType={};this.runChildNodes(featureType,node);featureTypeList.featureTypes.push(featureType);},read_cap_Name:function(obj,node){var name=this.getChildValue(node);if(name){var parts=name.split(":");obj.name=parts.pop();if(parts.length>0){obj.featureNS=this.lookupNamespaceURI(node,parts[0]);}}},read_cap_Title:function(obj,node){var title=this.getChildValue(node);if(title){obj.title=title;}},read_cap_Abstract:function(obj,node){var abst=this.getChildValue(node);if(abst){obj["abstract"]=abst;}},CLASS_NAME:"OpenLayers.Format.WFSCapabilities.v1"});OpenLayers.Format.WMC=OpenLayers.Class(OpenLayers.Format.Context,{defaultVersion:"1.1.0",getParser:function(version){var v=version||this.version||this.defaultVersion;if(!this.parser||this.parser.VERSION!=v){var format=OpenLayers.Format.WMC["v"+v.replace(/\./g,"_")];if(!format){throw"Can't find a WMC parser for version "+v;}  
this.parser=new format(this.options);}  
return this.parser;},layerToContext:function(layer){var parser=this.getParser();var layerContext={queryable:layer.queryable,visibility:layer.visibility,name:layer.params["LAYERS"],title:layer.name,metadataURL:layer.metadataURL,version:layer.params["VERSION"],url:layer.url,maxExtent:layer.maxExtent,transparent:layer.params["TRANSPARENT"],numZoomLevels:layer.numZoomLevels,units:layer.units,isBaseLayer:layer.isBaseLayer,opacity:layer.opacity,displayInLayerSwitcher:layer.displayInLayerSwitcher,singleTile:layer.singleTile,tileSize:(layer.singleTile||!layer.tileSize)?undefined:{width:layer.tileSize.w,height:layer.tileSize.h},minScale:(layer.options.resolutions||layer.options.scales||layer.options.maxResolution||layer.options.minScale)?layer.minScale:undefined,maxScale:(layer.options.resolutions||layer.options.scales||layer.options.minResolution||layer.options.maxScale)?layer.maxScale:undefined,formats:[{value:layer.params["FORMAT"],current:true}],styles:[{href:layer.params["SLD"],body:layer.params["SLD_BODY"],name:layer.params["STYLES"]||parser.defaultStyleName,title:parser.defaultStyleTitle,current:true}]};return layerContext;},toContext:function(obj){var context={};var layers=obj.layers;if(obj.CLASS_NAME=="OpenLayers.Map"){context.bounds=obj.getExtent();context.maxExtent=obj.maxExtent;context.projection=obj.projection;context.size=obj.getSize();}  
else{OpenLayers.Util.applyDefaults(context,obj);if(context.layers!=undefined){delete(context.layers);}}  
if(context.layersContext==undefined){context.layersContext=[];}  
if(layers!=undefined&&layers instanceof Array){for(var i=0,len=layers.length;i<len;i++){var layer=layers[i];if(layer instanceof OpenLayers.Layer.WMS){context.layersContext.push(this.layerToContext(layer));}}}  
return context;},CLASS_NAME:"OpenLayers.Format.WMC"});OpenLayers.Format.WMSCapabilities.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{wms:"http://www.opengis.net/wms",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},defaultPrefix:"wms",initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
if(data&&data.nodeType==9){data=data.documentElement;}  
var capabilities={};this.readNode(data,capabilities);this.postProcessLayers(capabilities);return capabilities;},postProcessLayers:function(capabilities){if(capabilities.capability){capabilities.capability.layers=[];var layers=capabilities.capability.nestedLayers;for(var i=0,len=layers.length;i<len;++i){var layer=layers[i];this.processLayer(capabilities.capability,layer);}}},processLayer:function(capability,layer,parentLayer){if(layer.formats===undefined){layer.formats=capability.request.getmap.formats;}  
if(parentLayer){layer.styles=layer.styles.concat(parentLayer.styles);var attributes=["queryable","cascaded","fixedWidth","fixedHeight","opaque","noSubsets","llbbox","minScale","maxScale","attribution"];var complexAttr=["srs","bbox","dimensions","authorityURLs"];var key;for(var j=0;j<attributes.length;j++){key=attributes[j];if(key in parentLayer){if(layer[key]==null){layer[key]=parentLayer[key];}  
if(layer[key]==null){var intAttr=["cascaded","fixedWidth","fixedHeight"];var boolAttr=["queryable","opaque","noSubsets"];if(OpenLayers.Util.indexOf(intAttr,key)!=-1){layer[key]=0;}  
if(OpenLayers.Util.indexOf(boolAttr,key)!=-1){layer[key]=false;}}}}  
for(var j=0;j<complexAttr.length;j++){key=complexAttr[j];layer[key]=OpenLayers.Util.extend(layer[key],parentLayer[key]);}}  
for(var i=0,len=layer.nestedLayers.length;i<len;i++){var childLayer=layer.nestedLayers[i];this.processLayer(capability,childLayer,layer);}  
if(layer.name){capability.layers.push(layer);}},readers:{"wms":{"Service":function(node,obj){obj.service={};this.readChildNodes(node,obj.service);},"Name":function(node,obj){obj.name=this.getChildValue(node);},"Title":function(node,obj){obj.title=this.getChildValue(node);},"Abstract":function(node,obj){obj["abstract"]=this.getChildValue(node);},"BoundingBox":function(node,obj){var bbox={};bbox.bbox=[parseFloat(node.getAttribute("minx")),parseFloat(node.getAttribute("miny")),parseFloat(node.getAttribute("maxx")),parseFloat(node.getAttribute("maxy"))];var res={x:parseFloat(node.getAttribute("resx")),y:parseFloat(node.getAttribute("resy"))};if(!(isNaN(res.x)&&isNaN(res.y))){bbox.res=res;}  
return bbox;},"OnlineResource":function(node,obj){obj.href=this.getAttributeNS(node,this.namespaces.xlink,"href");},"ContactInformation":function(node,obj){obj.contactInformation={};this.readChildNodes(node,obj.contactInformation);},"ContactPersonPrimary":function(node,obj){obj.personPrimary={};this.readChildNodes(node,obj.personPrimary);},"ContactPerson":function(node,obj){obj.person=this.getChildValue(node);},"ContactOrganization":function(node,obj){obj.organization=this.getChildValue(node);},"ContactPosition":function(node,obj){obj.position=this.getChildValue(node);},"ContactAddress":function(node,obj){obj.contactAddress={};this.readChildNodes(node,obj.contactAddress);},"AddressType":function(node,obj){obj.type=this.getChildValue(node);},"Address":function(node,obj){obj.address=this.getChildValue(node);},"City":function(node,obj){obj.city=this.getChildValue(node);},"StateOrProvince":function(node,obj){obj.stateOrProvince=this.getChildValue(node);},"PostCode":function(node,obj){obj.postcode=this.getChildValue(node);},"Country":function(node,obj){obj.country=this.getChildValue(node);},"ContactVoiceTelephone":function(node,obj){obj.phone=this.getChildValue(node);},"ContactFacsimileTelephone":function(node,obj){obj.fax=this.getChildValue(node);},"ContactElectronicMailAddress":function(node,obj){obj.email=this.getChildValue(node);},"Fees":function(node,obj){var fees=this.getChildValue(node);if(fees&&fees.toLowerCase()!="none"){obj.fees=fees;}},"AccessConstraints":function(node,obj){var constraints=this.getChildValue(node);if(constraints&&constraints.toLowerCase()!="none"){obj.accessConstraints=constraints;}},"Capability":function(node,obj){obj.capability={nestedLayers:[]};this.readChildNodes(node,obj.capability);},"Request":function(node,obj){obj.request={};this.readChildNodes(node,obj.request);},"GetCapabilities":function(node,obj){obj.getcapabilities={formats:[]};this.readChildNodes(node,obj.getcapabilities);},"Format":function(node,obj){if(obj.formats instanceof Array){obj.formats.push(this.getChildValue(node));}else{obj.format=this.getChildValue(node);}},"DCPType":function(node,obj){this.readChildNodes(node,obj);},"HTTP":function(node,obj){this.readChildNodes(node,obj);},"Get":function(node,obj){this.readChildNodes(node,obj);},"Post":function(node,obj){this.readChildNodes(node,obj);},"GetMap":function(node,obj){obj.getmap={formats:[]};this.readChildNodes(node,obj.getmap);},"GetFeatureInfo":function(node,obj){obj.getfeatureinfo={formats:[]};this.readChildNodes(node,obj.getfeatureinfo);},"Exception":function(node,obj){obj.exception={formats:[]};this.readChildNodes(node,obj.exception);},"Layer":function(node,obj){var attrNode=node.getAttributeNode("queryable");var queryable=(attrNode&&attrNode.specified)?node.getAttribute("queryable"):null;attrNode=node.getAttributeNode("cascaded");var cascaded=(attrNode&&attrNode.specified)?node.getAttribute("cascaded"):null;attrNode=node.getAttributeNode("opaque");var opaque=(attrNode&&attrNode.specified)?node.getAttribute('opaque'):null;var noSubsets=node.getAttribute('noSubsets');var fixedWidth=node.getAttribute('fixedWidth');var fixedHeight=node.getAttribute('fixedHeight');var layer={nestedLayers:[],styles:[],srs:{},metadataURLs:[],bbox:{},dimensions:{},authorityURLs:{},identifiers:{},keywords:[],queryable:(queryable&&queryable!=="")?(queryable==="1"||queryable==="true"):null,cascaded:(cascaded!==null)?parseInt(cascaded):null,opaque:opaque?(opaque==="1"||opaque==="true"):null,noSubsets:(noSubsets!==null)?(noSubsets==="1"||noSubsets==="true"):null,fixedWidth:(fixedWidth!=null)?parseInt(fixedWidth):null,fixedHeight:(fixedHeight!=null)?parseInt(fixedHeight):null};obj.nestedLayers.push(layer);this.readChildNodes(node,layer);if(layer.name){var parts=layer.name.split(":");if(parts.length>0){layer.prefix=parts[0];}}},"Attribution":function(node,obj){obj.attribution={};this.readChildNodes(node,obj.attribution);},"LogoURL":function(node,obj){obj.logo={width:node.getAttribute("width"),height:node.getAttribute("height")};this.readChildNodes(node,obj.logo);},"Style":function(node,obj){var style={};obj.styles.push(style);this.readChildNodes(node,style);},"LegendURL":function(node,obj){var legend={width:node.getAttribute("width"),height:node.getAttribute("height")};obj.legend=legend;this.readChildNodes(node,legend);},"MetadataURL":function(node,obj){var metadataURL={type:node.getAttribute("type")};obj.metadataURLs.push(metadataURL);this.readChildNodes(node,metadataURL);},"DataURL":function(node,obj){obj.dataURL={};this.readChildNodes(node,obj.dataURL);},"FeatureListURL":function(node,obj){obj.featureListURL={};this.readChildNodes(node,obj.featureListURL);},"AuthorityURL":function(node,obj){var name=node.getAttribute("name");var authority={};this.readChildNodes(node,authority);obj.authorityURLs[name]=authority.href;},"Identifier":function(node,obj){var authority=node.getAttribute("authority");obj.identifiers[authority]=this.getChildValue(node);},"KeywordList":function(node,obj){this.readChildNodes(node,obj);},"SRS":function(node,obj){obj.srs[this.getChildValue(node)]=true;}}},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1"});OpenLayers.Format.WMSDescribeLayer.v1_1=OpenLayers.Class(OpenLayers.Format.WMSDescribeLayer,{initialize:function(options){OpenLayers.Format.WMSDescribeLayer.prototype.initialize.apply(this,[options]);},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var root=data.documentElement;var children=root.childNodes;var describelayer=[];var childNode,nodeName;for(var i=0;i<children.length;++i){childNode=children[i];nodeName=childNode.nodeName;if(nodeName=='LayerDescription'){var layerName=childNode.getAttribute('name');var owsType='';var owsURL='';var typeName='';if(childNode.getAttribute('owsType')){owsType=childNode.getAttribute('owsType');owsURL=childNode.getAttribute('owsURL');}else{if(childNode.getAttribute('wfs')!=''){owsType='WFS';owsURL=childNode.getAttribute('wfs');}else if(childNode.getAttribute('wcs')!=''){owsType='WCS';owsURL=childNode.getAttribute('wcs');}}  
var query=childNode.getElementsByTagName('Query');if(query.length>0){typeName=query[0].getAttribute('typeName');if(!typeName){typeName=query[0].getAttribute('typename');}}  
describelayer.push({layerName:layerName,owsType:owsType,owsURL:owsURL,typeName:typeName});}}  
return describelayer;},CLASS_NAME:"OpenLayers.Format.WMSDescribeLayer.v1_1"});OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:'olHandlerBoxZoomBox',boxCharacteristics:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);var callbacks={"down":this.startBox,"move":this.moveBox,"out":this.removeBox,"up":this.endBox};this.dragHandler=new OpenLayers.Handler.Drag(this,callbacks,{keyMask:this.keyMask});},destroy:function(){if(this.dragHandler){this.dragHandler.destroy();this.dragHandler=null;}  
OpenLayers.Handler.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Handler.prototype.setMap.apply(this,arguments);if(this.dragHandler){this.dragHandler.setMap(map);}},startBox:function(xy){this.zoomBox=OpenLayers.Util.createDiv('zoomBox',this.dragHandler.start);this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE["Popup"]-1;this.map.viewPortDiv.appendChild(this.zoomBox);OpenLayers.Element.addClass(this.map.viewPortDiv,"olDrawBox");},moveBox:function(xy){var startX=this.dragHandler.start.x;var startY=this.dragHandler.start.y;var deltaX=Math.abs(startX-xy.x);var deltaY=Math.abs(startY-xy.y);this.zoomBox.style.width=Math.max(1,deltaX)+"px";this.zoomBox.style.height=Math.max(1,deltaY)+"px";this.zoomBox.style.left=xy.x<startX?xy.x+"px":startX+"px";this.zoomBox.style.top=xy.y<startY?xy.y+"px":startY+"px";var box=this.getBoxCharacteristics();if(box.newBoxModel){if(xy.x>startX){this.zoomBox.style.width=Math.max(1,deltaX-box.xOffset)+"px";}  
if(xy.y>startY){this.zoomBox.style.height=Math.max(1,deltaY-box.yOffset)+"px";}}},endBox:function(end){var result;if(Math.abs(this.dragHandler.start.x-end.x)>5||Math.abs(this.dragHandler.start.y-end.y)>5){var start=this.dragHandler.start;var top=Math.min(start.y,end.y);var bottom=Math.max(start.y,end.y);var left=Math.min(start.x,end.x);var right=Math.max(start.x,end.x);result=new OpenLayers.Bounds(left,bottom,right,top);}else{result=this.dragHandler.start.clone();}  
this.removeBox();this.callback("done",[result]);},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 xOffset=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width"))+1;var yOffset=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"))+1;var newBoxModel=OpenLayers.Util.getBrowserName()=="msie"?document.compatMode!="BackCompat":true;this.boxCharacteristics={xOffset:xOffset,yOffset:yOffset,newBoxModel:newBoxModel};}  
return this.boxCharacteristics;},CLASS_NAME:"OpenLayers.Handler.Box"});OpenLayers.Handler.RegularPolygon=OpenLayers.Class(OpenLayers.Handler.Drag,{sides:4,radius:null,snapAngle:null,snapToggle:'shiftKey',layerOptions:null,persist:false,irregular:false,angle:null,fixedRadius:false,feature:null,layer:null,origin:null,initialize:function(control,callbacks,options){if(!(options&&options.layerOptions&&options.layerOptions.styleMap)){this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style['default'],{});}  
OpenLayers.Handler.prototype.initialize.apply(this,[control,callbacks,options]);this.options=(options)?options:{};},setOptions:function(newOptions){OpenLayers.Util.extend(this.options,newOptions);OpenLayers.Util.extend(this,newOptions);},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var options=OpenLayers.Util.extend({displayInLayerSwitcher:false,calculateInRange:OpenLayers.Function.True},this.layerOptions);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,options);this.map.addLayer(this.layer);activated=true;}  
return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.Drag.prototype.deactivate.apply(this,arguments)){if(this.dragging){this.cancel();}  
if(this.layer.map!=null){this.layer.destroy(false);if(this.feature){this.feature.destroy();}}  
this.layer=null;this.feature=null;deactivated=true;}  
return deactivated;},down:function(evt){this.fixedRadius=!!(this.radius);var maploc=this.map.getLonLatFromPixel(evt.xy);this.origin=new OpenLayers.Geometry.Point(maploc.lon,maploc.lat);if(!this.fixedRadius||this.irregular){this.radius=this.map.getResolution();}  
if(this.persist){this.clear();}  
this.feature=new OpenLayers.Feature.Vector();this.createGeometry();this.callback("create",[this.origin,this.feature]);this.layer.addFeatures([this.feature],{silent:true});this.layer.drawFeature(this.feature,this.style);},move:function(evt){var maploc=this.map.getLonLatFromPixel(evt.xy);var point=new OpenLayers.Geometry.Point(maploc.lon,maploc.lat);if(this.irregular){var ry=Math.sqrt(2)*Math.abs(point.y-this.origin.y)/2;this.radius=Math.max(this.map.getResolution()/2,ry);}else if(this.fixedRadius){this.origin=point;}else{this.calculateAngle(point,evt);this.radius=Math.max(this.map.getResolution()/2,point.distanceTo(this.origin));}  
this.modifyGeometry();if(this.irregular){var dx=point.x-this.origin.x;var dy=point.y-this.origin.y;var ratio;if(dy==0){ratio=dx/(this.radius*Math.sqrt(2));}else{ratio=dx/dy;}  
this.feature.geometry.resize(1,this.origin,ratio);this.feature.geometry.move(dx/2,dy/2);}  
this.layer.drawFeature(this.feature,this.style);},up:function(evt){this.finalize();if(this.start==this.last){this.callback("done",[evt.xy]);}},out:function(evt){this.finalize();},createGeometry:function(){this.angle=Math.PI*((1/this.sides)-(1/2));if(this.snapAngle){this.angle+=this.snapAngle*(Math.PI/180);}  
this.feature.geometry=OpenLayers.Geometry.Polygon.createRegularPolygon(this.origin,this.radius,this.sides,this.snapAngle);},modifyGeometry:function(){var angle,point;var ring=this.feature.geometry.components[0];if(ring.components.length!=(this.sides+1)){this.createGeometry();ring=this.feature.geometry.components[0];}  
for(var i=0;i<this.sides;++i){point=ring.components[i];angle=this.angle+(i*2*Math.PI/this.sides);point.x=this.origin.x+(this.radius*Math.cos(angle));point.y=this.origin.y+(this.radius*Math.sin(angle));point.clearBounds();}},calculateAngle:function(point,evt){var alpha=Math.atan2(point.y-this.origin.y,point.x-this.origin.x);if(this.snapAngle&&(this.snapToggle&&!evt[this.snapToggle])){var snapAngleRad=(Math.PI/180)*this.snapAngle;this.angle=Math.round(alpha/snapAngleRad)*snapAngleRad;}else{this.angle=alpha;}},cancel:function(){this.callback("cancel",null);this.finalize();},finalize:function(){this.origin=null;this.radius=this.options.radius;},clear:function(){if(this.layer){this.layer.renderer.clear();this.layer.destroyFeatures();}},callback:function(name,args){if(this.callbacks[name]){this.callbacks[name].apply(this.control,[this.feature.geometry.clone()]);}  
if(!this.persist&&(name=="done"||name=="cancel")){this.clear();}},CLASS_NAME:"OpenLayers.Handler.RegularPolygon"});OpenLayers.Layer.EventPane=OpenLayers.Class(OpenLayers.Layer,{smoothDragPan:true,isBaseLayer:true,isFixed:true,pane:null,mapObject:null,initialize:function(name,options){OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(this.pane==null){this.pane=OpenLayers.Util.createDiv(this.div.id+"_EventPane");}},destroy:function(){this.mapObject=null;this.pane=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1;this.pane.style.display=this.div.style.display;this.pane.style.width="100%";this.pane.style.height="100%";if(OpenLayers.Util.getBrowserName()=="msie"){this.pane.style.background="url("+OpenLayers.Util.getImagesLocation()+"blank.gif)";}  
if(this.isFixed){this.map.viewPortDiv.appendChild(this.pane);}else{this.map.layerContainerDiv.appendChild(this.pane);}  
this.loadMapObject();if(this.mapObject==null){this.loadWarningMessage();}},removeMap:function(map){if(this.pane&&this.pane.parentNode){this.pane.parentNode.removeChild(this.pane);}  
OpenLayers.Layer.prototype.removeMap.apply(this,arguments);},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var viewSize=this.map.getSize();var msgW=Math.min(viewSize.w,300);var msgH=Math.min(viewSize.h,200);var size=new OpenLayers.Size(msgW,msgH);var centerPx=new OpenLayers.Pixel(viewSize.w/2,viewSize.h/2);var topLeft=centerPx.add(-size.w/2,-size.h/2);var div=OpenLayers.Util.createDiv(this.name+"_warning",topLeft,size,null,null,null,"auto");div.style.padding="7px";div.style.backgroundColor="yellow";div.innerHTML=this.getWarningHTML();this.div.appendChild(div);},getWarningHTML:function(){return"";},display:function(display){OpenLayers.Layer.prototype.display.apply(this,arguments);this.pane.style.display=this.div.style.display;},setZIndex:function(zIndex){OpenLayers.Layer.prototype.setZIndex.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1;},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(this.mapObject!=null){var newCenter=this.map.getCenter();var newZoom=this.map.getZoom();if(newCenter!=null){var moOldCenter=this.getMapObjectCenter();var oldCenter=this.getOLLonLatFromMapObjectLonLat(moOldCenter);var moOldZoom=this.getMapObjectZoom();var oldZoom=this.getOLZoomFromMapObjectZoom(moOldZoom);if(!(newCenter.equals(oldCenter))||!(newZoom==oldZoom)){if(dragging&&this.dragPanMapObject&&this.smoothDragPan){var oldPx=this.map.getViewPortPxFromLonLat(oldCenter);var newPx=this.map.getViewPortPxFromLonLat(newCenter);this.dragPanMapObject(newPx.x-oldPx.x,oldPx.y-newPx.y);}else{var center=this.getMapObjectLonLatFromOLLonLat(newCenter);var zoom=this.getMapObjectZoomFromOLZoom(newZoom);this.setMapObjectCenter(center,zoom,dragging);}}}}},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var moPixel=this.getMapObjectPixelFromOLPixel(viewPortPx);var moLonLat=this.getMapObjectLonLatFromMapObjectPixel(moPixel);lonlat=this.getOLLonLatFromMapObjectLonLat(moLonLat);}  
return lonlat;},getViewPortPxFromLonLat:function(lonlat){var viewPortPx=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var moLonLat=this.getMapObjectLonLatFromOLLonLat(lonlat);var moPixel=this.getMapObjectPixelFromMapObjectLonLat(moLonLat);viewPortPx=this.getOLPixelFromMapObjectPixel(moPixel);}  
return viewPortPx;},getOLLonLatFromMapObjectLonLat:function(moLonLat){var olLonLat=null;if(moLonLat!=null){var lon=this.getLongitudeFromMapObjectLonLat(moLonLat);var lat=this.getLatitudeFromMapObjectLonLat(moLonLat);olLonLat=new OpenLayers.LonLat(lon,lat);}  
return olLonLat;},getMapObjectLonLatFromOLLonLat:function(olLonLat){var moLatLng=null;if(olLonLat!=null){moLatLng=this.getMapObjectLonLatFromLonLat(olLonLat.lon,olLonLat.lat);}  
return moLatLng;},getOLPixelFromMapObjectPixel:function(moPixel){var olPixel=null;if(moPixel!=null){var x=this.getXFromMapObjectPixel(moPixel);var y=this.getYFromMapObjectPixel(moPixel);olPixel=new OpenLayers.Pixel(x,y);}  
return olPixel;},getMapObjectPixelFromOLPixel:function(olPixel){var moPixel=null;if(olPixel!=null){moPixel=this.getMapObjectPixelFromXY(olPixel.x,olPixel.y);}  
return moPixel;},CLASS_NAME:"OpenLayers.Layer.EventPane"});OpenLayers.Layer.FixedZoomLevels=OpenLayers.Class({initialize:function(){},initResolutions:function(){var props=new Array('minZoomLevel','maxZoomLevel','numZoomLevels');for(var i=0,len=props.length;i<len;i++){var property=props[i];this[property]=(this.options[property]!=null)?this.options[property]:this.map[property];}  
if((this.minZoomLevel==null)||(this.minZoomLevel<this.MIN_ZOOM_LEVEL)){this.minZoomLevel=this.MIN_ZOOM_LEVEL;}  
var desiredZoomLevels;var limitZoomLevels=this.MAX_ZOOM_LEVEL-this.minZoomLevel+1;if(((this.options.numZoomLevels==null)&&(this.options.maxZoomLevel!=null))||((this.numZoomLevels==null)&&(this.maxZoomLevel!=null))){desiredZoomLevels=this.maxZoomLevel-this.minZoomLevel+1;}else{desiredZoomLevels=this.numZoomLevels;}  
if(desiredZoomLevels!=null){this.numZoomLevels=Math.min(desiredZoomLevels,limitZoomLevels);}else{this.numZoomLevels=limitZoomLevels;}  
this.maxZoomLevel=this.minZoomLevel+this.numZoomLevels-1;if(this.RESOLUTIONS!=null){var resolutionsIndex=0;this.resolutions=[];for(var i=this.minZoomLevel;i<=this.maxZoomLevel;i++){this.resolutions[resolutionsIndex++]=this.RESOLUTIONS[i];}  
this.maxResolution=this.resolutions[0];this.minResolution=this.resolutions[this.resolutions.length-1];}},getResolution:function(){if(this.resolutions!=null){return OpenLayers.Layer.prototype.getResolution.apply(this,arguments);}else{var resolution=null;var viewSize=this.map.getSize();var extent=this.getExtent();if((viewSize!=null)&&(extent!=null)){resolution=Math.max(extent.getWidth()/viewSize.w,extent.getHeight()/viewSize.h);}  
return resolution;}},getExtent:function(){var extent=null;var size=this.map.getSize();var tlPx=new OpenLayers.Pixel(0,0);var tlLL=this.getLonLatFromViewPortPx(tlPx);var brPx=new OpenLayers.Pixel(size.w,size.h);var brLL=this.getLonLatFromViewPortPx(brPx);if((tlLL!=null)&&(brLL!=null)){extent=new OpenLayers.Bounds(tlLL.lon,brLL.lat,brLL.lon,tlLL.lat);}  
return extent;},getZoomForResolution:function(resolution){if(this.resolutions!=null){return OpenLayers.Layer.prototype.getZoomForResolution.apply(this,arguments);}else{var extent=OpenLayers.Layer.prototype.getExtent.apply(this,[]);return this.getZoomForExtent(extent);}},getOLZoomFromMapObjectZoom:function(moZoom){var zoom=null;if(moZoom!=null){zoom=moZoom-this.minZoomLevel;}  
return zoom;},getMapObjectZoomFromOLZoom:function(olZoom){var zoom=null;if(olZoom!=null){zoom=olZoom+this.minZoomLevel;}  
return zoom;},CLASS_NAME:"OpenLayers.Layer.FixedZoomLevels"});OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:false,initialize:function(name,url,params,options){var newArguments=arguments;newArguments=[name,options];OpenLayers.Layer.prototype.initialize.apply(this,newArguments);this.url=url;this.params=OpenLayers.Util.extend({},params);},destroy:function(){this.url=null;this.params=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.getOptions());}  
obj=OpenLayers.Layer.prototype.clone.apply(this,[obj]);return obj;},setUrl:function(newUrl){this.url=newUrl;},mergeNewParams:function(newParams){this.params=OpenLayers.Util.extend(this.params,newParams);var ret=this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"params"});}  
return ret;},redraw:function(force){if(force){return this.mergeNewParams({"_olSalt":Math.random()});}else{return OpenLayers.Layer.prototype.redraw.apply(this,[]);}},selectUrl:function(paramString,urls){var product=1;for(var i=0,len=paramString.length;i<len;i++){product*=paramString.charCodeAt(i)*this.URL_HASH_FACTOR;product-=Math.floor(product);}  
return urls[Math.floor(product*urls.length)];},getFullRequestString:function(newParams,altUrl){var url=altUrl||this.url;var allParams=OpenLayers.Util.extend({},this.params);allParams=OpenLayers.Util.extend(allParams,newParams);var paramsString=OpenLayers.Util.getParameterString(allParams);if(url instanceof Array){url=this.selectUrl(paramsString,url);}  
var urlParams=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(url));for(var key in allParams){if(key.toUpperCase()in urlParams){delete allParams[key];}}  
paramsString=OpenLayers.Util.getParameterString(allParams);return OpenLayers.Util.urlAppend(url,paramsString);},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});OpenLayers.Layer.Image=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:true,url:null,extent:null,size:null,tile:null,aspectRatio:null,initialize:function(name,url,extent,size,options){this.url=url;this.extent=extent;this.maxExtent=extent;this.size=size;OpenLayers.Layer.prototype.initialize.apply(this,[name,options]);this.aspectRatio=(this.extent.getHeight()/this.size.h)/(this.extent.getWidth()/this.size.w);},destroy:function(){if(this.tile){this.removeTileMonitoringHooks(this.tile);this.tile.destroy();this.tile=null;}  
OpenLayers.Layer.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.Image(this.name,this.url,this.extent,this.size,this.getOptions());}  
obj=OpenLayers.Layer.prototype.clone.apply(this,[obj]);return obj;},setMap:function(map){if(this.options.maxResolution==null){this.options.maxResolution=this.aspectRatio*this.extent.getWidth()/this.size.w;}  
OpenLayers.Layer.prototype.setMap.apply(this,arguments);},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var firstRendering=(this.tile==null);if(zoomChanged||firstRendering){this.setTileSize();var ul=new OpenLayers.LonLat(this.extent.left,this.extent.top);var ulPx=this.map.getLayerPxFromLonLat(ul);if(firstRendering){this.tile=new OpenLayers.Tile.Image(this,ulPx,this.extent,null,this.tileSize);this.addTileMonitoringHooks(this.tile);}else{this.tile.size=this.tileSize.clone();this.tile.position=ulPx.clone();}  
this.tile.draw();}},setTileSize:function(){var tileWidth=this.extent.getWidth()/this.map.getResolution();var tileHeight=this.extent.getHeight()/this.map.getResolution();this.tileSize=new OpenLayers.Size(tileWidth,tileHeight);},addTileMonitoringHooks:function(tile){tile.onLoadStart=function(){this.events.triggerEvent("loadstart");};tile.events.register("loadstart",this,tile.onLoadStart);tile.onLoadEnd=function(){this.events.triggerEvent("loadend");};tile.events.register("loadend",this,tile.onLoadEnd);tile.events.register("unload",this,tile.onLoadEnd);},removeTileMonitoringHooks:function(tile){tile.unload();tile.events.un({"loadstart":tile.onLoadStart,"loadend":tile.onLoadEnd,"unload":tile.onLoadEnd,scope:this});},setUrl:function(newUrl){this.url=newUrl;this.tile.draw();},getURL:function(bounds){return this.url;},CLASS_NAME:"OpenLayers.Layer.Image"});OpenLayers.Layer.Markers=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:false,markers:null,drawn:false,initialize:function(name,options){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.markers=[];},destroy:function(){this.clearMarkers();this.markers=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},setOpacity:function(opacity){if(opacity!=this.opacity){this.opacity=opacity;for(var i=0,len=this.markers.length;i<len;i++){this.markers[i].setOpacity(this.opacity);}}},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(zoomChanged||!this.drawn){for(var i=0,len=this.markers.length;i<len;i++){this.drawMarker(this.markers[i]);}  
this.drawn=true;}},addMarker:function(marker){this.markers.push(marker);if(this.opacity!=null){marker.setOpacity(this.opacity);}  
if(this.map&&this.map.getExtent()){marker.map=this.map;this.drawMarker(marker);}},removeMarker:function(marker){if(this.markers&&this.markers.length){OpenLayers.Util.removeItem(this.markers,marker);marker.erase();}},clearMarkers:function(){if(this.markers!=null){while(this.markers.length>0){this.removeMarker(this.markers[0]);}}},drawMarker:function(marker){var px=this.map.getLayerPxFromLonLat(marker.lonlat);if(px==null){marker.display(false);}else{if(!marker.isDrawn()){var markerImg=marker.draw(px);this.div.appendChild(markerImg);}else if(marker.icon){marker.icon.moveTo(px);}}},getDataExtent:function(){var maxExtent=null;if(this.markers&&(this.markers.length>0)){var maxExtent=new OpenLayers.Bounds();for(var i=0,len=this.markers.length;i<len;i++){var marker=this.markers[i];maxExtent.extend(marker.lonlat);}}  
return maxExtent;},CLASS_NAME:"OpenLayers.Layer.Markers"});OpenLayers.Layer.SphericalMercator={getExtent:function(){var extent=null;if(this.sphericalMercator){extent=this.map.calculateBounds();}else{extent=OpenLayers.Layer.FixedZoomLevels.prototype.getExtent.apply(this);}  
return extent;},getLonLatFromViewPortPx:function(viewPortPx){return OpenLayers.Layer.prototype.getLonLatFromViewPortPx.apply(this,arguments);},getViewPortPxFromLonLat:function(lonlat){return OpenLayers.Layer.prototype.getViewPortPxFromLonLat.apply(this,arguments);},initMercatorParameters:function(){this.RESOLUTIONS=[];var maxResolution=156543.0339;for(var zoom=0;zoom<=this.MAX_ZOOM_LEVEL;++zoom){this.RESOLUTIONS[zoom]=maxResolution/Math.pow(2,zoom);}  
this.units="m";this.projection=this.projection||"EPSG:900913";},forwardMercator:function(lon,lat){var x=lon*20037508.34/180;var y=Math.log(Math.tan((90+lat)*Math.PI/360))/(Math.PI/180);y=y*20037508.34/180;return new OpenLayers.LonLat(x,y);},inverseMercator:function(x,y){var lon=(x/20037508.34)*180;var lat=(y/20037508.34)*180;lat=180/Math.PI*(2*Math.atan(Math.exp(lat*Math.PI/180))-Math.PI/2);return new OpenLayers.LonLat(lon,lat);},projectForward:function(point){var lonlat=OpenLayers.Layer.SphericalMercator.forwardMercator(point.x,point.y);point.x=lonlat.lon;point.y=lonlat.lat;return point;},projectInverse:function(point){var lonlat=OpenLayers.Layer.SphericalMercator.inverseMercator(point.x,point.y);point.x=lonlat.lon;point.y=lonlat.lat;return point;}};OpenLayers.Projection.addTransform("EPSG:4326","EPSG:900913",OpenLayers.Layer.SphericalMercator.projectForward);OpenLayers.Projection.addTransform("EPSG:900913","EPSG:4326",OpenLayers.Layer.SphericalMercator.projectInverse);OpenLayers.Tile.WFS=OpenLayers.Class(OpenLayers.Tile,{features:null,url:null,request:null,initialize:function(layer,position,bounds,url,size){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=url;this.features=[];},destroy:function(){OpenLayers.Tile.prototype.destroy.apply(this,arguments);this.destroyAllFeatures();this.features=null;this.url=null;if(this.request){this.request.abort();this.request=null;}},clear:function(){this.destroyAllFeatures();},draw:function(){if(OpenLayers.Tile.prototype.draw.apply(this,arguments)){if(this.isLoading){this.events.triggerEvent("reload");}else{this.isLoading=true;this.events.triggerEvent("loadstart");}  
this.loadFeaturesForRegion(this.requestSuccess);}},loadFeaturesForRegion:function(success,failure){if(this.request){this.request.abort();}  
this.request=OpenLayers.Request.GET({url:this.url,success:success,failure:failure,scope:this});},requestSuccess:function(request){if(this.features){var doc=request.responseXML;if(!doc||!doc.documentElement){doc=request.responseText;}  
if(this.layer.vectorMode){this.layer.addFeatures(this.layer.formatObject.read(doc));}else{var xml=new OpenLayers.Format.XML();if(typeof doc=="string"){doc=xml.read(doc);}  
var resultFeatures=xml.getElementsByTagNameNS(doc,"http://www.opengis.net/gml","featureMember");this.addResults(resultFeatures);}}  
if(this.events){this.events.triggerEvent("loadend");}  
this.request=null;},addResults:function(results){for(var i=0;i<results.length;i++){var feature=new this.layer.featureClass(this.layer,results[i]);this.features.push(feature);}},destroyAllFeatures:function(){while(this.features.length>0){var feature=this.features.shift();feature.destroy();}},CLASS_NAME:"OpenLayers.Tile.WFS"});OpenLayers.Control.DrawFeature=OpenLayers.Class(OpenLayers.Control,{layer:null,callbacks:null,EVENT_TYPES:["featureadded"],multi:false,featureAdded:function(){},handlerOptions:null,initialize:function(layer,handler,options){this.EVENT_TYPES=OpenLayers.Control.DrawFeature.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[options]);this.callbacks=OpenLayers.Util.extend({done:this.drawFeature,modify:function(vertex,feature){this.layer.events.triggerEvent("sketchmodified",{vertex:vertex,feature:feature});},create:function(vertex,feature){this.layer.events.triggerEvent("sketchstarted",{vertex:vertex,feature:feature});}},this.callbacks);this.layer=layer;this.handlerOptions=this.handlerOptions||{};if(!("multi"in this.handlerOptions)){this.handlerOptions.multi=this.multi;}  
var sketchStyle=this.layer.styleMap&&this.layer.styleMap.styles.temporary;if(sketchStyle){this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{styleMap:new OpenLayers.StyleMap({"default":sketchStyle})});}  
this.handler=new handler(this,this.callbacks,this.handlerOptions);},drawFeature:function(geometry){var feature=new OpenLayers.Feature.Vector(geometry);var proceed=this.layer.events.triggerEvent("sketchcomplete",{feature:feature});if(proceed!==false){feature.state=OpenLayers.State.INSERT;this.layer.addFeatures([feature]);this.featureAdded(feature);this.events.triggerEvent("featureadded",{feature:feature});}},CLASS_NAME:"OpenLayers.Control.DrawFeature"});OpenLayers.Control.Measure=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:['measure','measurepartial'],handlerOptions:null,callbacks:null,displaySystem:'metric',geodesic:false,displaySystemUnits:{geographic:['dd'],english:['mi','ft','in'],metric:['km','m']},partialDelay:300,delayedTrigger:null,persist:false,initialize:function(handler,options){this.EVENT_TYPES=OpenLayers.Control.Measure.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[options]);this.callbacks=OpenLayers.Util.extend({done:this.measureComplete,point:this.measurePartial},this.callbacks);this.handlerOptions=OpenLayers.Util.extend({persist:this.persist},this.handlerOptions);this.handler=new handler(this,this.callbacks,this.handlerOptions);},cancel:function(){this.handler.cancel();},updateHandler:function(handler,options){var active=this.active;if(active){this.deactivate();}  
this.handler=new handler(this,this.callbacks,options);if(active){this.activate();}},measureComplete:function(geometry){if(this.delayedTrigger){window.clearTimeout(this.delayedTrigger);}  
this.measure(geometry,"measure");},measurePartial:function(point,geometry){if(geometry.getLength()>0){geometry=geometry.clone();this.delayedTrigger=window.setTimeout(OpenLayers.Function.bind(function(){this.measure(geometry,"measurepartial");},this),this.partialDelay);}},measure:function(geometry,eventType){var stat,order;if(geometry.CLASS_NAME.indexOf('LineString')>-1){stat=this.getBestLength(geometry);order=1;}else{stat=this.getBestArea(geometry);order=2;}  
this.events.triggerEvent(eventType,{measure:stat[0],units:stat[1],order:order,geometry:geometry});},getBestArea:function(geometry){var units=this.displaySystemUnits[this.displaySystem];var unit,area;for(var i=0,len=units.length;i<len;++i){unit=units[i];area=this.getArea(geometry,unit);if(area>1){break;}}  
return[area,unit];},getArea:function(geometry,units){var area,geomUnits;if(this.geodesic){area=geometry.getGeodesicArea(this.map.getProjectionObject());geomUnits="m";}else{area=geometry.getArea();geomUnits=this.map.getUnits();}  
var inPerDisplayUnit=OpenLayers.INCHES_PER_UNIT[units];if(inPerDisplayUnit){var inPerMapUnit=OpenLayers.INCHES_PER_UNIT[geomUnits];area*=Math.pow((inPerMapUnit/inPerDisplayUnit),2);}  
return area;},getBestLength:function(geometry){var units=this.displaySystemUnits[this.displaySystem];var unit,length;for(var i=0,len=units.length;i<len;++i){unit=units[i];length=this.getLength(geometry,unit);if(length>1){break;}}  
return[length,unit];},getLength:function(geometry,units){var length,geomUnits;if(this.geodesic){length=geometry.getGeodesicLength(this.map.getProjectionObject());geomUnits="m";}else{length=geometry.getLength();geomUnits=this.map.getUnits();}  
var inPerDisplayUnit=OpenLayers.INCHES_PER_UNIT[units];if(inPerDisplayUnit){var inPerMapUnit=OpenLayers.INCHES_PER_UNIT[geomUnits];length*=(inPerMapUnit/inPerDisplayUnit);}  
return length;},CLASS_NAME:"OpenLayers.Control.Measure"});OpenLayers.Control.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,out:false,alwaysZoom:false,draw:function(){this.handler=new OpenLayers.Handler.Box(this,{done:this.zoomBox},{keyMask:this.keyMask});},zoomBox:function(position){if(position instanceof OpenLayers.Bounds){var bounds;if(!this.out){var minXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.left,position.bottom));var maxXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.right,position.top));bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);}else{var pixWidth=Math.abs(position.right-position.left);var pixHeight=Math.abs(position.top-position.bottom);var zoomFactor=Math.min((this.map.size.h/pixHeight),(this.map.size.w/pixWidth));var extent=this.map.getExtent();var center=this.map.getLonLatFromPixel(position.getCenterPixel());var xmin=center.lon-(extent.getWidth()/2)*zoomFactor;var xmax=center.lon+(extent.getWidth()/2)*zoomFactor;var ymin=center.lat-(extent.getHeight()/2)*zoomFactor;var ymax=center.lat+(extent.getHeight()/2)*zoomFactor;bounds=new OpenLayers.Bounds(xmin,ymin,xmax,ymax);}  
var lastZoom=this.map.getZoom();this.map.zoomToExtent(bounds);if(lastZoom==this.map.getZoom()&&this.alwaysZoom==true){this.map.zoomTo(lastZoom+(this.out?-1:1));}}else{if(!this.out){this.map.setCenter(this.map.getLonLatFromPixel(position),this.map.getZoom()+1);}else{this.map.setCenter(this.map.getLonLatFromPixel(position),this.map.getZoom()-1);}}},CLASS_NAME:"OpenLayers.Control.ZoomBox"});OpenLayers.Format.WFSCapabilities.v1_0_0=OpenLayers.Class(OpenLayers.Format.WFSCapabilities.v1,{initialize:function(options){OpenLayers.Format.WFSCapabilities.v1.prototype.initialize.apply(this,[options]);},read_cap_Service:function(capabilities,node){var service={};this.runChildNodes(service,node);capabilities.service=service;},read_cap_Fees:function(service,node){var fees=this.getChildValue(node);if(fees&&fees.toLowerCase()!="none"){service.fees=fees;}},read_cap_AccessConstraints:function(service,node){var constraints=this.getChildValue(node);if(constraints&&constraints.toLowerCase()!="none"){service.accessConstraints=constraints;}},read_cap_OnlineResource:function(service,node){var onlineResource=this.getChildValue(node);if(onlineResource&&onlineResource.toLowerCase()!="none"){service.onlineResource=onlineResource;}},read_cap_Keywords:function(service,node){var keywords=this.getChildValue(node);if(keywords&&keywords.toLowerCase()!="none"){service.keywords=keywords.split(', ');}},read_cap_Capability:function(capabilities,node){var capability={};this.runChildNodes(capability,node);capabilities.capability=capability;},read_cap_Request:function(obj,node){var request={};this.runChildNodes(request,node);obj.request=request;},read_cap_GetFeature:function(request,node){var getfeature={href:{},formats:[]};this.runChildNodes(getfeature,node);request.getfeature=getfeature;},read_cap_ResultFormat:function(obj,node){var children=node.childNodes;var childNode;for(var i=0;i<children.length;i++){childNode=children[i];if(childNode.nodeType==1){obj.formats.push(childNode.nodeName);}}},read_cap_DCPType:function(obj,node){this.runChildNodes(obj,node);},read_cap_HTTP:function(obj,node){this.runChildNodes(obj.href,node);},read_cap_Get:function(obj,node){obj.get=node.getAttribute("onlineResource");},read_cap_Post:function(obj,node){obj.post=node.getAttribute("onlineResource");},CLASS_NAME:"OpenLayers.Format.WFSCapabilities.v1_0_0"});OpenLayers.Format.WFSCapabilities.v1_1_0=OpenLayers.Class(OpenLayers.Format.WFSCapabilities.v1,{initialize:function(options){OpenLayers.Format.WFSCapabilities.v1.prototype.initialize.apply(this,[options]);},CLASS_NAME:"OpenLayers.Format.WFSCapabilities.v1_1_0"});OpenLayers.Format.WKT=OpenLayers.Class(OpenLayers.Format,{initialize:function(options){this.regExes={'typeStr':/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,'spaces':/\s+/,'parenComma':/\)\s*,\s*\(/,'doubleParenComma':/\)\s*\)\s*,\s*\(\s*\(/,'trimParens':/^\s*\(?(.*?)\)?\s*$/};OpenLayers.Format.prototype.initialize.apply(this,[options]);},read:function(wkt){var features,type,str;var matches=this.regExes.typeStr.exec(wkt);if(matches){type=matches[1].toLowerCase();str=matches[2];if(this.parse[type]){features=this.parse[type].apply(this,[str]);}  
if(this.internalProjection&&this.externalProjection){if(features&&features.CLASS_NAME=="OpenLayers.Feature.Vector"){features.geometry.transform(this.externalProjection,this.internalProjection);}else if(features&&type!="geometrycollection"&&typeof features=="object"){for(var i=0,len=features.length;i<len;i++){var component=features[i];component.geometry.transform(this.externalProjection,this.internalProjection);}}}}  
return features;},write:function(features){var collection,geometry,type,data,isCollection;if(features.constructor==Array){collection=features;isCollection=true;}else{collection=[features];isCollection=false;}  
var pieces=[];if(isCollection){pieces.push('GEOMETRYCOLLECTION(');}  
for(var i=0,len=collection.length;i<len;++i){if(isCollection&&i>0){pieces.push(',');}  
geometry=collection[i].geometry;type=geometry.CLASS_NAME.split('.')[2].toLowerCase();if(!this.extract[type]){return null;}  
if(this.internalProjection&&this.externalProjection){geometry=geometry.clone();geometry.transform(this.internalProjection,this.externalProjection);}  
data=this.extract[type].apply(this,[geometry]);pieces.push(type.toUpperCase()+'('+data+')');}  
if(isCollection){pieces.push(')');}  
return pieces.join('');},extract:{'point':function(point){return point.x+' '+point.y;},'multipoint':function(multipoint){var array=[];for(var i=0,len=multipoint.components.length;i<len;++i){array.push('('+  
this.extract.point.apply(this,[multipoint.components[i]])+')');}  
return array.join(',');},'linestring':function(linestring){var array=[];for(var i=0,len=linestring.components.length;i<len;++i){array.push(this.extract.point.apply(this,[linestring.components[i]]));}  
return array.join(',');},'multilinestring':function(multilinestring){var array=[];for(var i=0,len=multilinestring.components.length;i<len;++i){array.push('('+  
this.extract.linestring.apply(this,[multilinestring.components[i]])+')');}  
return array.join(',');},'polygon':function(polygon){var array=[];for(var i=0,len=polygon.components.length;i<len;++i){array.push('('+  
this.extract.linestring.apply(this,[polygon.components[i]])+')');}  
return array.join(',');},'multipolygon':function(multipolygon){var array=[];for(var i=0,len=multipolygon.components.length;i<len;++i){array.push('('+  
this.extract.polygon.apply(this,[multipolygon.components[i]])+')');}  
return array.join(',');}},parse:{'point':function(str){var coords=OpenLayers.String.trim(str).split(this.regExes.spaces);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(coords[0],coords[1]));},'multipoint':function(str){var point;var points=OpenLayers.String.trim(str).split(this.regExes.parenComma);var components=[];for(var i=0,len=points.length;i<len;++i){point=points[i].replace(this.regExes.trimParens,'$1');components.push(this.parse.point.apply(this,[point]).geometry);}  
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint(components));},'linestring':function(str){var points=OpenLayers.String.trim(str).split(',');var components=[];for(var i=0,len=points.length;i<len;++i){components.push(this.parse.point.apply(this,[points[i]]).geometry);}  
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(components));},'multilinestring':function(str){var line;var lines=OpenLayers.String.trim(str).split(this.regExes.parenComma);var components=[];for(var i=0,len=lines.length;i<len;++i){line=lines[i].replace(this.regExes.trimParens,'$1');components.push(this.parse.linestring.apply(this,[line]).geometry);}  
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiLineString(components));},'polygon':function(str){var ring,linestring,linearring;var rings=OpenLayers.String.trim(str).split(this.regExes.parenComma);var components=[];for(var i=0,len=rings.length;i<len;++i){ring=rings[i].replace(this.regExes.trimParens,'$1');linestring=this.parse.linestring.apply(this,[ring]).geometry;linearring=new OpenLayers.Geometry.LinearRing(linestring.components);components.push(linearring);}  
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon(components));},'multipolygon':function(str){var polygon;var polygons=OpenLayers.String.trim(str).split(this.regExes.doubleParenComma);var components=[];for(var i=0,len=polygons.length;i<len;++i){polygon=polygons[i].replace(this.regExes.trimParens,'$1');components.push(this.parse.polygon.apply(this,[polygon]).geometry);}  
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPolygon(components));},'geometrycollection':function(str){str=str.replace(/,\s*([A-Za-z])/g,'|$1');var wktArray=OpenLayers.String.trim(str).split('|');var components=[];for(var i=0,len=wktArray.length;i<len;++i){components.push(OpenLayers.Format.WKT.prototype.read.apply(this,[wktArray[i]]));}  
return components;}},CLASS_NAME:"OpenLayers.Format.WKT"});OpenLayers.Format.WMC.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ol:"http://openlayers.org/context",wmc:"http://www.opengis.net/context",sld:"http://www.opengis.net/sld",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},schemaLocation:"",getNamespacePrefix:function(uri){var prefix=null;if(uri==null){prefix=this.namespaces[this.defaultPrefix];}else{for(prefix in this.namespaces){if(this.namespaces[prefix]==uri){break;}}}  
return prefix;},defaultPrefix:"wmc",rootPrefix:null,defaultStyleName:"",defaultStyleTitle:"Default",initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var root=data.documentElement;this.rootPrefix=root.prefix;var context={version:root.getAttribute("version")};this.runChildNodes(context,root);return context;},runChildNodes:function(obj,node){var children=node.childNodes;var childNode,processor,prefix,local;for(var i=0,len=children.length;i<len;++i){childNode=children[i];if(childNode.nodeType==1){prefix=this.getNamespacePrefix(childNode.namespaceURI);local=childNode.nodeName.split(":").pop();processor=this["read_"+prefix+"_"+local];if(processor){processor.apply(this,[obj,childNode]);}}}},read_wmc_General:function(context,node){this.runChildNodes(context,node);},read_wmc_BoundingBox:function(context,node){context.projection=node.getAttribute("SRS");context.bounds=new OpenLayers.Bounds(parseFloat(node.getAttribute("minx")),parseFloat(node.getAttribute("miny")),parseFloat(node.getAttribute("maxx")),parseFloat(node.getAttribute("maxy")));},read_wmc_LayerList:function(context,node){context.layersContext=[];this.runChildNodes(context,node);},read_wmc_Layer:function(context,node){var layerContext={visibility:(node.getAttribute("hidden")!="1"),queryable:(node.getAttribute("queryable")=="1"),formats:[],styles:[]};this.runChildNodes(layerContext,node);context.layersContext.push(layerContext);},read_wmc_Extension:function(obj,node){this.runChildNodes(obj,node);},read_ol_units:function(layerContext,node){layerContext.units=this.getChildValue(node);},read_ol_maxExtent:function(obj,node){var bounds=new OpenLayers.Bounds(node.getAttribute("minx"),node.getAttribute("miny"),node.getAttribute("maxx"),node.getAttribute("maxy"));obj.maxExtent=bounds;},read_ol_transparent:function(layerContext,node){layerContext.transparent=this.getChildValue(node);},read_ol_numZoomLevels:function(layerContext,node){layerContext.numZoomLevels=parseInt(this.getChildValue(node));},read_ol_opacity:function(layerContext,node){layerContext.opacity=parseFloat(this.getChildValue(node));},read_ol_singleTile:function(layerContext,node){layerContext.singleTile=(this.getChildValue(node)=="true");},read_ol_tileSize:function(layerContext,node){var obj={"width":node.getAttribute("width"),"height":node.getAttribute("height")};layerContext.tileSize=obj;},read_ol_isBaseLayer:function(layerContext,node){layerContext.isBaseLayer=(this.getChildValue(node)=="true");},read_ol_displayInLayerSwitcher:function(layerContext,node){layerContext.displayInLayerSwitcher=(this.getChildValue(node)=="true");},read_wmc_Server:function(layerContext,node){layerContext.version=node.getAttribute("version");var server={};var links=node.getElementsByTagName("OnlineResource");if(links.length>0){this.read_wmc_OnlineResource(server,links[0]);}  
layerContext.url=server.href;},read_wmc_FormatList:function(layerContext,node){this.runChildNodes(layerContext,node);},read_wmc_Format:function(layerContext,node){var format={value:this.getChildValue(node)};if(node.getAttribute("current")=="1"){format.current=true;}  
layerContext.formats.push(format);},read_wmc_StyleList:function(layerContext,node){this.runChildNodes(layerContext,node);},read_wmc_Style:function(layerContext,node){var style={};this.runChildNodes(style,node);if(node.getAttribute("current")=="1"){style.current=true;}  
layerContext.styles.push(style);},read_wmc_SLD:function(style,node){this.runChildNodes(style,node);},read_sld_StyledLayerDescriptor:function(sld,node){var xml=OpenLayers.Format.XML.prototype.write.apply(this,[node]);sld.body=xml;},read_wmc_OnlineResource:function(obj,node){obj.href=this.getAttributeNS(node,this.namespaces.xlink,"href");},read_wmc_Name:function(obj,node){var name=this.getChildValue(node);if(name){obj.name=name;}},read_wmc_Title:function(obj,node){var title=this.getChildValue(node);if(title){obj.title=title;}},read_wmc_MetadataURL:function(layerContext,node){var metadataURL={};var links=node.getElementsByTagName("OnlineResource");if(links.length>0){this.read_wmc_OnlineResource(metadataURL,links[0]);}  
layerContext.metadataURL=metadataURL.href;},read_wmc_Abstract:function(obj,node){var abst=this.getChildValue(node);if(abst){obj["abstract"]=abst;}},read_wmc_LegendURL:function(style,node){var legend={width:node.getAttribute('width'),height:node.getAttribute('height')};var links=node.getElementsByTagName("OnlineResource");if(links.length>0){this.read_wmc_OnlineResource(legend,links[0]);}  
style.legend=legend;},write:function(context,options){var root=this.createElementDefaultNS("ViewContext");this.setAttributes(root,{version:this.VERSION,id:(options&&typeof options.id=="string")?options.id:OpenLayers.Util.createUniqueID("OpenLayers_Context_")});this.setAttributeNS(root,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);root.appendChild(this.write_wmc_General(context));root.appendChild(this.write_wmc_LayerList(context));return OpenLayers.Format.XML.prototype.write.apply(this,[root]);},createElementDefaultNS:function(name,childValue,attributes){var node=this.createElementNS(this.namespaces[this.defaultPrefix],name);if(childValue){node.appendChild(this.createTextNode(childValue));}  
if(attributes){this.setAttributes(node,attributes);}  
return node;},setAttributes:function(node,obj){var value;for(var name in obj){value=obj[name].toString();if(value.match(/[A-Z]/)){this.setAttributeNS(node,null,name,value);}else{node.setAttribute(name,value);}}},write_wmc_General:function(context){var node=this.createElementDefaultNS("General");if(context.size){node.appendChild(this.createElementDefaultNS("Window",null,{width:context.size.w,height:context.size.h}));}  
var bounds=context.bounds;node.appendChild(this.createElementDefaultNS("BoundingBox",null,{minx:bounds.left.toPrecision(18),miny:bounds.bottom.toPrecision(18),maxx:bounds.right.toPrecision(18),maxy:bounds.top.toPrecision(18),SRS:context.projection}));node.appendChild(this.createElementDefaultNS("Title",context.title));node.appendChild(this.write_ol_MapExtension(context));return node;},write_ol_MapExtension:function(context){var node=this.createElementDefaultNS("Extension");var bounds=context.maxExtent;if(bounds){var maxExtent=this.createElementNS(this.namespaces.ol,"ol:maxExtent");this.setAttributes(maxExtent,{minx:bounds.left.toPrecision(18),miny:bounds.bottom.toPrecision(18),maxx:bounds.right.toPrecision(18),maxy:bounds.top.toPrecision(18)});node.appendChild(maxExtent);}  
return node;},write_wmc_LayerList:function(context){var list=this.createElementDefaultNS("LayerList");for(var i=0,len=context.layersContext.length;i<len;++i){list.appendChild(this.write_wmc_Layer(context.layersContext[i]));}  
return list;},write_wmc_Layer:function(context){var node=this.createElementDefaultNS("Layer",null,{queryable:context.queryable?"1":"0",hidden:context.visibility?"0":"1"});node.appendChild(this.write_wmc_Server(context));node.appendChild(this.createElementDefaultNS("Name",context.name));node.appendChild(this.createElementDefaultNS("Title",context.title));if(context.metadataURL){node.appendChild(this.write_wmc_MetadataURL(context.metadataURL));}  
return node;},write_wmc_LayerExtension:function(context){var node=this.createElementDefaultNS("Extension");var bounds=context.maxExtent;var maxExtent=this.createElementNS(this.namespaces.ol,"ol:maxExtent");this.setAttributes(maxExtent,{minx:bounds.left.toPrecision(18),miny:bounds.bottom.toPrecision(18),maxx:bounds.right.toPrecision(18),maxy:bounds.top.toPrecision(18)});node.appendChild(maxExtent);if(context.tileSize&&!context.singleTile){var size=this.createElementNS(this.namespaces.ol,"ol:tileSize");this.setAttributes(size,context.tileSize);node.appendChild(size);}  
var properties=["transparent","numZoomLevels","units","isBaseLayer","opacity","displayInLayerSwitcher","singleTile"];var child;for(var i=0,len=properties.length;i<len;++i){child=this.createOLPropertyNode(context,properties[i]);if(child){node.appendChild(child);}}  
return node;},createOLPropertyNode:function(obj,prop){var node=null;if(obj[prop]!=null){node=this.createElementNS(this.namespaces.ol,"ol:"+prop);node.appendChild(this.createTextNode(obj[prop].toString()));}  
return node;},write_wmc_Server:function(context){var node=this.createElementDefaultNS("Server");this.setAttributes(node,{service:"OGC:WMS",version:context.version});node.appendChild(this.write_wmc_OnlineResource(context.url));return node;},write_wmc_MetadataURL:function(metadataURL){var node=this.createElementDefaultNS("MetadataURL");node.appendChild(this.write_wmc_OnlineResource(metadataURL));return node;},write_wmc_FormatList:function(context){var node=this.createElementDefaultNS("FormatList");for(var i=0,len=context.formats.length;i<len;i++){var format=context.formats[i];node.appendChild(this.createElementDefaultNS("Format",format.value,(format.current&&format.current==true)?{current:"1"}:null));}  
return node;},write_wmc_StyleList:function(layer){var node=this.createElementDefaultNS("StyleList");var styles=layer.styles;if(styles&&styles instanceof Array){var sld;for(var i=0,len=styles.length;i<len;i++){var s=styles[i];var style=this.createElementDefaultNS("Style",null,(s.current&&s.current==true)?{current:"1"}:null);if(s.href){sld=this.createElementDefaultNS("SLD");var link=this.write_wmc_OnlineResource(s.href);sld.appendChild(link);sld.appendChild(this.createElementDefaultNS("Name",s.name));if(s.title){sld.appendChild(this.createElementDefaultNS("Title",s.title));}  
style.appendChild(sld);}else if(s.body){sld=this.createElementDefaultNS("SLD");var doc=OpenLayers.Format.XML.prototype.read.apply(this,[s.body]);var imported=doc.documentElement;if(sld.ownerDocument&&sld.ownerDocument.importNode){imported=sld.ownerDocument.importNode(imported,true);}  
sld.appendChild(imported);sld.appendChild(this.createElementDefaultNS("Name",s.name));if(s.title){sld.appendChild(this.createElementDefaultNS("Title",s.title));}  
style.appendChild(sld);}else{style.appendChild(this.createElementDefaultNS("Name",s.name));style.appendChild(this.createElementDefaultNS("Title",s.title));if(s['abstract']){style.appendChild(this.createElementDefaultNS("Abstract",s['abstract']));}}  
node.appendChild(style);}}  
return node;},write_wmc_OnlineResource:function(href){var node=this.createElementDefaultNS("OnlineResource");this.setAttributeNS(node,this.namespaces.xlink,"xlink:type","simple");this.setAttributeNS(node,this.namespaces.xlink,"xlink:href",href);return node;},CLASS_NAME:"OpenLayers.Format.WMC.v1"});OpenLayers.Format.WMSCapabilities.v1_1=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1,{readers:{"wms":OpenLayers.Util.applyDefaults({"WMT_MS_Capabilities":function(node,obj){this.readChildNodes(node,obj);},"Keyword":function(node,obj){if(obj.keywords){obj.keywords.push(this.getChildValue(node));}},"DescribeLayer":function(node,obj){obj.describelayer={formats:[]};this.readChildNodes(node,obj.describelayer);},"GetLegendGraphic":function(node,obj){obj.getlegendgraphic={formats:[]};this.readChildNodes(node,obj.getlegendgraphic);},"GetStyles":function(node,obj){obj.getstyles={formats:[]};this.readChildNodes(node,obj.getstyles);},"PutStyles":function(node,obj){obj.putstyles={formats:[]};this.readChildNodes(node,obj.putstyles);},"UserDefinedSymbolization":function(node,obj){var userSymbols={supportSLD:parseInt(node.getAttribute("SupportSLD"))==1,userLayer:parseInt(node.getAttribute("UserLayer"))==1,userStyle:parseInt(node.getAttribute("UserStyle"))==1,remoteWFS:parseInt(node.getAttribute("RemoteWFS"))==1};obj.userSymbols=userSymbols;},"LatLonBoundingBox":function(node,obj){obj.llbbox=[parseFloat(node.getAttribute("minx")),parseFloat(node.getAttribute("miny")),parseFloat(node.getAttribute("maxx")),parseFloat(node.getAttribute("maxy"))];},"BoundingBox":function(node,obj){var bbox=OpenLayers.Format.WMSCapabilities.v1.prototype.readers["wms"].BoundingBox.apply(this,[node,obj]);bbox.srs=node.getAttribute("SRS");obj.bbox[bbox.srs]=bbox;},"ScaleHint":function(node,obj){var min=node.getAttribute("min");var max=node.getAttribute("max");var rad2=Math.pow(2,0.5);var ipm=OpenLayers.INCHES_PER_UNIT["m"];obj.maxScale=parseFloat(((min/rad2)*ipm*OpenLayers.DOTS_PER_INCH).toPrecision(13));obj.minScale=parseFloat(((max/rad2)*ipm*OpenLayers.DOTS_PER_INCH).toPrecision(13));},"Dimension":function(node,obj){var name=node.getAttribute("name").toLowerCase();var dim={name:name,units:node.getAttribute("units"),unitsymbol:node.getAttribute("unitSymbol")};obj.dimensions[dim.name]=dim;},"Extent":function(node,obj){var name=node.getAttribute("name").toLowerCase();if(name in obj["dimensions"]){var extent=obj.dimensions[name];extent.nearestVal=node.getAttribute("nearestValue")==="1";extent.multipleVal=node.getAttribute("multipleValues")==="1";extent.current=node.getAttribute("current")==="1";extent["default"]=node.getAttribute("default")||"";var values=this.getChildValue(node);extent.values=values.split(",");}}},OpenLayers.Format.WMSCapabilities.v1.prototype.readers["wms"])},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_1"});OpenLayers.Format.WMSCapabilities.v1_3=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1,{readers:{"wms":OpenLayers.Util.applyDefaults({"WMS_Capabilities":function(node,obj){this.readChildNodes(node,obj);},"LayerLimit":function(node,obj){obj.layerLimit=parseInt(this.getChildValue(node));},"MaxWidth":function(node,obj){obj.maxWidth=parseInt(this.getChildValue(node));},"MaxHeight":function(node,obj){obj.maxHeight=parseInt(this.getChildValue(node));},"BoundingBox":function(node,obj){var bbox=OpenLayers.Format.WMSCapabilities.v1.prototype.readers["wms"].BoundingBox.apply(this,[node,obj]);bbox.srs=node.getAttribute("CRS");obj.bbox[bbox.srs]=bbox;},"CRS":function(node,obj){this.readers.wms.SRS.apply(this,[node,obj]);},"EX_GeographicBoundingBox":function(node,obj){obj.llbbox=[];this.readChildNodes(node,obj.llbbox);},"westBoundLongitude":function(node,obj){obj[0]=this.getChildValue(node);},"eastBoundLongitude":function(node,obj){obj[2]=this.getChildValue(node);},"southBoundLatitude":function(node,obj){obj[1]=this.getChildValue(node);},"northBoundLatitude":function(node,obj){obj[3]=this.getChildValue(node);},"MinScaleDenominator":function(node,obj){obj.maxScale=parseFloat(this.getChildValue(node)).toPrecision(16);},"MaxScaleDenominator":function(node,obj){obj.minScale=parseFloat(this.getChildValue(node)).toPrecision(16);},"Dimension":function(node,obj){var name=node.getAttribute("name").toLowerCase();var dim={name:name,units:node.getAttribute("units"),unitsymbol:node.getAttribute("unitSymbol"),nearestVal:node.getAttribute("nearestValue")==="1",multipleVal:node.getAttribute("multipleValues")==="1","default":node.getAttribute("default")||"",current:node.getAttribute("current")==="1",values:this.getChildValue(node).split(",")};obj.dimensions[dim.name]=dim;},"Keyword":function(node,obj){var keyword={value:this.getChildValue(node),vocabulary:node.getAttribute("vocabulary")};if(obj.keywords){obj.keywords.push(keyword);}}},OpenLayers.Format.WMSCapabilities.v1.prototype.readers["wms"]),"sld":{"UserDefinedSymbolization":function(node,obj){this.readers.wms.UserDefinedSymbolization.apply(this,[node,obj]);obj.userSymbols.inlineFeature=parseInt(node.getAttribute("InlineFeature"))==1;obj.userSymbols.remoteWCS=parseInt(node.getAttribute("RemoteWCS"))==1;},"DescribeLayer":function(node,obj){this.readers.wms.DescribeLayer.apply(this,[node,obj]);},"GetLegendGraphic":function(node,obj){this.readers.wms.GetLegendGraphic.apply(this,[node,obj]);}}},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_3"});OpenLayers.Format.WMTSCapabilities.v1_0_0=OpenLayers.Class(OpenLayers.Format.OWSCommon.v1_1_0,{version:"1.0.0",namespaces:{ows:"http://www.opengis.net/ows/1.1",wmts:"http://www.opengis.net/wmts/1.0",xlink:"http://www.w3.org/1999/xlink"},yx:null,defaultPrefix:"wmts",initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);this.options=options;var yx=OpenLayers.Util.extend({},OpenLayers.Format.WMTSCapabilities.prototype.yx);this.yx=OpenLayers.Util.extend(yx,this.yx);},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
if(data&&data.nodeType==9){data=data.documentElement;}  
var capabilities={};this.readNode(data,capabilities);capabilities.version=this.version;return capabilities;},readers:{"wmts":{"Capabilities":function(node,obj){this.readChildNodes(node,obj);},"Contents":function(node,obj){obj.contents={};obj.contents.layers=[];obj.contents.tileMatrixSets={};this.readChildNodes(node,obj.contents);},"Layer":function(node,obj){var layer={styles:[],formats:[],tileMatrixSetLinks:[]};layer.layers=[];this.readChildNodes(node,layer);obj.layers.push(layer);},"Style":function(node,obj){var style={};style.isDefault=(node.getAttribute("isDefault")==="true");this.readChildNodes(node,style);obj.styles.push(style);},"Format":function(node,obj){obj.formats.push(this.getChildValue(node));},"TileMatrixSetLink":function(node,obj){var tileMatrixSetLink={};this.readChildNodes(node,tileMatrixSetLink);obj.tileMatrixSetLinks.push(tileMatrixSetLink);},"TileMatrixSet":function(node,obj){if(obj.layers){var tileMatrixSet={matrixIds:[]};this.readChildNodes(node,tileMatrixSet);obj.tileMatrixSets[tileMatrixSet.identifier]=tileMatrixSet;}else{obj.tileMatrixSet=this.getChildValue(node);}},"TileMatrix":function(node,obj){var tileMatrix={supportedCRS:obj.supportedCRS};this.readChildNodes(node,tileMatrix);obj.matrixIds.push(tileMatrix);},"ScaleDenominator":function(node,obj){obj.scaleDenominator=parseFloat(this.getChildValue(node));},"TopLeftCorner":function(node,obj){var topLeftCorner=this.getChildValue(node);var coords=topLeftCorner.split(" ");var yx;if(obj.supportedCRS){var crs=obj.supportedCRS.replace(/urn:ogc:def:crs:(\w+):.+:(\w+)$/,"urn:ogc:def:crs:$1::$2");yx=!!this.yx[crs];}  
if(yx){obj.topLeftCorner=new OpenLayers.LonLat(coords[1],coords[0]);}else{obj.topLeftCorner=new OpenLayers.LonLat(coords[0],coords[1]);}},"TileWidth":function(node,obj){obj.tileWidth=parseInt(this.getChildValue(node));},"TileHeight":function(node,obj){obj.tileHeight=parseInt(this.getChildValue(node));},"MatrixWidth":function(node,obj){obj.matrixWidth=parseInt(this.getChildValue(node));},"MatrixHeight":function(node,obj){obj.matrixHeight=parseInt(this.getChildValue(node));},"WSDL":function(node,obj){obj.wsdl={};obj.wsdl.href=node.getAttribute("xlink:href");},"ServiceMetadataURL":function(node,obj){obj.serviceMetadataUrl={};obj.serviceMetadataUrl.href=node.getAttribute("xlink:href");}},"ows":OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"]},CLASS_NAME:"OpenLayers.Format.WMTSCapabilities.v1_0_0"});OpenLayers.Layer.Boxes=OpenLayers.Class(OpenLayers.Layer.Markers,{initialize:function(name,options){OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments);},drawMarker:function(marker){var bounds=marker.bounds;var topleft=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(bounds.left,bounds.top));var botright=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(bounds.right,bounds.bottom));if(botright==null||topleft==null){marker.display(false);}else{var sz=new OpenLayers.Size(Math.max(1,botright.x-topleft.x),Math.max(1,botright.y-topleft.y));var markerDiv=marker.draw(topleft,sz);if(!marker.drawn){this.div.appendChild(markerDiv);marker.drawn=true;}}},removeMarker:function(marker){OpenLayers.Util.removeItem(this.markers,marker);if((marker.div!=null)&&(marker.div.parentNode==this.div)){this.div.removeChild(marker.div);}},CLASS_NAME:"OpenLayers.Layer.Boxes"});OpenLayers.Layer.GeoRSS=OpenLayers.Class(OpenLayers.Layer.Markers,{location:null,features:null,formatOptions:null,selectedFeature:null,icon:null,popupSize:null,useFeedTitle:true,initialize:function(name,location,options){OpenLayers.Layer.Markers.prototype.initialize.apply(this,[name,options]);this.location=location;this.features=[];},destroy:function(){OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments);this.clearFeatures();this.features=null;},loadRSS:function(){if(!this.loaded){this.events.triggerEvent("loadstart");OpenLayers.Request.GET({url:this.location,success:this.parseData,scope:this});this.loaded=true;}},moveTo:function(bounds,zoomChanged,minor){OpenLayers.Layer.Markers.prototype.moveTo.apply(this,arguments);if(this.visibility&&!this.loaded){this.loadRSS();}},parseData:function(ajaxRequest){var doc=ajaxRequest.responseXML;if(!doc||!doc.documentElement){doc=OpenLayers.Format.XML.prototype.read(ajaxRequest.responseText);}  
if(this.useFeedTitle){var name=null;try{name=doc.getElementsByTagNameNS('*','title')[0].firstChild.nodeValue;}  
catch(e){name=doc.getElementsByTagName('title')[0].firstChild.nodeValue;}  
if(name){this.setName(name);}}  
var options={};OpenLayers.Util.extend(options,this.formatOptions);if(this.map&&!this.projection.equals(this.map.getProjectionObject())){options.externalProjection=this.projection;options.internalProjection=this.map.getProjectionObject();}  
var format=new OpenLayers.Format.GeoRSS(options);var features=format.read(doc);for(var i=0,len=features.length;i<len;i++){var data={};var feature=features[i];if(!feature.geometry){continue;}  
var title=feature.attributes.title?feature.attributes.title:"Untitled";var description=feature.attributes.description?feature.attributes.description:"No description.";var link=feature.attributes.link?feature.attributes.link:"";var location=feature.geometry.getBounds().getCenterLonLat();data.icon=this.icon==null?OpenLayers.Marker.defaultIcon():this.icon.clone();data.popupSize=this.popupSize?this.popupSize.clone():new OpenLayers.Size(250,120);if(title||description){data.title=title;data.description=description;var contentHTML='<div class="olLayerGeoRSSClose">[x]</div>';contentHTML+='<div class="olLayerGeoRSSTitle">';if(link){contentHTML+='<a class="link" href="'+link+'" target="_blank">';}  
contentHTML+=title;if(link){contentHTML+='</a>';}  
contentHTML+='</div>';contentHTML+='<div style="" class="olLayerGeoRSSDescription">';contentHTML+=description;contentHTML+='</div>';data['popupContentHTML']=contentHTML;}  
var feature=new OpenLayers.Feature(this,location,data);this.features.push(feature);var marker=feature.createMarker();marker.events.register('click',feature,this.markerClick);this.addMarker(marker);}  
this.events.triggerEvent("loadend");},markerClick:function(evt){var sameMarkerClicked=(this==this.layer.selectedFeature);this.layer.selectedFeature=(!sameMarkerClicked)?this:null;for(var i=0,len=this.layer.map.popups.length;i<len;i++){this.layer.map.removePopup(this.layer.map.popups[i]);}  
if(!sameMarkerClicked){var popup=this.createPopup();OpenLayers.Event.observe(popup.div,"click",OpenLayers.Function.bind(function(){for(var i=0,len=this.layer.map.popups.length;i<len;i++){this.layer.map.removePopup(this.layer.map.popups[i]);}},this));this.layer.map.addPopup(popup);}  
OpenLayers.Event.stop(evt);},clearFeatures:function(){if(this.features!=null){while(this.features.length>0){var feature=this.features[0];OpenLayers.Util.removeItem(this.features,feature);feature.destroy();}}},CLASS_NAME:"OpenLayers.Layer.GeoRSS"});OpenLayers.Layer.Google=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:0,MAX_ZOOM_LEVEL:21,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.00002145767211914062,0.00001072883605957031,0.00000536441802978515,0.00000268220901489257,0.0000013411045074462891,0.00000067055225372314453],type:null,wrapDateLine:true,sphericalMercator:false,version:null,initialize:function(name,options){options=options||{};if(!options.version){options.version=typeof GMap2==="function"?"2":"3";}  
var mixin=OpenLayers.Layer.Google["v"+  
options.version.replace(/\./g,"_")];if(mixin){OpenLayers.Util.applyDefaults(options,mixin);}else{throw"Unsupported Google Maps API version: "+options.version;}  
OpenLayers.Util.applyDefaults(options,mixin.DEFAULTS);if(options.maxExtent){options.maxExtent=options.maxExtent.clone();}  
OpenLayers.Layer.EventPane.prototype.initialize.apply(this,[name,options]);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,[name,options]);if(this.sphericalMercator){OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator);this.initMercatorParameters();}},clone:function(){return new OpenLayers.Layer.Google(this.name,this.getOptions());},setVisibility:function(visible){var opacity=this.opacity==null?1:this.opacity;OpenLayers.Layer.EventPane.prototype.setVisibility.apply(this,arguments);this.setOpacity(opacity);},display:function(visible){if(!this._dragging){this.setGMapVisibility(visible);}  
OpenLayers.Layer.EventPane.prototype.display.apply(this,arguments);},moveTo:function(bounds,zoomChanged,dragging){this._dragging=dragging;OpenLayers.Layer.EventPane.prototype.moveTo.apply(this,arguments);delete this._dragging;},setOpacity:function(opacity){if(opacity!==this.opacity){if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"opacity"});}  
this.opacity=opacity;}  
if(this.getVisibility()){var container=this.getMapContainer();OpenLayers.Util.modifyDOMElement(container,null,null,null,null,null,null,opacity);}},destroy:function(){if(this.map){this.setGMapVisibility(false);var cache=OpenLayers.Layer.Google.cache[this.map.id];if(cache&&cache.count<=1){this.removeGMapElements();}}  
OpenLayers.Layer.EventPane.prototype.destroy.apply(this,arguments);},removeGMapElements:function(){var cache=OpenLayers.Layer.Google.cache[this.map.id];if(cache){var container=this.mapObject&&this.getMapContainer();if(container&&container.parentNode){container.parentNode.removeChild(container);}  
var termsOfUse=cache.termsOfUse;if(termsOfUse&&termsOfUse.parentNode){termsOfUse.parentNode.removeChild(termsOfUse);}  
var poweredBy=cache.poweredBy;if(poweredBy&&poweredBy.parentNode){poweredBy.parentNode.removeChild(poweredBy);}}},removeMap:function(map){if(this.visibility&&this.mapObject){this.setGMapVisibility(false);}  
var cache=OpenLayers.Layer.Google.cache[map.id];if(cache){if(cache.count<=1){this.removeGMapElements();delete OpenLayers.Layer.Google.cache[map.id];}else{--cache.count;}}  
delete this.termsOfUse;delete this.poweredBy;delete this.mapObject;delete this.dragObject;OpenLayers.Layer.EventPane.prototype.removeMap.apply(this,arguments);},getOLBoundsFromMapObjectBounds:function(moBounds){var olBounds=null;if(moBounds!=null){var sw=moBounds.getSouthWest();var ne=moBounds.getNorthEast();if(this.sphericalMercator){sw=this.forwardMercator(sw.lng(),sw.lat());ne=this.forwardMercator(ne.lng(),ne.lat());}else{sw=new OpenLayers.LonLat(sw.lng(),sw.lat());ne=new OpenLayers.LonLat(ne.lng(),ne.lat());}  
olBounds=new OpenLayers.Bounds(sw.lon,sw.lat,ne.lon,ne.lat);}  
return olBounds;},getWarningHTML:function(){return OpenLayers.i18n("googleWarning");},getMapObjectCenter:function(){return this.mapObject.getCenter();},getMapObjectZoom:function(){return this.mapObject.getZoom();},getLongitudeFromMapObjectLonLat:function(moLonLat){return this.sphericalMercator?this.forwardMercator(moLonLat.lng(),moLonLat.lat()).lon:moLonLat.lng();},getLatitudeFromMapObjectLonLat:function(moLonLat){var lat=this.sphericalMercator?this.forwardMercator(moLonLat.lng(),moLonLat.lat()).lat:moLonLat.lat();return lat;},getXFromMapObjectPixel:function(moPixel){return moPixel.x;},getYFromMapObjectPixel:function(moPixel){return moPixel.y;},CLASS_NAME:"OpenLayers.Layer.Google"});OpenLayers.Layer.Google.cache={};OpenLayers.Layer.Google.v2={termsOfUse:null,poweredBy:null,dragObject:null,loadMapObject:function(){if(!this.type){this.type=G_NORMAL_MAP;}  
var mapObject,termsOfUse,poweredBy;var cache=OpenLayers.Layer.Google.cache[this.map.id];if(cache){mapObject=cache.mapObject;termsOfUse=cache.termsOfUse;poweredBy=cache.poweredBy;++cache.count;}else{var container=this.map.viewPortDiv;var div=document.createElement("div");div.id=this.map.id+"_GMap2Container";div.style.position="absolute";div.style.width="100%";div.style.height="100%";container.appendChild(div);try{mapObject=new GMap2(div);termsOfUse=div.lastChild;container.appendChild(termsOfUse);termsOfUse.style.zIndex="1100";termsOfUse.style.right="";termsOfUse.style.bottom="";termsOfUse.className="olLayerGoogleCopyright";poweredBy=div.lastChild;container.appendChild(poweredBy);poweredBy.style.zIndex="1100";poweredBy.style.right="";poweredBy.style.bottom="";poweredBy.className="olLayerGooglePoweredBy gmnoprint";}catch(e){throw(e);}  
OpenLayers.Layer.Google.cache[this.map.id]={mapObject:mapObject,termsOfUse:termsOfUse,poweredBy:poweredBy,count:1};}  
this.mapObject=mapObject;this.termsOfUse=termsOfUse;this.poweredBy=poweredBy;if(OpenLayers.Util.indexOf(this.mapObject.getMapTypes(),this.type)===-1){this.mapObject.addMapType(this.type);}  
if(typeof mapObject.getDragObject=="function"){this.dragObject=mapObject.getDragObject();}else{this.dragPanMapObject=null;}  
if(this.isBaseLayer===false){this.setGMapVisibility(this.div.style.display!=="none");}},onMapResize:function(){if(this.visibility&&this.mapObject.isLoaded()){this.mapObject.checkResize();}else{if(!this._resized){var layer=this;var handle=GEvent.addListener(this.mapObject,"load",function(){GEvent.removeListener(handle);delete layer._resized;layer.mapObject.checkResize();layer.moveTo(layer.map.getCenter(),layer.map.getZoom());});}  
this._resized=true;}},setGMapVisibility:function(visible){var cache=OpenLayers.Layer.Google.cache[this.map.id];if(cache){var container=this.mapObject.getContainer();if(visible===true){this.mapObject.setMapType(this.type);container.style.display="";this.termsOfUse.style.left="";this.termsOfUse.style.display="";this.poweredBy.style.display="";cache.displayed=this.id;}else{if(cache.displayed===this.id){delete cache.displayed;}  
if(!cache.displayed){container.style.display="none";this.termsOfUse.style.display="none";this.termsOfUse.style.left="-9999px";this.poweredBy.style.display="none";}}}},getMapContainer:function(){return this.mapObject.getContainer();},getMapObjectBoundsFromOLBounds:function(olBounds){var moBounds=null;if(olBounds!=null){var sw=this.sphericalMercator?this.inverseMercator(olBounds.bottom,olBounds.left):new OpenLayers.LonLat(olBounds.bottom,olBounds.left);var ne=this.sphericalMercator?this.inverseMercator(olBounds.top,olBounds.right):new OpenLayers.LonLat(olBounds.top,olBounds.right);moBounds=new GLatLngBounds(new GLatLng(sw.lat,sw.lon),new GLatLng(ne.lat,ne.lon));}  
return moBounds;},setMapObjectCenter:function(center,zoom){this.mapObject.setCenter(center,zoom);},dragPanMapObject:function(dX,dY){this.dragObject.moveBy(new GSize(-dX,dY));},getMapObjectLonLatFromMapObjectPixel:function(moPixel){return this.mapObject.fromContainerPixelToLatLng(moPixel);},getMapObjectPixelFromMapObjectLonLat:function(moLonLat){return this.mapObject.fromLatLngToContainerPixel(moLonLat);},getMapObjectZoomFromMapObjectBounds:function(moBounds){return this.mapObject.getBoundsZoomLevel(moBounds);},getMapObjectLonLatFromLonLat:function(lon,lat){var gLatLng;if(this.sphericalMercator){var lonlat=this.inverseMercator(lon,lat);gLatLng=new GLatLng(lonlat.lat,lonlat.lon);}else{gLatLng=new GLatLng(lat,lon);}  
return gLatLng;},getMapObjectPixelFromXY:function(x,y){return new GPoint(x,y);}};OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,grid:null,singleTile:false,ratio:1.5,buffer:2,numLoadingTiles:0,initialize:function(name,url,params,options){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.events.addEventType("tileloaded");this.grid=[];},destroy:function(){this.clearGrid();this.grid=null;this.tileSize=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments);},clearGrid:function(){if(this.grid){for(var iRow=0,len=this.grid.length;iRow<len;iRow++){var row=this.grid[iRow];for(var iCol=0,clen=row.length;iCol<clen;iCol++){var tile=row[iCol];this.removeTileMonitoringHooks(tile);tile.destroy();}}  
this.grid=[];}},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.getOptions());}  
obj=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[obj]);if(this.tileSize!=null){obj.tileSize=this.tileSize.clone();}  
obj.grid=[];return obj;},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);bounds=bounds||this.map.getExtent();if(bounds!=null){var forceReTile=!this.grid.length||zoomChanged;var tilesBounds=this.getTilesBounds();if(this.singleTile){if(forceReTile||(!dragging&&!tilesBounds.containsBounds(bounds))){this.initSingleTile(bounds);}}else{if(forceReTile||!tilesBounds.containsBounds(bounds,true)){this.initGriddedTiles(bounds);}else{this.moveGriddedTiles(bounds);}}}},setTileSize:function(size){if(this.singleTile){size=this.map.getSize();size.h=parseInt(size.h*this.ratio);size.w=parseInt(size.w*this.ratio);}  
OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[size]);},getGridBounds:function(){var msg="The getGridBounds() function is deprecated. It will be "+"removed in 3.0. Please use getTilesBounds() instead.";OpenLayers.Console.warn(msg);return this.getTilesBounds();},getTilesBounds:function(){var bounds=null;if(this.grid.length){var bottom=this.grid.length-1;var bottomLeftTile=this.grid[bottom][0];var right=this.grid[0].length-1;var topRightTile=this.grid[0][right];bounds=new OpenLayers.Bounds(bottomLeftTile.bounds.left,bottomLeftTile.bounds.bottom,topRightTile.bounds.right,topRightTile.bounds.top);}  
return bounds;},initSingleTile:function(bounds){var center=bounds.getCenterLonLat();var tileWidth=bounds.getWidth()*this.ratio;var tileHeight=bounds.getHeight()*this.ratio;var tileBounds=new OpenLayers.Bounds(center.lon-(tileWidth/2),center.lat-(tileHeight/2),center.lon+(tileWidth/2),center.lat+(tileHeight/2));var ul=new OpenLayers.LonLat(tileBounds.left,tileBounds.top);var px=this.map.getLayerPxFromLonLat(ul);if(!this.grid.length){this.grid[0]=[];}  
var tile=this.grid[0][0];if(!tile){tile=this.addTile(tileBounds,px);this.addTileMonitoringHooks(tile);tile.draw();this.grid[0][0]=tile;}else{tile.moveTo(tileBounds,px);}  
this.removeExcessTiles(1,1);},calculateGridLayout:function(bounds,extent,resolution){var tilelon=resolution*this.tileSize.w;var tilelat=resolution*this.tileSize.h;var offsetlon=bounds.left-extent.left;var tilecol=Math.floor(offsetlon/tilelon)-this.buffer;var tilecolremain=offsetlon/tilelon-tilecol;var tileoffsetx=-tilecolremain*this.tileSize.w;var tileoffsetlon=extent.left+tilecol*tilelon;var offsetlat=bounds.top-(extent.bottom+tilelat);var tilerow=Math.ceil(offsetlat/tilelat)+this.buffer;var tilerowremain=tilerow-offsetlat/tilelat;var tileoffsety=-tilerowremain*this.tileSize.h;var tileoffsetlat=extent.bottom+tilerow*tilelat;return{tilelon:tilelon,tilelat:tilelat,tileoffsetlon:tileoffsetlon,tileoffsetlat:tileoffsetlat,tileoffsetx:tileoffsetx,tileoffsety:tileoffsety};},initGriddedTiles:function(bounds){var viewSize=this.map.getSize();var minRows=Math.ceil(viewSize.h/this.tileSize.h)+  
Math.max(1,2*this.buffer);var minCols=Math.ceil(viewSize.w/this.tileSize.w)+  
Math.max(1,2*this.buffer);var extent=this.getMaxExtent();var resolution=this.map.getResolution();var tileLayout=this.calculateGridLayout(bounds,extent,resolution);var tileoffsetx=Math.round(tileLayout.tileoffsetx);var tileoffsety=Math.round(tileLayout.tileoffsety);var tileoffsetlon=tileLayout.tileoffsetlon;var tileoffsetlat=tileLayout.tileoffsetlat;var tilelon=tileLayout.tilelon;var tilelat=tileLayout.tilelat;this.origin=new OpenLayers.Pixel(tileoffsetx,tileoffsety);var startX=tileoffsetx;var startLon=tileoffsetlon;var rowidx=0;var layerContainerDivLeft=parseInt(this.map.layerContainerDiv.style.left);var layerContainerDivTop=parseInt(this.map.layerContainerDiv.style.top);do{var row=this.grid[rowidx++];if(!row){row=[];this.grid.push(row);}  
tileoffsetlon=startLon;tileoffsetx=startX;var colidx=0;do{var tileBounds=new OpenLayers.Bounds(tileoffsetlon,tileoffsetlat,tileoffsetlon+tilelon,tileoffsetlat+tilelat);var x=tileoffsetx;x-=layerContainerDivLeft;var y=tileoffsety;y-=layerContainerDivTop;var px=new OpenLayers.Pixel(x,y);var tile=row[colidx++];if(!tile){tile=this.addTile(tileBounds,px);this.addTileMonitoringHooks(tile);row.push(tile);}else{tile.moveTo(tileBounds,px,false);}  
tileoffsetlon+=tilelon;tileoffsetx+=this.tileSize.w;}while((tileoffsetlon<=bounds.right+tilelon*this.buffer)||colidx<minCols);tileoffsetlat-=tilelat;tileoffsety+=this.tileSize.h;}while((tileoffsetlat>=bounds.bottom-tilelat*this.buffer)||rowidx<minRows);this.removeExcessTiles(rowidx,colidx);this.spiralTileLoad();},getMaxExtent:function(){return this.maxExtent;},spiralTileLoad:function(){var tileQueue=[];var directions=["right","down","left","up"];var iRow=0;var iCell=-1;var direction=OpenLayers.Util.indexOf(directions,"right");var directionsTried=0;while(directionsTried<directions.length){var testRow=iRow;var testCell=iCell;switch(directions[direction]){case"right":testCell++;break;case"down":testRow++;break;case"left":testCell--;break;case"up":testRow--;break;}  
var tile=null;if((testRow<this.grid.length)&&(testRow>=0)&&(testCell<this.grid[0].length)&&(testCell>=0)){tile=this.grid[testRow][testCell];}  
if((tile!=null)&&(!tile.queued)){tileQueue.unshift(tile);tile.queued=true;directionsTried=0;iRow=testRow;iCell=testCell;}else{direction=(direction+1)%4;directionsTried++;}}  
for(var i=0,len=tileQueue.length;i<len;i++){var tile=tileQueue[i];tile.draw();tile.queued=false;}},addTile:function(bounds,position){},addTileMonitoringHooks:function(tile){tile.onLoadStart=function(){if(this.numLoadingTiles==0){this.events.triggerEvent("loadstart");}  
this.numLoadingTiles++;};tile.events.register("loadstart",this,tile.onLoadStart);tile.onLoadEnd=function(){this.numLoadingTiles--;this.events.triggerEvent("tileloaded");if(this.numLoadingTiles==0){this.events.triggerEvent("loadend");}};tile.events.register("loadend",this,tile.onLoadEnd);tile.events.register("unload",this,tile.onLoadEnd);},removeTileMonitoringHooks:function(tile){tile.unload();tile.events.un({"loadstart":tile.onLoadStart,"loadend":tile.onLoadEnd,"unload":tile.onLoadEnd,scope:this});},moveGriddedTiles:function(bounds){var buffer=this.buffer||1;while(true){var tlLayer=this.grid[0][0].position;var tlViewPort=this.map.getViewPortPxFromLayerPx(tlLayer);if(tlViewPort.x>-this.tileSize.w*(buffer-1)){this.shiftColumn(true);}else if(tlViewPort.x<-this.tileSize.w*buffer){this.shiftColumn(false);}else if(tlViewPort.y>-this.tileSize.h*(buffer-1)){this.shiftRow(true);}else if(tlViewPort.y<-this.tileSize.h*buffer){this.shiftRow(false);}else{break;}};},shiftRow:function(prepend){var modelRowIndex=(prepend)?0:(this.grid.length-1);var grid=this.grid;var modelRow=grid[modelRowIndex];var resolution=this.map.getResolution();var deltaY=(prepend)?-this.tileSize.h:this.tileSize.h;var deltaLat=resolution*-deltaY;var row=(prepend)?grid.pop():grid.shift();for(var i=0,len=modelRow.length;i<len;i++){var modelTile=modelRow[i];var bounds=modelTile.bounds.clone();var position=modelTile.position.clone();bounds.bottom=bounds.bottom+deltaLat;bounds.top=bounds.top+deltaLat;position.y=position.y+deltaY;row[i].moveTo(bounds,position);}  
if(prepend){grid.unshift(row);}else{grid.push(row);}},shiftColumn:function(prepend){var deltaX=(prepend)?-this.tileSize.w:this.tileSize.w;var resolution=this.map.getResolution();var deltaLon=resolution*deltaX;for(var i=0,len=this.grid.length;i<len;i++){var row=this.grid[i];var modelTileIndex=(prepend)?0:(row.length-1);var modelTile=row[modelTileIndex];var bounds=modelTile.bounds.clone();var position=modelTile.position.clone();bounds.left=bounds.left+deltaLon;bounds.right=bounds.right+deltaLon;position.x=position.x+deltaX;var tile=prepend?this.grid[i].pop():this.grid[i].shift();tile.moveTo(bounds,position);if(prepend){row.unshift(tile);}else{row.push(tile);}}},removeExcessTiles:function(rows,columns){while(this.grid.length>rows){var row=this.grid.pop();for(var i=0,l=row.length;i<l;i++){var tile=row[i];this.removeTileMonitoringHooks(tile);tile.destroy();}}  
while(this.grid[0].length>columns){for(var i=0,l=this.grid.length;i<l;i++){var row=this.grid[i];var tile=row.pop();this.removeTileMonitoringHooks(tile);tile.destroy();}}},onMapResize:function(){if(this.singleTile){this.clearGrid();this.setTileSize();}},getTileBounds:function(viewPortPx){var maxExtent=this.maxExtent;var resolution=this.getResolution();var tileMapWidth=resolution*this.tileSize.w;var tileMapHeight=resolution*this.tileSize.h;var mapPoint=this.getLonLatFromViewPortPx(viewPortPx);var tileLeft=maxExtent.left+(tileMapWidth*Math.floor((mapPoint.lon-  
maxExtent.left)/tileMapWidth));var tileBottom=maxExtent.bottom+(tileMapHeight*Math.floor((mapPoint.lat-  
maxExtent.bottom)/tileMapHeight));return new OpenLayers.Bounds(tileLeft,tileBottom,tileLeft+tileMapWidth,tileBottom+tileMapHeight);},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Layer.MultiMap=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:1,MAX_ZOOM_LEVEL:17,RESOLUTIONS:[9,1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125],type:null,initialize:function(name,options){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);if(this.sphericalMercator){OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator);this.initMercatorParameters();this.RESOLUTIONS.unshift(10);}},loadMapObject:function(){try{this.mapObject=new MultimapViewer(this.div);}catch(e){}},getWarningHTML:function(){return OpenLayers.i18n("getLayerWarning",{'layerType':"MM",'layerLib':"MultiMap"});},setMapObjectCenter:function(center,zoom){this.mapObject.goToPosition(center,zoom);},getMapObjectCenter:function(){return this.mapObject.getCurrentPosition();},getMapObjectZoom:function(){return this.mapObject.getZoomFactor();},getMapObjectLonLatFromMapObjectPixel:function(moPixel){moPixel.x=moPixel.x-(this.map.getSize().w/2);moPixel.y=moPixel.y-(this.map.getSize().h/2);return this.mapObject.getMapPositionAt(moPixel);},getMapObjectPixelFromMapObjectLonLat:function(moLonLat){return this.mapObject.geoPosToContainerPixels(moLonLat);},getLongitudeFromMapObjectLonLat:function(moLonLat){return this.sphericalMercator?this.forwardMercator(moLonLat.lon,moLonLat.lat).lon:moLonLat.lon;},getLatitudeFromMapObjectLonLat:function(moLonLat){return this.sphericalMercator?this.forwardMercator(moLonLat.lon,moLonLat.lat).lat:moLonLat.lat;},getMapObjectLonLatFromLonLat:function(lon,lat){var mmLatLon;if(this.sphericalMercator){var lonlat=this.inverseMercator(lon,lat);mmLatLon=new MMLatLon(lonlat.lat,lonlat.lon);}else{mmLatLon=new MMLatLon(lat,lon);}  
return mmLatLon;},getXFromMapObjectPixel:function(moPixel){return moPixel.x;},getYFromMapObjectPixel:function(moPixel){return moPixel.y;},getMapObjectPixelFromXY:function(x,y){return new MMPoint(x,y);},CLASS_NAME:"OpenLayers.Layer.MultiMap"});OpenLayers.Layer.VirtualEarth=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:1,MAX_ZOOM_LEVEL:19,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.00002145767211914062,0.00001072883605957031,0.00000536441802978515],type:null,wrapDateLine:true,sphericalMercator:false,animationEnabled:true,initialize:function(name,options){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);if(this.sphericalMercator){OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator);this.initMercatorParameters();}},loadMapObject:function(){var veDiv=OpenLayers.Util.createDiv(this.name);var sz=this.map.getSize();veDiv.style.width=sz.w+"px";veDiv.style.height=sz.h+"px";this.div.appendChild(veDiv);try{this.mapObject=new VEMap(this.name);}catch(e){}  
if(this.mapObject!=null){try{this.mapObject.LoadMap(null,null,this.type,true);this.mapObject.AttachEvent("onmousedown",OpenLayers.Function.True);}catch(e){}  
this.mapObject.HideDashboard();if(typeof this.mapObject.SetAnimationEnabled=="function"){this.mapObject.SetAnimationEnabled(this.animationEnabled);}}  
if(!this.mapObject||!this.mapObject.vemapcontrol||!this.mapObject.vemapcontrol.PanMap||(typeof this.mapObject.vemapcontrol.PanMap!="function")){this.dragPanMapObject=null;}},onMapResize:function(){this.mapObject.Resize(this.map.size.w,this.map.size.h);},getWarningHTML:function(){return OpenLayers.i18n("getLayerWarning",{'layerType':'VE','layerLib':'VirtualEarth'});},setMapObjectCenter:function(center,zoom){this.mapObject.SetCenterAndZoom(center,zoom);},getMapObjectCenter:function(){return this.mapObject.GetCenter();},dragPanMapObject:function(dX,dY){this.mapObject.vemapcontrol.PanMap(dX,-dY);},getMapObjectZoom:function(){return this.mapObject.GetZoomLevel();},getMapObjectLonLatFromMapObjectPixel:function(moPixel){return(typeof VEPixel!='undefined')?this.mapObject.PixelToLatLong(moPixel):this.mapObject.PixelToLatLong(moPixel.x,moPixel.y);},getMapObjectPixelFromMapObjectLonLat:function(moLonLat){return this.mapObject.LatLongToPixel(moLonLat);},getLongitudeFromMapObjectLonLat:function(moLonLat){return this.sphericalMercator?this.forwardMercator(moLonLat.Longitude,moLonLat.Latitude).lon:moLonLat.Longitude;},getLatitudeFromMapObjectLonLat:function(moLonLat){return this.sphericalMercator?this.forwardMercator(moLonLat.Longitude,moLonLat.Latitude).lat:moLonLat.Latitude;},getMapObjectLonLatFromLonLat:function(lon,lat){var veLatLong;if(this.sphericalMercator){var lonlat=this.inverseMercator(lon,lat);veLatLong=new VELatLong(lonlat.lat,lonlat.lon);}else{veLatLong=new VELatLong(lat,lon);}  
return veLatLong;},getXFromMapObjectPixel:function(moPixel){return moPixel.x;},getYFromMapObjectPixel:function(moPixel){return moPixel.y;},getMapObjectPixelFromXY:function(x,y){return(typeof VEPixel!='undefined')?new VEPixel(x,y):new Msn.VE.Pixel(x,y);},CLASS_NAME:"OpenLayers.Layer.VirtualEarth"});OpenLayers.Layer.Yahoo=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:0,MAX_ZOOM_LEVEL:17,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.00002145767211914062,0.00001072883605957031],type:null,wrapDateLine:true,sphericalMercator:false,initialize:function(name,options){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);if(this.sphericalMercator){OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator);this.initMercatorParameters();}},loadMapObject:function(){try{var size=this.getMapObjectSizeFromOLSize(this.map.getSize());this.mapObject=new YMap(this.div,this.type,size);this.mapObject.disableKeyControls();this.mapObject.disableDragMap();if(!this.mapObject.moveByXY||(typeof this.mapObject.moveByXY!="function")){this.dragPanMapObject=null;}}catch(e){}},onMapResize:function(){try{var size=this.getMapObjectSizeFromOLSize(this.map.getSize());this.mapObject.resizeTo(size);}catch(e){}},setMap:function(map){OpenLayers.Layer.EventPane.prototype.setMap.apply(this,arguments);this.map.events.register("moveend",this,this.fixYahooEventPane);},fixYahooEventPane:function(){var yahooEventPane=OpenLayers.Util.getElement("ygddfdiv");if(yahooEventPane!=null){if(yahooEventPane.parentNode!=null){yahooEventPane.parentNode.removeChild(yahooEventPane);}  
this.map.events.unregister("moveend",this,this.fixYahooEventPane);}},getWarningHTML:function(){return OpenLayers.i18n("getLayerWarning",{'layerType':'Yahoo','layerLib':'Yahoo'});},getOLZoomFromMapObjectZoom:function(moZoom){var zoom=null;if(moZoom!=null){zoom=OpenLayers.Layer.FixedZoomLevels.prototype.getOLZoomFromMapObjectZoom.apply(this,[moZoom]);zoom=18-zoom;}  
return zoom;},getMapObjectZoomFromOLZoom:function(olZoom){var zoom=null;if(olZoom!=null){zoom=OpenLayers.Layer.FixedZoomLevels.prototype.getMapObjectZoomFromOLZoom.apply(this,[olZoom]);zoom=18-zoom;}  
return zoom;},setMapObjectCenter:function(center,zoom){this.mapObject.drawZoomAndCenter(center,zoom);},getMapObjectCenter:function(){return this.mapObject.getCenterLatLon();},dragPanMapObject:function(dX,dY){this.mapObject.moveByXY({'x':-dX,'y':dY});},getMapObjectZoom:function(){return this.mapObject.getZoomLevel();},getMapObjectLonLatFromMapObjectPixel:function(moPixel){return this.mapObject.convertXYLatLon(moPixel);},getMapObjectPixelFromMapObjectLonLat:function(moLonLat){return this.mapObject.convertLatLonXY(moLonLat);},getLongitudeFromMapObjectLonLat:function(moLonLat){return this.sphericalMercator?this.forwardMercator(moLonLat.Lon,moLonLat.Lat).lon:moLonLat.Lon;},getLatitudeFromMapObjectLonLat:function(moLonLat){return this.sphericalMercator?this.forwardMercator(moLonLat.Lon,moLonLat.Lat).lat:moLonLat.Lat;},getMapObjectLonLatFromLonLat:function(lon,lat){var yLatLong;if(this.sphericalMercator){var lonlat=this.inverseMercator(lon,lat);yLatLong=new YGeoPoint(lonlat.lat,lonlat.lon);}else{yLatLong=new YGeoPoint(lat,lon);}  
return yLatLong;},getXFromMapObjectPixel:function(moPixel){return moPixel.x;},getYFromMapObjectPixel:function(moPixel){return moPixel.y;},getMapObjectPixelFromXY:function(x,y){return new YCoordPoint(x,y);},getMapObjectSizeFromOLSize:function(olSize){return new YSize(olSize.w,olSize.h);},CLASS_NAME:"OpenLayers.Layer.Yahoo"});OpenLayers.Style=OpenLayers.Class({id:null,name:null,title:null,description:null,layerName:null,isDefault:false,rules:null,context:null,defaultStyle:null,defaultsPerSymbolizer:false,propertyStyles:null,initialize:function(style,options){OpenLayers.Util.extend(this,options);this.rules=[];if(options&&options.rules){this.addRules(options.rules);}  
this.setDefaultStyle(style||OpenLayers.Feature.Vector.style["default"]);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){for(var i=0,len=this.rules.length;i<len;i++){this.rules[i].destroy();this.rules[i]=null;}  
this.rules=null;this.defaultStyle=null;},createSymbolizer:function(feature){var style=this.defaultsPerSymbolizer?{}:this.createLiterals(OpenLayers.Util.extend({},this.defaultStyle),feature);var rules=this.rules;var rule,context;var elseRules=[];var appliedRules=false;for(var i=0,len=rules.length;i<len;i++){rule=rules[i];var applies=rule.evaluate(feature);if(applies){if(rule instanceof OpenLayers.Rule&&rule.elseFilter){elseRules.push(rule);}else{appliedRules=true;this.applySymbolizer(rule,style,feature);}}}  
if(appliedRules==false&&elseRules.length>0){appliedRules=true;for(var i=0,len=elseRules.length;i<len;i++){this.applySymbolizer(elseRules[i],style,feature);}}  
if(rules.length>0&&appliedRules==false){style.display="none";}  
return style;},applySymbolizer:function(rule,style,feature){var symbolizerPrefix=feature.geometry?this.getSymbolizerPrefix(feature.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0];var symbolizer=rule.symbolizer[symbolizerPrefix]||rule.symbolizer;if(this.defaultsPerSymbolizer===true){var defaults=this.defaultStyle;OpenLayers.Util.applyDefaults(symbolizer,{pointRadius:defaults.pointRadius});if(symbolizer.stroke===true||symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{strokeWidth:defaults.strokeWidth,strokeColor:defaults.strokeColor,strokeOpacity:defaults.strokeOpacity,strokeDashstyle:defaults.strokeDashstyle,strokeLinecap:defaults.strokeLinecap});}  
if(symbolizer.fill===true||symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{fillColor:defaults.fillColor,fillOpacity:defaults.fillOpacity});}  
if(symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{pointRadius:this.defaultStyle.pointRadius,externalGraphic:this.defaultStyle.externalGraphic,graphicName:this.defaultStyle.graphicName,graphicOpacity:this.defaultStyle.graphicOpacity,graphicWidth:this.defaultStyle.graphicWidth,graphicHeight:this.defaultStyle.graphicHeight,graphicXOffset:this.defaultStyle.graphicXOffset,graphicYOffset:this.defaultStyle.graphicYOffset});}}  
return this.createLiterals(OpenLayers.Util.extend(style,symbolizer),feature);},createLiterals:function(style,feature){var context=OpenLayers.Util.extend({},feature.attributes||feature.data);OpenLayers.Util.extend(context,this.context);for(var i in this.propertyStyles){style[i]=OpenLayers.Style.createLiteral(style[i],context,feature,i);}  
return style;},findPropertyStyles:function(){var propertyStyles={};var style=this.defaultStyle;this.addPropertyStyles(propertyStyles,style);var rules=this.rules;var symbolizer,value;for(var i=0,len=rules.length;i<len;i++){symbolizer=rules[i].symbolizer;for(var key in symbolizer){value=symbolizer[key];if(typeof value=="object"){this.addPropertyStyles(propertyStyles,value);}else{this.addPropertyStyles(propertyStyles,symbolizer);break;}}}  
return propertyStyles;},addPropertyStyles:function(propertyStyles,symbolizer){var property;for(var key in symbolizer){property=symbolizer[key];if(typeof property=="string"&&property.match(/\$\{\w+\}/)){propertyStyles[key]=true;}}  
return propertyStyles;},addRules:function(rules){Array.prototype.push.apply(this.rules,rules);this.propertyStyles=this.findPropertyStyles();},setDefaultStyle:function(style){this.defaultStyle=style;this.propertyStyles=this.findPropertyStyles();},getSymbolizerPrefix:function(geometry){var prefixes=OpenLayers.Style.SYMBOLIZER_PREFIXES;for(var i=0,len=prefixes.length;i<len;i++){if(geometry.CLASS_NAME.indexOf(prefixes[i])!=-1){return prefixes[i];}}},clone:function(){var options=OpenLayers.Util.extend({},this);if(this.rules){options.rules=[];for(var i=0,len=this.rules.length;i<len;++i){options.rules.push(this.rules[i].clone());}}  
options.context=this.context&&OpenLayers.Util.extend({},this.context);var defaultStyle=OpenLayers.Util.extend({},this.defaultStyle);return new OpenLayers.Style(defaultStyle,options);},CLASS_NAME:"OpenLayers.Style"});OpenLayers.Style.createLiteral=function(value,context,feature,property){if(typeof value=="string"&&value.indexOf("${")!=-1){value=OpenLayers.String.format(value,context,[feature,property]);value=(isNaN(value)||!value)?value:parseFloat(value);}  
return value;};OpenLayers.Style.SYMBOLIZER_PREFIXES=['Point','Line','Polygon','Text','Raster'];OpenLayers.Control.Navigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,documentDrag:false,zoomBox:null,zoomBoxEnabled:true,zoomWheelEnabled:true,mouseWheelOptions:null,handleRightClicks:false,zoomBoxKeyMask:OpenLayers.Handler.MOD_SHIFT,autoActivate:true,initialize:function(options){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments);},destroy:function(){this.deactivate();if(this.dragPan){this.dragPan.destroy();}  
this.dragPan=null;if(this.zoomBox){this.zoomBox.destroy();}  
this.zoomBox=null;OpenLayers.Control.prototype.destroy.apply(this,arguments);},activate:function(){this.dragPan.activate();if(this.zoomWheelEnabled){this.handlers.wheel.activate();}  
this.handlers.click.activate();if(this.zoomBoxEnabled){this.zoomBox.activate();}  
return OpenLayers.Control.prototype.activate.apply(this,arguments);},deactivate:function(){this.zoomBox.deactivate();this.dragPan.deactivate();this.handlers.click.deactivate();this.handlers.wheel.deactivate();return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},draw:function(){if(this.handleRightClicks){this.map.viewPortDiv.oncontextmenu=OpenLayers.Function.False;}  
var clickCallbacks={'dblclick':this.defaultDblClick,'dblrightclick':this.defaultDblRightClick};var clickOptions={'double':true,'stopDouble':true};this.handlers.click=new OpenLayers.Handler.Click(this,clickCallbacks,clickOptions);this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map,documentDrag:this.documentDrag},this.dragPanOptions));this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:this.zoomBoxKeyMask});this.dragPan.draw();this.zoomBox.draw();this.handlers.wheel=new OpenLayers.Handler.MouseWheel(this,{"up":this.wheelUp,"down":this.wheelDown},this.mouseWheelOptions);},defaultDblClick:function(evt){var newCenter=this.map.getLonLatFromViewPortPx(evt.xy);this.map.setCenter(newCenter,this.map.zoom+1);},defaultDblRightClick:function(evt){var newCenter=this.map.getLonLatFromViewPortPx(evt.xy);this.map.setCenter(newCenter,this.map.zoom-1);},wheelChange:function(evt,deltaZ){var currentZoom=this.map.getZoom();var newZoom=this.map.getZoom()+Math.round(deltaZ);newZoom=Math.max(newZoom,0);newZoom=Math.min(newZoom,this.map.getNumZoomLevels());if(newZoom===currentZoom){return;}  
var size=this.map.getSize();var deltaX=size.w/2-evt.xy.x;var deltaY=evt.xy.y-size.h/2;var newRes=this.map.baseLayer.getResolutionForZoom(newZoom);var zoomPoint=this.map.getLonLatFromPixel(evt.xy);var newCenter=new OpenLayers.LonLat(zoomPoint.lon+deltaX*newRes,zoomPoint.lat+deltaY*newRes);this.map.setCenter(newCenter,newZoom);},wheelUp:function(evt,delta){this.wheelChange(evt,delta||1);},wheelDown:function(evt,delta){this.wheelChange(evt,delta||-1);},disableZoomBox:function(){this.zoomBoxEnabled=false;this.zoomBox.deactivate();},enableZoomBox:function(){this.zoomBoxEnabled=true;if(this.active){this.zoomBox.activate();}},disableZoomWheel:function(){this.zoomWheelEnabled=false;this.handlers.wheel.deactivate();},enableZoomWheel:function(){this.zoomWheelEnabled=true;if(this.active){this.handlers.wheel.activate();}},CLASS_NAME:"OpenLayers.Control.Navigation"});OpenLayers.Filter=OpenLayers.Class({initialize:function(options){OpenLayers.Util.extend(this,options);},destroy:function(){},evaluate:function(context){return true;},clone:function(){return null;},CLASS_NAME:"OpenLayers.Filter"});OpenLayers.Format.WMC.v1_0_0=OpenLayers.Class(OpenLayers.Format.WMC.v1,{VERSION:"1.0.0",schemaLocation:"http://www.opengis.net/context http://schemas.opengis.net/context/1.0.0/context.xsd",initialize:function(options){OpenLayers.Format.WMC.v1.prototype.initialize.apply(this,[options]);},write_wmc_Layer:function(context){var node=OpenLayers.Format.WMC.v1.prototype.write_wmc_Layer.apply(this,[context]);node.appendChild(this.write_wmc_FormatList(context));node.appendChild(this.write_wmc_StyleList(context));node.appendChild(this.write_wmc_LayerExtension(context));},CLASS_NAME:"OpenLayers.Format.WMC.v1_0_0"});OpenLayers.Format.WMC.v1_1_0=OpenLayers.Class(OpenLayers.Format.WMC.v1,{VERSION:"1.1.0",schemaLocation:"http://www.opengis.net/context http://schemas.opengis.net/context/1.1.0/context.xsd",initialize:function(options){OpenLayers.Format.WMC.v1.prototype.initialize.apply(this,[options]);},read_sld_MinScaleDenominator:function(layerContext,node){var minScaleDenominator=parseFloat(this.getChildValue(node));if(minScaleDenominator>0){layerContext.maxScale=minScaleDenominator;}},read_sld_MaxScaleDenominator:function(layerContext,node){layerContext.minScale=parseFloat(this.getChildValue(node));},write_wmc_Layer:function(context){var node=OpenLayers.Format.WMC.v1.prototype.write_wmc_Layer.apply(this,[context]);if(context.maxScale){var minSD=this.createElementNS(this.namespaces.sld,"sld:MinScaleDenominator");minSD.appendChild(this.createTextNode(context.maxScale.toPrecision(16)));node.appendChild(minSD);}  
if(context.minScale){var maxSD=this.createElementNS(this.namespaces.sld,"sld:MaxScaleDenominator");maxSD.appendChild(this.createTextNode(context.minScale.toPrecision(16)));node.appendChild(maxSD);}  
node.appendChild(this.write_wmc_FormatList(context));node.appendChild(this.write_wmc_StyleList(context));node.appendChild(this.write_wmc_LayerExtension(context));return node;},CLASS_NAME:"OpenLayers.Format.WMC.v1_1_0"});OpenLayers.Format.WMSCapabilities.v1_1_0=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1_1,{version:"1.1.0",initialize:function(options){OpenLayers.Format.WMSCapabilities.v1_1.prototype.initialize.apply(this,[options]);},readers:{"wms":OpenLayers.Util.applyDefaults({"SRS":function(node,obj){var srs=this.getChildValue(node);var values=srs.split(/ +/);for(var i=0,len=values.length;i<len;i++){obj.srs[values[i]]=true;}}},OpenLayers.Format.WMSCapabilities.v1_1.prototype.readers["wms"])},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_1_0"});OpenLayers.Format.WMSCapabilities.v1_1_1=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1_1,{version:"1.1.1",initialize:function(options){OpenLayers.Format.WMSCapabilities.v1_1.prototype.initialize.apply(this,[options]);},readers:{"wms":OpenLayers.Util.applyDefaults({"SRS":function(node,obj){obj.srs[this.getChildValue(node)]=true;}},OpenLayers.Format.WMSCapabilities.v1_1.prototype.readers["wms"])},CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_1_1"});OpenLayers.Format.WMSCapabilities.v1_3_0=OpenLayers.Class(OpenLayers.Format.WMSCapabilities.v1_3,{version:"1.3.0",CLASS_NAME:"OpenLayers.Format.WMSCapabilities.v1_3_0"});OpenLayers.Geometry=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){this.id=null;this.bounds=null;},clone:function(){return new OpenLayers.Geometry();},setBounds:function(bounds){if(bounds){this.bounds=bounds.clone();}},clearBounds:function(){this.bounds=null;if(this.parent){this.parent.clearBounds();}},extendBounds:function(newBounds){var bounds=this.getBounds();if(!bounds){this.setBounds(newBounds);}else{this.bounds.extend(newBounds);}},getBounds:function(){if(this.bounds==null){this.calculateBounds();}  
return this.bounds;},calculateBounds:function(){},distanceTo:function(geometry,options){},getVertices:function(nodes){},atPoint:function(lonlat,toleranceLon,toleranceLat){var atPoint=false;var bounds=this.getBounds();if((bounds!=null)&&(lonlat!=null)){var dX=(toleranceLon!=null)?toleranceLon:0;var dY=(toleranceLat!=null)?toleranceLat:0;var toleranceBounds=new OpenLayers.Bounds(this.bounds.left-dX,this.bounds.bottom-dY,this.bounds.right+dX,this.bounds.top+dY);atPoint=toleranceBounds.containsLonLat(lonlat);}  
return atPoint;},getLength:function(){return 0.0;},getArea:function(){return 0.0;},getCentroid:function(){return null;},toString:function(){return OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this));},CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(wkt){var format=arguments.callee.format;if(!format){format=new OpenLayers.Format.WKT();arguments.callee.format=format;}  
var geom;var result=format.read(wkt);if(result instanceof OpenLayers.Feature.Vector){geom=result.geometry;}else if(result instanceof Array){var len=result.length;var components=new Array(len);for(var i=0;i<len;++i){components[i]=result[i].geometry;}  
geom=new OpenLayers.Geometry.Collection(components);}  
return geom;};OpenLayers.Geometry.segmentsIntersect=function(seg1,seg2,options){var point=options&&options.point;var tolerance=options&&options.tolerance;var intersection=false;var x11_21=seg1.x1-seg2.x1;var y11_21=seg1.y1-seg2.y1;var x12_11=seg1.x2-seg1.x1;var y12_11=seg1.y2-seg1.y1;var y22_21=seg2.y2-seg2.y1;var x22_21=seg2.x2-seg2.x1;var d=(y22_21*x12_11)-(x22_21*y12_11);var n1=(x22_21*y11_21)-(y22_21*x11_21);var n2=(x12_11*y11_21)-(y12_11*x11_21);if(d==0){if(n1==0&&n2==0){intersection=true;}}else{var along1=n1/d;var along2=n2/d;if(along1>=0&&along1<=1&&along2>=0&&along2<=1){if(!point){intersection=true;}else{var x=seg1.x1+(along1*x12_11);var y=seg1.y1+(along1*y12_11);intersection=new OpenLayers.Geometry.Point(x,y);}}}  
if(tolerance){var dist;if(intersection){if(point){var segs=[seg1,seg2];var seg,x,y;outer:for(var i=0;i<2;++i){seg=segs[i];for(var j=1;j<3;++j){x=seg["x"+j];y=seg["y"+j];dist=Math.sqrt(Math.pow(x-intersection.x,2)+  
Math.pow(y-intersection.y,2));if(dist<tolerance){intersection.x=x;intersection.y=y;break outer;}}}}}else{var segs=[seg1,seg2];var source,target,x,y,p,result;outer:for(var i=0;i<2;++i){source=segs[i];target=segs[(i+1)%2];for(var j=1;j<3;++j){p={x:source["x"+j],y:source["y"+j]};result=OpenLayers.Geometry.distanceToSegment(p,target);if(result.distance<tolerance){if(point){intersection=new OpenLayers.Geometry.Point(p.x,p.y);}else{intersection=true;}  
break outer;}}}}}  
return intersection;};OpenLayers.Geometry.distanceToSegment=function(point,segment){var x0=point.x;var y0=point.y;var x1=segment.x1;var y1=segment.y1;var x2=segment.x2;var y2=segment.y2;var dx=x2-x1;var dy=y2-y1;var along=((dx*(x0-x1))+(dy*(y0-y1)))/(Math.pow(dx,2)+Math.pow(dy,2));var x,y;if(along<=0.0){x=x1;y=y1;}else if(along>=1.0){x=x2;y=y2;}else{x=x1+along*dx;y=y1+along*dy;}  
return{distance:Math.sqrt(Math.pow(x-x0,2)+Math.pow(y-y0,2)),x:x,y:y};};OpenLayers.Layer.ArcGIS93Rest=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{format:"png"},isBaseLayer:true,initialize:function(name,url,params,options){var newArguments=[];params=OpenLayers.Util.upperCaseObject(params);newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if(this.params.TRANSPARENT&&this.params.TRANSPARENT.toString().toLowerCase()=="true"){if((options==null)||(!options.isBaseLayer)){this.isBaseLayer=false;}  
if(this.params.FORMAT=="jpg"){this.params.FORMAT=OpenLayers.Util.alphaHack()?"gif":"png";}}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.ArcGIS93Rest(this.name,this.url,this.params,this.getOptions());}  
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){bounds=this.adjustBounds(bounds);var projWords=this.projection.getCode().split(":");var srid=projWords[projWords.length-1];var imageSize=this.getImageSize();var newParams={'BBOX':bounds.toBBOX(),'SIZE':imageSize.w+","+imageSize.h,'F':"image",'BBOXSR':srid,'IMAGESR':srid};if(this.layerDefs){var layerDefStrList=[];var layerID;for(layerID in this.layerDefs){if(this.layerDefs.hasOwnProperty(layerID)){if(this.layerDefs[layerID]){layerDefStrList.push(layerID);layerDefStrList.push(":");layerDefStrList.push(this.layerDefs[layerID]);layerDefStrList.push(";");}}}  
if(layerDefStrList.length>0){newParams['LAYERDEFS']=layerDefStrList.join("");}}  
var requestString=this.getFullRequestString(newParams);return requestString;},setLayerFilter:function(id,queryDef){if(!this.layerDefs){this.layerDefs={};}  
if(queryDef){this.layerDefs[id]=queryDef;}else{delete this.layerDefs[id];}},clearLayerFilter:function(id){if(id){delete this.layerDefs[id];}else{delete this.layerDefs;}},mergeNewParams:function(newParams){var upperParams=OpenLayers.Util.upperCaseObject(newParams);var newArguments=[upperParams];return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,newArguments);},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},CLASS_NAME:"OpenLayers.Layer.ArcGIS93Rest"});OpenLayers.Layer.Google.v3={DEFAULTS:{maxExtent:new OpenLayers.Bounds(-128*156543.0339,-128*156543.0339,128*156543.0339,128*156543.0339),sphericalMercator:true,maxResolution:156543.0339,units:"m",projection:"EPSG:900913"},loadMapObject:function(){if(!this.type){this.type=google.maps.MapTypeId.ROADMAP;}  
var mapObject;var cache=OpenLayers.Layer.Google.cache[this.map.id];if(cache){mapObject=cache.mapObject;++cache.count;}else{var container=this.map.viewPortDiv;var div=document.createElement("div");div.id=this.map.id+"_GMapContainer";div.style.position="absolute";div.style.width="100%";div.style.height="100%";container.appendChild(div);var center=this.map.getCenter();mapObject=new google.maps.Map(div,{center:center?new google.maps.LatLng(center.lat,center.lon):new google.maps.LatLng(0,0),zoom:this.map.getZoom()||0,mapTypeId:this.type,disableDefaultUI:true,keyboardShortcuts:false,draggable:false,disableDoubleClickZoom:true,scrollwheel:false});cache={mapObject:mapObject,count:1};OpenLayers.Layer.Google.cache[this.map.id]=cache;this.repositionListener=google.maps.event.addListenerOnce(mapObject,"center_changed",OpenLayers.Function.bind(this.repositionMapElements,this));}  
this.mapObject=mapObject;this.setGMapVisibility(this.visibility);},repositionMapElements:function(){google.maps.event.trigger(this.mapObject,"resize");var div=this.mapObject.getDiv().firstChild;if(!div||div.childNodes.length<3){this.repositionTimer=window.setTimeout(OpenLayers.Function.bind(this.repositionMapElements,this),250);return false;}  
var cache=OpenLayers.Layer.Google.cache[this.map.id];var container=this.map.viewPortDiv;var termsOfUse=div.lastChild;container.appendChild(termsOfUse);termsOfUse.style.zIndex="1100";termsOfUse.style.bottom="";termsOfUse.className="olLayerGoogleCopyright olLayerGoogleV3";termsOfUse.style.display="";cache.termsOfUse=termsOfUse;var poweredBy=div.lastChild;container.appendChild(poweredBy);poweredBy.style.zIndex="1100";poweredBy.style.bottom="";poweredBy.className="olLayerGooglePoweredBy olLayerGoogleV3 gmnoprint";poweredBy.style.display="";cache.poweredBy=poweredBy;this.setGMapVisibility(this.visibility);},onMapResize:function(){if(this.visibility){google.maps.event.trigger(this.mapObject,"resize");}else{if(!this._resized){var layer=this;google.maps.event.addListenerOnce(this.mapObject,"tilesloaded",function(){delete layer._resized;google.maps.event.trigger(layer.mapObject,"resize");layer.moveTo(layer.map.getCenter(),layer.map.getZoom());});}  
this._resized=true;}},setGMapVisibility:function(visible){var cache=OpenLayers.Layer.Google.cache[this.map.id];if(cache){var type=this.type;var layers=this.map.layers;var layer;for(var i=layers.length-1;i>=0;--i){layer=layers[i];if(layer instanceof OpenLayers.Layer.Google&&layer.visibility===true&&layer.inRange===true){type=layer.type;visible=true;break;}}  
var container=this.mapObject.getDiv();if(visible===true){this.mapObject.setMapTypeId(type);container.style.left="";if(cache.termsOfUse&&cache.termsOfUse.style){cache.termsOfUse.style.left="";cache.termsOfUse.style.display="";cache.poweredBy.style.display="";}  
cache.displayed=this.id;}else{delete cache.displayed;container.style.left="-9999px";if(cache.termsOfUse&&cache.termsOfUse.style){cache.termsOfUse.style.display="none";cache.termsOfUse.style.left="-9999px";cache.poweredBy.style.display="none";}}}},getMapContainer:function(){return this.mapObject.getDiv();},getMapObjectBoundsFromOLBounds:function(olBounds){var moBounds=null;if(olBounds!=null){var sw=this.sphericalMercator?this.inverseMercator(olBounds.bottom,olBounds.left):new OpenLayers.LonLat(olBounds.bottom,olBounds.left);var ne=this.sphericalMercator?this.inverseMercator(olBounds.top,olBounds.right):new OpenLayers.LonLat(olBounds.top,olBounds.right);moBounds=new google.maps.LatLngBounds(new google.maps.LatLng(sw.lat,sw.lon),new google.maps.LatLng(ne.lat,ne.lon));}  
return moBounds;},getMapObjectLonLatFromMapObjectPixel:function(moPixel){var size=this.map.getSize();var lon=this.getLongitudeFromMapObjectLonLat(this.mapObject.center);var lat=this.getLatitudeFromMapObjectLonLat(this.mapObject.center);var res=this.map.getResolution();var delta_x=moPixel.x-(size.w/2);var delta_y=moPixel.y-(size.h/2);var lonlat=new OpenLayers.LonLat(lon+delta_x*res,lat-delta_y*res);if(this.wrapDateLine){lonlat=lonlat.wrapDateLine(this.maxExtent);}  
return this.getMapObjectLonLatFromLonLat(lonlat.lon,lonlat.lat);},getMapObjectPixelFromMapObjectLonLat:function(moLonLat){var lon=this.getLongitudeFromMapObjectLonLat(moLonLat);var lat=this.getLatitudeFromMapObjectLonLat(moLonLat);var res=this.map.getResolution();var extent=this.map.getExtent();var px=new OpenLayers.Pixel((1/res*(lon-extent.left)),(1/res*(extent.top-lat)));return this.getMapObjectPixelFromXY(px.x,px.y);},setMapObjectCenter:function(center,zoom){this.mapObject.setOptions({center:center,zoom:zoom});},getMapObjectZoomFromMapObjectBounds:function(moBounds){return this.mapObject.getBoundsZoomLevel(moBounds);},getMapObjectLonLatFromLonLat:function(lon,lat){var gLatLng;if(this.sphericalMercator){var lonlat=this.inverseMercator(lon,lat);gLatLng=new google.maps.LatLng(lonlat.lat,lonlat.lon);}else{gLatLng=new google.maps.LatLng(lat,lon);}  
return gLatLng;},getMapObjectPixelFromXY:function(x,y){return new google.maps.Point(x,y);},destroy:function(){if(this.repositionListener){google.maps.event.removeListener(this.repositionListener);}  
if(this.repositionTimer){window.clearTimeout(this.repositionTimer);}  
OpenLayers.Layer.Google.prototype.destroy.apply(this,arguments);}};OpenLayers.Layer.KaMap=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,units:null,resolution:OpenLayers.DOTS_PER_INCH,DEFAULT_PARAMS:{i:'jpeg',map:''},initialize:function(name,url,params,options){var newArguments=[];newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);this.params=OpenLayers.Util.applyDefaults(this.params,this.DEFAULT_PARAMS);},getURL:function(bounds){bounds=this.adjustBounds(bounds);var mapRes=this.map.getResolution();var scale=Math.round((this.map.getScale()*10000))/10000;var pX=Math.round(bounds.left/mapRes);var pY=-Math.round(bounds.top/mapRes);return this.getFullRequestString({t:pY,l:pX,s:scale});},addTile:function(bounds,position){var url=this.getURL(bounds);return new OpenLayers.Tile.Image(this,position,bounds,url,this.tileSize);},calculateGridLayout:function(bounds,extent,resolution){var tilelon=resolution*this.tileSize.w;var tilelat=resolution*this.tileSize.h;var offsetlon=bounds.left;var tilecol=Math.floor(offsetlon/tilelon)-this.buffer;var tilecolremain=offsetlon/tilelon-tilecol;var tileoffsetx=-tilecolremain*this.tileSize.w;var tileoffsetlon=tilecol*tilelon;var offsetlat=bounds.top;var tilerow=Math.ceil(offsetlat/tilelat)+this.buffer;var tilerowremain=tilerow-offsetlat/tilelat;var tileoffsety=-(tilerowremain+1)*this.tileSize.h;var tileoffsetlat=tilerow*tilelat;return{tilelon:tilelon,tilelat:tilelat,tileoffsetlon:tileoffsetlon,tileoffsetlat:tileoffsetlat,tileoffsetx:tileoffsetx,tileoffsety:tileoffsety};},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.KaMap(this.name,this.url,this.params,this.getOptions());}  
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);if(this.tileSize!=null){obj.tileSize=this.tileSize.clone();}  
obj.grid=[];return obj;},getTileBounds:function(viewPortPx){var resolution=this.getResolution();var tileMapWidth=resolution*this.tileSize.w;var tileMapHeight=resolution*this.tileSize.h;var mapPoint=this.getLonLatFromViewPortPx(viewPortPx);var tileLeft=tileMapWidth*Math.floor(mapPoint.lon/tileMapWidth);var tileBottom=tileMapHeight*Math.floor(mapPoint.lat/tileMapHeight);return new OpenLayers.Bounds(tileLeft,tileBottom,tileLeft+tileMapWidth,tileBottom+tileMapHeight);},CLASS_NAME:"OpenLayers.Layer.KaMap"});OpenLayers.Layer.MapGuide=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,useHttpTile:false,singleTile:false,useOverlay:false,useAsyncOverlay:true,TILE_PARAMS:{operation:'GETTILEIMAGE',version:'1.2.0'},SINGLE_TILE_PARAMS:{operation:'GETMAPIMAGE',format:'PNG',locale:'en',clip:'1',version:'1.0.0'},OVERLAY_PARAMS:{operation:'GETDYNAMICMAPOVERLAYIMAGE',format:'PNG',locale:'en',clip:'1',version:'2.0.0'},FOLDER_PARAMS:{tileColumnsPerFolder:30,tileRowsPerFolder:30,format:'png',querystring:null},defaultSize:new OpenLayers.Size(300,300),initialize:function(name,url,params,options){OpenLayers.Layer.Grid.prototype.initialize.apply(this,arguments);if(options==null||options.isBaseLayer==null){this.isBaseLayer=((this.transparent!="true")&&(this.transparent!=true));}  
if(options&&options.useOverlay!=null){this.useOverlay=options.useOverlay;}  
if(this.singleTile){if(this.useOverlay){OpenLayers.Util.applyDefaults(this.params,this.OVERLAY_PARAMS);if(!this.useAsyncOverlay){this.params.version="1.0.0";}}else{OpenLayers.Util.applyDefaults(this.params,this.SINGLE_TILE_PARAMS);}}else{if(this.useHttpTile){OpenLayers.Util.applyDefaults(this.params,this.FOLDER_PARAMS);}else{OpenLayers.Util.applyDefaults(this.params,this.TILE_PARAMS);}  
this.setTileSize(this.defaultSize);}},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.MapGuide(this.name,this.url,this.params,this.getOptions());}  
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},getURL:function(bounds){var url;var center=bounds.getCenterLonLat();var mapSize=this.map.getSize();if(this.singleTile){var params={setdisplaydpi:OpenLayers.DOTS_PER_INCH,setdisplayheight:mapSize.h*this.ratio,setdisplaywidth:mapSize.w*this.ratio,setviewcenterx:center.lon,setviewcentery:center.lat,setviewscale:this.map.getScale()};if(this.useOverlay&&!this.useAsyncOverlay){var getVisParams={};getVisParams=OpenLayers.Util.extend(getVisParams,params);getVisParams.operation="GETVISIBLEMAPEXTENT";getVisParams.version="1.0.0";getVisParams.session=this.params.session;getVisParams.mapName=this.params.mapName;getVisParams.format='text/xml';url=this.getFullRequestString(getVisParams);OpenLayers.Request.GET({url:url,async:false});}  
url=this.getFullRequestString(params);}else{var currentRes=this.map.getResolution();var colidx=Math.floor((bounds.left-this.maxExtent.left)/currentRes);colidx=Math.round(colidx/this.tileSize.w);var rowidx=Math.floor((this.maxExtent.top-bounds.top)/currentRes);rowidx=Math.round(rowidx/this.tileSize.h);if(this.useHttpTile){url=this.getImageFilePath({tilecol:colidx,tilerow:rowidx,scaleindex:this.resolutions.length-this.map.zoom-1});}else{url=this.getFullRequestString({tilecol:colidx,tilerow:rowidx,scaleindex:this.resolutions.length-this.map.zoom-1});}}  
return url;},getFullRequestString:function(newParams,altUrl){var url=(altUrl==null)?this.url:altUrl;if(typeof url=="object"){url=url[Math.floor(Math.random()*url.length)];}  
var requestString=url;var allParams=OpenLayers.Util.extend({},this.params);allParams=OpenLayers.Util.extend(allParams,newParams);var urlParams=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(url));for(var key in allParams){if(key.toUpperCase()in urlParams){delete allParams[key];}}  
var paramsString=OpenLayers.Util.getParameterString(allParams);paramsString=paramsString.replace(/,/g,"+");if(paramsString!=""){var lastServerChar=url.charAt(url.length-1);if((lastServerChar=="&")||(lastServerChar=="?")){requestString+=paramsString;}else{if(url.indexOf('?')==-1){requestString+='?'+paramsString;}else{requestString+='&'+paramsString;}}}  
return requestString;},getImageFilePath:function(newParams,altUrl){var url=(altUrl==null)?this.url:altUrl;if(typeof url=="object"){url=url[Math.floor(Math.random()*url.length)];}  
var requestString=url;var tileRowGroup="";var tileColGroup="";if(newParams.tilerow<0){tileRowGroup='-';}  
if(newParams.tilerow==0){tileRowGroup+='0';}else{tileRowGroup+=Math.floor(Math.abs(newParams.tilerow/this.params.tileRowsPerFolder))*this.params.tileRowsPerFolder;}  
if(newParams.tilecol<0){tileColGroup='-';}  
if(newParams.tilecol==0){tileColGroup+='0';}else{tileColGroup+=Math.floor(Math.abs(newParams.tilecol/this.params.tileColumnsPerFolder))*this.params.tileColumnsPerFolder;}  
var tilePath='/S'+Math.floor(newParams.scaleindex)  
+'/'+this.params.basemaplayergroupname  
+'/R'+tileRowGroup  
+'/C'+tileColGroup  
+'/'+(newParams.tilerow%this.params.tileRowsPerFolder)  
+'_'+(newParams.tilecol%this.params.tileColumnsPerFolder)  
+'.'+this.params.format;if(this.params.querystring){tilePath+="?"+this.params.querystring;}  
requestString+=tilePath;return requestString;},calculateGridLayout:function(bounds,extent,resolution){var tilelon=resolution*this.tileSize.w;var tilelat=resolution*this.tileSize.h;var offsetlon=bounds.left-extent.left;var tilecol=Math.floor(offsetlon/tilelon)-this.buffer;var tilecolremain=offsetlon/tilelon-tilecol;var tileoffsetx=-tilecolremain*this.tileSize.w;var tileoffsetlon=extent.left+tilecol*tilelon;var offsetlat=extent.top-bounds.top+tilelat;var tilerow=Math.floor(offsetlat/tilelat)-this.buffer;var tilerowremain=tilerow-offsetlat/tilelat;var tileoffsety=tilerowremain*this.tileSize.h;var tileoffsetlat=extent.top-tilelat*tilerow;return{tilelon:tilelon,tilelat:tilelat,tileoffsetlon:tileoffsetlon,tileoffsetlat:tileoffsetlat,tileoffsetx:tileoffsetx,tileoffsety:tileoffsety};},CLASS_NAME:"OpenLayers.Layer.MapGuide"});OpenLayers.Layer.MapServer=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{mode:"map",map_imagetype:"png"},initialize:function(name,url,params,options){var newArguments=[];newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);this.params=OpenLayers.Util.applyDefaults(this.params,this.DEFAULT_PARAMS);if(options==null||options.isBaseLayer==null){this.isBaseLayer=((this.params.transparent!="true")&&(this.params.transparent!=true));}},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.MapServer(this.name,this.url,this.params,this.getOptions());}  
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},getURL:function(bounds){bounds=this.adjustBounds(bounds);var extent=[bounds.left,bounds.bottom,bounds.right,bounds.top];var imageSize=this.getImageSize();var url=this.getFullRequestString({mapext:extent,imgext:extent,map_size:[imageSize.w,imageSize.h],imgx:imageSize.w/2,imgy:imageSize.h/2,imgxy:[imageSize.w,imageSize.h]});return url;},getFullRequestString:function(newParams,altUrl){var url=(altUrl==null)?this.url:altUrl;var allParams=OpenLayers.Util.extend({},this.params);allParams=OpenLayers.Util.extend(allParams,newParams);var paramsString=OpenLayers.Util.getParameterString(allParams);if(url instanceof Array){url=this.selectUrl(paramsString,url);}  
var urlParams=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(url));for(var key in allParams){if(key.toUpperCase()in urlParams){delete allParams[key];}}  
paramsString=OpenLayers.Util.getParameterString(allParams);var requestString=url;paramsString=paramsString.replace(/,/g,"+");if(paramsString!=""){var lastServerChar=url.charAt(url.length-1);if((lastServerChar=="&")||(lastServerChar=="?")){requestString+=paramsString;}else{if(url.indexOf('?')==-1){requestString+='?'+paramsString;}else{requestString+='&'+paramsString;}}}  
return requestString;},CLASS_NAME:"OpenLayers.Layer.MapServer"});OpenLayers.Layer.TMS=OpenLayers.Class(OpenLayers.Layer.Grid,{serviceVersion:"1.0.0",isBaseLayer:true,tileOrigin:null,serverResolutions:null,zoomOffset:0,initialize:function(name,url,options){var newArguments=[];newArguments.push(name,url,{},options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.TMS(this.name,this.url,this.getOptions());}  
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){bounds=this.adjustBounds(bounds);var res=this.map.getResolution();var x=Math.round((bounds.left-this.tileOrigin.lon)/(res*this.tileSize.w));var y=Math.round((bounds.bottom-this.tileOrigin.lat)/(res*this.tileSize.h));var z=this.serverResolutions!=null?OpenLayers.Util.indexOf(this.serverResolutions,res):this.map.getZoom()+this.zoomOffset;var path=this.serviceVersion+"/"+this.layername+"/"+z+"/"+x+"/"+y+"."+this.type;var url=this.url;if(url instanceof Array){url=this.selectUrl(path,url);}  
return url+path;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},setMap:function(map){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.TileCache=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,format:'image/png',serverResolutions:null,initialize:function(name,url,layername,options){this.layername=layername;OpenLayers.Layer.Grid.prototype.initialize.apply(this,[name,url,{},options]);this.extension=this.format.split('/')[1].toLowerCase();this.extension=(this.extension=='jpg')?'jpeg':this.extension;},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.TileCache(this.name,this.url,this.layername,this.getOptions());}  
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){var res=this.map.getResolution();var bbox=this.maxExtent;var size=this.tileSize;var tileX=Math.round((bounds.left-bbox.left)/(res*size.w));var tileY=Math.round((bounds.bottom-bbox.bottom)/(res*size.h));var tileZ=this.serverResolutions!=null?OpenLayers.Util.indexOf(this.serverResolutions,res):this.map.getZoom();function zeroPad(number,length){number=String(number);var zeros=[];for(var i=0;i<length;++i){zeros.push('0');}  
return zeros.join('').substring(0,length-number.length)+number;}  
var components=[this.layername,zeroPad(tileZ,2),zeroPad(parseInt(tileX/1000000),3),zeroPad((parseInt(tileX/1000)%1000),3),zeroPad((parseInt(tileX)%1000),3),zeroPad(parseInt(tileY/1000000),3),zeroPad((parseInt(tileY/1000)%1000),3),zeroPad((parseInt(tileY)%1000),3)+'.'+this.extension];var path=components.join('/');var url=this.url;if(url instanceof Array){url=this.selectUrl(path,url);}  
url=(url.charAt(url.length-1)=='/')?url:url+'/';return url+path;},addTile:function(bounds,position){var url=this.getURL(bounds);return new OpenLayers.Tile.Image(this,position,bounds,url,this.tileSize);},CLASS_NAME:"OpenLayers.Layer.TileCache"});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(name,url,params,options){var newArguments=[];params=OpenLayers.Util.upperCaseObject(params);if(parseFloat(params.VERSION)>=1.3&&!params.EXCEPTIONS){params.EXCEPTIONS="INIMAGE";}  
newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if(!this.noMagic&&this.params.TRANSPARENT&&this.params.TRANSPARENT.toString().toLowerCase()=="true"){if((options==null)||(!options.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(obj){if(obj==null){obj=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.getOptions());}  
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},reverseAxisOrder:function(){return(parseFloat(this.params.VERSION)>=1.3&&!!this.yx[this.map.getProjectionObject().getCode()]);},getURL:function(bounds){bounds=this.adjustBounds(bounds);var imageSize=this.getImageSize();var newParams={};var reverseAxisOrder=this.reverseAxisOrder();newParams.BBOX=this.encodeBBOX?bounds.toBBOX(null,reverseAxisOrder):bounds.toArray(reverseAxisOrder);newParams.WIDTH=imageSize.w;newParams.HEIGHT=imageSize.h;var requestString=this.getFullRequestString(newParams);return requestString;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},mergeNewParams:function(newParams){var upperParams=OpenLayers.Util.upperCaseObject(newParams);var newArguments=[upperParams];return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,newArguments);},getFullRequestString:function(newParams,altUrl){var projectionCode=this.map.getProjection();var value=(projectionCode=="none")?null:projectionCode  
if(parseFloat(this.params.VERSION)>=1.3){this.params.CRS=value;}else{this.params.SRS=value;}  
return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments);},CLASS_NAME:"OpenLayers.Layer.WMS"});OpenLayers.Layer.WMTS=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,version:"1.0.0",requestEncoding:"KVP",url:null,layer:null,matrixSet:null,style:null,format:"image/jpeg",tileOrigin:null,tileFullExtent:null,formatSuffix:null,matrixIds:null,dimensions:null,params:null,zoomOffset:0,formatSuffixMap:{"image/png":"png","image/png8":"png","image/png24":"png","image/png32":"png","png":"png","image/jpeg":"jpg","image/jpg":"jpg","jpeg":"jpg","jpg":"jpg"},matrix:null,initialize:function(config){var required={url:true,layer:true,style:true,matrixSet:true};for(var prop in required){if(!(prop in config)){throw new Error("Missing property '"+prop+"' in layer configuration.");}}  
config.params=OpenLayers.Util.upperCaseObject(config.params);var args=[config.name,config.url,config.params,config];OpenLayers.Layer.Grid.prototype.initialize.apply(this,args);if(!this.formatSuffix){this.formatSuffix=this.formatSuffixMap[this.format]||this.format.split("/").pop();}  
if(this.matrixIds){var len=this.matrixIds.length;if(len&&typeof this.matrixIds[0]==="string"){var ids=this.matrixIds;this.matrixIds=new Array(len);for(var i=0;i<len;++i){this.matrixIds[i]={identifier:ids[i]};}}}},setMap:function(){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);this.updateMatrixProperties();},updateMatrixProperties:function(){this.matrix=this.getMatrix();if(this.matrix){if(this.matrix.topLeftCorner){this.tileOrigin=this.matrix.topLeftCorner;}  
if(this.matrix.tileWidth&&this.matrix.tileHeight){this.tileSize=new OpenLayers.Size(this.matrix.tileWidth,this.matrix.tileHeight);}  
if(!this.tileOrigin){this.tileOrigin=new OpenLayers.LonLat(this.maxExtent.left,this.maxExtent.top);}  
if(!this.tileFullExtent){this.tileFullExtent=this.maxExtent;}}},moveTo:function(bounds,zoomChanged,dragging){if(zoomChanged||!this.matrix){this.updateMatrixProperties();}  
return OpenLayers.Layer.Grid.prototype.moveTo.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.WMTS(this.options);}  
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getMatrix:function(){var matrix;if(!this.matrixIds||this.matrixIds.length===0){matrix={identifier:this.map.getZoom()+this.zoomOffset};}else{if("scaleDenominator"in this.matrixIds[0]){var denom=OpenLayers.METERS_PER_INCH*OpenLayers.INCHES_PER_UNIT[this.units]*this.map.getResolution()/0.28E-3;var diff=Number.POSITIVE_INFINITY;var delta;for(var i=0,ii=this.matrixIds.length;i<ii;++i){delta=Math.abs(1-(this.matrixIds[i].scaleDenominator/denom));if(delta<diff){diff=delta;matrix=this.matrixIds[i];}}}else{matrix=this.matrixIds[this.map.getZoom()+this.zoomOffset];}}  
return matrix;},getTileInfo:function(loc){var res=this.map.getResolution();var fx=(loc.lon-this.tileOrigin.lon)/(res*this.tileSize.w);var fy=(this.tileOrigin.lat-loc.lat)/(res*this.tileSize.h);var col=Math.floor(fx);var row=Math.floor(fy);return{col:col,row:row,i:Math.floor((fx-col)*this.tileSize.w),j:Math.floor((fy-row)*this.tileSize.h)};},getURL:function(bounds){bounds=this.adjustBounds(bounds);var url="";if(!this.tileFullExtent||this.tileFullExtent.intersectsBounds(bounds)){var center=bounds.getCenterLonLat();var info=this.getTileInfo(center);var matrixId=this.matrix.identifier;if(this.requestEncoding.toUpperCase()==="REST"){var path=this.version+"/"+this.layer+"/"+this.style+"/";if(this.dimensions){for(var i=0;i<this.dimensions.length;i++){if(this.params[this.dimensions[i]]){path=path+this.params[this.dimensions[i]]+"/";}}}  
path=path+this.matrixSet+"/"+this.matrix.identifier+"/"+info.row+"/"+info.col+"."+this.formatSuffix;if(this.url instanceof Array){url=this.selectUrl(path,this.url);}else{url=this.url;}  
if(!url.match(/\/$/)){url=url+"/";}  
url=url+path;}else if(this.requestEncoding.toUpperCase()==="KVP"){var params={SERVICE:"WMTS",REQUEST:"GetTile",VERSION:this.version,LAYER:this.layer,STYLE:this.style,TILEMATRIXSET:this.matrixSet,TILEMATRIX:this.matrix.identifier,TILEROW:info.row,TILECOL:info.col,FORMAT:this.format};url=OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,[params]);}}  
return url;},mergeNewParams:function(newParams){if(this.requestEncoding.toUpperCase()==="KVP"){return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,[OpenLayers.Util.upperCaseObject(newParams)]);}},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},CLASS_NAME:"OpenLayers.Layer.WMTS"});OpenLayers.Layer.WorldWind=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{},isBaseLayer:true,lzd:null,zoomLevels:null,initialize:function(name,url,lzd,zoomLevels,params,options){this.lzd=lzd;this.zoomLevels=zoomLevels;var newArguments=[];newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);this.params=OpenLayers.Util.applyDefaults(this.params,this.DEFAULT_PARAMS);},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},getZoom:function(){var zoom=this.map.getZoom();var extent=this.map.getMaxExtent();zoom=zoom-Math.log(this.maxResolution/(this.lzd/512))/Math.log(2);return zoom;},getURL:function(bounds){bounds=this.adjustBounds(bounds);var zoom=this.getZoom();var extent=this.map.getMaxExtent();var deg=this.lzd/Math.pow(2,this.getZoom());var x=Math.floor((bounds.left-extent.left)/deg);var y=Math.floor((bounds.bottom-extent.bottom)/deg);if(this.map.getResolution()<=(this.lzd/512)&&this.getZoom()<=this.zoomLevels){return this.getFullRequestString({L:zoom,X:x,Y:y});}else{return OpenLayers.Util.getImagesLocation()+"blank.gif";}},CLASS_NAME:"OpenLayers.Layer.WorldWind"});OpenLayers.Layer.XYZ=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,sphericalMercator:false,zoomOffset:0,initialize:function(name,url,options){if(options&&options.sphericalMercator||this.sphericalMercator){options=OpenLayers.Util.extend({maxExtent:new OpenLayers.Bounds(-128*156543.0339,-128*156543.0339,128*156543.0339,128*156543.0339),maxResolution:156543.0339,numZoomLevels:19,units:"m",projection:"EPSG:900913"},options);}  
url=url||this.url;name=name||this.name;var newArguments=[name,url,{},options];OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.XYZ(this.name,this.url,this.getOptions());}  
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){var res=this.map.getResolution();var x=Math.round((bounds.left-this.maxExtent.left)/(res*this.tileSize.w));var y=Math.round((this.maxExtent.top-bounds.top)/(res*this.tileSize.h));var z=this.map.getZoom()+this.zoomOffset;var url=this.url;var s=''+x+y+z;if(url instanceof Array)  
{url=this.selectUrl(s,url);}  
var path=OpenLayers.String.format(url,{'x':x,'y':y,'z':z});return path;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},setMap:function(map){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);if(!this.tileOrigin){this.tileOrigin=new OpenLayers.LonLat(this.maxExtent.left,this.maxExtent.bottom);}},CLASS_NAME:"OpenLayers.Layer.XYZ"});OpenLayers.Layer.OSM=OpenLayers.Class(OpenLayers.Layer.XYZ,{name:"OpenStreetMap",attribution:"Data CC-By-SA by <a href='http://openstreetmap.org/'>OpenStreetMap</a>",sphericalMercator:true,url:'http://tile.openstreetmap.org/${z}/${x}/${y}.png',clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.OSM(this.name,this.url,this.getOptions());}  
obj=OpenLayers.Layer.XYZ.prototype.clone.apply(this,[obj]);return obj;},CLASS_NAME:"OpenLayers.Layer.OSM"});OpenLayers.Layer.Zoomify=OpenLayers.Class(OpenLayers.Layer.Grid,{url:null,size:null,isBaseLayer:true,standardTileSize:256,numberOfTiers:0,tileCountUpToTier:new Array(),tierSizeInTiles:new Array(),tierImageSize:new Array(),initialize:function(name,url,size,options){this.initializeZoomify(size);var newArguments=[];newArguments.push(name,url,size,{},options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);},initializeZoomify:function(size){var imageSize=size.clone()  
var tiles=new OpenLayers.Size(Math.ceil(imageSize.w/this.standardTileSize),Math.ceil(imageSize.h/this.standardTileSize));this.tierSizeInTiles.push(tiles);this.tierImageSize.push(imageSize);while(imageSize.w>this.standardTileSize||imageSize.h>this.standardTileSize){imageSize=new OpenLayers.Size(Math.floor(imageSize.w/2),Math.floor(imageSize.h/2));tiles=new OpenLayers.Size(Math.ceil(imageSize.w/this.standardTileSize),Math.ceil(imageSize.h/this.standardTileSize));this.tierSizeInTiles.push(tiles);this.tierImageSize.push(imageSize);}  
this.tierSizeInTiles.reverse();this.tierImageSize.reverse();this.numberOfTiers=this.tierSizeInTiles.length;this.tileCountUpToTier[0]=0;for(var i=1;i<this.numberOfTiers;i++){this.tileCountUpToTier.push(this.tierSizeInTiles[i-1].w*this.tierSizeInTiles[i-1].h+  
this.tileCountUpToTier[i-1]);}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments);this.tileCountUpToTier.length=0  
this.tierSizeInTiles.length=0  
this.tierImageSize.length=0},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.Zoomify(this.name,this.url,this.size,this.options);}  
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){bounds=this.adjustBounds(bounds);var res=this.map.getResolution();var x=Math.round((bounds.left-this.tileOrigin.lon)/(res*this.tileSize.w));var y=Math.round((this.tileOrigin.lat-bounds.top)/(res*this.tileSize.h));var z=this.map.getZoom();var tileIndex=x+y*this.tierSizeInTiles[z].w+this.tileCountUpToTier[z];var path="TileGroup"+Math.floor((tileIndex)/256)+"/"+z+"-"+x+"-"+y+".jpg";var url=this.url;if(url instanceof Array){url=this.selectUrl(path,url);}  
return url+path;},getImageSize:function(){if(arguments.length>0){bounds=this.adjustBounds(arguments[0]);var res=this.map.getResolution();var x=Math.round((bounds.left-this.tileOrigin.lon)/(res*this.tileSize.w));var y=Math.round((this.tileOrigin.lat-bounds.top)/(res*this.tileSize.h));var z=this.map.getZoom();var w=this.standardTileSize;var h=this.standardTileSize;if(x==this.tierSizeInTiles[z].w-1){var w=this.tierImageSize[z].w%this.standardTileSize;};if(y==this.tierSizeInTiles[z].h-1){var h=this.tierImageSize[z].h%this.standardTileSize;};return(new OpenLayers.Size(w,h));}else{return this.tileSize;}},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},setMap:function(map){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.top);},calculateGridLayout:function(bounds,extent,resolution){var tilelon=resolution*this.tileSize.w;var tilelat=resolution*this.tileSize.h;var offsetlon=bounds.left-extent.left;var tilecol=Math.floor(offsetlon/tilelon)-this.buffer;var tilecolremain=offsetlon/tilelon-tilecol;var tileoffsetx=-tilecolremain*this.tileSize.w;var tileoffsetlon=extent.left+tilecol*tilelon;var offsetlat=extent.top-bounds.top+tilelat;var tilerow=Math.floor(offsetlat/tilelat)-this.buffer;var tilerowremain=tilerow-offsetlat/tilelat;var tileoffsety=tilerowremain*this.tileSize.h;var tileoffsetlat=extent.top-tilelat*tilerow;return{tilelon:tilelon,tilelat:tilelat,tileoffsetlon:tileoffsetlon,tileoffsetlat:tileoffsetlat,tileoffsetx:tileoffsetx,tileoffsety:tileoffsety};},CLASS_NAME:"OpenLayers.Layer.Zoomify"});OpenLayers.Protocol.SQL.Gears=OpenLayers.Class(OpenLayers.Protocol.SQL,{FID_PREFIX:'__gears_fid__',NULL_GEOMETRY:'__gears_null_geometry__',NULL_FEATURE_STATE:'__gears_null_feature_state__',jsonParser:null,wktParser:null,fidRegExp:null,saveFeatureState:true,typeOfFid:"string",db:null,initialize:function(options){if(!this.supported()){return;}  
OpenLayers.Protocol.SQL.prototype.initialize.apply(this,[options]);this.jsonParser=new OpenLayers.Format.JSON();this.wktParser=new OpenLayers.Format.WKT();this.fidRegExp=new RegExp('^'+this.FID_PREFIX);this.initializeDatabase();},initializeDatabase:function(){this.db=google.gears.factory.create('beta.database');this.db.open(this.databaseName);this.db.execute("CREATE TABLE IF NOT EXISTS "+this.tableName+" (fid TEXT UNIQUE, geometry TEXT, properties TEXT,"+" state TEXT)");},destroy:function(){this.db.close();this.db=null;this.jsonParser=null;this.wktParser=null;OpenLayers.Protocol.SQL.prototype.destroy.apply(this);},supported:function(){return!!(window.google&&google.gears);},read:function(options){OpenLayers.Protocol.prototype.read.apply(this,arguments);options=OpenLayers.Util.applyDefaults(options,this.options);var feature,features=[];var rs=this.db.execute("SELECT * FROM "+this.tableName);while(rs.isValidRow()){feature=this.unfreezeFeature(rs);if(this.evaluateFilter(feature,options.filter)){if(!options.noFeatureStateReset){feature.state=null;}  
features.push(feature);}  
rs.next();}  
rs.close();var resp=new OpenLayers.Protocol.Response({code:OpenLayers.Protocol.Response.SUCCESS,requestType:"read",features:features});if(options&&options.callback){options.callback.call(options.scope,resp);}  
return resp;},unfreezeFeature:function(row){var feature;var wkt=row.fieldByName('geometry');if(wkt==this.NULL_GEOMETRY){feature=new OpenLayers.Feature.Vector();}else{feature=this.wktParser.read(wkt);}  
feature.attributes=this.jsonParser.read(row.fieldByName('properties'));feature.fid=this.extractFidFromField(row.fieldByName('fid'));var state=row.fieldByName('state');if(state==this.NULL_FEATURE_STATE){state=null;}  
feature.state=state;return feature;},extractFidFromField:function(field){if(!field.match(this.fidRegExp)&&this.typeOfFid=="number"){field=parseFloat(field);}  
return field;},create:function(features,options){options=OpenLayers.Util.applyDefaults(options,this.options);var resp=this.createOrUpdate(features);resp.requestType="create";if(options&&options.callback){options.callback.call(options.scope,resp);}  
return resp;},update:function(features,options){options=OpenLayers.Util.applyDefaults(options,this.options);var resp=this.createOrUpdate(features);resp.requestType="update";if(options&&options.callback){options.callback.call(options.scope,resp);}  
return resp;},createOrUpdate:function(features){if(!(features instanceof Array)){features=[features];}  
var i,len=features.length,feature;var insertedFeatures=new Array(len);for(i=0;i<len;i++){feature=features[i];var params=this.freezeFeature(feature);this.db.execute("REPLACE INTO "+this.tableName+" (fid, geometry, properties, state)"+" VALUES (?, ?, ?, ?)",params);var clone=feature.clone();clone.fid=this.extractFidFromField(params[0]);insertedFeatures[i]=clone;}  
return new OpenLayers.Protocol.Response({code:OpenLayers.Protocol.Response.SUCCESS,features:insertedFeatures,reqFeatures:features});},freezeFeature:function(feature){feature.fid=feature.fid!=null?""+feature.fid:OpenLayers.Util.createUniqueID(this.FID_PREFIX);var geometry=feature.geometry!=null?feature.geometry.toString():this.NULL_GEOMETRY;var properties=this.jsonParser.write(feature.attributes);var state=this.getFeatureStateForFreeze(feature);return[feature.fid,geometry,properties,state];},getFeatureStateForFreeze:function(feature){var state;if(!this.saveFeatureState){state=this.NULL_FEATURE_STATE;}else if(this.createdOffline(feature)){state=OpenLayers.State.INSERT;}else{state=feature.state;}  
return state;},"delete":function(features,options){if(!(features instanceof Array)){features=[features];}  
options=OpenLayers.Util.applyDefaults(options,this.options);var i,len,feature;for(i=0,len=features.length;i<len;i++){feature=features[i];if(this.saveFeatureState&&!this.createdOffline(feature)){var toDelete=feature.clone();toDelete.fid=feature.fid;if(toDelete.geometry){toDelete.geometry.destroy();toDelete.geometry=null;}  
toDelete.state=feature.state;this.createOrUpdate(toDelete);}else{this.db.execute("DELETE FROM "+this.tableName+" WHERE fid = ?",[feature.fid]);}}  
var resp=new OpenLayers.Protocol.Response({code:OpenLayers.Protocol.Response.SUCCESS,requestType:"delete",reqFeatures:features});if(options&&options.callback){options.callback.call(options.scope,resp);}  
return resp;},createdOffline:function(feature){return(typeof feature.fid=="string"&&!!(feature.fid.match(this.fidRegExp)));},commit:function(features,options){var opt,resp=[],nRequests=0,nResponses=0;function callback(resp){if(++nResponses<nRequests){resp.last=false;}  
this.callUserCallback(options,resp);}  
var feature,toCreate=[],toUpdate=[],toDelete=[];for(var i=features.length-1;i>=0;i--){feature=features[i];switch(feature.state){case OpenLayers.State.INSERT:toCreate.push(feature);break;case OpenLayers.State.UPDATE:toUpdate.push(feature);break;case OpenLayers.State.DELETE:toDelete.push(feature);break;}}  
if(toCreate.length>0){nRequests++;opt=OpenLayers.Util.applyDefaults({"callback":callback,"scope":this},options.create);resp.push(this.create(toCreate,opt));}  
if(toUpdate.length>0){nRequests++;opt=OpenLayers.Util.applyDefaults({"callback":callback,"scope":this},options.update);resp.push(this.update(toUpdate,opt));}  
if(toDelete.length>0){nRequests++;opt=OpenLayers.Util.applyDefaults({"callback":callback,"scope":this},options["delete"]);resp.push(this["delete"](toDelete,opt));}  
return resp;},clear:function(){this.db.execute("DELETE FROM "+this.tableName);},callUserCallback:function(options,resp){var opt=options[resp.requestType];if(opt&&opt.callback){opt.callback.call(opt.scope,resp);}  
if(resp.last&&options.callback){options.callback.call(options.scope);}},CLASS_NAME:"OpenLayers.Protocol.SQL.Gears"});OpenLayers.Rule=OpenLayers.Class({id:null,name:null,title:null,description:null,context:null,filter:null,elseFilter:false,symbolizer:null,symbolizers:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(options){this.symbolizer={};OpenLayers.Util.extend(this,options);if(this.symbolizers){delete this.symbolizer;}  
this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){for(var i in this.symbolizer){this.symbolizer[i]=null;}  
this.symbolizer=null;delete this.symbolizers;},evaluate:function(feature){var context=this.getContext(feature);var applies=true;if(this.minScaleDenominator||this.maxScaleDenominator){var scale=feature.layer.map.getScale();}  
if(this.minScaleDenominator){applies=scale>=OpenLayers.Style.createLiteral(this.minScaleDenominator,context);}  
if(applies&&this.maxScaleDenominator){applies=scale<OpenLayers.Style.createLiteral(this.maxScaleDenominator,context);}  
if(applies&&this.filter){if(this.filter.CLASS_NAME=="OpenLayers.Filter.FeatureId"){applies=this.filter.evaluate(feature);}else{applies=this.filter.evaluate(context);}}  
return applies;},getContext:function(feature){var context=this.context;if(!context){context=feature.attributes||feature.data;}  
if(typeof this.context=="function"){context=this.context(feature);}  
return context;},clone:function(){var options=OpenLayers.Util.extend({},this);if(this.symbolizers){var len=this.symbolizers.length;options.symbolizers=new Array(len);for(var i=0;i<len;++i){options.symbolizers[i]=this.symbolizers[i].clone();}}else{options.symbolizer={};var value,type;for(var key in this.symbolizer){value=this.symbolizer[key];type=typeof value;if(type==="object"){options.symbolizer[key]=OpenLayers.Util.extend({},value);}else if(type==="string"){options.symbolizer[key]=value;}}}  
options.filter=this.filter&&this.filter.clone();options.context=this.context&&OpenLayers.Util.extend({},this.context);return new OpenLayers.Rule(options);},CLASS_NAME:"OpenLayers.Rule"});OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:true,initialize:function(style,options){this.styles={"default":new OpenLayers.Style(OpenLayers.Feature.Vector.style["default"]),"select":new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"]),"temporary":new OpenLayers.Style(OpenLayers.Feature.Vector.style["temporary"]),"delete":new OpenLayers.Style(OpenLayers.Feature.Vector.style["delete"])};if(style instanceof OpenLayers.Style){this.styles["default"]=style;this.styles["select"]=style;this.styles["temporary"]=style;this.styles["delete"]=style;}else if(typeof style=="object"){for(var key in style){if(style[key]instanceof OpenLayers.Style){this.styles[key]=style[key];}else if(typeof style[key]=="object"){this.styles[key]=new OpenLayers.Style(style[key]);}else{this.styles["default"]=new OpenLayers.Style(style);this.styles["select"]=new OpenLayers.Style(style);this.styles["temporary"]=new OpenLayers.Style(style);this.styles["delete"]=new OpenLayers.Style(style);break;}}}  
OpenLayers.Util.extend(this,options);},destroy:function(){for(var key in this.styles){this.styles[key].destroy();}  
this.styles=null;},createSymbolizer:function(feature,intent){if(!feature){feature=new OpenLayers.Feature.Vector();}  
if(!this.styles[intent]){intent="default";}  
feature.renderIntent=intent;var defaultSymbolizer={};if(this.extendDefault&&intent!="default"){defaultSymbolizer=this.styles["default"].createSymbolizer(feature);}  
return OpenLayers.Util.extend(defaultSymbolizer,this.styles[intent].createSymbolizer(feature));},addUniqueValueRules:function(renderIntent,property,symbolizers,context){var rules=[];for(var value in symbolizers){rules.push(new OpenLayers.Rule({symbolizer:symbolizers[value],context:context,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:property,value:value})}));}  
this.styles[renderIntent].addRules(rules);},CLASS_NAME:"OpenLayers.StyleMap"});OpenLayers.Control.NavToolbar=OpenLayers.Class(OpenLayers.Control.Panel,{initialize:function(options){OpenLayers.Control.Panel.prototype.initialize.apply(this,[options]);this.addControls([new OpenLayers.Control.Navigation(),new OpenLayers.Control.ZoomBox()]);},draw:function(){var div=OpenLayers.Control.Panel.prototype.draw.apply(this,arguments);this.activateControl(this.controls[0]);return div;},CLASS_NAME:"OpenLayers.Control.NavToolbar"});OpenLayers.Filter.Comparison=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,matchCase:true,lowerBoundary:null,upperBoundary:null,initialize:function(options){OpenLayers.Filter.prototype.initialize.apply(this,[options]);},evaluate:function(context){if(context instanceof OpenLayers.Feature.Vector){context=context.attributes;}  
var result=false;var got=context[this.property];switch(this.type){case OpenLayers.Filter.Comparison.EQUAL_TO:var exp=this.value;if(!this.matchCase&&typeof got=="string"&&typeof exp=="string"){result=(got.toUpperCase()==exp.toUpperCase());}else{result=(got==exp);}  
break;case OpenLayers.Filter.Comparison.NOT_EQUAL_TO:var exp=this.value;if(!this.matchCase&&typeof got=="string"&&typeof exp=="string"){result=(got.toUpperCase()!=exp.toUpperCase());}else{result=(got!=exp);}  
break;case OpenLayers.Filter.Comparison.LESS_THAN:result=got<this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN:result=got>this.value;break;case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:result=got<=this.value;break;case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:result=got>=this.value;break;case OpenLayers.Filter.Comparison.BETWEEN:result=(got>=this.lowerBoundary)&&(got<=this.upperBoundary);break;case OpenLayers.Filter.Comparison.LIKE:var regexp=new RegExp(this.value,"gi");result=regexp.test(got);break;}  
return result;},value2regex:function(wildCard,singleChar,escapeChar){if(wildCard=="."){var msg="'.' is an unsupported wildCard character for "+"OpenLayers.Filter.Comparison";OpenLayers.Console.error(msg);return null;}  
wildCard=wildCard?wildCard:"*";singleChar=singleChar?singleChar:".";escapeChar=escapeChar?escapeChar:"!";this.value=this.value.replace(new RegExp("\\"+escapeChar+"(.|$)","g"),"\\$1");this.value=this.value.replace(new RegExp("\\"+singleChar,"g"),".");this.value=this.value.replace(new RegExp("\\"+wildCard,"g"),".*");this.value=this.value.replace(new RegExp("\\\\.\\*","g"),"\\"+wildCard);this.value=this.value.replace(new RegExp("\\\\\\.","g"),"\\"+singleChar);return this.value;},regex2value:function(){var value=this.value;value=value.replace(/!/g,"!!");value=value.replace(/(\\)?\\\./g,function($0,$1){return $1?$0:"!.";});value=value.replace(/(\\)?\\\*/g,function($0,$1){return $1?$0:"!*";});value=value.replace(/\\\\/g,"\\");value=value.replace(/\.\*/g,"*");return value;},clone:function(){return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison(),this);},CLASS_NAME:"OpenLayers.Filter.Comparison"});OpenLayers.Filter.Comparison.EQUAL_TO="==";OpenLayers.Filter.Comparison.NOT_EQUAL_TO="!=";OpenLayers.Filter.Comparison.LESS_THAN="<";OpenLayers.Filter.Comparison.GREATER_THAN=">";OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO="<=";OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO=">=";OpenLayers.Filter.Comparison.BETWEEN="..";OpenLayers.Filter.Comparison.LIKE="~";OpenLayers.Filter.FeatureId=OpenLayers.Class(OpenLayers.Filter,{fids:null,initialize:function(options){this.fids=[];OpenLayers.Filter.prototype.initialize.apply(this,[options]);},evaluate:function(feature){for(var i=0,len=this.fids.length;i<len;i++){var fid=feature.fid||feature.id;if(fid==this.fids[i]){return true;}}  
return false;},clone:function(){var filter=new OpenLayers.Filter.FeatureId();OpenLayers.Util.extend(filter,this);filter.fids=this.fids.slice();return filter;},CLASS_NAME:"OpenLayers.Filter.FeatureId"});OpenLayers.Filter.Logical=OpenLayers.Class(OpenLayers.Filter,{filters:null,type:null,initialize:function(options){this.filters=[];OpenLayers.Filter.prototype.initialize.apply(this,[options]);},destroy:function(){this.filters=null;OpenLayers.Filter.prototype.destroy.apply(this);},evaluate:function(context){switch(this.type){case OpenLayers.Filter.Logical.AND:for(var i=0,len=this.filters.length;i<len;i++){if(this.filters[i].evaluate(context)==false){return false;}}  
return true;case OpenLayers.Filter.Logical.OR:for(var i=0,len=this.filters.length;i<len;i++){if(this.filters[i].evaluate(context)==true){return true;}}  
return false;case OpenLayers.Filter.Logical.NOT:return(!this.filters[0].evaluate(context));}},clone:function(){var filters=[];for(var i=0,len=this.filters.length;i<len;++i){filters.push(this.filters[i].clone());}  
return new OpenLayers.Filter.Logical({type:this.type,filters:filters});},CLASS_NAME:"OpenLayers.Filter.Logical"});OpenLayers.Filter.Logical.AND="&&";OpenLayers.Filter.Logical.OR="||";OpenLayers.Filter.Logical.NOT="!";OpenLayers.Filter.Spatial=OpenLayers.Class(OpenLayers.Filter,{type:null,property:null,value:null,distance:null,distanceUnits:null,initialize:function(options){OpenLayers.Filter.prototype.initialize.apply(this,[options]);},evaluate:function(feature){var intersect=false;switch(this.type){case OpenLayers.Filter.Spatial.BBOX:case OpenLayers.Filter.Spatial.INTERSECTS:if(feature.geometry){var geom=this.value;if(this.value.CLASS_NAME=="OpenLayers.Bounds"){geom=this.value.toGeometry();}  
if(feature.geometry.intersects(geom)){intersect=true;}}  
break;default:OpenLayers.Console.error(OpenLayers.i18n("filterEvaluateNotImplemented"));break;}  
return intersect;},clone:function(){var options=OpenLayers.Util.applyDefaults({value:this.value&&this.value.clone&&this.value.clone()},this);return new OpenLayers.Filter.Spatial(options);},CLASS_NAME:"OpenLayers.Filter.Spatial"});OpenLayers.Filter.Spatial.BBOX="BBOX";OpenLayers.Filter.Spatial.INTERSECTS="INTERSECTS";OpenLayers.Filter.Spatial.DWITHIN="DWITHIN";OpenLayers.Filter.Spatial.WITHIN="WITHIN";OpenLayers.Filter.Spatial.CONTAINS="CONTAINS";OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(components){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];if(components!=null){this.addComponents(components);}},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;i<len;i++){geometry.addComponent(this.components[i].clone());}  
OpenLayers.Util.applyDefaults(geometry,this);return geometry;},getComponentsString:function(){var strings=[];for(var i=0,len=this.components.length;i<len;i++){strings.push(this.components[i].toShortString());}  
return strings.join(",");},calculateBounds:function(){this.bounds=null;if(this.components&&this.components.length>0){this.setBounds(this.components[0].getBounds());for(var i=1,len=this.components.length;i<len;i++){this.extendBounds(this.components[i].getBounds());}}},addComponents:function(components){if(!(components instanceof Array)){components=[components];}  
for(var i=0,len=components.length;i<len;i++){this.addComponent(components[i]);}},addComponent:function(component,index){var added=false;if(component){if(this.componentTypes==null||(OpenLayers.Util.indexOf(this.componentTypes,component.CLASS_NAME)>-1)){if(index!=null&&(index<this.components.length)){var components1=this.components.slice(0,index);var components2=this.components.slice(index,this.components.length);components1.push(component);this.components=components1.concat(components2);}else{this.components.push(component);}  
component.parent=this;this.clearBounds();added=true;}}  
return added;},removeComponents:function(components){if(!(components instanceof Array)){components=[components];}  
for(var i=components.length-1;i>=0;--i){this.removeComponent(components[i]);}},removeComponent:function(component){OpenLayers.Util.removeItem(this.components,component);this.clearBounds();},getLength:function(){var length=0.0;for(var i=0,len=this.components.length;i<len;i++){length+=this.components[i].getLength();}  
return length;},getArea:function(){var area=0.0;for(var i=0,len=this.components.length;i<len;i++){area+=this.components[i].getArea();}  
return area;},getGeodesicArea:function(projection){var area=0.0;for(var i=0,len=this.components.length;i<len;i++){area+=this.components[i].getGeodesicArea(projection);}  
return area;},getCentroid:function(weighted){if(!weighted){return this.components.length&&this.components[0].getCentroid();}  
var len=this.components.length;if(!len){return false;}  
var areas=[];var centroids=[];var areaSum=0;var minArea=Number.MAX_VALUE;var component;for(var i=0;i<len;++i){component=this.components[i];var area=component.getArea();var centroid=component.getCentroid(true);if(isNaN(area)||isNaN(centroid.x)||isNaN(centroid.y)){continue;}  
areas.push(area);areaSum+=area;minArea=(area<minArea&&area>0)?area:minArea;centroids.push(centroid);}  
len=areas.length;if(areaSum===0){for(var i=0;i<len;++i){areas[i]=1;}  
areaSum=areas.length;}else{for(var i=0;i<len;++i){areas[i]/=minArea;}  
areaSum/=minArea;}  
var xSum=0,ySum=0,centroid,area;for(var i=0;i<len;++i){centroid=centroids[i];area=areas[i];xSum+=centroid.x*area;ySum+=centroid.y*area;}  
return new OpenLayers.Geometry.Point(xSum/areaSum,ySum/areaSum);},getGeodesicLength:function(projection){var length=0.0;for(var i=0,len=this.components.length;i<len;i++){length+=this.components[i].getGeodesicLength(projection);}  
return length;},move:function(x,y){for(var i=0,len=this.components.length;i<len;i++){this.components[i].move(x,y);}},rotate:function(angle,origin){for(var i=0,len=this.components.length;i<len;++i){this.components[i].rotate(angle,origin);}},resize:function(scale,origin,ratio){for(var i=0;i<this.components.length;++i){this.components[i].resize(scale,origin,ratio);}  
return this;},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var result,best,distance;var min=Number.POSITIVE_INFINITY;for(var i=0,len=this.components.length;i<len;++i){result=this.components[i].distanceTo(geometry,options);distance=details?result.distance:result;if(distance<min){min=distance;best=result;if(min==0){break;}}}  
return best;},equals:function(geometry){var equivalent=true;if(!geometry||!geometry.CLASS_NAME||(this.CLASS_NAME!=geometry.CLASS_NAME)){equivalent=false;}else if(!(geometry.components instanceof Array)||(geometry.components.length!=this.components.length)){equivalent=false;}else{for(var i=0,len=this.components.length;i<len;++i){if(!this.components[i].equals(geometry.components[i])){equivalent=false;break;}}}  
return equivalent;},transform:function(source,dest){if(source&&dest){for(var i=0,len=this.components.length;i<len;i++){var component=this.components[i];component.transform(source,dest);}  
this.bounds=null;}  
return this;},intersects:function(geometry){var intersect=false;for(var i=0,len=this.components.length;i<len;++i){intersect=geometry.intersects(this.components[i]);if(intersect){break;}}  
return intersect;},getVertices:function(nodes){var vertices=[];for(var i=0,len=this.components.length;i<len;++i){Array.prototype.push.apply(vertices,this.components[i].getVertices(nodes));}  
return vertices;},CLASS_NAME:"OpenLayers.Geometry.Collection"});OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(x,y){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(x);this.y=parseFloat(y);},clone:function(obj){if(obj==null){obj=new OpenLayers.Geometry.Point(this.x,this.y);}  
OpenLayers.Util.applyDefaults(obj,this);return obj;},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y);},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var distance,x0,y0,x1,y1,result;if(geometry instanceof OpenLayers.Geometry.Point){x0=this.x;y0=this.y;x1=geometry.x;y1=geometry.y;distance=Math.sqrt(Math.pow(x0-x1,2)+Math.pow(y0-y1,2));result=!details?distance:{x0:x0,y0:y0,x1:x1,y1:y1,distance:distance};}else{result=geometry.distanceTo(this,options);if(details){result={x0:result.x1,y0:result.y1,x1:result.x0,y1:result.y0,distance:result.distance};}}  
return result;},equals:function(geom){var equals=false;if(geom!=null){equals=((this.x==geom.x&&this.y==geom.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(geom.x)&&isNaN(geom.y)));}  
return equals;},toShortString:function(){return(this.x+", "+this.y);},move:function(x,y){this.x=this.x+x;this.y=this.y+y;this.clearBounds();},rotate:function(angle,origin){angle*=Math.PI/180;var radius=this.distanceTo(origin);var theta=angle+Math.atan2(this.y-origin.y,this.x-origin.x);this.x=origin.x+(radius*Math.cos(theta));this.y=origin.y+(radius*Math.sin(theta));this.clearBounds();},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y);},resize:function(scale,origin,ratio){ratio=(ratio==undefined)?1:ratio;this.x=origin.x+(scale*ratio*(this.x-origin.x));this.y=origin.y+(scale*(this.y-origin.y));this.clearBounds();return this;},intersects:function(geometry){var intersect=false;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.equals(geometry);}else{intersect=geometry.intersects(this);}  
return intersect;},transform:function(source,dest){if((source&&dest)){OpenLayers.Projection.transform(this,source,dest);this.bounds=null;}  
return this;},getVertices:function(nodes){return[this];},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Geometry.Rectangle=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,width:null,height:null,initialize:function(x,y,width,height){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=x;this.y=y;this.width=width;this.height=height;},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x+this.width,this.y+this.height);},getLength:function(){var length=(2*this.width)+(2*this.height);return length;},getArea:function(){var area=this.width*this.height;return area;},CLASS_NAME:"OpenLayers.Geometry.Rectangle"});OpenLayers.Geometry.Surface=OpenLayers.Class(OpenLayers.Geometry,{initialize:function(){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);},CLASS_NAME:"OpenLayers.Geometry.Surface"});OpenLayers.Layer.KaMapCache=OpenLayers.Class(OpenLayers.Layer.KaMap,{IMAGE_EXTENSIONS:{'jpeg':'jpg','gif':'gif','png':'png','png8':'png','png24':'png','dithered':'png'},DEFAULT_FORMAT:'jpeg',initialize:function(name,url,params,options){OpenLayers.Layer.KaMap.prototype.initialize.apply(this,arguments);this.extension=this.IMAGE_EXTENSIONS[this.params.i.toLowerCase()||DEFAULT_FORMAT];},getURL:function(bounds){bounds=this.adjustBounds(bounds);var mapRes=this.map.getResolution();var scale=Math.round((this.map.getScale()*10000))/10000;var pX=Math.round(bounds.left/mapRes);var pY=-Math.round(bounds.top/mapRes);var metaX=Math.floor(pX/this.tileSize.w/this.params.metaTileSize.w)*this.tileSize.w*this.params.metaTileSize.w;var metaY=Math.floor(pY/this.tileSize.h/this.params.metaTileSize.h)*this.tileSize.h*this.params.metaTileSize.h;var url=this.url;if(url instanceof Array){url=this.selectUrl(paramsString,url);}  
var components=[url,"/",this.params.map,"/",scale,"/",this.params.g.replace(/\s/g,'_'),"/def/t",metaY,"/l",metaX,"/t",pY,"l",pX,".",this.extension];return components.join("");},CLASS_NAME:"OpenLayers.Layer.KaMapCache"});OpenLayers.Layer.MapServer.Untiled=OpenLayers.Class(OpenLayers.Layer.MapServer,{singleTile:true,initialize:function(name,url,params,options){OpenLayers.Layer.MapServer.prototype.initialize.apply(this,arguments);var msg="The OpenLayers.Layer.MapServer.Untiled class is deprecated and "+"will be removed in 3.0. Instead, you should use the "+"normal OpenLayers.Layer.MapServer class, passing it the option "+"'singleTile' as true.";OpenLayers.Console.warn(msg);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.MapServer.Untiled(this.name,this.url,this.params,this.getOptions());}  
obj=OpenLayers.Layer.MapServer.prototype.clone.apply(this,[obj]);return obj;},CLASS_NAME:"OpenLayers.Layer.MapServer.Untiled"});OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{EVENT_TYPES:["beforefeatureadded","beforefeaturesadded","featureadded","featuresadded","beforefeatureremoved","beforefeaturesremoved","featureremoved","featuresremoved","beforefeatureselected","featureselected","featureunselected","beforefeaturemodified","featuremodified","afterfeaturemodified","vertexmodified","sketchstarted","sketchmodified","sketchcomplete","refresh"],isBaseLayer:false,isFixed:false,isVector:true,features:null,filter:null,selectedFeatures:null,unrenderedFeatures:null,reportError:true,style:null,styleMap:null,strategies:null,protocol:null,renderers:['SVG','VML','Canvas'],renderer:null,rendererOptions:null,geometryType:null,drawn:false,initialize:function(name,options){this.EVENT_TYPES=OpenLayers.Layer.Vector.prototype.EVENT_TYPES.concat(OpenLayers.Layer.prototype.EVENT_TYPES);OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(!this.renderer||!this.renderer.supported()){this.assignRenderer();}  
if(!this.renderer||!this.renderer.supported()){this.renderer=null;this.displayError();}  
if(!this.styleMap){this.styleMap=new OpenLayers.StyleMap();}  
this.features=[];this.selectedFeatures=[];this.unrenderedFeatures={};if(this.strategies){for(var i=0,len=this.strategies.length;i<len;i++){this.strategies[i].setLayer(this);}}},destroy:function(){if(this.strategies){var strategy,i,len;for(i=0,len=this.strategies.length;i<len;i++){strategy=this.strategies[i];if(strategy.autoDestroy){strategy.destroy();}}  
this.strategies=null;}  
if(this.protocol){if(this.protocol.autoDestroy){this.protocol.destroy();}  
this.protocol=null;}  
this.destroyFeatures();this.features=null;this.selectedFeatures=null;this.unrenderedFeatures=null;if(this.renderer){this.renderer.destroy();}  
this.renderer=null;this.geometryType=null;this.drawn=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.Vector(this.name,this.getOptions());}  
obj=OpenLayers.Layer.prototype.clone.apply(this,[obj]);var features=this.features;var len=features.length;var clonedFeatures=new Array(len);for(var i=0;i<len;++i){clonedFeatures[i]=features[i].clone();}  
obj.features=clonedFeatures;return obj;},refresh:function(obj){if(this.calculateInRange()&&this.visibility){this.events.triggerEvent("refresh",obj);}},assignRenderer:function(){for(var i=0,len=this.renderers.length;i<len;i++){var rendererClass=this.renderers[i];var renderer=(typeof rendererClass=="function")?rendererClass:OpenLayers.Renderer[rendererClass];if(renderer&&renderer.prototype.supported()){this.renderer=new renderer(this.div,this.rendererOptions);break;}}},displayError:function(){if(this.reportError){OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported",{'renderers':this.renderers.join("\n")}));}},setMap:function(map){OpenLayers.Layer.prototype.setMap.apply(this,arguments);if(!this.renderer){this.map.removeLayer(this);}else{this.renderer.map=this.map;this.renderer.setSize(this.map.getSize());}},afterAdd:function(){if(this.strategies){var strategy,i,len;for(i=0,len=this.strategies.length;i<len;i++){strategy=this.strategies[i];if(strategy.autoActivate){strategy.activate();}}}},removeMap:function(map){this.drawn=false;if(this.strategies){var strategy,i,len;for(i=0,len=this.strategies.length;i<len;i++){strategy=this.strategies[i];if(strategy.autoActivate){strategy.deactivate();}}}},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);this.renderer.setSize(this.map.getSize());},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var coordSysUnchanged=true;if(!dragging){this.renderer.root.style.visibility="hidden";this.div.style.left=-parseInt(this.map.layerContainerDiv.style.left)+"px";this.div.style.top=-parseInt(this.map.layerContainerDiv.style.top)+"px";var extent=this.map.getExtent();coordSysUnchanged=this.renderer.setExtent(extent,zoomChanged);this.renderer.root.style.visibility="visible";if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1){this.div.scrollLeft=this.div.scrollLeft;}  
if(!zoomChanged&&coordSysUnchanged){for(var i in this.unrenderedFeatures){var feature=this.unrenderedFeatures[i];this.drawFeature(feature);}}}  
if(!this.drawn||zoomChanged||!coordSysUnchanged){this.drawn=true;var feature;for(var i=0,len=this.features.length;i<len;i++){this.renderer.locked=(i!==(len-1));feature=this.features[i];this.drawFeature(feature);}}},display:function(display){OpenLayers.Layer.prototype.display.apply(this,arguments);var currentDisplay=this.div.style.display;if(currentDisplay!=this.renderer.root.style.display){this.renderer.root.style.display=currentDisplay;}},addFeatures:function(features,options){if(!(features instanceof Array)){features=[features];}  
var notify=!options||!options.silent;if(notify){var event={features:features};var ret=this.events.triggerEvent("beforefeaturesadded",event);if(ret===false){return;}  
features=event.features;}  
var featuresAdded=[];for(var i=0,len=features.length;i<len;i++){if(i!=(features.length-1)){this.renderer.locked=true;}else{this.renderer.locked=false;}  
var feature=features[i];if(this.geometryType&&!(feature.geometry instanceof this.geometryType)){var throwStr=OpenLayers.i18n('componentShouldBe',{'geomType':this.geometryType.prototype.CLASS_NAME});throw throwStr;}  
feature.layer=this;if(!feature.style&&this.style){feature.style=OpenLayers.Util.extend({},this.style);}  
if(notify){if(this.events.triggerEvent("beforefeatureadded",{feature:feature})===false){continue;};this.preFeatureInsert(feature);}  
featuresAdded.push(feature);this.features.push(feature);this.drawFeature(feature);if(notify){this.events.triggerEvent("featureadded",{feature:feature});this.onFeatureInsert(feature);}}  
if(notify){this.events.triggerEvent("featuresadded",{features:featuresAdded});}},removeFeatures:function(features,options){if(!features||features.length===0){return;}  
if(features===this.features){return this.removeAllFeatures(options);}  
if(!(features instanceof Array)){features=[features];}  
if(features===this.selectedFeatures){features=features.slice();}  
var notify=!options||!options.silent;if(notify){this.events.triggerEvent("beforefeaturesremoved",{features:features});}  
for(var i=features.length-1;i>=0;i--){if(i!=0&&features[i-1].geometry){this.renderer.locked=true;}else{this.renderer.locked=false;}  
var feature=features[i];delete this.unrenderedFeatures[feature.id];if(notify){this.events.triggerEvent("beforefeatureremoved",{feature:feature});}  
this.features=OpenLayers.Util.removeItem(this.features,feature);feature.layer=null;if(feature.geometry){this.renderer.eraseFeatures(feature);}  
if(OpenLayers.Util.indexOf(this.selectedFeatures,feature)!=-1){OpenLayers.Util.removeItem(this.selectedFeatures,feature);}  
if(notify){this.events.triggerEvent("featureremoved",{feature:feature});}}  
if(notify){this.events.triggerEvent("featuresremoved",{features:features});}},removeAllFeatures:function(options){var notify=!options||!options.silent;var features=this.features;if(notify){this.events.triggerEvent("beforefeaturesremoved",{features:features});}  
var feature;for(var i=features.length-1;i>=0;i--){feature=features[i];if(notify){this.events.triggerEvent("beforefeatureremoved",{feature:feature});}  
feature.layer=null;if(notify){this.events.triggerEvent("featureremoved",{feature:feature});}}  
this.renderer.clear();this.features=[];this.unrenderedFeatures={};this.selectedFeatures=[];if(notify){this.events.triggerEvent("featuresremoved",{features:features});}},destroyFeatures:function(features,options){var all=(features==undefined);if(all){features=this.features;}  
if(features){this.removeFeatures(features,options);for(var i=features.length-1;i>=0;i--){features[i].destroy();}}},drawFeature:function(feature,style){if(!this.drawn){return}  
if(typeof style!="object"){if(!style&&feature.state===OpenLayers.State.DELETE){style="delete";}  
var renderIntent=style||feature.renderIntent;style=feature.style||this.style;if(!style){style=this.styleMap.createSymbolizer(feature,renderIntent);}}  
if(!this.renderer.drawFeature(feature,style)){this.unrenderedFeatures[feature.id]=feature;}else{delete this.unrenderedFeatures[feature.id];};},eraseFeatures:function(features){this.renderer.eraseFeatures(features);},getFeatureFromEvent:function(evt){if(!this.renderer){OpenLayers.Console.error(OpenLayers.i18n("getFeatureError"));return null;}  
var featureId=this.renderer.getFeatureIdFromEvent(evt);return this.getFeatureById(featureId);},getFeatureBy:function(property,value){var feature=null;for(var i=0,len=this.features.length;i<len;++i){if(this.features[i][property]==value){feature=this.features[i];break;}}  
return feature;},getFeatureById:function(featureId){return this.getFeatureBy('id',featureId);},getFeatureByFid:function(featureFid){return this.getFeatureBy('fid',featureFid);},onFeatureInsert:function(feature){},preFeatureInsert:function(feature){},getDataExtent:function(){var maxExtent=null;var features=this.features;if(features&&(features.length>0)){maxExtent=new OpenLayers.Bounds();var geometry=null;for(var i=0,len=features.length;i<len;i++){geometry=features[i].geometry;if(geometry){maxExtent.extend(geometry.getBounds());}}}  
return maxExtent;},CLASS_NAME:"OpenLayers.Layer.Vector"});OpenLayers.Layer.WMS.Post=OpenLayers.Class(OpenLayers.Layer.WMS,{tileClass:null,unsupportedBrowsers:["mozilla","firefox","opera"],SUPPORTED_TRANSITIONS:[],initialize:function(name,url,params,options){var newArguments=[];newArguments.push(name,url,params,options);OpenLayers.Layer.WMS.prototype.initialize.apply(this,newArguments);this.tileClass=OpenLayers.Util.indexOf(this.unsupportedBrowsers,OpenLayers.Util.getBrowserName())!=-1?OpenLayers.Tile.Image:OpenLayers.Tile.Image.IFrame;},addTile:function(bounds,position){return new this.tileClass(this,position,bounds,null,this.tileSize);},CLASS_NAME:'OpenLayers.Layer.WMS.Post'});OpenLayers.Layer.WMS.Untiled=OpenLayers.Class(OpenLayers.Layer.WMS,{singleTile:true,initialize:function(name,url,params,options){OpenLayers.Layer.WMS.prototype.initialize.apply(this,arguments);var msg="The OpenLayers.Layer.WMS.Untiled class is deprecated and "+"will be removed in 3.0. Instead, you should use the "+"normal OpenLayers.Layer.WMS class, passing it the option "+"'singleTile' as true.";OpenLayers.Console.warn(msg);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.WMS.Untiled(this.name,this.url,this.params,this.getOptions());}  
obj=OpenLayers.Layer.WMS.prototype.clone.apply(this,[obj]);return obj;},CLASS_NAME:"OpenLayers.Layer.WMS.Untiled"});OpenLayers.Strategy.Filter=OpenLayers.Class(OpenLayers.Strategy,{filter:null,cache:null,caching:false,initialize:function(options){OpenLayers.Strategy.prototype.initialize.apply(this,[options]);if(!this.filter||!(this.filter instanceof OpenLayers.Filter)){throw new Error("Filter strategy must be constructed with a filter");}},activate:function(){var activated=OpenLayers.Strategy.prototype.activate.apply(this,arguments);if(activated){this.cache=[];this.layer.events.on({"beforefeaturesadded":this.handleAdd,"beforefeaturesremoved":this.handleRemove,scope:this});}  
return activated;},deactivate:function(){this.cache=null;if(this.layer&&this.layer.events){this.layer.events.un({"beforefeaturesadded":this.handleAdd,"beforefeaturesremoved":this.handleRemove,scope:this});}  
return OpenLayers.Strategy.prototype.deactivate.apply(this,arguments);},handleAdd:function(event){if(!this.caching){var features=event.features;event.features=[];var feature;for(var i=0,ii=features.length;i<ii;++i){feature=features[i];if(this.filter.evaluate(feature)){event.features.push(feature);}else{this.cache.push(feature);}}}},handleRemove:function(event){if(!this.caching){this.cache=[];}},setFilter:function(filter){this.filter=filter;var previousCache=this.cache;this.cache=[];this.handleAdd({features:this.layer.features});if(this.cache.length>0){this.caching=true;this.layer.removeFeatures(this.cache.slice(),{silent:true});this.caching=false;}  
if(previousCache.length>0){var event={features:previousCache};this.handleAdd(event);this.caching=true;this.layer.addFeatures(event.features,{silent:true});this.caching=false;}},CLASS_NAME:"OpenLayers.Strategy.Filter"});OpenLayers.Style2=OpenLayers.Class({id:null,name:null,title:null,description:null,layerName:null,isDefault:false,rules:null,initialize:function(config){OpenLayers.Util.extend(this,config);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){for(var i=0,len=this.rules.length;i<len;i++){this.rules[i].destroy();}  
delete this.rules;},clone:function(){var config=OpenLayers.Util.extend({},this);if(this.rules){config.rules=[];for(var i=0,len=this.rules.length;i<len;++i){config.rules.push(this.rules[i].clone());}}  
return new OpenLayers.Style2(config);},CLASS_NAME:"OpenLayers.Style2"});OpenLayers.Control.GetFeature=OpenLayers.Class(OpenLayers.Control,{protocol:null,multipleKey:null,toggleKey:null,modifiers:null,multiple:false,click:true,single:true,clickout:true,toggle:false,clickTolerance:5,hover:false,box:false,maxFeatures:10,features:null,hoverFeature:null,handlerOptions:null,handlers:null,hoverResponse:null,filterType:OpenLayers.Filter.Spatial.BBOX,EVENT_TYPES:["featureselected","featuresselected","featureunselected","clickout","beforefeatureselected","beforefeaturesselected","hoverfeature","outfeature"],initialize:function(options){this.EVENT_TYPES=OpenLayers.Control.GetFeature.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);options.handlerOptions=options.handlerOptions||{};OpenLayers.Control.prototype.initialize.apply(this,[options]);this.features={};this.handlers={};if(this.click){this.handlers.click=new OpenLayers.Handler.Click(this,{click:this.selectClick},this.handlerOptions.click||{});}  
if(this.box){this.handlers.box=new OpenLayers.Handler.Box(this,{done:this.selectBox},OpenLayers.Util.extend(this.handlerOptions.box,{boxDivClassName:"olHandlerBoxSelectFeature"}));}  
if(this.hover){this.handlers.hover=new OpenLayers.Handler.Hover(this,{'move':this.cancelHover,'pause':this.selectHover},OpenLayers.Util.extend(this.handlerOptions.hover,{'delay':250}));}},activate:function(){if(!this.active){for(var i in this.handlers){this.handlers[i].activate();}}  
return OpenLayers.Control.prototype.activate.apply(this,arguments);},deactivate:function(){if(this.active){for(var i in this.handlers){this.handlers[i].deactivate();}}  
return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},selectClick:function(evt){var bounds=this.pixelToBounds(evt.xy);this.setModifiers(evt);this.request(bounds,{single:this.single});},selectBox:function(position){var bounds;if(position instanceof OpenLayers.Bounds){var minXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.left,position.bottom));var maxXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.right,position.top));bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);}else{if(this.click){return;}  
bounds=this.pixelToBounds(position);}  
this.setModifiers(this.handlers.box.dragHandler.evt);this.request(bounds);},selectHover:function(evt){var bounds=this.pixelToBounds(evt.xy);this.request(bounds,{single:true,hover:true});},cancelHover:function(){if(this.hoverResponse){this.protocol.abort(this.hoverResponse);this.hoverResponse=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait");}},request:function(bounds,options){options=options||{};var filter=new OpenLayers.Filter.Spatial({type:this.filterType,value:bounds});OpenLayers.Element.addClass(this.map.viewPortDiv,"olCursorWait");var response=this.protocol.read({maxFeatures:options.single==true?this.maxFeatures:undefined,filter:filter,callback:function(result){if(result.success()){if(result.features.length){if(options.single==true){this.selectBestFeature(result.features,bounds.getCenterLonLat(),options);}else{this.select(result.features);}}else if(options.hover){this.hoverSelect();}else{this.events.triggerEvent("clickout");if(this.clickout){this.unselectAll();}}}  
OpenLayers.Element.removeClass(this.map.viewPortDiv,"olCursorWait");},scope:this});if(options.hover==true){this.hoverResponse=response;}},selectBestFeature:function(features,clickPosition,options){options=options||{};if(features.length){var point=new OpenLayers.Geometry.Point(clickPosition.lon,clickPosition.lat);var feature,resultFeature,dist;var minDist=Number.MAX_VALUE;for(var i=0;i<features.length;++i){feature=features[i];if(feature.geometry){dist=point.distanceTo(feature.geometry,{edge:false});if(dist<minDist){minDist=dist;resultFeature=feature;if(minDist==0){break;}}}}  
if(options.hover==true){this.hoverSelect(resultFeature);}else{this.select(resultFeature||features);}}},setModifiers:function(evt){this.modifiers={multiple:this.multiple||(this.multipleKey&&evt[this.multipleKey]),toggle:this.toggle||(this.toggleKey&&evt[this.toggleKey])};},select:function(features){if(!this.modifiers.multiple&&!this.modifiers.toggle){this.unselectAll();}  
if(!(features instanceof Array)){features=[features];}  
var cont=this.events.triggerEvent("beforefeaturesselected",{features:features});if(cont!==false){var selectedFeatures=[];var feature;for(var i=0,len=features.length;i<len;++i){feature=features[i];if(this.features[feature.fid||feature.id]){if(this.modifiers.toggle){this.unselect(this.features[feature.fid||feature.id]);}}else{cont=this.events.triggerEvent("beforefeatureselected",{feature:feature});if(cont!==false){this.features[feature.fid||feature.id]=feature;selectedFeatures.push(feature);this.events.triggerEvent("featureselected",{feature:feature});}}}  
this.events.triggerEvent("featuresselected",{features:selectedFeatures});}},hoverSelect:function(feature){var fid=feature?feature.fid||feature.id:null;var hfid=this.hoverFeature?this.hoverFeature.fid||this.hoverFeature.id:null;if(hfid&&hfid!=fid){this.events.triggerEvent("outfeature",{feature:this.hoverFeature});this.hoverFeature=null;}  
if(fid&&fid!=hfid){this.events.triggerEvent("hoverfeature",{feature:feature});this.hoverFeature=feature;}},unselect:function(feature){delete this.features[feature.fid||feature.id];this.events.triggerEvent("featureunselected",{feature:feature});},unselectAll:function(){for(var fid in this.features){this.unselect(this.features[fid]);}},setMap:function(map){for(var i in this.handlers){this.handlers[i].setMap(map);}  
OpenLayers.Control.prototype.setMap.apply(this,arguments);},pixelToBounds:function(pixel){var llPx=pixel.add(-this.clickTolerance/2,this.clickTolerance/2);var urPx=pixel.add(this.clickTolerance/2,-this.clickTolerance/2);var ll=this.map.getLonLatFromPixel(llPx);var ur=this.map.getLonLatFromPixel(urPx);return new OpenLayers.Bounds(ll.lon,ll.lat,ur.lon,ur.lat);},CLASS_NAME:"OpenLayers.Control.GetFeature"});OpenLayers.Control.Snapping=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["beforesnap","snap","unsnap"],DEFAULTS:{tolerance:10,node:true,edge:true,vertex:true},greedy:true,precedence:["node","vertex","edge"],resolution:null,geoToleranceCache:null,layer:null,feature:null,point:null,initialize:function(options){Array.prototype.push.apply(this.EVENT_TYPES,OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[options]);this.options=options||{};if(this.options.layer){this.setLayer(this.options.layer);}  
var defaults=OpenLayers.Util.extend({},this.options.defaults);this.defaults=OpenLayers.Util.applyDefaults(defaults,this.DEFAULTS);this.setTargets(this.options.targets);if(this.targets.length===0&&this.layer){this.addTargetLayer(this.layer);}  
this.geoToleranceCache={};},setLayer:function(layer){if(this.active){this.deactivate();this.layer=layer;this.activate();}else{this.layer=layer;}},setTargets:function(targets){this.targets=[];if(targets&&targets.length){var target;for(var i=0,len=targets.length;i<len;++i){target=targets[i];if(target instanceof OpenLayers.Layer.Vector){this.addTargetLayer(target);}else{this.addTarget(target);}}}},addTargetLayer:function(layer){this.addTarget({layer:layer});},addTarget:function(target){target=OpenLayers.Util.applyDefaults(target,this.defaults);target.nodeTolerance=target.nodeTolerance||target.tolerance;target.vertexTolerance=target.vertexTolerance||target.tolerance;target.edgeTolerance=target.edgeTolerance||target.tolerance;this.targets.push(target);},removeTargetLayer:function(layer){var target;for(var i=this.targets.length-1;i>=0;--i){target=this.targets[i];if(target.layer===layer){this.removeTarget(target);}}},removeTarget:function(target){return OpenLayers.Util.removeItem(this.targets,target);},activate:function(){var activated=OpenLayers.Control.prototype.activate.call(this);if(activated){if(this.layer&&this.layer.events){this.layer.events.on({sketchstarted:this.onSketchModified,sketchmodified:this.onSketchModified,vertexmodified:this.onVertexModified,scope:this});}}  
return activated;},deactivate:function(){var deactivated=OpenLayers.Control.prototype.deactivate.call(this);if(deactivated){if(this.layer&&this.layer.events){this.layer.events.un({sketchstarted:this.onSketchModified,sketchmodified:this.onSketchModified,vertexmodified:this.onVertexModified,scope:this});}}  
this.feature=null;this.point=null;return deactivated;},onSketchModified:function(event){this.feature=event.feature;this.considerSnapping(event.vertex,event.vertex);},onVertexModified:function(event){this.feature=event.feature;var loc=this.layer.map.getLonLatFromViewPortPx(event.pixel);this.considerSnapping(event.vertex,new OpenLayers.Geometry.Point(loc.lon,loc.lat));},considerSnapping:function(point,loc){var best={rank:Number.POSITIVE_INFINITY,dist:Number.POSITIVE_INFINITY,x:null,y:null};var snapped=false;var result,target;for(var i=0,len=this.targets.length;i<len;++i){target=this.targets[i];result=this.testTarget(target,loc);if(result){if(this.greedy){best=result;best.target=target;snapped=true;break;}else{if((result.rank<best.rank)||(result.rank===best.rank&&result.dist<best.dist)){best=result;best.target=target;snapped=true;}}}}  
if(snapped){var proceed=this.events.triggerEvent("beforesnap",{point:point,x:best.x,y:best.y,distance:best.dist,layer:best.target.layer,snapType:this.precedence[best.rank]});if(proceed!==false){point.x=best.x;point.y=best.y;this.point=point;this.events.triggerEvent("snap",{point:point,snapType:this.precedence[best.rank],layer:best.target.layer,distance:best.dist});}else{snapped=false;}}  
if(this.point&&!snapped){point.x=loc.x;point.y=loc.y;this.point=null;this.events.triggerEvent("unsnap",{point:point});}},testTarget:function(target,loc){var tolerance={node:this.getGeoTolerance(target.nodeTolerance),vertex:this.getGeoTolerance(target.vertexTolerance),edge:this.getGeoTolerance(target.edgeTolerance)};var maxTolerance=Math.max(tolerance.node,tolerance.vertex,tolerance.edge);var result={rank:Number.POSITIVE_INFINITY,dist:Number.POSITIVE_INFINITY};var eligible=false;var features=target.layer.features;var feature,type,vertices,vertex,closest,dist,found;var numTypes=this.precedence.length;var ll=new OpenLayers.LonLat(loc.x,loc.y);for(var i=0,len=features.length;i<len;++i){feature=features[i];if(feature!==this.feature&&!feature._sketch&&feature.state!==OpenLayers.State.DELETE&&(!target.filter||target.filter.evaluate(feature.attributes))){if(feature.atPoint(ll,maxTolerance,maxTolerance)){for(var j=0,stop=Math.min(result.rank+1,numTypes);j<stop;++j){type=this.precedence[j];if(target[type]){if(type==="edge"){closest=feature.geometry.distanceTo(loc,{details:true});dist=closest.distance;if(dist<=tolerance[type]&&dist<result.dist){result={rank:j,dist:dist,x:closest.x0,y:closest.y0};eligible=true;break;}}else{vertices=feature.geometry.getVertices(type==="node");found=false;for(var k=0,klen=vertices.length;k<klen;++k){vertex=vertices[k];dist=vertex.distanceTo(loc);if(dist<=tolerance[type]&&(j<result.rank||(j===result.rank&&dist<result.dist))){result={rank:j,dist:dist,x:vertex.x,y:vertex.y};eligible=true;found=true;}}  
if(found){break;}}}}}}}  
return eligible?result:null;},getGeoTolerance:function(tolerance){var resolution=this.layer.map.getResolution();if(resolution!==this.resolution){this.resolution=resolution;this.geoToleranceCache={};}  
var geoTolerance=this.geoToleranceCache[tolerance];if(geoTolerance===undefined){geoTolerance=tolerance*resolution;this.geoToleranceCache[tolerance]=geoTolerance;}  
return geoTolerance;},destroy:function(){if(this.active){this.deactivate();}  
delete this.layer;delete this.targets;OpenLayers.Control.prototype.destroy.call(this);},CLASS_NAME:"OpenLayers.Control.Snapping"});OpenLayers.Format.Filter=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:"1.0.0",version:null,parser:null,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},write:function(filter,options){var version=(options&&options.version)||this.version||this.defaultVersion;if(!this.parser||this.parser.VERSION!=version){var format=OpenLayers.Format.Filter["v"+version.replace(/\./g,"_")];if(!format){throw"Can't find a Filter parser for version "+  
version;}  
this.parser=new format(this.options);}  
return this.parser.write(filter);},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var version=this.version;if(!version){version=this.defaultVersion;}  
if(!this.parser||this.parser.VERSION!=version){var format=OpenLayers.Format.Filter["v"+version.replace(/\./g,"_")];if(!format){throw"Can't find a Filter parser for version "+  
version;}  
this.parser=new format(this.options);}  
var filter=this.parser.read(data);return filter;},CLASS_NAME:"OpenLayers.Format.Filter"});OpenLayers.Format.SLD=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:"1.0.0",version:null,namedLayersAsArray:false,parser:null,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},write:function(sld,options){var version=(options&&options.version)||this.version||this.defaultVersion;if(!this.parser||this.parser.VERSION!=version){var format=OpenLayers.Format.SLD["v"+version.replace(/\./g,"_")];if(!format){throw"Can't find a SLD parser for version "+  
version;}  
this.parser=new format(this.options);}  
var root=this.parser.write(sld);return OpenLayers.Format.XML.prototype.write.apply(this,[root]);},read:function(data,options){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var root=data.documentElement;var version=this.version;if(!version){version=root.getAttribute("version");if(!version){version=this.defaultVersion;}}  
if(!this.parser||this.parser.VERSION!=version){var format=OpenLayers.Format.SLD["v"+version.replace(/\./g,"_")];if(!format){throw"Can't find a SLD parser for version "+  
version;}  
this.parser=new format(this.options);}  
var sld=this.parser.read(data,options);return sld;},CLASS_NAME:"OpenLayers.Format.SLD"});OpenLayers.Format.Text=OpenLayers.Class(OpenLayers.Format,{defaultStyle:null,extractStyles:true,initialize:function(options){options=options||{};if(options.extractStyles!==false){options.defaultStyle={'externalGraphic':OpenLayers.Util.getImagesLocation()+"marker.png",'graphicWidth':21,'graphicHeight':25,'graphicXOffset':-10.5,'graphicYOffset':-12.5};}  
OpenLayers.Format.prototype.initialize.apply(this,[options]);},read:function(text){var lines=text.split('\n');var columns;var features=[];for(var lcv=0;lcv<(lines.length-1);lcv++){var currLine=lines[lcv].replace(/^\s*/,'').replace(/\s*$/,'');if(currLine.charAt(0)!='#'){if(!columns){columns=currLine.split('\t');}else{var vals=currLine.split('\t');var geometry=new OpenLayers.Geometry.Point(0,0);var attributes={};var style=this.defaultStyle?OpenLayers.Util.applyDefaults({},this.defaultStyle):null;var icon,iconSize,iconOffset,overflow;var set=false;for(var valIndex=0;valIndex<vals.length;valIndex++){if(vals[valIndex]){if(columns[valIndex]=='point'){var coords=vals[valIndex].split(',');geometry.y=parseFloat(coords[0]);geometry.x=parseFloat(coords[1]);set=true;}else if(columns[valIndex]=='lat'){geometry.y=parseFloat(vals[valIndex]);set=true;}else if(columns[valIndex]=='lon'){geometry.x=parseFloat(vals[valIndex]);set=true;}else if(columns[valIndex]=='title')  
attributes['title']=vals[valIndex];else if(columns[valIndex]=='image'||columns[valIndex]=='icon'&&style){style['externalGraphic']=vals[valIndex];}else if(columns[valIndex]=='iconSize'&&style){var size=vals[valIndex].split(',');style['graphicWidth']=parseFloat(size[0]);style['graphicHeight']=parseFloat(size[1]);}else if(columns[valIndex]=='iconOffset'&&style){var offset=vals[valIndex].split(',');style['graphicXOffset']=parseFloat(offset[0]);style['graphicYOffset']=parseFloat(offset[1]);}else if(columns[valIndex]=='description'){attributes['description']=vals[valIndex];}else if(columns[valIndex]=='overflow'){attributes['overflow']=vals[valIndex];}else{attributes[columns[valIndex]]=vals[valIndex];}}}  
if(set){if(this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection);}  
var feature=new OpenLayers.Feature.Vector(geometry,attributes,style);features.push(feature);}}}}  
return features;},CLASS_NAME:"OpenLayers.Format.Text"});OpenLayers.Geometry.MultiPoint=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(components){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments);},addPoint:function(point,index){this.addComponent(point,index);},removePoint:function(point){this.removeComponent(point);},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});OpenLayers.Handler.Point=OpenLayers.Class(OpenLayers.Handler,{point:null,layer:null,multi:false,drawing:false,mouseDown:false,lastDown:null,lastUp:null,persist:false,layerOptions:null,initialize:function(control,callbacks,options){if(!(options&&options.layerOptions&&options.layerOptions.styleMap)){this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style['default'],{});}  
OpenLayers.Handler.prototype.initialize.apply(this,arguments);},activate:function(){if(!OpenLayers.Handler.prototype.activate.apply(this,arguments)){return false;}  
var options=OpenLayers.Util.extend({displayInLayerSwitcher:false,calculateInRange:OpenLayers.Function.True},this.layerOptions);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,options);this.map.addLayer(this.layer);return true;},createFeature:function(pixel){var lonlat=this.map.getLonLatFromPixel(pixel);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat));this.callback("create",[this.point.geometry,this.point]);this.point.geometry.clearBounds();this.layer.addFeatures([this.point],{silent:true});},deactivate:function(){if(!OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){return false;}  
if(this.drawing){this.cancel();}  
this.destroyFeature();if(this.layer.map!=null){this.layer.destroy(false);}  
this.layer=null;return true;},destroyFeature:function(){if(this.layer){this.layer.destroyFeatures();}  
this.point=null;},finalize:function(cancel){var key=cancel?"cancel":"done";this.drawing=false;this.mouseDown=false;this.lastDown=null;this.lastUp=null;this.callback(key,[this.geometryClone()]);if(cancel||!this.persist){this.destroyFeature();}},cancel:function(){this.finalize(true);},click:function(evt){OpenLayers.Event.stop(evt);return false;},dblclick:function(evt){OpenLayers.Event.stop(evt);return false;},modifyFeature:function(pixel){var lonlat=this.map.getLonLatFromPixel(pixel);this.point.geometry.x=lonlat.lon;this.point.geometry.y=lonlat.lat;this.callback("modify",[this.point.geometry,this.point]);this.point.geometry.clearBounds();this.drawFeature();},drawFeature:function(){this.layer.drawFeature(this.point,this.style);},getGeometry:function(){var geometry=this.point&&this.point.geometry;if(geometry&&this.multi){geometry=new OpenLayers.Geometry.MultiPoint([geometry]);}  
return geometry;},geometryClone:function(){var geom=this.getGeometry();return geom&&geom.clone();},mousedown:function(evt){if(!this.checkModifiers(evt)){return true;}  
if(this.lastDown&&this.lastDown.equals(evt.xy)){return true;}  
this.drawing=true;if(this.lastDown==null){if(this.persist){this.destroyFeature();}  
this.createFeature(evt.xy);}else{this.modifyFeature(evt.xy);}  
this.lastDown=evt.xy;return false;},mousemove:function(evt){if(this.drawing){this.modifyFeature(evt.xy);}  
return true;},mouseup:function(evt){if(this.drawing){this.finalize();return false;}else{return true;}},CLASS_NAME:"OpenLayers.Handler.Point"});OpenLayers.Layer.GML=OpenLayers.Class(OpenLayers.Layer.Vector,{loaded:false,format:null,formatOptions:null,initialize:function(name,url,options){var newArguments=[];newArguments.push(name,options);OpenLayers.Layer.Vector.prototype.initialize.apply(this,newArguments);this.url=url;},setVisibility:function(visibility,noEvent){OpenLayers.Layer.Vector.prototype.setVisibility.apply(this,arguments);if(this.visibility&&!this.loaded){this.loadGML();}},moveTo:function(bounds,zoomChanged,minor){OpenLayers.Layer.Vector.prototype.moveTo.apply(this,arguments);if(this.visibility&&!this.loaded){this.loadGML();}},loadGML:function(){if(!this.loaded){this.events.triggerEvent("loadstart");OpenLayers.Request.GET({url:this.url,success:this.requestSuccess,failure:this.requestFailure,scope:this});this.loaded=true;}},setUrl:function(url){this.url=url;this.destroyFeatures();this.loaded=false;this.loadGML();},requestSuccess:function(request){var doc=request.responseXML;if(!doc||!doc.documentElement){doc=request.responseText;}  
var options={};OpenLayers.Util.extend(options,this.formatOptions);if(this.map&&!this.projection.equals(this.map.getProjectionObject())){options.externalProjection=this.projection;options.internalProjection=this.map.getProjectionObject();}  
var gml=this.format?new this.format(options):new OpenLayers.Format.GML(options);this.addFeatures(gml.read(doc));this.events.triggerEvent("loadend");},requestFailure:function(request){OpenLayers.Console.userError(OpenLayers.i18n("errorLoadingGML",{'url':this.url}));this.events.triggerEvent("loadend");},CLASS_NAME:"OpenLayers.Layer.GML"});OpenLayers.Layer.PointTrack=OpenLayers.Class(OpenLayers.Layer.Vector,{dataFrom:null,initialize:function(name,options){OpenLayers.Layer.Vector.prototype.initialize.apply(this,arguments);},addNodes:function(pointFeatures){if(pointFeatures.length<2){OpenLayers.Console.error("At least two point features have to be added to create"+"a line from");return;}  
var lines=new Array(pointFeatures.length-1);var pointFeature,startPoint,endPoint;for(var i=0,len=pointFeatures.length;i<len;i++){pointFeature=pointFeatures[i];endPoint=pointFeature.geometry;if(!endPoint){var lonlat=pointFeature.lonlat;endPoint=new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);}else if(endPoint.CLASS_NAME!="OpenLayers.Geometry.Point"){OpenLayers.Console.error("Only features with point geometries are supported.");return;}  
if(i>0){var attributes=(this.dataFrom!=null)?(pointFeatures[i+this.dataFrom].data||pointFeatures[i+this.dataFrom].attributes):null;var line=new OpenLayers.Geometry.LineString([startPoint,endPoint]);lines[i-1]=new OpenLayers.Feature.Vector(line,attributes);}  
startPoint=endPoint;}  
this.addFeatures(lines);},CLASS_NAME:"OpenLayers.Layer.PointTrack"});OpenLayers.Layer.PointTrack.dataFrom={'SOURCE_NODE':-1,'TARGET_NODE':0};OpenLayers.Layer.Vector.RootContainer=OpenLayers.Class(OpenLayers.Layer.Vector,{displayInLayerSwitcher:false,layers:null,initialize:function(name,options){OpenLayers.Layer.Vector.prototype.initialize.apply(this,arguments);},display:function(){},getFeatureFromEvent:function(evt){var layers=this.layers;var feature;for(var i=0;i<layers.length;i++){feature=layers[i].getFeatureFromEvent(evt);if(feature){return feature;}}},setMap:function(map){OpenLayers.Layer.Vector.prototype.setMap.apply(this,arguments);this.collectRoots();map.events.register("changelayer",this,this.handleChangeLayer);},removeMap:function(map){map.events.unregister("changelayer",this,this.handleChangeLayer);this.resetRoots();OpenLayers.Layer.Vector.prototype.removeMap.apply(this,arguments);},collectRoots:function(){var layer;for(var i=0;i<this.map.layers.length;++i){layer=this.map.layers[i];if(OpenLayers.Util.indexOf(this.layers,layer)!=-1){layer.renderer.moveRoot(this.renderer);}}},resetRoots:function(){var layer;for(var i=0;i<this.layers.length;++i){layer=this.layers[i];if(this.renderer&&layer.renderer.getRenderLayerId()==this.id){this.renderer.moveRoot(layer.renderer);}}},handleChangeLayer:function(evt){var layer=evt.layer;if(evt.property=="order"&&OpenLayers.Util.indexOf(this.layers,layer)!=-1){this.resetRoots();this.collectRoots();}},CLASS_NAME:"OpenLayers.Layer.Vector.RootContainer"});OpenLayers.Layer.WFS=OpenLayers.Class(OpenLayers.Layer.Vector,OpenLayers.Layer.Markers,{isBaseLayer:false,tile:null,ratio:2,DEFAULT_PARAMS:{service:"WFS",version:"1.0.0",request:"GetFeature"},featureClass:null,format:null,formatObject:null,formatOptions:null,vectorMode:true,encodeBBOX:false,extractAttributes:false,initialize:function(name,url,params,options){if(options==undefined){options={};}  
if(options.featureClass||!OpenLayers.Layer.Vector||!OpenLayers.Feature.Vector){this.vectorMode=false;}  
params=OpenLayers.Util.upperCaseObject(params);OpenLayers.Util.extend(options,{'reportError':false});var newArguments=[];newArguments.push(name,options);OpenLayers.Layer.Vector.prototype.initialize.apply(this,newArguments);if(!this.renderer||!this.vectorMode){this.vectorMode=false;if(!options.featureClass){options.featureClass=OpenLayers.Feature.WFS;}  
OpenLayers.Layer.Markers.prototype.initialize.apply(this,newArguments);}  
if(this.params&&this.params.typename&&!this.options.typename){this.options.typename=this.params.typename;}  
if(!this.options.geometry_column){this.options.geometry_column="the_geom";}  
this.params=OpenLayers.Util.applyDefaults(params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));this.url=url;},destroy:function(){if(this.vectorMode){OpenLayers.Layer.Vector.prototype.destroy.apply(this,arguments);}else{OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments);}  
if(this.tile){this.tile.destroy();}  
this.tile=null;this.ratio=null;this.featureClass=null;this.format=null;if(this.formatObject&&this.formatObject.destroy){this.formatObject.destroy();}  
this.formatObject=null;this.formatOptions=null;this.vectorMode=null;this.encodeBBOX=null;this.extractAttributes=null;},setMap:function(map){if(this.vectorMode){OpenLayers.Layer.Vector.prototype.setMap.apply(this,arguments);var options={'extractAttributes':this.extractAttributes};OpenLayers.Util.extend(options,this.formatOptions);if(this.map&&!this.projection.equals(this.map.getProjectionObject())){options.externalProjection=this.projection;options.internalProjection=this.map.getProjectionObject();}  
this.formatObject=this.format?new this.format(options):new OpenLayers.Format.GML(options);}else{OpenLayers.Layer.Markers.prototype.setMap.apply(this,arguments);}},moveTo:function(bounds,zoomChanged,dragging){if(this.vectorMode){OpenLayers.Layer.Vector.prototype.moveTo.apply(this,arguments);}else{OpenLayers.Layer.Markers.prototype.moveTo.apply(this,arguments);}  
if(dragging){return false;}  
if(zoomChanged){if(this.vectorMode){this.renderer.clear();}}  
if(this.options.minZoomLevel){OpenLayers.Console.warn(OpenLayers.i18n('minZoomLevelError'));if(this.map.getZoom()<this.options.minZoomLevel){return null;}}  
if(bounds==null){bounds=this.map.getExtent();}  
var firstRendering=(this.tile==null);var outOfBounds=(!firstRendering&&!this.tile.bounds.containsBounds(bounds));if(zoomChanged||firstRendering||(!dragging&&outOfBounds)){var center=bounds.getCenterLonLat();var tileWidth=bounds.getWidth()*this.ratio;var tileHeight=bounds.getHeight()*this.ratio;var tileBounds=new OpenLayers.Bounds(center.lon-(tileWidth/2),center.lat-(tileHeight/2),center.lon+(tileWidth/2),center.lat+(tileHeight/2));var tileSize=this.map.getSize();tileSize.w=tileSize.w*this.ratio;tileSize.h=tileSize.h*this.ratio;var ul=new OpenLayers.LonLat(tileBounds.left,tileBounds.top);var pos=this.map.getLayerPxFromLonLat(ul);var url=this.getFullRequestString();var params=null;var filter=this.params.filter||this.params.FILTER;if(filter){params={FILTER:filter};}  
else{params={BBOX:this.encodeBBOX?tileBounds.toBBOX():tileBounds.toArray()};}  
if(this.map&&!this.projection.equals(this.map.getProjectionObject())){var projectedBounds=tileBounds.clone();projectedBounds.transform(this.map.getProjectionObject(),this.projection);if(!filter){params.BBOX=this.encodeBBOX?projectedBounds.toBBOX():projectedBounds.toArray();}}  
url+="&"+OpenLayers.Util.getParameterString(params);if(!this.tile){this.tile=new OpenLayers.Tile.WFS(this,pos,tileBounds,url,tileSize);this.addTileMonitoringHooks(this.tile);this.tile.draw();}else{if(this.vectorMode){this.destroyFeatures();this.renderer.clear();}else{this.clearMarkers();}  
this.removeTileMonitoringHooks(this.tile);this.tile.destroy();this.tile=null;this.tile=new OpenLayers.Tile.WFS(this,pos,tileBounds,url,tileSize);this.addTileMonitoringHooks(this.tile);this.tile.draw();}}},addTileMonitoringHooks:function(tile){tile.onLoadStart=function(){if(this==this.layer.tile){this.layer.events.triggerEvent("loadstart");}};tile.events.register("loadstart",tile,tile.onLoadStart);tile.onLoadEnd=function(){if(this==this.layer.tile){this.layer.events.triggerEvent("tileloaded");this.layer.events.triggerEvent("loadend");}};tile.events.register("loadend",tile,tile.onLoadEnd);tile.events.register("unload",tile,tile.onLoadEnd);},removeTileMonitoringHooks:function(tile){tile.unload();tile.events.un({"loadstart":tile.onLoadStart,"loadend":tile.onLoadEnd,"unload":tile.onLoadEnd,scope:tile});},onMapResize:function(){if(this.vectorMode){OpenLayers.Layer.Vector.prototype.onMapResize.apply(this,arguments);}else{OpenLayers.Layer.Markers.prototype.onMapResize.apply(this,arguments);}},display:function(){if(this.vectorMode){OpenLayers.Layer.Vector.prototype.display.apply(this,arguments);}else{OpenLayers.Layer.Markers.prototype.display.apply(this,arguments);}},mergeNewParams:function(newParams){var upperParams=OpenLayers.Util.upperCaseObject(newParams);var newArguments=[upperParams];return OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,newArguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.WFS(this.name,this.url,this.params,this.getOptions());}  
if(this.vectorMode){obj=OpenLayers.Layer.Vector.prototype.clone.apply(this,[obj]);}else{obj=OpenLayers.Layer.Markers.prototype.clone.apply(this,[obj]);}  
return obj;},getFullRequestString:function(newParams,altUrl){var projectionCode=this.projection.getCode()||this.map.getProjection();this.params.SRS=(projectionCode=="none")?null:projectionCode;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments);},commit:function(){if(!this.writer){var options={};if(this.map&&!this.projection.equals(this.map.getProjectionObject())){options.externalProjection=this.projection;options.internalProjection=this.map.getProjectionObject();}  
this.writer=new OpenLayers.Format.WFS(options,this);}  
var data=this.writer.write(this.features);OpenLayers.Request.POST({url:this.url,data:data,success:this.commitSuccess,failure:this.commitFailure,scope:this});},commitSuccess:function(request){var response=request.responseText;if(response.indexOf('SUCCESS')!=-1){this.commitReport(OpenLayers.i18n("commitSuccess",{'response':response}));for(var i=0;i<this.features.length;i++){this.features[i].state=null;}}else if(response.indexOf('FAILED')!=-1||response.indexOf('Exception')!=-1){this.commitReport(OpenLayers.i18n("commitFailed",{'response':response}));}},commitFailure:function(request){},commitReport:function(string,response){OpenLayers.Console.userError(string);},refresh:function(){if(this.tile){if(this.vectorMode){this.renderer.clear();this.features.length=0;}else{this.clearMarkers();this.markers.length=0;}  
this.tile.draw();}},getDataExtent:function(){var extent;if(this.vectorMode){extent=OpenLayers.Layer.Vector.prototype.getDataExtent.apply(this);}else{extent=OpenLayers.Layer.Markers.prototype.getDataExtent.apply(this);}  
return extent;},setOpacity:function(opacity){if(this.vectorMode){OpenLayers.Layer.Vector.prototype.setOpacity.apply(this,[opacity]);}else{OpenLayers.Layer.Markers.prototype.setOpacity.apply(this,[opacity]);}},CLASS_NAME:"OpenLayers.Layer.WFS"});OpenLayers.Protocol.HTTP=OpenLayers.Class(OpenLayers.Protocol,{url:null,headers:null,params:null,callback:null,scope:null,readWithPOST:false,wildcarded:false,initialize:function(options){options=options||{};this.params={};this.headers={};OpenLayers.Protocol.prototype.initialize.apply(this,arguments);},destroy:function(){this.params=null;this.headers=null;OpenLayers.Protocol.prototype.destroy.apply(this);},read:function(options){OpenLayers.Protocol.prototype.read.apply(this,arguments);options=OpenLayers.Util.applyDefaults(options,this.options);options.params=OpenLayers.Util.applyDefaults(options.params,this.options.params);if(options.filter){options.params=this.filterToParams(options.filter,options.params);}  
var readWithPOST=(options.readWithPOST!==undefined)?options.readWithPOST:this.readWithPOST;var resp=new OpenLayers.Protocol.Response({requestType:"read"});if(readWithPOST){resp.priv=OpenLayers.Request.POST({url:options.url,callback:this.createCallback(this.handleRead,resp,options),data:OpenLayers.Util.getParameterString(options.params),headers:{"Content-Type":"application/x-www-form-urlencoded"}});}else{resp.priv=OpenLayers.Request.GET({url:options.url,callback:this.createCallback(this.handleRead,resp,options),params:options.params,headers:options.headers});}  
return resp;},handleRead:function(resp,options){this.handleResponse(resp,options);},filterToParams:function(filter,params){params=params||{};var className=filter.CLASS_NAME;var filterType=className.substring(className.lastIndexOf(".")+1);switch(filterType){case"Spatial":switch(filter.type){case OpenLayers.Filter.Spatial.BBOX:params.bbox=filter.value.toArray();break;case OpenLayers.Filter.Spatial.DWITHIN:params.tolerance=filter.distance;case OpenLayers.Filter.Spatial.WITHIN:params.lon=filter.value.x;params.lat=filter.value.y;break;default:OpenLayers.Console.warn("Unknown spatial filter type "+filter.type);}  
break;case"Comparison":var op=OpenLayers.Protocol.HTTP.COMP_TYPE_TO_OP_STR[filter.type];if(op!==undefined){var value=filter.value;if(filter.type==OpenLayers.Filter.Comparison.LIKE){value=this.regex2value(value);if(this.wildcarded){value="%"+value+"%";}}  
params[filter.property+"__"+op]=value;params.queryable=params.queryable||[];params.queryable.push(filter.property);}else{OpenLayers.Console.warn("Unknown comparison filter type "+filter.type);}  
break;case"Logical":if(filter.type===OpenLayers.Filter.Logical.AND){for(var i=0,len=filter.filters.length;i<len;i++){params=this.filterToParams(filter.filters[i],params);}}else{OpenLayers.Console.warn("Unsupported logical filter type "+filter.type);}  
break;default:OpenLayers.Console.warn("Unknown filter type "+filterType);}  
return params;},regex2value:function(value){value=value.replace(/%/g,"\\%");value=value.replace(/\\\\\.(\*)?/g,function($0,$1){return $1?$0:"\\\\_";});value=value.replace(/\\\\\.\*/g,"\\\\%");value=value.replace(/(\\)?\.(\*)?/g,function($0,$1,$2){return $1||$2?$0:"_";});value=value.replace(/(\\)?\.\*/g,function($0,$1){return $1?$0:"%";});value=value.replace(/\\\./g,".");value=value.replace(/(\\)?\\\*/g,function($0,$1){return $1?$0:"*";});return value;},create:function(features,options){options=OpenLayers.Util.applyDefaults(options,this.options);var resp=new OpenLayers.Protocol.Response({reqFeatures:features,requestType:"create"});resp.priv=OpenLayers.Request.POST({url:options.url,callback:this.createCallback(this.handleCreate,resp,options),headers:options.headers,data:this.format.write(features)});return resp;},handleCreate:function(resp,options){this.handleResponse(resp,options);},update:function(feature,options){options=options||{};var url=options.url||feature.url||this.options.url+"/"+feature.fid;options=OpenLayers.Util.applyDefaults(options,this.options);var resp=new OpenLayers.Protocol.Response({reqFeatures:feature,requestType:"update"});resp.priv=OpenLayers.Request.PUT({url:url,callback:this.createCallback(this.handleUpdate,resp,options),headers:options.headers,data:this.format.write(feature)});return resp;},handleUpdate:function(resp,options){this.handleResponse(resp,options);},"delete":function(feature,options){options=options||{};var url=options.url||feature.url||this.options.url+"/"+feature.fid;options=OpenLayers.Util.applyDefaults(options,this.options);var resp=new OpenLayers.Protocol.Response({reqFeatures:feature,requestType:"delete"});resp.priv=OpenLayers.Request.DELETE({url:url,callback:this.createCallback(this.handleDelete,resp,options),headers:options.headers});return resp;},handleDelete:function(resp,options){this.handleResponse(resp,options);},handleResponse:function(resp,options){var request=resp.priv;if(options.callback){if(request.status>=200&&request.status<300){if(resp.requestType!="delete"){resp.features=this.parseFeatures(request);}  
resp.code=OpenLayers.Protocol.Response.SUCCESS;}else{resp.code=OpenLayers.Protocol.Response.FAILURE;}  
options.callback.call(options.scope,resp);}},parseFeatures:function(request){var doc=request.responseXML;if(!doc||!doc.documentElement){doc=request.responseText;}  
if(!doc||doc.length<=0){return null;}  
return this.format.read(doc);},commit:function(features,options){options=OpenLayers.Util.applyDefaults(options,this.options);var resp=[],nResponses=0;var types={};types[OpenLayers.State.INSERT]=[];types[OpenLayers.State.UPDATE]=[];types[OpenLayers.State.DELETE]=[];var feature,list,requestFeatures=[];for(var i=0,len=features.length;i<len;++i){feature=features[i];list=types[feature.state];if(list){list.push(feature);requestFeatures.push(feature);}}  
var nRequests=(types[OpenLayers.State.INSERT].length>0?1:0)+  
types[OpenLayers.State.UPDATE].length+  
types[OpenLayers.State.DELETE].length;var success=true;var finalResponse=new OpenLayers.Protocol.Response({reqFeatures:requestFeatures});function insertCallback(response){var len=response.features?response.features.length:0;var fids=new Array(len);for(var i=0;i<len;++i){fids[i]=response.features[i].fid;}  
finalResponse.insertIds=fids;callback.apply(this,[response]);}  
function callback(response){this.callUserCallback(response,options);success=success&&response.success();nResponses++;if(nResponses>=nRequests){if(options.callback){finalResponse.code=success?OpenLayers.Protocol.Response.SUCCESS:OpenLayers.Protocol.Response.FAILURE;options.callback.apply(options.scope,[finalResponse]);}}}  
var queue=types[OpenLayers.State.INSERT];if(queue.length>0){resp.push(this.create(queue,OpenLayers.Util.applyDefaults({callback:insertCallback,scope:this},options.create)));}  
queue=types[OpenLayers.State.UPDATE];for(var i=queue.length-1;i>=0;--i){resp.push(this.update(queue[i],OpenLayers.Util.applyDefaults({callback:callback,scope:this},options.update)));}  
queue=types[OpenLayers.State.DELETE];for(var i=queue.length-1;i>=0;--i){resp.push(this["delete"](queue[i],OpenLayers.Util.applyDefaults({callback:callback,scope:this},options["delete"])));}  
return resp;},abort:function(response){if(response){response.priv.abort();}},callUserCallback:function(resp,options){var opt=options[resp.requestType];if(opt&&opt.callback){opt.callback.call(opt.scope,resp);}},CLASS_NAME:"OpenLayers.Protocol.HTTP"});(function(){var o=OpenLayers.Protocol.HTTP.COMP_TYPE_TO_OP_STR={};o[OpenLayers.Filter.Comparison.EQUAL_TO]="eq";o[OpenLayers.Filter.Comparison.NOT_EQUAL_TO]="ne";o[OpenLayers.Filter.Comparison.LESS_THAN]="lt";o[OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO]="lte";o[OpenLayers.Filter.Comparison.GREATER_THAN]="gt";o[OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO]="gte";o[OpenLayers.Filter.Comparison.LIKE]="ilike";})();OpenLayers.Strategy.BBOX=OpenLayers.Class(OpenLayers.Strategy,{bounds:null,resolution:null,ratio:2,resFactor:null,response:null,initialize:function(options){OpenLayers.Strategy.prototype.initialize.apply(this,[options]);},activate:function(){var activated=OpenLayers.Strategy.prototype.activate.call(this);if(activated){this.layer.events.on({"moveend":this.update,scope:this});this.layer.events.on({"refresh":this.update,scope:this});}  
return activated;},deactivate:function(){var deactivated=OpenLayers.Strategy.prototype.deactivate.call(this);if(deactivated){this.layer.events.un({"moveend":this.update,scope:this});this.layer.events.un({"refresh":this.update,scope:this});}  
return deactivated;},update:function(options){var mapBounds=this.getMapBounds();if((options&&options.force)||this.invalidBounds(mapBounds)){this.calculateBounds(mapBounds);this.resolution=this.layer.map.getResolution();this.triggerRead();}},getMapBounds:function(){var bounds=this.layer.map.getExtent();if(!this.layer.projection.equals(this.layer.map.getProjectionObject())){bounds=bounds.clone().transform(this.layer.map.getProjectionObject(),this.layer.projection);}  
return bounds;},invalidBounds:function(mapBounds){if(!mapBounds){mapBounds=this.getMapBounds();}  
var invalid=!this.bounds||!this.bounds.containsBounds(mapBounds);if(!invalid&&this.resFactor){var ratio=this.resolution/this.layer.map.getResolution();invalid=(ratio>=this.resFactor||ratio<=(1/this.resFactor));}  
return invalid;},calculateBounds:function(mapBounds){if(!mapBounds){mapBounds=this.getMapBounds();}  
var center=mapBounds.getCenterLonLat();var dataWidth=mapBounds.getWidth()*this.ratio;var dataHeight=mapBounds.getHeight()*this.ratio;this.bounds=new OpenLayers.Bounds(center.lon-(dataWidth/2),center.lat-(dataHeight/2),center.lon+(dataWidth/2),center.lat+(dataHeight/2));},triggerRead:function(){if(this.response){this.layer.protocol.abort(this.response);this.layer.events.triggerEvent("loadend");}  
this.layer.events.triggerEvent("loadstart");this.response=this.layer.protocol.read({filter:this.createFilter(),callback:this.merge,scope:this});},createFilter:function(){var filter=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.BBOX,value:this.bounds,projection:this.layer.projection});if(this.layer.filter){filter=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND,filters:[this.layer.filter,filter]});}  
return filter;},merge:function(resp){this.layer.destroyFeatures();var features=resp.features;if(features&&features.length>0){var remote=this.layer.projection;var local=this.layer.map.getProjectionObject();if(!local.equals(remote)){var geom;for(var i=0,len=features.length;i<len;++i){geom=features[i].geometry;if(geom){geom.transform(remote,local);}}}  
this.layer.addFeatures(features);}  
this.response=null;this.layer.events.triggerEvent("loadend");},CLASS_NAME:"OpenLayers.Strategy.BBOX"});OpenLayers.Control.SelectFeature=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["beforefeaturehighlighted","featurehighlighted","featureunhighlighted"],multipleKey:null,toggleKey:null,multiple:false,clickout:true,toggle:false,hover:false,highlightOnly:false,box:false,onBeforeSelect:function(){},onSelect:function(){},onUnselect:function(){},scope:null,geometryTypes:null,layer:null,layers:null,callbacks:null,selectStyle:null,renderIntent:"select",handlers:null,initialize:function(layers,options){this.EVENT_TYPES=OpenLayers.Control.SelectFeature.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[options]);if(this.scope===null){this.scope=this;}  
this.initLayer(layers);var callbacks={click:this.clickFeature,clickout:this.clickoutFeature};if(this.hover){callbacks.over=this.overFeature;callbacks.out=this.outFeature;}  
this.callbacks=OpenLayers.Util.extend(callbacks,this.callbacks);this.handlers={feature:new OpenLayers.Handler.Feature(this,this.layer,this.callbacks,{geometryTypes:this.geometryTypes})};if(this.box){this.handlers.box=new OpenLayers.Handler.Box(this,{done:this.selectBox},{boxDivClassName:"olHandlerBoxSelectFeature"});}},initLayer:function(layers){if(layers instanceof Array){this.layers=layers;this.layer=new OpenLayers.Layer.Vector.RootContainer(this.id+"_container",{layers:layers});}else{this.layer=layers;}},destroy:function(){if(this.active&&this.layers){this.map.removeLayer(this.layer);}  
OpenLayers.Control.prototype.destroy.apply(this,arguments);if(this.layers){this.layer.destroy();}},activate:function(){if(!this.active){if(this.layers){this.map.addLayer(this.layer);}  
this.handlers.feature.activate();if(this.box&&this.handlers.box){this.handlers.box.activate();}}  
return OpenLayers.Control.prototype.activate.apply(this,arguments);},deactivate:function(){if(this.active){this.handlers.feature.deactivate();if(this.handlers.box){this.handlers.box.deactivate();}  
if(this.layers){this.map.removeLayer(this.layer);}}  
return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},unselectAll:function(options){var layers=this.layers||[this.layer];var layer,feature;for(var l=0;l<layers.length;++l){layer=layers[l];for(var i=layer.selectedFeatures.length-1;i>=0;--i){feature=layer.selectedFeatures[i];if(!options||options.except!=feature){this.unselect(feature);}}}},clickFeature:function(feature){if(!this.hover){var selected=(OpenLayers.Util.indexOf(feature.layer.selectedFeatures,feature)>-1);if(selected){if(this.toggleSelect()){this.unselect(feature);}else if(!this.multipleSelect()){this.unselectAll({except:feature});}}else{if(!this.multipleSelect()){this.unselectAll({except:feature});}  
this.select(feature);}}},multipleSelect:function(){return this.multiple||(this.handlers.feature.evt&&this.handlers.feature.evt[this.multipleKey]);},toggleSelect:function(){return this.toggle||(this.handlers.feature.evt&&this.handlers.feature.evt[this.toggleKey]);},clickoutFeature:function(feature){if(!this.hover&&this.clickout){this.unselectAll();}},overFeature:function(feature){var layer=feature.layer;if(this.hover){if(this.highlightOnly){this.highlight(feature);}else if(OpenLayers.Util.indexOf(layer.selectedFeatures,feature)==-1){this.select(feature);}}},outFeature:function(feature){if(this.hover){if(this.highlightOnly){if(feature._lastHighlighter==this.id){if(feature._prevHighlighter&&feature._prevHighlighter!=this.id){delete feature._lastHighlighter;var control=this.map.getControl(feature._prevHighlighter);if(control){control.highlight(feature);}}else{this.unhighlight(feature);}}}else{this.unselect(feature);}}},highlight:function(feature){var layer=feature.layer;var cont=this.events.triggerEvent("beforefeaturehighlighted",{feature:feature});if(cont!==false){feature._prevHighlighter=feature._lastHighlighter;feature._lastHighlighter=this.id;var style=this.selectStyle||this.renderIntent;layer.drawFeature(feature,style);this.events.triggerEvent("featurehighlighted",{feature:feature});}},unhighlight:function(feature){var layer=feature.layer;feature._lastHighlighter=feature._prevHighlighter;delete feature._prevHighlighter;layer.drawFeature(feature,feature.style||feature.layer.style||"default");this.events.triggerEvent("featureunhighlighted",{feature:feature});},select:function(feature){var cont=this.onBeforeSelect.call(this.scope,feature);var layer=feature.layer;if(cont!==false){cont=layer.events.triggerEvent("beforefeatureselected",{feature:feature});if(cont!==false){layer.selectedFeatures.push(feature);this.highlight(feature);if(!this.handlers.feature.lastFeature){this.handlers.feature.lastFeature=layer.selectedFeatures[0];}  
layer.events.triggerEvent("featureselected",{feature:feature});this.onSelect.call(this.scope,feature);}}},unselect:function(feature){var layer=feature.layer;this.unhighlight(feature);OpenLayers.Util.removeItem(layer.selectedFeatures,feature);layer.events.triggerEvent("featureunselected",{feature:feature});this.onUnselect.call(this.scope,feature);},selectBox:function(position){if(position instanceof OpenLayers.Bounds){var minXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.left,position.bottom));var maxXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.right,position.top));var bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);if(!this.multipleSelect()){this.unselectAll();}  
var prevMultiple=this.multiple;this.multiple=true;var layers=this.layers||[this.layer];var layer;for(var l=0;l<layers.length;++l){layer=layers[l];for(var i=0,len=layer.features.length;i<len;++i){var feature=layer.features[i];if(!feature.getVisibility()){continue;}  
if(this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)>-1){if(bounds.toGeometry().intersects(feature.geometry)){if(OpenLayers.Util.indexOf(layer.selectedFeatures,feature)==-1){this.select(feature);}}}}}  
this.multiple=prevMultiple;}},setMap:function(map){this.handlers.feature.setMap(map);if(this.box){this.handlers.box.setMap(map);}  
OpenLayers.Control.prototype.setMap.apply(this,arguments);},setLayer:function(layers){var isActive=this.active;this.unselectAll();this.deactivate();if(this.layers){this.layer.destroy();this.layers=null;}  
this.initLayer(layers);this.handlers.feature.layer=this.layer;if(isActive){this.activate();}},CLASS_NAME:"OpenLayers.Control.SelectFeature"});OpenLayers.Format.Filter.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ogc:"http://www.opengis.net/ogc",gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},defaultPrefix:"ogc",schemaLocation:null,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(data){var obj={};this.readers.ogc["Filter"].apply(this,[data,obj]);return obj.filter;},readers:{"ogc":{"Filter":function(node,parent){var obj={fids:[],filters:[]};this.readChildNodes(node,obj);if(obj.fids.length>0){parent.filter=new OpenLayers.Filter.FeatureId({fids:obj.fids});}else if(obj.filters.length>0){parent.filter=obj.filters[0];}},"FeatureId":function(node,obj){var fid=node.getAttribute("fid");if(fid){obj.fids.push(fid);}},"And":function(node,obj){var filter=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.AND});this.readChildNodes(node,filter);obj.filters.push(filter);},"Or":function(node,obj){var filter=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.OR});this.readChildNodes(node,filter);obj.filters.push(filter);},"Not":function(node,obj){var filter=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.NOT});this.readChildNodes(node,filter);obj.filters.push(filter);},"PropertyIsLessThan":function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LESS_THAN});this.readChildNodes(node,filter);obj.filters.push(filter);},"PropertyIsGreaterThan":function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.GREATER_THAN});this.readChildNodes(node,filter);obj.filters.push(filter);},"PropertyIsLessThanOrEqualTo":function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO});this.readChildNodes(node,filter);obj.filters.push(filter);},"PropertyIsGreaterThanOrEqualTo":function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO});this.readChildNodes(node,filter);obj.filters.push(filter);},"PropertyIsBetween":function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.BETWEEN});this.readChildNodes(node,filter);obj.filters.push(filter);},"Literal":function(node,obj){obj.value=OpenLayers.String.numericIf(this.getChildValue(node));},"PropertyName":function(node,filter){filter.property=this.getChildValue(node);},"LowerBoundary":function(node,filter){filter.lowerBoundary=OpenLayers.String.numericIf(this.readOgcExpression(node));},"UpperBoundary":function(node,filter){filter.upperBoundary=OpenLayers.String.numericIf(this.readOgcExpression(node));},"Intersects":function(node,obj){this.readSpatial(node,obj,OpenLayers.Filter.Spatial.INTERSECTS);},"Within":function(node,obj){this.readSpatial(node,obj,OpenLayers.Filter.Spatial.WITHIN);},"Contains":function(node,obj){this.readSpatial(node,obj,OpenLayers.Filter.Spatial.CONTAINS);},"DWithin":function(node,obj){this.readSpatial(node,obj,OpenLayers.Filter.Spatial.DWITHIN);},"Distance":function(node,obj){obj.distance=parseInt(this.getChildValue(node));obj.distanceUnits=node.getAttribute("units");}}},readSpatial:function(node,obj,type){var filter=new OpenLayers.Filter.Spatial({type:type});this.readChildNodes(node,filter);filter.value=filter.components[0];delete filter.components;obj.filters.push(filter);},readOgcExpression:function(node){var obj={};this.readChildNodes(node,obj);var value=obj.value;if(value===undefined){value=this.getChildValue(node);}  
return value;},write:function(filter){return this.writers.ogc["Filter"].apply(this,[filter]);},writers:{"ogc":{"Filter":function(filter){var node=this.createElementNSPlus("ogc:Filter");var sub=filter.CLASS_NAME.split(".").pop();if(sub=="FeatureId"){for(var i=0;i<filter.fids.length;++i){this.writeNode("FeatureId",filter.fids[i],node);}}else{this.writeNode(this.getFilterType(filter),filter,node);}  
return node;},"FeatureId":function(fid){return this.createElementNSPlus("ogc:FeatureId",{attributes:{fid:fid}});},"And":function(filter){var node=this.createElementNSPlus("ogc:And");var childFilter;for(var i=0;i<filter.filters.length;++i){childFilter=filter.filters[i];this.writeNode(this.getFilterType(childFilter),childFilter,node);}  
return node;},"Or":function(filter){var node=this.createElementNSPlus("ogc:Or");var childFilter;for(var i=0;i<filter.filters.length;++i){childFilter=filter.filters[i];this.writeNode(this.getFilterType(childFilter),childFilter,node);}  
return node;},"Not":function(filter){var node=this.createElementNSPlus("ogc:Not");var childFilter=filter.filters[0];this.writeNode(this.getFilterType(childFilter),childFilter,node);return node;},"PropertyIsLessThan":function(filter){var node=this.createElementNSPlus("ogc:PropertyIsLessThan");this.writeNode("PropertyName",filter,node);this.writeNode("Literal",filter.value,node);return node;},"PropertyIsGreaterThan":function(filter){var node=this.createElementNSPlus("ogc:PropertyIsGreaterThan");this.writeNode("PropertyName",filter,node);this.writeNode("Literal",filter.value,node);return node;},"PropertyIsLessThanOrEqualTo":function(filter){var node=this.createElementNSPlus("ogc:PropertyIsLessThanOrEqualTo");this.writeNode("PropertyName",filter,node);this.writeNode("Literal",filter.value,node);return node;},"PropertyIsGreaterThanOrEqualTo":function(filter){var node=this.createElementNSPlus("ogc:PropertyIsGreaterThanOrEqualTo");this.writeNode("PropertyName",filter,node);this.writeNode("Literal",filter.value,node);return node;},"PropertyIsBetween":function(filter){var node=this.createElementNSPlus("ogc:PropertyIsBetween");this.writeNode("PropertyName",filter,node);this.writeNode("LowerBoundary",filter,node);this.writeNode("UpperBoundary",filter,node);return node;},"PropertyName":function(filter){return this.createElementNSPlus("ogc:PropertyName",{value:filter.property});},"Literal":function(value){return this.createElementNSPlus("ogc:Literal",{value:value});},"LowerBoundary":function(filter){var node=this.createElementNSPlus("ogc:LowerBoundary");this.writeNode("Literal",filter.lowerBoundary,node);return node;},"UpperBoundary":function(filter){var node=this.createElementNSPlus("ogc:UpperBoundary");this.writeNode("Literal",filter.upperBoundary,node);return node;},"INTERSECTS":function(filter){return this.writeSpatial(filter,"Intersects");},"WITHIN":function(filter){return this.writeSpatial(filter,"Within");},"CONTAINS":function(filter){return this.writeSpatial(filter,"Contains");},"DWITHIN":function(filter){var node=this.writeSpatial(filter,"DWithin");this.writeNode("Distance",filter,node);return node;},"Distance":function(filter){return this.createElementNSPlus("ogc:Distance",{attributes:{units:filter.distanceUnits},value:filter.distance});}}},getFilterType:function(filter){var filterType=this.filterMap[filter.type];if(!filterType){throw"Filter writing not supported for rule type: "+filter.type;}  
return filterType;},filterMap:{"&&":"And","||":"Or","!":"Not","==":"PropertyIsEqualTo","!=":"PropertyIsNotEqualTo","<":"PropertyIsLessThan",">":"PropertyIsGreaterThan","<=":"PropertyIsLessThanOrEqualTo",">=":"PropertyIsGreaterThanOrEqualTo","..":"PropertyIsBetween","~":"PropertyIsLike","BBOX":"BBOX","DWITHIN":"DWITHIN","WITHIN":"WITHIN","CONTAINS":"CONTAINS","INTERSECTS":"INTERSECTS"},CLASS_NAME:"OpenLayers.Format.Filter.v1"});OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(points){OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this,arguments);},getLength:function(){var length=0.0;if(this.components&&(this.components.length>1)){for(var i=1,len=this.components.length;i<len;i++){length+=this.components[i-1].distanceTo(this.components[i]);}}  
return length;},getGeodesicLength:function(projection){var geom=this;if(projection){var gg=new OpenLayers.Projection("EPSG:4326");if(!gg.equals(projection)){geom=this.clone().transform(projection,gg);}}  
var length=0.0;if(geom.components&&(geom.components.length>1)){var p1,p2;for(var i=1,len=geom.components.length;i<len;i++){p1=geom.components[i-1];p2=geom.components[i];length+=OpenLayers.Util.distVincenty({lon:p1.x,lat:p1.y},{lon:p2.x,lat:p2.y});}}  
return length*1000;},CLASS_NAME:"OpenLayers.Geometry.Curve"});OpenLayers.Layer.Text=OpenLayers.Class(OpenLayers.Layer.Markers,{location:null,features:null,formatOptions:null,selectedFeature:null,initialize:function(name,options){OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments);this.features=new Array();},destroy:function(){OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments);this.clearFeatures();this.features=null;},loadText:function(){if(!this.loaded){if(this.location!=null){var onFail=function(e){this.events.triggerEvent("loadend");};this.events.triggerEvent("loadstart");OpenLayers.Request.GET({url:this.location,success:this.parseData,failure:onFail,scope:this});this.loaded=true;}}},moveTo:function(bounds,zoomChanged,minor){OpenLayers.Layer.Markers.prototype.moveTo.apply(this,arguments);if(this.visibility&&!this.loaded){this.loadText();}},parseData:function(ajaxRequest){var text=ajaxRequest.responseText;var options={};OpenLayers.Util.extend(options,this.formatOptions);if(this.map&&!this.projection.equals(this.map.getProjectionObject())){options.externalProjection=this.projection;options.internalProjection=this.map.getProjectionObject();}  
var parser=new OpenLayers.Format.Text(options);var features=parser.read(text);for(var i=0,len=features.length;i<len;i++){var data={};var feature=features[i];var location;var iconSize,iconOffset;location=new OpenLayers.LonLat(feature.geometry.x,feature.geometry.y);if(feature.style.graphicWidth&&feature.style.graphicHeight){iconSize=new OpenLayers.Size(feature.style.graphicWidth,feature.style.graphicHeight);}  
if(feature.style.graphicXOffset!==undefined&&feature.style.graphicYOffset!==undefined){iconOffset=new OpenLayers.Pixel(feature.style.graphicXOffset,feature.style.graphicYOffset);}  
if(feature.style.externalGraphic!=null){data.icon=new OpenLayers.Icon(feature.style.externalGraphic,iconSize,iconOffset);}else{data.icon=OpenLayers.Marker.defaultIcon();if(iconSize!=null){data.icon.setSize(iconSize);}}  
if((feature.attributes.title!=null)&&(feature.attributes.description!=null)){data['popupContentHTML']='<h2>'+feature.attributes.title+'</h2>'+'<p>'+feature.attributes.description+'</p>';}  
data['overflow']=feature.attributes.overflow||"auto";var markerFeature=new OpenLayers.Feature(this,location,data);this.features.push(markerFeature);var marker=markerFeature.createMarker();if((feature.attributes.title!=null)&&(feature.attributes.description!=null)){marker.events.register('click',markerFeature,this.markerClick);}  
this.addMarker(marker);}  
this.events.triggerEvent("loadend");},markerClick:function(evt){var sameMarkerClicked=(this==this.layer.selectedFeature);this.layer.selectedFeature=(!sameMarkerClicked)?this:null;for(var i=0,len=this.layer.map.popups.length;i<len;i++){this.layer.map.removePopup(this.layer.map.popups[i]);}  
if(!sameMarkerClicked){this.layer.map.addPopup(this.createPopup());}  
OpenLayers.Event.stop(evt);},clearFeatures:function(){if(this.features!=null){while(this.features.length>0){var feature=this.features[0];OpenLayers.Util.removeItem(this.features,feature);feature.destroy();}}},CLASS_NAME:"OpenLayers.Layer.Text"});OpenLayers.Control.ModifyFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,clickout:true,toggle:true,standalone:false,layer:null,feature:null,vertices:null,virtualVertices:null,selectControl:null,dragControl:null,handlers:null,deleteCodes:null,virtualStyle:null,mode:null,modified:false,radiusHandle:null,dragHandle:null,onModificationStart:function(){},onModification:function(){},onModificationEnd:function(){},initialize:function(layer,options){this.layer=layer;this.vertices=[];this.virtualVertices=[];this.virtualStyle=OpenLayers.Util.extend({},this.layer.style||this.layer.styleMap.createSymbolizer());this.virtualStyle.fillOpacity=0.3;this.virtualStyle.strokeOpacity=0.3;this.deleteCodes=[46,68];this.mode=OpenLayers.Control.ModifyFeature.RESHAPE;OpenLayers.Control.prototype.initialize.apply(this,[options]);if(!(this.deleteCodes instanceof Array)){this.deleteCodes=[this.deleteCodes];}  
var control=this;var selectOptions={geometryTypes:this.geometryTypes,clickout:this.clickout,toggle:this.toggle,onBeforeSelect:this.beforeSelectFeature,onSelect:this.selectFeature,onUnselect:this.unselectFeature,scope:this};if(this.standalone===false){this.selectControl=new OpenLayers.Control.SelectFeature(layer,selectOptions);}  
var dragOptions={geometryTypes:["OpenLayers.Geometry.Point"],snappingOptions:this.snappingOptions,onStart:function(feature,pixel){control.dragStart.apply(control,[feature,pixel]);},onDrag:function(feature,pixel){control.dragVertex.apply(control,[feature,pixel]);},onComplete:function(feature){control.dragComplete.apply(control,[feature]);},featureCallbacks:{over:function(feature){if(control.standalone!==true||feature._sketch||control.feature===feature){control.dragControl.overFeature.apply(control.dragControl,[feature]);}}}};this.dragControl=new OpenLayers.Control.DragFeature(layer,dragOptions);var keyboardOptions={keydown:this.handleKeypress};this.handlers={keyboard:new OpenLayers.Handler.Keyboard(this,keyboardOptions)};},destroy:function(){this.layer=null;this.standalone||this.selectControl.destroy();this.dragControl.destroy();OpenLayers.Control.prototype.destroy.apply(this,[]);},activate:function(){return((this.standalone||this.selectControl.activate())&&this.handlers.keyboard.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments));},deactivate:function(){var deactivated=false;if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.layer.removeFeatures(this.vertices,{silent:true});this.layer.removeFeatures(this.virtualVertices,{silent:true});this.vertices=[];this.dragControl.deactivate();var feature=this.feature;var valid=feature&&feature.geometry&&feature.layer;if(this.standalone===false){if(valid){this.selectControl.unselect.apply(this.selectControl,[feature]);}  
this.selectControl.deactivate();}else{if(valid){this.unselectFeature(feature);}}  
this.handlers.keyboard.deactivate();deactivated=true;}  
return deactivated;},beforeSelectFeature:function(feature){return this.layer.events.triggerEvent("beforefeaturemodified",{feature:feature});},selectFeature:function(feature){this.feature=feature;this.modified=false;this.resetVertices();this.dragControl.activate();this.onModificationStart(this.feature);},unselectFeature:function(feature){this.layer.removeFeatures(this.vertices,{silent:true});this.vertices=[];this.layer.destroyFeatures(this.virtualVertices,{silent:true});this.virtualVertices=[];if(this.dragHandle){this.layer.destroyFeatures([this.dragHandle],{silent:true});delete this.dragHandle;}  
if(this.radiusHandle){this.layer.destroyFeatures([this.radiusHandle],{silent:true});delete this.radiusHandle;}  
this.feature=null;this.dragControl.deactivate();this.onModificationEnd(feature);this.layer.events.triggerEvent("afterfeaturemodified",{feature:feature,modified:this.modified});this.modified=false;},dragStart:function(feature,pixel){if(feature!=this.feature&&!feature.geometry.parent&&feature!=this.dragHandle&&feature!=this.radiusHandle){if(this.standalone===false&&this.feature){this.selectControl.clickFeature.apply(this.selectControl,[this.feature]);}  
if(this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)!=-1){this.standalone||this.selectControl.clickFeature.apply(this.selectControl,[feature]);this.dragControl.overFeature.apply(this.dragControl,[feature]);this.dragControl.lastPixel=pixel;this.dragControl.handlers.drag.started=true;this.dragControl.handlers.drag.start=pixel;this.dragControl.handlers.drag.last=pixel;}}},dragVertex:function(vertex,pixel){this.modified=true;if(this.feature.geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){if(this.feature!=vertex){this.feature=vertex;}  
this.layer.events.triggerEvent("vertexmodified",{vertex:vertex.geometry,feature:this.feature,pixel:pixel});}else{if(vertex._index){vertex.geometry.parent.addComponent(vertex.geometry,vertex._index);delete vertex._index;OpenLayers.Util.removeItem(this.virtualVertices,vertex);this.vertices.push(vertex);}else if(vertex==this.dragHandle){this.layer.removeFeatures(this.vertices,{silent:true});this.vertices=[];if(this.radiusHandle){this.layer.destroyFeatures([this.radiusHandle],{silent:true});this.radiusHandle=null;}}else if(vertex!==this.radiusHandle){this.layer.events.triggerEvent("vertexmodified",{vertex:vertex.geometry,feature:this.feature,pixel:pixel});}  
if(this.virtualVertices.length>0){this.layer.destroyFeatures(this.virtualVertices,{silent:true});this.virtualVertices=[];}  
this.layer.drawFeature(this.feature,this.standalone?undefined:this.selectControl.renderIntent);}  
this.layer.drawFeature(vertex);},dragComplete:function(vertex){this.resetVertices();this.setFeatureState();this.onModification(this.feature);this.layer.events.triggerEvent("featuremodified",{feature:this.feature});},setFeatureState:function(){if(this.feature.state!=OpenLayers.State.INSERT&&this.feature.state!=OpenLayers.State.DELETE){this.feature.state=OpenLayers.State.UPDATE;}},resetVertices:function(){if(this.dragControl.feature){this.dragControl.outFeature(this.dragControl.feature);}  
if(this.vertices.length>0){this.layer.removeFeatures(this.vertices,{silent:true});this.vertices=[];}  
if(this.virtualVertices.length>0){this.layer.removeFeatures(this.virtualVertices,{silent:true});this.virtualVertices=[];}  
if(this.dragHandle){this.layer.destroyFeatures([this.dragHandle],{silent:true});this.dragHandle=null;}  
if(this.radiusHandle){this.layer.destroyFeatures([this.radiusHandle],{silent:true});this.radiusHandle=null;}  
if(this.feature&&this.feature.geometry.CLASS_NAME!="OpenLayers.Geometry.Point"){if((this.mode&OpenLayers.Control.ModifyFeature.DRAG)){this.collectDragHandle();}  
if((this.mode&(OpenLayers.Control.ModifyFeature.ROTATE|OpenLayers.Control.ModifyFeature.RESIZE))){this.collectRadiusHandle();}  
if(this.mode&OpenLayers.Control.ModifyFeature.RESHAPE){if(!(this.mode&OpenLayers.Control.ModifyFeature.RESIZE)){this.collectVertices();}}}},handleKeypress:function(evt){var code=evt.keyCode;if(this.feature&&OpenLayers.Util.indexOf(this.deleteCodes,code)!=-1){var vertex=this.dragControl.feature;if(vertex&&OpenLayers.Util.indexOf(this.vertices,vertex)!=-1&&!this.dragControl.handlers.drag.dragging&&vertex.geometry.parent){vertex.geometry.parent.removeComponent(vertex.geometry);this.layer.drawFeature(this.feature,this.standalone?undefined:this.selectControl.renderIntent);this.resetVertices();this.setFeatureState();this.onModification(this.feature);this.layer.events.triggerEvent("featuremodified",{feature:this.feature});}}},collectVertices:function(){this.vertices=[];this.virtualVertices=[];var control=this;function collectComponentVertices(geometry){var i,vertex,component,len;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){vertex=new OpenLayers.Feature.Vector(geometry);vertex._sketch=true;control.vertices.push(vertex);}else{var numVert=geometry.components.length;if(geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){numVert-=1;}  
for(i=0;i<numVert;++i){component=geometry.components[i];if(component.CLASS_NAME=="OpenLayers.Geometry.Point"){vertex=new OpenLayers.Feature.Vector(component);vertex._sketch=true;control.vertices.push(vertex);}else{collectComponentVertices(component);}}  
if(geometry.CLASS_NAME!="OpenLayers.Geometry.MultiPoint"){for(i=0,len=geometry.components.length;i<len-1;++i){var prevVertex=geometry.components[i];var nextVertex=geometry.components[i+1];if(prevVertex.CLASS_NAME=="OpenLayers.Geometry.Point"&&nextVertex.CLASS_NAME=="OpenLayers.Geometry.Point"){var x=(prevVertex.x+nextVertex.x)/2;var y=(prevVertex.y+nextVertex.y)/2;var point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(x,y),null,control.virtualStyle);point.geometry.parent=geometry;point._index=i+1;point._sketch=true;control.virtualVertices.push(point);}}}}}  
collectComponentVertices.call(this,this.feature.geometry);this.layer.addFeatures(this.virtualVertices,{silent:true});this.layer.addFeatures(this.vertices,{silent:true});},collectDragHandle:function(){var geometry=this.feature.geometry;var center=geometry.getBounds().getCenterLonLat();var originGeometry=new OpenLayers.Geometry.Point(center.lon,center.lat);var origin=new OpenLayers.Feature.Vector(originGeometry);originGeometry.move=function(x,y){OpenLayers.Geometry.Point.prototype.move.call(this,x,y);geometry.move(x,y);};origin._sketch=true;this.dragHandle=origin;this.layer.addFeatures([this.dragHandle],{silent:true});},collectRadiusHandle:function(){var geometry=this.feature.geometry;var bounds=geometry.getBounds();var center=bounds.getCenterLonLat();var originGeometry=new OpenLayers.Geometry.Point(center.lon,center.lat);var radiusGeometry=new OpenLayers.Geometry.Point(bounds.right,bounds.bottom);var radius=new OpenLayers.Feature.Vector(radiusGeometry);var resize=(this.mode&OpenLayers.Control.ModifyFeature.RESIZE);var reshape=(this.mode&OpenLayers.Control.ModifyFeature.RESHAPE);var rotate=(this.mode&OpenLayers.Control.ModifyFeature.ROTATE);radiusGeometry.move=function(x,y){OpenLayers.Geometry.Point.prototype.move.call(this,x,y);var dx1=this.x-originGeometry.x;var dy1=this.y-originGeometry.y;var dx0=dx1-x;var dy0=dy1-y;if(rotate){var a0=Math.atan2(dy0,dx0);var a1=Math.atan2(dy1,dx1);var angle=a1-a0;angle*=180/Math.PI;geometry.rotate(angle,originGeometry);}  
if(resize){var scale,ratio;if(reshape){scale=dy1/dy0;ratio=(dx1/dx0)/scale;}else{var l0=Math.sqrt((dx0*dx0)+(dy0*dy0));var l1=Math.sqrt((dx1*dx1)+(dy1*dy1));scale=l1/l0;}  
geometry.resize(scale,originGeometry,ratio);}};radius._sketch=true;this.radiusHandle=radius;this.layer.addFeatures([this.radiusHandle],{silent:true});},setMap:function(map){this.standalone||this.selectControl.setMap(map);this.dragControl.setMap(map);OpenLayers.Control.prototype.setMap.apply(this,arguments);},CLASS_NAME:"OpenLayers.Control.ModifyFeature"});OpenLayers.Control.ModifyFeature.RESHAPE=1;OpenLayers.Control.ModifyFeature.RESIZE=2;OpenLayers.Control.ModifyFeature.ROTATE=4;OpenLayers.Control.ModifyFeature.DRAG=8;OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{initialize:function(points){OpenLayers.Geometry.Curve.prototype.initialize.apply(this,arguments);},removeComponent:function(point){if(this.components&&(this.components.length>2)){OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);}},intersects:function(geometry){var intersect=false;var type=geometry.CLASS_NAME;if(type=="OpenLayers.Geometry.LineString"||type=="OpenLayers.Geometry.LinearRing"||type=="OpenLayers.Geometry.Point"){var segs1=this.getSortedSegments();var segs2;if(type=="OpenLayers.Geometry.Point"){segs2=[{x1:geometry.x,y1:geometry.y,x2:geometry.x,y2:geometry.y}];}else{segs2=geometry.getSortedSegments();}  
var seg1,seg1x1,seg1x2,seg1y1,seg1y2,seg2,seg2y1,seg2y2;outer:for(var i=0,len=segs1.length;i<len;++i){seg1=segs1[i];seg1x1=seg1.x1;seg1x2=seg1.x2;seg1y1=seg1.y1;seg1y2=seg1.y2;inner:for(var j=0,jlen=segs2.length;j<jlen;++j){seg2=segs2[j];if(seg2.x1>seg1x2){break;}  
if(seg2.x2<seg1x1){continue;}  
seg2y1=seg2.y1;seg2y2=seg2.y2;if(Math.min(seg2y1,seg2y2)>Math.max(seg1y1,seg1y2)){continue;}  
if(Math.max(seg2y1,seg2y2)<Math.min(seg1y1,seg1y2)){continue;}  
if(OpenLayers.Geometry.segmentsIntersect(seg1,seg2)){intersect=true;break outer;}}}}else{intersect=geometry.intersects(this);}  
return intersect;},getSortedSegments:function(){var numSeg=this.components.length-1;var segments=new Array(numSeg),point1,point2;for(var i=0;i<numSeg;++i){point1=this.components[i];point2=this.components[i+1];if(point1.x<point2.x){segments[i]={x1:point1.x,y1:point1.y,x2:point2.x,y2:point2.y};}else{segments[i]={x1:point2.x,y1:point2.y,x2:point1.x,y2:point1.y};}}  
function byX1(seg1,seg2){return seg1.x1-seg2.x1;}  
return segments.sort(byX1);},splitWithSegment:function(seg,options){var edge=!(options&&options.edge===false);var tolerance=options&&options.tolerance;var lines=[];var verts=this.getVertices();var points=[];var intersections=[];var split=false;var vert1,vert2,point;var node,vertex,target;var interOptions={point:true,tolerance:tolerance};var result=null;for(var i=0,stop=verts.length-2;i<=stop;++i){vert1=verts[i];points.push(vert1.clone());vert2=verts[i+1];target={x1:vert1.x,y1:vert1.y,x2:vert2.x,y2:vert2.y};point=OpenLayers.Geometry.segmentsIntersect(seg,target,interOptions);if(point instanceof OpenLayers.Geometry.Point){if((point.x===seg.x1&&point.y===seg.y1)||(point.x===seg.x2&&point.y===seg.y2)||point.equals(vert1)||point.equals(vert2)){vertex=true;}else{vertex=false;}  
if(vertex||edge){if(!point.equals(intersections[intersections.length-1])){intersections.push(point.clone());}  
if(i===0){if(point.equals(vert1)){continue;}}  
if(point.equals(vert2)){continue;}  
split=true;if(!point.equals(vert1)){points.push(point);}  
lines.push(new OpenLayers.Geometry.LineString(points));points=[point.clone()];}}}  
if(split){points.push(vert2.clone());lines.push(new OpenLayers.Geometry.LineString(points));}  
if(intersections.length>0){var xDir=seg.x1<seg.x2?1:-1;var yDir=seg.y1<seg.y2?1:-1;result={lines:lines,points:intersections.sort(function(p1,p2){return(xDir*p1.x-xDir*p2.x)||(yDir*p1.y-yDir*p2.y);})};}  
return result;},split:function(target,options){var results=null;var mutual=options&&options.mutual;var sourceSplit,targetSplit,sourceParts,targetParts;if(target instanceof OpenLayers.Geometry.LineString){var verts=this.getVertices();var vert1,vert2,seg,splits,lines,point;var points=[];sourceParts=[];for(var i=0,stop=verts.length-2;i<=stop;++i){vert1=verts[i];vert2=verts[i+1];seg={x1:vert1.x,y1:vert1.y,x2:vert2.x,y2:vert2.y};targetParts=targetParts||[target];if(mutual){points.push(vert1.clone());}  
for(var j=0;j<targetParts.length;++j){splits=targetParts[j].splitWithSegment(seg,options);if(splits){lines=splits.lines;if(lines.length>0){lines.unshift(j,1);Array.prototype.splice.apply(targetParts,lines);j+=lines.length-2;}  
if(mutual){for(var k=0,len=splits.points.length;k<len;++k){point=splits.points[k];if(!point.equals(vert1)){points.push(point);sourceParts.push(new OpenLayers.Geometry.LineString(points));if(point.equals(vert2)){points=[];}else{points=[point.clone()];}}}}}}}  
if(mutual&&sourceParts.length>0&&points.length>0){points.push(vert2.clone());sourceParts.push(new OpenLayers.Geometry.LineString(points));}}else{results=target.splitWith(this,options);}  
if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];}  
if(sourceParts&&sourceParts.length>1){sourceSplit=true;}else{sourceParts=[];}  
if(targetSplit||sourceSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}}  
return results;},splitWith:function(geometry,options){return geometry.split(this,options);},getVertices:function(nodes){var vertices;if(nodes===true){vertices=[this.components[0],this.components[this.components.length-1]];}else if(nodes===false){vertices=this.components.slice(1,this.components.length-1);}else{vertices=this.components.slice();}  
return vertices;},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var result,best={};var min=Number.POSITIVE_INFINITY;if(geometry instanceof OpenLayers.Geometry.Point){var segs=this.getSortedSegments();var x=geometry.x;var y=geometry.y;var seg;for(var i=0,len=segs.length;i<len;++i){seg=segs[i];result=OpenLayers.Geometry.distanceToSegment(geometry,seg);if(result.distance<min){min=result.distance;best=result;if(min===0){break;}}else{if(seg.x2>x&&((y>seg.y1&&y<seg.y2)||(y<seg.y1&&y>seg.y2))){break;}}}  
if(details){best={distance:best.distance,x0:best.x,y0:best.y,x1:x,y1:y};}else{best=best.distance;}}else if(geometry instanceof OpenLayers.Geometry.LineString){var segs0=this.getSortedSegments();var segs1=geometry.getSortedSegments();var seg0,seg1,intersection,x0,y0;var len1=segs1.length;var interOptions={point:true};outer:for(var i=0,len=segs0.length;i<len;++i){seg0=segs0[i];x0=seg0.x1;y0=seg0.y1;for(var j=0;j<len1;++j){seg1=segs1[j];intersection=OpenLayers.Geometry.segmentsIntersect(seg0,seg1,interOptions);if(intersection){min=0;best={distance:0,x0:intersection.x,y0:intersection.y,x1:intersection.x,y1:intersection.y};break outer;}else{result=OpenLayers.Geometry.distanceToSegment({x:x0,y:y0},seg1);if(result.distance<min){min=result.distance;best={distance:min,x0:x0,y0:y0,x1:result.x,y1:result.y};}}}}  
if(!details){best=best.distance;}  
if(min!==0){if(seg0){result=geometry.distanceTo(new OpenLayers.Geometry.Point(seg0.x2,seg0.y2),options);var dist=details?result.distance:result;if(dist<min){if(details){best={distance:min,x0:result.x1,y0:result.y1,x1:result.x0,y1:result.y0};}else{best=dist;}}}}}else{best=geometry.distanceTo(this,options);if(details){best={distance:best.distance,x0:best.x1,y0:best.y1,x1:best.x0,y1:best.y0};}}  
return best;},CLASS_NAME:"OpenLayers.Geometry.LineString"});OpenLayers.Control.TransformFeature=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["beforesetfeature","setfeature","beforetransform","transform","transformcomplete"],geometryTypes:null,layer:null,preserveAspectRatio:false,rotate:true,feature:null,renderIntent:"temporary",rotationHandleSymbolizer:null,box:null,center:null,scale:1,ratio:1,rotation:0,handles:null,rotationHandles:null,dragControl:null,initialize:function(layer,options){this.EVENT_TYPES=OpenLayers.Control.TransformFeature.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[options]);this.layer=layer;if(!this.rotationHandleSymbolizer){this.rotationHandleSymbolizer={stroke:false,pointRadius:10,fillOpacity:0,cursor:"pointer"};}  
this.createBox();this.createControl();},activate:function(){var activated=false;if(OpenLayers.Control.prototype.activate.apply(this,arguments)){this.dragControl.activate();this.layer.addFeatures([this.box]);this.rotate&&this.layer.addFeatures(this.rotationHandles);this.layer.addFeatures(this.handles);activated=true;}  
return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.layer.removeFeatures(this.handles);this.rotate&&this.layer.removeFeatures(this.rotationHandles);this.layer.removeFeatures([this.box]);this.dragControl.deactivate();deactivated=true;}  
return deactivated;},setMap:function(map){this.dragControl.setMap(map);OpenLayers.Control.prototype.setMap.apply(this,arguments);},setFeature:function(feature,initialParams){initialParams=OpenLayers.Util.applyDefaults(initialParams,{rotation:0,scale:1,ratio:1});var evt={feature:feature};var oldRotation=this.rotation;var oldCenter=this.center;OpenLayers.Util.extend(this,initialParams);if(this.events.triggerEvent("beforesetfeature",evt)===false){return;}  
this.feature=feature;this.activate();this._setfeature=true;var featureBounds=this.feature.geometry.getBounds();this.box.move(featureBounds.getCenterLonLat());this.box.geometry.rotate(-oldRotation,oldCenter);this._angle=0;var ll;if(this.rotation){var geom=feature.geometry.clone();geom.rotate(-this.rotation,this.center);var box=new OpenLayers.Feature.Vector(geom.getBounds().toGeometry());box.geometry.rotate(this.rotation,this.center);this.box.geometry.rotate(this.rotation,this.center);this.box.move(box.geometry.getBounds().getCenterLonLat());var llGeom=box.geometry.components[0].components[0];ll=llGeom.getBounds().getCenterLonLat();}else{ll=new OpenLayers.LonLat(featureBounds.left,featureBounds.bottom);}  
this.handles[0].move(ll);delete this._setfeature;this.events.triggerEvent("setfeature",evt);},createBox:function(){var control=this;this.center=new OpenLayers.Geometry.Point(0,0);var box=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([new OpenLayers.Geometry.Point(-1,-1),new OpenLayers.Geometry.Point(0,-1),new OpenLayers.Geometry.Point(1,-1),new OpenLayers.Geometry.Point(1,0),new OpenLayers.Geometry.Point(1,1),new OpenLayers.Geometry.Point(0,1),new OpenLayers.Geometry.Point(-1,1),new OpenLayers.Geometry.Point(-1,0),new OpenLayers.Geometry.Point(-1,-1)]),null,typeof this.renderIntent=="string"?null:this.renderIntent);box.geometry.move=function(x,y){control._moving=true;OpenLayers.Geometry.LineString.prototype.move.apply(this,arguments);control.center.move(x,y);delete control._moving;};var vertexMoveFn=function(x,y){OpenLayers.Geometry.Point.prototype.move.apply(this,arguments);this._rotationHandle&&this._rotationHandle.geometry.move(x,y);this._handle.geometry.move(x,y);};var vertexResizeFn=function(scale,center,ratio){OpenLayers.Geometry.Point.prototype.resize.apply(this,arguments);this._rotationHandle&&this._rotationHandle.geometry.resize(scale,center,ratio);this._handle.geometry.resize(scale,center,ratio);};var vertexRotateFn=function(angle,center){OpenLayers.Geometry.Point.prototype.rotate.apply(this,arguments);this._rotationHandle&&this._rotationHandle.geometry.rotate(angle,center);this._handle.geometry.rotate(angle,center);};var handleMoveFn=function(x,y){var oldX=this.x,oldY=this.y;OpenLayers.Geometry.Point.prototype.move.call(this,x,y);if(control._moving){return;}  
var evt=control.dragControl.handlers.drag.evt;var preserveAspectRatio=!control._setfeature&&control.preserveAspectRatio;var reshape=!preserveAspectRatio&&!(evt&&evt.shiftKey);var oldGeom=new OpenLayers.Geometry.Point(oldX,oldY);var centerGeometry=control.center;this.rotate(-control.rotation,centerGeometry);oldGeom.rotate(-control.rotation,centerGeometry);var dx1=this.x-centerGeometry.x;var dy1=this.y-centerGeometry.y;var dx0=dx1-(this.x-oldGeom.x);var dy0=dy1-(this.y-oldGeom.y);this.x=oldX;this.y=oldY;var scale,ratio=1;if(reshape){scale=Math.abs(dy0)<0.00001?1:dy1/dy0;ratio=(Math.abs(dx0)<0.00001?1:(dx1/dx0))/scale;}else{var l0=Math.sqrt((dx0*dx0)+(dy0*dy0));var l1=Math.sqrt((dx1*dx1)+(dy1*dy1));scale=l1/l0;}  
control._moving=true;control.box.geometry.rotate(-control.rotation,centerGeometry);delete control._moving;control.box.geometry.resize(scale,centerGeometry,ratio);control.box.geometry.rotate(control.rotation,centerGeometry);control.transformFeature({scale:scale,ratio:ratio});};var rotationHandleMoveFn=function(x,y){var oldX=this.x,oldY=this.y;OpenLayers.Geometry.Point.prototype.move.call(this,x,y);if(control._moving){return;}  
var evt=control.dragControl.handlers.drag.evt;var constrain=(evt&&evt.shiftKey)?45:1;var centerGeometry=control.center;var dx1=this.x-centerGeometry.x;var dy1=this.y-centerGeometry.y;var dx0=dx1-x;var dy0=dy1-y;this.x=oldX;this.y=oldY;var a0=Math.atan2(dy0,dx0);var a1=Math.atan2(dy1,dx1);var angle=a1-a0;angle*=180/Math.PI;control._angle=(control._angle+angle)%360;var diff=control.rotation%constrain;if(Math.abs(control._angle)>=constrain||diff!==0){angle=Math.round(control._angle/constrain)*constrain-  
diff;control._angle=0;control.box.geometry.rotate(angle,centerGeometry);control.transformFeature({rotation:angle});}};var handles=new Array(8);var rotationHandles=new Array(4);var geom,handle,rotationHandle;for(var i=0;i<8;++i){geom=box.geometry.components[i];handle=new OpenLayers.Feature.Vector(geom.clone(),null,typeof this.renderIntent=="string"?null:this.renderIntent);if(i%2==0){rotationHandle=new OpenLayers.Feature.Vector(geom.clone(),null,typeof this.rotationHandleSymbolizer=="string"?null:this.rotationHandleSymbolizer);rotationHandle.geometry.move=rotationHandleMoveFn;geom._rotationHandle=rotationHandle;rotationHandles[i/2]=rotationHandle;}  
geom.move=vertexMoveFn;geom.resize=vertexResizeFn;geom.rotate=vertexRotateFn;handle.geometry.move=handleMoveFn;geom._handle=handle;handles[i]=handle;}  
this.box=box;this.rotationHandles=rotationHandles;this.handles=handles;},createControl:function(){var control=this;this.dragControl=new OpenLayers.Control.DragFeature(this.layer,{documentDrag:true,moveFeature:function(pixel){if(this.feature===control.feature){this.feature=control.box;}  
OpenLayers.Control.DragFeature.prototype.moveFeature.apply(this,arguments);},onDrag:function(feature,pixel){if(feature===control.box){control.transformFeature({center:control.center});control.drawHandles();}},onStart:function(feature,pixel){var eligible=!control.geometryTypes||OpenLayers.Util.indexOf(control.geometryTypes,feature.geometry.CLASS_NAME)!==-1;var i=OpenLayers.Util.indexOf(control.handles,feature);i+=OpenLayers.Util.indexOf(control.rotationHandles,feature);if(feature!==control.feature&&feature!==control.box&&i==-2&&eligible){control.setFeature(feature);}},onComplete:function(feature,pixel){control.events.triggerEvent("transformcomplete",{feature:control.feature});}});},drawHandles:function(){var layer=this.layer;for(var i=0;i<8;++i){if(this.rotate&&i%2===0){layer.drawFeature(this.rotationHandles[i/2],this.rotationHandleSymbolizer);}  
layer.drawFeature(this.handles[i],this.renderIntent);}},transformFeature:function(mods){if(!this._setfeature){this.scale*=(mods.scale||1);this.ratio*=(mods.ratio||1);var oldRotation=this.rotation;this.rotation=(this.rotation+(mods.rotation||0))%360;if(this.events.triggerEvent("beforetransform",mods)!==false){var feature=this.feature;var geom=feature.geometry;var center=this.center;geom.rotate(-oldRotation,center);if(mods.scale||mods.ratio){geom.resize(mods.scale,center,mods.ratio);}else if(mods.center){feature.move(mods.center.getBounds().getCenterLonLat());}  
geom.rotate(this.rotation,center);this.layer.drawFeature(feature);feature.toState(OpenLayers.State.UPDATE);this.events.triggerEvent("transform",mods);}}  
this.layer.drawFeature(this.box,this.renderIntent);this.drawHandles();},destroy:function(){var geom;for(var i=0;i<8;++i){geom=this.box.geometry.components[i];geom._handle.destroy();geom._handle=null;geom._rotationHandle&&geom._rotationHandle.destroy();geom._rotationHandle=null;}  
this.box.destroy();this.box=null;this.layer=null;this.dragControl.destroy();OpenLayers.Control.prototype.destroy.apply(this,arguments);},CLASS_NAME:"OpenLayers.Control.TransformFeature"});OpenLayers.Format.GPX=OpenLayers.Class(OpenLayers.Format.XML,{extractWaypoints:true,extractTracks:true,extractRoutes:true,extractAttributes:true,initialize:function(options){this.externalProjection=new OpenLayers.Projection("EPSG:4326");OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(doc){if(typeof doc=="string"){doc=OpenLayers.Format.XML.prototype.read.apply(this,[doc]);}  
var features=[];if(this.extractTracks){var tracks=doc.getElementsByTagName("trk");for(var i=0,len=tracks.length;i<len;i++){var attrs={};if(this.extractAttributes){attrs=this.parseAttributes(tracks[i]);}  
var segs=this.getElementsByTagNameNS(tracks[i],tracks[i].namespaceURI,"trkseg");for(var j=0,seglen=segs.length;j<seglen;j++){var track=this.extractSegment(segs[j],"trkpt");features.push(new OpenLayers.Feature.Vector(track,attrs));}}}  
if(this.extractRoutes){var routes=doc.getElementsByTagName("rte");for(var k=0,klen=routes.length;k<klen;k++){var attrs={};if(this.extractAttributes){attrs=this.parseAttributes(routes[k]);}  
var route=this.extractSegment(routes[k],"rtept");features.push(new OpenLayers.Feature.Vector(route,attrs));}}  
if(this.extractWaypoints){var waypoints=doc.getElementsByTagName("wpt");for(var l=0,len=waypoints.length;l<len;l++){var attrs={};if(this.extractAttributes){attrs=this.parseAttributes(waypoints[l]);}  
var wpt=new OpenLayers.Geometry.Point(waypoints[l].getAttribute("lon"),waypoints[l].getAttribute("lat"));features.push(new OpenLayers.Feature.Vector(wpt,attrs));}}  
if(this.internalProjection&&this.externalProjection){for(var g=0,featLength=features.length;g<featLength;g++){features[g].geometry.transform(this.externalProjection,this.internalProjection);}}  
return features;},extractSegment:function(segment,segmentType){var points=this.getElementsByTagNameNS(segment,segment.namespaceURI,segmentType);var point_features=[];for(var i=0,len=points.length;i<len;i++){point_features.push(new OpenLayers.Geometry.Point(points[i].getAttribute("lon"),points[i].getAttribute("lat")));}  
return new OpenLayers.Geometry.LineString(point_features);},parseAttributes:function(node){var attributes={};var attrNode=node.firstChild;while(attrNode){if(attrNode.nodeType==1){var value=attrNode.firstChild;if(value.nodeType==3||value.nodeType==4){name=(attrNode.prefix)?attrNode.nodeName.split(":")[1]:attrNode.nodeName;if(name!="trkseg"&&name!="rtept"){attributes[name]=value.nodeValue;}}}  
attrNode=attrNode.nextSibling;}  
return attributes;},CLASS_NAME:"OpenLayers.Format.GPX"});OpenLayers.Geometry.LinearRing=OpenLayers.Class(OpenLayers.Geometry.LineString,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(points){OpenLayers.Geometry.LineString.prototype.initialize.apply(this,arguments);},addComponent:function(point,index){var added=false;var lastPoint=this.components.pop();if(index!=null||!point.equals(lastPoint)){added=OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,arguments);}  
var firstPoint=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[firstPoint]);return added;},removeComponent:function(point){if(this.components.length>4){this.components.pop();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);var firstPoint=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[firstPoint]);}},move:function(x,y){for(var i=0,len=this.components.length;i<len-1;i++){this.components[i].move(x,y);}},rotate:function(angle,origin){for(var i=0,len=this.components.length;i<len-1;++i){this.components[i].rotate(angle,origin);}},resize:function(scale,origin,ratio){for(var i=0,len=this.components.length;i<len-1;++i){this.components[i].resize(scale,origin,ratio);}  
return this;},transform:function(source,dest){if(source&&dest){for(var i=0,len=this.components.length;i<len-1;i++){var component=this.components[i];component.transform(source,dest);}  
this.bounds=null;}  
return this;},getCentroid:function(){if(this.components&&(this.components.length>2)){var sumX=0.0;var sumY=0.0;for(var i=0;i<this.components.length-1;i++){var b=this.components[i];var c=this.components[i+1];sumX+=(b.x+c.x)*(b.x*c.y-c.x*b.y);sumY+=(b.y+c.y)*(b.x*c.y-c.x*b.y);}  
var area=-1*this.getArea();var x=sumX/(6*area);var y=sumY/(6*area);return new OpenLayers.Geometry.Point(x,y);}else{return null;}},getArea:function(){var area=0.0;if(this.components&&(this.components.length>2)){var sum=0.0;for(var i=0,len=this.components.length;i<len-1;i++){var b=this.components[i];var c=this.components[i+1];sum+=(b.x+c.x)*(c.y-b.y);}  
area=-sum/2.0;}  
return area;},getGeodesicArea:function(projection){var ring=this;if(projection){var gg=new OpenLayers.Projection("EPSG:4326");if(!gg.equals(projection)){ring=this.clone().transform(projection,gg);}}  
var area=0.0;var len=ring.components&&ring.components.length;if(len>2){var p1,p2;for(var i=0;i<len-1;i++){p1=ring.components[i];p2=ring.components[i+1];area+=OpenLayers.Util.rad(p2.x-p1.x)*(2+Math.sin(OpenLayers.Util.rad(p1.y))+  
Math.sin(OpenLayers.Util.rad(p2.y)));}  
area=area*6378137.0*6378137.0/2.0;}  
return area;},containsPoint:function(point){var approx=OpenLayers.Number.limitSigDigs;var digs=14;var px=approx(point.x,digs);var py=approx(point.y,digs);function getX(y,x1,y1,x2,y2){return(((x1-x2)*y)+((x2*y1)-(x1*y2)))/(y1-y2);}  
var numSeg=this.components.length-1;var start,end,x1,y1,x2,y2,cx,cy;var crosses=0;for(var i=0;i<numSeg;++i){start=this.components[i];x1=approx(start.x,digs);y1=approx(start.y,digs);end=this.components[i+1];x2=approx(end.x,digs);y2=approx(end.y,digs);if(y1==y2){if(py==y1){if(x1<=x2&&(px>=x1&&px<=x2)||x1>=x2&&(px<=x1&&px>=x2)){crosses=-1;break;}}  
continue;}  
cx=approx(getX(py,x1,y1,x2,y2),digs);if(cx==px){if(y1<y2&&(py>=y1&&py<=y2)||y1>y2&&(py<=y1&&py>=y2)){crosses=-1;break;}}  
if(cx<=px){continue;}  
if(x1!=x2&&(cx<Math.min(x1,x2)||cx>Math.max(x1,x2))){continue;}  
if(y1<y2&&(py>=y1&&py<y2)||y1>y2&&(py<y1&&py>=y2)){++crosses;}}  
var contained=(crosses==-1)?1:!!(crosses&1);return contained;},intersects:function(geometry){var intersect=false;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.containsPoint(geometry);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"){intersect=geometry.intersects(this);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){intersect=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[geometry]);}else{for(var i=0,len=geometry.components.length;i<len;++i){intersect=geometry.components[i].intersects(this);if(intersect){break;}}}  
return intersect;},getVertices:function(nodes){return(nodes===true)?[]:this.components.slice(0,this.components.length-1);},CLASS_NAME:"OpenLayers.Geometry.LinearRing"});OpenLayers.Geometry.MultiLineString=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LineString"],initialize:function(components){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments);},split:function(geometry,options){var results=null;var mutual=options&&options.mutual;var splits,sourceLine,sourceLines,sourceSplit,targetSplit;var sourceParts=[];var targetParts=[geometry];for(var i=0,len=this.components.length;i<len;++i){sourceLine=this.components[i];sourceSplit=false;for(var j=0;j<targetParts.length;++j){splits=sourceLine.split(targetParts[j],options);if(splits){if(mutual){sourceLines=splits[0];for(var k=0,klen=sourceLines.length;k<klen;++k){if(k===0&&sourceParts.length){sourceParts[sourceParts.length-1].addComponent(sourceLines[k]);}else{sourceParts.push(new OpenLayers.Geometry.MultiLineString([sourceLines[k]]));}}  
sourceSplit=true;splits=splits[1];}  
if(splits.length){splits.unshift(j,1);Array.prototype.splice.apply(targetParts,splits);break;}}}  
if(!sourceSplit){if(sourceParts.length){sourceParts[sourceParts.length-1].addComponent(sourceLine.clone());}else{sourceParts=[new OpenLayers.Geometry.MultiLineString(sourceLine.clone())];}}}  
if(sourceParts&&sourceParts.length>1){sourceSplit=true;}else{sourceParts=[];}  
if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];}  
if(sourceSplit||targetSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}}  
return results;},splitWith:function(geometry,options){var results=null;var mutual=options&&options.mutual;var splits,targetLine,sourceLines,sourceSplit,targetSplit,sourceParts,targetParts;if(geometry instanceof OpenLayers.Geometry.LineString){targetParts=[];sourceParts=[geometry];for(var i=0,len=this.components.length;i<len;++i){targetSplit=false;targetLine=this.components[i];for(var j=0;j<sourceParts.length;++j){splits=sourceParts[j].split(targetLine,options);if(splits){if(mutual){sourceLines=splits[0];if(sourceLines.length){sourceLines.unshift(j,1);Array.prototype.splice.apply(sourceParts,sourceLines);j+=sourceLines.length-2;}  
splits=splits[1];if(splits.length===0){splits=[targetLine.clone()];}}  
for(var k=0,klen=splits.length;k<klen;++k){if(k===0&&targetParts.length){targetParts[targetParts.length-1].addComponent(splits[k]);}else{targetParts.push(new OpenLayers.Geometry.MultiLineString([splits[k]]));}}  
targetSplit=true;}}  
if(!targetSplit){if(targetParts.length){targetParts[targetParts.length-1].addComponent(targetLine.clone());}else{targetParts=[new OpenLayers.Geometry.MultiLineString([targetLine.clone()])];}}}}else{results=geometry.split(this);}  
if(sourceParts&&sourceParts.length>1){sourceSplit=true;}else{sourceParts=[];}  
if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];}  
if(sourceSplit||targetSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}}  
return results;},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});OpenLayers.Handler.Path=OpenLayers.Class(OpenLayers.Handler.Point,{line:null,freehand:false,freehandToggle:'shiftKey',initialize:function(control,callbacks,options){OpenLayers.Handler.Point.prototype.initialize.apply(this,arguments);},createFeature:function(pixel){var lonlat=this.control.map.getLonLatFromPixel(pixel);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat));this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([this.point.geometry]));this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.line,this.point],{silent:true});},destroyFeature:function(){OpenLayers.Handler.Point.prototype.destroyFeature.apply(this);this.line=null;},removePoint:function(){if(this.point){this.layer.removeFeatures([this.point]);}},addPoint:function(pixel){this.layer.removeFeatures([this.point]);var lonlat=this.control.map.getLonLatFromPixel(pixel);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat));this.line.geometry.addComponent(this.point.geometry,this.line.geometry.components.length);this.callback("point",[this.point.geometry,this.getGeometry()]);this.callback("modify",[this.point.geometry,this.getSketch()]);this.drawFeature();},freehandMode:function(evt){return(this.freehandToggle&&evt[this.freehandToggle])?!this.freehand:this.freehand;},modifyFeature:function(pixel){var lonlat=this.control.map.getLonLatFromPixel(pixel);this.point.geometry.x=lonlat.lon;this.point.geometry.y=lonlat.lat;this.callback("modify",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.drawFeature();},drawFeature:function(){this.layer.drawFeature(this.line,this.style);this.layer.drawFeature(this.point,this.style);},getSketch:function(){return this.line;},getGeometry:function(){var geometry=this.line&&this.line.geometry;if(geometry&&this.multi){geometry=new OpenLayers.Geometry.MultiLineString([geometry]);}  
return geometry;},mousedown:function(evt){if(this.lastDown&&this.lastDown.equals(evt.xy)){return false;}  
if(this.lastDown==null){if(this.persist){this.destroyFeature();}  
this.createFeature(evt.xy);}else if((this.lastUp==null)||!this.lastUp.equals(evt.xy)){this.addPoint(evt.xy);}  
this.mouseDown=true;this.lastDown=evt.xy;this.drawing=true;return false;},mousemove:function(evt){if(this.drawing){if(this.mouseDown&&this.freehandMode(evt)){this.addPoint(evt.xy);}else{this.modifyFeature(evt.xy);}}  
return true;},mouseup:function(evt){this.mouseDown=false;if(this.drawing){if(this.freehandMode(evt)){this.removePoint();this.finalize();}else{if(this.lastUp==null){this.addPoint(evt.xy);}  
this.lastUp=evt.xy;}  
return false;}  
return true;},dblclick:function(evt){if(!this.freehandMode(evt)){var index=this.line.geometry.components.length-1;this.line.geometry.removeComponent(this.line.geometry.components[index]);this.removePoint();this.finalize();}  
return false;},CLASS_NAME:"OpenLayers.Handler.Path"});OpenLayers.Control.Split=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["beforesplit","split","aftersplit"],layer:null,source:null,sourceOptions:null,tolerance:null,edge:true,deferDelete:false,mutual:true,targetFilter:null,sourceFilter:null,handler:null,initialize:function(options){Array.prototype.push.apply(this.EVENT_TYPES,OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[options]);this.options=options||{};if(this.options.source){this.setSource(this.options.source);}},setSource:function(layer){if(this.active){this.deactivate();if(this.handler){this.handler.destroy();delete this.handler;}  
this.source=layer;this.activate();}else{this.source=layer;}},activate:function(){var activated=OpenLayers.Control.prototype.activate.call(this);if(activated){if(!this.source){if(!this.handler){this.handler=new OpenLayers.Handler.Path(this,{done:function(geometry){this.onSketchComplete({feature:new OpenLayers.Feature.Vector(geometry)});}},{layerOptions:this.sourceOptions});}  
this.handler.activate();}else if(this.source.events){this.source.events.on({sketchcomplete:this.onSketchComplete,afterfeaturemodified:this.afterFeatureModified,scope:this});}}  
return activated;},deactivate:function(){var deactivated=OpenLayers.Control.prototype.deactivate.call(this);if(deactivated){if(this.source&&this.source.events){this.layer.events.un({sketchcomplete:this.onSketchComplete,afterfeaturemodified:this.afterFeatureModified,scope:this});}}  
return deactivated;},onSketchComplete:function(event){this.feature=null;return!this.considerSplit(event.feature);},afterFeatureModified:function(event){if(event.modified){var feature=event.feature;if(feature.geometry instanceof OpenLayers.Geometry.LineString||feature.geometry instanceof OpenLayers.Geometry.MultiLineString){this.feature=event.feature;this.considerSplit(event.feature);}}},removeByGeometry:function(features,geometry){for(var i=0,len=features.length;i<len;++i){if(features[i].geometry===geometry){features.splice(i,1);break;}}},isEligible:function(target){return(target.state!==OpenLayers.State.DELETE)&&(target.geometry instanceof OpenLayers.Geometry.LineString||target.geometry instanceof OpenLayers.Geometry.MultiLineString)&&(this.feature!==target)&&(!this.targetFilter||this.targetFilter.evaluate(target.attributes));},considerSplit:function(feature){var sourceSplit=false;var targetSplit=false;if(!this.sourceFilter||this.sourceFilter.evaluate(feature.attributes)){var features=this.layer&&this.layer.features||[];var target,results,proceed;var additions=[],removals=[];var mutual=(this.layer===this.source)&&this.mutual;var options={edge:this.edge,tolerance:this.tolerance,mutual:mutual};var sourceParts=[feature.geometry];var targetFeature,targetParts;var source,parts;for(var i=0,len=features.length;i<len;++i){targetFeature=features[i];if(this.isEligible(targetFeature)){targetParts=[targetFeature.geometry];for(var j=0;j<sourceParts.length;++j){source=sourceParts[j];for(var k=0;k<targetParts.length;++k){target=targetParts[k];if(source.getBounds().intersectsBounds(target.getBounds())){results=source.split(target,options);if(results){proceed=this.events.triggerEvent("beforesplit",{source:feature,target:targetFeature});if(proceed!==false){if(mutual){parts=results[0];if(parts.length>1){parts.unshift(j,1);Array.prototype.splice.apply(sourceParts,parts);j+=parts.length-3;}  
results=results[1];}  
if(results.length>1){results.unshift(k,1);Array.prototype.splice.apply(targetParts,results);k+=results.length-3;}}}}}}  
if(targetParts&&targetParts.length>1){this.geomsToFeatures(targetFeature,targetParts);this.events.triggerEvent("split",{original:targetFeature,features:targetParts});Array.prototype.push.apply(additions,targetParts);removals.push(targetFeature);targetSplit=true;}}}  
if(sourceParts&&sourceParts.length>1){this.geomsToFeatures(feature,sourceParts);this.events.triggerEvent("split",{original:feature,features:sourceParts});Array.prototype.push.apply(additions,sourceParts);removals.push(feature);sourceSplit=true;}  
if(sourceSplit||targetSplit){if(this.deferDelete){var feat,destroys=[];for(var i=0,len=removals.length;i<len;++i){feat=removals[i];if(feat.state===OpenLayers.State.INSERT){destroys.push(feat);}else{feat.state=OpenLayers.State.DELETE;this.layer.drawFeature(feat);}}  
this.layer.destroyFeatures(destroys,{silent:true});for(var i=0,len=additions.length;i<len;++i){additions[i].state=OpenLayers.State.INSERT;}}else{this.layer.destroyFeatures(removals,{silent:true});}  
this.layer.addFeatures(additions,{silent:true});this.events.triggerEvent("aftersplit",{source:feature,features:additions});}}  
return sourceSplit;},geomsToFeatures:function(feature,geoms){var clone=feature.clone();delete clone.geometry;var newFeature;for(var i=0,len=geoms.length;i<len;++i){newFeature=clone.clone();newFeature.geometry=geoms[i];newFeature.state=OpenLayers.State.INSERT;geoms[i]=newFeature;}},destroy:function(){if(this.active){this.deactivate();}  
OpenLayers.Control.prototype.destroy.call(this);},CLASS_NAME:"OpenLayers.Control.Split"});OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],initialize:function(components){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments);},getArea:function(){var area=0.0;if(this.components&&(this.components.length>0)){area+=Math.abs(this.components[0].getArea());for(var i=1,len=this.components.length;i<len;i++){area-=Math.abs(this.components[i].getArea());}}  
return area;},getGeodesicArea:function(projection){var area=0.0;if(this.components&&(this.components.length>0)){area+=Math.abs(this.components[0].getGeodesicArea(projection));for(var i=1,len=this.components.length;i<len;i++){area-=Math.abs(this.components[i].getGeodesicArea(projection));}}  
return area;},containsPoint:function(point){var numRings=this.components.length;var contained=false;if(numRings>0){contained=this.components[0].containsPoint(point);if(contained!==1){if(contained&&numRings>1){var hole;for(var i=1;i<numRings;++i){hole=this.components[i].containsPoint(point);if(hole){if(hole===1){contained=1;}else{contained=false;}  
break;}}}}}  
return contained;},intersects:function(geometry){var intersect=false;var i,len;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.containsPoint(geometry);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"||geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){for(i=0,len=this.components.length;i<len;++i){intersect=geometry.intersects(this.components[i]);if(intersect){break;}}  
if(!intersect){for(i=0,len=geometry.components.length;i<len;++i){intersect=this.containsPoint(geometry.components[i]);if(intersect){break;}}}}else{for(i=0,len=geometry.components.length;i<len;++i){intersect=this.intersects(geometry.components[i]);if(intersect){break;}}}  
if(!intersect&&geometry.CLASS_NAME=="OpenLayers.Geometry.Polygon"){var ring=this.components[0];for(i=0,len=ring.components.length;i<len;++i){intersect=geometry.containsPoint(ring.components[i]);if(intersect){break;}}}  
return intersect;},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var result;if(!edge&&this.intersects(geometry)){result=0;}else{result=OpenLayers.Geometry.Collection.prototype.distanceTo.apply(this,[geometry,options]);}  
return result;},CLASS_NAME:"OpenLayers.Geometry.Polygon"});OpenLayers.Geometry.Polygon.createRegularPolygon=function(origin,radius,sides,rotation){var angle=Math.PI*((1/sides)-(1/2));if(rotation){angle+=(rotation/180)*Math.PI;}  
var rotatedAngle,x,y;var points=[];for(var i=0;i<sides;++i){rotatedAngle=angle+(i*2*Math.PI/sides);x=origin.x+(radius*Math.cos(rotatedAngle));y=origin.y+(radius*Math.sin(rotatedAngle));points.push(new OpenLayers.Geometry.Point(x,y));}  
var ring=new OpenLayers.Geometry.LinearRing(points);return new OpenLayers.Geometry.Polygon([ring]);};OpenLayers.Format.GeoRSS=OpenLayers.Class(OpenLayers.Format.XML,{rssns:"http://backend.userland.com/rss2",featureNS:"http://mapserver.gis.umn.edu/mapserver",georssns:"http://www.georss.org/georss",geons:"http://www.w3.org/2003/01/geo/wgs84_pos#",featureTitle:"Untitled",featureDescription:"No Description",gmlParser:null,xy:false,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},createGeometryFromItem:function(item){var point=this.getElementsByTagNameNS(item,this.georssns,"point");var lat=this.getElementsByTagNameNS(item,this.geons,'lat');var lon=this.getElementsByTagNameNS(item,this.geons,'long');var line=this.getElementsByTagNameNS(item,this.georssns,"line");var polygon=this.getElementsByTagNameNS(item,this.georssns,"polygon");var where=this.getElementsByTagNameNS(item,this.georssns,"where");var box=this.getElementsByTagNameNS(item,this.georssns,"box");if(point.length>0||(lat.length>0&&lon.length>0)){var location;if(point.length>0){location=OpenLayers.String.trim(point[0].firstChild.nodeValue).split(/\s+/);if(location.length!=2){location=OpenLayers.String.trim(point[0].firstChild.nodeValue).split(/\s*,\s*/);}}else{location=[parseFloat(lat[0].firstChild.nodeValue),parseFloat(lon[0].firstChild.nodeValue)];}  
var geometry=new OpenLayers.Geometry.Point(parseFloat(location[1]),parseFloat(location[0]));}else if(line.length>0){var coords=OpenLayers.String.trim(this.concatChildValues(line[0])).split(/\s+/);var components=[];var point;for(var i=0,len=coords.length;i<len;i+=2){point=new OpenLayers.Geometry.Point(parseFloat(coords[i+1]),parseFloat(coords[i]));components.push(point);}  
geometry=new OpenLayers.Geometry.LineString(components);}else if(polygon.length>0){var coords=OpenLayers.String.trim(this.concatChildValues(polygon[0])).split(/\s+/);var components=[];var point;for(var i=0,len=coords.length;i<len;i+=2){point=new OpenLayers.Geometry.Point(parseFloat(coords[i+1]),parseFloat(coords[i]));components.push(point);}  
geometry=new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(components)]);}else if(where.length>0){if(!this.gmlParser){this.gmlParser=new OpenLayers.Format.GML({'xy':this.xy});}  
var feature=this.gmlParser.parseFeature(where[0]);geometry=feature.geometry;}else if(box.length>0){var coords=OpenLayers.String.trim(box[0].firstChild.nodeValue).split(/\s+/);var components=[];var point;if(coords.length>3){point=new OpenLayers.Geometry.Point(parseFloat(coords[1]),parseFloat(coords[0]));components.push(point);point=new OpenLayers.Geometry.Point(parseFloat(coords[1]),parseFloat(coords[2]));components.push(point);point=new OpenLayers.Geometry.Point(parseFloat(coords[3]),parseFloat(coords[2]));components.push(point);point=new OpenLayers.Geometry.Point(parseFloat(coords[3]),parseFloat(coords[0]));components.push(point);point=new OpenLayers.Geometry.Point(parseFloat(coords[1]),parseFloat(coords[0]));components.push(point);}  
geometry=new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(components)]);}  
if(geometry&&this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection);}  
return geometry;},createFeatureFromItem:function(item){var geometry=this.createGeometryFromItem(item);var title=this.getChildValue(item,"*","title",this.featureTitle);var description=this.getChildValue(item,"*","description",this.getChildValue(item,"*","content",this.getChildValue(item,"*","summary",this.featureDescription)));var link=this.getChildValue(item,"*","link");if(!link){try{link=this.getElementsByTagNameNS(item,"*","link")[0].getAttribute("href");}catch(e){link=null;}}  
var id=this.getChildValue(item,"*","id",null);var data={"title":title,"description":description,"link":link};var feature=new OpenLayers.Feature.Vector(geometry,data);feature.fid=id;return feature;},getChildValue:function(node,nsuri,name,def){var value;var eles=this.getElementsByTagNameNS(node,nsuri,name);if(eles&&eles[0]&&eles[0].firstChild&&eles[0].firstChild.nodeValue){value=eles[0].firstChild.nodeValue;}else{value=(def==undefined)?"":def;}  
return value;},read:function(doc){if(typeof doc=="string"){doc=OpenLayers.Format.XML.prototype.read.apply(this,[doc]);}  
var itemlist=null;itemlist=this.getElementsByTagNameNS(doc,'*','item');if(itemlist.length==0){itemlist=this.getElementsByTagNameNS(doc,'*','entry');}  
var numItems=itemlist.length;var features=new Array(numItems);for(var i=0;i<numItems;i++){features[i]=this.createFeatureFromItem(itemlist[i]);}  
return features;},write:function(features){var georss;if(features instanceof Array){georss=this.createElementNS(this.rssns,"rss");for(var i=0,len=features.length;i<len;i++){georss.appendChild(this.createFeatureXML(features[i]));}}else{georss=this.createFeatureXML(features);}  
return OpenLayers.Format.XML.prototype.write.apply(this,[georss]);},createFeatureXML:function(feature){var geometryNode=this.buildGeometryNode(feature.geometry);var featureNode=this.createElementNS(this.rssns,"item");var titleNode=this.createElementNS(this.rssns,"title");titleNode.appendChild(this.createTextNode(feature.attributes.title?feature.attributes.title:""));var descNode=this.createElementNS(this.rssns,"description");descNode.appendChild(this.createTextNode(feature.attributes.description?feature.attributes.description:""));featureNode.appendChild(titleNode);featureNode.appendChild(descNode);if(feature.attributes.link){var linkNode=this.createElementNS(this.rssns,"link");linkNode.appendChild(this.createTextNode(feature.attributes.link));featureNode.appendChild(linkNode);}  
for(var attr in feature.attributes){if(attr=="link"||attr=="title"||attr=="description"){continue;}  
var attrText=this.createTextNode(feature.attributes[attr]);var nodename=attr;if(attr.search(":")!=-1){nodename=attr.split(":")[1];}  
var attrContainer=this.createElementNS(this.featureNS,"feature:"+nodename);attrContainer.appendChild(attrText);featureNode.appendChild(attrContainer);}  
featureNode.appendChild(geometryNode);return featureNode;},buildGeometryNode:function(geometry){if(this.internalProjection&&this.externalProjection){geometry=geometry.clone();geometry.transform(this.internalProjection,this.externalProjection);}  
var node;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Polygon"){node=this.createElementNS(this.georssns,'georss:polygon');node.appendChild(this.buildCoordinatesNode(geometry.components[0]));}  
else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"){node=this.createElementNS(this.georssns,'georss:line');node.appendChild(this.buildCoordinatesNode(geometry));}  
else if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){node=this.createElementNS(this.georssns,'georss:point');node.appendChild(this.buildCoordinatesNode(geometry));}else{throw"Couldn't parse "+geometry.CLASS_NAME;}  
return node;},buildCoordinatesNode:function(geometry){var points=null;if(geometry.components){points=geometry.components;}  
var path;if(points){var numPoints=points.length;var parts=new Array(numPoints);for(var i=0;i<numPoints;i++){parts[i]=points[i].y+" "+points[i].x;}  
path=parts.join(" ");}else{path=geometry.y+" "+geometry.x;}  
return this.createTextNode(path);},CLASS_NAME:"OpenLayers.Format.GeoRSS"});OpenLayers.Format.KML=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{kml:"http://www.opengis.net/kml/2.2",gx:"http://www.google.com/kml/ext/2.2"},kmlns:"http://earth.google.com/kml/2.0",placemarksDesc:"No description available",foldersName:"OpenLayers export",foldersDesc:"Exported on "+new Date(),extractAttributes:true,extractStyles:false,extractTracks:false,trackAttributes:null,internalns:null,features:null,styles:null,styleBaseUrl:"",fetched:null,maxDepth:0,initialize:function(options){this.regExes={trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g),kmlColor:(/(\w{2})(\w{2})(\w{2})(\w{2})/),kmlIconPalette:(/root:\/\/icons\/palette-(\d+)(\.\w+)/),straightBracket:(/\$\[(.*?)\]/g)};this.externalProjection=new OpenLayers.Projection("EPSG:4326");OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(data){this.features=[];this.styles={};this.fetched={};var options={depth:0,styleBaseUrl:this.styleBaseUrl};return this.parseData(data,options);},parseData:function(data,options){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var types=["Link","NetworkLink","Style","StyleMap","Placemark"];for(var i=0,len=types.length;i<len;++i){var type=types[i];var nodes=this.getElementsByTagNameNS(data,"*",type);if(nodes.length==0){continue;}  
switch(type.toLowerCase()){case"link":case"networklink":this.parseLinks(nodes,options);break;case"style":if(this.extractStyles){this.parseStyles(nodes,options);}  
break;case"stylemap":if(this.extractStyles){this.parseStyleMaps(nodes,options);}  
break;case"placemark":this.parseFeatures(nodes,options);break;}}  
return this.features;},parseLinks:function(nodes,options){if(options.depth>=this.maxDepth){return false;}  
var newOptions=OpenLayers.Util.extend({},options);newOptions.depth++;for(var i=0,len=nodes.length;i<len;i++){var href=this.parseProperty(nodes[i],"*","href");if(href&&!this.fetched[href]){this.fetched[href]=true;var data=this.fetchLink(href);if(data){this.parseData(data,newOptions);}}}},fetchLink:function(href){var request=OpenLayers.Request.GET({url:href,async:false});if(request){return request.responseText;}},parseStyles:function(nodes,options){for(var i=0,len=nodes.length;i<len;i++){var style=this.parseStyle(nodes[i]);if(style){var styleName=(options.styleBaseUrl||"")+"#"+style.id;this.styles[styleName]=style;}}},parseKmlColor:function(kmlColor){var color=null;if(kmlColor){var matches=kmlColor.match(this.regExes.kmlColor);if(matches){color={color:'#'+matches[4]+matches[3]+matches[2],opacity:parseInt(matches[1],16)/255};}}  
return color;},parseStyle:function(node){var style={};var types=["LineStyle","PolyStyle","IconStyle","BalloonStyle","LabelStyle"];var type,nodeList,geometry,parser;for(var i=0,len=types.length;i<len;++i){type=types[i];styleTypeNode=this.getElementsByTagNameNS(node,"*",type)[0];if(!styleTypeNode){continue;}  
switch(type.toLowerCase()){case"linestyle":var kmlColor=this.parseProperty(styleTypeNode,"*","color");var color=this.parseKmlColor(kmlColor);if(color){style["strokeColor"]=color.color;style["strokeOpacity"]=color.opacity;}  
var width=this.parseProperty(styleTypeNode,"*","width");if(width){style["strokeWidth"]=width;}  
break;case"polystyle":var kmlColor=this.parseProperty(styleTypeNode,"*","color");var color=this.parseKmlColor(kmlColor);if(color){style["fillOpacity"]=color.opacity;style["fillColor"]=color.color;}  
var fill=this.parseProperty(styleTypeNode,"*","fill");if(fill=="0"){style["fillColor"]="none";}  
var outline=this.parseProperty(styleTypeNode,"*","outline");if(outline=="0"){style["strokeWidth"]="0";}  
break;case"iconstyle":var scale=parseFloat(this.parseProperty(styleTypeNode,"*","scale")||1);var width=32*scale;var height=32*scale;var iconNode=this.getElementsByTagNameNS(styleTypeNode,"*","Icon")[0];if(iconNode){var href=this.parseProperty(iconNode,"*","href");if(href){var w=this.parseProperty(iconNode,"*","w");var h=this.parseProperty(iconNode,"*","h");var google="http://maps.google.com/mapfiles/kml";if(OpenLayers.String.startsWith(href,google)&&!w&&!h){w=64;h=64;scale=scale/2;}  
w=w||h;h=h||w;if(w){width=parseInt(w)*scale;}  
if(h){height=parseInt(h)*scale;}  
var matches=href.match(this.regExes.kmlIconPalette);if(matches){var palette=matches[1];var file_extension=matches[2];var x=this.parseProperty(iconNode,"*","x");var y=this.parseProperty(iconNode,"*","y");var posX=x?x/32:0;var posY=y?(7-y/32):7;var pos=posY*8+posX;href="http://maps.google.com/mapfiles/kml/pal"  
+palette+"/icon"+pos+file_extension;}  
style["graphicOpacity"]=1;style["externalGraphic"]=href;}}  
var hotSpotNode=this.getElementsByTagNameNS(styleTypeNode,"*","hotSpot")[0];if(hotSpotNode){var x=parseFloat(hotSpotNode.getAttribute("x"));var y=parseFloat(hotSpotNode.getAttribute("y"));var xUnits=hotSpotNode.getAttribute("xunits");if(xUnits=="pixels"){style["graphicXOffset"]=-x*scale;}  
else if(xUnits=="insetPixels"){style["graphicXOffset"]=-width+(x*scale);}  
else if(xUnits=="fraction"){style["graphicXOffset"]=-width*x;}  
var yUnits=hotSpotNode.getAttribute("yunits");if(yUnits=="pixels"){style["graphicYOffset"]=-height+(y*scale)+1;}  
else if(yUnits=="insetPixels"){style["graphicYOffset"]=-(y*scale)+1;}  
else if(yUnits=="fraction"){style["graphicYOffset"]=-height*(1-y)+1;}}  
style["graphicWidth"]=width;style["graphicHeight"]=height;break;case"balloonstyle":var balloonStyle=OpenLayers.Util.getXmlNodeValue(styleTypeNode);if(balloonStyle){style["balloonStyle"]=balloonStyle.replace(this.regExes.straightBracket,"${$1}");}  
break;case"labelstyle":var kmlColor=this.parseProperty(styleTypeNode,"*","color");var color=this.parseKmlColor(kmlColor);if(color){style["fontColor"]=color.color;style["fontOpacity"]=color.opacity;}  
break;default:}}  
if(!style["strokeColor"]&&style["fillColor"]){style["strokeColor"]=style["fillColor"];}  
var id=node.getAttribute("id");if(id&&style){style.id=id;}  
return style;},parseStyleMaps:function(nodes,options){for(var i=0,len=nodes.length;i<len;i++){var node=nodes[i];var pairs=this.getElementsByTagNameNS(node,"*","Pair");var id=node.getAttribute("id");for(var j=0,jlen=pairs.length;j<jlen;j++){var pair=pairs[j];var key=this.parseProperty(pair,"*","key");var styleUrl=this.parseProperty(pair,"*","styleUrl");if(styleUrl&&key=="normal"){this.styles[(options.styleBaseUrl||"")+"#"+id]=this.styles[(options.styleBaseUrl||"")+styleUrl];}  
if(styleUrl&&key=="highlight"){}}}},parseFeatures:function(nodes,options){var features=[];for(var i=0,len=nodes.length;i<len;i++){var featureNode=nodes[i];var feature=this.parseFeature.apply(this,[featureNode]);if(feature){if(this.extractStyles&&feature.attributes&&feature.attributes.styleUrl){feature.style=this.getStyle(feature.attributes.styleUrl,options);}  
if(this.extractStyles){var inlineStyleNode=this.getElementsByTagNameNS(featureNode,"*","Style")[0];if(inlineStyleNode){var inlineStyle=this.parseStyle(inlineStyleNode);if(inlineStyle){feature.style=OpenLayers.Util.extend(feature.style,inlineStyle);}}}  
if(this.extractTracks){var tracks=this.getElementsByTagNameNS(featureNode,this.namespaces.gx,"Track");if(tracks&&tracks.length>0){var track=tracks[0];var container={features:[],feature:feature};this.readNode(track,container);if(container.features.length>0){features.push.apply(features,container.features);}}}else{features.push(feature);}}else{throw"Bad Placemark: "+i;}}  
this.features=this.features.concat(features);},readers:{"kml":{"when":function(node,container){container.whens.push(OpenLayers.Date.parse(this.getChildValue(node)));},"_trackPointAttribute":function(node,container){var name=node.nodeName.split(":").pop();container.attributes[name].push(this.getChildValue(node));}},"gx":{"Track":function(node,container){var obj={whens:[],points:[],angles:[]};if(this.trackAttributes){var name;obj.attributes={};for(var i=0,ii=this.trackAttributes.length;i<ii;++i){name=this.trackAttributes[i];obj.attributes[name]=[];if(!(name in this.readers.kml)){this.readers.kml[name]=this.readers.kml._trackPointAttribute;}}}  
this.readChildNodes(node,obj);if(obj.whens.length!==obj.points.length){throw new Error("gx:Track with unequal number of when ("+obj.whens.length+") and gx:coord ("+obj.points.length+") elements.");}  
var hasAngles=obj.angles.length>0;if(hasAngles&&obj.whens.length!==obj.angles.length){throw new Error("gx:Track with unequal number of when ("+obj.whens.length+") and gx:angles ("+obj.angles.length+") elements.");}  
var feature,point,angles;for(var i=0,ii=obj.whens.length;i<ii;++i){feature=container.feature.clone();feature.fid=container.feature.fid||container.feature.id;point=obj.points[i];feature.geometry=point;if("z"in point){feature.attributes.altitude=point.z;}  
if(this.internalProjection&&this.externalProjection){feature.geometry.transform(this.externalProjection,this.internalProjection);}  
if(this.trackAttributes){for(var j=0,jj=this.trackAttributes.length;j<jj;++j){feature.attributes[name]=obj.attributes[this.trackAttributes[j]][i];}}  
feature.attributes.when=obj.whens[i];feature.attributes.trackId=container.feature.id;if(hasAngles){angles=obj.angles[i];feature.attributes.heading=parseFloat(angles[0]);feature.attributes.tilt=parseFloat(angles[1]);feature.attributes.roll=parseFloat(angles[2]);}  
container.features.push(feature);}},"coord":function(node,container){var str=this.getChildValue(node);var coords=str.replace(this.regExes.trimSpace,"").split(/\s+/);var point=new OpenLayers.Geometry.Point(coords[0],coords[1]);if(coords.length>2){point.z=parseFloat(coords[2]);}  
container.points.push(point);},"angles":function(node,container){var str=this.getChildValue(node);var parts=str.replace(this.regExes.trimSpace,"").split(/\s+/);container.angles.push(parts);}}},parseFeature:function(node){var order=["MultiGeometry","Polygon","LineString","Point"];var type,nodeList,geometry,parser;for(var i=0,len=order.length;i<len;++i){type=order[i];this.internalns=node.namespaceURI?node.namespaceURI:this.kmlns;nodeList=this.getElementsByTagNameNS(node,this.internalns,type);if(nodeList.length>0){var parser=this.parseGeometry[type.toLowerCase()];if(parser){geometry=parser.apply(this,[nodeList[0]]);if(this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection);}}else{OpenLayers.Console.error(OpenLayers.i18n("unsupportedGeometryType",{'geomType':type}));}  
break;}}  
var attributes;if(this.extractAttributes){attributes=this.parseAttributes(node);}  
var feature=new OpenLayers.Feature.Vector(geometry,attributes);var fid=node.getAttribute("id")||node.getAttribute("name");if(fid!=null){feature.fid=fid;}  
return feature;},getStyle:function(styleUrl,options){var styleBaseUrl=OpenLayers.Util.removeTail(styleUrl);var newOptions=OpenLayers.Util.extend({},options);newOptions.depth++;newOptions.styleBaseUrl=styleBaseUrl;if(!this.styles[styleUrl]&&!OpenLayers.String.startsWith(styleUrl,"#")&&newOptions.depth<=this.maxDepth&&!this.fetched[styleBaseUrl]){var data=this.fetchLink(styleBaseUrl);if(data){this.parseData(data,newOptions);}}  
var style=OpenLayers.Util.extend({},this.styles[styleUrl]);return style;},parseGeometry:{point:function(node){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"coordinates");var coords=[];if(nodeList.length>0){var coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.removeSpace,"");coords=coordString.split(",");}  
var point=null;if(coords.length>1){if(coords.length==2){coords[2]=null;}  
point=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{throw"Bad coordinate string: "+coordString;}  
return point;},linestring:function(node,ring){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"coordinates");var line=null;if(nodeList.length>0){var coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coordString=coordString.replace(this.regExes.trimComma,",");var pointList=coordString.split(this.regExes.splitSpace);var numPoints=pointList.length;var points=new Array(numPoints);var coords,numCoords;for(var i=0;i<numPoints;++i){coords=pointList[i].split(",");numCoords=coords.length;if(numCoords>1){if(coords.length==2){coords[2]=null;}  
points[i]=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{throw"Bad LineString point coordinates: "+  
pointList[i];}}  
if(numPoints){if(ring){line=new OpenLayers.Geometry.LinearRing(points);}else{line=new OpenLayers.Geometry.LineString(points);}}else{throw"Bad LineString coordinates: "+coordString;}}  
return line;},polygon:function(node){var nodeList=this.getElementsByTagNameNS(node,this.internalns,"LinearRing");var numRings=nodeList.length;var components=new Array(numRings);if(numRings>0){var ring;for(var i=0,len=nodeList.length;i<len;++i){ring=this.parseGeometry.linestring.apply(this,[nodeList[i],true]);if(ring){components[i]=ring;}else{throw"Bad LinearRing geometry: "+i;}}}  
return new OpenLayers.Geometry.Polygon(components);},multigeometry:function(node){var child,parser;var parts=[];var children=node.childNodes;for(var i=0,len=children.length;i<len;++i){child=children[i];if(child.nodeType==1){var type=(child.prefix)?child.nodeName.split(":")[1]:child.nodeName;var parser=this.parseGeometry[type.toLowerCase()];if(parser){parts.push(parser.apply(this,[child]));}}}  
return new OpenLayers.Geometry.Collection(parts);}},parseAttributes:function(node){var attributes={};var edNodes=node.getElementsByTagName("ExtendedData");if(edNodes.length){attributes=this.parseExtendedData(edNodes[0]);}  
var child,grandchildren,grandchild;var children=node.childNodes;for(var i=0,len=children.length;i<len;++i){child=children[i];if(child.nodeType==1){grandchildren=child.childNodes;if(grandchildren.length>=1&&grandchildren.length<=3){var grandchild;switch(grandchildren.length){case 1:grandchild=grandchildren[0];break;case 2:var c1=grandchildren[0];var c2=grandchildren[1];grandchild=(c1.nodeType==3||c1.nodeType==4)?c1:c2;break;case 3:default:grandchild=grandchildren[1];break;}  
if(grandchild.nodeType==3||grandchild.nodeType==4){var name=(child.prefix)?child.nodeName.split(":")[1]:child.nodeName;var value=OpenLayers.Util.getXmlNodeValue(grandchild);if(value){value=value.replace(this.regExes.trimSpace,"");attributes[name]=value;}}}}}  
return attributes;},parseExtendedData:function(node){var attributes={};var i,len,data,key;var dataNodes=node.getElementsByTagName("Data");for(i=0,len=dataNodes.length;i<len;i++){data=dataNodes[i];key=data.getAttribute("name");var ed={};var valueNode=data.getElementsByTagName("value");if(valueNode.length){ed['value']=this.getChildValue(valueNode[0]);}  
var nameNode=data.getElementsByTagName("displayName");if(nameNode.length){ed['displayName']=this.getChildValue(nameNode[0]);}  
attributes[key]=ed;}  
var simpleDataNodes=node.getElementsByTagName("SimpleData");for(i=0,len=simpleDataNodes.length;i<len;i++){var ed={};data=simpleDataNodes[i];key=data.getAttribute("name");ed['value']=this.getChildValue(data);ed['displayName']=key;attributes[key]=ed;}  
return attributes;},parseProperty:function(xmlNode,namespace,tagName){var value;var nodeList=this.getElementsByTagNameNS(xmlNode,namespace,tagName);try{value=OpenLayers.Util.getXmlNodeValue(nodeList[0]);}catch(e){value=null;}  
return value;},write:function(features){if(!(features instanceof Array)){features=[features];}  
var kml=this.createElementNS(this.kmlns,"kml");var folder=this.createFolderXML();for(var i=0,len=features.length;i<len;++i){folder.appendChild(this.createPlacemarkXML(features[i]));}  
kml.appendChild(folder);return OpenLayers.Format.XML.prototype.write.apply(this,[kml]);},createFolderXML:function(){var folder=this.createElementNS(this.kmlns,"Folder");if(this.foldersName){var folderName=this.createElementNS(this.kmlns,"name");var folderNameText=this.createTextNode(this.foldersName);folderName.appendChild(folderNameText);folder.appendChild(folderName);}  
if(this.foldersDesc){var folderDesc=this.createElementNS(this.kmlns,"description");var folderDescText=this.createTextNode(this.foldersDesc);folderDesc.appendChild(folderDescText);folder.appendChild(folderDesc);}  
return folder;},createPlacemarkXML:function(feature){var placemarkName=this.createElementNS(this.kmlns,"name");var name=feature.style&&feature.style.label?feature.style.label:feature.attributes.name||feature.id;placemarkName.appendChild(this.createTextNode(name));var placemarkDesc=this.createElementNS(this.kmlns,"description");var desc=feature.attributes.description||this.placemarksDesc;placemarkDesc.appendChild(this.createTextNode(desc));var placemarkNode=this.createElementNS(this.kmlns,"Placemark");if(feature.fid!=null){placemarkNode.setAttribute("id",feature.fid);}  
placemarkNode.appendChild(placemarkName);placemarkNode.appendChild(placemarkDesc);var geometryNode=this.buildGeometryNode(feature.geometry);placemarkNode.appendChild(geometryNode);return placemarkNode;},buildGeometryNode:function(geometry){if(this.internalProjection&&this.externalProjection){geometry=geometry.clone();geometry.transform(this.internalProjection,this.externalProjection);}  
var className=geometry.CLASS_NAME;var type=className.substring(className.lastIndexOf(".")+1);var builder=this.buildGeometry[type.toLowerCase()];var node=null;if(builder){node=builder.apply(this,[geometry]);}  
return node;},buildGeometry:{point:function(geometry){var kml=this.createElementNS(this.kmlns,"Point");kml.appendChild(this.buildCoordinatesNode(geometry));return kml;},multipoint:function(geometry){return this.buildGeometry.collection.apply(this,[geometry]);},linestring:function(geometry){var kml=this.createElementNS(this.kmlns,"LineString");kml.appendChild(this.buildCoordinatesNode(geometry));return kml;},multilinestring:function(geometry){return this.buildGeometry.collection.apply(this,[geometry]);},linearring:function(geometry){var kml=this.createElementNS(this.kmlns,"LinearRing");kml.appendChild(this.buildCoordinatesNode(geometry));return kml;},polygon:function(geometry){var kml=this.createElementNS(this.kmlns,"Polygon");var rings=geometry.components;var ringMember,ringGeom,type;for(var i=0,len=rings.length;i<len;++i){type=(i==0)?"outerBoundaryIs":"innerBoundaryIs";ringMember=this.createElementNS(this.kmlns,type);ringGeom=this.buildGeometry.linearring.apply(this,[rings[i]]);ringMember.appendChild(ringGeom);kml.appendChild(ringMember);}  
return kml;},multipolygon:function(geometry){return this.buildGeometry.collection.apply(this,[geometry]);},collection:function(geometry){var kml=this.createElementNS(this.kmlns,"MultiGeometry");var child;for(var i=0,len=geometry.components.length;i<len;++i){child=this.buildGeometryNode.apply(this,[geometry.components[i]]);if(child){kml.appendChild(child);}}  
return kml;}},buildCoordinatesNode:function(geometry){var coordinatesNode=this.createElementNS(this.kmlns,"coordinates");var path;var points=geometry.components;if(points){var point;var numPoints=points.length;var parts=new Array(numPoints);for(var i=0;i<numPoints;++i){point=points[i];parts[i]=point.x+","+point.y;}  
path=parts.join(" ");}else{path=geometry.x+","+geometry.y;}  
var txtNode=this.createTextNode(path);coordinatesNode.appendChild(txtNode);return coordinatesNode;},CLASS_NAME:"OpenLayers.Format.KML"});OpenLayers.Format.OSM=OpenLayers.Class(OpenLayers.Format.XML,{checkTags:false,interestingTagsExclude:null,areaTags:null,initialize:function(options){var layer_defaults={'interestingTagsExclude':['source','source_ref','source:ref','history','attribution','created_by'],'areaTags':['area','building','leisure','tourism','ruins','historic','landuse','military','natural','sport']};layer_defaults=OpenLayers.Util.extend(layer_defaults,options);var interesting={};for(var i=0;i<layer_defaults.interestingTagsExclude.length;i++){interesting[layer_defaults.interestingTagsExclude[i]]=true;}  
layer_defaults.interestingTagsExclude=interesting;var area={};for(var i=0;i<layer_defaults.areaTags.length;i++){area[layer_defaults.areaTags[i]]=true;}  
layer_defaults.areaTags=area;this.externalProjection=new OpenLayers.Projection("EPSG:4326");OpenLayers.Format.XML.prototype.initialize.apply(this,[layer_defaults]);},read:function(doc){if(typeof doc=="string"){doc=OpenLayers.Format.XML.prototype.read.apply(this,[doc]);}  
var nodes=this.getNodes(doc);var ways=this.getWays(doc);var feat_list=new Array(ways.length);for(var i=0;i<ways.length;i++){var point_list=new Array(ways[i].nodes.length);var poly=this.isWayArea(ways[i])?1:0;for(var j=0;j<ways[i].nodes.length;j++){var node=nodes[ways[i].nodes[j]];var point=new OpenLayers.Geometry.Point(node.lon,node.lat);point.osm_id=parseInt(ways[i].nodes[j]);point_list[j]=point;node.used=true;}  
var geometry=null;if(poly){geometry=new OpenLayers.Geometry.Polygon(new OpenLayers.Geometry.LinearRing(point_list));}else{geometry=new OpenLayers.Geometry.LineString(point_list);}  
if(this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection);}  
var feat=new OpenLayers.Feature.Vector(geometry,ways[i].tags);feat.osm_id=parseInt(ways[i].id);feat.fid="way."+feat.osm_id;feat_list[i]=feat;}  
for(var node_id in nodes){var node=nodes[node_id];if(!node.used||this.checkTags){var tags=null;if(this.checkTags){var result=this.getTags(node.node,true);if(node.used&&!result[1]){continue;}  
tags=result[0];}else{tags=this.getTags(node.node);}  
var feat=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(node['lon'],node['lat']),tags);if(this.internalProjection&&this.externalProjection){feat.geometry.transform(this.externalProjection,this.internalProjection);}  
feat.osm_id=parseInt(node_id);feat.fid="node."+feat.osm_id;feat_list.push(feat);}  
node.node=null;}  
return feat_list;},getNodes:function(doc){var node_list=doc.getElementsByTagName("node");var nodes={};for(var i=0;i<node_list.length;i++){var node=node_list[i];var id=node.getAttribute("id");nodes[id]={'lat':node.getAttribute("lat"),'lon':node.getAttribute("lon"),'node':node};}  
return nodes;},getWays:function(doc){var way_list=doc.getElementsByTagName("way");var return_ways=[];for(var i=0;i<way_list.length;i++){var way=way_list[i];var way_object={id:way.getAttribute("id")};way_object.tags=this.getTags(way);var node_list=way.getElementsByTagName("nd");way_object.nodes=new Array(node_list.length);for(var j=0;j<node_list.length;j++){way_object.nodes[j]=node_list[j].getAttribute("ref");}  
return_ways.push(way_object);}  
return return_ways;},getTags:function(dom_node,interesting_tags){var tag_list=dom_node.getElementsByTagName("tag");var tags={};var interesting=false;for(var j=0;j<tag_list.length;j++){var key=tag_list[j].getAttribute("k");tags[key]=tag_list[j].getAttribute("v");if(interesting_tags){if(!this.interestingTagsExclude[key]){interesting=true;}}}  
return interesting_tags?[tags,interesting]:tags;},isWayArea:function(way){var poly_shaped=false;var poly_tags=false;if(way.nodes[0]==way.nodes[way.nodes.length-1]){poly_shaped=true;}  
if(this.checkTags){for(var key in way.tags){if(this.areaTags[key]){poly_tags=true;break;}}}  
return poly_shaped&&(this.checkTags?poly_tags:true);},write:function(features){if(!(features instanceof Array)){features=[features];}  
this.osm_id=1;this.created_nodes={};var root_node=this.createElementNS(null,"osm");root_node.setAttribute("version","0.5");root_node.setAttribute("generator","OpenLayers "+OpenLayers.VERSION_NUMBER);for(var i=features.length-1;i>=0;i--){var nodes=this.createFeatureNodes(features[i]);for(var j=0;j<nodes.length;j++){root_node.appendChild(nodes[j]);}}  
return OpenLayers.Format.XML.prototype.write.apply(this,[root_node]);},createFeatureNodes:function(feature){var nodes=[];var className=feature.geometry.CLASS_NAME;var type=className.substring(className.lastIndexOf(".")+1);type=type.toLowerCase();var builder=this.createXML[type];if(builder){nodes=builder.apply(this,[feature]);}  
return nodes;},createXML:{'point':function(point){var id=null;var geometry=point.geometry?point.geometry:point;var already_exists=false;if(point.osm_id){id=point.osm_id;if(this.created_nodes[id]){already_exists=true;}}else{id=-this.osm_id;this.osm_id++;}  
if(already_exists){node=this.created_nodes[id];}else{var node=this.createElementNS(null,"node");}  
this.created_nodes[id]=node;node.setAttribute("id",id);node.setAttribute("lon",geometry.x);node.setAttribute("lat",geometry.y);if(point.attributes){this.serializeTags(point,node);}  
this.setState(point,node);return already_exists?[]:[node];},linestring:function(feature){var nodes=[];var geometry=feature.geometry;if(feature.osm_id){id=feature.osm_id;}else{id=-this.osm_id;this.osm_id++;}  
var way=this.createElementNS(null,"way");way.setAttribute("id",id);for(var i=0;i<geometry.components.length;i++){var node=this.createXML['point'].apply(this,[geometry.components[i]]);if(node.length){node=node[0];var node_ref=node.getAttribute("id");nodes.push(node);}else{node_ref=geometry.components[i].osm_id;node=this.created_nodes[node_ref];}  
this.setState(feature,node);var nd_dom=this.createElementNS(null,"nd");nd_dom.setAttribute("ref",node_ref);way.appendChild(nd_dom);}  
this.serializeTags(feature,way);nodes.push(way);return nodes;},polygon:function(feature){var attrs=OpenLayers.Util.extend({'area':'yes'},feature.attributes);var feat=new OpenLayers.Feature.Vector(feature.geometry.components[0],attrs);feat.osm_id=feature.osm_id;return this.createXML['linestring'].apply(this,[feat]);}},serializeTags:function(feature,node){for(var key in feature.attributes){var tag=this.createElementNS(null,"tag");tag.setAttribute("k",key);tag.setAttribute("v",feature.attributes[key]);node.appendChild(tag);}},setState:function(feature,node){if(feature.state){var state=null;switch(feature.state){case OpenLayers.State.UPDATE:state="modify";case OpenLayers.State.DELETE:state="delete";}  
if(state){node.setAttribute("action",state);}}},CLASS_NAME:"OpenLayers.Format.OSM"});OpenLayers.Geometry.MultiPolygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Polygon"],initialize:function(components){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments);},CLASS_NAME:"OpenLayers.Geometry.MultiPolygon"});OpenLayers.Handler.Polygon=OpenLayers.Class(OpenLayers.Handler.Path,{polygon:null,initialize:function(control,callbacks,options){OpenLayers.Handler.Path.prototype.initialize.apply(this,arguments);},createFeature:function(pixel){var lonlat=this.control.map.getLonLatFromPixel(pixel);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat));this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LinearRing([this.point.geometry]));this.polygon=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([this.line.geometry]));this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.polygon,this.point],{silent:true});},destroyFeature:function(){OpenLayers.Handler.Path.prototype.destroyFeature.apply(this);this.polygon=null;},drawFeature:function(){this.layer.drawFeature(this.polygon,this.style);this.layer.drawFeature(this.point,this.style);},getSketch:function(){return this.polygon;},getGeometry:function(){var geometry=this.polygon&&this.polygon.geometry;if(geometry&&this.multi){geometry=new OpenLayers.Geometry.MultiPolygon([geometry]);}  
return geometry;},dblclick:function(evt){if(!this.freehandMode(evt)){var index=this.line.geometry.components.length-2;this.line.geometry.removeComponent(this.line.geometry.components[index]);this.removePoint();this.finalize();}  
return false;},CLASS_NAME:"OpenLayers.Handler.Polygon"});OpenLayers.Control.EditingToolbar=OpenLayers.Class(OpenLayers.Control.Panel,{initialize:function(layer,options){OpenLayers.Control.Panel.prototype.initialize.apply(this,[options]);this.addControls([new OpenLayers.Control.Navigation()]);var controls=[new OpenLayers.Control.DrawFeature(layer,OpenLayers.Handler.Point,{'displayClass':'olControlDrawFeaturePoint'}),new OpenLayers.Control.DrawFeature(layer,OpenLayers.Handler.Path,{'displayClass':'olControlDrawFeaturePath'}),new OpenLayers.Control.DrawFeature(layer,OpenLayers.Handler.Polygon,{'displayClass':'olControlDrawFeaturePolygon'})];this.addControls(controls);},draw:function(){var div=OpenLayers.Control.Panel.prototype.draw.apply(this,arguments);this.activateControl(this.controls[0]);return div;},CLASS_NAME:"OpenLayers.Control.EditingToolbar"});OpenLayers.Control.SLDSelect=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["selected"],clearOnDeactivate:false,layers:null,callbacks:null,selectionSymbolizer:{'Polygon':{fillColor:'#FF0000',stroke:false},'Line':{strokeColor:'#FF0000',strokeWidth:2},'Point':{graphicName:'square',fillColor:'#FF0000',pointRadius:5}},layerOptions:null,handlerOptions:null,sketchStyle:null,wfsCache:{},layerCache:{},initialize:function(handler,options){this.EVENT_TYPES=OpenLayers.Control.SLDSelect.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[options]);this.callbacks=OpenLayers.Util.extend({done:this.select,click:this.select},this.callbacks);this.handlerOptions=this.handlerOptions||{};this.layerOptions=OpenLayers.Util.applyDefaults(this.layerOptions,{displayInLayerSwitcher:false});if(this.sketchStyle){this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{styleMap:new OpenLayers.StyleMap({"default":this.sketchStyle})});}  
this.handler=new handler(this,this.callbacks,this.handlerOptions);},destroy:function(){for(var key in this.layerCache){delete this.layerCache[key];}  
for(var key in this.wfsCache){delete this.wfsCache[key];}  
OpenLayers.Control.prototype.destroy.apply(this,arguments);},coupleLayerVisiblity:function(evt){this.setVisibility(evt.object.getVisibility());},createSelectionLayer:function(source){var selectionLayer;if(!this.layerCache[source.id]){selectionLayer=new OpenLayers.Layer.WMS.Post(source.name,source.url,source.params,OpenLayers.Util.applyDefaults(this.layerOptions,source.getOptions()));this.layerCache[source.id]=selectionLayer;if(this.layerOptions.displayInLayerSwitcher===false){source.events.on({"visibilitychanged":this.coupleLayerVisiblity,scope:selectionLayer});}  
this.map.addLayer(selectionLayer);}else{selectionLayer=this.layerCache[source.id];}  
return selectionLayer;},createSLD:function(layer,filters,geometryAttributes){var sld={version:"1.0.0",namedLayers:{}};var layerNames=[layer.params.LAYERS].join(",").split(",");for(var i=0,len=layerNames.length;i<len;i++){var name=layerNames[i];sld.namedLayers[name]={name:name,userStyles:[]};var symbolizer=this.selectionSymbolizer;var geometryAttribute=geometryAttributes[i];if(geometryAttribute.type.indexOf('Polygon')>=0){symbolizer={Polygon:this.selectionSymbolizer['Polygon']};}else if(geometryAttribute.type.indexOf('LineString')>=0){symbolizer={Line:this.selectionSymbolizer['Line']};}else if(geometryAttribute.type.indexOf('Point')>=0){symbolizer={Point:this.selectionSymbolizer['Point']};}  
var filter=filters[i];sld.namedLayers[name].userStyles.push({name:'default',rules:[new OpenLayers.Rule({symbolizer:symbolizer,filter:filter,maxScaleDenominator:layer.options.minScale})]});}  
return new OpenLayers.Format.SLD().write(sld);},parseDescribeLayer:function(request){var format=new OpenLayers.Format.WMSDescribeLayer();var doc=request.responseXML;if(!doc||!doc.documentElement){doc=request.responseText;}  
var describeLayer=format.read(doc);var typeNames=[];var url=null;for(var i=0,len=describeLayer.length;i<len;i++){if(describeLayer[i].owsType=="WFS"){typeNames.push(describeLayer[i].typeName);url=describeLayer[i].owsURL;}}  
var options={url:url,params:{SERVICE:"WFS",TYPENAME:typeNames.toString(),REQUEST:"DescribeFeatureType",VERSION:"1.0.0"},callback:function(request){var format=new OpenLayers.Format.WFSDescribeFeatureType();var doc=request.responseXML;if(!doc||!doc.documentElement){doc=request.responseText;}  
var describeFeatureType=format.read(doc);this.control.wfsCache[this.layer.id]=describeFeatureType;this.control._queue&&this.control.applySelection();},scope:this};OpenLayers.Request.GET(options);},getGeometryAttributes:function(layer){var result=[];var cache=this.wfsCache[layer.id];for(var i=0,len=cache.featureTypes.length;i<len;i++){var typeName=cache.featureTypes[i];var properties=typeName.properties;for(var j=0,lenj=properties.length;j<lenj;j++){var property=properties[j];var type=property.type;if((type.indexOf('LineString')>=0)||(type.indexOf('GeometryAssociationType')>=0)||(type.indexOf('GeometryPropertyType')>=0)||(type.indexOf('Point')>=0)||(type.indexOf('Polygon')>=0)){result.push(property);}}}  
return result;},activate:function(){var activated=OpenLayers.Control.prototype.activate.call(this);if(activated){for(var i=0,len=this.layers.length;i<len;i++){var layer=this.layers[i];if(layer&&!this.wfsCache[layer.id]){var options={url:layer.url,params:{SERVICE:"WMS",VERSION:layer.params.VERSION,LAYERS:layer.params.LAYERS,REQUEST:"DescribeLayer"},callback:this.parseDescribeLayer,scope:{layer:layer,control:this}};OpenLayers.Request.GET(options);}}}  
return activated;},deactivate:function(){var deactivated=OpenLayers.Control.prototype.deactivate.call(this);if(deactivated){for(var i=0,len=this.layers.length;i<len;i++){var layer=this.layers[i];if(layer&&this.clearOnDeactivate===true){var layerCache=this.layerCache;var selectionLayer=layerCache[layer.id];if(selectionLayer){layer.events.un({"visibilitychanged":this.coupleLayerVisiblity,scope:selectionLayer});selectionLayer.destroy();delete layerCache[layer.id];}}}}  
return deactivated;},setLayers:function(layers){if(this.active){this.deactivate();this.layers=layers;this.activate();}else{this.layers=layers;}},createFilter:function(geometryAttribute,geometry){var filter=null;if(this.handler instanceof OpenLayers.Handler.RegularPolygon){if(this.handler.irregular===true){filter=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.BBOX,property:geometryAttribute.name,value:geometry.getBounds()});}else{filter=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.INTERSECTS,property:geometryAttribute.name,value:geometry});}}else if(this.handler instanceof OpenLayers.Handler.Polygon){filter=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.INTERSECTS,property:geometryAttribute.name,value:geometry});}else if(this.handler instanceof OpenLayers.Handler.Path){if(geometryAttribute.type.indexOf('Point')>=0){filter=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.DWITHIN,property:geometryAttribute.name,distance:this.map.getExtent().getWidth()*0.01,distanceUnits:this.map.getUnits(),value:geometry});}else{filter=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.INTERSECTS,property:geometryAttribute.name,value:geometry});}}else if(this.handler instanceof OpenLayers.Handler.Click){if(geometryAttribute.type.indexOf('Polygon')>=0){filter=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.INTERSECTS,property:geometryAttribute.name,value:geometry});}else{filter=new OpenLayers.Filter.Spatial({type:OpenLayers.Filter.Spatial.DWITHIN,property:geometryAttribute.name,distance:this.map.getExtent().getWidth()*0.01,distanceUnits:this.map.getUnits(),value:geometry});}}  
return filter;},select:function(geometry){this._queue=function(){for(var i=0,len=this.layers.length;i<len;i++){var layer=this.layers[i];var geometryAttributes=this.getGeometryAttributes(layer);var filters=[];for(var j=0,lenj=geometryAttributes.length;j<lenj;j++){var geometryAttribute=geometryAttributes[j];if(geometryAttribute!==null){if(!(geometry instanceof OpenLayers.Geometry)){var point=this.map.getLonLatFromPixel(geometry.xy);geometry=new OpenLayers.Geometry.Point(point.lon,point.lat);}  
var filter=this.createFilter(geometryAttribute,geometry);if(filter!==null){filters.push(filter);}}}  
var selectionLayer=this.createSelectionLayer(layer);var sld=this.createSLD(layer,filters,geometryAttributes);this.events.triggerEvent("selected",{layer:layer,filters:filters});selectionLayer.mergeNewParams({SLD_BODY:sld});delete this._queue;}};this.applySelection();},applySelection:function(){var canApply=true;for(var i=0,len=this.layers.length;i<len;i++){if(!this.wfsCache[this.layers[i].id]){canApply=false;break;}}  
canApply&&this._queue.call(this);},CLASS_NAME:"OpenLayers.Control.SLDSelect"});OpenLayers.Format.ArcXML=OpenLayers.Class(OpenLayers.Format.XML,{fontStyleKeys:['antialiasing','blockout','font','fontcolor','fontsize','fontstyle','glowing','interval','outline','printmode','shadow','transparency'],request:null,response:null,initialize:function(options){this.request=new OpenLayers.Format.ArcXML.Request();this.response=new OpenLayers.Format.ArcXML.Response();if(options){if(options.requesttype=="feature"){this.request.get_image=null;var qry=this.request.get_feature.query;this.addCoordSys(qry.featurecoordsys,options.featureCoordSys);this.addCoordSys(qry.filtercoordsys,options.filterCoordSys);if(options.polygon){qry.isspatial=true;qry.spatialfilter.polygon=options.polygon;}else if(options.envelope){qry.isspatial=true;qry.spatialfilter.envelope={minx:0,miny:0,maxx:0,maxy:0};this.parseEnvelope(qry.spatialfilter.envelope,options.envelope);}}else if(options.requesttype=="image"){this.request.get_feature=null;var props=this.request.get_image.properties;this.parseEnvelope(props.envelope,options.envelope);this.addLayers(props.layerlist,options.layers);this.addImageSize(props.imagesize,options.tileSize);this.addCoordSys(props.featurecoordsys,options.featureCoordSys);this.addCoordSys(props.filtercoordsys,options.filterCoordSys);}else{this.request=null;}}  
OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},parseEnvelope:function(env,arr){if(arr&&arr.length==4){env.minx=arr[0];env.miny=arr[1];env.maxx=arr[2];env.maxy=arr[3];}},addLayers:function(ll,lyrs){for(var lind=0,len=lyrs.length;lind<len;lind++){ll.push(lyrs[lind]);}},addImageSize:function(imsize,olsize){if(olsize!==null){imsize.width=olsize.w;imsize.height=olsize.h;imsize.printwidth=olsize.w;imsize.printheight=olsize.h;}},addCoordSys:function(featOrFilt,fsys){if(typeof fsys=="string"){featOrFilt.id=parseInt(fsys);featOrFilt.string=fsys;}  
else if(typeof fsys=="object"&&fsys.proj!==null){featOrFilt.id=fsys.proj.srsProjNumber;featOrFilt.string=fsys.proj.srsCode;}else{featOrFilt=fsys;}},iserror:function(data){var ret=null;if(!data){ret=(this.response.error!=='');}else{data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);var errorNodes=data.documentElement.getElementsByTagName("ERROR");ret=(errorNodes!==null&&errorNodes.length>0);}  
return ret;},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var arcNode=null;if(data&&data.documentElement){if(data.documentElement.nodeName=="ARCXML"){arcNode=data.documentElement;}else{arcNode=data.documentElement.getElementsByTagName("ARCXML")[0];}}  
if(!arcNode||arcNode.firstChild.nodeName==='parsererror'){var error,source;try{error=data.firstChild.nodeValue;source=data.firstChild.childNodes[1].firstChild.nodeValue;}catch(err){}  
throw{message:"Error parsing the ArcXML request",error:error,source:source};}  
var response=this.parseResponse(arcNode);return response;},write:function(request){if(!request){request=this.request;}  
var root=this.createElementNS("","ARCXML");root.setAttribute("version","1.1");var reqElem=this.createElementNS("","REQUEST");if(request.get_image!=null){var getElem=this.createElementNS("","GET_IMAGE");reqElem.appendChild(getElem);var propElem=this.createElementNS("","PROPERTIES");getElem.appendChild(propElem);var props=request.get_image.properties;if(props.featurecoordsys!=null){var feat=this.createElementNS("","FEATURECOORDSYS");propElem.appendChild(feat);if(props.featurecoordsys.id===0){feat.setAttribute("string",props.featurecoordsys['string']);}  
else{feat.setAttribute("id",props.featurecoordsys.id);}}  
if(props.filtercoordsys!=null){var filt=this.createElementNS("","FILTERCOORDSYS");propElem.appendChild(filt);if(props.filtercoordsys.id===0){filt.setAttribute("string",props.filtercoordsys.string);}  
else{filt.setAttribute("id",props.filtercoordsys.id);}}  
if(props.envelope!=null){var env=this.createElementNS("","ENVELOPE");propElem.appendChild(env);env.setAttribute("minx",props.envelope.minx);env.setAttribute("miny",props.envelope.miny);env.setAttribute("maxx",props.envelope.maxx);env.setAttribute("maxy",props.envelope.maxy);}  
var imagesz=this.createElementNS("","IMAGESIZE");propElem.appendChild(imagesz);imagesz.setAttribute("height",props.imagesize.height);imagesz.setAttribute("width",props.imagesize.width);if(props.imagesize.height!=props.imagesize.printheight||props.imagesize.width!=props.imagesize.printwidth){imagesz.setAttribute("printheight",props.imagesize.printheight);imagesz.setArrtibute("printwidth",props.imagesize.printwidth);}  
if(props.background!=null){var backgrnd=this.createElementNS("","BACKGROUND");propElem.appendChild(backgrnd);backgrnd.setAttribute("color",props.background.color.r+","+  
props.background.color.g+","+  
props.background.color.b);if(props.background.transcolor!==null){backgrnd.setAttribute("transcolor",props.background.transcolor.r+","+  
props.background.transcolor.g+","+  
props.background.transcolor.b);}}  
if(props.layerlist!=null&&props.layerlist.length>0){var layerlst=this.createElementNS("","LAYERLIST");propElem.appendChild(layerlst);for(var ld=0;ld<props.layerlist.length;ld++){var ldef=this.createElementNS("","LAYERDEF");layerlst.appendChild(ldef);ldef.setAttribute("id",props.layerlist[ld].id);ldef.setAttribute("visible",props.layerlist[ld].visible);if(typeof props.layerlist[ld].query=="object"){var query=props.layerlist[ld].query;if(query.where.length<0){continue;}  
var queryElem=null;if(typeof query.spatialfilter=="boolean"&&query.spatialfilter){queryElem=this.createElementNS("","SPATIALQUERY");}  
else{queryElem=this.createElementNS("","QUERY");}  
queryElem.setAttribute("where",query.where);if(typeof query.accuracy=="number"&&query.accuracy>0){queryElem.setAttribute("accuracy",query.accuracy);}  
if(typeof query.featurelimit=="number"&&query.featurelimit<2000){queryElem.setAttribute("featurelimit",query.featurelimit);}  
if(typeof query.subfields=="string"&&query.subfields!="#ALL#"){queryElem.setAttribute("subfields",query.subfields);}  
if(typeof query.joinexpression=="string"&&query.joinexpression.length>0){queryElem.setAttribute("joinexpression",query.joinexpression);}  
if(typeof query.jointables=="string"&&query.jointables.length>0){queryElem.setAttribute("jointables",query.jointables);}  
ldef.appendChild(queryElem);}  
if(typeof props.layerlist[ld].renderer=="object"){this.addRenderer(ldef,props.layerlist[ld].renderer);}}}}else if(request.get_feature!=null){var getElem=this.createElementNS("","GET_FEATURES");getElem.setAttribute("outputmode","newxml");getElem.setAttribute("checkesc","true");if(request.get_feature.geometry){getElem.setAttribute("geometry",request.get_feature.geometry);}  
else{getElem.setAttribute("geometry","false");}  
if(request.get_feature.compact){getElem.setAttribute("compact",request.get_feature.compact);}  
if(request.get_feature.featurelimit=="number"){getElem.setAttribute("featurelimit",request.get_feature.featurelimit);}  
getElem.setAttribute("globalenvelope","true");reqElem.appendChild(getElem);if(request.get_feature.layer!=null&&request.get_feature.layer.length>0){var lyrElem=this.createElementNS("","LAYER");lyrElem.setAttribute("id",request.get_feature.layer);getElem.appendChild(lyrElem);}  
var fquery=request.get_feature.query;if(fquery!=null){var qElem=null;if(fquery.isspatial){qElem=this.createElementNS("","SPATIALQUERY");}else{qElem=this.createElementNS("","QUERY");}  
getElem.appendChild(qElem);if(typeof fquery.accuracy=="number"){qElem.setAttribute("accuracy",fquery.accuracy);}  
if(fquery.featurecoordsys!=null){var fcsElem1=this.createElementNS("","FEATURECOORDSYS");if(fquery.featurecoordsys.id==0){fcsElem1.setAttribute("string",fquery.featurecoordsys.string);}else{fcsElem1.setAttribute("id",fquery.featurecoordsys.id);}  
qElem.appendChild(fcsElem1);}  
if(fquery.filtercoordsys!=null){var fcsElem2=this.createElementNS("","FILTERCOORDSYS");if(fquery.filtercoordsys.id===0){fcsElem2.setAttribute("string",fquery.filtercoordsys.string);}else{fcsElem2.setAttribute("id",fquery.filtercoordsys.id);}  
qElem.appendChild(fcsElem2);}  
if(fquery.buffer>0){var bufElem=this.createElementNS("","BUFFER");bufElem.setAttribute("distance",fquery.buffer);qElem.appendChild(bufElem);}  
if(fquery.isspatial){var spfElem=this.createElementNS("","SPATIALFILTER");spfElem.setAttribute("relation",fquery.spatialfilter.relation);qElem.appendChild(spfElem);if(fquery.spatialfilter.envelope){var envElem=this.createElementNS("","ENVELOPE");envElem.setAttribute("minx",fquery.spatialfilter.envelope.minx);envElem.setAttribute("miny",fquery.spatialfilter.envelope.miny);envElem.setAttribute("maxx",fquery.spatialfilter.envelope.maxx);envElem.setAttribute("maxy",fquery.spatialfilter.envelope.maxy);spfElem.appendChild(envElem);}else if(typeof fquery.spatialfilter.polygon=="object"){spfElem.appendChild(this.writePolygonGeometry(fquery.spatialfilter.polygon));}}  
if(fquery.where!=null&&fquery.where.length>0){qElem.setAttribute("where",fquery.where);}}}  
root.appendChild(reqElem);return OpenLayers.Format.XML.prototype.write.apply(this,[root]);},addGroupRenderer:function(ldef,toprenderer){var topRelem=this.createElementNS("","GROUPRENDERER");ldef.appendChild(topRelem);for(var rind=0;rind<toprenderer.length;rind++){var renderer=toprenderer[rind];this.addRenderer(topRelem,renderer);}},addRenderer:function(topRelem,renderer){if(renderer instanceof Array){this.addGroupRenderer(topRelem,renderer);}else{var renderElem=this.createElementNS("",renderer.type.toUpperCase()+"RENDERER");topRelem.appendChild(renderElem);if(renderElem.tagName=="VALUEMAPRENDERER"){this.addValueMapRenderer(renderElem,renderer);}else if(renderElem.tagName=="VALUEMAPLABELRENDERER"){this.addValueMapLabelRenderer(renderElem,renderer);}else if(renderElem.tagName=="SIMPLELABELRENDERER"){this.addSimpleLabelRenderer(renderElem,renderer);}else if(renderElem.tagName=="SCALEDEPENDENTRENDERER"){this.addScaleDependentRenderer(renderElem,renderer);}}},addScaleDependentRenderer:function(renderElem,renderer){if(typeof renderer.lower=="string"||typeof renderer.lower=="number"){renderElem.setAttribute("lower",renderer.lower);}  
if(typeof renderer.upper=="string"||typeof renderer.upper=="number"){renderElem.setAttribute("upper",renderer.upper);}  
this.addRenderer(renderElem,renderer.renderer);},addValueMapLabelRenderer:function(renderElem,renderer){renderElem.setAttribute("lookupfield",renderer.lookupfield);renderElem.setAttribute("labelfield",renderer.labelfield);if(typeof renderer.exacts=="object"){for(var ext=0,extlen=renderer.exacts.length;ext<extlen;ext++){var exact=renderer.exacts[ext];var eelem=this.createElementNS("","EXACT");if(typeof exact.value=="string"){eelem.setAttribute("value",exact.value);}  
if(typeof exact.label=="string"){eelem.setAttribute("label",exact.label);}  
if(typeof exact.method=="string"){eelem.setAttribute("method",exact.method);}  
renderElem.appendChild(eelem);if(typeof exact.symbol=="object"){var selem=null;if(exact.symbol.type=="text"){selem=this.createElementNS("","TEXTSYMBOL");}  
if(selem!=null){var keys=this.fontStyleKeys;for(var i=0,len=keys.length;i<len;i++){var key=keys[i];if(exact.symbol[key]){selem.setAttribute(key,exact.symbol[key]);}}  
eelem.appendChild(selem);}}}}},addValueMapRenderer:function(renderElem,renderer){renderElem.setAttribute("lookupfield",renderer.lookupfield);if(typeof renderer.ranges=="object"){for(var rng=0,rnglen=renderer.ranges.length;rng<rnglen;rng++){var range=renderer.ranges[rng];var relem=this.createElementNS("","RANGE");relem.setAttribute("lower",range.lower);relem.setAttribute("upper",range.upper);renderElem.appendChild(relem);if(typeof range.symbol=="object"){var selem=null;if(range.symbol.type=="simplepolygon"){selem=this.createElementNS("","SIMPLEPOLYGONSYMBOL");}  
if(selem!=null){if(typeof range.symbol.boundarycolor=="string"){selem.setAttribute("boundarycolor",range.symbol.boundarycolor);}  
if(typeof range.symbol.fillcolor=="string"){selem.setAttribute("fillcolor",range.symbol.fillcolor);}  
if(typeof range.symbol.filltransparency=="number"){selem.setAttribute("filltransparency",range.symbol.filltransparency);}  
relem.appendChild(selem);}}}}else if(typeof renderer.exacts=="object"){for(var ext=0,extlen=renderer.exacts.length;ext<extlen;ext++){var exact=renderer.exacts[ext];var eelem=this.createElementNS("","EXACT");if(typeof exact.value=="string"){eelem.setAttribute("value",exact.value);}  
if(typeof exact.label=="string"){eelem.setAttribute("label",exact.label);}  
if(typeof exact.method=="string"){eelem.setAttribute("method",exact.method);}  
renderElem.appendChild(eelem);if(typeof exact.symbol=="object"){var selem=null;if(exact.symbol.type=="simplemarker"){selem=this.createElementNS("","SIMPLEMARKERSYMBOL");}  
if(selem!=null){if(typeof exact.symbol.antialiasing=="string"){selem.setAttribute("antialiasing",exact.symbol.antialiasing);}  
if(typeof exact.symbol.color=="string"){selem.setAttribute("color",exact.symbol.color);}  
if(typeof exact.symbol.outline=="string"){selem.setAttribute("outline",exact.symbol.outline);}  
if(typeof exact.symbol.overlap=="string"){selem.setAttribute("overlap",exact.symbol.overlap);}  
if(typeof exact.symbol.shadow=="string"){selem.setAttribute("shadow",exact.symbol.shadow);}  
if(typeof exact.symbol.transparency=="number"){selem.setAttribute("transparency",exact.symbol.transparency);}  
if(typeof exact.symbol.usecentroid=="string"){selem.setAttribute("usecentroid",exact.symbol.usecentroid);}  
if(typeof exact.symbol.width=="number"){selem.setAttribute("width",exact.symbol.width);}  
eelem.appendChild(selem);}}}}},addSimpleLabelRenderer:function(renderElem,renderer){renderElem.setAttribute("field",renderer.field);var keys=['featureweight','howmanylabels','labelbufferratio','labelpriorities','labelweight','linelabelposition','rotationalangles'];for(var i=0,len=keys.length;i<len;i++){var key=keys[i];if(renderer[key]){renderElem.setAttribute(key,renderer[key]);}}  
if(renderer.symbol.type=="text"){var symbol=renderer.symbol;var selem=this.createElementNS("","TEXTSYMBOL");renderElem.appendChild(selem);var keys=this.fontStyleKeys;for(var i=0,len=keys.length;i<len;i++){var key=keys[i];if(symbol[key]){selem.setAttribute(key,renderer[key]);}}}},writePolygonGeometry:function(polygon){if(!(polygon instanceof OpenLayers.Geometry.Polygon)){throw{message:'Cannot write polygon geometry to ArcXML with an '+  
polygon.CLASS_NAME+' object.',geometry:polygon};}  
var polyElem=this.createElementNS("","POLYGON");for(var ln=0,lnlen=polygon.components.length;ln<lnlen;ln++){var ring=polygon.components[ln];var ringElem=this.createElementNS("","RING");for(var rn=0,rnlen=ring.components.length;rn<rnlen;rn++){var point=ring.components[rn];var pointElem=this.createElementNS("","POINT");pointElem.setAttribute("x",point.x);pointElem.setAttribute("y",point.y);ringElem.appendChild(pointElem);}  
polyElem.appendChild(ringElem);}  
return polyElem;},parseResponse:function(data){if(typeof data=="string"){var newData=new OpenLayers.Format.XML();data=newData.read(data);}  
var response=new OpenLayers.Format.ArcXML.Response();var errorNode=data.getElementsByTagName("ERROR");if(errorNode!=null&&errorNode.length>0){response.error=this.getChildValue(errorNode,"Unknown error.");}else{var responseNode=data.getElementsByTagName("RESPONSE");if(responseNode==null||responseNode.length==0){response.error="No RESPONSE tag found in ArcXML response.";return response;}  
var rtype=responseNode[0].firstChild.nodeName;if(rtype=="#text"){rtype=responseNode[0].firstChild.nextSibling.nodeName;}  
if(rtype=="IMAGE"){var envelopeNode=data.getElementsByTagName("ENVELOPE");var outputNode=data.getElementsByTagName("OUTPUT");if(envelopeNode==null||envelopeNode.length==0){response.error="No ENVELOPE tag found in ArcXML response.";}else if(outputNode==null||outputNode.length==0){response.error="No OUTPUT tag found in ArcXML response.";}else{var envAttr=this.parseAttributes(envelopeNode[0]);var outputAttr=this.parseAttributes(outputNode[0]);if(typeof outputAttr.type=="string"){response.image={envelope:envAttr,output:{type:outputAttr.type,data:this.getChildValue(outputNode[0])}};}else{response.image={envelope:envAttr,output:outputAttr};}}}else if(rtype=="FEATURES"){var features=responseNode[0].getElementsByTagName("FEATURES");var featureCount=features[0].getElementsByTagName("FEATURECOUNT");response.features.featurecount=featureCount[0].getAttribute("count");if(response.features.featurecount>0){var envelope=features[0].getElementsByTagName("ENVELOPE");response.features.envelope=this.parseAttributes(envelope[0],typeof(0));var featureList=features[0].getElementsByTagName("FEATURE");for(var fn=0;fn<featureList.length;fn++){var feature=new OpenLayers.Feature.Vector();var fields=featureList[fn].getElementsByTagName("FIELD");for(var fdn=0;fdn<fields.length;fdn++){var fieldName=fields[fdn].getAttribute("name");var fieldValue=fields[fdn].getAttribute("value");feature.attributes[fieldName]=fieldValue;}  
var geom=featureList[fn].getElementsByTagName("POLYGON");if(geom.length>0){var ring=geom[0].getElementsByTagName("RING");var polys=[];for(var rn=0;rn<ring.length;rn++){var linearRings=[];linearRings.push(this.parsePointGeometry(ring[rn]));var holes=ring[rn].getElementsByTagName("HOLE");for(var hn=0;hn<holes.length;hn++){linearRings.push(this.parsePointGeometry(holes[hn]));}  
holes=null;polys.push(new OpenLayers.Geometry.Polygon(linearRings));linearRings=null;}  
ring=null;if(polys.length==1){feature.geometry=polys[0];}else  
{feature.geometry=new OpenLayers.Geometry.MultiPolygon(polys);}}  
response.features.feature.push(feature);}}}else{response.error="Unidentified response type.";}}  
return response;},parseAttributes:function(node,type){var attributes={};for(var attr=0;attr<node.attributes.length;attr++){if(type=="number"){attributes[node.attributes[attr].nodeName]=parseFloat(node.attributes[attr].nodeValue);}else{attributes[node.attributes[attr].nodeName]=node.attributes[attr].nodeValue;}}  
return attributes;},parsePointGeometry:function(node){var ringPoints=[];var coords=node.getElementsByTagName("COORDS");if(coords.length>0){var coordArr=this.getChildValue(coords[0]);coordArr=coordArr.split(/;/);for(var cn=0;cn<coordArr.length;cn++){var coordItems=coordArr[cn].split(/ /);ringPoints.push(new OpenLayers.Geometry.Point(parseFloat(coordItems[0]),parseFloat(coordItems[1])));}  
coords=null;}else{var point=node.getElementsByTagName("POINT");if(point.length>0){for(var pn=0;pn<point.length;pn++){ringPoints.push(new OpenLayers.Geometry.Point(parseFloat(point[pn].getAttribute("x")),parseFloat(point[pn].getAttribute("y"))));}}  
point=null;}  
return new OpenLayers.Geometry.LinearRing(ringPoints);},CLASS_NAME:"OpenLayers.Format.ArcXML"});OpenLayers.Format.ArcXML.Request=OpenLayers.Class({initialize:function(params){var defaults={get_image:{properties:{background:null,draw:true,envelope:{minx:0,miny:0,maxx:0,maxy:0},featurecoordsys:{id:0,string:"",datumtransformid:0,datumtransformstring:""},filtercoordsys:{id:0,string:"",datumtransformid:0,datumtransformstring:""},imagesize:{height:0,width:0,dpi:96,printheight:0,printwidth:0,scalesymbols:false},layerlist:[],output:{baseurl:"",legendbaseurl:"",legendname:"",legendpath:"",legendurl:"",name:"",path:"",type:"jpg",url:""}}},get_feature:{layer:"",query:{isspatial:false,featurecoordsys:{id:0,string:"",datumtransformid:0,datumtransformstring:""},filtercoordsys:{id:0,string:"",datumtransformid:0,datumtransformstring:""},buffer:0,where:"",spatialfilter:{relation:"envelope_intersection",envelope:null}}},environment:{separators:{cs:" ",ts:";"}},layer:[],workspaces:[]};return OpenLayers.Util.extend(this,defaults);},CLASS_NAME:"OpenLayers.Format.ArcXML.Request"});OpenLayers.Format.ArcXML.Response=OpenLayers.Class({initialize:function(params){var defaults={image:{envelope:null,output:''},features:{featurecount:0,envelope:null,feature:[]},error:''};return OpenLayers.Util.extend(this,defaults);},CLASS_NAME:"OpenLayers.Format.ArcXML.Response"});OpenLayers.Format.GML=OpenLayers.Class(OpenLayers.Format.XML,{featureNS:"http://mapserver.gis.umn.edu/mapserver",featurePrefix:"feature",featureName:"featureMember",layerName:"features",geometryName:"geometry",collectionName:"FeatureCollection",gmlns:"http://www.opengis.net/gml",extractAttributes:true,xy:true,initialize:function(options){this.regExes={trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)};OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
var featureNodes=this.getElementsByTagNameNS(data.documentElement,this.gmlns,this.featureName);var features=[];for(var i=0;i<featureNodes.length;i++){var feature=this.parseFeature(featureNodes[i]);if(feature){features.push(feature);}}  
return features;},parseFeature:function(node){var order=["MultiPolygon","Polygon","MultiLineString","LineString","MultiPoint","Point","Envelope"];var type,nodeList,geometry,parser;for(var i=0;i<order.length;++i){type=order[i];nodeList=this.getElementsByTagNameNS(node,this.gmlns,type);if(nodeList.length>0){parser=this.parseGeometry[type.toLowerCase()];if(parser){geometry=parser.apply(this,[nodeList[0]]);if(this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection);}}else{OpenLayers.Console.error(OpenLayers.i18n("unsupportedGeometryType",{'geomType':type}));}  
break;}}  
var bounds;var boxNodes=this.getElementsByTagNameNS(node,this.gmlns,"Box");for(i=0;i<boxNodes.length;++i){var boxNode=boxNodes[i];var box=this.parseGeometry["box"].apply(this,[boxNode]);var parentNode=boxNode.parentNode;var parentName=parentNode.localName||parentNode.nodeName.split(":").pop();if(parentName==="boundedBy"){bounds=box;}else{geometry=box.toGeometry();}}  
var attributes;if(this.extractAttributes){attributes=this.parseAttributes(node);}  
var feature=new OpenLayers.Feature.Vector(geometry,attributes);feature.bounds=bounds;feature.gml={featureType:node.firstChild.nodeName.split(":")[1],featureNS:node.firstChild.namespaceURI,featureNSPrefix:node.firstChild.prefix};var childNode=node.firstChild;var fid;while(childNode){if(childNode.nodeType==1){fid=childNode.getAttribute("fid")||childNode.getAttribute("id");if(fid){break;}}  
childNode=childNode.nextSibling;}  
feature.fid=fid;return feature;},parseGeometry:{point:function(node){var nodeList,coordString;var coords=[];var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"pos");if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);}  
if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coordinates");if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.removeSpace,"");coords=coordString.split(",");}}  
if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coord");if(nodeList.length>0){var xList=this.getElementsByTagNameNS(nodeList[0],this.gmlns,"X");var yList=this.getElementsByTagNameNS(nodeList[0],this.gmlns,"Y");if(xList.length>0&&yList.length>0){coords=[xList[0].firstChild.nodeValue,yList[0].firstChild.nodeValue];}}}  
if(coords.length==2){coords[2]=null;}  
if(this.xy){return new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}  
else{return new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}},multipoint:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"Point");var components=[];if(nodeList.length>0){var point;for(var i=0;i<nodeList.length;++i){point=this.parseGeometry.point.apply(this,[nodeList[i]]);if(point){components.push(point);}}}  
return new OpenLayers.Geometry.MultiPoint(components);},linestring:function(node,ring){var nodeList,coordString;var coords=[];var points=[];nodeList=this.getElementsByTagNameNS(node,this.gmlns,"posList");if(nodeList.length>0){coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);var dim=parseInt(nodeList[0].getAttribute("dimension"));var j,x,y,z;for(var i=0;i<coords.length/dim;++i){j=i*dim;x=coords[j];y=coords[j+1];z=(dim==2)?null:coords[j+2];if(this.xy){points.push(new OpenLayers.Geometry.Point(x,y,z));}else{points.push(new OpenLayers.Geometry.Point(y,x,z));}}}  
if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coordinates");if(nodeList.length>0){coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coordString=coordString.replace(this.regExes.trimComma,",");var pointList=coordString.split(this.regExes.splitSpace);for(var i=0;i<pointList.length;++i){coords=pointList[i].split(",");if(coords.length==2){coords[2]=null;}  
if(this.xy){points.push(new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]));}else{points.push(new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]));}}}}  
var line=null;if(points.length!=0){if(ring){line=new OpenLayers.Geometry.LinearRing(points);}else{line=new OpenLayers.Geometry.LineString(points);}}  
return line;},multilinestring:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"LineString");var components=[];if(nodeList.length>0){var line;for(var i=0;i<nodeList.length;++i){line=this.parseGeometry.linestring.apply(this,[nodeList[i]]);if(line){components.push(line);}}}  
return new OpenLayers.Geometry.MultiLineString(components);},polygon:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"LinearRing");var components=[];if(nodeList.length>0){var ring;for(var i=0;i<nodeList.length;++i){ring=this.parseGeometry.linestring.apply(this,[nodeList[i],true]);if(ring){components.push(ring);}}}  
return new OpenLayers.Geometry.Polygon(components);},multipolygon:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"Polygon");var components=[];if(nodeList.length>0){var polygon;for(var i=0;i<nodeList.length;++i){polygon=this.parseGeometry.polygon.apply(this,[nodeList[i]]);if(polygon){components.push(polygon);}}}  
return new OpenLayers.Geometry.MultiPolygon(components);},envelope:function(node){var components=[];var coordString;var envelope;var lpoint=this.getElementsByTagNameNS(node,this.gmlns,"lowerCorner");if(lpoint.length>0){var coords=[];if(lpoint.length>0){coordString=lpoint[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);}  
if(coords.length==2){coords[2]=null;}  
if(this.xy){var lowerPoint=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{var lowerPoint=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}}  
var upoint=this.getElementsByTagNameNS(node,this.gmlns,"upperCorner");if(upoint.length>0){var coords=[];if(upoint.length>0){coordString=upoint[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);}  
if(coords.length==2){coords[2]=null;}  
if(this.xy){var upperPoint=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{var upperPoint=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}}  
if(lowerPoint&&upperPoint){components.push(new OpenLayers.Geometry.Point(lowerPoint.x,lowerPoint.y));components.push(new OpenLayers.Geometry.Point(upperPoint.x,lowerPoint.y));components.push(new OpenLayers.Geometry.Point(upperPoint.x,upperPoint.y));components.push(new OpenLayers.Geometry.Point(lowerPoint.x,upperPoint.y));components.push(new OpenLayers.Geometry.Point(lowerPoint.x,lowerPoint.y));var ring=new OpenLayers.Geometry.LinearRing(components);envelope=new OpenLayers.Geometry.Polygon([ring]);}  
return envelope;},box:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coordinates");var coordString;var coords,beginPoint=null,endPoint=null;if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coords=coordString.split(" ");if(coords.length==2){beginPoint=coords[0].split(",");endPoint=coords[1].split(",");}}  
if(beginPoint!==null&&endPoint!==null){return new OpenLayers.Bounds(parseFloat(beginPoint[0]),parseFloat(beginPoint[1]),parseFloat(endPoint[0]),parseFloat(endPoint[1]));}}},parseAttributes:function(node){var attributes={};var childNode=node.firstChild;var children,i,child,grandchildren,grandchild,name,value;while(childNode){if(childNode.nodeType==1){children=childNode.childNodes;for(i=0;i<children.length;++i){child=children[i];if(child.nodeType==1){grandchildren=child.childNodes;if(grandchildren.length==1){grandchild=grandchildren[0];if(grandchild.nodeType==3||grandchild.nodeType==4){name=(child.prefix)?child.nodeName.split(":")[1]:child.nodeName;value=grandchild.nodeValue.replace(this.regExes.trimSpace,"");attributes[name]=value;}}else{attributes[child.nodeName.split(":").pop()]=null;}}}  
break;}  
childNode=childNode.nextSibling;}  
return attributes;},write:function(features){if(!(features instanceof Array)){features=[features];}  
var gml=this.createElementNS("http://www.opengis.net/wfs","wfs:"+this.collectionName);for(var i=0;i<features.length;i++){gml.appendChild(this.createFeatureXML(features[i]));}  
return OpenLayers.Format.XML.prototype.write.apply(this,[gml]);},createFeatureXML:function(feature){var geometry=feature.geometry;var geometryNode=this.buildGeometryNode(geometry);var geomContainer=this.createElementNS(this.featureNS,this.featurePrefix+":"+  
this.geometryName);geomContainer.appendChild(geometryNode);var featureNode=this.createElementNS(this.gmlns,"gml:"+this.featureName);var featureContainer=this.createElementNS(this.featureNS,this.featurePrefix+":"+  
this.layerName);var fid=feature.fid||feature.id;featureContainer.setAttribute("fid",fid);featureContainer.appendChild(geomContainer);for(var attr in feature.attributes){var attrText=this.createTextNode(feature.attributes[attr]);var nodename=attr.substring(attr.lastIndexOf(":")+1);var attrContainer=this.createElementNS(this.featureNS,this.featurePrefix+":"+  
nodename);attrContainer.appendChild(attrText);featureContainer.appendChild(attrContainer);}  
featureNode.appendChild(featureContainer);return featureNode;},buildGeometryNode:function(geometry){if(this.externalProjection&&this.internalProjection){geometry=geometry.clone();geometry.transform(this.internalProjection,this.externalProjection);}  
var className=geometry.CLASS_NAME;var type=className.substring(className.lastIndexOf(".")+1);var builder=this.buildGeometry[type.toLowerCase()];return builder.apply(this,[geometry]);},buildGeometry:{point:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:Point");gml.appendChild(this.buildCoordinatesNode(geometry));return gml;},multipoint:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:MultiPoint");var points=geometry.components;var pointMember,pointGeom;for(var i=0;i<points.length;i++){pointMember=this.createElementNS(this.gmlns,"gml:pointMember");pointGeom=this.buildGeometry.point.apply(this,[points[i]]);pointMember.appendChild(pointGeom);gml.appendChild(pointMember);}  
return gml;},linestring:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:LineString");gml.appendChild(this.buildCoordinatesNode(geometry));return gml;},multilinestring:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:MultiLineString");var lines=geometry.components;var lineMember,lineGeom;for(var i=0;i<lines.length;++i){lineMember=this.createElementNS(this.gmlns,"gml:lineStringMember");lineGeom=this.buildGeometry.linestring.apply(this,[lines[i]]);lineMember.appendChild(lineGeom);gml.appendChild(lineMember);}  
return gml;},linearring:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:LinearRing");gml.appendChild(this.buildCoordinatesNode(geometry));return gml;},polygon:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:Polygon");var rings=geometry.components;var ringMember,ringGeom,type;for(var i=0;i<rings.length;++i){type=(i==0)?"outerBoundaryIs":"innerBoundaryIs";ringMember=this.createElementNS(this.gmlns,"gml:"+type);ringGeom=this.buildGeometry.linearring.apply(this,[rings[i]]);ringMember.appendChild(ringGeom);gml.appendChild(ringMember);}  
return gml;},multipolygon:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:MultiPolygon");var polys=geometry.components;var polyMember,polyGeom;for(var i=0;i<polys.length;++i){polyMember=this.createElementNS(this.gmlns,"gml:polygonMember");polyGeom=this.buildGeometry.polygon.apply(this,[polys[i]]);polyMember.appendChild(polyGeom);gml.appendChild(polyMember);}  
return gml;},bounds:function(bounds){var gml=this.createElementNS(this.gmlns,"gml:Box");gml.appendChild(this.buildCoordinatesNode(bounds));return gml;}},buildCoordinatesNode:function(geometry){var coordinatesNode=this.createElementNS(this.gmlns,"gml:coordinates");coordinatesNode.setAttribute("decimal",".");coordinatesNode.setAttribute("cs",",");coordinatesNode.setAttribute("ts"," ");var parts=[];if(geometry instanceof OpenLayers.Bounds){parts.push(geometry.left+","+geometry.bottom);parts.push(geometry.right+","+geometry.top);}else{var points=(geometry.components)?geometry.components:[geometry];for(var i=0;i<points.length;i++){parts.push(points[i].x+","+points[i].y);}}  
var txtNode=this.createTextNode(parts.join(" "));coordinatesNode.appendChild(txtNode);return coordinatesNode;},CLASS_NAME:"OpenLayers.Format.GML"});OpenLayers.Format.GeoJSON=OpenLayers.Class(OpenLayers.Format.JSON,{ignoreExtraDims:false,initialize:function(options){OpenLayers.Format.JSON.prototype.initialize.apply(this,[options]);},read:function(json,type,filter){type=(type)?type:"FeatureCollection";var results=null;var obj=null;if(typeof json=="string"){obj=OpenLayers.Format.JSON.prototype.read.apply(this,[json,filter]);}else{obj=json;}  
if(!obj){OpenLayers.Console.error("Bad JSON: "+json);}else if(typeof(obj.type)!="string"){OpenLayers.Console.error("Bad GeoJSON - no type: "+json);}else if(this.isValidType(obj,type)){switch(type){case"Geometry":try{results=this.parseGeometry(obj);}catch(err){OpenLayers.Console.error(err);}  
break;case"Feature":try{results=this.parseFeature(obj);results.type="Feature";}catch(err){OpenLayers.Console.error(err);}  
break;case"FeatureCollection":results=[];switch(obj.type){case"Feature":try{results.push(this.parseFeature(obj));}catch(err){results=null;OpenLayers.Console.error(err);}  
break;case"FeatureCollection":for(var i=0,len=obj.features.length;i<len;++i){try{results.push(this.parseFeature(obj.features[i]));}catch(err){results=null;OpenLayers.Console.error(err);}}  
break;default:try{var geom=this.parseGeometry(obj);results.push(new OpenLayers.Feature.Vector(geom));}catch(err){results=null;OpenLayers.Console.error(err);}}  
break;}}  
return results;},isValidType:function(obj,type){var valid=false;switch(type){case"Geometry":if(OpenLayers.Util.indexOf(["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","Box","GeometryCollection"],obj.type)==-1){OpenLayers.Console.error("Unsupported geometry type: "+  
obj.type);}else{valid=true;}  
break;case"FeatureCollection":valid=true;break;default:if(obj.type==type){valid=true;}else{OpenLayers.Console.error("Cannot convert types from "+  
obj.type+" to "+type);}}  
return valid;},parseFeature:function(obj){var feature,geometry,attributes,bbox;attributes=(obj.properties)?obj.properties:{};bbox=(obj.geometry&&obj.geometry.bbox)||obj.bbox;try{geometry=this.parseGeometry(obj.geometry);}catch(err){throw err;}  
feature=new OpenLayers.Feature.Vector(geometry,attributes);if(bbox){feature.bounds=OpenLayers.Bounds.fromArray(bbox);}  
if(obj.id){feature.fid=obj.id;}  
return feature;},parseGeometry:function(obj){if(obj==null){return null;}  
var geometry,collection=false;if(obj.type=="GeometryCollection"){if(!(obj.geometries instanceof Array)){throw"GeometryCollection must have geometries array: "+obj;}  
var numGeom=obj.geometries.length;var components=new Array(numGeom);for(var i=0;i<numGeom;++i){components[i]=this.parseGeometry.apply(this,[obj.geometries[i]]);}  
geometry=new OpenLayers.Geometry.Collection(components);collection=true;}else{if(!(obj.coordinates instanceof Array)){throw"Geometry must have coordinates array: "+obj;}  
if(!this.parseCoords[obj.type.toLowerCase()]){throw"Unsupported geometry type: "+obj.type;}  
try{geometry=this.parseCoords[obj.type.toLowerCase()].apply(this,[obj.coordinates]);}catch(err){throw err;}}  
if(this.internalProjection&&this.externalProjection&&!collection){geometry.transform(this.externalProjection,this.internalProjection);}  
return geometry;},parseCoords:{"point":function(array){if(this.ignoreExtraDims==false&&array.length!=2){throw"Only 2D points are supported: "+array;}  
return new OpenLayers.Geometry.Point(array[0],array[1]);},"multipoint":function(array){var points=[];var p=null;for(var i=0,len=array.length;i<len;++i){try{p=this.parseCoords["point"].apply(this,[array[i]]);}catch(err){throw err;}  
points.push(p);}  
return new OpenLayers.Geometry.MultiPoint(points);},"linestring":function(array){var points=[];var p=null;for(var i=0,len=array.length;i<len;++i){try{p=this.parseCoords["point"].apply(this,[array[i]]);}catch(err){throw err;}  
points.push(p);}  
return new OpenLayers.Geometry.LineString(points);},"multilinestring":function(array){var lines=[];var l=null;for(var i=0,len=array.length;i<len;++i){try{l=this.parseCoords["linestring"].apply(this,[array[i]]);}catch(err){throw err;}  
lines.push(l);}  
return new OpenLayers.Geometry.MultiLineString(lines);},"polygon":function(array){var rings=[];var r,l;for(var i=0,len=array.length;i<len;++i){try{l=this.parseCoords["linestring"].apply(this,[array[i]]);}catch(err){throw err;}  
r=new OpenLayers.Geometry.LinearRing(l.components);rings.push(r);}  
return new OpenLayers.Geometry.Polygon(rings);},"multipolygon":function(array){var polys=[];var p=null;for(var i=0,len=array.length;i<len;++i){try{p=this.parseCoords["polygon"].apply(this,[array[i]]);}catch(err){throw err;}  
polys.push(p);}  
return new OpenLayers.Geometry.MultiPolygon(polys);},"box":function(array){if(array.length!=2){throw"GeoJSON box coordinates must have 2 elements";}  
return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(array[0][0],array[0][1]),new OpenLayers.Geometry.Point(array[1][0],array[0][1]),new OpenLayers.Geometry.Point(array[1][0],array[1][1]),new OpenLayers.Geometry.Point(array[0][0],array[1][1]),new OpenLayers.Geometry.Point(array[0][0],array[0][1])])]);}},write:function(obj,pretty){var geojson={"type":null};if(obj instanceof Array){geojson.type="FeatureCollection";var numFeatures=obj.length;geojson.features=new Array(numFeatures);for(var i=0;i<numFeatures;++i){var element=obj[i];if(!element instanceof OpenLayers.Feature.Vector){var msg="FeatureCollection only supports collections "+"of features: "+element;throw msg;}  
geojson.features[i]=this.extract.feature.apply(this,[element]);}}else if(obj.CLASS_NAME.indexOf("OpenLayers.Geometry")==0){geojson=this.extract.geometry.apply(this,[obj]);}else if(obj instanceof OpenLayers.Feature.Vector){geojson=this.extract.feature.apply(this,[obj]);if(obj.layer&&obj.layer.projection){geojson.crs=this.createCRSObject(obj);}}  
return OpenLayers.Format.JSON.prototype.write.apply(this,[geojson,pretty]);},createCRSObject:function(object){var proj=object.layer.projection.toString();var crs={};if(proj.match(/epsg:/i)){var code=parseInt(proj.substring(proj.indexOf(":")+1));if(code==4326){crs={"type":"OGC","properties":{"urn":"urn:ogc:def:crs:OGC:1.3:CRS84"}};}else{crs={"type":"EPSG","properties":{"code":code}};}}  
return crs;},extract:{'feature':function(feature){var geom=this.extract.geometry.apply(this,[feature.geometry]);return{"type":"Feature","id":feature.fid==null?feature.id:feature.fid,"properties":feature.attributes,"geometry":geom};},'geometry':function(geometry){if(geometry==null){return null;}  
if(this.internalProjection&&this.externalProjection){geometry=geometry.clone();geometry.transform(this.internalProjection,this.externalProjection);}  
var geometryType=geometry.CLASS_NAME.split('.')[2];var data=this.extract[geometryType.toLowerCase()].apply(this,[geometry]);var json;if(geometryType=="Collection"){json={"type":"GeometryCollection","geometries":data};}else{json={"type":geometryType,"coordinates":data};}  
return json;},'point':function(point){return[point.x,point.y];},'multipoint':function(multipoint){var array=[];for(var i=0,len=multipoint.components.length;i<len;++i){array.push(this.extract.point.apply(this,[multipoint.components[i]]));}  
return array;},'linestring':function(linestring){var array=[];for(var i=0,len=linestring.components.length;i<len;++i){array.push(this.extract.point.apply(this,[linestring.components[i]]));}  
return array;},'multilinestring':function(multilinestring){var array=[];for(var i=0,len=multilinestring.components.length;i<len;++i){array.push(this.extract.linestring.apply(this,[multilinestring.components[i]]));}  
return array;},'polygon':function(polygon){var array=[];for(var i=0,len=polygon.components.length;i<len;++i){array.push(this.extract.linestring.apply(this,[polygon.components[i]]));}  
return array;},'multipolygon':function(multipolygon){var array=[];for(var i=0,len=multipolygon.components.length;i<len;++i){array.push(this.extract.polygon.apply(this,[multipolygon.components[i]]));}  
return array;},'collection':function(collection){var len=collection.components.length;var array=new Array(len);for(var i=0;i<len;++i){array[i]=this.extract.geometry.apply(this,[collection.components[i]]);}  
return array;}},CLASS_NAME:"OpenLayers.Format.GeoJSON"});OpenLayers.Format.ArcXML.Features=OpenLayers.Class(OpenLayers.Format.XML,{initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(data){var axl=new OpenLayers.Format.ArcXML();var parsed=axl.read(data);return parsed.features.feature;}});if(!OpenLayers.Format.GML){OpenLayers.Format.GML={};}  
OpenLayers.Format.GML.Base=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs"},defaultPrefix:"gml",schemaLocation:null,featureType:null,featureNS:null,geometryName:"geometry",extractAttributes:true,srsName:null,xy:true,geometryTypes:null,singleFeatureType:null,regExes:{trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)},initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);this.setGeometryTypes();if(options&&options.featureNS){this.setNamespace("feature",options.featureNS);}  
this.singleFeatureType=!options||(typeof options.featureType==="string");},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
if(data&&data.nodeType==9){data=data.documentElement;}  
var features=[];this.readNode(data,{features:features});if(features.length==0){var elements=this.getElementsByTagNameNS(data,this.namespaces.gml,"featureMember");if(elements.length){for(var i=0,len=elements.length;i<len;++i){this.readNode(elements[i],{features:features});}}else{var elements=this.getElementsByTagNameNS(data,this.namespaces.gml,"featureMembers");if(elements.length){this.readNode(elements[0],{features:features});}}}  
return features;},readers:{"gml":{"featureMember":function(node,obj){this.readChildNodes(node,obj);},"featureMembers":function(node,obj){this.readChildNodes(node,obj);},"name":function(node,obj){obj.name=this.getChildValue(node);},"boundedBy":function(node,obj){var container={};this.readChildNodes(node,container);if(container.components&&container.components.length>0){obj.bounds=container.components[0];}},"Point":function(node,container){var obj={points:[]};this.readChildNodes(node,obj);if(!container.components){container.components=[];}  
container.components.push(obj.points[0]);},"coordinates":function(node,obj){var str=this.getChildValue(node).replace(this.regExes.trimSpace,"");str=str.replace(this.regExes.trimComma,",");var pointList=str.split(this.regExes.splitSpace);var coords;var numPoints=pointList.length;var points=new Array(numPoints);for(var i=0;i<numPoints;++i){coords=pointList[i].split(",");if(this.xy){points[i]=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{points[i]=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}}  
obj.points=points;},"coord":function(node,obj){var coord={};this.readChildNodes(node,coord);if(!obj.points){obj.points=[];}  
obj.points.push(new OpenLayers.Geometry.Point(coord.x,coord.y,coord.z));},"X":function(node,coord){coord.x=this.getChildValue(node);},"Y":function(node,coord){coord.y=this.getChildValue(node);},"Z":function(node,coord){coord.z=this.getChildValue(node);},"MultiPoint":function(node,container){var obj={components:[]};this.readChildNodes(node,obj);container.components=[new OpenLayers.Geometry.MultiPoint(obj.components)];},"pointMember":function(node,obj){this.readChildNodes(node,obj);},"LineString":function(node,container){var obj={};this.readChildNodes(node,obj);if(!container.components){container.components=[];}  
container.components.push(new OpenLayers.Geometry.LineString(obj.points));},"MultiLineString":function(node,container){var obj={components:[]};this.readChildNodes(node,obj);container.components=[new OpenLayers.Geometry.MultiLineString(obj.components)];},"lineStringMember":function(node,obj){this.readChildNodes(node,obj);},"Polygon":function(node,container){var obj={outer:null,inner:[]};this.readChildNodes(node,obj);obj.inner.unshift(obj.outer);if(!container.components){container.components=[];}  
container.components.push(new OpenLayers.Geometry.Polygon(obj.inner));},"LinearRing":function(node,obj){var container={};this.readChildNodes(node,container);obj.components=[new OpenLayers.Geometry.LinearRing(container.points)];},"MultiPolygon":function(node,container){var obj={components:[]};this.readChildNodes(node,obj);container.components=[new OpenLayers.Geometry.MultiPolygon(obj.components)];},"polygonMember":function(node,obj){this.readChildNodes(node,obj);},"GeometryCollection":function(node,container){var obj={components:[]};this.readChildNodes(node,obj);container.components=[new OpenLayers.Geometry.Collection(obj.components)];},"geometryMember":function(node,obj){this.readChildNodes(node,obj);}},"feature":{"*":function(node,obj){var name;var local=node.localName||node.nodeName.split(":").pop();if(obj.features){if(!this.singleFeatureType&&(OpenLayers.Util.indexOf(this.featureType,local)!==-1)){name="_typeName";}else if(local===this.featureType){name="_typeName";}}else{if(node.childNodes.length==0||(node.childNodes.length==1&&node.firstChild.nodeType==3)){if(this.extractAttributes){name="_attribute";}}else{name="_geometry";}}  
if(name){this.readers.feature[name].apply(this,[node,obj]);}},"_typeName":function(node,obj){var container={components:[],attributes:{}};this.readChildNodes(node,container);if(container.name){container.attributes.name=container.name;}  
var feature=new OpenLayers.Feature.Vector(container.components[0],container.attributes);if(!this.singleFeatureType){feature.type=node.nodeName.split(":").pop();feature.namespace=node.namespaceURI;}  
var fid=node.getAttribute("fid")||this.getAttributeNS(node,this.namespaces["gml"],"id");if(fid){feature.fid=fid;}  
if(this.internalProjection&&this.externalProjection&&feature.geometry){feature.geometry.transform(this.externalProjection,this.internalProjection);}  
if(container.bounds){feature.bounds=container.bounds;}  
obj.features.push(feature);},"_geometry":function(node,obj){this.readChildNodes(node,obj);},"_attribute":function(node,obj){var local=node.localName||node.nodeName.split(":").pop();var value=this.getChildValue(node);obj.attributes[local]=value;}},"wfs":{"FeatureCollection":function(node,obj){this.readChildNodes(node,obj);}}},write:function(features){var name;if(features instanceof Array){name="featureMembers";}else{name="featureMember";}  
var root=this.writeNode("gml:"+name,features);this.setAttributeNS(root,this.namespaces["xsi"],"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[root]);},writers:{"gml":{"featureMember":function(feature){var node=this.createElementNSPlus("gml:featureMember");this.writeNode("feature:_typeName",feature,node);return node;},"MultiPoint":function(geometry){var node=this.createElementNSPlus("gml:MultiPoint");for(var i=0;i<geometry.components.length;++i){this.writeNode("pointMember",geometry.components[i],node);}  
return node;},"pointMember":function(geometry){var node=this.createElementNSPlus("gml:pointMember");this.writeNode("Point",geometry,node);return node;},"MultiLineString":function(geometry){var node=this.createElementNSPlus("gml:MultiLineString");for(var i=0;i<geometry.components.length;++i){this.writeNode("lineStringMember",geometry.components[i],node);}  
return node;},"lineStringMember":function(geometry){var node=this.createElementNSPlus("gml:lineStringMember");this.writeNode("LineString",geometry,node);return node;},"MultiPolygon":function(geometry){var node=this.createElementNSPlus("gml:MultiPolygon");for(var i=0;i<geometry.components.length;++i){this.writeNode("polygonMember",geometry.components[i],node);}  
return node;},"polygonMember":function(geometry){var node=this.createElementNSPlus("gml:polygonMember");this.writeNode("Polygon",geometry,node);return node;},"GeometryCollection":function(geometry){var node=this.createElementNSPlus("gml:GeometryCollection");for(var i=0,len=geometry.components.length;i<len;++i){this.writeNode("geometryMember",geometry.components[i],node);}  
return node;},"geometryMember":function(geometry){var node=this.createElementNSPlus("gml:geometryMember");var child=this.writeNode("feature:_geometry",geometry);node.appendChild(child.firstChild);return node;}},"feature":{"_typeName":function(feature){var node=this.createElementNSPlus("feature:"+this.featureType,{attributes:{fid:feature.fid}});if(feature.geometry){this.writeNode("feature:_geometry",feature.geometry,node);}  
for(var name in feature.attributes){var value=feature.attributes[name];if(value!=null){this.writeNode("feature:_attribute",{name:name,value:value},node);}}  
return node;},"_geometry":function(geometry){if(this.externalProjection&&this.internalProjection){geometry=geometry.clone().transform(this.internalProjection,this.externalProjection);}  
var node=this.createElementNSPlus("feature:"+this.geometryName);var type=this.geometryTypes[geometry.CLASS_NAME];var child=this.writeNode("gml:"+type,geometry,node);if(this.srsName){child.setAttribute("srsName",this.srsName);}  
return node;},"_attribute":function(obj){return this.createElementNSPlus("feature:"+obj.name,{value:obj.value});}},"wfs":{"FeatureCollection":function(features){var node=this.createElementNSPlus("wfs:FeatureCollection");for(var i=0,len=features.length;i<len;++i){this.writeNode("gml:featureMember",features[i],node);}  
return node;}}},setGeometryTypes:function(){this.geometryTypes={"OpenLayers.Geometry.Point":"Point","OpenLayers.Geometry.MultiPoint":"MultiPoint","OpenLayers.Geometry.LineString":"LineString","OpenLayers.Geometry.MultiLineString":"MultiLineString","OpenLayers.Geometry.Polygon":"Polygon","OpenLayers.Geometry.MultiPolygon":"MultiPolygon","OpenLayers.Geometry.Collection":"GeometryCollection"};},CLASS_NAME:"OpenLayers.Format.GML.Base"});OpenLayers.Format.WFS=OpenLayers.Class(OpenLayers.Format.GML,{layer:null,wfsns:"http://www.opengis.net/wfs",ogcns:"http://www.opengis.net/ogc",initialize:function(options,layer){OpenLayers.Format.GML.prototype.initialize.apply(this,[options]);this.layer=layer;if(this.layer.featureNS){this.featureNS=this.layer.featureNS;}  
if(this.layer.options.geometry_column){this.geometryName=this.layer.options.geometry_column;}  
if(this.layer.options.typename){this.featureName=this.layer.options.typename;}},write:function(features){var transaction=this.createElementNS(this.wfsns,'wfs:Transaction');transaction.setAttribute("version","1.0.0");transaction.setAttribute("service","WFS");for(var i=0;i<features.length;i++){switch(features[i].state){case OpenLayers.State.INSERT:transaction.appendChild(this.insert(features[i]));break;case OpenLayers.State.UPDATE:transaction.appendChild(this.update(features[i]));break;case OpenLayers.State.DELETE:transaction.appendChild(this.remove(features[i]));break;}}  
return OpenLayers.Format.XML.prototype.write.apply(this,[transaction]);},createFeatureXML:function(feature){var geometryNode=this.buildGeometryNode(feature.geometry);var geomContainer=this.createElementNS(this.featureNS,"feature:"+this.geometryName);geomContainer.appendChild(geometryNode);var featureContainer=this.createElementNS(this.featureNS,"feature:"+this.featureName);featureContainer.appendChild(geomContainer);for(var attr in feature.attributes){var attrText=this.createTextNode(feature.attributes[attr]);var nodename=attr;if(attr.search(":")!=-1){nodename=attr.split(":")[1];}  
var attrContainer=this.createElementNS(this.featureNS,"feature:"+nodename);attrContainer.appendChild(attrText);featureContainer.appendChild(attrContainer);}  
return featureContainer;},insert:function(feature){var insertNode=this.createElementNS(this.wfsns,'wfs:Insert');insertNode.appendChild(this.createFeatureXML(feature));return insertNode;},update:function(feature){if(!feature.fid){OpenLayers.Console.userError(OpenLayers.i18n("noFID"));}  
var updateNode=this.createElementNS(this.wfsns,'wfs:Update');updateNode.setAttribute("typeName",this.featurePrefix+':'+this.featureName);updateNode.setAttribute("xmlns:"+this.featurePrefix,this.featureNS);var propertyNode=this.createElementNS(this.wfsns,'wfs:Property');var nameNode=this.createElementNS(this.wfsns,'wfs:Name');var txtNode=this.createTextNode(this.geometryName);nameNode.appendChild(txtNode);propertyNode.appendChild(nameNode);var valueNode=this.createElementNS(this.wfsns,'wfs:Value');var geometryNode=this.buildGeometryNode(feature.geometry);if(feature.layer){geometryNode.setAttribute("srsName",feature.layer.projection.getCode());}  
valueNode.appendChild(geometryNode);propertyNode.appendChild(valueNode);updateNode.appendChild(propertyNode);for(var propName in feature.attributes){propertyNode=this.createElementNS(this.wfsns,'wfs:Property');nameNode=this.createElementNS(this.wfsns,'wfs:Name');nameNode.appendChild(this.createTextNode(propName));propertyNode.appendChild(nameNode);valueNode=this.createElementNS(this.wfsns,'wfs:Value');valueNode.appendChild(this.createTextNode(feature.attributes[propName]));propertyNode.appendChild(valueNode);updateNode.appendChild(propertyNode);}  
var filterNode=this.createElementNS(this.ogcns,'ogc:Filter');var filterIdNode=this.createElementNS(this.ogcns,'ogc:FeatureId');filterIdNode.setAttribute("fid",feature.fid);filterNode.appendChild(filterIdNode);updateNode.appendChild(filterNode);return updateNode;},remove:function(feature){if(!feature.fid){OpenLayers.Console.userError(OpenLayers.i18n("noFID"));return false;}  
var deleteNode=this.createElementNS(this.wfsns,'wfs:Delete');deleteNode.setAttribute("typeName",this.featurePrefix+':'+this.featureName);deleteNode.setAttribute("xmlns:"+this.featurePrefix,this.featureNS);var filterNode=this.createElementNS(this.ogcns,'ogc:Filter');var filterIdNode=this.createElementNS(this.ogcns,'ogc:FeatureId');filterIdNode.setAttribute("fid",feature.fid);filterNode.appendChild(filterIdNode);deleteNode.appendChild(filterNode);return deleteNode;},destroy:function(){this.layer=null;},CLASS_NAME:"OpenLayers.Format.WFS"});OpenLayers.Layer.ArcIMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{ClientVersion:"9.2",ServiceName:''},tileSize:null,featureCoordSys:"4326",filterCoordSys:"4326",layers:null,async:true,name:"ArcIMS",isBaseLayer:true,DEFAULT_OPTIONS:{tileSize:new OpenLayers.Size(512,512),featureCoordSys:"4326",filterCoordSys:"4326",layers:null,isBaseLayer:true,async:true,name:"ArcIMS"},initialize:function(name,url,options){this.tileSize=new OpenLayers.Size(512,512);this.params=OpenLayers.Util.applyDefaults({ServiceName:options.serviceName},this.DEFAULT_PARAMS);this.options=OpenLayers.Util.applyDefaults(options,this.DEFAULT_OPTIONS);OpenLayers.Layer.Grid.prototype.initialize.apply(this,[name,url,this.params,options]);if(this.transparent){if(!this.isBaseLayer){this.isBaseLayer=false;}  
if(this.format=="image/jpeg"){this.format=OpenLayers.Util.alphaHack()?"image/gif":"image/png";}}  
if(this.options.layers===null){this.options.layers=[];}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments);},getURL:function(bounds){var url="";bounds=this.adjustBounds(bounds);var axlReq=new OpenLayers.Format.ArcXML(OpenLayers.Util.extend(this.options,{requesttype:"image",envelope:bounds.toArray(),tileSize:this.tileSize}));var req=new OpenLayers.Request.POST({url:this.getFullRequestString(),data:axlReq.write(),async:false});if(req!=null){var doc=req.responseXML;if(!doc||!doc.documentElement){doc=req.responseText;}  
var axlResp=new OpenLayers.Format.ArcXML();var arcxml=axlResp.read(doc);url=this.getUrlOrImage(arcxml.image.output);}  
return url;},getURLasync:function(bounds,scope,prop,callback){bounds=this.adjustBounds(bounds);var axlReq=new OpenLayers.Format.ArcXML(OpenLayers.Util.extend(this.options,{requesttype:"image",envelope:bounds.toArray(),tileSize:this.tileSize}));OpenLayers.Request.POST({url:this.getFullRequestString(),async:true,data:axlReq.write(),callback:function(req){var doc=req.responseXML;if(!doc||!doc.documentElement){doc=req.responseText;}  
var axlResp=new OpenLayers.Format.ArcXML();var arcxml=axlResp.read(doc);scope[prop]=this.getUrlOrImage(arcxml.image.output);callback.apply(scope);},scope:this});},getUrlOrImage:function(output){var ret="";if(output.url){ret=output.url;}else if(output.data){ret="data:image/"+output.type+";base64,"+output.data;}  
return ret;},setLayerQuery:function(id,querydef){for(var lyr=0;lyr<this.options.layers.length;lyr++){if(id==this.options.layers[lyr].id){this.options.layers[lyr].query=querydef;return;}}  
this.options.layers.push({id:id,visible:true,query:querydef});},getFeatureInfo:function(geometry,layer,options){var buffer=options.buffer||1;var callback=options.callback||function(){};var scope=options.scope||window;var requestOptions={};OpenLayers.Util.extend(requestOptions,this.options);requestOptions.requesttype="feature";if(geometry instanceof OpenLayers.LonLat){requestOptions.polygon=null;requestOptions.envelope=[geometry.lon-buffer,geometry.lat-buffer,geometry.lon+buffer,geometry.lat+buffer];}else if(geometry instanceof OpenLayers.Geometry.Polygon){requestOptions.envelope=null;requestOptions.polygon=geometry;}  
var arcxml=new OpenLayers.Format.ArcXML(requestOptions);OpenLayers.Util.extend(arcxml.request.get_feature,options);arcxml.request.get_feature.layer=layer.id;if(typeof layer.query.accuracy=="number"){arcxml.request.get_feature.query.accuracy=layer.query.accuracy;}else{var mapCenter=this.map.getCenter();var viewPx=this.map.getViewPortPxFromLonLat(mapCenter);viewPx.x++;var mapOffCenter=this.map.getLonLatFromPixel(viewPx);arcxml.request.get_feature.query.accuracy=mapOffCenter.lon-mapCenter.lon;}  
arcxml.request.get_feature.query.where=layer.query.where;arcxml.request.get_feature.query.spatialfilter.relation="area_intersection";OpenLayers.Request.POST({url:this.getFullRequestString({'CustomService':'Query'}),data:arcxml.write(),callback:function(request){var response=arcxml.parseResponse(request.responseText);if(!arcxml.iserror()){callback.call(scope,response.features);}else{callback.call(scope,null);}}});},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.ArcIMS(this.name,this.url,this.getOptions());}  
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},CLASS_NAME:"OpenLayers.Layer.ArcIMS"});OpenLayers.Format.GML.v2=OpenLayers.Class(OpenLayers.Format.GML.Base,{schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd",initialize:function(options){OpenLayers.Format.GML.Base.prototype.initialize.apply(this,[options]);},readers:{"gml":OpenLayers.Util.applyDefaults({"outerBoundaryIs":function(node,container){var obj={};this.readChildNodes(node,obj);container.outer=obj.components[0];},"innerBoundaryIs":function(node,container){var obj={};this.readChildNodes(node,obj);container.inner.push(obj.components[0]);},"Box":function(node,container){var obj={};this.readChildNodes(node,obj);if(!container.components){container.components=[];}  
var min=obj.points[0];var max=obj.points[1];container.components.push(new OpenLayers.Bounds(min.x,min.y,max.x,max.y));}},OpenLayers.Format.GML.Base.prototype.readers["gml"]),"feature":OpenLayers.Format.GML.Base.prototype.readers["feature"],"wfs":OpenLayers.Format.GML.Base.prototype.readers["wfs"]},write:function(features){var name;if(features instanceof Array){name="wfs:FeatureCollection";}else{name="gml:featureMember";}  
var root=this.writeNode(name,features);this.setAttributeNS(root,this.namespaces["xsi"],"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[root]);},writers:{"gml":OpenLayers.Util.applyDefaults({"Point":function(geometry){var node=this.createElementNSPlus("gml:Point");this.writeNode("coordinates",[geometry],node);return node;},"coordinates":function(points){var numPoints=points.length;var parts=new Array(numPoints);var point;for(var i=0;i<numPoints;++i){point=points[i];if(this.xy){parts[i]=point.x+","+point.y;}else{parts[i]=point.y+","+point.x;}  
if(point.z!=undefined){parts[i]+=","+point.z;}}  
return this.createElementNSPlus("gml:coordinates",{attributes:{decimal:".",cs:",",ts:" "},value:(numPoints==1)?parts[0]:parts.join(" ")});},"LineString":function(geometry){var node=this.createElementNSPlus("gml:LineString");this.writeNode("coordinates",geometry.components,node);return node;},"Polygon":function(geometry){var node=this.createElementNSPlus("gml:Polygon");this.writeNode("outerBoundaryIs",geometry.components[0],node);for(var i=1;i<geometry.components.length;++i){this.writeNode("innerBoundaryIs",geometry.components[i],node);}  
return node;},"outerBoundaryIs":function(ring){var node=this.createElementNSPlus("gml:outerBoundaryIs");this.writeNode("LinearRing",ring,node);return node;},"innerBoundaryIs":function(ring){var node=this.createElementNSPlus("gml:innerBoundaryIs");this.writeNode("LinearRing",ring,node);return node;},"LinearRing":function(ring){var node=this.createElementNSPlus("gml:LinearRing");this.writeNode("coordinates",ring.components,node);return node;},"Box":function(bounds){var node=this.createElementNSPlus("gml:Box");this.writeNode("coordinates",[{x:bounds.left,y:bounds.bottom},{x:bounds.right,y:bounds.top}],node);if(this.srsName){node.setAttribute("srsName",this.srsName);}  
return node;}},OpenLayers.Format.GML.Base.prototype.writers["gml"]),"feature":OpenLayers.Format.GML.Base.prototype.writers["feature"],"wfs":OpenLayers.Format.GML.Base.prototype.writers["wfs"]},CLASS_NAME:"OpenLayers.Format.GML.v2"});OpenLayers.Format.GML.v3=OpenLayers.Class(OpenLayers.Format.GML.Base,{schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",curve:false,multiCurve:true,surface:false,multiSurface:true,initialize:function(options){OpenLayers.Format.GML.Base.prototype.initialize.apply(this,[options]);},readers:{"gml":OpenLayers.Util.applyDefaults({"featureMembers":function(node,obj){this.readChildNodes(node,obj);},"Curve":function(node,container){var obj={points:[]};this.readChildNodes(node,obj);if(!container.components){container.components=[];}  
container.components.push(new OpenLayers.Geometry.LineString(obj.points));},"segments":function(node,obj){this.readChildNodes(node,obj);},"LineStringSegment":function(node,container){var obj={};this.readChildNodes(node,obj);if(obj.points){Array.prototype.push.apply(container.points,obj.points);}},"pos":function(node,obj){var str=this.getChildValue(node).replace(this.regExes.trimSpace,"");var coords=str.split(this.regExes.splitSpace);var point;if(this.xy){point=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{point=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}  
obj.points=[point];},"posList":function(node,obj){var str=this.getChildValue(node).replace(this.regExes.trimSpace,"");var coords=str.split(this.regExes.splitSpace);var dim=parseInt(node.getAttribute("dimension"))||2;var j,x,y,z;var numPoints=coords.length/dim;var points=new Array(numPoints);for(var i=0,len=coords.length;i<len;i+=dim){x=coords[i];y=coords[i+1];z=(dim==2)?undefined:coords[i+2];if(this.xy){points[i/dim]=new OpenLayers.Geometry.Point(x,y,z);}else{points[i/dim]=new OpenLayers.Geometry.Point(y,x,z);}}  
obj.points=points;},"Surface":function(node,obj){this.readChildNodes(node,obj);},"patches":function(node,obj){this.readChildNodes(node,obj);},"PolygonPatch":function(node,obj){this.readers.gml.Polygon.apply(this,[node,obj]);},"exterior":function(node,container){var obj={};this.readChildNodes(node,obj);container.outer=obj.components[0];},"interior":function(node,container){var obj={};this.readChildNodes(node,obj);container.inner.push(obj.components[0]);},"MultiCurve":function(node,container){var obj={components:[]};this.readChildNodes(node,obj);if(obj.components.length>0){container.components=[new OpenLayers.Geometry.MultiLineString(obj.components)];}},"curveMember":function(node,obj){this.readChildNodes(node,obj);},"MultiSurface":function(node,container){var obj={components:[]};this.readChildNodes(node,obj);if(obj.components.length>0){container.components=[new OpenLayers.Geometry.MultiPolygon(obj.components)];}},"surfaceMember":function(node,obj){this.readChildNodes(node,obj);},"surfaceMembers":function(node,obj){this.readChildNodes(node,obj);},"pointMembers":function(node,obj){this.readChildNodes(node,obj);},"lineStringMembers":function(node,obj){this.readChildNodes(node,obj);},"polygonMembers":function(node,obj){this.readChildNodes(node,obj);},"geometryMembers":function(node,obj){this.readChildNodes(node,obj);},"Envelope":function(node,container){var obj={points:new Array(2)};this.readChildNodes(node,obj);if(!container.components){container.components=[];}  
var min=obj.points[0];var max=obj.points[1];container.components.push(new OpenLayers.Bounds(min.x,min.y,max.x,max.y));},"lowerCorner":function(node,container){var obj={};this.readers.gml.pos.apply(this,[node,obj]);container.points[0]=obj.points[0];},"upperCorner":function(node,container){var obj={};this.readers.gml.pos.apply(this,[node,obj]);container.points[1]=obj.points[0];}},OpenLayers.Format.GML.Base.prototype.readers["gml"]),"feature":OpenLayers.Format.GML.Base.prototype.readers["feature"],"wfs":OpenLayers.Format.GML.Base.prototype.readers["wfs"]},write:function(features){var name;if(features instanceof Array){name="featureMembers";}else{name="featureMember";}  
var root=this.writeNode("gml:"+name,features);this.setAttributeNS(root,this.namespaces["xsi"],"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[root]);},writers:{"gml":OpenLayers.Util.applyDefaults({"featureMembers":function(features){var node=this.createElementNSPlus("gml:featureMembers");for(var i=0,len=features.length;i<len;++i){this.writeNode("feature:_typeName",features[i],node);}  
return node;},"Point":function(geometry){var node=this.createElementNSPlus("gml:Point");this.writeNode("pos",geometry,node);return node;},"pos":function(point){var pos=(this.xy)?(point.x+" "+point.y):(point.y+" "+point.x);return this.createElementNSPlus("gml:pos",{value:pos});},"LineString":function(geometry){var node=this.createElementNSPlus("gml:LineString");this.writeNode("posList",geometry.components,node);return node;},"Curve":function(geometry){var node=this.createElementNSPlus("gml:Curve");this.writeNode("segments",geometry,node);return node;},"segments":function(geometry){var node=this.createElementNSPlus("gml:segments");this.writeNode("LineStringSegment",geometry,node);return node;},"LineStringSegment":function(geometry){var node=this.createElementNSPlus("gml:LineStringSegment");this.writeNode("posList",geometry.components,node);return node;},"posList":function(points){var len=points.length;var parts=new Array(len);var point;for(var i=0;i<len;++i){point=points[i];if(this.xy){parts[i]=point.x+" "+point.y;}else{parts[i]=point.y+" "+point.x;}}  
return this.createElementNSPlus("gml:posList",{value:parts.join(" ")});},"Surface":function(geometry){var node=this.createElementNSPlus("gml:Surface");this.writeNode("patches",geometry,node);return node;},"patches":function(geometry){var node=this.createElementNSPlus("gml:patches");this.writeNode("PolygonPatch",geometry,node);return node;},"PolygonPatch":function(geometry){var node=this.createElementNSPlus("gml:PolygonPatch",{attributes:{interpolation:"planar"}});this.writeNode("exterior",geometry.components[0],node);for(var i=1,len=geometry.components.length;i<len;++i){this.writeNode("interior",geometry.components[i],node);}  
return node;},"Polygon":function(geometry){var node=this.createElementNSPlus("gml:Polygon");this.writeNode("exterior",geometry.components[0],node);for(var i=1,len=geometry.components.length;i<len;++i){this.writeNode("interior",geometry.components[i],node);}  
return node;},"exterior":function(ring){var node=this.createElementNSPlus("gml:exterior");this.writeNode("LinearRing",ring,node);return node;},"interior":function(ring){var node=this.createElementNSPlus("gml:interior");this.writeNode("LinearRing",ring,node);return node;},"LinearRing":function(ring){var node=this.createElementNSPlus("gml:LinearRing");this.writeNode("posList",ring.components,node);return node;},"MultiCurve":function(geometry){var node=this.createElementNSPlus("gml:MultiCurve");for(var i=0,len=geometry.components.length;i<len;++i){this.writeNode("curveMember",geometry.components[i],node);}  
return node;},"curveMember":function(geometry){var node=this.createElementNSPlus("gml:curveMember");if(this.curve){this.writeNode("Curve",geometry,node);}else{this.writeNode("LineString",geometry,node);}  
return node;},"MultiSurface":function(geometry){var node=this.createElementNSPlus("gml:MultiSurface");for(var i=0,len=geometry.components.length;i<len;++i){this.writeNode("surfaceMember",geometry.components[i],node);}  
return node;},"surfaceMember":function(polygon){var node=this.createElementNSPlus("gml:surfaceMember");if(this.surface){this.writeNode("Surface",polygon,node);}else{this.writeNode("Polygon",polygon,node);}  
return node;},"Envelope":function(bounds){var node=this.createElementNSPlus("gml:Envelope");this.writeNode("lowerCorner",bounds,node);this.writeNode("upperCorner",bounds,node);if(this.srsName){node.setAttribute("srsName",this.srsName);}  
return node;},"lowerCorner":function(bounds){var pos=(this.xy)?(bounds.left+" "+bounds.bottom):(bounds.bottom+" "+bounds.left);return this.createElementNSPlus("gml:lowerCorner",{value:pos});},"upperCorner":function(bounds){var pos=(this.xy)?(bounds.right+" "+bounds.top):(bounds.top+" "+bounds.right);return this.createElementNSPlus("gml:upperCorner",{value:pos});}},OpenLayers.Format.GML.Base.prototype.writers["gml"]),"feature":OpenLayers.Format.GML.Base.prototype.writers["feature"],"wfs":OpenLayers.Format.GML.Base.prototype.writers["wfs"]},setGeometryTypes:function(){this.geometryTypes={"OpenLayers.Geometry.Point":"Point","OpenLayers.Geometry.MultiPoint":"MultiPoint","OpenLayers.Geometry.LineString":(this.curve===true)?"Curve":"LineString","OpenLayers.Geometry.MultiLineString":(this.multiCurve===false)?"MultiLineString":"MultiCurve","OpenLayers.Geometry.Polygon":(this.surface===true)?"Surface":"Polygon","OpenLayers.Geometry.MultiPolygon":(this.multiSurface===false)?"MultiPolygon":"MultiSurface","OpenLayers.Geometry.Collection":"GeometryCollection"};},CLASS_NAME:"OpenLayers.Format.GML.v3"});OpenLayers.Format.Atom=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{atom:"http://www.w3.org/2005/Atom",georss:"http://www.georss.org/georss"},feedTitle:"untitled",defaultEntryTitle:"untitled",gmlParser:null,xy:false,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(doc){if(typeof doc=="string"){doc=OpenLayers.Format.XML.prototype.read.apply(this,[doc]);}  
return this.parseFeatures(doc);},write:function(features){var doc;if(features instanceof Array){doc=this.createElementNSPlus("atom:feed");doc.appendChild(this.createElementNSPlus("atom:title",{value:this.feedTitle}));for(var i=0,ii=features.length;i<ii;i++){doc.appendChild(this.buildEntryNode(features[i]));}}  
else{doc=this.buildEntryNode(features);}  
return OpenLayers.Format.XML.prototype.write.apply(this,[doc]);},buildContentNode:function(content){var node=this.createElementNSPlus("atom:content",{attributes:{type:content.type||null}});if(content.src){node.setAttribute("src",content.src);}else{if(content.type=="text"||content.type==null){node.appendChild(this.createTextNode(content.value));}else if(content.type=="html"){if(typeof content.value!="string"){throw"HTML content must be in form of an escaped string";}  
node.appendChild(this.createTextNode(content.value));}else if(content.type=="xhtml"){node.appendChild(content.value);}else if(content.type=="xhtml"||content.type.match(/(\+|\/)xml$/)){node.appendChild(content.value);}  
else{node.appendChild(this.createTextNode(content.value));}}  
return node;},buildEntryNode:function(feature){var attrib=feature.attributes;var atomAttrib=attrib.atom||{};var entryNode=this.createElementNSPlus("atom:entry");if(atomAttrib.authors){var authors=atomAttrib.authors instanceof Array?atomAttrib.authors:[atomAttrib.authors];for(var i=0,ii=authors.length;i<ii;i++){entryNode.appendChild(this.buildPersonConstructNode("author",authors[i]));}}  
if(atomAttrib.categories){var categories=atomAttrib.categories instanceof Array?atomAttrib.categories:[atomAttrib.categories];var category;for(var i=0,ii=categories.length;i<ii;i++){category=categories[i];entryNode.appendChild(this.createElementNSPlus("atom:category",{attributes:{term:category.term,scheme:category.scheme||null,label:category.label||null}}));}}  
if(atomAttrib.content){entryNode.appendChild(this.buildContentNode(atomAttrib.content));}  
if(atomAttrib.contributors){var contributors=atomAttrib.contributors instanceof Array?atomAttrib.contributors:[atomAttrib.contributors];for(var i=0,ii=contributors.length;i<ii;i++){entryNode.appendChild(this.buildPersonConstructNode("contributor",contributors[i]));}}  
if(feature.fid){entryNode.appendChild(this.createElementNSPlus("atom:id",{value:feature.fid}));}  
if(atomAttrib.links){var links=atomAttrib.links instanceof Array?atomAttrib.links:[atomAttrib.links];var link;for(var i=0,ii=links.length;i<ii;i++){link=links[i];entryNode.appendChild(this.createElementNSPlus("atom:link",{attributes:{href:link.href,rel:link.rel||null,type:link.type||null,hreflang:link.hreflang||null,title:link.title||null,length:link.length||null}}));}}  
if(atomAttrib.published){entryNode.appendChild(this.createElementNSPlus("atom:published",{value:atomAttrib.published}));}  
if(atomAttrib.rights){entryNode.appendChild(this.createElementNSPlus("atom:rights",{value:atomAttrib.rights}));}  
if(atomAttrib.summary||attrib.description){entryNode.appendChild(this.createElementNSPlus("atom:summary",{value:atomAttrib.summary||attrib.description}));}  
entryNode.appendChild(this.createElementNSPlus("atom:title",{value:atomAttrib.title||attrib.title||this.defaultEntryTitle}));if(atomAttrib.updated){entryNode.appendChild(this.createElementNSPlus("atom:updated",{value:atomAttrib.updated}));}  
if(feature.geometry){var whereNode=this.createElementNSPlus("georss:where");whereNode.appendChild(this.buildGeometryNode(feature.geometry));entryNode.appendChild(whereNode);}  
return entryNode;},initGmlParser:function(){this.gmlParser=new OpenLayers.Format.GML.v3({xy:this.xy,featureNS:"http://example.com#feature",internalProjection:this.internalProjection,externalProjection:this.externalProjection});},buildGeometryNode:function(geometry){if(!this.gmlParser){this.initGmlParser();}  
var node=this.gmlParser.writeNode("feature:_geometry",geometry);return node.firstChild;},buildPersonConstructNode:function(name,value){var oNames=["uri","email"];var personNode=this.createElementNSPlus("atom:"+name);personNode.appendChild(this.createElementNSPlus("atom:name",{value:value.name}));for(var i=0,ii=oNames.length;i<ii;i++){if(value[oNames[i]]){personNode.appendChild(this.createElementNSPlus("atom:"+oNames[i],{value:value[oNames[i]]}));}}  
return personNode;},getFirstChildValue:function(node,nsuri,name,def){var value;var nodes=this.getElementsByTagNameNS(node,nsuri,name);if(nodes&&nodes.length>0){value=this.getChildValue(nodes[0],def);}else{value=def;}  
return value;},parseFeature:function(node){var atomAttrib={};var value=null;var nodes=null;var attval=null;var atomns=this.namespaces.atom;this.parsePersonConstructs(node,"author",atomAttrib);nodes=this.getElementsByTagNameNS(node,atomns,"category");if(nodes.length>0){atomAttrib.categories=[];}  
for(var i=0,ii=nodes.length;i<ii;i++){value={};value.term=nodes[i].getAttribute("term");attval=nodes[i].getAttribute("scheme");if(attval){value.scheme=attval;}  
attval=nodes[i].getAttribute("label");if(attval){value.label=attval;}  
atomAttrib.categories.push(value);}  
nodes=this.getElementsByTagNameNS(node,atomns,"content");if(nodes.length>0){value={};attval=nodes[0].getAttribute("type");if(attval){value.type=attval;}  
attval=nodes[0].getAttribute("src");if(attval){value.src=attval;}else{if(value.type=="text"||value.type=="html"||value.type==null){value.value=this.getFirstChildValue(node,atomns,"content",null);}else if(value.type=="xhtml"||value.type.match(/(\+|\/)xml$/)){value.value=this.getChildEl(nodes[0]);}else{value.value=this.getFirstChildValue(node,atomns,"content",null);}  
atomAttrib.content=value;}}  
this.parsePersonConstructs(node,"contributor",atomAttrib);atomAttrib.id=this.getFirstChildValue(node,atomns,"id",null);nodes=this.getElementsByTagNameNS(node,atomns,"link");if(nodes.length>0){atomAttrib.links=new Array(nodes.length);}  
var oAtts=["rel","type","hreflang","title","length"];for(var i=0,ii=nodes.length;i<ii;i++){value={};value.href=nodes[i].getAttribute("href");for(var j=0,jj=oAtts.length;j<jj;j++){attval=nodes[i].getAttribute(oAtts[j]);if(attval){value[oAtts[j]]=attval;}}  
atomAttrib.links[i]=value;}  
value=this.getFirstChildValue(node,atomns,"published",null);if(value){atomAttrib.published=value;}  
value=this.getFirstChildValue(node,atomns,"rights",null);if(value){atomAttrib.rights=value;}  
value=this.getFirstChildValue(node,atomns,"summary",null);if(value){atomAttrib.summary=value;}  
atomAttrib.title=this.getFirstChildValue(node,atomns,"title",null);atomAttrib.updated=this.getFirstChildValue(node,atomns,"updated",null);var featureAttrib={title:atomAttrib.title,description:atomAttrib.summary,atom:atomAttrib};var geometry=this.parseLocations(node)[0];var feature=new OpenLayers.Feature.Vector(geometry,featureAttrib);feature.fid=atomAttrib.id;return feature;},parseFeatures:function(node){var features=[];var entries=this.getElementsByTagNameNS(node,this.namespaces.atom,"entry");if(entries.length==0){entries=[node];}  
for(var i=0,ii=entries.length;i<ii;i++){features.push(this.parseFeature(entries[i]));}  
return features;},parseLocations:function(node){var georssns=this.namespaces.georss;var locations={components:[]};var where=this.getElementsByTagNameNS(node,georssns,"where");if(where&&where.length>0){if(!this.gmlParser){this.initGmlParser();}  
for(var i=0,ii=where.length;i<ii;i++){this.gmlParser.readChildNodes(where[i],locations);}}  
var components=locations.components;var point=this.getElementsByTagNameNS(node,georssns,"point");if(point&&point.length>0){for(var i=0,ii=point.length;i<ii;i++){var xy=OpenLayers.String.trim(point[i].firstChild.nodeValue).split(/\s+/);if(xy.length!=2){xy=OpenLayers.String.trim(point[i].firstChild.nodeValue).split(/\s*,\s*/);}  
components.push(new OpenLayers.Geometry.Point(parseFloat(xy[1]),parseFloat(xy[0])));}}  
var line=this.getElementsByTagNameNS(node,georssns,"line");if(line&&line.length>0){var coords;var p;var points;for(var i=0,ii=line.length;i<ii;i++){coords=OpenLayers.String.trim(line[i].firstChild.nodeValue).split(/\s+/);points=[];for(var j=0,jj=coords.length;j<jj;j+=2){p=new OpenLayers.Geometry.Point(parseFloat(coords[j+1]),parseFloat(coords[j]));points.push(p);}  
components.push(new OpenLayers.Geometry.LineString(points));}}  
var polygon=this.getElementsByTagNameNS(node,georssns,"polygon");if(polygon&&polygon.length>0){var coords;var p;var points;for(var i=0,ii=polygon.length;i<ii;i++){coords=OpenLayers.String.trim(polygon[i].firstChild.nodeValue).split(/\s+/);points=[];for(var j=0,jj=coords.length;j<jj;j+=2){p=new OpenLayers.Geometry.Point(parseFloat(coords[j+1]),parseFloat(coords[j]));points.push(p);}  
components.push(new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(components)]));}}  
if(this.internalProjection&&this.externalProjection){for(var i=0,ii=components.length;i<ii;i++){if(components[i]){components[i].transform(this.externalProjection,this.internalProjection);}}}  
return components;},parsePersonConstructs:function(node,name,data){var persons=[];var atomns=this.namespaces.atom;var nodes=this.getElementsByTagNameNS(node,atomns,name);var oAtts=["uri","email"];for(var i=0,ii=nodes.length;i<ii;i++){var value={};value.name=this.getFirstChildValue(nodes[i],atomns,"name",null);for(var j=0,jj=oAtts.length;j<jj;j++){var attval=this.getFirstChildValue(nodes[i],atomns,oAtts[j],null);if(attval){value[oAtts[j]]=attval;}}  
persons.push(value);}  
if(persons.length>0){data[name+"s"]=persons;}},CLASS_NAME:"OpenLayers.Format.Atom"});OpenLayers.Format.Filter.v1_0_0=OpenLayers.Class(OpenLayers.Format.GML.v2,OpenLayers.Format.Filter.v1,{VERSION:"1.0.0",schemaLocation:"http://www.opengis.net/ogc/filter/1.0.0/filter.xsd",initialize:function(options){OpenLayers.Format.GML.v2.prototype.initialize.apply(this,[options]);},readers:{"ogc":OpenLayers.Util.applyDefaults({"PropertyIsEqualTo":function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO});this.readChildNodes(node,filter);obj.filters.push(filter);},"PropertyIsNotEqualTo":function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.NOT_EQUAL_TO});this.readChildNodes(node,filter);obj.filters.push(filter);},"PropertyIsLike":function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LIKE});this.readChildNodes(node,filter);var wildCard=node.getAttribute("wildCard");var singleChar=node.getAttribute("singleChar");var esc=node.getAttribute("escape");filter.value2regex(wildCard,singleChar,esc);obj.filters.push(filter);}},OpenLayers.Format.Filter.v1.prototype.readers["ogc"]),"gml":OpenLayers.Format.GML.v2.prototype.readers["gml"],"feature":OpenLayers.Format.GML.v2.prototype.readers["feature"]},writers:{"ogc":OpenLayers.Util.applyDefaults({"PropertyIsEqualTo":function(filter){var node=this.createElementNSPlus("ogc:PropertyIsEqualTo");this.writeNode("PropertyName",filter,node);this.writeNode("Literal",filter.value,node);return node;},"PropertyIsNotEqualTo":function(filter){var node=this.createElementNSPlus("ogc:PropertyIsNotEqualTo");this.writeNode("PropertyName",filter,node);this.writeNode("Literal",filter.value,node);return node;},"PropertyIsLike":function(filter){var node=this.createElementNSPlus("ogc:PropertyIsLike",{attributes:{wildCard:"*",singleChar:".",escape:"!"}});this.writeNode("PropertyName",filter,node);this.writeNode("Literal",filter.regex2value(),node);return node;},"BBOX":function(filter){var node=this.createElementNSPlus("ogc:BBOX");this.writeNode("PropertyName",filter,node);var box=this.writeNode("gml:Box",filter.value,node);if(filter.projection){box.setAttribute("srsName",filter.projection);}  
return node;}},OpenLayers.Format.Filter.v1.prototype.writers["ogc"]),"gml":OpenLayers.Format.GML.v2.prototype.writers["gml"],"feature":OpenLayers.Format.GML.v2.prototype.writers["feature"]},writeSpatial:function(filter,name){var node=this.createElementNSPlus("ogc:"+name);this.writeNode("PropertyName",filter,node);var child;if(filter.value instanceof OpenLayers.Geometry){child=this.writeNode("feature:_geometry",filter.value).firstChild;}else{child=this.writeNode("gml:Box",filter.value);}  
if(filter.projection){child.setAttribute("srsName",filter.projection);}  
node.appendChild(child);return node;},CLASS_NAME:"OpenLayers.Format.Filter.v1_0_0"});OpenLayers.Format.Filter.v1_1_0=OpenLayers.Class(OpenLayers.Format.GML.v3,OpenLayers.Format.Filter.v1,{VERSION:"1.1.0",schemaLocation:"http://www.opengis.net/ogc/filter/1.1.0/filter.xsd",initialize:function(options){OpenLayers.Format.GML.v3.prototype.initialize.apply(this,[options]);},readers:{"ogc":OpenLayers.Util.applyDefaults({"PropertyIsEqualTo":function(node,obj){var matchCase=node.getAttribute("matchCase");var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,matchCase:!(matchCase==="false"||matchCase==="0")});this.readChildNodes(node,filter);obj.filters.push(filter);},"PropertyIsNotEqualTo":function(node,obj){var matchCase=node.getAttribute("matchCase");var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.NOT_EQUAL_TO,matchCase:!(matchCase==="false"||matchCase==="0")});this.readChildNodes(node,filter);obj.filters.push(filter);},"PropertyIsLike":function(node,obj){var filter=new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.LIKE});this.readChildNodes(node,filter);var wildCard=node.getAttribute("wildCard");var singleChar=node.getAttribute("singleChar");var esc=node.getAttribute("escapeChar");filter.value2regex(wildCard,singleChar,esc);obj.filters.push(filter);}},OpenLayers.Format.Filter.v1.prototype.readers["ogc"]),"gml":OpenLayers.Format.GML.v3.prototype.readers["gml"],"feature":OpenLayers.Format.GML.v3.prototype.readers["feature"]},writers:{"ogc":OpenLayers.Util.applyDefaults({"PropertyIsEqualTo":function(filter){var node=this.createElementNSPlus("ogc:PropertyIsEqualTo",{attributes:{matchCase:filter.matchCase}});this.writeNode("PropertyName",filter,node);this.writeNode("Literal",filter.value,node);return node;},"PropertyIsNotEqualTo":function(filter){var node=this.createElementNSPlus("ogc:PropertyIsNotEqualTo",{attributes:{matchCase:filter.matchCase}});this.writeNode("PropertyName",filter,node);this.writeNode("Literal",filter.value,node);return node;},"PropertyIsLike":function(filter){var node=this.createElementNSPlus("ogc:PropertyIsLike",{attributes:{wildCard:"*",singleChar:".",escapeChar:"!"}});this.writeNode("PropertyName",filter,node);this.writeNode("Literal",filter.regex2value(),node);return node;},"BBOX":function(filter){var node=this.createElementNSPlus("ogc:BBOX");this.writeNode("PropertyName",filter,node);var box=this.writeNode("gml:Envelope",filter.value);if(filter.projection){box.setAttribute("srsName",filter.projection);}  
node.appendChild(box);return node;}},OpenLayers.Format.Filter.v1.prototype.writers["ogc"]),"gml":OpenLayers.Format.GML.v3.prototype.writers["gml"],"feature":OpenLayers.Format.GML.v3.prototype.writers["feature"]},writeSpatial:function(filter,name){var node=this.createElementNSPlus("ogc:"+name);this.writeNode("PropertyName",filter,node);var child;if(filter.value instanceof OpenLayers.Geometry){child=this.writeNode("feature:_geometry",filter.value).firstChild;}else{child=this.writeNode("gml:Envelope",filter.value);}  
if(filter.projection){child.setAttribute("srsName",filter.projection);}  
node.appendChild(child);return node;},CLASS_NAME:"OpenLayers.Format.Filter.v1_1_0"});OpenLayers.Format.SOSCapabilities.v1_0_0=OpenLayers.Class(OpenLayers.Format.SOSCapabilities,{namespaces:{ows:"http://www.opengis.net/ows/1.1",sos:"http://www.opengis.net/sos/1.0",gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink"},regExes:{trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)},initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);this.options=options;},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
if(data&&data.nodeType==9){data=data.documentElement;}  
var capabilities={};this.readNode(data,capabilities);return capabilities;},readers:{"gml":OpenLayers.Util.applyDefaults({"name":function(node,obj){obj.name=this.getChildValue(node);},"TimePeriod":function(node,obj){obj.timePeriod={};this.readChildNodes(node,obj.timePeriod);},"beginPosition":function(node,timePeriod){timePeriod.beginPosition=this.getChildValue(node);},"endPosition":function(node,timePeriod){timePeriod.endPosition=this.getChildValue(node);}},OpenLayers.Format.GML.v3.prototype.readers["gml"]),"sos":{"Capabilities":function(node,obj){this.readChildNodes(node,obj);},"Contents":function(node,obj){obj.contents={};this.readChildNodes(node,obj.contents);},"ObservationOfferingList":function(node,contents){contents.offeringList={};this.readChildNodes(node,contents.offeringList);},"ObservationOffering":function(node,offeringList){var id=this.getAttributeNS(node,this.namespaces.gml,"id");offeringList[id]={procedures:[],observedProperties:[],featureOfInterestIds:[],responseFormats:[],resultModels:[],responseModes:[]};this.readChildNodes(node,offeringList[id]);},"time":function(node,offering){offering.time={};this.readChildNodes(node,offering.time);},"procedure":function(node,offering){offering.procedures.push(this.getAttributeNS(node,this.namespaces.xlink,"href"));},"observedProperty":function(node,offering){offering.observedProperties.push(this.getAttributeNS(node,this.namespaces.xlink,"href"));},"featureOfInterest":function(node,offering){offering.featureOfInterestIds.push(this.getAttributeNS(node,this.namespaces.xlink,"href"));},"responseFormat":function(node,offering){offering.responseFormats.push(this.getChildValue(node));},"resultModel":function(node,offering){offering.resultModels.push(this.getChildValue(node));},"responseMode":function(node,offering){offering.responseModes.push(this.getChildValue(node));;}},"ows":OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"]},CLASS_NAME:"OpenLayers.Format.SOSCapabilities.v1_0_0"});OpenLayers.Format.SOSGetFeatureOfInterest=OpenLayers.Class(OpenLayers.Format.XML,{VERSION:"1.0.0",namespaces:{sos:"http://www.opengis.net/sos/1.0",gml:"http://www.opengis.net/gml",sa:"http://www.opengis.net/sampling/1.0",xsi:"http://www.w3.org/2001/XMLSchema-instance"},schemaLocation:"http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosAll.xsd",defaultPrefix:"sos",regExes:{trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)},initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
if(data&&data.nodeType==9){data=data.documentElement;}  
var info={features:[]};this.readNode(data,info);var features=[];for(var i=0,len=info.features.length;i<len;i++){var container=info.features[i];if(this.internalProjection&&this.externalProjection&&container.components[0]){container.components[0].transform(this.externalProjection,this.internalProjection);}  
var feature=new OpenLayers.Feature.Vector(container.components[0],container.attributes);features.push(feature);}  
return features;},readers:{"sa":{"SamplingPoint":function(node,obj){if(!obj.attributes){var feature={attributes:{}};obj.features.push(feature);obj=feature;}  
obj.attributes.id=this.getAttributeNS(node,this.namespaces.gml,"id");this.readChildNodes(node,obj);},"position":function(node,obj){this.readChildNodes(node,obj);}},"gml":OpenLayers.Util.applyDefaults({"FeatureCollection":function(node,obj){this.readChildNodes(node,obj);},"featureMember":function(node,obj){var feature={attributes:{}};obj.features.push(feature);this.readChildNodes(node,feature);},"name":function(node,obj){obj.attributes.name=this.getChildValue(node);},"pos":function(node,obj){if(!this.externalProjection){this.externalProjection=new OpenLayers.Projection(node.getAttribute("srsName"));}  
OpenLayers.Format.GML.v3.prototype.readers.gml.pos.apply(this,[node,obj]);}},OpenLayers.Format.GML.v3.prototype.readers.gml)},writers:{"sos":{"GetFeatureOfInterest":function(options){var node=this.createElementNSPlus("GetFeatureOfInterest",{attributes:{version:this.VERSION,service:'SOS',"xsi:schemaLocation":this.schemaLocation}});for(var i=0,len=options.fois.length;i<len;i++){this.writeNode("FeatureOfInterestId",{foi:options.fois[i]},node);}  
return node;},"FeatureOfInterestId":function(options){var node=this.createElementNSPlus("FeatureOfInterestId",{value:options.foi});return node;}}},CLASS_NAME:"OpenLayers.Format.SOSGetFeatureOfInterest"});OpenLayers.Format.SOSGetObservation=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{ows:"http://www.opengis.net/ows",gml:"http://www.opengis.net/gml",sos:"http://www.opengis.net/sos/1.0",ogc:"http://www.opengis.net/ogc",om:"http://www.opengis.net/om/1.0",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},regExes:{trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)},VERSION:"1.0.0",schemaLocation:"http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosGetObservation.xsd",defaultPrefix:"sos",initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
if(data&&data.nodeType==9){data=data.documentElement;}  
var info={measurements:[]};this.readNode(data,info);return info;},write:function(options){var node=this.writeNode("sos:GetObservation",options);node.setAttribute("xmlns:om",this.namespaces.om);this.setAttributeNS(node,this.namespaces.xsi,"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[node]);},readers:{"om":{"ObservationCollection":function(node,obj){obj.id=this.getAttributeNS(node,this.namespaces.gml,"id");this.readChildNodes(node,obj);},"member":function(node,observationCollection){this.readChildNodes(node,observationCollection);},"Measurement":function(node,observationCollection){var measurement={};observationCollection.measurements.push(measurement);this.readChildNodes(node,measurement);},"samplingTime":function(node,measurement){var samplingTime={};measurement.samplingTime=samplingTime;this.readChildNodes(node,samplingTime);},"observedProperty":function(node,measurement){measurement.observedProperty=this.getAttributeNS(node,this.namespaces.xlink,"href");this.readChildNodes(node,measurement);},"procedure":function(node,measurement){measurement.procedure=this.getAttributeNS(node,this.namespaces.xlink,"href");this.readChildNodes(node,measurement);},"result":function(node,measurement){var result={};measurement.result=result;if(this.getChildValue(node)!==''){result.value=this.getChildValue(node);result.uom=node.getAttribute("uom");}else{this.readChildNodes(node,result);}}},"gml":OpenLayers.Util.applyDefaults({"TimeInstant":function(node,samplingTime){var timeInstant={};samplingTime.timeInstant=timeInstant;this.readChildNodes(node,timeInstant);},"timePosition":function(node,timeInstant){timeInstant.timePosition=this.getChildValue(node);}},OpenLayers.Format.GML.v3.prototype.readers.gml)},writers:{"sos":{"GetObservation":function(options){var node=this.createElementNSPlus("GetObservation",{attributes:{version:this.VERSION,service:'SOS'}});this.writeNode("offering",options,node);this.writeNode("eventTime",options,node);this.writeNode("procedure",options,node);this.writeNode("observedProperty",options,node);this.writeNode("responseFormat",options,node);this.writeNode("resultModel",options,node);this.writeNode("responseMode",options,node);return node;},"responseFormat":function(options){return this.createElementNSPlus("responseFormat",{value:options.responseFormat});},"procedure":function(options){return this.createElementNSPlus("procedure",{value:options.procedure});},"offering":function(options){return this.createElementNSPlus("offering",{value:options.offering});},"observedProperty":function(options){return this.createElementNSPlus("observedProperty",{value:options.observedProperty});},"eventTime":function(options){var node=this.createElementNSPlus("eventTime");if(options.eventTime==='latest'){this.writeNode("ogc:TM_Equals",options,node);}  
return node;},"resultModel":function(options){return this.createElementNSPlus("resultModel",{value:options.resultModel});},"responseMode":function(options){return this.createElementNSPlus("responseMode",{value:options.responseMode});}},"ogc":{"TM_Equals":function(options){var node=this.createElementNSPlus("ogc:TM_Equals");this.writeNode("ogc:PropertyName",{property:"urn:ogc:data:time:iso8601"},node);if(options.eventTime==='latest'){this.writeNode("gml:TimeInstant",{value:'latest'},node);}  
return node;},"PropertyName":function(options){return this.createElementNSPlus("ogc:PropertyName",{value:options.property});}},"gml":{"TimeInstant":function(options){var node=this.createElementNSPlus("gml:TimeInstant");this.writeNode("gml:timePosition",options,node);return node;},"timePosition":function(options){var node=this.createElementNSPlus("gml:timePosition",{value:options.value});return node;}}},CLASS_NAME:"OpenLayers.Format.SOSGetObservation"});OpenLayers.Format.CSWGetRecords.v2_0_2=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",csw:"http://www.opengis.net/cat/csw/2.0.2",dc:"http://purl.org/dc/elements/1.1/",dct:"http://purl.org/dc/terms/",ows:"http://www.opengis.net/ows"},defaultPrefix:"csw",version:"2.0.2",schemaLocation:"http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd",requestId:null,resultType:null,outputFormat:null,outputSchema:null,startPosition:null,maxRecords:null,DistributedSearch:null,ResponseHandler:null,Query:null,regExes:{trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)},initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
if(data&&data.nodeType==9){data=data.documentElement;}  
var obj={};this.readNode(data,obj);return obj;},readers:{"csw":{"GetRecordsResponse":function(node,obj){obj.records=[];this.readChildNodes(node,obj);var version=this.getAttributeNS(node,"",'version');if(version!=""){obj.version=version;}},"RequestId":function(node,obj){obj.RequestId=this.getChildValue(node);},"SearchStatus":function(node,obj){obj.SearchStatus={};var timestamp=this.getAttributeNS(node,"",'timestamp');if(timestamp!=""){obj.SearchStatus.timestamp=timestamp;}},"SearchResults":function(node,obj){this.readChildNodes(node,obj);var attrs=node.attributes;var SearchResults={};for(var i=0,len=attrs.length;i<len;++i){if((attrs[i].name=="numberOfRecordsMatched")||(attrs[i].name=="numberOfRecordsReturned")||(attrs[i].name=="nextRecord")){SearchResults[attrs[i].name]=parseInt(attrs[i].nodeValue);}else{SearchResults[attrs[i].name]=attrs[i].nodeValue;}}  
obj.SearchResults=SearchResults;},"SummaryRecord":function(node,obj){var record={type:"SummaryRecord"};this.readChildNodes(node,record);obj.records.push(record);},"BriefRecord":function(node,obj){var record={type:"BriefRecord"};this.readChildNodes(node,record);obj.records.push(record);},"DCMIRecord":function(node,obj){var record={type:"DCMIRecord"};this.readChildNodes(node,record);obj.records.push(record);},"Record":function(node,obj){var record={type:"Record"};this.readChildNodes(node,record);obj.records.push(record);}},"dc":{"*":function(node,obj){var name=node.localName||node.nodeName.split(":").pop();if(!(obj[name]instanceof Array)){obj[name]=new Array();}  
var dc_element={};var attrs=node.attributes;for(var i=0,len=attrs.length;i<len;++i){dc_element[attrs[i].name]=attrs[i].nodeValue;}  
dc_element.value=this.getChildValue(node);obj[name].push(dc_element);}},"dct":{"*":function(node,obj){var name=node.localName||node.nodeName.split(":").pop();if(!(obj[name]instanceof Array)){obj[name]=new Array();}  
obj[name].push(this.getChildValue(node));}},"ows":OpenLayers.Util.applyDefaults({"BoundingBox":function(node,obj){if(obj.bounds){obj.BoundingBox=[{crs:obj.projection,value:[obj.bounds.left,obj.bounds.bottom,obj.bounds.right,obj.bounds.top]}];delete obj.projection;delete obj.bounds;}  
OpenLayers.Format.OWSCommon.v1_0_0.prototype.readers["ows"]["BoundingBox"].apply(this,arguments);}},OpenLayers.Format.OWSCommon.v1_0_0.prototype.readers["ows"])},write:function(options){var node=this.writeNode("csw:GetRecords",options);return OpenLayers.Format.XML.prototype.write.apply(this,[node]);},writers:{"csw":{"GetRecords":function(options){if(!options){options={};}  
var node=this.createElementNSPlus("csw:GetRecords",{attributes:{service:"CSW",version:this.version,requestId:options.requestId||this.requestId,resultType:options.resultType||this.resultType,outputFormat:options.outputFormat||this.outputFormat,outputSchema:options.outputSchema||this.outputSchema,startPosition:options.startPosition||this.startPosition,maxRecords:options.maxRecords||this.maxRecords}});if(options.DistributedSearch||this.DistributedSearch){this.writeNode("csw:DistributedSearch",options.DistributedSearch||this.DistributedSearch,node);}  
var ResponseHandler=options.ResponseHandler||this.ResponseHandler;if(ResponseHandler instanceof Array&&ResponseHandler.length>0){for(var i=0,len=ResponseHandler.length;i<len;i++){this.writeNode("csw:ResponseHandler",ResponseHandler[i],node);}}  
this.writeNode("Query",options.Query||this.Query,node);return node;},"DistributedSearch":function(options){var node=this.createElementNSPlus("csw:DistributedSearch",{attributes:{hopCount:options.hopCount}});return node;},"ResponseHandler":function(options){var node=this.createElementNSPlus("csw:ResponseHandler",{value:options.value});return node;},"Query":function(options){if(!options){options={};}  
var node=this.createElementNSPlus("csw:Query",{attributes:{typeNames:options.typeNames||"csw:Record"}});var ElementName=options.ElementName;if(ElementName instanceof Array&&ElementName.length>0){for(var i=0,len=ElementName.length;i<len;i++){this.writeNode("csw:ElementName",ElementName[i],node);}}else{this.writeNode("csw:ElementSetName",options.ElementSetName||{value:'summary'},node);}  
if(options.Constraint){this.writeNode("csw:Constraint",options.Constraint,node);}  
return node;},"ElementName":function(options){var node=this.createElementNSPlus("csw:ElementName",{value:options.value});return node;},"ElementSetName":function(options){var node=this.createElementNSPlus("csw:ElementSetName",{attributes:{typeNames:options.typeNames},value:options.value});return node;},"Constraint":function(options){var node=this.createElementNSPlus("csw:Constraint",{attributes:{version:options.version}});if(options.Filter){var format=new OpenLayers.Format.Filter({version:options.version});node.appendChild(format.write(options.Filter));}else if(options.CqlText){var child=this.createElementNSPlus("CqlText",{value:options.CqlText.value});node.appendChild(child);}  
return node;}}},CLASS_NAME:"OpenLayers.Format.CSWGetRecords.v2_0_2"});OpenLayers.Format.SLD.v1=OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0,{namespaces:{sld:"http://www.opengis.net/sld",ogc:"http://www.opengis.net/ogc",gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},defaultPrefix:"sld",schemaLocation:null,multipleSymbolizers:false,featureTypeCounter:null,defaultSymbolizer:{fillColor:"#808080",fillOpacity:1,strokeColor:"#000000",strokeOpacity:1,strokeWidth:1,strokeDashstyle:"solid",pointRadius:3,graphicName:"square"},initialize:function(options){OpenLayers.Format.Filter.v1_0_0.prototype.initialize.apply(this,[options]);},read:function(data,options){options=OpenLayers.Util.applyDefaults(options,this.options);var sld={namedLayers:options.namedLayersAsArray===true?[]:{}};this.readChildNodes(data,sld);return sld;},readers:OpenLayers.Util.applyDefaults({"sld":{"StyledLayerDescriptor":function(node,sld){sld.version=node.getAttribute("version");this.readChildNodes(node,sld);},"Name":function(node,obj){obj.name=this.getChildValue(node);},"Title":function(node,obj){obj.title=this.getChildValue(node);},"Abstract":function(node,obj){obj.description=this.getChildValue(node);},"NamedLayer":function(node,sld){var layer={userStyles:[],namedStyles:[]};this.readChildNodes(node,layer);for(var i=0,len=layer.userStyles.length;i<len;++i){layer.userStyles[i].layerName=layer.name;}  
if(sld.namedLayers instanceof Array){sld.namedLayers.push(layer);}else{sld.namedLayers[layer.name]=layer;}},"NamedStyle":function(node,layer){layer.namedStyles.push(this.getChildName(node.firstChild));},"UserStyle":function(node,layer){var obj={defaultsPerSymbolizer:true,rules:[]};this.featureTypeCounter=-1;this.readChildNodes(node,obj);var style;if(this.multipleSymbolizers){delete obj.defaultsPerSymbolizer;style=new OpenLayers.Style2(obj);}else{style=new OpenLayers.Style(this.defaultSymbolizer,obj);}  
layer.userStyles.push(style);},"IsDefault":function(node,style){if(this.getChildValue(node)=="1"){style.isDefault=true;}},"FeatureTypeStyle":function(node,style){++this.featureTypeCounter;var obj={rules:this.multipleSymbolizers?style.rules:[]};this.readChildNodes(node,obj);if(!this.multipleSymbolizers){style.rules=obj.rules;}},"Rule":function(node,obj){var config;if(this.multipleSymbolizers){config={symbolizers:[]};}  
var rule=new OpenLayers.Rule(config);this.readChildNodes(node,rule);obj.rules.push(rule);},"ElseFilter":function(node,rule){rule.elseFilter=true;},"MinScaleDenominator":function(node,rule){rule.minScaleDenominator=parseFloat(this.getChildValue(node));},"MaxScaleDenominator":function(node,rule){rule.maxScaleDenominator=parseFloat(this.getChildValue(node));},"TextSymbolizer":function(node,rule){var config={};this.readChildNodes(node,config);if(this.multipleSymbolizers){config.zIndex=this.featureTypeCounter;rule.symbolizers.push(new OpenLayers.Symbolizer.Text(config));}else{rule.symbolizer["Text"]=OpenLayers.Util.applyDefaults(config,rule.symbolizer["Text"]);}},"Label":function(node,symbolizer){var obj={};this.readChildNodes(node,obj);if(obj.property){symbolizer.label="${"+obj.property+"}";}else{var value=this.readOgcExpression(node);if(value){symbolizer.label=value;}}},"Font":function(node,symbolizer){this.readChildNodes(node,symbolizer);},"Halo":function(node,symbolizer){var obj={};this.readChildNodes(node,obj);symbolizer.haloRadius=obj.haloRadius;symbolizer.haloColor=obj.fillColor;symbolizer.haloOpacity=obj.fillOpacity;},"Radius":function(node,symbolizer){var radius=this.readOgcExpression(node);if(radius!=null){symbolizer.haloRadius=radius;}},"RasterSymbolizer":function(node,rule){var config={};this.readChildNodes(node,config);if(this.multipleSymbolizers){config.zIndex=this.featureTypeCounter;rule.symbolizers.push(new OpenLayers.Symbolizer.Raster(config));}else{rule.symbolizer["Raster"]=OpenLayers.Util.applyDefaults(config,rule.symbolizer["Raster"]);}},"Geometry":function(node,obj){obj.geometry={};this.readChildNodes(node,obj.geometry);},"ColorMap":function(node,symbolizer){symbolizer.colorMap=[];this.readChildNodes(node,symbolizer.colorMap);},"ColorMapEntry":function(node,colorMap){var q=node.getAttribute("quantity");var o=node.getAttribute("opacity");colorMap.push({color:node.getAttribute("color"),quantity:q!==null?parseFloat(q):undefined,label:node.getAttribute("label")||undefined,opacity:o!==null?parseFloat(o):undefined});},"LineSymbolizer":function(node,rule){var config={};this.readChildNodes(node,config);if(this.multipleSymbolizers){config.zIndex=this.featureTypeCounter;rule.symbolizers.push(new OpenLayers.Symbolizer.Line(config));}else{rule.symbolizer["Line"]=OpenLayers.Util.applyDefaults(config,rule.symbolizer["Line"]);}},"PolygonSymbolizer":function(node,rule){var config={fill:false,stroke:false};if(!this.multipleSymbolizers){config=rule.symbolizer["Polygon"]||config;}  
this.readChildNodes(node,config);if(this.multipleSymbolizers){config.zIndex=this.featureTypeCounter;rule.symbolizers.push(new OpenLayers.Symbolizer.Polygon(config));}else{rule.symbolizer["Polygon"]=config;}},"PointSymbolizer":function(node,rule){var config={fill:false,stroke:false,graphic:false};if(!this.multipleSymbolizers){config=rule.symbolizer["Point"]||config;}  
this.readChildNodes(node,config);if(this.multipleSymbolizers){config.zIndex=this.featureTypeCounter;rule.symbolizers.push(new OpenLayers.Symbolizer.Point(config));}else{rule.symbolizer["Point"]=config;}},"Stroke":function(node,symbolizer){symbolizer.stroke=true;this.readChildNodes(node,symbolizer);},"Fill":function(node,symbolizer){symbolizer.fill=true;this.readChildNodes(node,symbolizer);},"CssParameter":function(node,symbolizer){var cssProperty=node.getAttribute("name");var symProperty=this.cssMap[cssProperty];if(symProperty){var value=this.readOgcExpression(node);if(value){symbolizer[symProperty]=value;}}},"Graphic":function(node,symbolizer){symbolizer.graphic=true;var graphic={};this.readChildNodes(node,graphic);var properties=["stroke","strokeColor","strokeWidth","strokeOpacity","strokeLinecap","fill","fillColor","fillOpacity","graphicName","rotation","graphicFormat"];var prop,value;for(var i=0,len=properties.length;i<len;++i){prop=properties[i];value=graphic[prop];if(value!=undefined){symbolizer[prop]=value;}}  
if(graphic.opacity!=undefined){symbolizer.graphicOpacity=graphic.opacity;}  
if(graphic.size!=undefined){symbolizer.pointRadius=graphic.size/2;}  
if(graphic.href!=undefined){symbolizer.externalGraphic=graphic.href;}  
if(graphic.rotation!=undefined){symbolizer.rotation=graphic.rotation;}},"ExternalGraphic":function(node,graphic){this.readChildNodes(node,graphic);},"Mark":function(node,graphic){this.readChildNodes(node,graphic);},"WellKnownName":function(node,graphic){graphic.graphicName=this.getChildValue(node);},"Opacity":function(node,obj){var opacity=this.readOgcExpression(node);if(opacity){obj.opacity=opacity;}},"Size":function(node,obj){var size=this.readOgcExpression(node);if(size){obj.size=size;}},"Rotation":function(node,obj){var rotation=this.readOgcExpression(node);if(rotation){obj.rotation=rotation;}},"OnlineResource":function(node,obj){obj.href=this.getAttributeNS(node,this.namespaces.xlink,"href");},"Format":function(node,graphic){graphic.graphicFormat=this.getChildValue(node);}}},OpenLayers.Format.Filter.v1_0_0.prototype.readers),cssMap:{"stroke":"strokeColor","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-dasharray":"strokeDashstyle","fill":"fillColor","fill-opacity":"fillOpacity","font-family":"fontFamily","font-size":"fontSize","font-weight":"fontWeight","font-style":"fontStyle"},getCssProperty:function(sym){var css=null;for(var prop in this.cssMap){if(this.cssMap[prop]==sym){css=prop;break;}}  
return css;},getGraphicFormat:function(href){var format,regex;for(var key in this.graphicFormats){if(this.graphicFormats[key].test(href)){format=key;break;}}  
return format||this.defautlGraphicFormat;},defaultGraphicFormat:"image/png",graphicFormats:{"image/jpeg":/\.jpe?g$/i,"image/gif":/\.gif$/i,"image/png":/\.png$/i},write:function(sld){return this.writers.sld.StyledLayerDescriptor.apply(this,[sld]);},writers:OpenLayers.Util.applyDefaults({"sld":{"StyledLayerDescriptor":function(sld){var root=this.createElementNSPlus("sld:StyledLayerDescriptor",{attributes:{"version":this.VERSION,"xsi:schemaLocation":this.schemaLocation}});root.setAttribute("xmlns:ogc",this.namespaces.ogc);root.setAttribute("xmlns:gml",this.namespaces.gml);if(sld.name){this.writeNode("Name",sld.name,root);}  
if(sld.title){this.writeNode("Title",sld.title,root);}  
if(sld.description){this.writeNode("Abstract",sld.description,root);}  
if(sld.namedLayers instanceof Array){for(var i=0,len=sld.namedLayers.length;i<len;++i){this.writeNode("NamedLayer",sld.namedLayers[i],root);}}else{for(var name in sld.namedLayers){this.writeNode("NamedLayer",sld.namedLayers[name],root);}}  
return root;},"Name":function(name){return this.createElementNSPlus("sld:Name",{value:name});},"Title":function(title){return this.createElementNSPlus("sld:Title",{value:title});},"Abstract":function(description){return this.createElementNSPlus("sld:Abstract",{value:description});},"NamedLayer":function(layer){var node=this.createElementNSPlus("sld:NamedLayer");this.writeNode("Name",layer.name,node);if(layer.namedStyles){for(var i=0,len=layer.namedStyles.length;i<len;++i){this.writeNode("NamedStyle",layer.namedStyles[i],node);}}  
if(layer.userStyles){for(var i=0,len=layer.userStyles.length;i<len;++i){this.writeNode("UserStyle",layer.userStyles[i],node);}}  
return node;},"NamedStyle":function(name){var node=this.createElementNSPlus("sld:NamedStyle");this.writeNode("Name",name,node);return node;},"UserStyle":function(style){var node=this.createElementNSPlus("sld:UserStyle");if(style.name){this.writeNode("Name",style.name,node);}  
if(style.title){this.writeNode("Title",style.title,node);}  
if(style.description){this.writeNode("Abstract",style.description,node);}  
if(style.isDefault){this.writeNode("IsDefault",style.isDefault,node);}  
if(this.multipleSymbolizers&&style.rules){var rulesByZ={0:[]};var zValues=[0];var rule,ruleMap,symbolizer,zIndex,clone;for(var i=0,ii=style.rules.length;i<ii;++i){rule=style.rules[i];if(rule.symbolizers){ruleMap={};for(var j=0,jj=rule.symbolizers.length;j<jj;++j){symbolizer=rule.symbolizers[j];zIndex=symbolizer.zIndex;if(!(zIndex in ruleMap)){clone=rule.clone();clone.symbolizers=[];ruleMap[zIndex]=clone;}  
ruleMap[zIndex].symbolizers.push(symbolizer.clone());}  
for(zIndex in ruleMap){if(!(zIndex in rulesByZ)){zValues.push(zIndex);rulesByZ[zIndex]=[];}  
rulesByZ[zIndex].push(ruleMap[zIndex]);}}else{rulesByZ[0].push(rule.clone());}}  
zValues.sort();var rules;for(var i=0,ii=zValues.length;i<ii;++i){rules=rulesByZ[zValues[i]];if(rules.length>0){clone=style.clone();clone.rules=rulesByZ[zValues[i]];this.writeNode("FeatureTypeStyle",clone,node);}}}else{this.writeNode("FeatureTypeStyle",style,node);}  
return node;},"IsDefault":function(bool){return this.createElementNSPlus("sld:IsDefault",{value:(bool)?"1":"0"});},"FeatureTypeStyle":function(style){var node=this.createElementNSPlus("sld:FeatureTypeStyle");for(var i=0,len=style.rules.length;i<len;++i){this.writeNode("Rule",style.rules[i],node);}  
return node;},"Rule":function(rule){var node=this.createElementNSPlus("sld:Rule");if(rule.name){this.writeNode("Name",rule.name,node);}  
if(rule.title){this.writeNode("Title",rule.title,node);}  
if(rule.description){this.writeNode("Abstract",rule.description,node);}  
if(rule.elseFilter){this.writeNode("ElseFilter",null,node);}else if(rule.filter){this.writeNode("ogc:Filter",rule.filter,node);}  
if(rule.minScaleDenominator!=undefined){this.writeNode("MinScaleDenominator",rule.minScaleDenominator,node);}  
if(rule.maxScaleDenominator!=undefined){this.writeNode("MaxScaleDenominator",rule.maxScaleDenominator,node);}  
var type,symbolizer;if(this.multipleSymbolizers&&rule.symbolizers){var symbolizer;for(var i=0,ii=rule.symbolizers.length;i<ii;++i){symbolizer=rule.symbolizers[i];type=symbolizer.CLASS_NAME.split(".").pop();this.writeNode(type+"Symbolizer",symbolizer,node);}}else{var types=OpenLayers.Style.SYMBOLIZER_PREFIXES;for(var i=0,len=types.length;i<len;++i){type=types[i];symbolizer=rule.symbolizer[type];if(symbolizer){this.writeNode(type+"Symbolizer",symbolizer,node);}}}  
return node;},"ElseFilter":function(){return this.createElementNSPlus("sld:ElseFilter");},"MinScaleDenominator":function(scale){return this.createElementNSPlus("sld:MinScaleDenominator",{value:scale});},"MaxScaleDenominator":function(scale){return this.createElementNSPlus("sld:MaxScaleDenominator",{value:scale});},"LineSymbolizer":function(symbolizer){var node=this.createElementNSPlus("sld:LineSymbolizer");this.writeNode("Stroke",symbolizer,node);return node;},"Stroke":function(symbolizer){var node=this.createElementNSPlus("sld:Stroke");if(symbolizer.strokeColor!=undefined){this.writeNode("CssParameter",{symbolizer:symbolizer,key:"strokeColor"},node);}  
if(symbolizer.strokeOpacity!=undefined){this.writeNode("CssParameter",{symbolizer:symbolizer,key:"strokeOpacity"},node);}  
if(symbolizer.strokeWidth!=undefined){this.writeNode("CssParameter",{symbolizer:symbolizer,key:"strokeWidth"},node);}  
if(symbolizer.strokeDashstyle!=undefined&&symbolizer.strokeDashstyle!=="solid"){this.writeNode("CssParameter",{symbolizer:symbolizer,key:"strokeDashstyle"},node);}  
if(symbolizer.strokeLinecap!=undefined){this.writeNode("CssParameter",{symbolizer:symbolizer,key:"strokeLinecap"},node);}  
return node;},"CssParameter":function(obj){return this.createElementNSPlus("sld:CssParameter",{attributes:{name:this.getCssProperty(obj.key)},value:obj.symbolizer[obj.key]});},"TextSymbolizer":function(symbolizer){var node=this.createElementNSPlus("sld:TextSymbolizer");if(symbolizer.label!=null){this.writeNode("Label",symbolizer.label,node);}  
if(symbolizer.fontFamily!=null||symbolizer.fontSize!=null||symbolizer.fontWeight!=null||symbolizer.fontStyle!=null){this.writeNode("Font",symbolizer,node);}  
if(symbolizer.haloRadius!=null||symbolizer.haloColor!=null||symbolizer.haloOpacity!=null){this.writeNode("Halo",symbolizer,node);}  
if(symbolizer.fillColor!=null||symbolizer.fillOpacity!=null){this.writeNode("Fill",symbolizer,node);}  
return node;},"Font":function(symbolizer){var node=this.createElementNSPlus("sld:Font");if(symbolizer.fontFamily){this.writeNode("CssParameter",{symbolizer:symbolizer,key:"fontFamily"},node);}  
if(symbolizer.fontSize){this.writeNode("CssParameter",{symbolizer:symbolizer,key:"fontSize"},node);}  
if(symbolizer.fontWeight){this.writeNode("CssParameter",{symbolizer:symbolizer,key:"fontWeight"},node);}  
if(symbolizer.fontStyle){this.writeNode("CssParameter",{symbolizer:symbolizer,key:"fontStyle"},node);}  
return node;},"Label":function(label){var node=this.createElementNSPlus("sld:Label");var tokens=label.split("${");node.appendChild(this.createTextNode(tokens[0]));var item,last;for(var i=1,len=tokens.length;i<len;i++){item=tokens[i];last=item.indexOf("}");if(last>0){this.writeNode("ogc:PropertyName",{property:item.substring(0,last)},node);node.appendChild(this.createTextNode(item.substring(++last)));}else{node.appendChild(this.createTextNode("${"+item));}}  
return node;},"Halo":function(symbolizer){var node=this.createElementNSPlus("sld:Halo");if(symbolizer.haloRadius){this.writeNode("Radius",symbolizer.haloRadius,node);}  
if(symbolizer.haloColor||symbolizer.haloOpacity){this.writeNode("Fill",{fillColor:symbolizer.haloColor,fillOpacity:symbolizer.haloOpacity},node);}  
return node;},"Radius":function(value){return this.createElementNSPlus("sld:Radius",{value:value});},"RasterSymbolizer":function(symbolizer){var node=this.createElementNSPlus("sld:RasterSymbolizer");if(symbolizer.geometry){this.writeNode("Geometry",symbolizer.geometry,node);}  
if(symbolizer.opacity){this.writeNode("Opacity",symbolizer.opacity,node);}  
if(symbolizer.colorMap){this.writeNode("ColorMap",symbolizer.colorMap,node);}  
return node;},"Geometry":function(geometry){var node=this.createElementNSPlus("sld:Geometry");if(geometry.property){this.writeNode("ogc:PropertyName",geometry,node);}  
return node;},"ColorMap":function(colorMap){var node=this.createElementNSPlus("sld:ColorMap");for(var i=0,len=colorMap.length;i<len;++i){this.writeNode("ColorMapEntry",colorMap[i],node);}  
return node;},"ColorMapEntry":function(colorMapEntry){var node=this.createElementNSPlus("sld:ColorMapEntry");var a=colorMapEntry;node.setAttribute("color",a.color);a.opacity!==undefined&&node.setAttribute("opacity",parseFloat(a.opacity));a.quantity!==undefined&&node.setAttribute("quantity",parseFloat(a.quantity));a.label!==undefined&&node.setAttribute("label",a.label);return node;},"PolygonSymbolizer":function(symbolizer){var node=this.createElementNSPlus("sld:PolygonSymbolizer");if(symbolizer.fill!==false){this.writeNode("Fill",symbolizer,node);}  
if(symbolizer.stroke!==false){this.writeNode("Stroke",symbolizer,node);}  
return node;},"Fill":function(symbolizer){var node=this.createElementNSPlus("sld:Fill");if(symbolizer.fillColor){this.writeNode("CssParameter",{symbolizer:symbolizer,key:"fillColor"},node);}  
if(symbolizer.fillOpacity!=null){this.writeNode("CssParameter",{symbolizer:symbolizer,key:"fillOpacity"},node);}  
return node;},"PointSymbolizer":function(symbolizer){var node=this.createElementNSPlus("sld:PointSymbolizer");this.writeNode("Graphic",symbolizer,node);return node;},"Graphic":function(symbolizer){var node=this.createElementNSPlus("sld:Graphic");if(symbolizer.externalGraphic!=undefined){this.writeNode("ExternalGraphic",symbolizer,node);}else{this.writeNode("Mark",symbolizer,node);}  
if(symbolizer.graphicOpacity!=undefined){this.writeNode("Opacity",symbolizer.graphicOpacity,node);}  
if(symbolizer.pointRadius!=undefined){this.writeNode("Size",symbolizer.pointRadius*2,node);}  
if(symbolizer.rotation!=undefined){this.writeNode("Rotation",symbolizer.rotation,node);}  
return node;},"ExternalGraphic":function(symbolizer){var node=this.createElementNSPlus("sld:ExternalGraphic");this.writeNode("OnlineResource",symbolizer.externalGraphic,node);var format=symbolizer.graphicFormat||this.getGraphicFormat(symbolizer.externalGraphic);this.writeNode("Format",format,node);return node;},"Mark":function(symbolizer){var node=this.createElementNSPlus("sld:Mark");if(symbolizer.graphicName){this.writeNode("WellKnownName",symbolizer.graphicName,node);}  
if(symbolizer.fill!==false){this.writeNode("Fill",symbolizer,node);}  
if(symbolizer.stroke!==false){this.writeNode("Stroke",symbolizer,node);}  
return node;},"WellKnownName":function(name){return this.createElementNSPlus("sld:WellKnownName",{value:name});},"Opacity":function(value){return this.createElementNSPlus("sld:Opacity",{value:value});},"Size":function(value){return this.createElementNSPlus("sld:Size",{value:value});},"Rotation":function(value){return this.createElementNSPlus("sld:Rotation",{value:value});},"OnlineResource":function(href){return this.createElementNSPlus("sld:OnlineResource",{attributes:{"xlink:type":"simple","xlink:href":href}});},"Format":function(format){return this.createElementNSPlus("sld:Format",{value:format});}}},OpenLayers.Format.Filter.v1_0_0.prototype.writers),CLASS_NAME:"OpenLayers.Format.SLD.v1"});OpenLayers.Format.WFST.v1_0_0=OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0,OpenLayers.Format.WFST.v1,{version:"1.0.0",srsNameInQuery:false,schemaLocations:{"wfs":"http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"},initialize:function(options){OpenLayers.Format.Filter.v1_0_0.prototype.initialize.apply(this,[options]);OpenLayers.Format.WFST.v1.prototype.initialize.apply(this,[options]);},readers:{"wfs":OpenLayers.Util.applyDefaults({"WFS_TransactionResponse":function(node,obj){obj.insertIds=[];obj.success=false;this.readChildNodes(node,obj);},"InsertResult":function(node,container){var obj={fids:[]};this.readChildNodes(node,obj);container.insertIds.push(obj.fids[0]);},"TransactionResult":function(node,obj){this.readChildNodes(node,obj);},"Status":function(node,obj){this.readChildNodes(node,obj);},"SUCCESS":function(node,obj){obj.success=true;}},OpenLayers.Format.WFST.v1.prototype.readers["wfs"]),"gml":OpenLayers.Format.GML.v2.prototype.readers["gml"],"feature":OpenLayers.Format.GML.v2.prototype.readers["feature"],"ogc":OpenLayers.Format.Filter.v1_0_0.prototype.readers["ogc"]},writers:{"wfs":OpenLayers.Util.applyDefaults({"Query":function(options){options=OpenLayers.Util.extend({featureNS:this.featureNS,featurePrefix:this.featurePrefix,featureType:this.featureType,srsName:this.srsName,srsNameInQuery:this.srsNameInQuery},options);var node=this.createElementNSPlus("wfs:Query",{attributes:{typeName:(options.featureNS?options.featurePrefix+":":"")+  
options.featureType}});if(options.srsNameInQuery&&options.srsName){node.setAttribute("srsName",options.srsName);}  
if(options.featureNS){node.setAttribute("xmlns:"+options.featurePrefix,options.featureNS);}  
if(options.propertyNames){for(var i=0,len=options.propertyNames.length;i<len;i++){this.writeNode("ogc:PropertyName",{property:options.propertyNames[i]},node);}}  
if(options.filter){this.setFilterProperty(options.filter);this.writeNode("ogc:Filter",options.filter,node);}  
return node;}},OpenLayers.Format.WFST.v1.prototype.writers["wfs"]),"gml":OpenLayers.Format.GML.v2.prototype.writers["gml"],"feature":OpenLayers.Format.GML.v2.prototype.writers["feature"],"ogc":OpenLayers.Format.Filter.v1_0_0.prototype.writers["ogc"]},CLASS_NAME:"OpenLayers.Format.WFST.v1_0_0"});OpenLayers.Format.WFST.v1_1_0=OpenLayers.Class(OpenLayers.Format.Filter.v1_1_0,OpenLayers.Format.WFST.v1,{version:"1.1.0",schemaLocations:{"wfs":"http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"},initialize:function(options){OpenLayers.Format.Filter.v1_1_0.prototype.initialize.apply(this,[options]);OpenLayers.Format.WFST.v1.prototype.initialize.apply(this,[options]);},readers:{"wfs":OpenLayers.Util.applyDefaults({"FeatureCollection":function(node,obj){obj.numberOfFeatures=parseInt(node.getAttribute("numberOfFeatures"));OpenLayers.Format.WFST.v1.prototype.readers["wfs"]["FeatureCollection"].apply(this,arguments);},"TransactionResponse":function(node,obj){obj.insertIds=[];obj.success=false;this.readChildNodes(node,obj);},"TransactionSummary":function(node,obj){obj.success=true;},"InsertResults":function(node,obj){this.readChildNodes(node,obj);},"Feature":function(node,container){var obj={fids:[]};this.readChildNodes(node,obj);container.insertIds.push(obj.fids[0]);}},OpenLayers.Format.WFST.v1.prototype.readers["wfs"]),"gml":OpenLayers.Format.GML.v3.prototype.readers["gml"],"feature":OpenLayers.Format.GML.v3.prototype.readers["feature"],"ogc":OpenLayers.Format.Filter.v1_1_0.prototype.readers["ogc"]},writers:{"wfs":OpenLayers.Util.applyDefaults({"GetFeature":function(options){var node=OpenLayers.Format.WFST.v1.prototype.writers["wfs"]["GetFeature"].apply(this,arguments);options&&options.resultType&&this.setAttributes(node,{resultType:options.resultType});return node;},"Query":function(options){options=OpenLayers.Util.extend({featureNS:this.featureNS,featurePrefix:this.featurePrefix,featureType:this.featureType,srsName:this.srsName},options);var node=this.createElementNSPlus("wfs:Query",{attributes:{typeName:(options.featureNS?options.featurePrefix+":":"")+  
options.featureType,srsName:options.srsName}});if(options.featureNS){node.setAttribute("xmlns:"+options.featurePrefix,options.featureNS);}  
if(options.propertyNames){for(var i=0,len=options.propertyNames.length;i<len;i++){this.writeNode("wfs:PropertyName",{property:options.propertyNames[i]},node);}}  
if(options.filter){this.setFilterProperty(options.filter);this.writeNode("ogc:Filter",options.filter,node);}  
return node;},"PropertyName":function(obj){return this.createElementNSPlus("wfs:PropertyName",{value:obj.property});}},OpenLayers.Format.WFST.v1.prototype.writers["wfs"]),"gml":OpenLayers.Format.GML.v3.prototype.writers["gml"],"feature":OpenLayers.Format.GML.v3.prototype.writers["feature"],"ogc":OpenLayers.Format.Filter.v1_1_0.prototype.writers["ogc"]},CLASS_NAME:"OpenLayers.Format.WFST.v1_1_0"});OpenLayers.Protocol.SOS.v1_0_0=OpenLayers.Class(OpenLayers.Protocol,{fois:null,formatOptions:null,initialize:function(options){OpenLayers.Protocol.prototype.initialize.apply(this,[options]);if(!options.format){this.format=new OpenLayers.Format.SOSGetFeatureOfInterest(this.formatOptions);}},destroy:function(){if(this.options&&!this.options.format){this.format.destroy();}  
this.format=null;OpenLayers.Protocol.prototype.destroy.apply(this);},read:function(options){options=OpenLayers.Util.extend({},options);OpenLayers.Util.applyDefaults(options,this.options||{});var response=new OpenLayers.Protocol.Response({requestType:"read"});var format=this.format;var data=OpenLayers.Format.XML.prototype.write.apply(format,[format.writeNode("sos:GetFeatureOfInterest",{fois:this.fois})]);response.priv=OpenLayers.Request.POST({url:options.url,callback:this.createCallback(this.handleRead,response,options),data:data});return response;},handleRead:function(response,options){if(options.callback){var request=response.priv;if(request.status>=200&&request.status<300){response.features=this.parseFeatures(request);response.code=OpenLayers.Protocol.Response.SUCCESS;}else{response.code=OpenLayers.Protocol.Response.FAILURE;}  
options.callback.call(options.scope,response);}},parseFeatures:function(request){var doc=request.responseXML;if(!doc||!doc.documentElement){doc=request.responseText;}  
if(!doc||doc.length<=0){return null;}  
return this.format.read(doc);},CLASS_NAME:"OpenLayers.Protocol.SOS.v1_0_0"});OpenLayers.Format.SLD.v1_0_0=OpenLayers.Class(OpenLayers.Format.SLD.v1,{VERSION:"1.0.0",schemaLocation:"http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd",initialize:function(options){OpenLayers.Format.SLD.v1.prototype.initialize.apply(this,[options]);},CLASS_NAME:"OpenLayers.Format.SLD.v1_0_0"});OpenLayers.Protocol.WFS.v1_0_0=OpenLayers.Class(OpenLayers.Protocol.WFS.v1,{version:"1.0.0",CLASS_NAME:"OpenLayers.Protocol.WFS.v1_0_0"});OpenLayers.Protocol.WFS.v1_1_0=OpenLayers.Class(OpenLayers.Protocol.WFS.v1,{version:"1.1.0",CLASS_NAME:"OpenLayers.Protocol.WFS.v1_1_0"});OpenLayers.Format.OWSContext.v0_3_1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{owc:"http://www.opengis.net/ows-context",gml:"http://www.opengis.net/gml",kml:"http://www.opengis.net/kml/2.2",ogc:"http://www.opengis.net/ogc",ows:"http://www.opengis.net/ows",sld:"http://www.opengis.net/sld",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance"},VERSION:"0.3.1",schemaLocation:"http://www.opengis.net/ows-context http://www.ogcnetwork.net/schemas/owc/0.3.1/owsContext.xsd",defaultPrefix:"owc",extractAttributes:true,xy:true,regExes:{trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)},featureNS:"http://mapserver.gis.umn.edu/mapserver",featureType:'vector',geometryName:'geometry',nestingLayerLookup:null,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);OpenLayers.Format.GML.v2.prototype.setGeometryTypes.call(this);},setNestingPath:function(l){if(l.layersContext){for(var i=0,len=l.layersContext.length;i<len;i++){var layerContext=l.layersContext[i];var nPath=[];var nTitle=l.title||"";if(l.metadata&&l.metadata.nestingPath){nPath=l.metadata.nestingPath.slice();}  
if(nTitle!=""){nPath.push(nTitle);}  
layerContext.metadata.nestingPath=nPath;if(layerContext.layersContext){this.setNestingPath(layerContext);}}}},decomposeNestingPath:function(nPath){var a=[];if(nPath instanceof Array){while(nPath.length>0){a.push(nPath.slice());nPath.pop();}  
a.reverse();}  
return a;},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}  
if(data&&data.nodeType==9){data=data.documentElement;}  
var context={};this.readNode(data,context);this.setNestingPath({layersContext:context.layersContext});var layers=[];this.processLayer(layers,context);delete context.layersContext;context.layersContext=layers;return context;},processLayer:function(layerArray,layer){if(layer.layersContext){for(var i=0,len=layer.layersContext.length;i<len;i++){var l=layer.layersContext[i];layerArray.push(l);if(l.layersContext){this.processLayer(layerArray,l);}}}},write:function(context,options){var name="OWSContext";this.nestingLayerLookup={};options=options||{};OpenLayers.Util.applyDefaults(options,context);var root=this.writeNode(name,options);this.nestingLayerLookup=null;this.setAttributeNS(root,this.namespaces["xsi"],"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[root]);},readers:{"kml":{"Document":function(node,obj){obj.features=new OpenLayers.Format.KML({kmlns:this.namespaces.kml,extractStyles:true}).read(node);}},"owc":{"OWSContext":function(node,obj){this.readChildNodes(node,obj);},"General":function(node,obj){this.readChildNodes(node,obj);},"ResourceList":function(node,obj){this.readChildNodes(node,obj);},"Layer":function(node,obj){var layerContext={metadata:{},visibility:(node.getAttribute("hidden")!="1"),queryable:(node.getAttribute("queryable")=="1"),opacity:((node.getAttribute("opacity")!=null)?parseFloat(node.getAttribute("opacity")):null),name:node.getAttribute("name"),categoryLayer:(node.getAttribute("name")==null),formats:[],styles:[]};if(!obj.layersContext){obj.layersContext=[];}  
obj.layersContext.push(layerContext);this.readChildNodes(node,layerContext);},"InlineGeometry":function(node,obj){obj.features=[];var elements=this.getElementsByTagNameNS(node,this.namespaces.gml,"featureMember");var el;if(elements.length>=1){el=elements[0];}  
if(el&&el.firstChild){var featurenode=(el.firstChild.nextSibling)?el.firstChild.nextSibling:el.firstChild;this.setNamespace("feature",featurenode.namespaceURI);this.featureType=featurenode.localName||featurenode.nodeName.split(":").pop();this.readChildNodes(node,obj);}},"Server":function(node,obj){if((!obj.service&&!obj.version)||(obj.service!=OpenLayers.Format.Context.serviceTypes.WMS)){obj.service=node.getAttribute("service");obj.version=node.getAttribute("version");this.readChildNodes(node,obj);}},"Name":function(node,obj){obj.name=this.getChildValue(node);this.readChildNodes(node,obj);},"Title":function(node,obj){obj.title=this.getChildValue(node);this.readChildNodes(node,obj);},"StyleList":function(node,obj){this.readChildNodes(node,obj.styles);},"Style":function(node,obj){var style={};obj.push(style);this.readChildNodes(node,style);},"LegendURL":function(node,obj){var legend={};obj.legend=legend;this.readChildNodes(node,legend);},"OnlineResource":function(node,obj){obj.url=this.getAttributeNS(node,this.namespaces.xlink,"href");this.readChildNodes(node,obj);}},"ows":OpenLayers.Format.OWSCommon.v1_0_0.prototype.readers.ows,"gml":OpenLayers.Format.GML.v2.prototype.readers.gml,"sld":OpenLayers.Format.SLD.v1_0_0.prototype.readers.sld,"feature":OpenLayers.Format.GML.v2.prototype.readers.feature},writers:{"owc":{"OWSContext":function(options){var node=this.createElementNSPlus("OWSContext",{attributes:{version:this.VERSION,id:options.id||OpenLayers.Util.createUniqueID("OpenLayers_OWSContext_")}});this.writeNode("General",options,node);this.writeNode("ResourceList",options,node);return node;},"General":function(options){var node=this.createElementNSPlus("General");this.writeNode("ows:BoundingBox",options,node);this.writeNode("ows:Title",options.title||'OpenLayers OWSContext',node);return node;},"ResourceList":function(options){var node=this.createElementNSPlus("ResourceList");for(var i=0,len=options.layers.length;i<len;i++){var layer=options.layers[i];var decomposedPath=this.decomposeNestingPath(layer.metadata.nestingPath);this.writeNode("_Layer",{layer:layer,subPaths:decomposedPath},node);}  
return node;},"Server":function(options){var node=this.createElementNSPlus("Server",{attributes:{version:options.version,service:options.service}});this.writeNode("OnlineResource",options,node);return node;},"OnlineResource":function(options){var node=this.createElementNSPlus("OnlineResource",{attributes:{"xlink:href":options.url}});return node;},"InlineGeometry":function(layer){var node=this.createElementNSPlus("InlineGeometry");this.writeNode("gml:boundedBy",layer.getDataExtent(),node);for(var i=0,len=layer.features.length;i<len;i++){this.writeNode("gml:featureMember",layer.features[i],node);}  
return node;},"StyleList":function(styles){var node=this.createElementNSPlus("StyleList");for(var i=0,len=styles.length;i<len;i++){this.writeNode("Style",styles[i],node);}  
return node;},"Style":function(style){var node=this.createElementNSPlus("Style");this.writeNode("Name",style,node);this.writeNode("Title",style,node);this.writeNode("LegendURL",style,node);return node;},"Name":function(obj){var node=this.createElementNSPlus("Name",{value:obj.name});return node;},"Title":function(obj){var node=this.createElementNSPlus("Title",{value:obj.title});return node;},"LegendURL":function(style){var node=this.createElementNSPlus("LegendURL");this.writeNode("OnlineResource",style.legend,node);return node;},"_WMS":function(layer){var node=this.createElementNSPlus("Layer",{attributes:{name:layer.params.LAYERS,queryable:layer.queryable?"1":"0",hidden:layer.visibility?"0":"1",opacity:layer.opacity?layer.opacity:null}});this.writeNode("ows:Title",layer.name,node);this.writeNode("ows:OutputFormat",layer.params.FORMAT,node);this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.WMS,version:layer.params.VERSION,url:layer.url},node);if(layer.metadata.styles&&layer.metadata.styles.length>0){this.writeNode("StyleList",layer.metadata.styles,node);}  
return node;},"_Layer":function(options){var layer,subPaths,node,title;layer=options.layer;subPaths=options.subPaths;node=null;title=null;if(subPaths.length>0){var path=subPaths[0].join("/");var index=path.lastIndexOf("/");node=this.nestingLayerLookup[path];title=(index>0)?path.substring(index+1,path.length):path;if(!node){node=this.createElementNSPlus("Layer");this.writeNode("ows:Title",title,node);this.nestingLayerLookup[path]=node;}  
options.subPaths.shift();this.writeNode("_Layer",options,node);return node;}else{if(layer instanceof OpenLayers.Layer.WMS){node=this.writeNode("_WMS",layer);}else if(layer instanceof OpenLayers.Layer.Vector){if(layer.protocol instanceof OpenLayers.Protocol.WFS.v1){node=this.writeNode("_WFS",layer);}else if(layer.protocol instanceof OpenLayers.Protocol.HTTP){if(layer.protocol.format instanceof OpenLayers.Format.GML){layer.protocol.format.version="2.1.2";node=this.writeNode("_GML",layer);}else if(layer.protocol.format instanceof OpenLayers.Format.KML){layer.protocol.format.version="2.2";node=this.writeNode("_KML",layer);}}else{this.setNamespace("feature",this.featureNS);node=this.writeNode("_InlineGeometry",layer);}}  
if(layer.options.maxScale){this.writeNode("sld:MinScaleDenominator",layer.options.maxScale,node);}  
if(layer.options.minScale){this.writeNode("sld:MaxScaleDenominator",layer.options.minScale,node);}  
this.nestingLayerLookup[layer.name]=node;return node;}},"_WFS":function(layer){var node=this.createElementNSPlus("Layer",{attributes:{name:layer.protocol.featurePrefix+":"+layer.protocol.featureType,hidden:layer.visibility?"0":"1"}});this.writeNode("ows:Title",layer.name,node);this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.WFS,version:layer.protocol.version,url:layer.protocol.url},node);return node;},"_InlineGeometry":function(layer){var node=this.createElementNSPlus("Layer",{attributes:{name:this.featureType,hidden:layer.visibility?"0":"1"}});this.writeNode("ows:Title",layer.name,node);this.writeNode("InlineGeometry",layer,node);return node;},"_GML":function(layer){var node=this.createElementNSPlus("Layer");this.writeNode("ows:Title",layer.name,node);this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.GML,url:layer.protocol.url,version:layer.protocol.format.version},node);return node;},"_KML":function(layer){var node=this.createElementNSPlus("Layer");this.writeNode("ows:Title",layer.name,node);this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.KML,version:layer.protocol.format.version,url:layer.protocol.url},node);return node;}},"gml":OpenLayers.Util.applyDefaults({"boundedBy":function(bounds){var node=this.createElementNSPlus("gml:boundedBy");this.writeNode("gml:Box",bounds,node);return node;}},OpenLayers.Format.GML.v2.prototype.writers.gml),"ows":OpenLayers.Format.OWSCommon.v1_0_0.prototype.writers.ows,"sld":OpenLayers.Format.SLD.v1_0_0.prototype.writers.sld,"feature":OpenLayers.Format.GML.v2.prototype.writers.feature},CLASS_NAME:"OpenLayers.Format.OWSContext.v0_3_1"});  
 
## HowTo: Build & deploy "Shrunk" Single File Library version of OpenLayers ##  
 
* Build:  
 
cd build  
./build.py  
cd ..  
 
* Upload the result to the server: e.g.  
 
scp build/OpenLayers.js openlayers@openlayers.org:openlayers.org/htdocs/code/  
 
 
 
#!/usr/bin/env python  
 
import sys  
sys.path.append("../tools")  
import mergejs  
 
def build():  
have_compressor = None  
try:  
import jsmin  
have_compressor = "jsmin"  
except ImportError:  
try:  
import minimize  
have_compressor = "minimize"  
except Exception, E:  
print E  
pass  
 
sourceDirectory = "../lib"  
configFilename = "full.cfg"  
outputFilename = "OpenLayers.js"  
 
if len(sys.argv) > 1:  
configFilename = sys.argv[1]  
extension = configFilename[-4:]  
 
if extension != ".cfg":  
configFilename = sys.argv[1] + ".cfg"  
 
if len(sys.argv) > 2:  
outputFilename = sys.argv[2]  
 
print "Merging libraries."  
merged = mergejs.run(sourceDirectory, None, configFilename)  
if have_compressor == "jsmin":  
print "Compressing using jsmin."  
minimized = jsmin.jsmin(merged)  
elif have_compressor == "minimize":  
print "Compressing using minimize."  
minimized = minimize.minimize(merged)  
else: # fallback  
print "Not compressing."  
minimized = merged  
print "Adding license file."  
minimized = file("license.txt").read() + minimized  
 
print "Writing to %s." % outputFilename  
file(outputFilename, "w").write(minimized)  
 
print "Done."  
 
if __name__ == '__main__':  
build()  
#!/usr/bin/env python  
 
import sys  
sys.path.append("../tools")  
 
import jsmin, mergejs  
 
sourceDirectory = "../lib"  
configFilename = "full.cfg"  
outputFilename = "OpenLayers.js"  
 
if len(sys.argv) > 1:  
configFilename = sys.argv[1] + ".cfg"  
if len(sys.argv) > 2:  
outputFilename = sys.argv[2]  
 
print "Merging libraries."  
merged = mergejs.run(sourceDirectory, None, configFilename)  
print "Adding license file."  
merged = file("license.txt").read() + merged  
 
print "Writing to %s." % outputFilename  
file(outputFilename, "w").write(merged)  
 
print "Done."  
 
# This is the full build with all files: this includes the vector-related files  
# like Renderers and Formats.  
 
[first]  
OpenLayers/SingleFile.js  
OpenLayers.js  
OpenLayers/BaseTypes.js  
OpenLayers/BaseTypes/Class.js  
OpenLayers/Util.js  
Rico/Corner.js  
 
[last]  
 
[include]  
 
[exclude]  
Firebug/firebug.js  
Firebug/firebugx.js  
OpenLayers/Lang/ca.js  
OpenLayers/Lang/cs-CZ.js  
OpenLayers/Lang/da-DK.js  
OpenLayers/Lang/de.js  
OpenLayers/Lang/en-CA.js  
OpenLayers/Lang/es.js  
OpenLayers/Lang/fr.js  
OpenLayers/Lang/it.js  
OpenLayers/Lang/nb.js  
OpenLayers/Lang/nl.js  
OpenLayers/Lang/pt-BR.js  
OpenLayers/Lang/sv-SE.js  
OpenLayers/Lang/zh-TW.js  
OpenLayers/Lang/zh-CN.js  
 
# This file includes the OpenLayers code to create a build for everything that  
# does not require vector support. build.py uses this profile if no other one  
# is specified.  
 
[first]  
OpenLayers/SingleFile.js  
OpenLayers.js  
OpenLayers/BaseTypes.js  
OpenLayers/BaseTypes/Class.js  
OpenLayers/Util.js  
Rico/Corner.js  
 
[last]  
 
[include]  
 
[exclude]  
Firebug/firebug.js  
Firebug/firebugx.js  
OpenLayers/Format/GeoRSS.js  
OpenLayers/Format/GML.js  
OpenLayers/Format/WKT.js  
OpenLayers/Format/KML.js  
OpenLayers/Format/WFS.js  
OpenLayers/Format.js  
OpenLayers/Handler/Path.js  
OpenLayers/Handler/Point.js  
OpenLayers/Handler/Polygon.js  
OpenLayers/Handler/Select.js  
OpenLayers/Geometry/Collection.js  
OpenLayers/Geometry/Curve.js  
OpenLayers/Geometry/LinearRing.js  
OpenLayers/Geometry/LineString.js  
OpenLayers/Geometry/MultiLineString.js  
OpenLayers/Geometry/MultiPoint.js  
OpenLayers/Geometry/MultiPolygon.js  
OpenLayers/Geometry/Point.js  
OpenLayers/Geometry/Polygon.js  
OpenLayers/Geometry/Rectangle.js  
OpenLayers/Geometry/Surface.js  
OpenLayers/Geometry.js  
OpenLayers/Layer/GML.js  
OpenLayers/Layer/Vector.js  
OpenLayers/Control/DrawFeature.js  
OpenLayers/Control/EditingToolbar.js  
OpenLayers/Control/SelectFeature.js  
OpenLayers/Feature/Vector.js  
OpenLayers/Renderer  
OpenLayers/Renderer/Elements.js  
OpenLayers/Renderer/SVG.js  
OpenLayers/Renderer/VML.js  
OpenLayers/Renderer.js  
OpenLayers/Lang/ca.js  
OpenLayers/Lang/cs-CZ.js  
OpenLayers/Lang/da-DK.js  
OpenLayers/Lang/de.js  
OpenLayers/Lang/en-CA.js  
OpenLayers/Lang/es.js  
OpenLayers/Lang/fr.js  
OpenLayers/Lang/it.js  
OpenLayers/Lang/nb.js  
OpenLayers/Lang/nl.js  
OpenLayers/Lang/pt-BR.js  
OpenLayers/Lang/sv-SE.js  
OpenLayers/Lang/zh-TW.js  
OpenLayers/Lang/zh-CN.js  
 
 
 
/*  
 
OpenLayers.js -- OpenLayers Map Viewer Library  
 
Copyright 2005-2010 OpenLayers Contributors, released under the Clear BSD  
license. Please see http://svn.openlayers.org/trunk/openlayers/license.txt  
for the full text of the license.  
 
Includes compressed code under the following licenses:  
 
(For uncompressed versions of the code used please see the  
OpenLayers SVN repository: <http://openlayers.org/>)  
 
*/  
 
/* Contains portions of Prototype.js:  
*  
* Prototype JavaScript framework, version 1.4.0  
* (c) 2005 Sam Stephenson <sam@conio.net>  
*  
* Prototype is freely distributable under the terms of an MIT-style license.  
* For details, see the Prototype web site: http://prototype.conio.net/  
*  
*--------------------------------------------------------------------------*/  
 
/**  
*  
* Contains portions of Rico <http://openrico.org/>  
*  
* Copyright 2005 Sabre Airline Solutions  
*  
* Licensed under the Apache License, Version 2.0 (the "License"); you  
* may not use this file except in compliance with the License. You  
* may obtain a copy of the License at  
*  
* http://www.apache.org/licenses/LICENSE-2.0  
*  
* Unless required by applicable law or agreed to in writing, software  
* distributed under the License is distributed on an "AS IS" BASIS,  
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or  
* implied. See the License for the specific language governing  
* permissions and limitations under the License.  
*  
**/  
 
/**  
* Contains XMLHttpRequest.js <http://code.google.com/p/xmlhttprequest/>  
* Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com)  
*  
* Licensed under the Apache License, Version 2.0 (the "License");  
* you may not use this file except in compliance with the License.  
* You may obtain a copy of the License at  
* http://www.apache.org/licenses/LICENSE-2.0  
*/  
 
/**  
* Contains portions of Gears <http://code.google.com/apis/gears/>  
*  
* Copyright 2007, Google Inc.  
*  
* Redistribution and use in source and binary forms, with or without  
* modification, are permitted provided that the following conditions are met:  
*  
* 1. Redistributions of source code must retain the above copyright notice,  
* this list of conditions and the following disclaimer.  
* 2. Redistributions in binary form must reproduce the above copyright notice,  
* this list of conditions and the following disclaimer in the documentation  
* and/or other materials provided with the distribution.  
* 3. Neither the name of Google Inc. nor the names of its contributors may be  
* used to endorse or promote products derived from this software without  
* specific prior written permission.  
*  
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED  
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF  
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO  
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;  
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,  
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR  
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF  
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
*  
* Sets up google.gears.*, which is *the only* supported way to access Gears.  
*  
* Circumvent this file at your own risk!  
*  
* In the future, Gears may automatically define google.gears.* without this  
* file. Gears may use these objects to transparently fix bugs and compatibility  
* issues. Applications that use the code below will continue to work seamlessly  
* when that happens.  
*/  
 
# This file includes a small subset of OpenLayers code, designed to be  
# integrated into another application. It includes only the Layer types  
# neccesary to create tiled or untiled WMS, and does not include any Controls.  
# This is the result of what was at the time called "Webmap.js" at the FOSS4G  
# Web Mapping BOF.  
 
[first]  
OpenLayers/SingleFile.js  
OpenLayers.js  
OpenLayers/BaseTypes.js  
OpenLayers/BaseTypes/Class.js  
OpenLayers/Util.js  
 
[last]  
 
[include]  
OpenLayers/Map.js  
OpenLayers/Layer/WMS.js  
 
[exclude]  
 
 
 
 Binary files a/labs/openlayers/img/blank.gif and /dev/null differ
 Binary files a/labs/openlayers/img/cloud-popup-relative.png and /dev/null differ
 Binary files a/labs/openlayers/img/drag-rectangle-off.png and /dev/null differ
 Binary files a/labs/openlayers/img/drag-rectangle-on.png and /dev/null differ
 Binary files a/labs/openlayers/img/east-mini.png and /dev/null differ
 Binary files a/labs/openlayers/img/layer-switcher-maximize.png and /dev/null differ
 Binary files a/labs/openlayers/img/layer-switcher-minimize.png and /dev/null differ
 Binary files a/labs/openlayers/img/marker-blue.png and /dev/null differ
 Binary files a/labs/openlayers/img/marker-gold.png and /dev/null differ
 Binary files a/labs/openlayers/img/marker-green.png and /dev/null differ
 Binary files a/labs/openlayers/img/marker.png and /dev/null differ
 Binary files a/labs/openlayers/img/measuring-stick-off.png and /dev/null differ
 Binary files a/labs/openlayers/img/measuring-stick-on.png and /dev/null differ
 Binary files a/labs/openlayers/img/north-mini.png and /dev/null differ
 Binary files a/labs/openlayers/img/panning-hand-off.png and /dev/null differ
 Binary files a/labs/openlayers/img/panning-hand-on.png and /dev/null differ
 Binary files a/labs/openlayers/img/slider.png and /dev/null differ
 Binary files a/labs/openlayers/img/south-mini.png and /dev/null differ
 Binary files a/labs/openlayers/img/west-mini.png and /dev/null differ
 Binary files a/labs/openlayers/img/zoom-minus-mini.png and /dev/null differ
 Binary files a/labs/openlayers/img/zoom-plus-mini.png and /dev/null differ
 Binary files a/labs/openlayers/img/zoom-world-mini.png and /dev/null differ
 Binary files a/labs/openlayers/img/zoombar.png and /dev/null differ
 Binary files a/labs/openlayers/lib/Firebug/errorIcon.png and /dev/null differ
 
html, body {  
margin: 0;  
background: #FFFFFF;  
font-family: Lucida Grande, Tahoma, sans-serif;  
font-size: 11px;  
overflow: hidden;  
}  
 
a {  
text-decoration: none;  
}  
 
a:hover {  
text-decoration: underline;  
}  
 
.toolbar {  
height: 14px;  
border-top: 1px solid ThreeDHighlight;  
border-bottom: 1px solid ThreeDShadow;  
padding: 2px 6px;  
background: ThreeDFace;  
}  
 
.toolbarRight {  
position: absolute;  
top: 4px;  
right: 6px;  
}  
 
#log {  
overflow: auto;  
position: absolute;  
left: 0;  
width: 100%;  
}  
 
#commandLine {  
position: absolute;  
bottom: 0;  
left: 0;  
width: 100%;  
height: 18px;  
border: none;  
border-top: 1px solid ThreeDShadow;  
}  
 
/************************************************************************************************/  
 
.logRow {  
position: relative;  
border-bottom: 1px solid #D7D7D7;  
padding: 2px 4px 1px 6px;  
background-color: #FFFFFF;  
}  
 
.logRow-command {  
font-family: Monaco, monospace;  
color: blue;  
}  
 
.objectBox-null {  
padding: 0 2px;  
border: 1px solid #666666;  
background-color: #888888;  
color: #FFFFFF;  
}  
 
.objectBox-string {  
font-family: Monaco, monospace;  
color: red;  
white-space: pre;  
}  
 
.objectBox-number {  
color: #000088;  
}  
 
.objectBox-function {  
font-family: Monaco, monospace;  
color: DarkGreen;  
}  
 
.objectBox-object {  
color: DarkGreen;  
font-weight: bold;  
}  
 
/************************************************************************************************/  
 
.logRow-info,  
.logRow-error,  
.logRow-warning {  
background: #FFFFFF no-repeat 2px 2px;  
padding-left: 20px;  
padding-bottom: 3px;  
}  
 
.logRow-info {  
background-image: url(infoIcon.png);  
}  
 
.logRow-warning {  
background-color: cyan;  
background-image: url(warningIcon.png);  
}  
 
.logRow-error {  
background-color: LightYellow;  
background-image: url(errorIcon.png);  
}  
 
.errorMessage {  
vertical-align: top;  
color: #FF0000;  
}  
 
.objectBox-sourceLink {  
position: absolute;  
right: 4px;  
top: 2px;  
padding-left: 8px;  
font-family: Lucida Grande, sans-serif;  
font-weight: bold;  
color: #0000FF;  
}  
 
/************************************************************************************************/  
 
.logRow-group {  
background: #EEEEEE;  
border-bottom: none;  
}  
 
.logGroup {  
background: #EEEEEE;  
}  
 
.logGroupBox {  
margin-left: 24px;  
border-top: 1px solid #D7D7D7;  
border-left: 1px solid #D7D7D7;  
}  
 
/************************************************************************************************/  
 
.selectorTag,  
.selectorId,  
.selectorClass {  
font-family: Monaco, monospace;  
font-weight: normal;  
}  
 
.selectorTag {  
color: #0000FF;  
}  
 
.selectorId {  
color: DarkBlue;  
}  
 
.selectorClass {  
color: red;  
}  
 
/************************************************************************************************/  
 
.objectBox-element {  
font-family: Monaco, monospace;  
color: #000088;  
}  
 
.nodeChildren {  
margin-left: 16px;  
}  
 
.nodeTag {  
color: blue;  
}  
 
.nodeValue {  
color: #FF0000;  
font-weight: normal;  
}  
 
.nodeText,  
.nodeComment {  
margin: 0 2px;  
vertical-align: top;  
}  
 
.nodeText {  
color: #333333;  
}  
 
.nodeComment {  
color: DarkGreen;  
}  
 
/************************************************************************************************/  
 
.propertyNameCell {  
vertical-align: top;  
}  
 
.propertyName {  
font-weight: bold;  
}  
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
 
<html xmlns="http://www.w3.org/1999/xhtml">  
 
<head>  
<title>Firebug</title>  
<link rel="stylesheet" type="text/css" href="firebug.css">  
</head>  
 
<body>  
<div id="toolbar" class="toolbar">  
<a href="#" onclick="parent.console.clear()">Clear</a>  
<span class="toolbarRight">  
<a href="#" onclick="parent.console.close()">Close</a>  
</span>  
</div>  
<div id="log"></div>  
<input type="text" id="commandLine">  
 
<script>parent.onFirebugReady(document);</script>  
</body>  
</html>  
 
 
if (!window.console || !console.firebug) { (function()  
{  
window.console =  
{  
log: function()  
{  
logFormatted(arguments, "");  
},  
 
debug: function()  
{  
logFormatted(arguments, "debug");  
},  
 
info: function()  
{  
logFormatted(arguments, "info");  
},  
 
warn: function()  
{  
logFormatted(arguments, "warning");  
},  
 
error: function()  
{  
logFormatted(arguments, "error");  
},  
 
assert: function(truth, message)  
{  
if (!truth)  
{  
var args = [];  
for (var i = 1; i < arguments.length; ++i)  
args.push(arguments[i]);  
 
logFormatted(args.length ? args : ["Assertion Failure"], "error");  
throw message ? message : "Assertion Failure";  
}  
},  
 
dir: function(object)  
{  
var html = [];  
 
var pairs = [];  
for (var name in object)  
{  
try  
{  
pairs.push([name, object[name]]);  
}  
catch (exc)  
{  
}  
}  
 
pairs.sort(function(a, b) { return a[0] < b[0] ? -1 : 1; });  
 
html.push('<table>');  
for (var i = 0; i < pairs.length; ++i)  
{  
var name = pairs[i][0], value = pairs[i][1];  
 
html.push('<tr>',  
'<td class="propertyNameCell"><span class="propertyName">',  
escapeHTML(name), '</span></td>', '<td><span class="propertyValue">');  
appendObject(value, html);  
html.push('</span></td></tr>');  
}  
html.push('</table>');  
 
logRow(html, "dir");  
},  
 
dirxml: function(node)  
{  
var html = [];  
 
appendNode(node, html);  
logRow(html, "dirxml");  
},  
 
group: function()  
{  
logRow(arguments, "group", pushGroup);  
},  
 
groupEnd: function()  
{  
logRow(arguments, "", popGroup);  
},  
 
time: function(name)  
{  
timeMap[name] = (new Date()).getTime();  
},  
 
timeEnd: function(name)  
{  
if (name in timeMap)  
{  
var delta = (new Date()).getTime() - timeMap[name];  
logFormatted([name+ ":", delta+"ms"]);  
delete timeMap[name];  
}  
},  
 
count: function()  
{  
this.warn(["count() not supported."]);  
},  
 
trace: function()  
{  
this.warn(["trace() not supported."]);  
},  
 
profile: function()  
{  
this.warn(["profile() not supported."]);  
},  
 
profileEnd: function()  
{  
},  
 
clear: function()  
{  
consoleBody.innerHTML = "";  
},  
 
open: function()  
{  
toggleConsole(true);  
},  
 
close: function()  
{  
if (frameVisible)  
toggleConsole();  
}  
};  
 
// ********************************************************************************************  
 
var consoleFrame = null;  
var consoleBody = null;  
var commandLine = null;  
 
var frameVisible = false;  
var messageQueue = [];  
var groupStack = [];  
var timeMap = {};  
 
var clPrefix = ">>> ";  
 
var isFirefox = navigator.userAgent.indexOf("Firefox") != -1;  
var isIE = navigator.userAgent.indexOf("MSIE") != -1;  
var isOpera = navigator.userAgent.indexOf("Opera") != -1;  
var isSafari = navigator.userAgent.indexOf("AppleWebKit") != -1;  
 
// ********************************************************************************************  
 
function toggleConsole(forceOpen)  
{  
frameVisible = forceOpen || !frameVisible;  
if (consoleFrame)  
consoleFrame.style.visibility = frameVisible ? "visible" : "hidden";  
else  
waitForBody();  
}  
 
function focusCommandLine()  
{  
toggleConsole(true);  
if (commandLine)  
commandLine.focus();  
}  
 
function waitForBody()  
{  
if (document.body)  
createFrame();  
else  
setTimeout(waitForBody, 200);  
}  
 
function createFrame()  
{  
if (consoleFrame)  
return;  
 
window.onFirebugReady = function(doc)  
{  
window.onFirebugReady = null;  
 
var toolbar = doc.getElementById("toolbar");  
toolbar.onmousedown = onSplitterMouseDown;  
 
commandLine = doc.getElementById("commandLine");  
addEvent(commandLine, "keydown", onCommandLineKeyDown);  
 
addEvent(doc, isIE || isSafari ? "keydown" : "keypress", onKeyDown);  
 
consoleBody = doc.getElementById("log");  
layout();  
flush();  
}  
 
var baseURL = getFirebugURL();  
 
consoleFrame = document.createElement("iframe");  
consoleFrame.setAttribute("src", baseURL+"/firebug.html");  
consoleFrame.setAttribute("frameBorder", "0");  
consoleFrame.style.visibility = (frameVisible ? "visible" : "hidden");  
consoleFrame.style.zIndex = "2147483583";  
consoleFrame.style.position = document.all ? "absolute" : "fixed";  
consoleFrame.style.width = "100%";  
consoleFrame.style.left = "0";  
consoleFrame.style.bottom = "0";  
consoleFrame.style.height = "200px";  
document.body.appendChild(consoleFrame);  
}  
 
function getFirebugURL()  
{  
var scripts = document.getElementsByTagName("script");  
for (var i = 0; i < scripts.length; ++i)  
{  
if (scripts[i].src.indexOf("firebug.js") != -1)  
{  
var lastSlash = scripts[i].src.lastIndexOf("/");  
return scripts[i].src.substr(0, lastSlash);  
}  
}  
}  
 
function evalCommandLine()  
{  
var text = commandLine.value;  
commandLine.value = "";  
 
logRow([clPrefix, text], "command");  
 
var value;  
try  
{  
value = eval(text);  
}  
catch (exc)  
{  
}  
 
console.log(value);  
}  
 
function layout()  
{  
var toolbar = consoleBody.ownerDocument.getElementById("toolbar");  
var height = consoleFrame.offsetHeight - (toolbar.offsetHeight + commandLine.offsetHeight);  
height = Math.max(height, 0);  
consoleBody.style.top = toolbar.offsetHeight + "px";  
consoleBody.style.height = height + "px";  
 
commandLine.style.top = (consoleFrame.offsetHeight - commandLine.offsetHeight) + "px";  
}  
 
function logRow(message, className, handler)  
{  
if (consoleBody)  
writeMessage(message, className, handler);  
else  
{  
messageQueue.push([message, className, handler]);  
waitForBody();  
}  
}  
 
function flush()  
{  
var queue = messageQueue;  
messageQueue = [];  
 
for (var i = 0; i < queue.length; ++i)  
writeMessage(queue[i][0], queue[i][1], queue[i][2]);  
}  
 
function writeMessage(message, className, handler)  
{  
var isScrolledToBottom =  
consoleBody.scrollTop + consoleBody.offsetHeight >= consoleBody.scrollHeight;  
 
if (!handler)  
handler = writeRow;  
 
handler(message, className);  
 
if (isScrolledToBottom)  
consoleBody.scrollTop = consoleBody.scrollHeight - consoleBody.offsetHeight;  
}  
 
function appendRow(row)  
{  
var container = groupStack.length ? groupStack[groupStack.length-1] : consoleBody;  
container.appendChild(row);  
}  
 
function writeRow(message, className)  
{  
var row = consoleBody.ownerDocument.createElement("div");  
row.className = "logRow" + (className ? " logRow-"+className : "");  
row.innerHTML = message.join("");  
appendRow(row);  
}  
 
function pushGroup(message, className)  
{  
logFormatted(message, className);  
 
var groupRow = consoleBody.ownerDocument.createElement("div");  
groupRow.className = "logGroup";  
var groupRowBox = consoleBody.ownerDocument.createElement("div");  
groupRowBox.className = "logGroupBox";  
groupRow.appendChild(groupRowBox);  
appendRow(groupRowBox);  
groupStack.push(groupRowBox);  
}  
 
function popGroup()  
{  
groupStack.pop();  
}  
 
// ********************************************************************************************  
 
function logFormatted(objects, className)  
{  
var html = [];  
 
var format = objects[0];  
var objIndex = 0;  
 
if (typeof(format) != "string")  
{  
format = "";  
objIndex = -1;  
}  
 
var parts = parseFormat(format);  
for (var i = 0; i < parts.length; ++i)  
{  
var part = parts[i];  
if (part && typeof(part) == "object")  
{  
var object = objects[++objIndex];  
part.appender(object, html);  
}  
else  
appendText(part, html);  
}  
 
for (var i = objIndex+1; i < objects.length; ++i)  
{  
appendText(" ", html);  
 
var object = objects[i];  
if (typeof(object) == "string")  
appendText(object, html);  
else  
appendObject(object, html);  
}  
 
logRow(html, className);  
}  
 
function parseFormat(format)  
{  
var parts = [];  
 
var reg = /((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/;  
var appenderMap = {s: appendText, d: appendInteger, i: appendInteger, f: appendFloat};  
 
for (var m = reg.exec(format); m; m = reg.exec(format))  
{  
var type = m[8] ? m[8] : m[5];  
var appender = type in appenderMap ? appenderMap[type] : appendObject;  
var precision = m[3] ? parseInt(m[3]) : (m[4] == "." ? -1 : 0);  
 
parts.push(format.substr(0, m[0][0] == "%" ? m.index : m.index+1));  
parts.push({appender: appender, precision: precision});  
 
format = format.substr(m.index+m[0].length);  
}  
 
parts.push(format);  
 
return parts;  
}  
 
function escapeHTML(value)  
{  
function replaceChars(ch)  
{  
switch (ch)  
{  
case "<":  
return "&lt;";  
case ">":  
return "&gt;";  
case "&":  
return "&amp;";  
case "'":  
return "&#39;";  
case '"':  
return "&quot;";  
}  
return "?";  
};  
return String(value).replace(/[<>&"']/g, replaceChars);  
}  
 
function objectToString(object)  
{  
try  
{  
return object+"";  
}  
catch (exc)  
{  
return null;  
}  
}  
 
// ********************************************************************************************  
 
function appendText(object, html)  
{  
html.push(escapeHTML(objectToString(object)));  
}  
 
function appendNull(object, html)  
{  
html.push('<span class="objectBox-null">', escapeHTML(objectToString(object)), '</span>');  
}  
 
function appendString(object, html)  
{  
html.push('<span class="objectBox-string">&quot;', escapeHTML(objectToString(object)),  
'&quot;</span>');  
}  
 
function appendInteger(object, html)  
{  
html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>');  
}  
 
function appendFloat(object, html)  
{  
html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>');  
}  
 
function appendFunction(object, html)  
{  
var reName = /function ?(.*?)\(/;  
var m = reName.exec(objectToString(object));  
var name = m ? m[1] : "function";  
html.push('<span class="objectBox-function">', escapeHTML(name), '()</span>');  
}  
 
function appendObject(object, html)  
{  
try  
{  
if (object == undefined)  
appendNull("undefined", html);  
else if (object == null)  
appendNull("null", html);  
else if (typeof object == "string")  
appendString(object, html);  
else if (typeof object == "number")  
appendInteger(object, html);  
else if (typeof object == "function")  
appendFunction(object, html);  
else if (object.nodeType == 1)  
appendSelector(object, html);  
else if (typeof object == "object")  
appendObjectFormatted(object, html);  
else  
appendText(object, html);  
}  
catch (exc)  
{  
}  
}  
 
function appendObjectFormatted(object, html)  
{  
var text = objectToString(object);  
var reObject = /\[object (.*?)\]/;  
 
var m = reObject.exec(text);  
html.push('<span class="objectBox-object">', m ? m[1] : text, '</span>')  
}  
 
function appendSelector(object, html)  
{  
html.push('<span class="objectBox-selector">');  
 
html.push('<span class="selectorTag">', escapeHTML(object.nodeName.toLowerCase()), '</span>');  
if (object.id)  
html.push('<span class="selectorId">#', escapeHTML(object.id), '</span>');  
if (object.className)  
html.push('<span class="selectorClass">.', escapeHTML(object.className), '</span>');  
 
html.push('</span>');  
}  
 
function appendNode(node, html)  
{  
if (node.nodeType == 1)  
{  
html.push(  
'<div class="objectBox-element">',  
'&lt;<span class="nodeTag">', node.nodeName.toLowerCase(), '</span>');  
 
for (var i = 0; i < node.attributes.length; ++i)  
{  
var attr = node.attributes[i];  
if (!attr.specified)  
continue;  
 
html.push('&nbsp;<span class="nodeName">', attr.nodeName.toLowerCase(),  
'</span>=&quot;<span class="nodeValue">', escapeHTML(attr.nodeValue),  
'</span>&quot;')  
}  
 
if (node.firstChild)  
{  
html.push('&gt;</div><div class="nodeChildren">');  
 
for (var child = node.firstChild; child; child = child.nextSibling)  
appendNode(child, html);  
 
html.push('</div><div class="objectBox-element">&lt;/<span class="nodeTag">',  
node.nodeName.toLowerCase(), '&gt;</span></div>');  
}  
else  
html.push('/&gt;</div>');  
}  
else if (node.nodeType == 3)  
{  
html.push('<div class="nodeText">', escapeHTML(node.nodeValue),  
'</div>');  
}  
}  
 
// ********************************************************************************************  
 
function addEvent(object, name, handler)  
{  
if (document.all)  
object.attachEvent("on"+name, handler);  
else  
object.addEventListener(name, handler, false);  
}  
 
function removeEvent(object, name, handler)  
{  
if (document.all)  
object.detachEvent("on"+name, handler);  
else  
object.removeEventListener(name, handler, false);  
}  
 
function cancelEvent(event)  
{  
if (document.all)  
event.cancelBubble = true;  
else  
event.stopPropagation();  
}  
 
function onError(msg, href, lineNo)  
{  
var html = [];  
 
var lastSlash = href.lastIndexOf("/");  
var fileName = lastSlash == -1 ? href : href.substr(lastSlash+1);  
 
html.push(  
'<span class="errorMessage">', msg, '</span>',  
'<div class="objectBox-sourceLink">', fileName, ' (line ', lineNo, ')</div>'  
);  
 
logRow(html, "error");  
};  
 
function onKeyDown(event)  
{  
if (event.keyCode == 123)  
toggleConsole();  
else if ((event.keyCode == 108 || event.keyCode == 76) && event.shiftKey  
&& (event.metaKey || event.ctrlKey))  
focusCommandLine();  
else  
return;  
 
cancelEvent(event);  
}  
 
function onSplitterMouseDown(event)  
{  
if (isSafari || isOpera)  
return;  
 
addEvent(document, "mousemove", onSplitterMouseMove);  
addEvent(document, "mouseup", onSplitterMouseUp);  
 
for (var i = 0; i < frames.length; ++i)  
{  
addEvent(frames[i].document, "mousemove", onSplitterMouseMove);  
addEvent(frames[i].document, "mouseup", onSplitterMouseUp);  
}  
}  
 
function onSplitterMouseMove(event)  
{  
var win = document.all  
? event.srcElement.ownerDocument.parentWindow  
: event.target.ownerDocument.defaultView;  
 
var clientY = event.clientY;  
if (win != win.parent)  
clientY += win.frameElement ? win.frameElement.offsetTop : 0;  
 
var height = consoleFrame.offsetTop + consoleFrame.clientHeight;  
var toolbar = consoleBody.ownerDocument.getElementById("toolbar");  
var y = Math.max(height - clientY,  
toolbar.offsetHeight + commandLine.offsetHeight);  
 
consoleFrame.style.height = y + "px";  
layout();  
}  
 
function onSplitterMouseUp(event)  
{  
removeEvent(document, "mousemove", onSplitterMouseMove);  
removeEvent(document, "mouseup", onSplitterMouseUp);  
 
for (var i = 0; i < frames.length; ++i)  
{  
removeEvent(frames[i].document, "mousemove", onSplitterMouseMove);  
removeEvent(frames[i].document, "mouseup", onSplitterMouseUp);  
}  
}  
 
function onCommandLineKeyDown(event)  
{  
if (event.keyCode == 13)  
evalCommandLine();  
else if (event.keyCode == 27)  
commandLine.value = "";  
}  
 
window.onerror = onError;  
addEvent(document, isIE || isSafari ? "keydown" : "keypress", onKeyDown);  
 
if (document.documentElement.getAttribute("debug") == "true")  
toggleConsole(true);  
})();  
}  
 
 
if (!window.console || !console.firebug) {  
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",  
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];  
 
window.console = {};  
for (var i = 0; i < names.length; ++i)  
window.console[names[i]] = function() {}  
}  
 
 Binary files a/labs/openlayers/lib/Firebug/infoIcon.png and /dev/null differ
Software License Agreement (BSD License)  
 
Copyright (c) 2007, Parakey Inc.  
All rights reserved.  
 
Redistribution and use of this software in source and binary forms, with or without modification,  
are permitted provided that the following conditions are met:  
 
* Redistributions of source code must retain the above  
copyright notice, this list of conditions and the  
following disclaimer.  
 
* Redistributions in binary form must reproduce the above  
copyright notice, this list of conditions and the  
following disclaimer in the documentation and/or other  
materials provided with the distribution.  
 
* Neither the name of Parakey Inc. nor the names of its  
contributors may be used to endorse or promote products  
derived from this software without specific prior  
written permission of Parakey Inc.  
 
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR  
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND  
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR  
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL  
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,  
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER  
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
 
This directory contains the source for Firebug Lite  
(http://www.getfirebug.com/lite.html). This code is distributed with a  
BSD License, Copyright (c) 2007, Parakey Inc. See the included license.txt  
for the full text of the license.  
 
This is a patched version of the trunk from  
http://fbug.googlecode.com/svn/trunk.  
 
Revision 36 was patched to resolve the issue described here  
http://code.google.com/p/fbug/issues/detail?id=85  
 
When this issue is resolved, Firebug Lite can be used directly - no further  
modifications are needed for OpenLayers.  
 Binary files a/labs/openlayers/lib/Firebug/warningIcon.png and /dev/null differ
/*  
* Copyright 2007, Google Inc.  
*  
* Redistribution and use in source and binary forms, with or without  
* modification, are permitted provided that the following conditions are met:  
*  
* 1. Redistributions of source code must retain the above copyright notice,  
* this list of conditions and the following disclaimer.  
* 2. Redistributions in binary form must reproduce the above copyright notice,  
* this list of conditions and the following disclaimer in the documentation  
* and/or other materials provided with the distribution.  
* 3. Neither the name of Google Inc. nor the names of its contributors may be  
* used to endorse or promote products derived from this software without  
* specific prior written permission.  
*  
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED  
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF  
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO  
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;  
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,  
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR  
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF  
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
*  
* Sets up google.gears.*, which is *the only* supported way to access Gears.  
*  
* Circumvent this file at your own risk!  
*  
* In the future, Gears may automatically define google.gears.* without this  
* file. Gears may use these objects to transparently fix bugs and compatibility  
* issues. Applications that use the code below will continue to work seamlessly  
* when that happens.  
*/  
 
(function() {  
// We are already defined. Hooray!  
if (window.google && google.gears) {  
return;  
}  
 
var factory = null;  
 
// Firefox  
if (typeof GearsFactory != 'undefined') {  
factory = new GearsFactory();  
} else {  
// IE  
try {  
factory = new ActiveXObject('Gears.Factory');  
// privateSetGlobalObject is only required and supported on WinCE.  
if (factory.getBuildInfo().indexOf('ie_mobile') != -1) {  
factory.privateSetGlobalObject(this);  
}  
} catch (e) {  
// Safari  
if ((typeof navigator.mimeTypes != 'undefined')  
&& navigator.mimeTypes["application/x-googlegears"]) {  
factory = document.createElement("object");  
factory.style.display = "none";  
factory.width = 0;  
factory.height = 0;  
factory.type = "application/x-googlegears";  
document.documentElement.appendChild(factory);  
}  
}  
}  
 
// *Do not* define any objects if Gears is not installed. This mimics the  
// behavior of Gears defining the objects in the future.  
if (!factory) {  
return;  
}  
 
// Now set up the objects, being careful not to overwrite anything.  
//  
// Note: In Internet Explorer for Windows Mobile, you can't add properties to  
// the window object. However, global objects are automatically added as  
// properties of the window object in all browsers.  
if (!window.google) {  
google = {};  
}  
 
if (!google.gears) {  
google.gears = {factory: factory};  
}  
})();  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/*  
* @requires OpenLayers/BaseTypes.js  
* @requires OpenLayers/Lang/en.js  
* @requires OpenLayers/Console.js  
*/  
 
(function() {  
/**  
* Before creating the OpenLayers namespace, check to see if  
* OpenLayers.singleFile is true. This occurs if the  
* OpenLayers/SingleFile.js script is included before this one - as is the  
* case with single file builds.  
*/  
var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile);  
 
/**  
* Cache for the script location returned from  
* OpenLayers._getScriptLocation  
*/  
var scriptLocation;  
 
/**  
* Namespace: OpenLayers  
* The OpenLayers object provides a namespace for all things OpenLayers  
*/  
window.OpenLayers = {  
 
/**  
* Property: _scriptName  
* {String} Relative path of this script.  
*/  
_scriptName: (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js",  
 
/**  
* Function: _getScriptLocation  
* Return the path to this script.  
*  
* Returns:  
* {String} Path to this script  
*/  
_getScriptLocation: function () {  
if (scriptLocation != undefined) {  
return scriptLocation;  
}  
scriptLocation = "";  
var isOL = new RegExp("(^|(.*?\\/))(" + OpenLayers._scriptName + ")(\\?|$)");  
 
var scripts = document.getElementsByTagName('script');  
for (var i=0, len=scripts.length; i<len; i++) {  
var src = scripts[i].getAttribute('src');  
if (src) {  
var match = src.match(isOL);  
if(match) {  
scriptLocation = match[1];  
break;  
}  
}  
}  
return scriptLocation;  
}  
};  
/**  
* OpenLayers.singleFile is a flag indicating this file is being included  
* in a Single File Library build of the OpenLayers Library.  
*  
* When we are *not* part of a SFL build we dynamically include the  
* OpenLayers library code.  
*  
* When we *are* part of a SFL build we do not dynamically include the  
* OpenLayers library code as it will be appended at the end of this file.  
*/  
if(!singleFile) {  
var jsfiles = new Array(  
"OpenLayers/Util.js",  
"OpenLayers/BaseTypes.js",  
"OpenLayers/BaseTypes/Class.js",  
"OpenLayers/BaseTypes/Bounds.js",  
"OpenLayers/BaseTypes/Element.js",  
"OpenLayers/BaseTypes/LonLat.js",  
"OpenLayers/BaseTypes/Pixel.js",  
"OpenLayers/BaseTypes/Size.js",  
"OpenLayers/Console.js",  
"OpenLayers/Tween.js",  
"Rico/Corner.js",  
"Rico/Color.js",  
"OpenLayers/Ajax.js",  
"OpenLayers/Events.js",  
"OpenLayers/Request.js",  
"OpenLayers/Request/XMLHttpRequest.js",  
"OpenLayers/Projection.js",  
"OpenLayers/Map.js",  
"OpenLayers/Layer.js",  
"OpenLayers/Icon.js",  
"OpenLayers/Marker.js",  
"OpenLayers/Marker/Box.js",  
"OpenLayers/Popup.js",  
"OpenLayers/Tile.js",  
"OpenLayers/Tile/Image.js",  
"OpenLayers/Tile/Image/IFrame.js",  
"OpenLayers/Tile/WFS.js",  
"OpenLayers/Layer/Image.js",  
"OpenLayers/Layer/SphericalMercator.js",  
"OpenLayers/Layer/EventPane.js",  
"OpenLayers/Layer/FixedZoomLevels.js",  
"OpenLayers/Layer/Google.js",  
"OpenLayers/Layer/Google/v3.js",  
"OpenLayers/Layer/VirtualEarth.js",  
"OpenLayers/Layer/Yahoo.js",  
"OpenLayers/Layer/HTTPRequest.js",  
"OpenLayers/Layer/Grid.js",  
"OpenLayers/Layer/MapGuide.js",  
"OpenLayers/Layer/MapServer.js",  
"OpenLayers/Layer/MapServer/Untiled.js",  
"OpenLayers/Layer/KaMap.js",  
"OpenLayers/Layer/KaMapCache.js",  
"OpenLayers/Layer/MultiMap.js",  
"OpenLayers/Layer/Markers.js",  
"OpenLayers/Layer/Text.js",  
"OpenLayers/Layer/WorldWind.js",  
"OpenLayers/Layer/ArcGIS93Rest.js",  
"OpenLayers/Layer/WMS.js",  
"OpenLayers/Layer/WMS/Untiled.js",  
"OpenLayers/Layer/WMS/Post.js",  
"OpenLayers/Layer/WMTS.js",  
"OpenLayers/Layer/ArcIMS.js",  
"OpenLayers/Layer/GeoRSS.js",  
"OpenLayers/Layer/Boxes.js",  
"OpenLayers/Layer/XYZ.js",  
"OpenLayers/Layer/TMS.js",  
"OpenLayers/Layer/TileCache.js",  
"OpenLayers/Layer/Zoomify.js",  
"OpenLayers/Popup/Anchored.js",  
"OpenLayers/Popup/AnchoredBubble.js",  
"OpenLayers/Popup/Framed.js",  
"OpenLayers/Popup/FramedCloud.js",  
"OpenLayers/Feature.js",  
"OpenLayers/Feature/Vector.js",  
"OpenLayers/Feature/WFS.js",  
"OpenLayers/Handler.js",  
"OpenLayers/Handler/Click.js",  
"OpenLayers/Handler/Hover.js",  
"OpenLayers/Handler/Point.js",  
"OpenLayers/Handler/Path.js",  
"OpenLayers/Handler/Polygon.js",  
"OpenLayers/Handler/Feature.js",  
"OpenLayers/Handler/Drag.js",  
"OpenLayers/Handler/RegularPolygon.js",  
"OpenLayers/Handler/Box.js",  
"OpenLayers/Handler/MouseWheel.js",  
"OpenLayers/Handler/Keyboard.js",  
"OpenLayers/Control.js",  
"OpenLayers/Control/Attribution.js",  
"OpenLayers/Control/Button.js",  
"OpenLayers/Control/ZoomBox.js",  
"OpenLayers/Control/ZoomToMaxExtent.js",  
"OpenLayers/Control/DragPan.js",  
"OpenLayers/Control/Navigation.js",  
"OpenLayers/Control/MouseDefaults.js",  
"OpenLayers/Control/MousePosition.js",  
"OpenLayers/Control/OverviewMap.js",  
"OpenLayers/Control/KeyboardDefaults.js",  
"OpenLayers/Control/PanZoom.js",  
"OpenLayers/Control/PanZoomBar.js",  
"OpenLayers/Control/ArgParser.js",  
"OpenLayers/Control/Permalink.js",  
"OpenLayers/Control/Scale.js",  
"OpenLayers/Control/ScaleLine.js",  
"OpenLayers/Control/Snapping.js",  
"OpenLayers/Control/Split.js",  
"OpenLayers/Control/LayerSwitcher.js",  
"OpenLayers/Control/DrawFeature.js",  
"OpenLayers/Control/DragFeature.js",  
"OpenLayers/Control/ModifyFeature.js",  
"OpenLayers/Control/Panel.js",  
"OpenLayers/Control/SelectFeature.js",  
"OpenLayers/Control/NavigationHistory.js",  
"OpenLayers/Control/Measure.js",  
"OpenLayers/Control/WMSGetFeatureInfo.js",  
"OpenLayers/Control/WMTSGetFeatureInfo.js",  
"OpenLayers/Control/Graticule.js",  
"OpenLayers/Control/TransformFeature.js",  
"OpenLayers/Control/SLDSelect.js",  
"OpenLayers/Geometry.js",  
"OpenLayers/Geometry/Rectangle.js",  
"OpenLayers/Geometry/Collection.js",  
"OpenLayers/Geometry/Point.js",  
"OpenLayers/Geometry/MultiPoint.js",  
"OpenLayers/Geometry/Curve.js",  
"OpenLayers/Geometry/LineString.js",  
"OpenLayers/Geometry/LinearRing.js",  
"OpenLayers/Geometry/Polygon.js",  
"OpenLayers/Geometry/MultiLineString.js",  
"OpenLayers/Geometry/MultiPolygon.js",  
"OpenLayers/Geometry/Surface.js",  
"OpenLayers/Renderer.js",  
"OpenLayers/Renderer/Elements.js",  
"OpenLayers/Renderer/SVG.js",  
"OpenLayers/Renderer/Canvas.js",  
"OpenLayers/Renderer/VML.js",  
"OpenLayers/Layer/Vector.js",  
"OpenLayers/Layer/Vector/RootContainer.js",  
"OpenLayers/Strategy.js",  
"OpenLayers/Strategy/Filter.js",  
"OpenLayers/Strategy/Fixed.js",  
"OpenLayers/Strategy/Cluster.js",  
"OpenLayers/Strategy/Paging.js",  
"OpenLayers/Strategy/BBOX.js",  
"OpenLayers/Strategy/Save.js",  
"OpenLayers/Strategy/Refresh.js",  
"OpenLayers/Filter.js",  
"OpenLayers/Filter/FeatureId.js",  
"OpenLayers/Filter/Logical.js",  
"OpenLayers/Filter/Comparison.js",  
"OpenLayers/Filter/Spatial.js",  
"OpenLayers/Protocol.js",  
"OpenLayers/Protocol/HTTP.js",  
"OpenLayers/Protocol/SQL.js",  
"OpenLayers/Protocol/SQL/Gears.js",  
"OpenLayers/Protocol/WFS.js",  
"OpenLayers/Protocol/WFS/v1.js",  
"OpenLayers/Protocol/WFS/v1_0_0.js",  
"OpenLayers/Protocol/WFS/v1_1_0.js",  
"OpenLayers/Protocol/SOS.js",  
"OpenLayers/Protocol/SOS/v1_0_0.js",  
"OpenLayers/Layer/PointTrack.js",  
"OpenLayers/Layer/GML.js",  
"OpenLayers/Style.js",  
"OpenLayers/Style2.js",  
"OpenLayers/StyleMap.js",  
"OpenLayers/Rule.js",  
"OpenLayers/Format.js",  
"OpenLayers/Format/XML.js",  
"OpenLayers/Format/Context.js",  
"OpenLayers/Format/ArcXML.js",  
"OpenLayers/Format/ArcXML/Features.js",  
"OpenLayers/Format/GML.js",  
"OpenLayers/Format/GML/Base.js",  
"OpenLayers/Format/GML/v2.js",  
"OpenLayers/Format/GML/v3.js",  
"OpenLayers/Format/Atom.js",  
"OpenLayers/Format/KML.js",  
"OpenLayers/Format/GeoRSS.js",  
"OpenLayers/Format/WFS.js",  
"OpenLayers/Format/WFSCapabilities.js",  
"OpenLayers/Format/WFSCapabilities/v1.js",  
"OpenLayers/Format/WFSCapabilities/v1_0_0.js",  
"OpenLayers/Format/WFSCapabilities/v1_1_0.js",  
"OpenLayers/Format/WFSDescribeFeatureType.js",  
"OpenLayers/Format/WMSDescribeLayer.js",  
"OpenLayers/Format/WMSDescribeLayer/v1_1.js",  
"OpenLayers/Format/WKT.js",  
"OpenLayers/Format/OSM.js",  
"OpenLayers/Format/GPX.js",  
"OpenLayers/Format/Filter.js",  
"OpenLayers/Format/Filter/v1.js",  
"OpenLayers/Format/Filter/v1_0_0.js",  
"OpenLayers/Format/Filter/v1_1_0.js",  
"OpenLayers/Format/SLD.js",  
"OpenLayers/Format/SLD/v1.js",  
"OpenLayers/Format/SLD/v1_0_0.js",  
"OpenLayers/Format/OWSCommon/v1.js",  
"OpenLayers/Format/OWSCommon/v1_0_0.js",  
"OpenLayers/Format/OWSCommon/v1_1_0.js",  
"OpenLayers/Format/CSWGetDomain.js",  
"OpenLayers/Format/CSWGetDomain/v2_0_2.js",  
"OpenLayers/Format/CSWGetRecords.js",  
"OpenLayers/Format/CSWGetRecords/v2_0_2.js",  
"OpenLayers/Format/WFST.js",  
"OpenLayers/Format/WFST/v1.js",  
"OpenLayers/Format/WFST/v1_0_0.js",  
"OpenLayers/Format/WFST/v1_1_0.js",  
"OpenLayers/Format/Text.js",  
"OpenLayers/Format/JSON.js",  
"OpenLayers/Format/GeoJSON.js",  
"OpenLayers/Format/WMC.js",  
"OpenLayers/Format/WMC/v1.js",  
"OpenLayers/Format/WMC/v1_0_0.js",  
"OpenLayers/Format/WMC/v1_1_0.js",  
"OpenLayers/Format/WMSCapabilities.js",  
"OpenLayers/Format/WMSCapabilities/v1.js",  
"OpenLayers/Format/WMSCapabilities/v1_1.js",  
"OpenLayers/Format/WMSCapabilities/v1_1_0.js",  
"OpenLayers/Format/WMSCapabilities/v1_1_1.js",  
"OpenLayers/Format/WMSCapabilities/v1_3.js",  
"OpenLayers/Format/WMSCapabilities/v1_3_0.js",  
"OpenLayers/Format/WMSGetFeatureInfo.js",  
"OpenLayers/Format/SOSCapabilities.js",  
"OpenLayers/Format/SOSCapabilities/v1_0_0.js",  
"OpenLayers/Format/SOSGetObservation.js",  
"OpenLayers/Format/SOSGetFeatureOfInterest.js",  
"OpenLayers/Format/OWSContext.js",  
"OpenLayers/Format/OWSContext/v0_3_1.js",  
"OpenLayers/Format/WMTSCapabilities.js",  
"OpenLayers/Format/WMTSCapabilities/v1_0_0.js",  
"OpenLayers/Layer/WFS.js",  
"OpenLayers/Control/GetFeature.js",  
"OpenLayers/Control/MouseToolbar.js",  
"OpenLayers/Control/NavToolbar.js",  
"OpenLayers/Control/PanPanel.js",  
"OpenLayers/Control/Pan.js",  
"OpenLayers/Control/ZoomIn.js",  
"OpenLayers/Control/ZoomOut.js",  
"OpenLayers/Control/ZoomPanel.js",  
"OpenLayers/Control/EditingToolbar.js",  
"OpenLayers/Symbolizer.js",  
"OpenLayers/Symbolizer/Point.js",  
"OpenLayers/Symbolizer/Line.js",  
"OpenLayers/Symbolizer/Polygon.js",  
"OpenLayers/Symbolizer/Text.js",  
"OpenLayers/Symbolizer/Raster.js",  
"OpenLayers/Lang.js",  
"OpenLayers/Lang/en.js"  
); // etc.  
 
var agent = navigator.userAgent;  
var docWrite = (agent.match("MSIE") || agent.match("Safari"));  
if(docWrite) {  
var allScriptTags = new Array(jsfiles.length);  
}  
var host = OpenLayers._getScriptLocation() + "lib/";  
for (var i=0, len=jsfiles.length; i<len; i++) {  
if (docWrite) {  
allScriptTags[i] = "<script src='" + host + jsfiles[i] +  
"'></script>";  
} else {  
var s = document.createElement("script");  
s.src = host + jsfiles[i];  
var h = document.getElementsByTagName("head").length ?  
document.getElementsByTagName("head")[0] :  
document.body;  
h.appendChild(s);  
}  
}  
if (docWrite) {  
document.write(allScriptTags.join(""));  
}  
}  
})();  
 
/**  
* Constant: VERSION_NUMBER  
*/  
OpenLayers.VERSION_NUMBER="OpenLayers 2.10 -- $Revision: 10721 $";  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Request/XMLHttpRequest.js  
* @requires OpenLayers/Console.js  
*/  
 
OpenLayers.ProxyHost = "";  
//OpenLayers.ProxyHost = "examples/proxy.cgi?url=";  
 
/**  
* Ajax reader for OpenLayers  
*  
* @uri url to do remote XML http get  
* @param {String} 'get' format params (x=y&a=b...)  
* @who object to handle callbacks for this request  
* @complete the function to be called on success  
* @failure the function to be called on failure  
*  
* example usage from a caller:  
*  
* caps: function(request) {  
* -blah-  
* },  
*  
* OpenLayers.loadURL(url,params,this,caps);  
*  
* Notice the above example does not provide an error handler; a default empty  
* handler is provided which merely logs the error if a failure handler is not  
* supplied  
*  
*/  
 
 
/**  
* Function: OpenLayers.nullHandler  
* @param {} request  
*/  
OpenLayers.nullHandler = function(request) {  
OpenLayers.Console.userError(OpenLayers.i18n("unhandledRequest", {'statusText':request.statusText}));  
};  
 
/**  
* APIFunction: OpenLayers.loadURL  
* Background load a document. For more flexibility in using XMLHttpRequest,  
* see the <OpenLayers.Request> methods.  
*  
* Parameters:  
* uri - {String} URI of source doc  
* params - {String} or {Object} GET params. Either a string in the form  
* "?hello=world&foo=bar" (do not forget the leading question mark)  
* or an object in the form {'hello': 'world', 'foo': 'bar}  
* caller - {Object} object which gets callbacks  
* onComplete - {Function} Optional callback for success. The callback  
* will be called with this set to caller and will receive the request  
* object as an argument. Note that if you do not specify an onComplete  
* function, <OpenLayers.nullHandler> will be called (which pops up a  
* user friendly error message dialog).  
* onFailure - {Function} Optional callback for failure. In the event of  
* a failure, the callback will be called with this set to caller and will  
* receive the request object as an argument. Note that if you do not  
* specify an onComplete function, <OpenLayers.nullHandler> will be called  
* (which pops up a user friendly error message dialog).  
*  
* Returns:  
* {<OpenLayers.Request.XMLHttpRequest>} The request object. To abort loading,  
* call request.abort().  
*/  
OpenLayers.loadURL = function(uri, params, caller,  
onComplete, onFailure) {  
 
if(typeof params == 'string') {  
params = OpenLayers.Util.getParameters(params);  
}  
var success = (onComplete) ? onComplete : OpenLayers.nullHandler;  
var failure = (onFailure) ? onFailure : OpenLayers.nullHandler;  
 
return OpenLayers.Request.GET({  
url: uri, params: params,  
success: success, failure: failure, scope: caller  
});  
};  
 
/**  
* Function: OpenLayers.parseXMLString  
* Parse XML into a doc structure  
*  
* Parameters:  
* text - {String}  
*  
* Returns:  
* {?} Parsed AJAX Responsev  
*/  
OpenLayers.parseXMLString = function(text) {  
 
//MS sucks, if the server is bad it dies  
var index = text.indexOf('<');  
if (index > 0) {  
text = text.substring(index);  
}  
 
var ajaxResponse = OpenLayers.Util.Try(  
function() {  
var xmldom = new ActiveXObject('Microsoft.XMLDOM');  
xmldom.loadXML(text);  
return xmldom;  
},  
function() {  
return new DOMParser().parseFromString(text, 'text/xml');  
},  
function() {  
var req = new XMLHttpRequest();  
req.open("GET", "data:" + "text/xml" +  
";charset=utf-8," + encodeURIComponent(text), false);  
if (req.overrideMimeType) {  
req.overrideMimeType("text/xml");  
}  
req.send(null);  
return req.responseXML;  
}  
);  
 
return ajaxResponse;  
};  
 
 
/**  
* Namespace: OpenLayers.Ajax  
*/  
OpenLayers.Ajax = {  
 
/**  
* Method: emptyFunction  
*/  
emptyFunction: function () {},  
 
/**  
* Method: getTransport  
*  
* Returns:  
* {Object} Transport mechanism for whichever browser we're in, or false if  
* none available.  
*/  
getTransport: function() {  
return OpenLayers.Util.Try(  
function() {return new XMLHttpRequest();},  
function() {return new ActiveXObject('Msxml2.XMLHTTP');},  
function() {return new ActiveXObject('Microsoft.XMLHTTP');}  
) || false;  
},  
 
/**  
* Property: activeRequestCount  
* {Integer}  
*/  
activeRequestCount: 0  
};  
 
/**  
* Namespace: OpenLayers.Ajax.Responders  
* {Object}  
*/  
OpenLayers.Ajax.Responders = {  
 
/**  
* Property: responders  
* {Array}  
*/  
responders: [],  
 
/**  
* Method: register  
*  
* Parameters:  
* responderToAdd - {?}  
*/  
register: function(responderToAdd) {  
for (var i = 0; i < this.responders.length; i++){  
if (responderToAdd == this.responders[i]){  
return;  
}  
}  
this.responders.push(responderToAdd);  
},  
 
/**  
* Method: unregister  
*  
* Parameters:  
* responderToRemove - {?}  
*/  
unregister: function(responderToRemove) {  
OpenLayers.Util.removeItem(this.reponders, responderToRemove);  
},  
 
/**  
* Method: dispatch  
*  
* Parameters:  
* callback - {?}  
* request - {?}  
* transport - {?}  
*/  
dispatch: function(callback, request, transport) {  
var responder;  
for (var i = 0; i < this.responders.length; i++) {  
responder = this.responders[i];  
 
if (responder[callback] &&  
typeof responder[callback] == 'function') {  
try {  
responder[callback].apply(responder,  
[request, transport]);  
} catch (e) {}  
}  
}  
}  
};  
 
OpenLayers.Ajax.Responders.register({  
/**  
* Function: onCreate  
*/  
onCreate: function() {  
OpenLayers.Ajax.activeRequestCount++;  
},  
 
/**  
* Function: onComplete  
*/  
onComplete: function() {  
OpenLayers.Ajax.activeRequestCount--;  
}  
});  
 
/**  
* Class: OpenLayers.Ajax.Base  
*/  
OpenLayers.Ajax.Base = OpenLayers.Class({  
 
/**  
* Constructor: OpenLayers.Ajax.Base  
*  
* Parameters:  
* options - {Object}  
*/  
initialize: function(options) {  
this.options = {  
method: 'post',  
asynchronous: true,  
contentType: 'application/xml',  
parameters: ''  
};  
OpenLayers.Util.extend(this.options, options || {});  
 
this.options.method = this.options.method.toLowerCase();  
 
if (typeof this.options.parameters == 'string') {  
this.options.parameters =  
OpenLayers.Util.getParameters(this.options.parameters);  
}  
}  
});  
 
/**  
* Class: OpenLayers.Ajax.Request  
* *Deprecated*. Use <OpenLayers.Request> method instead.  
*  
* Inherit:  
* - <OpenLayers.Ajax.Base>  
*/  
OpenLayers.Ajax.Request = OpenLayers.Class(OpenLayers.Ajax.Base, {  
 
/**  
* Property: _complete  
*  
* {Boolean}  
*/  
_complete: false,  
 
/**  
* Constructor: OpenLayers.Ajax.Request  
*  
* Parameters:  
* url - {String}  
* options - {Object}  
*/  
initialize: function(url, options) {  
OpenLayers.Ajax.Base.prototype.initialize.apply(this, [options]);  
 
if (OpenLayers.ProxyHost && OpenLayers.String.startsWith(url, "http")) {  
url = OpenLayers.ProxyHost + encodeURIComponent(url);  
}  
 
this.transport = OpenLayers.Ajax.getTransport();  
this.request(url);  
},  
 
/**  
* Method: request  
*  
* Parameters:  
* url - {String}  
*/  
request: function(url) {  
this.url = url;  
this.method = this.options.method;  
var params = OpenLayers.Util.extend({}, this.options.parameters);  
 
if (this.method != 'get' && this.method != 'post') {  
// simulate other verbs over post  
params['_method'] = this.method;  
this.method = 'post';  
}  
 
this.parameters = params;  
 
if (params = OpenLayers.Util.getParameterString(params)) {  
// when GET, append parameters to URL  
if (this.method == 'get') {  
this.url += ((this.url.indexOf('?') > -1) ? '&' : '?') + params;  
} else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {  
params += '&_=';  
}  
}  
try {  
var response = new OpenLayers.Ajax.Response(this);  
if (this.options.onCreate) {  
this.options.onCreate(response);  
}  
 
OpenLayers.Ajax.Responders.dispatch('onCreate',  
this,  
response);  
 
this.transport.open(this.method.toUpperCase(),  
this.url,  
this.options.asynchronous);  
 
if (this.options.asynchronous) {  
window.setTimeout(  
OpenLayers.Function.bind(this.respondToReadyState, this, 1),  
10);  
}  
 
this.transport.onreadystatechange =  
OpenLayers.Function.bind(this.onStateChange, this);  
this.setRequestHeaders();  
 
this.body = this.method == 'post' ?  
(this.options.postBody || params) : null;  
this.transport.send(this.body);  
 
// Force Firefox to handle ready state 4 for synchronous requests  
if (!this.options.asynchronous &&  
this.transport.overrideMimeType) {  
this.onStateChange();  
}  
} catch (e) {  
this.dispatchException(e);  
}  
},  
 
/**  
* Method: onStateChange  
*/  
onStateChange: function() {  
var readyState = this.transport.readyState;  
if (readyState > 1 && !((readyState == 4) && this._complete)) {  
this.respondToReadyState(this.transport.readyState);  
}  
},  
 
/**  
* Method: setRequestHeaders  
*/  
setRequestHeaders: function() {  
var headers = {  
'X-Requested-With': 'XMLHttpRequest',  
'Accept': 'text/javascript, text/html, application/xml, text/xml, */*',  
'OpenLayers': true  
};  
 
if (this.method == 'post') {  
headers['Content-type'] = this.options.contentType +  
(this.options.encoding ? '; charset=' + this.options.encoding : '');  
 
/* Force "Connection: close" for older Mozilla browsers to work  
* around a bug where XMLHttpRequest sends an incorrect  
* Content-length header. See Mozilla Bugzilla #246651.  
*/  
if (this.transport.overrideMimeType &&  
(navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) {  
headers['Connection'] = 'close';  
}  
}  
// user-defined headers  
if (typeof this.options.requestHeaders == 'object') {  
var extras = this.options.requestHeaders;  
 
if (typeof extras.push == 'function') {  
for (var i = 0, length = extras.length; i < length; i += 2) {  
headers[extras[i]] = extras[i+1];  
}  
} else {  
for (var i in extras) {  
headers[i] = extras[i];  
}  
}  
}  
 
for (var name in headers) {  
this.transport.setRequestHeader(name, headers[name]);  
}  
},  
 
/**  
* Method: success  
*  
* Returns:  
* {Boolean} -  
*/  
success: function() {  
var status = this.getStatus();  
return !status || (status >=200 && status < 300);  
},  
 
/**  
* Method: getStatus  
*  
* Returns:  
* {Integer} - Status  
*/  
getStatus: function() {  
try {  
return this.transport.status || 0;  
} catch (e) {  
return 0;  
}  
},  
 
/**  
* Method: respondToReadyState  
*  
* Parameters:  
* readyState - {?}  
*/  
respondToReadyState: function(readyState) {  
var state = OpenLayers.Ajax.Request.Events[readyState];  
var response = new OpenLayers.Ajax.Response(this);  
 
if (state == 'Complete') {  
try {  
this._complete = true;  
(this.options['on' + response.status] ||  
this.options['on' + (this.success() ? 'Success' : 'Failure')] ||  
OpenLayers.Ajax.emptyFunction)(response);  
} catch (e) {  
this.dispatchException(e);  
}  
 
var contentType = response.getHeader('Content-type');  
}  
 
try {  
(this.options['on' + state] ||  
OpenLayers.Ajax.emptyFunction)(response);  
OpenLayers.Ajax.Responders.dispatch('on' + state,  
this,  
response);  
} catch (e) {  
this.dispatchException(e);  
}  
 
if (state == 'Complete') {  
// avoid memory leak in MSIE: clean up  
this.transport.onreadystatechange = OpenLayers.Ajax.emptyFunction;  
}  
},  
 
/**  
* Method: getHeader  
*  
* Parameters:  
* name - {String} Header name  
*  
* Returns:  
* {?} - response header for the given name  
*/  
getHeader: function(name) {  
try {  
return this.transport.getResponseHeader(name);  
} catch (e) {  
return null;  
}  
},  
 
/**  
* Method: dispatchException  
* If the optional onException function is set, execute it  
* and then dispatch the call to any other listener registered  
* for onException.  
*  
* If no optional onException function is set, we suspect that  
* the user may have also not used  
* OpenLayers.Ajax.Responders.register to register a listener  
* for the onException call. To make sure that something  
* gets done with this exception, only dispatch the call if there  
* are listeners.  
*  
* If you explicitly want to swallow exceptions, set  
* request.options.onException to an empty function (function(){})  
* or register an empty function with <OpenLayers.Ajax.Responders>  
* for onException.  
*  
* Parameters:  
* exception - {?}  
*/  
dispatchException: function(exception) {  
var handler = this.options.onException;  
if(handler) {  
// call options.onException and alert any other listeners  
handler(this, exception);  
OpenLayers.Ajax.Responders.dispatch('onException', this, exception);  
} else {  
// check if there are any other listeners  
var listener = false;  
var responders = OpenLayers.Ajax.Responders.responders;  
for (var i = 0; i < responders.length; i++) {  
if(responders[i].onException) {  
listener = true;  
break;  
}  
}  
if(listener) {  
// call all listeners  
OpenLayers.Ajax.Responders.dispatch('onException', this, exception);  
} else {  
// let the exception through  
throw exception;  
}  
}  
}  
});  
 
/**  
* Property: Events  
* {Array(String)}  
*/  
OpenLayers.Ajax.Request.Events =  
['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];  
 
/**  
* Class: OpenLayers.Ajax.Response  
*/  
OpenLayers.Ajax.Response = OpenLayers.Class({  
 
/**  
* Property: status  
*  
* {Integer}  
*/  
status: 0,  
 
 
/**  
* Property: statusText  
*  
* {String}  
*/  
statusText: '',  
 
/**  
* Constructor: OpenLayers.Ajax.Response  
*  
* Parameters:  
* request - {Object}  
*/  
initialize: function(request) {  
this.request = request;  
var transport = this.transport = request.transport,  
readyState = this.readyState = transport.readyState;  
 
if ((readyState > 2 &&  
!(!!(window.attachEvent && !window.opera))) ||  
readyState == 4) {  
this.status = this.getStatus();  
this.statusText = this.getStatusText();  
this.responseText = transport.responseText == null ?  
'' : String(transport.responseText);  
}  
 
if(readyState == 4) {  
var xml = transport.responseXML;  
this.responseXML = xml === undefined ? null : xml;  
}  
},  
 
/**  
* Method: getStatus  
*/  
getStatus: OpenLayers.Ajax.Request.prototype.getStatus,  
 
/**  
* Method: getStatustext  
*  
* Returns:  
* {String} - statusText  
*/  
getStatusText: function() {  
try {  
return this.transport.statusText || '';  
} catch (e) {  
return '';  
}  
},  
 
/**  
* Method: getHeader  
*/  
getHeader: OpenLayers.Ajax.Request.prototype.getHeader,  
 
/**  
* Method: getResponseHeader  
*  
* Returns:  
* {?} - response header for given name  
*/  
getResponseHeader: function(name) {  
return this.transport.getResponseHeader(name);  
}  
});  
 
 
/**  
* Function: getElementsByTagNameNS  
*  
* Parameters:  
* parentnode - {?}  
* nsuri - {?}  
* nsprefix - {?}  
* tagname - {?}  
*  
* Returns:  
* {?}  
*/  
OpenLayers.Ajax.getElementsByTagNameNS = function(parentnode, nsuri,  
nsprefix, tagname) {  
var elem = null;  
if (parentnode.getElementsByTagNameNS) {  
elem = parentnode.getElementsByTagNameNS(nsuri, tagname);  
} else {  
elem = parentnode.getElementsByTagName(nsprefix + ':' + tagname);  
}  
return elem;  
};  
 
 
/**  
* Function: serializeXMLToString  
* Wrapper function around XMLSerializer, which doesn't exist/work in  
* IE/Safari. We need to come up with a way to serialize in those browser:  
* for now, these browsers will just fail. #535, #536  
*  
* Parameters:  
* xmldom {XMLNode} xml dom to serialize  
*  
* Returns:  
* {?}  
*/  
OpenLayers.Ajax.serializeXMLToString = function(xmldom) {  
var serializer = new XMLSerializer();  
var data = serializer.serializeToString(xmldom);  
return data;  
};  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/BaseTypes/Class.js  
* @requires OpenLayers/BaseTypes/LonLat.js  
* @requires OpenLayers/BaseTypes/Size.js  
* @requires OpenLayers/BaseTypes/Pixel.js  
* @requires OpenLayers/BaseTypes/Bounds.js  
* @requires OpenLayers/BaseTypes/Element.js  
* @requires OpenLayers/Lang/en.js  
* @requires OpenLayers/Console.js  
*/  
 
/**  
* Header: OpenLayers Base Types  
* OpenLayers custom string, number and function functions are described here.  
*/  
 
/**  
* Namespace: OpenLayers.String  
* Contains convenience functions for string manipulation.  
*/  
OpenLayers.String = {  
 
/**  
* APIFunction: startsWith  
* Test whether a string starts with another string.  
*  
* Parameters:  
* str - {String} The string to test.  
* sub - {Sring} The substring to look for.  
*  
* Returns:  
* {Boolean} The first string starts with the second.  
*/  
startsWith: function(str, sub) {  
return (str.indexOf(sub) == 0);  
},  
 
/**  
* APIFunction: contains  
* Test whether a string contains another string.  
*  
* Parameters:  
* str - {String} The string to test.  
* sub - {String} The substring to look for.  
*  
* Returns:  
* {Boolean} The first string contains the second.  
*/  
contains: function(str, sub) {  
return (str.indexOf(sub) != -1);  
},  
 
/**  
* APIFunction: trim  
* Removes leading and trailing whitespace characters from a string.  
*  
* Parameters:  
* str - {String} The (potentially) space padded string. This string is not  
* modified.  
*  
* Returns:  
* {String} A trimmed version of the string with all leading and  
* trailing spaces removed.  
*/  
trim: function(str) {  
return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');  
},  
 
/**  
* APIFunction: camelize  
* Camel-case a hyphenated string.  
* Ex. "chicken-head" becomes "chickenHead", and  
* "-chicken-head" becomes "ChickenHead".  
*  
* Parameters:  
* str - {String} The string to be camelized. The original is not modified.  
*  
* Returns:  
* {String} The string, camelized  
*/  
camelize: function(str) {  
var oStringList = str.split('-');  
var camelizedString = oStringList[0];  
for (var i=1, len=oStringList.length; i<len; i++) {  
var s = oStringList[i];  
camelizedString += s.charAt(0).toUpperCase() + s.substring(1);  
}  
return camelizedString;  
},  
 
/**  
* APIFunction: format  
* Given a string with tokens in the form ${token}, return a string  
* with tokens replaced with properties from the given context  
* object. Represent a literal "${" by doubling it, e.g. "${${".  
*  
* Parameters:  
* template - {String} A string with tokens to be replaced. A template  
* has the form "literal ${token}" where the token will be replaced  
* by the value of context["token"].  
* context - {Object} An optional object with properties corresponding  
* to the tokens in the format string. If no context is sent, the  
* window object will be used.  
* args - {Array} Optional arguments to pass to any functions found in  
* the context. If a context property is a function, the token  
* will be replaced by the return from the function called with  
* these arguments.  
*  
* Returns:  
* {String} A string with tokens replaced from the context object.  
*/  
format: function(template, context, args) {  
if(!context) {  
context = window;  
}  
 
// Example matching:  
// str = ${foo.bar}  
// match = foo.bar  
var replacer = function(str, match) {  
var replacement;  
 
// Loop through all subs. Example: ${a.b.c}  
// 0 -> replacement = context[a];  
// 1 -> replacement = context[a][b];  
// 2 -> replacement = context[a][b][c];  
var subs = match.split(/\.+/);  
for (var i=0; i< subs.length; i++) {  
if (i == 0) {  
replacement = context;  
}  
 
replacement = replacement[subs[i]];  
}  
 
if(typeof replacement == "function") {  
replacement = args ?  
replacement.apply(null, args) :  
replacement();  
}  
 
// If replacement is undefined, return the string 'undefined'.  
// This is a workaround for a bugs in browsers not properly  
// dealing with non-participating groups in regular expressions:  
// http://blog.stevenlevithan.com/archives/npcg-javascript  
if (typeof replacement == 'undefined') {  
return 'undefined';  
} else {  
return replacement;  
}  
};  
 
return template.replace(OpenLayers.String.tokenRegEx, replacer);  
},  
 
/**  
* Property: OpenLayers.String.tokenRegEx  
* Used to find tokens in a string.  
* Examples: ${a}, ${a.b.c}, ${a-b}, ${5}  
*/  
tokenRegEx: /\$\{([\w.]+?)\}/g,  
 
/**  
* Property: OpenLayers.String.numberRegEx  
* Used to test strings as numbers.  
*/  
numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,  
 
/**  
* APIFunction: OpenLayers.String.isNumeric  
* Determine whether a string contains only a numeric value.  
*  
* Examples:  
* (code)  
* OpenLayers.String.isNumeric("6.02e23") // true  
* OpenLayers.String.isNumeric("12 dozen") // false  
* OpenLayers.String.isNumeric("4") // true  
* OpenLayers.String.isNumeric(" 4 ") // false  
* (end)  
*  
* Returns:  
* {Boolean} String contains only a number.  
*/  
isNumeric: function(value) {  
return OpenLayers.String.numberRegEx.test(value);  
},  
 
/**  
* APIFunction: numericIf  
* Converts a string that appears to be a numeric value into a number.  
*  
* Returns  
* {Number|String} a Number if the passed value is a number, a String  
* otherwise.  
*/  
numericIf: function(value) {  
return OpenLayers.String.isNumeric(value) ? parseFloat(value) : value;  
}  
 
};  
 
if (!String.prototype.startsWith) {  
/**  
* APIMethod: String.startsWith  
* *Deprecated*. Whether or not a string starts with another string.  
*  
* Parameters:  
* sStart - {Sring} The string we're testing for.  
*  
* Returns:  
* {Boolean} Whether or not this string starts with the string passed in.  
*/  
String.prototype.startsWith = function(sStart) {  
OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",  
{'newMethod':'OpenLayers.String.startsWith'}));  
return OpenLayers.String.startsWith(this, sStart);  
};  
}  
 
if (!String.prototype.contains) {  
/**  
* APIMethod: String.contains  
* *Deprecated*. Whether or not a string contains another string.  
*  
* Parameters:  
* str - {String} The string that we're testing for.  
*  
* Returns:  
* {Boolean} Whether or not this string contains with the string passed in.  
*/  
String.prototype.contains = function(str) {  
OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",  
{'newMethod':'OpenLayers.String.contains'}));  
return OpenLayers.String.contains(this, str);  
};  
}  
 
if (!String.prototype.trim) {  
/**  
* APIMethod: String.trim  
* *Deprecated*. Removes leading and trailing whitespace characters from a string.  
*  
* Returns:  
* {String} A trimmed version of the string - all leading and  
* trailing spaces removed  
*/  
String.prototype.trim = function() {  
OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",  
{'newMethod':'OpenLayers.String.trim'}));  
return OpenLayers.String.trim(this);  
};  
}  
 
if (!String.prototype.camelize) {  
/**  
* APIMethod: String.camelize  
* *Deprecated*. Camel-case a hyphenated string.  
* Ex. "chicken-head" becomes "chickenHead", and  
* "-chicken-head" becomes "ChickenHead".  
*  
* Returns:  
* {String} The string, camelized  
*/  
String.prototype.camelize = function() {  
OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",  
{'newMethod':'OpenLayers.String.camelize'}));  
return OpenLayers.String.camelize(this);  
};  
}  
 
/**  
* Namespace: OpenLayers.Number  
* Contains convenience functions for manipulating numbers.  
*/  
OpenLayers.Number = {  
 
/**  
* Property: decimalSeparator  
* Decimal separator to use when formatting numbers.  
*/  
decimalSeparator: ".",  
 
/**  
* Property: thousandsSeparator  
* Thousands separator to use when formatting numbers.  
*/  
thousandsSeparator: ",",  
 
/**  
* APIFunction: limitSigDigs  
* Limit the number of significant digits on a float.  
*  
* Parameters:  
* num - {Float}  
* sig - {Integer}  
*  
* Returns:  
* {Float} The number, rounded to the specified number of significant  
* digits.  
*/  
limitSigDigs: function(num, sig) {  
var fig = 0;  
if (sig > 0) {  
fig = parseFloat(num.toPrecision(sig));  
}  
return fig;  
},  
 
/**  
* APIFunction: format  
* Formats a number for output.  
*  
* Parameters:  
* num - {Float}  
* dec - {Integer} Number of decimal places to round to.  
* Defaults to 0. Set to null to leave decimal places unchanged.  
* tsep - {String} Thousands separator.  
* Default is ",".  
* dsep - {String} Decimal separator.  
* Default is ".".  
*  
* Returns:  
* {String} A string representing the formatted number.  
*/  
format: function(num, dec, tsep, dsep) {  
dec = (typeof dec != "undefined") ? dec : 0;  
tsep = (typeof tsep != "undefined") ? tsep :  
OpenLayers.Number.thousandsSeparator;  
dsep = (typeof dsep != "undefined") ? dsep :  
OpenLayers.Number.decimalSeparator;  
 
if (dec != null) {  
num = parseFloat(num.toFixed(dec));  
}  
 
var parts = num.toString().split(".");  
if (parts.length == 1 && dec == null) {  
// integer where we do not want to touch the decimals  
dec = 0;  
}  
 
var integer = parts[0];  
if (tsep) {  
var thousands = /(-?[0-9]+)([0-9]{3})/;  
while(thousands.test(integer)) {  
integer = integer.replace(thousands, "$1" + tsep + "$2");  
}  
}  
 
var str;  
if (dec == 0) {  
str = integer;  
} else {  
var rem = parts.length > 1 ? parts[1] : "0";  
if (dec != null) {  
rem = rem + new Array(dec - rem.length + 1).join("0");  
}  
str = integer + dsep + rem;  
}  
return str;  
}  
};  
 
if (!Number.prototype.limitSigDigs) {  
/**  
* APIMethod: Number.limitSigDigs  
* *Deprecated*. Limit the number of significant digits on an integer. Does *not*  
* work with floats!  
*  
* Parameters:  
* sig - {Integer}  
*  
* Returns:  
* {Integer} The number, rounded to the specified number of significant digits.  
* If null, 0, or negative value passed in, returns 0  
*/  
Number.prototype.limitSigDigs = function(sig) {  
OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",  
{'newMethod':'OpenLayers.Number.limitSigDigs'}));  
return OpenLayers.Number.limitSigDigs(this, sig);  
};  
}  
 
/**  
* Namespace: OpenLayers.Function  
* Contains convenience functions for function manipulation.  
*/  
OpenLayers.Function = {  
/**  
* APIFunction: bind  
* Bind a function to an object. Method to easily create closures with  
* 'this' altered.  
*  
* Parameters:  
* func - {Function} Input function.  
* object - {Object} The object to bind to the input function (as this).  
*  
* Returns:  
* {Function} A closure with 'this' set to the passed in object.  
*/  
bind: function(func, object) {  
// create a reference to all arguments past the second one  
var args = Array.prototype.slice.apply(arguments, [2]);  
return function() {  
// Push on any additional arguments from the actual function call.  
// These will come after those sent to the bind call.  
var newArgs = args.concat(  
Array.prototype.slice.apply(arguments, [0])  
);  
return func.apply(object, newArgs);  
};  
},  
 
/**  
* APIFunction: bindAsEventListener  
* Bind a function to an object, and configure it to receive the event  
* object as first parameter when called.  
*  
* Parameters:  
* func - {Function} Input function to serve as an event listener.  
* object - {Object} A reference to this.  
*  
* Returns:  
* {Function}  
*/  
bindAsEventListener: function(func, object) {  
return function(event) {  
return func.call(object, event || window.event);  
};  
},  
 
/**  
* APIFunction: False  
* A simple function to that just does "return false". We use this to  
* avoid attaching anonymous functions to DOM event handlers, which  
* causes "issues" on IE<8.  
*  
* Usage:  
* document.onclick = OpenLayers.Function.False;  
*  
* Returns:  
* {Boolean}  
*/  
False : function() {  
return false;  
},  
 
/**  
* APIFunction: True  
* A simple function to that just does "return true". We use this to  
* avoid attaching anonymous functions to DOM event handlers, which  
* causes "issues" on IE<8.  
*  
* Usage:  
* document.onclick = OpenLayers.Function.True;  
*  
* Returns:  
* {Boolean}  
*/  
True : function() {  
return true;  
}  
};  
 
if (!Function.prototype.bind) {  
/**  
* APIMethod: Function.bind  
* *Deprecated*. Bind a function to an object.  
* Method to easily create closures with 'this' altered.  
*  
* Parameters:  
* object - {Object} the this parameter  
*  
* Returns:  
* {Function} A closure with 'this' altered to the first  
* argument.  
*/  
Function.prototype.bind = function() {  
OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",  
{'newMethod':'OpenLayers.Function.bind'}));  
// new function takes the same arguments with this function up front  
Array.prototype.unshift.apply(arguments, [this]);  
return OpenLayers.Function.bind.apply(null, arguments);  
};  
}  
 
if (!Function.prototype.bindAsEventListener) {  
/**  
* APIMethod: Function.bindAsEventListener  
* *Deprecated*. Bind a function to an object, and configure it to receive the  
* event object as first parameter when called.  
*  
* Parameters:  
* object - {Object} A reference to this.  
*  
* Returns:  
* {Function}  
*/  
Function.prototype.bindAsEventListener = function(object) {  
OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",  
{'newMethod':'OpenLayers.Function.bindAsEventListener'}));  
return OpenLayers.Function.bindAsEventListener(this, object);  
};  
}  
 
/**  
* Namespace: OpenLayers.Array  
* Contains convenience functions for array manipulation.  
*/  
OpenLayers.Array = {  
 
/**  
* APIMethod: filter  
* Filter an array. Provides the functionality of the  
* Array.prototype.filter extension to the ECMA-262 standard. Where  
* available, Array.prototype.filter will be used.  
*  
* Based on well known example from http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/filter  
*  
* Parameters:  
* array - {Array} The array to be filtered. This array is not mutated.  
* Elements added to this array by the callback will not be visited.  
* callback - {Function} A function that is called for each element in  
* the array. If this function returns true, the element will be  
* included in the return. The function will be called with three  
* arguments: the element in the array, the index of that element, and  
* the array itself. If the optional caller parameter is specified  
* the callback will be called with this set to caller.  
* caller - {Object} Optional object to be set as this when the callback  
* is called.  
*  
* Returns:  
* {Array} An array of elements from the passed in array for which the  
* callback returns true.  
*/  
filter: function(array, callback, caller) {  
var selected = [];  
if (Array.prototype.filter) {  
selected = array.filter(callback, caller);  
} else {  
var len = array.length;  
if (typeof callback != "function") {  
throw new TypeError();  
}  
for(var i=0; i<len; i++) {  
if (i in array) {  
var val = array[i];  
if (callback.call(caller, val, i, array)) {  
selected.push(val);  
}  
}  
}  
}  
return selected;  
}  
 
};  
 
/**  
* Namespace: OpenLayers.Date  
* Contains implementations of Date.parse and date.toISOString that match the  
* ECMAScript 5 specification for parsing RFC 3339 dates.  
* http://tools.ietf.org/html/rfc3339  
*/  
OpenLayers.Date = {  
 
/**  
* APIMethod: toISOString  
* Generates a string representing a date. The format of the string follows  
* the profile of ISO 8601 for date and time on the Internet (see  
* http://tools.ietf.org/html/rfc3339). If the toISOString method is  
* available on the Date prototype, that is used. The toISOString  
* method for Date instances is defined in ECMA-262.  
*  
* Parameters:  
* date - {Date} A date object.  
*  
* Returns:  
* {String} A string representing the date (e.g.  
* "2010-08-07T16:58:23.123Z"). If the date does not have a valid time  
* (i.e. isNaN(date.getTime())) this method returns the string "Invalid  
* Date". The ECMA standard says the toISOString method should throw  
* RangeError in this case, but Firefox returns a string instead. For  
* best results, use isNaN(date.getTime()) to determine date validity  
* before generating date strings.  
*/  
toISOString: (function() {  
if ("toISOString" in Date.prototype) {  
return function(date) {  
return date.toISOString();  
}  
} else {  
function pad(num, len) {  
var str = num + "";  
while (str.length < len) {  
str = "0" + str;  
}  
return str;  
}  
return function(date) {  
var str;  
if (isNaN(date.getTime())) {  
// ECMA-262 says throw RangeError, Firefox returns  
// "Invalid Date"  
str = "Invalid Date";  
} else {  
str =  
date.getUTCFullYear() + "-" +  
pad(date.getUTCMonth() + 1, 2) + "-" +  
pad(date.getUTCDate(), 2) + "T" +  
pad(date.getUTCHours(), 2) + ":" +  
pad(date.getUTCMinutes(), 2) + ":" +  
pad(date.getUTCSeconds(), 2) + "." +  
pad(date.getUTCMilliseconds(), 3) + "Z";  
}  
return str;  
}  
}  
 
})(),  
 
/**  
* APIMethod: parse  
* Generate a date object from a string. The format for the string follows  
* the profile of ISO 8601 for date and time on the Internet (see  
* http://tools.ietf.org/html/rfc3339). If the parse method on  
* the Date constructor returns a valid date for the given string,  
* that method is used.  
*  
* Parameters:  
* str - {String} A string representing the date (e.g.  
* "2010", "2010-08", "2010-08-07", "2010-08-07T16:58:23.123Z",  
* "2010-08-07T11:58:23.123-06").  
*  
* Returns:  
* {Date} A date object. If the string could not be parsed, an invalid  
* date is returned (i.e. isNaN(date.getTime())).  
*/  
parse: function(str) {  
var date;  
// first check if the native parse method can parse it  
var elapsed = Date.parse(str);  
if (!isNaN(elapsed)) {  
date = new Date(elapsed);  
} else {  
var match = str.match(/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))?$/);  
var date;  
if (match && (match[1] || match[7])) { // must have at least year or time  
var year = parseInt(match[1], 10) || 0;  
var month = (parseInt(match[2], 10) - 1) || 0;  
var day = parseInt(match[3], 10) || 1;  
date = new Date(Date.UTC(year, month, day));  
// optional time  
var type = match[7];  
if (type) {  
var hours = parseInt(match[4], 10);  
var minutes = parseInt(match[5], 10);  
var secFrac = parseFloat(match[6]);  
var seconds = secFrac | 0;  
var milliseconds = Math.round(1000 * (secFrac - seconds));  
date.setUTCHours(hours, minutes, seconds, milliseconds);  
// check offset  
if (type !== "Z") {  
var hoursOffset = parseInt(type, 10);  
var minutesOffset = parseInt(match[8]) || 0;  
var offset = -1000 * (60 * (hoursOffset * 60) + minutesOffset * 60);  
date = new Date(date.getTime() + offset);  
}  
}  
} else {  
date = new Date("invalid");  
}  
}  
return date;  
}  
 
};  
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Console.js  
*/  
 
/**  
* Class: OpenLayers.Bounds  
* Instances of this class represent bounding boxes. Data stored as left,  
* bottom, right, top floats. All values are initialized to null, however,  
* you should make sure you set them before using the bounds for anything.  
*  
* Possible use case:  
* > bounds = new OpenLayers.Bounds();  
* > bounds.extend(new OpenLayers.LonLat(4,5));  
* > bounds.extend(new OpenLayers.LonLat(5,6));  
* > bounds.toBBOX(); // returns 4,5,5,6  
*/  
OpenLayers.Bounds = OpenLayers.Class({  
 
/**  
* Property: left  
* {Number} Minimum horizontal coordinate.  
*/  
left: null,  
 
/**  
* Property: bottom  
* {Number} Minimum vertical coordinate.  
*/  
bottom: null,  
 
/**  
* Property: right  
* {Number} Maximum horizontal coordinate.  
*/  
right: null,  
 
/**  
* Property: top  
* {Number} Maximum vertical coordinate.  
*/  
top: null,  
 
/**  
* Property: centerLonLat  
* {<OpenLayers.LonLat>} A cached center location. This should not be  
* accessed directly. Use <getCenterLonLat> instead.  
*/  
centerLonLat: null,  
 
/**  
* Constructor: OpenLayers.Bounds  
* Construct a new bounds object.  
*  
* Parameters:  
* left - {Number} The left bounds of the box. Note that for width  
* calculations, this is assumed to be less than the right value.  
* bottom - {Number} The bottom bounds of the box. Note that for height  
* calculations, this is assumed to be more than the top value.  
* right - {Number} The right bounds.  
* top - {Number} The top bounds.  
*/  
initialize: function(left, bottom, right, top) {  
if (left != null) {  
this.left = OpenLayers.Util.toFloat(left);  
}  
if (bottom != null) {  
this.bottom = OpenLayers.Util.toFloat(bottom);  
}  
if (right != null) {  
this.right = OpenLayers.Util.toFloat(right);  
}  
if (top != null) {  
this.top = OpenLayers.Util.toFloat(top);  
}  
},  
 
/**  
* Method: clone  
* Create a cloned instance of this bounds.  
*  
* Returns:  
* {<OpenLayers.Bounds>} A fresh copy of the bounds  
*/  
clone:function() {  
return new OpenLayers.Bounds(this.left, this.bottom,  
this.right, this.top);  
},  
 
/**  
* Method: equals  
* Test a two bounds for equivalence.  
*  
* Parameters:  
* bounds - {<OpenLayers.Bounds>}  
*  
* Returns:  
* {Boolean} The passed-in bounds object has the same left,  
* right, top, bottom components as this. Note that if bounds  
* passed in is null, returns false.  
*/  
equals:function(bounds) {  
var equals = false;  
if (bounds != null) {  
equals = ((this.left == bounds.left) &&  
(this.right == bounds.right) &&  
(this.top == bounds.top) &&  
(this.bottom == bounds.bottom));  
}  
return equals;  
},  
 
/**  
* APIMethod: toString  
*  
* Returns:  
* {String} String representation of bounds object.  
* (ex.<i>"left-bottom=(5,42) right-top=(10,45)"</i>)  
*/  
toString:function() {  
return ( "left-bottom=(" + this.left + "," + this.bottom + ")"  
+ " right-top=(" + this.right + "," + this.top + ")" );  
},  
 
/**  
* APIMethod: toArray  
*  
* Parameters:  
* reverseAxisOrder - {Boolean} Should we reverse the axis order?  
*  
* Returns:  
* {Array} array of left, bottom, right, top  
*/  
toArray: function(reverseAxisOrder) {  
if (reverseAxisOrder === true) {  
return [this.bottom, this.left, this.top, this.right];  
} else {  
return [this.left, this.bottom, this.right, this.top];  
}  
},  
 
/**  
* APIMethod: toBBOX  
*  
* Parameters:  
* decimal - {Integer} How many significant digits in the bbox coords?  
* Default is 6  
* reverseAxisOrder - {Boolean} Should we reverse the axis order?  
*  
* Returns:  
* {String} Simple String representation of bounds object.  
* (ex. <i>"5,42,10,45"</i>)  
*/  
toBBOX:function(decimal, reverseAxisOrder) {  
if (decimal== null) {  
decimal = 6;  
}  
var mult = Math.pow(10, decimal);  
var xmin = Math.round(this.left * mult) / mult;  
var ymin = Math.round(this.bottom * mult) / mult;  
var xmax = Math.round(this.right * mult) / mult;  
var ymax = Math.round(this.top * mult) / mult;  
if (reverseAxisOrder === true) {  
return ymin + "," + xmin + "," + ymax + "," + xmax;  
} else {  
return xmin + "," + ymin + "," + xmax + "," + ymax;  
}  
},  
 
/**  
* APIMethod: toGeometry  
* Create a new polygon geometry based on this bounds.  
*  
* Returns:  
* {<OpenLayers.Geometry.Polygon>} A new polygon with the coordinates  
* of this bounds.  
*/  
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)  
])  
]);  
},  
 
/**  
* APIMethod: getWidth  
*  
* Returns:  
* {Float} The width of the bounds  
*/  
getWidth:function() {  
return (this.right - this.left);  
},  
 
/**  
* APIMethod: getHeight  
*  
* Returns:  
* {Float} The height of the bounds (top minus bottom).  
*/  
getHeight:function() {  
return (this.top - this.bottom);  
},  
 
/**  
* APIMethod: getSize  
*  
* Returns:  
* {<OpenLayers.Size>} The size of the box.  
*/  
getSize:function() {  
return new OpenLayers.Size(this.getWidth(), this.getHeight());  
},  
 
/**  
* APIMethod: getCenterPixel  
*  
* Returns:  
* {<OpenLayers.Pixel>} The center of the bounds in pixel space.  
*/  
getCenterPixel:function() {  
return new OpenLayers.Pixel( (this.left + this.right) / 2,  
(this.bottom + this.top) / 2);  
},  
 
/**  
* APIMethod: getCenterLonLat  
*  
* Returns:  
* {<OpenLayers.LonLat>} The center of the bounds in map space.  
*/  
getCenterLonLat:function() {  
if(!this.centerLonLat) {  
this.centerLonLat = new OpenLayers.LonLat(  
(this.left + this.right) / 2, (this.bottom + this.top) / 2  
);  
}  
return this.centerLonLat;  
},  
 
/**  
* Method: scale  
* Scales the bounds around a pixel or lonlat. Note that the new  
* bounds may return non-integer properties, even if a pixel  
* is passed.  
*  
* Parameters:  
* ratio - {Float}  
* origin - {<OpenLayers.Pixel> or <OpenLayers.LonLat>}  
* Default is center.  
*  
* Returns:  
* {<OpenLayers.Bound>} A new bounds that is scaled by ratio  
* from origin.  
*/  
 
scale: function(ratio, origin){  
if(origin == null){  
origin = this.getCenterLonLat();  
}  
 
var origx,origy;  
 
// get origin coordinates  
if(origin.CLASS_NAME == "OpenLayers.LonLat"){  
origx = origin.lon;  
origy = origin.lat;  
} else {  
origx = origin.x;  
origy = origin.y;  
}  
 
var left = (this.left - origx) * ratio + origx;  
var bottom = (this.bottom - origy) * ratio + origy;  
var right = (this.right - origx) * ratio + origx;  
var top = (this.top - origy) * ratio + origy;  
 
return new OpenLayers.Bounds(left, bottom, right, top);  
},  
 
/**  
* APIMethod: add  
*  
* Parameters:  
* x - {Float}  
* y - {Float}  
*  
* Returns:  
* {<OpenLayers.Bounds>} A new bounds whose coordinates are the same as  
* this, but shifted by the passed-in x and y values.  
*/  
add:function(x, y) {  
if ( (x == null) || (y == null) ) {  
var msg = OpenLayers.i18n("boundsAddError");  
OpenLayers.Console.error(msg);  
return null;  
}  
return new OpenLayers.Bounds(this.left + x, this.bottom + y,  
this.right + x, this.top + y);  
},  
 
/**  
* APIMethod: extend  
* Extend the bounds to include the point, lonlat, or bounds specified.  
* Note, this function assumes that left < right and bottom < top.  
*  
* Parameters:  
* object - {Object} Can be LonLat, Point, or Bounds  
*/  
extend:function(object) {  
var bounds = null;  
if (object) {  
// clear cached center location  
switch(object.CLASS_NAME) {  
case "OpenLayers.LonLat":  
bounds = new OpenLayers.Bounds(object.lon, object.lat,  
object.lon, object.lat);  
break;  
case "OpenLayers.Geometry.Point":  
bounds = new OpenLayers.Bounds(object.x, object.y,  
object.x, object.y);  
break;  
 
case "OpenLayers.Bounds":  
bounds = object;  
break;  
}  
 
if (bounds) {  
this.centerLonLat = null;  
if ( (this.left == null) || (bounds.left < this.left)) {  
this.left = bounds.left;  
}  
if ( (this.bottom == null) || (bounds.bottom < this.bottom) ) {  
this.bottom = bounds.bottom;  
}  
if ( (this.right == null) || (bounds.right > this.right) ) {  
this.right = bounds.right;  
}  
if ( (this.top == null) || (bounds.top > this.top) ) {  
this.top = bounds.top;  
}  
}  
}  
},  
 
/**  
* APIMethod: containsLonLat  
*  
* Parameters:  
* ll - {<OpenLayers.LonLat>}  
* inclusive - {Boolean} Whether or not to include the border.  
* Default is true.  
*  
* Returns:  
* {Boolean} The passed-in lonlat is within this bounds.  
*/  
containsLonLat:function(ll, inclusive) {  
return this.contains(ll.lon, ll.lat, inclusive);  
},  
 
/**  
* APIMethod: containsPixel  
*  
* Parameters:  
* px - {<OpenLayers.Pixel>}  
* inclusive - {Boolean} Whether or not to include the border. Default is  
* true.  
*  
* Returns:  
* {Boolean} The passed-in pixel is within this bounds.  
*/  
containsPixel:function(px, inclusive) {  
return this.contains(px.x, px.y, inclusive);  
},  
 
/**  
* APIMethod: contains  
*  
* Parameters:  
* x - {Float}  
* y - {Float}  
* inclusive - {Boolean} Whether or not to include the border. Default is  
* true.  
*  
* Returns:  
* {Boolean} Whether or not the passed-in coordinates are within this  
* bounds.  
*/  
contains:function(x, y, inclusive) {  
//set default  
if (inclusive == null) {  
inclusive = true;  
}  
 
if (x == null || y == null) {  
return false;  
}  
 
x = OpenLayers.Util.toFloat(x);  
y = OpenLayers.Util.toFloat(y);  
 
var contains = false;  
if (inclusive) {  
contains = ((x >= this.left) && (x <= this.right) &&  
(y >= this.bottom) && (y <= this.top));  
} else {  
contains = ((x > this.left) && (x < this.right) &&  
(y > this.bottom) && (y < this.top));  
}  
return contains;  
},  
 
/**  
* APIMethod: intersectsBounds  
* Determine whether the target bounds intersects this bounds. Bounds are  
* considered intersecting if any of their edges intersect or if one  
* bounds contains the other.  
*  
* Parameters:  
* bounds - {<OpenLayers.Bounds>} The target bounds.  
* inclusive - {Boolean} Treat coincident borders as intersecting. Default  
* is true. If false, bounds that do not overlap but only touch at the  
* border will not be considered as intersecting.  
*  
* Returns:  
* {Boolean} The passed-in bounds object intersects this bounds.  
*/  
intersectsBounds:function(bounds, inclusive) {  
if (inclusive == null) {  
inclusive = true;  
}  
var intersects = false;  
var mightTouch = (  
this.left == bounds.right ||  
this.right == bounds.left ||  
this.top == bounds.bottom ||  
this.bottom == bounds.top  
);  
 
// if the two bounds only touch at an edge, and inclusive is false,  
// then the bounds don't *really* intersect.  
if (inclusive || !mightTouch) {  
// otherwise, if one of the boundaries even partially contains another,  
// inclusive of the edges, then they do intersect.  
var inBottom = (  
((bounds.bottom >= this.bottom) && (bounds.bottom <= this.top)) ||  
((this.bottom >= bounds.bottom) && (this.bottom <= bounds.top))  
);  
var inTop = (  
((bounds.top >= this.bottom) && (bounds.top <= this.top)) ||  
((this.top > bounds.bottom) && (this.top < bounds.top))  
);  
var inLeft = (  
((bounds.left >= this.left) && (bounds.left <= this.right)) ||  
((this.left >= bounds.left) && (this.left <= bounds.right))  
);  
var inRight = (  
((bounds.right >= this.left) && (bounds.right <= this.right)) ||  
((this.right >= bounds.left) && (this.right <= bounds.right))  
);  
intersects = ((inBottom || inTop) && (inLeft || inRight));  
}  
return intersects;  
},  
 
/**  
* APIMethod: containsBounds  
* Determine whether the target bounds is contained within this bounds.  
*  
* bounds - {<OpenLayers.Bounds>} The target bounds.  
* partial - {Boolean} If any of the target corners is within this bounds  
* consider the bounds contained. Default is false. If false, the  
* entire target bounds must be contained within this bounds.  
* inclusive - {Boolean} Treat shared edges as contained. Default is  
* true.  
*  
* Returns:  
* {Boolean} The passed-in bounds object is contained within this bounds.  
*/  
containsBounds:function(bounds, partial, inclusive) {  
if (partial == null) {  
partial = false;  
}  
if (inclusive == null) {  
inclusive = true;  
}  
var bottomLeft = this.contains(bounds.left, bounds.bottom, inclusive);  
var bottomRight = this.contains(bounds.right, bounds.bottom, inclusive);  
var topLeft = this.contains(bounds.left, bounds.top, inclusive);  
var topRight = this.contains(bounds.right, bounds.top, inclusive);  
 
return (partial) ? (bottomLeft || bottomRight || topLeft || topRight)  
: (bottomLeft && bottomRight && topLeft && topRight);  
},  
 
/**  
* APIMethod: determineQuadrant  
*  
* Parameters:  
* lonlat - {<OpenLayers.LonLat>}  
*  
* Returns:  
* {String} The quadrant ("br" "tr" "tl" "bl") of the bounds in which the  
* coordinate lies.  
*/  
determineQuadrant: function(lonlat) {  
 
var quadrant = "";  
var center = this.getCenterLonLat();  
 
quadrant += (lonlat.lat < center.lat) ? "b" : "t";  
quadrant += (lonlat.lon < center.lon) ? "l" : "r";  
 
return quadrant;  
},  
 
/**  
* APIMethod: transform  
* Transform the Bounds object from source to dest.  
*  
* Parameters:  
* source - {<OpenLayers.Projection>} Source projection.  
* dest - {<OpenLayers.Projection>} Destination projection.  
*  
* Returns:  
* {<OpenLayers.Bounds>} Itself, for use in chaining operations.  
*/  
transform: function(source, dest) {  
// clear cached center location  
this.centerLonLat = null;  
var ll = OpenLayers.Projection.transform(  
{'x': this.left, 'y': this.bottom}, source, dest);  
var lr = OpenLayers.Projection.transform(  
{'x': this.right, 'y': this.bottom}, source, dest);  
var ul = OpenLayers.Projection.transform(  
{'x': this.left, 'y': this.top}, source, dest);  
var ur = OpenLayers.Projection.transform(  
{'x': this.right, 'y': this.top}, source, dest);  
this.left = Math.min(ll.x, ul.x);  
this.bottom = Math.min(ll.y, lr.y);  
this.right = Math.max(lr.x, ur.x);  
this.top = Math.max(ul.y, ur.y);  
return this;  
},  
 
/**  
* APIMethod: wrapDateLine  
*  
* Parameters:  
* maxExtent - {<OpenLayers.Bounds>}  
* options - {Object} Some possible options are:  
* leftTolerance - {float} Allow for a margin of error  
* with the 'left' value of this  
* bound.  
* Default is 0.  
* rightTolerance - {float} Allow for a margin of error  
* with the 'right' value of  
* this bound.  
* Default is 0.  
*  
* Returns:  
* {<OpenLayers.Bounds>} A copy of this bounds, but wrapped around the  
* "dateline" (as specified by the borders of  
* maxExtent). Note that this function only returns  
* a different bounds value if this bounds is  
* *entirely* outside of the maxExtent. If this  
* bounds straddles the dateline (is part in/part  
* out of maxExtent), the returned bounds will be  
* merely a copy of this one.  
*/  
wrapDateLine: function(maxExtent, options) {  
options = options || {};  
 
var leftTolerance = options.leftTolerance || 0;  
var rightTolerance = options.rightTolerance || 0;  
 
var newBounds = this.clone();  
 
if (maxExtent) {  
 
//shift right?  
while ( newBounds.left < maxExtent.left &&  
(newBounds.right - rightTolerance) <= maxExtent.left ) {  
newBounds = newBounds.add(maxExtent.getWidth(), 0);  
}  
 
//shift left?  
while ( (newBounds.left + leftTolerance) >= maxExtent.right &&  
newBounds.right > maxExtent.right ) {  
newBounds = newBounds.add(-maxExtent.getWidth(), 0);  
}  
}  
 
return newBounds;  
},  
 
CLASS_NAME: "OpenLayers.Bounds"  
});  
 
/**  
* APIFunction: fromString  
* Alternative constructor that builds a new OpenLayers.Bounds from a  
* parameter string  
*  
* Parameters:  
* str - {String}Comma-separated bounds string. (ex. <i>"5,42,10,45"</i>)  
*  
* Returns:  
* {<OpenLayers.Bounds>} New bounds object built from the  
* passed-in String.  
*/  
OpenLayers.Bounds.fromString = function(str) {  
var bounds = str.split(",");  
return OpenLayers.Bounds.fromArray(bounds);  
};  
 
/**  
* APIFunction: fromArray  
* Alternative constructor that builds a new OpenLayers.Bounds  
* from an array  
*  
* Parameters:  
* bbox - {Array(Float)} Array of bounds values (ex. <i>[5,42,10,45]</i>)  
*  
* Returns:  
* {<OpenLayers.Bounds>} New bounds object built from the passed-in Array.  
*/  
OpenLayers.Bounds.fromArray = function(bbox) {  
return new OpenLayers.Bounds(parseFloat(bbox[0]),  
parseFloat(bbox[1]),  
parseFloat(bbox[2]),  
parseFloat(bbox[3]));  
};  
 
/**  
* APIFunction: fromSize  
* Alternative constructor that builds a new OpenLayers.Bounds  
* from a size  
*  
* Parameters:  
* size - {<OpenLayers.Size>}  
*  
* Returns:  
* {<OpenLayers.Bounds>} New bounds object built from the passed-in size.  
*/  
OpenLayers.Bounds.fromSize = function(size) {  
return new OpenLayers.Bounds(0,  
size.h,  
size.w,  
0);  
};  
 
/**  
* Function: oppositeQuadrant  
* Get the opposite quadrant for a given quadrant string.  
*  
* Parameters:  
* quadrant - {String} two character quadrant shortstring  
*  
* Returns:  
* {String} The opposing quadrant ("br" "tr" "tl" "bl"). For Example, if  
* you pass in "bl" it returns "tr", if you pass in "br" it  
* returns "tl", etc.  
*/  
OpenLayers.Bounds.oppositeQuadrant = function(quadrant) {  
var opp = "";  
 
opp += (quadrant.charAt(0) == 't') ? 'b' : 't';  
opp += (quadrant.charAt(1) == 'l') ? 'r' : 'l';  
 
return opp;  
};  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* Constructor: OpenLayers.Class  
* Base class used to construct all other classes. Includes support for  
* multiple inheritance.  
*  
* This constructor is new in OpenLayers 2.5. At OpenLayers 3.0, the old  
* syntax for creating classes and dealing with inheritance  
* will be removed.  
*  
* To create a new OpenLayers-style class, use the following syntax:  
* > var MyClass = OpenLayers.Class(prototype);  
*  
* To create a new OpenLayers-style class with multiple inheritance, use the  
* following syntax:  
* > var MyClass = OpenLayers.Class(Class1, Class2, prototype);  
* Note that instanceof reflection will only reveil Class1 as superclass.  
* Class2 ff are mixins.  
*  
*/  
OpenLayers.Class = function() {  
var Class = function() {  
/**  
* This following condition can be removed at 3.0 - this is only for  
* backwards compatibility while the Class.inherit method is still  
* in use. So at 3.0, the following three lines would be replaced with  
* simply:  
* this.initialize.apply(this, arguments);  
*/  
if (arguments && arguments[0] != OpenLayers.Class.isPrototype) {  
this.initialize.apply(this, arguments);  
}  
};  
var extended = {};  
var parent, initialize, Type;  
for(var i=0, len=arguments.length; i<len; ++i) {  
Type = arguments[i];  
if(typeof Type == "function") {  
// make the class passed as the first argument the superclass  
if(i == 0 && len > 1) {  
initialize = Type.prototype.initialize;  
// replace the initialize method with an empty function,  
// because we do not want to create a real instance here  
Type.prototype.initialize = function() {};  
// the line below makes sure that the new class has a  
// superclass  
extended = new Type();  
// restore the original initialize method  
if(initialize === undefined) {  
delete Type.prototype.initialize;  
} else {  
Type.prototype.initialize = initialize;  
}  
}  
// get the prototype of the superclass  
parent = Type.prototype;  
} else {  
// in this case we're extending with the prototype  
parent = Type;  
}  
OpenLayers.Util.extend(extended, parent);  
}  
Class.prototype = extended;  
return Class;  
};  
 
/**  
* Property: isPrototype  
* *Deprecated*. This is no longer needed and will be removed at 3.0.  
*/  
OpenLayers.Class.isPrototype = function () {};  
 
/**  
* APIFunction: OpenLayers.create  
* *Deprecated*. Old method to create an OpenLayers style class. Use the  
* <OpenLayers.Class> constructor instead.  
*  
* Returns:  
* An OpenLayers class  
*/  
OpenLayers.Class.create = function() {  
return function() {  
if (arguments && arguments[0] != OpenLayers.Class.isPrototype) {  
this.initialize.apply(this, arguments);  
}  
};  
};  
 
 
/**  
* APIFunction: inherit  
* *Deprecated*. Old method to inherit from one or more OpenLayers style  
* classes. Use the <OpenLayers.Class> constructor instead.  
*  
* Parameters:  
* class - One or more classes can be provided as arguments  
*  
* Returns:  
* An object prototype  
*/  
OpenLayers.Class.inherit = function () {  
var superClass = arguments[0];  
var proto = new superClass(OpenLayers.Class.isPrototype);  
for (var i=1, len=arguments.length; i<len; i++) {  
if (typeof arguments[i] == "function") {  
var mixin = arguments[i];  
arguments[i] = new mixin(OpenLayers.Class.isPrototype);  
}  
OpenLayers.Util.extend(proto, arguments[i]);  
}  
return proto;  
};  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* Namespace: OpenLayers.Element  
*/  
OpenLayers.Element = {  
 
/**  
* APIFunction: visible  
*  
* Parameters:  
* element - {DOMElement}  
*  
* Returns:  
* {Boolean} Is the element visible?  
*/  
visible: function(element) {  
return OpenLayers.Util.getElement(element).style.display != 'none';  
},  
 
/**  
* APIFunction: toggle  
* Toggle the visibility of element(s) passed in  
*  
* Parameters:  
* element - {DOMElement} Actually user can pass any number of elements  
*/  
toggle: function() {  
for (var i=0, len=arguments.length; i<len; i++) {  
var element = OpenLayers.Util.getElement(arguments[i]);  
var display = OpenLayers.Element.visible(element) ? 'hide'  
: 'show';  
OpenLayers.Element[display](element);  
}  
},  
 
 
/**  
* APIFunction: hide  
* Hide element(s) passed in  
*  
* Parameters:  
* element - {DOMElement} Actually user can pass any number of elements  
*/  
hide: function() {  
for (var i=0, len=arguments.length; i<len; i++) {  
var element = OpenLayers.Util.getElement(arguments[i]);  
if (element) {  
element.style.display = 'none';  
}  
}  
},  
 
/**  
* APIFunction: show  
* Show element(s) passed in  
*  
* Parameters:  
* element - {DOMElement} Actually user can pass any number of elements  
*/  
show: function() {  
for (var i=0, len=arguments.length; i<len; i++) {  
var element = OpenLayers.Util.getElement(arguments[i]);  
if (element) {  
element.style.display = '';  
}  
}  
},  
 
/**  
* APIFunction: remove  
* Remove the specified element from the DOM.  
*  
* Parameters:  
* element - {DOMElement}  
*/  
remove: function(element) {  
element = OpenLayers.Util.getElement(element);  
element.parentNode.removeChild(element);  
},  
 
/**  
* APIFunction: getHeight  
*  
* Parameters:  
* element - {DOMElement}  
*  
* Returns:  
* {Integer} The offset height of the element passed in  
*/  
getHeight: function(element) {  
element = OpenLayers.Util.getElement(element);  
return element.offsetHeight;  
},  
 
/**  
* APIFunction: getDimensions  
* *Deprecated*. Returns dimensions of the element passed in.  
*  
* Parameters:  
* element - {DOMElement}  
*  
* Returns:  
* {Object} Object with 'width' and 'height' properties which are the  
* dimensions of the element passed in.  
*/  
getDimensions: function(element) {  
element = OpenLayers.Util.getElement(element);  
if (OpenLayers.Element.getStyle(element, 'display') != 'none') {  
return {width: element.offsetWidth, height: element.offsetHeight};  
}  
 
// All *Width and *Height properties give 0 on elements with display none,  
// so enable the element temporarily  
var els = element.style;  
var originalVisibility = els.visibility;  
var originalPosition = els.position;  
var originalDisplay = els.display;  
els.visibility = 'hidden';  
els.position = 'absolute';  
els.display = '';  
var originalWidth = element.clientWidth;  
var originalHeight = element.clientHeight;  
els.display = originalDisplay;  
els.position = originalPosition;  
els.visibility = originalVisibility;  
return {width: originalWidth, height: originalHeight};  
},  
 
/**  
* Function: hasClass  
* Tests if an element has the given CSS class name.  
*  
* Parameters:  
* element - {DOMElement} A DOM element node.  
* name - {String} The CSS class name to search for.  
*  
* Returns:  
* {Boolean} The element has the given class name.  
*/  
hasClass: function(element, name) {  
var names = element.className;  
return (!!names && new RegExp("(^|\\s)" + name + "(\\s|$)").test(names));  
},  
 
/**  
* Function: addClass  
* Add a CSS class name to an element. Safe where element already has  
* the class name.  
*  
* Parameters:  
* element - {DOMElement} A DOM element node.  
* name - {String} The CSS class name to add.  
*  
* Returns:  
* {DOMElement} The element.  
*/  
addClass: function(element, name) {  
if(!OpenLayers.Element.hasClass(element, name)) {  
element.className += (element.className ? " " : "") + name;  
}  
return element;  
},  
 
/**  
* Function: removeClass  
* Remove a CSS class name from an element. Safe where element does not  
* have the class name.  
*  
* Parameters:  
* element - {DOMElement} A DOM element node.  
* name - {String} The CSS class name to remove.  
*  
* Returns:  
* {DOMElement} The element.  
*/  
removeClass: function(element, name) {  
var names = element.className;  
if(names) {  
element.className = OpenLayers.String.trim(  
names.replace(  
new RegExp("(^|\\s+)" + name + "(\\s+|$)"), " "  
)  
);  
}  
return element;  
},  
 
/**  
* Function: toggleClass  
* Remove a CSS class name from an element if it exists. Add the class name  
* if it doesn't exist.  
*  
* Parameters:  
* element - {DOMElement} A DOM element node.  
* name - {String} The CSS class name to toggle.  
*  
* Returns:  
* {DOMElement} The element.  
*/  
toggleClass: function(element, name) {  
if(OpenLayers.Element.hasClass(element, name)) {  
OpenLayers.Element.removeClass(element, name);  
} else {  
OpenLayers.Element.addClass(element, name);  
}  
return element;  
},  
 
/**  
* APIFunction: getStyle  
*  
* Parameters:  
* element - {DOMElement}  
* style - {?}  
*  
* Returns:  
* {?}  
*/  
getStyle: function(element, style) {  
element = OpenLayers.Util.getElement(element);  
 
var value = null;  
if (element && element.style) {  
value = element.style[OpenLayers.String.camelize(style)];  
if (!value) {  
if (document.defaultView &&  
document.defaultView.getComputedStyle) {  
 
var css = document.defaultView.getComputedStyle(element, null);  
value = css ? css.getPropertyValue(style) : null;  
} else if (element.currentStyle) {  
value = element.currentStyle[OpenLayers.String.camelize(style)];  
}  
}  
 
var positions = ['left', 'top', 'right', 'bottom'];  
if (window.opera &&  
(OpenLayers.Util.indexOf(positions,style) != -1) &&  
(OpenLayers.Element.getStyle(element, 'position') == 'static')) {  
value = 'auto';  
}  
}  
 
return value == 'auto' ? null : value;  
}  
 
};  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Console.js  
*/  
 
/**  
* Class: OpenLayers.LonLat  
* This class represents a longitude and latitude pair  
*/  
OpenLayers.LonLat = OpenLayers.Class({  
 
/**  
* APIProperty: lon  
* {Float} The x-axis coodinate in map units  
*/  
lon: 0.0,  
 
/**  
* APIProperty: lat  
* {Float} The y-axis coordinate in map units  
*/  
lat: 0.0,  
 
/**  
* Constructor: OpenLayers.LonLat  
* Create a new map location.  
*  
* Parameters:  
* lon - {Number} The x-axis coordinate in map units. If your map is in  
* a geographic projection, this will be the Longitude. Otherwise,  
* it will be the x coordinate of the map location in your map units.  
* lat - {Number} The y-axis coordinate in map units. If your map is in  
* a geographic projection, this will be the Latitude. Otherwise,  
* it will be the y coordinate of the map location in your map units.  
*/  
initialize: function(lon, lat) {  
this.lon = OpenLayers.Util.toFloat(lon);  
this.lat = OpenLayers.Util.toFloat(lat);  
},  
 
/**  
* Method: toString  
* Return a readable string version of the lonlat  
*  
* Returns:  
* {String} String representation of OpenLayers.LonLat object.  
* (ex. <i>"lon=5,lat=42"</i>)  
*/  
toString:function() {  
return ("lon=" + this.lon + ",lat=" + this.lat);  
},  
 
/**  
* APIMethod: toShortString  
*  
* Returns:  
* {String} Shortened String representation of OpenLayers.LonLat object.  
* (ex. <i>"5, 42"</i>)  
*/  
toShortString:function() {  
return (this.lon + ", " + this.lat);  
},  
 
/**  
* APIMethod: clone  
*  
* Returns:  
* {<OpenLayers.LonLat>} New OpenLayers.LonLat object with the same lon  
* and lat values  
*/  
clone:function() {  
return new OpenLayers.LonLat(this.lon, this.lat);  
},  
 
/**  
* APIMethod: add  
*  
* Parameters:  
* lon - {Float}  
* lat - {Float}  
*  
* Returns:  
* {<OpenLayers.LonLat>} A new OpenLayers.LonLat object with the lon and  
* lat passed-in added to this's.  
*/  
add:function(lon, lat) {  
if ( (lon == null) || (lat == null) ) {  
var msg = OpenLayers.i18n("lonlatAddError");  
OpenLayers.Console.error(msg);  
return null;  
}  
return new OpenLayers.LonLat(this.lon + OpenLayers.Util.toFloat(lon),  
this.lat + OpenLayers.Util.toFloat(lat));  
},  
 
/**  
* APIMethod: equals  
*  
* Parameters:  
* ll - {<OpenLayers.LonLat>}  
*  
* Returns:  
* {Boolean} Boolean value indicating whether the passed-in  
* <OpenLayers.LonLat> object has the same lon and lat  
* components as this.  
* Note: if ll passed in is null, returns false  
*/  
equals:function(ll) {  
var equals = false;  
if (ll != null) {  
equals = ((this.lon == ll.lon && this.lat == ll.lat) ||  
(isNaN(this.lon) && isNaN(this.lat) && isNaN(ll.lon) && isNaN(ll.lat)));  
}  
return equals;  
},  
 
/**  
* APIMethod: transform  
* Transform the LonLat object from source to dest. This transformation is  
* *in place*: if you want a *new* lonlat, use .clone() first.  
*  
* Parameters:  
* source - {<OpenLayers.Projection>} Source projection.  
* dest - {<OpenLayers.Projection>} Destination projection.  
*  
* Returns:  
* {<OpenLayers.LonLat>} Itself, for use in chaining operations.  
*/  
transform: function(source, dest) {  
var point = OpenLayers.Projection.transform(  
{'x': this.lon, 'y': this.lat}, source, dest);  
this.lon = point.x;  
this.lat = point.y;  
return this;  
},  
 
/**  
* APIMethod: wrapDateLine  
*  
* Parameters:  
* maxExtent - {<OpenLayers.Bounds>}  
*  
* Returns:  
* {<OpenLayers.LonLat>} A copy of this lonlat, but wrapped around the  
* "dateline" (as specified by the borders of  
* maxExtent)  
*/  
wrapDateLine: function(maxExtent) {  
 
var newLonLat = this.clone();  
 
if (maxExtent) {  
//shift right?  
while (newLonLat.lon < maxExtent.left) {  
newLonLat.lon += maxExtent.getWidth();  
}  
 
//shift left?  
while (newLonLat.lon > maxExtent.right) {  
newLonLat.lon -= maxExtent.getWidth();  
}  
}  
 
return newLonLat;  
},  
 
CLASS_NAME: "OpenLayers.LonLat"  
});  
 
/**  
* Function: fromString  
* Alternative constructor that builds a new <OpenLayers.LonLat> from a  
* parameter string  
*  
* Parameters:  
* str - {String} Comma-separated Lon,Lat coordinate string.  
* (ex. <i>"5,40"</i>)  
*  
* Returns:  
* {<OpenLayers.LonLat>} New <OpenLayers.LonLat> object built from the  
* passed-in String.  
*/  
OpenLayers.LonLat.fromString = function(str) {  
var pair = str.split(",");  
return new OpenLayers.LonLat(pair[0], pair[1]);  
};  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Console.js  
*/  
 
/**  
* Class: OpenLayers.Pixel  
* This class represents a screen coordinate, in x and y coordinates  
*/  
OpenLayers.Pixel = OpenLayers.Class({  
 
/**  
* APIProperty: x  
* {Number} The x coordinate  
*/  
x: 0.0,  
 
/**  
* APIProperty: y  
* {Number} The y coordinate  
*/  
y: 0.0,  
 
/**  
* Constructor: OpenLayers.Pixel  
* Create a new OpenLayers.Pixel instance  
*  
* Parameters:  
* x - {Number} The x coordinate  
* y - {Number} The y coordinate  
*  
* Returns:  
* An instance of OpenLayers.Pixel  
*/  
initialize: function(x, y) {  
this.x = parseFloat(x);  
this.y = parseFloat(y);  
},  
 
/**  
* Method: toString  
* Cast this object into a string  
*  
* Returns:  
* {String} The string representation of Pixel. ex: "x=200.4,y=242.2"  
*/  
toString:function() {  
return ("x=" + this.x + ",y=" + this.y);  
},  
 
/**  
* APIMethod: clone  
* Return a clone of this pixel object  
*  
* Returns:  
* {<OpenLayers.Pixel>} A clone pixel  
*/  
clone:function() {  
return new OpenLayers.Pixel(this.x, this.y);  
},  
 
/**  
* APIMethod: equals  
* Determine whether one pixel is equivalent to another  
*  
* Parameters:  
* px - {<OpenLayers.Pixel>}  
*  
* Returns:  
* {Boolean} The point passed in as parameter is equal to this. Note that  
* if px passed in is null, returns false.  
*/  
equals:function(px) {  
var equals = false;  
if (px != null) {  
equals = ((this.x == px.x && this.y == px.y) ||  
(isNaN(this.x) && isNaN(this.y) && isNaN(px.x) && isNaN(px.y)));  
}  
return equals;  
},  
 
/**  
* APIMethod: add  
*  
* Parameters:  
* x - {Integer}  
* y - {Integer}  
*  
* Returns:  
* {<OpenLayers.Pixel>} A new Pixel with this pixel's x&y augmented by the  
* values passed in.  
*/  
add:function(x, y) {  
if ( (x == null) || (y == null) ) {  
var msg = OpenLayers.i18n("pixelAddError");  
OpenLayers.Console.error(msg);  
return null;  
}  
return new OpenLayers.Pixel(this.x + x, this.y + y);  
},  
 
/**  
* APIMethod: offset  
*  
* Parameters  
* px - {<OpenLayers.Pixel>}  
*  
* Returns:  
* {<OpenLayers.Pixel>} A new Pixel with this pixel's x&y augmented by the  
* x&y values of the pixel passed in.  
*/  
offset:function(px) {  
var newPx = this.clone();  
if (px) {  
newPx = this.add(px.x, px.y);  
}  
return newPx;  
},  
 
CLASS_NAME: "OpenLayers.Pixel"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* Class: OpenLayers.Size  
* Instances of this class represent a width/height pair  
*/  
OpenLayers.Size = OpenLayers.Class({  
 
/**  
* APIProperty: w  
* {Number} width  
*/  
w: 0.0,  
 
/**  
* APIProperty: h  
* {Number} height  
*/  
h: 0.0,  
 
 
/**  
* Constructor: OpenLayers.Size  
* Create an instance of OpenLayers.Size  
*  
* Parameters:  
* w - {Number} width  
* h - {Number} height  
*/  
initialize: function(w, h) {  
this.w = parseFloat(w);  
this.h = parseFloat(h);  
},  
 
/**  
* Method: toString  
* Return the string representation of a size object  
*  
* Returns:  
* {String} The string representation of OpenLayers.Size object.  
* (ex. <i>"w=55,h=66"</i>)  
*/  
toString:function() {  
return ("w=" + this.w + ",h=" + this.h);  
},  
 
/**  
* APIMethod: clone  
* Create a clone of this size object  
*  
* Returns:  
* {<OpenLayers.Size>} A new OpenLayers.Size object with the same w and h  
* values  
*/  
clone:function() {  
return new OpenLayers.Size(this.w, this.h);  
},  
 
/**  
*  
* APIMethod: equals  
* Determine where this size is equal to another  
*  
* Parameters:  
* sz - {<OpenLayers.Size>}  
*  
* Returns:  
* {Boolean} The passed in size has the same h and w properties as this one.  
* Note that if sz passed in is null, returns false.  
*  
*/  
equals:function(sz) {  
var equals = false;  
if (sz != null) {  
equals = ((this.w == sz.w && this.h == sz.h) ||  
(isNaN(this.w) && isNaN(this.h) && isNaN(sz.w) && isNaN(sz.h)));  
}  
return equals;  
},  
 
CLASS_NAME: "OpenLayers.Size"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* Namespace: OpenLayers.Console  
* The OpenLayers.Console namespace is used for debugging and error logging.  
* If the Firebug Lite (../Firebug/firebug.js) is included before this script,  
* calls to OpenLayers.Console methods will get redirected to window.console.  
* This makes use of the Firebug extension where available and allows for  
* cross-browser debugging Firebug style.  
*  
* Note:  
* Note that behavior will differ with the Firebug extention and Firebug Lite.  
* Most notably, the Firebug Lite console does not currently allow for  
* hyperlinks to code or for clicking on object to explore their properties.  
*  
*/  
OpenLayers.Console = {  
/**  
* Create empty functions for all console methods. The real value of these  
* properties will be set if Firebug Lite (../Firebug/firebug.js script) is  
* included. We explicitly require the Firebug Lite script to trigger  
* functionality of the OpenLayers.Console methods.  
*/  
 
/**  
* APIFunction: log  
* Log an object in the console. The Firebug Lite console logs string  
* representation of objects. Given multiple arguments, they will  
* be cast to strings and logged with a space delimiter. If the first  
* argument is a string with printf-like formatting, subsequent arguments  
* will be used in string substitution. Any additional arguments (beyond  
* the number substituted in a format string) will be appended in a space-  
* delimited line.  
*  
* Parameters:  
* object - {Object}  
*/  
log: function() {},  
 
/**  
* APIFunction: debug  
* Writes a message to the console, including a hyperlink to the line  
* where it was called.  
*  
* May be called with multiple arguments as with OpenLayers.Console.log().  
*  
* Parameters:  
* object - {Object}  
*/  
debug: function() {},  
 
/**  
* APIFunction: info  
* Writes a message to the console with the visual "info" icon and color  
* coding and a hyperlink to the line where it was called.  
*  
* May be called with multiple arguments as with OpenLayers.Console.log().  
*  
* Parameters:  
* object - {Object}  
*/  
info: function() {},  
 
/**  
* APIFunction: warn  
* Writes a message to the console with the visual "warning" icon and  
* color coding and a hyperlink to the line where it was called.  
*  
* May be called with multiple arguments as with OpenLayers.Console.log().  
*  
* Parameters:  
* object - {Object}  
*/  
warn: function() {},  
 
/**  
* APIFunction: error  
* Writes a message to the console with the visual "error" icon and color  
* coding and a hyperlink to the line where it was called.  
*  
* May be called with multiple arguments as with OpenLayers.Console.log().  
*  
* Parameters:  
* object - {Object}  
*/  
error: function() {},  
 
/**  
* APIFunction: userError  
* A single interface for showing error messages to the user. The default  
* behavior is a Javascript alert, though this can be overridden by  
* reassigning OpenLayers.Console.userError to a different function.  
*  
* Expects a single error message  
*  
* Parameters:  
* object - {Object}  
*/  
userError: function(error) {  
alert(error);  
},  
 
/**  
* APIFunction: assert  
* Tests that an expression is true. If not, it will write a message to  
* the console and throw an exception.  
*  
* May be called with multiple arguments as with OpenLayers.Console.log().  
*  
* Parameters:  
* object - {Object}  
*/  
assert: function() {},  
 
/**  
* APIFunction: dir  
* Prints an interactive listing of all properties of the object. This  
* looks identical to the view that you would see in the DOM tab.  
*  
* Parameters:  
* object - {Object}  
*/  
dir: function() {},  
 
/**  
* APIFunction: dirxml  
* Prints the XML source tree of an HTML or XML element. This looks  
* identical to the view that you would see in the HTML tab. You can click  
* on any node to inspect it in the HTML tab.  
*  
* Parameters:  
* object - {Object}  
*/  
dirxml: function() {},  
 
/**  
* APIFunction: trace  
* Prints an interactive stack trace of JavaScript execution at the point  
* where it is called. The stack trace details the functions on the stack,  
* as well as the values that were passed as arguments to each function.  
* You can click each function to take you to its source in the Script tab,  
* and click each argument value to inspect it in the DOM or HTML tabs.  
*  
*/  
trace: function() {},  
 
/**  
* APIFunction: group  
* Writes a message to the console and opens a nested block to indent all  
* future messages sent to the console. Call OpenLayers.Console.groupEnd()  
* to close the block.  
*  
* May be called with multiple arguments as with OpenLayers.Console.log().  
*  
* Parameters:  
* object - {Object}  
*/  
group: function() {},  
 
/**  
* APIFunction: groupEnd  
* Closes the most recently opened block created by a call to  
* OpenLayers.Console.group  
*/  
groupEnd: function() {},  
 
/**  
* APIFunction: time  
* Creates a new timer under the given name. Call  
* OpenLayers.Console.timeEnd(name)  
* with the same name to stop the timer and print the time elapsed.  
*  
* Parameters:  
* name - {String}  
*/  
time: function() {},  
 
/**  
* APIFunction: timeEnd  
* Stops a timer created by a call to OpenLayers.Console.time(name) and  
* writes the time elapsed.  
*  
* Parameters:  
* name - {String}  
*/  
timeEnd: function() {},  
 
/**  
* APIFunction: profile  
* Turns on the JavaScript profiler. The optional argument title would  
* contain the text to be printed in the header of the profile report.  
*  
* This function is not currently implemented in Firebug Lite.  
*  
* Parameters:  
* title - {String} Optional title for the profiler  
*/  
profile: function() {},  
 
/**  
* APIFunction: profileEnd  
* Turns off the JavaScript profiler and prints its report.  
*  
* This function is not currently implemented in Firebug Lite.  
*/  
profileEnd: function() {},  
 
/**  
* APIFunction: count  
* Writes the number of times that the line of code where count was called  
* was executed. The optional argument title will print a message in  
* addition to the number of the count.  
*  
* This function is not currently implemented in Firebug Lite.  
*  
* Parameters:  
* title - {String} Optional title to be printed with count  
*/  
count: function() {},  
 
CLASS_NAME: "OpenLayers.Console"  
};  
 
/**  
* Execute an anonymous function to extend the OpenLayers.Console namespace  
* if the firebug.js script is included. This closure is used so that the  
* "scripts" and "i" variables don't pollute the global namespace.  
*/  
(function() {  
/**  
* If Firebug Lite is included (before this script), re-route all  
* OpenLayers.Console calls to the console object.  
*/  
var scripts = document.getElementsByTagName("script");  
for(var i=0, len=scripts.length; i<len; ++i) {  
if(scripts[i].src.indexOf("firebug.js") != -1) {  
if(console) {  
OpenLayers.Util.extend(OpenLayers.Console, console);  
break;  
}  
}  
}  
})();  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Console.js  
*/  
 
/**  
* Class: OpenLayers.Control  
* Controls affect the display or behavior of the map. They allow everything  
* from panning and zooming to displaying a scale indicator. Controls by  
* default are added to the map they are contained within however it is  
* possible to add a control to an external div by passing the div in the  
* options parameter.  
*  
* Example:  
* The following example shows how to add many of the common controls  
* to a map.  
*  
* > var map = new OpenLayers.Map('map', { controls: [] });  
* >  
* > map.addControl(new OpenLayers.Control.PanZoomBar());  
* > map.addControl(new OpenLayers.Control.MouseToolbar());  
* > map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));  
* > map.addControl(new OpenLayers.Control.Permalink());  
* > map.addControl(new OpenLayers.Control.Permalink('permalink'));  
* > map.addControl(new OpenLayers.Control.MousePosition());  
* > map.addControl(new OpenLayers.Control.OverviewMap());  
* > map.addControl(new OpenLayers.Control.KeyboardDefaults());  
*  
* The next code fragment is a quick example of how to intercept  
* shift-mouse click to display the extent of the bounding box  
* dragged out by the user. Usually controls are not created  
* in exactly this manner. See the source for a more complete  
* example:  
*  
* > var control = new OpenLayers.Control();  
* > OpenLayers.Util.extend(control, {  
* > draw: function () {  
* > // this Handler.Box will intercept the shift-mousedown  
* > // before Control.MouseDefault gets to see it  
* > this.box = new OpenLayers.Handler.Box( control,  
* > {"done": this.notice},  
* > {keyMask: OpenLayers.Handler.MOD_SHIFT});  
* > this.box.activate();  
* > },  
* >  
* > notice: function (bounds) {  
* > OpenLayers.Console.userError(bounds);  
* > }  
* > });  
* > map.addControl(control);  
*  
*/  
OpenLayers.Control = OpenLayers.Class({  
 
/**  
* Property: id  
* {String}  
*/  
id: null,  
 
/**  
* Property: map  
* {<OpenLayers.Map>} this gets set in the addControl() function in  
* OpenLayers.Map  
*/  
map: null,  
 
/**  
* Property: div  
* {DOMElement}  
*/  
div: null,  
 
/**  
* Property: type  
* {Number} Controls can have a 'type'. The type determines the type of  
* interactions which are possible with them when they are placed in an  
* <OpenLayers.Control.Panel>.  
*/  
type: null,  
 
/**  
* Property: allowSelection  
* {Boolean} By deafault, controls do not allow selection, because  
* it may interfere with map dragging. If this is true, OpenLayers  
* will not prevent selection of the control.  
* Default is false.  
*/  
allowSelection: false,  
 
/**  
* Property: displayClass  
* {string} This property is used for CSS related to the drawing of the  
* Control.  
*/  
displayClass: "",  
 
/**  
* Property: title  
* {string} This property is used for showing a tooltip over the  
* Control.  
*/  
title: "",  
 
/**  
* APIProperty: autoActivate  
* {Boolean} Activate the control when it is added to a map. Default is  
* false.  
*/  
autoActivate: false,  
 
/**  
* Property: active  
* {Boolean} The control is active.  
*/  
active: null,  
 
/**  
* Property: handler  
* {<OpenLayers.Handler>} null  
*/  
handler: null,  
 
/**  
* APIProperty: eventListeners  
* {Object} If set as an option at construction, the eventListeners  
* object will be registered with <OpenLayers.Events.on>. Object  
* structure must be a listeners object as shown in the example for  
* the events.on method.  
*/  
eventListeners: null,  
 
/**  
* Property: events  
* {<OpenLayers.Events>} Events instance for triggering control specific  
* events.  
*/  
events: null,  
 
/**  
* Constant: EVENT_TYPES  
* {Array(String)} Supported application event types. Register a listener  
* for a particular event with the following syntax:  
* (code)  
* control.events.register(type, obj, listener);  
* (end)  
*  
* Listeners will be called with a reference to an event object. The  
* properties of this event depends on exactly what happened.  
*  
* All event objects have at least the following properties:  
* object - {Object} A reference to control.events.object (a reference  
* to the control).  
* element - {DOMElement} A reference to control.events.element (which  
* will be null unless documented otherwise).  
*  
* Supported map event types:  
* activate - Triggered when activated.  
* deactivate - Triggered when deactivated.  
*/  
EVENT_TYPES: ["activate", "deactivate"],  
 
/**  
* Constructor: OpenLayers.Control  
* Create an OpenLayers Control. The options passed as a parameter  
* directly extend the control. For example passing the following:  
*  
* > var control = new OpenLayers.Control({div: myDiv});  
*  
* Overrides the default div attribute value of null.  
*  
* Parameters:  
* options - {Object}  
*/  
initialize: function (options) {  
// We do this before the extend so that instances can override  
// className in options.  
this.displayClass =  
this.CLASS_NAME.replace("OpenLayers.", "ol").replace(/\./g, "");  
 
OpenLayers.Util.extend(this, options);  
 
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 + "_");  
}  
},  
 
/**  
* Method: destroy  
* The destroy method is used to perform any clean up before the control  
* is dereferenced. Typically this is where event listeners are removed  
* to prevent memory leaks.  
*/  
destroy: function () {  
if(this.events) {  
if(this.eventListeners) {  
this.events.un(this.eventListeners);  
}  
this.events.destroy();  
this.events = null;  
}  
this.eventListeners = null;  
 
// eliminate circular references  
if (this.handler) {  
this.handler.destroy();  
this.handler = null;  
}  
if(this.handlers) {  
for(var key in this.handlers) {  
if(this.handlers.hasOwnProperty(key) &&  
typeof this.handlers[key].destroy == "function") {  
this.handlers[key].destroy();  
}  
}  
this.handlers = null;  
}  
if (this.map) {  
this.map.removeControl(this);  
this.map = null;  
}  
},  
 
/**  
* Method: setMap  
* Set the map property for the control. This is done through an accessor  
* so that subclasses can override this and take special action once  
* they have their map variable set.  
*  
* Parameters:  
* map - {<OpenLayers.Map>}  
*/  
setMap: function(map) {  
this.map = map;  
if (this.handler) {  
this.handler.setMap(map);  
}  
},  
 
/**  
* Method: draw  
* The draw method is called when the control is ready to be displayed  
* on the page. If a div has not been created one is created. Controls  
* with a visual component will almost always want to override this method  
* to customize the look of control.  
*  
* Parameters:  
* px - {<OpenLayers.Pixel>} The top-left pixel position of the control  
* or null.  
*  
* Returns:  
* {DOMElement} A reference to the DIV DOMElement containing the control  
*/  
draw: function (px) {  
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 (px != null) {  
this.position = px.clone();  
}  
this.moveTo(this.position);  
return this.div;  
},  
 
/**  
* Method: moveTo  
* Sets the left and top style attributes to the passed in pixel  
* coordinates.  
*  
* Parameters:  
* px - {<OpenLayers.Pixel>}  
*/  
moveTo: function (px) {  
if ((px != null) && (this.div != null)) {  
this.div.style.left = px.x + "px";  
this.div.style.top = px.y + "px";  
}  
},  
 
/**  
* Method: activate  
* Explicitly activates a control and it's associated  
* handler if one has been set. Controls can be  
* deactivated by calling the deactivate() method.  
*  
* Returns:  
* {Boolean} True if the control was successfully activated or  
* false if the control was already active.  
*/  
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;  
},  
 
/**  
* Method: deactivate  
* Deactivates a control and it's associated handler if any. The exact  
* effect of this depends on the control itself.  
*  
* Returns:  
* {Boolean} True if the control was effectively deactivated or false  
* if the control was already inactive.  
*/  
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"  
});  
 
/**  
* Constant: OpenLayers.Control.TYPE_BUTTON  
*/  
OpenLayers.Control.TYPE_BUTTON = 1;  
 
/**  
* Constant: OpenLayers.Control.TYPE_TOGGLE  
*/  
OpenLayers.Control.TYPE_TOGGLE = 2;  
 
/**  
* Constant: OpenLayers.Control.TYPE_TOOL  
*/  
OpenLayers.Control.TYPE_TOOL = 3;  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.ArgParser  
* The ArgParser control adds location bar querystring parsing functionality  
* to an OpenLayers Map.  
* When added to a Map control, on a page load/refresh, the Map will  
* automatically take the href string and parse it for lon, lat, zoom, and  
* layers information.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.ArgParser = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Parameter: center  
* {<OpenLayers.LonLat>}  
*/  
center: null,  
 
/**  
* Parameter: zoom  
* {int}  
*/  
zoom: null,  
 
/**  
* Parameter: layers  
* {Array(<OpenLayers.Layer>)}  
*/  
layers: null,  
 
/**  
* APIProperty: displayProjection  
* {<OpenLayers.Projection>} Requires proj4js support.  
* Projection used when reading the coordinates from the URL. This will  
*  
* reproject the map coordinates from the URL into the map's  
* projection.  
*  
* If you are using this functionality, be aware that any permalink  
* which is added to the map will determine the coordinate type which  
* is read from the URL, which means you should not add permalinks with  
* different displayProjections to the same map.  
*/  
displayProjection: null,  
 
/**  
* Constructor: OpenLayers.Control.ArgParser  
*  
* Parameters:  
* options - {Object}  
*/  
initialize: function(options) {  
OpenLayers.Control.prototype.initialize.apply(this, arguments);  
},  
 
/**  
* Method: setMap  
* Set the map property for the control.  
*  
* Parameters:  
* map - {<OpenLayers.Map>}  
*/  
setMap: function(map) {  
OpenLayers.Control.prototype.setMap.apply(this, arguments);  
 
//make sure we dont already have an arg parser attached  
for(var i=0, len=this.map.controls.length; i<len; i++) {  
var control = this.map.controls[i];  
if ( (control != this) &&  
(control.CLASS_NAME == "OpenLayers.Control.ArgParser") ) {  
 
// If a second argparser is added to the map, then we  
// override the displayProjection to be the one added to the  
// map.  
if (control.displayProjection != this.displayProjection) {  
this.displayProjection = control.displayProjection;  
}  
 
break;  
}  
}  
if (i == this.map.controls.length) {  
 
var args = OpenLayers.Util.getParameters();  
// Be careful to set layer first, to not trigger unnecessary layer loads  
if (args.layers) {  
this.layers = args.layers;  
 
// when we add a new layer, set its visibility  
this.map.events.register('addlayer', this,  
this.configureLayers);  
this.configureLayers();  
}  
if (args.lat && args.lon) {  
this.center = new OpenLayers.LonLat(parseFloat(args.lon),  
parseFloat(args.lat));  
if (args.zoom) {  
this.zoom = parseInt(args.zoom);  
}  
 
// when we add a new baselayer to see when we can set the center  
this.map.events.register('changebaselayer', this,  
this.setCenter);  
this.setCenter();  
}  
}  
},  
 
/**  
* Method: setCenter  
* As soon as a baseLayer has been loaded, we center and zoom  
* ...and remove the handler.  
*/  
setCenter: function() {  
 
if (this.map.baseLayer) {  
//dont need to listen for this one anymore  
this.map.events.unregister('changebaselayer', this,  
this.setCenter);  
 
if (this.displayProjection) {  
this.center.transform(this.displayProjection,  
this.map.getProjectionObject());  
}  
 
this.map.setCenter(this.center, this.zoom);  
}  
},  
 
/**  
* Method: configureLayers  
* As soon as all the layers are loaded, cycle through them and  
* hide or show them.  
*/  
configureLayers: function() {  
 
if (this.layers.length == this.map.layers.length) {  
this.map.events.unregister('addlayer', this, this.configureLayers);  
 
for(var i=0, len=this.layers.length; i<len; i++) {  
 
var layer = this.map.layers[i];  
var c = this.layers.charAt(i);  
 
if (c == "B") {  
this.map.setBaseLayer(layer);  
} else if ( (c == "T") || (c == "F") ) {  
layer.setVisibility(c == "T");  
}  
}  
}  
},  
 
CLASS_NAME: "OpenLayers.Control.ArgParser"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.Attribution  
* The attribution control adds attribution from layers to the map display.  
* It uses 'attribution' property of each layer.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.Attribution =  
OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* APIProperty: seperator  
* {String} String used to seperate layers.  
*/  
separator: ", ",  
 
/**  
* Constructor: OpenLayers.Control.Attribution  
*  
* Parameters:  
* options - {Object} Options for control.  
*/  
initialize: function(options) {  
OpenLayers.Control.prototype.initialize.apply(this, arguments);  
},  
 
/**  
* Method: destroy  
* Destroy control.  
*/  
destroy: function() {  
this.map.events.un({  
"removelayer": this.updateAttribution,  
"addlayer": this.updateAttribution,  
"changelayer": this.updateAttribution,  
"changebaselayer": this.updateAttribution,  
scope: this  
});  
 
OpenLayers.Control.prototype.destroy.apply(this, arguments);  
},  
 
/**  
* Method: draw  
* Initialize control.  
*  
* Returns:  
* {DOMElement} A reference to the DIV DOMElement containing the control  
*/  
draw: function() {  
OpenLayers.Control.prototype.draw.apply(this, arguments);  
 
this.map.events.on({  
'changebaselayer': this.updateAttribution,  
'changelayer': this.updateAttribution,  
'addlayer': this.updateAttribution,  
'removelayer': this.updateAttribution,  
scope: this  
});  
this.updateAttribution();  
 
return this.div;  
},  
 
/**  
* Method: updateAttribution  
* Update attribution string.  
*/  
updateAttribution: function() {  
var attributions = [];  
if (this.map && this.map.layers) {  
for(var i=0, len=this.map.layers.length; i<len; i++) {  
var layer = this.map.layers[i];  
if (layer.attribution && layer.getVisibility()) {  
// add attribution only if attribution text is unique  
if (OpenLayers.Util.indexOf(  
attributions, layer.attribution) === -1) {  
attributions.push( layer.attribution );  
}  
}  
}  
this.div.innerHTML = attributions.join(this.separator);  
}  
},  
 
CLASS_NAME: "OpenLayers.Control.Attribution"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.Button  
* The Button control is a very simple push-button, for use with  
* <OpenLayers.Control.Panel>.  
* When clicked, the function trigger() is executed.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*  
* Use:  
* (code)  
* var button = new OpenLayers.Control.Button({  
* displayClass: "MyButton", trigger: myFunction  
* });  
* panel.addControls([button]);  
* (end)  
*  
* Will create a button with CSS class MyButtonItemInactive, that  
* will call the function MyFunction() when clicked.  
*/  
OpenLayers.Control.Button = OpenLayers.Class(OpenLayers.Control, {  
/**  
* Property: type  
* {Integer} OpenLayers.Control.TYPE_BUTTON.  
*/  
type: OpenLayers.Control.TYPE_BUTTON,  
 
/**  
* Method: trigger  
* Called by a control panel when the button is clicked.  
*/  
trigger: function() {},  
 
CLASS_NAME: "OpenLayers.Control.Button"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Handler/Drag.js  
* @requires OpenLayers/Handler/Feature.js  
*/  
 
/**  
* Class: OpenLayers.Control.DragFeature  
* The DragFeature control moves a feature with a drag of the mouse. Create a  
* new control with the <OpenLayers.Control.DragFeature> constructor.  
*  
* Inherits From:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* APIProperty: geometryTypes  
* {Array(String)} To restrict dragging to a limited set of geometry types,  
* send a list of strings corresponding to the geometry class names.  
*/  
geometryTypes: null,  
 
/**  
* APIProperty: onStart  
* {Function} Define this function if you want to know when a drag starts.  
* The function should expect to receive two arguments: the feature  
* that is about to be dragged and the pixel location of the mouse.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>} The feature that is about to be  
* dragged.  
* pixel - {<OpenLayers.Pixel>} The pixel location of the mouse.  
*/  
onStart: function(feature, pixel) {},  
 
/**  
* APIProperty: onDrag  
* {Function} Define this function if you want to know about each move of a  
* feature. The function should expect to receive two arguments: the  
* feature that is being dragged and the pixel location of the mouse.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>} The feature that was dragged.  
* pixel - {<OpenLayers.Pixel>} The pixel location of the mouse.  
*/  
onDrag: function(feature, pixel) {},  
 
/**  
* APIProperty: onComplete  
* {Function} Define this function if you want to know when a feature is  
* done dragging. The function should expect to receive two arguments:  
* the feature that is being dragged and the pixel location of the  
* mouse.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>} The feature that was dragged.  
* pixel - {<OpenLayers.Pixel>} The pixel location of the mouse.  
*/  
onComplete: function(feature, pixel) {},  
 
/**  
* APIProperty: documentDrag  
* {Boolean} If set to true, mouse dragging will continue even if the  
* mouse cursor leaves the map viewport. Default is false.  
*/  
documentDrag: false,  
 
/**  
* Property: layer  
* {<OpenLayers.Layer.Vector>}  
*/  
layer: null,  
 
/**  
* Property: feature  
* {<OpenLayers.Feature.Vector>}  
*/  
feature: null,  
 
/**  
* Property: dragCallbacks  
* {Object} The functions that are sent to the drag handler for callback.  
*/  
dragCallbacks: {},  
 
/**  
* Property: featureCallbacks  
* {Object} The functions that are sent to the feature handler for callback.  
*/  
featureCallbacks: {},  
 
/**  
* Property: lastPixel  
* {<OpenLayers.Pixel>}  
*/  
lastPixel: null,  
 
/**  
* Constructor: OpenLayers.Control.DragFeature  
* Create a new control to drag features.  
*  
* Parameters:  
* layer - {<OpenLayers.Layer.Vector>} The layer containing features to be  
* dragged.  
* options - {Object} Optional object whose properties will be set on the  
* control.  
*/  
initialize: function(layer, options) {  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
this.layer = layer;  
this.handlers = {  
drag: new OpenLayers.Handler.Drag(  
this, OpenLayers.Util.extend({  
down: this.downFeature,  
move: this.moveFeature,  
up: this.upFeature,  
out: this.cancel,  
done: this.doneDragging  
}, this.dragCallbacks), {  
documentDrag: this.documentDrag  
}  
),  
feature: new OpenLayers.Handler.Feature(  
this, this.layer, OpenLayers.Util.extend({  
over: this.overFeature,  
out: this.outFeature  
}, this.featureCallbacks),  
{geometryTypes: this.geometryTypes}  
)  
};  
},  
 
/**  
* APIMethod: destroy  
* Take care of things that are not handled in superclass  
*/  
destroy: function() {  
this.layer = null;  
OpenLayers.Control.prototype.destroy.apply(this, []);  
},  
 
/**  
* APIMethod: activate  
* Activate the control and the feature handler.  
*  
* Returns:  
* {Boolean} Successfully activated the control and feature handler.  
*/  
activate: function() {  
return (this.handlers.feature.activate() &&  
OpenLayers.Control.prototype.activate.apply(this, arguments));  
},  
 
/**  
* APIMethod: deactivate  
* Deactivate the control and all handlers.  
*  
* Returns:  
* {Boolean} Successfully deactivated the control.  
*/  
deactivate: function() {  
// the return from the handlers is unimportant in this case  
this.handlers.drag.deactivate();  
this.handlers.feature.deactivate();  
this.feature = null;  
this.dragging = false;  
this.lastPixel = null;  
OpenLayers.Element.removeClass(  
this.map.viewPortDiv, this.displayClass + "Over"  
);  
return OpenLayers.Control.prototype.deactivate.apply(this, arguments);  
},  
 
/**  
* Method: overFeature  
* Called when the feature handler detects a mouse-over on a feature.  
* This activates the drag handler.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>} The selected feature.  
*/  
overFeature: function(feature) {  
if(!this.handlers.drag.dragging) {  
this.feature = feature;  
this.handlers.drag.activate();  
this.over = true;  
OpenLayers.Element.addClass(this.map.viewPortDiv, this.displayClass + "Over");  
} else {  
if(this.feature.id == feature.id) {  
this.over = true;  
} else {  
this.over = false;  
}  
}  
},  
 
/**  
* Method: downFeature  
* Called when the drag handler detects a mouse-down.  
*  
* Parameters:  
* pixel - {<OpenLayers.Pixel>} Location of the mouse event.  
*/  
downFeature: function(pixel) {  
this.lastPixel = pixel;  
this.onStart(this.feature, pixel);  
},  
 
/**  
* Method: moveFeature  
* Called when the drag handler detects a mouse-move. Also calls the  
* optional onDrag method.  
*  
* Parameters:  
* pixel - {<OpenLayers.Pixel>} Location of the mouse event.  
*/  
moveFeature: function(pixel) {  
var res = this.map.getResolution();  
this.feature.geometry.move(res * (pixel.x - this.lastPixel.x),  
res * (this.lastPixel.y - pixel.y));  
this.layer.drawFeature(this.feature);  
this.lastPixel = pixel;  
this.onDrag(this.feature, pixel);  
},  
 
/**  
* Method: upFeature  
* Called when the drag handler detects a mouse-up.  
*  
* Parameters:  
* pixel - {<OpenLayers.Pixel>} Location of the mouse event.  
*/  
upFeature: function(pixel) {  
if(!this.over) {  
this.handlers.drag.deactivate();  
}  
},  
 
/**  
* Method: doneDragging  
* Called when the drag handler is done dragging.  
*  
* Parameters:  
* pixel - {<OpenLayers.Pixel>} The last event pixel location. If this event  
* came from a mouseout, this may not be in the map viewport.  
*/  
doneDragging: function(pixel) {  
this.onComplete(this.feature, pixel);  
},  
 
/**  
* Method: outFeature  
* Called when the feature handler detects a mouse-out on a feature.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>} The feature that the mouse left.  
*/  
outFeature: function(feature) {  
if(!this.handlers.drag.dragging) {  
this.over = false;  
this.handlers.drag.deactivate();  
OpenLayers.Element.removeClass(  
this.map.viewPortDiv, this.displayClass + "Over"  
);  
this.feature = null;  
} else {  
if(this.feature.id == feature.id) {  
this.over = false;  
}  
}  
},  
 
/**  
* Method: cancel  
* Called when the drag handler detects a mouse-out (from the map viewport).  
*/  
cancel: function() {  
this.handlers.drag.deactivate();  
this.over = false;  
},  
 
/**  
* Method: setMap  
* Set the map property for the control and all handlers.  
*  
* Parameters:  
* map - {<OpenLayers.Map>} The control's map.  
*/  
setMap: function(map) {  
this.handlers.drag.setMap(map);  
this.handlers.feature.setMap(map);  
OpenLayers.Control.prototype.setMap.apply(this, arguments);  
},  
 
CLASS_NAME: "OpenLayers.Control.DragFeature"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Handler/Drag.js  
*/  
 
/**  
* Class: OpenLayers.Control.DragPan  
* The DragPan control pans the map with a drag of the mouse.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Property: type  
* {OpenLayers.Control.TYPES}  
*/  
type: OpenLayers.Control.TYPE_TOOL,  
 
/**  
* Property: panned  
* {Boolean} The map moved.  
*/  
panned: false,  
 
/**  
* Property: interval  
* {Integer} The number of milliseconds that should ellapse before  
* panning the map again. Set this to increase dragging performance.  
* Defaults to 25 milliseconds.  
*/  
interval: 25,  
 
/**  
* APIProperty: documentDrag  
* {Boolean} If set to true, mouse dragging will continue even if the  
* mouse cursor leaves the map viewport. Default is false.  
*/  
documentDrag: false,  
 
/**  
* Method: draw  
* Creates a Drag handler, using <panMap> and  
* <panMapDone> as callbacks.  
*/  
draw: function() {  
this.handler = new OpenLayers.Handler.Drag(this, {  
"move": this.panMap,  
"done": this.panMapDone  
}, {  
interval: this.interval,  
documentDrag: this.documentDrag  
}  
);  
},  
 
/**  
* Method: panMap  
*  
* Parameters:  
* xy - {<OpenLayers.Pixel>} Pixel of the mouse position  
*/  
panMap: function(xy) {  
this.panned = true;  
this.map.pan(  
this.handler.last.x - xy.x,  
this.handler.last.y - xy.y,  
{dragging: this.handler.dragging, animate: false}  
);  
},  
 
/**  
* Method: panMapDone  
* Finish the panning operation. Only call setCenter (through <panMap>)  
* if the map has actually been moved.  
*  
* Parameters:  
* xy - {<OpenLayers.Pixel>} Pixel of the mouse position  
*/  
panMapDone: function(xy) {  
if(this.panned) {  
this.panMap(xy);  
this.panned = false;  
}  
},  
 
CLASS_NAME: "OpenLayers.Control.DragPan"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Feature/Vector.js  
*/  
 
/**  
* Class: OpenLayers.Control.DrawFeature  
* The DrawFeature control draws point, line or polygon features on a vector  
* layer when active.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.DrawFeature = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Property: layer  
* {<OpenLayers.Layer.Vector>}  
*/  
layer: null,  
 
/**  
* Property: callbacks  
* {Object} The functions that are sent to the handler for callback  
*/  
callbacks: null,  
 
/**  
* Constant: EVENT_TYPES  
*  
* Supported event types:  
* featureadded - Triggered when a feature is added  
*/  
EVENT_TYPES: ["featureadded"],  
 
/**  
* APIProperty: multi  
* {Boolean} Cast features to multi-part geometries before passing to the  
* layer. Default is false.  
*/  
multi: false,  
 
/**  
* APIProperty: featureAdded  
* {Function} Called after each feature is added  
*/  
featureAdded: function() {},  
 
/**  
* APIProperty: handlerOptions  
* {Object} Used to set non-default properties on the control's handler  
*/  
handlerOptions: null,  
 
/**  
* Constructor: OpenLayers.Control.DrawFeature  
*  
* Parameters:  
* layer - {<OpenLayers.Layer.Vector>}  
* handler - {<OpenLayers.Handler>}  
* options - {Object}  
*/  
initialize: function(layer, handler, options) {  
 
// concatenate events specific to vector with those from the base  
this.EVENT_TYPES =  
OpenLayers.Control.DrawFeature.prototype.EVENT_TYPES.concat(  
OpenLayers.Control.prototype.EVENT_TYPES  
);  
 
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
this.callbacks = OpenLayers.Util.extend(  
{  
done: this.drawFeature,  
modify: function(vertex, feature) {  
this.layer.events.triggerEvent(  
"sketchmodified", {vertex: vertex, feature: feature}  
);  
},  
create: function(vertex, feature) {  
this.layer.events.triggerEvent(  
"sketchstarted", {vertex: vertex, feature: feature}  
);  
}  
},  
this.callbacks  
);  
this.layer = layer;  
this.handlerOptions = this.handlerOptions || {};  
if (!("multi" in this.handlerOptions)) {  
this.handlerOptions.multi = this.multi;  
}  
var sketchStyle = this.layer.styleMap && this.layer.styleMap.styles.temporary;  
if(sketchStyle) {  
this.handlerOptions.layerOptions = OpenLayers.Util.applyDefaults(  
this.handlerOptions.layerOptions,  
{styleMap: new OpenLayers.StyleMap({"default": sketchStyle})}  
);  
}  
this.handler = new handler(this, this.callbacks, this.handlerOptions);  
},  
 
/**  
* Method: drawFeature  
*/  
drawFeature: function(geometry) {  
var feature = new OpenLayers.Feature.Vector(geometry);  
var proceed = this.layer.events.triggerEvent(  
"sketchcomplete", {feature: feature}  
);  
if(proceed !== false) {  
feature.state = OpenLayers.State.INSERT;  
this.layer.addFeatures([feature]);  
this.featureAdded(feature);  
this.events.triggerEvent("featureadded",{feature : feature});  
}  
},  
 
CLASS_NAME: "OpenLayers.Control.DrawFeature"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control/Panel.js  
* @requires OpenLayers/Control/Navigation.js  
* @requires OpenLayers/Control/DrawFeature.js  
* @requires OpenLayers/Handler/Point.js  
* @requires OpenLayers/Handler/Path.js  
* @requires OpenLayers/Handler/Polygon.js  
*/  
 
/**  
* Class: OpenLayers.Control.EditingToolbar  
* The EditingToolbar is a panel of 4 controls to draw polygons, lines,  
* points, or to navigate the map by panning. By default it appears in the  
* upper right corner of the map.  
*  
* Inherits from:  
* - <OpenLayers.Control.Panel>  
*/  
OpenLayers.Control.EditingToolbar = OpenLayers.Class(  
OpenLayers.Control.Panel, {  
 
/**  
* Constructor: OpenLayers.Control.EditingToolbar  
* Create an editing toolbar for a given layer.  
*  
* Parameters:  
* layer - {<OpenLayers.Layer.Vector>}  
* options - {Object}  
*/  
initialize: function(layer, options) {  
OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);  
 
this.addControls(  
[ new OpenLayers.Control.Navigation() ]  
);  
var controls = [  
new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Point, {'displayClass': 'olControlDrawFeaturePoint'}),  
new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Path, {'displayClass': 'olControlDrawFeaturePath'}),  
new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Polygon, {'displayClass': 'olControlDrawFeaturePolygon'})  
];  
this.addControls(controls);  
},  
 
/**  
* Method: draw  
* calls the default draw, and then activates mouse defaults.  
*  
* Returns:  
* {DOMElement}  
*/  
draw: function() {  
var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);  
this.activateControl(this.controls[0]);  
return div;  
},  
 
CLASS_NAME: "OpenLayers.Control.EditingToolbar"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Handler/Click.js  
* @requires OpenLayers/Handler/Box.js  
* @requires OpenLayers/Handler/Hover.js  
* @requires OpenLayers/Filter/Spatial.js  
*/  
 
/**  
* Class: OpenLayers.Control.GetFeature  
* Gets vector features for locations underneath the mouse cursor. Can be  
* configured to act on click, hover or dragged boxes. Uses an  
* <OpenLayers.Protocol> that supports spatial filters to retrieve  
* features from a server and fires events that notify applications of the  
* selected features.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* APIProperty: protocol  
* {<OpenLayers.Protocol>} Required. The protocol used for fetching  
* features.  
*/  
protocol: null,  
 
/**  
* APIProperty: multipleKey  
* {String} An event modifier ('altKey' or 'shiftKey') that temporarily sets  
* the <multiple> property to true. Default is null.  
*/  
multipleKey: null,  
 
/**  
* APIProperty: toggleKey  
* {String} An event modifier ('altKey' or 'shiftKey') that temporarily sets  
* the <toggle> property to true. Default is null.  
*/  
toggleKey: null,  
 
/**  
* Property: modifiers  
* {Object} The event modifiers to use, according to the current event  
* being handled by this control's handlers  
*/  
modifiers: null,  
 
/**  
* APIProperty: multiple  
* {Boolean} Allow selection of multiple geometries. Default is false.  
*/  
multiple: false,  
 
/**  
* APIProperty: click  
* {Boolean} Use a click handler for selecting/unselecting features. If  
* both <click> and <box> are set to true, the click handler takes  
* precedence over the box handler if a box with zero extent was  
* selected. Default is true.  
*/  
click: true,  
 
/**  
* APIProperty: single  
* {Boolean} Tells whether select by click should select a single  
* feature. If set to false, all matching features are selected.  
* If set to true, only the best matching feature is selected.  
* This option has an effect only of the <click> option is set  
* to true. Default is true.  
*/  
single: true,  
 
/**  
* APIProperty: clickout  
* {Boolean} Unselect features when clicking outside any feature.  
* Applies only if <click> is true. Default is true.  
*/  
clickout: true,  
 
/**  
* APIProperty: toggle  
* {Boolean} Unselect a selected feature on click. Applies only if  
* <click> is true. Default is false.  
*/  
toggle: false,  
 
/**  
* APIProperty: clickTolerance  
* {Integer} Tolerance for the filter query in pixels. This has the  
* same effect as the tolerance parameter on WMS GetFeatureInfo  
* requests. Will be ignored for box selections. Applies only if  
* <click> or <hover> is true. Default is 5. Note that this not  
* only affects requests on click, but also on hover.  
*/  
clickTolerance: 5,  
 
/**  
* APIProperty: hover  
* {Boolean} Send feature requests on mouse moves. Default is false.  
*/  
hover: false,  
 
/**  
* APIProperty: box  
* {Boolean} Allow feature selection by drawing a box. If set to  
* true set <click> to false to disable the click handler and  
* rely on the box handler only, even for "zero extent" boxes.  
* See the description of the <click> option for additional  
* information. Default is false.  
*/  
box: false,  
 
/**  
* APIProperty: maxFeatures  
* {Integer} Maximum number of features to return from a query in single mode  
* if supported by the <protocol>. This set of features is then used to  
* determine the best match client-side. Default is 10.  
*/  
maxFeatures: 10,  
 
/**  
* Property: features  
* {Object} Hash of {<OpenLayers.Feature.Vector>}, keyed by fid, holding  
* the currently selected features  
*/  
features: null,  
 
/**  
* Proeprty: hoverFeature  
* {<OpenLayers.Feature.Vector>} The feature currently selected by the  
* hover handler  
*/  
hoverFeature: null,  
 
/**  
* APIProperty: handlerOptions  
* {Object} Additional options for the handlers used by this control. This  
* is a hash with the keys "click", "box" and "hover".  
*/  
handlerOptions: null,  
 
/**  
* Property: handlers  
* {Object} Object with references to multiple <OpenLayers.Handler>  
* instances.  
*/  
handlers: null,  
 
/**  
* Property: hoverResponse  
* {<OpenLayers.Protocol.Response>} The response object associated with  
* the currently running hover request (if any).  
*/  
hoverResponse: null,  
 
/**  
* Property: filterType  
* {<String>} The type of filter to use when sending off a request.  
* Possible values:  
* OpenLayers.Filter.Spatial.<BBOX|INTERSECTS|WITHIN|CONTAINS>  
* Defaults to: OpenLayers.Filter.Spatial.BBOX  
*/  
filterType: OpenLayers.Filter.Spatial.BBOX,  
 
/**  
* Constant: EVENT_TYPES  
*  
* Supported event types:  
* beforefeatureselected - Triggered when <click> is true before a  
* feature is selected. The event object has a feature property with  
* the feature about to select  
* featureselected - Triggered when <click> is true and a feature is  
* selected. The event object has a feature property with the  
* selected feature  
* beforefeaturesselected - Triggered when <click> is true before a  
* set of features is selected. The event object is an array of  
* feature properties with the features about to be selected.  
* Return false after receiving this event to discontinue processing  
* of all featureselected events and the featuresselected event.  
* featuresselected - Triggered when <click> is true and a set of  
* features is selected. The event object is an array of feature  
* properties of the selected features  
* featureunselected - Triggered when <click> is true and a feature is  
* unselected. The event object has a feature property with the  
* unselected feature  
* clickout - Triggered when when <click> is true and no feature was  
* selected.  
* hoverfeature - Triggered when <hover> is true and the mouse has  
* stopped over a feature  
* outfeature - Triggered when <hover> is true and the mouse moves  
* moved away from a hover-selected feature  
*/  
EVENT_TYPES: ["featureselected", "featuresselected", "featureunselected",  
"clickout", "beforefeatureselected", "beforefeaturesselected",  
"hoverfeature", "outfeature"],  
 
/**  
* Constructor: OpenLayers.Control.GetFeature  
* Create a new control for fetching remote features.  
*  
* Parameters:  
* options - {Object} A configuration object which at least has to contain  
* a <protocol> property  
*/  
initialize: function(options) {  
// concatenate events specific to vector with those from the base  
this.EVENT_TYPES =  
OpenLayers.Control.GetFeature.prototype.EVENT_TYPES.concat(  
OpenLayers.Control.prototype.EVENT_TYPES  
);  
 
options.handlerOptions = options.handlerOptions || {};  
 
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
 
this.features = {};  
 
this.handlers = {};  
 
if(this.click) {  
this.handlers.click = new OpenLayers.Handler.Click(this,  
{click: this.selectClick}, this.handlerOptions.click || {});  
}  
 
if(this.box) {  
this.handlers.box = new OpenLayers.Handler.Box(  
this, {done: this.selectBox},  
OpenLayers.Util.extend(this.handlerOptions.box, {  
boxDivClassName: "olHandlerBoxSelectFeature"  
})  
);  
}  
 
if(this.hover) {  
this.handlers.hover = new OpenLayers.Handler.Hover(  
this, {'move': this.cancelHover, 'pause': this.selectHover},  
OpenLayers.Util.extend(this.handlerOptions.hover, {  
'delay': 250  
})  
);  
}  
},  
 
/**  
* Method: activate  
* Activates the control.  
*  
* Returns:  
* {Boolean} The control was effectively activated.  
*/  
activate: function () {  
if (!this.active) {  
for(var i in this.handlers) {  
this.handlers[i].activate();  
}  
}  
return OpenLayers.Control.prototype.activate.apply(  
this, arguments  
);  
},  
 
/**  
* Method: deactivate  
* Deactivates the control.  
*  
* Returns:  
* {Boolean} The control was effectively deactivated.  
*/  
deactivate: function () {  
if (this.active) {  
for(var i in this.handlers) {  
this.handlers[i].deactivate();  
}  
}  
return OpenLayers.Control.prototype.deactivate.apply(  
this, arguments  
);  
},  
 
/**  
* Method: selectClick  
* Called on click  
*  
* Parameters:  
* evt - {<OpenLayers.Event>}  
*/  
selectClick: function(evt) {  
var bounds = this.pixelToBounds(evt.xy);  
 
this.setModifiers(evt);  
this.request(bounds, {single: this.single});  
},  
 
/**  
* Method: selectBox  
* Callback from the handlers.box set up when <box> selection is on  
*  
* Parameters:  
* position - {<OpenLayers.Bounds>}  
*/  
selectBox: function(position) {  
var bounds;  
if (position instanceof OpenLayers.Bounds) {  
var minXY = this.map.getLonLatFromPixel(  
new OpenLayers.Pixel(position.left, position.bottom)  
);  
var maxXY = this.map.getLonLatFromPixel(  
new OpenLayers.Pixel(position.right, position.top)  
);  
bounds = new OpenLayers.Bounds(  
minXY.lon, minXY.lat, maxXY.lon, maxXY.lat  
);  
 
} else {  
if(this.click) {  
// box without extent - let the click handler take care of it  
return;  
}  
bounds = this.pixelToBounds(position);  
}  
this.setModifiers(this.handlers.box.dragHandler.evt);  
this.request(bounds);  
},  
 
/**  
* Method selectHover  
* Callback from the handlers.hover set up when <hover> selection is on  
*  
* Parameters:  
* evt {Object} - event object with an xy property  
*/  
selectHover: function(evt) {  
var bounds = this.pixelToBounds(evt.xy);  
this.request(bounds, {single: true, hover: true});  
},  
 
/**  
* Method: cancelHover  
* Callback from the handlers.hover set up when <hover> selection is on  
*/  
cancelHover: function() {  
if (this.hoverResponse) {  
this.protocol.abort(this.hoverResponse);  
this.hoverResponse = null;  
 
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");  
}  
},  
 
/**  
* Method: request  
* Sends a GetFeature request to the WFS  
*  
* Parameters:  
* bounds - {<OpenLayers.Bounds>} bounds for the request's BBOX filter  
* options - {Object} additional options for this method.  
*  
* Supported options include:  
* single - {Boolean} A single feature should be returned.  
* Note that this will be ignored if the protocol does not  
* return the geometries of the features.  
* hover - {Boolean} Do the request for the hover handler.  
*/  
request: function(bounds, options) {  
options = options || {};  
var filter = new OpenLayers.Filter.Spatial({  
type: this.filterType,  
value: bounds  
});  
 
// Set the cursor to "wait" to tell the user we're working.  
OpenLayers.Element.addClass(this.map.viewPortDiv, "olCursorWait");  
 
var response = this.protocol.read({  
maxFeatures: options.single == true ? this.maxFeatures : undefined,  
filter: filter,  
callback: function(result) {  
if(result.success()) {  
if(result.features.length) {  
if(options.single == true) {  
this.selectBestFeature(result.features,  
bounds.getCenterLonLat(), options);  
} else {  
this.select(result.features);  
}  
} else if(options.hover) {  
this.hoverSelect();  
} else {  
this.events.triggerEvent("clickout");  
if(this.clickout) {  
this.unselectAll();  
}  
}  
}  
// Reset the cursor.  
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");  
},  
scope: this  
});  
if(options.hover == true) {  
this.hoverResponse = response;  
}  
},  
 
/**  
* Method: selectBestFeature  
* Selects the feature from an array of features that is the best match  
* for the click position.  
*  
* Parameters:  
* features - {Array(<OpenLayers.Feature.Vector>)}  
* clickPosition - {<OpenLayers.LonLat>}  
* options - {Object} additional options for this method  
*  
* Supported options include:  
* hover - {Boolean} Do the selection for the hover handler.  
*/  
selectBestFeature: function(features, clickPosition, options) {  
options = options || {};  
if(features.length) {  
var point = new OpenLayers.Geometry.Point(clickPosition.lon,  
clickPosition.lat);  
var feature, resultFeature, dist;  
var minDist = Number.MAX_VALUE;  
for(var i=0; i<features.length; ++i) {  
feature = features[i];  
if(feature.geometry) {  
dist = point.distanceTo(feature.geometry, {edge: false});  
if(dist < minDist) {  
minDist = dist;  
resultFeature = feature;  
if(minDist == 0) {  
break;  
}  
}  
}  
}  
 
if(options.hover == true) {  
this.hoverSelect(resultFeature);  
} else {  
this.select(resultFeature || features);  
}  
}  
},  
 
/**  
* Method: setModifiers  
* Sets the multiple and toggle modifiers according to the current event  
*  
* Parameters:  
* evt {<OpenLayers.Event>}  
*/  
setModifiers: function(evt) {  
this.modifiers = {  
multiple: this.multiple || (this.multipleKey && evt[this.multipleKey]),  
toggle: this.toggle || (this.toggleKey && evt[this.toggleKey])  
};  
},  
 
/**  
* Method: select  
* Add feature to the hash of selected features and trigger the  
* featureselected and featuresselected events.  
*  
* Parameters:  
* features - {<OpenLayers.Feature.Vector>} or an array of features  
*/  
select: function(features) {  
if(!this.modifiers.multiple && !this.modifiers.toggle) {  
this.unselectAll();  
}  
if(!(features instanceof Array)) {  
features = [features];  
}  
 
var cont = this.events.triggerEvent("beforefeaturesselected", {  
features: features  
});  
if(cont !== false) {  
var selectedFeatures = [];  
var feature;  
for(var i=0, len=features.length; i<len; ++i) {  
feature = features[i];  
if(this.features[feature.fid || feature.id]) {  
if(this.modifiers.toggle) {  
this.unselect(this.features[feature.fid || feature.id]);  
}  
} else {  
cont = this.events.triggerEvent("beforefeatureselected", {  
feature: feature  
});  
if(cont !== false) {  
this.features[feature.fid || feature.id] = feature;  
selectedFeatures.push(feature);  
 
this.events.triggerEvent("featureselected",  
{feature: feature});  
}  
}  
}  
this.events.triggerEvent("featuresselected", {  
features: selectedFeatures  
});  
}  
},  
 
/**  
* Method: hoverSelect  
* Sets/unsets the <hoverFeature>  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>} the feature to hover-select.  
* If none is provided, the current <hoverFeature> will be nulled and  
* the outfeature event will be triggered.  
*/  
hoverSelect: function(feature) {  
var fid = feature ? feature.fid || feature.id : null;  
var hfid = this.hoverFeature ?  
this.hoverFeature.fid || this.hoverFeature.id : null;  
 
if(hfid && hfid != fid) {  
this.events.triggerEvent("outfeature",  
{feature: this.hoverFeature});  
this.hoverFeature = null;  
}  
if(fid && fid != hfid) {  
this.events.triggerEvent("hoverfeature", {feature: feature});  
this.hoverFeature = feature;  
}  
},  
 
/**  
* Method: unselect  
* Remove feature from the hash of selected features and trigger the  
* featureunselected event.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>}  
*/  
unselect: function(feature) {  
delete this.features[feature.fid || feature.id];  
this.events.triggerEvent("featureunselected", {feature: feature});  
},  
 
/**  
* Method: unselectAll  
* Unselect all selected features.  
*/  
unselectAll: function() {  
// we'll want an option to supress notification here  
for(var fid in this.features) {  
this.unselect(this.features[fid]);  
}  
},  
 
/**  
* Method: setMap  
* Set the map property for the control.  
*  
* Parameters:  
* map - {<OpenLayers.Map>}  
*/  
setMap: function(map) {  
for(var i in this.handlers) {  
this.handlers[i].setMap(map);  
}  
OpenLayers.Control.prototype.setMap.apply(this, arguments);  
},  
 
/**  
* Method: pixelToBounds  
* Takes a pixel as argument and creates bounds after adding the  
* <clickTolerance>.  
*  
* Parameters:  
* pixel - {<OpenLayers.Pixel>}  
*/  
pixelToBounds: function(pixel) {  
var llPx = pixel.add(-this.clickTolerance/2, this.clickTolerance/2);  
var urPx = pixel.add(this.clickTolerance/2, -this.clickTolerance/2);  
var ll = this.map.getLonLatFromPixel(llPx);  
var ur = this.map.getLonLatFromPixel(urPx);  
return new OpenLayers.Bounds(ll.lon, ll.lat, ur.lon, ur.lat);  
},  
 
CLASS_NAME: "OpenLayers.Control.GetFeature"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.Graticule  
* The Graticule displays a grid of latitude/longitude lines reprojected on  
* the map.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*  
*/  
OpenLayers.Control.Graticule = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* APIProperty: autoActivate  
* {Boolean} Activate the control when it is added to a map. Default is  
* true.  
*/  
autoActivate: true,  
 
/**  
* APIProperty: intervals  
* {Array(Float)} A list of possible graticule widths in degrees.  
*/  
intervals: [ 45, 30, 20, 10, 5, 2, 1,  
0.5, 0.2, 0.1, 0.05, 0.01,  
0.005, 0.002, 0.001 ],  
 
/**  
* APIProperty: displayInLayerSwitcher  
* {Boolean} Allows the Graticule control to be switched on and off by  
* LayerSwitcher control. Defaults is true.  
*/  
displayInLayerSwitcher: true,  
 
/**  
* APIProperty: visible  
* {Boolean} should the graticule be initially visible (default=true)  
*/  
visible: true,  
 
/**  
* APIProperty: numPoints  
* {Integer} The number of points to use in each graticule line. Higher  
* numbers result in a smoother curve for projected maps  
*/  
numPoints: 50,  
 
/**  
* APIProperty: targetSize  
* {Integer} The maximum size of the grid in pixels on the map  
*/  
targetSize: 200,  
 
/**  
* APIProperty: layerName  
* {String} The name to be displayed in the layer switcher, default is set  
* by {<OpenLayers.Lang>}.  
*/  
layerName: null,  
 
/**  
* APIProperty: labelled  
* {Boolean} Should the graticule lines be labelled?. default=true  
*/  
labelled: true,  
 
/**  
* APIProperty: labelFormat  
* {String} the format of the labels, default = 'dm'. See  
* <OpenLayers.Util.getFormattedLonLat> for other options.  
*/  
labelFormat: 'dm',  
 
/**  
* APIProperty: lineSymbolizer  
* {symbolizer} the symbolizer used to render lines  
*/  
lineSymbolizer: {  
strokeColor: "#333",  
strokeWidth: 1,  
strokeOpacity: 0.5  
},  
 
/**  
* APIProperty: labelSymbolizer  
* {symbolizer} the symbolizer used to render labels  
*/  
labelSymbolizer: {},  
 
/**  
* Property: gratLayer  
* {OpenLayers.Layer.Vector} vector layer used to draw the graticule on  
*/  
gratLayer: null,  
 
/**  
* Constructor: OpenLayers.Control.Graticule  
* Create a new graticule control to display a grid of latitude longitude  
* lines.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be used  
* to extend the control.  
*/  
initialize: function(options) {  
options = options || {};  
options.layerName = options.layerName || OpenLayers.i18n("graticule");  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
 
this.labelSymbolizer.stroke = false;  
this.labelSymbolizer.fill = false;  
this.labelSymbolizer.label = "${label}";  
this.labelSymbolizer.labelAlign = "${labelAlign}";  
this.labelSymbolizer.labelXOffset = "${xOffset}";  
this.labelSymbolizer.labelYOffset = "${yOffset}";  
},  
 
/**  
* APIMethod: destroy  
*/  
destroy: function() {  
this.deactivate();  
OpenLayers.Control.prototype.destroy.apply(this, arguments);  
if (this.gratLayer) {  
this.gratLayer.destroy();  
this.gratLayer = null;  
}  
},  
 
/**  
* Method: draw  
*  
* initializes the graticule layer and does the initial update  
*  
* Returns:  
* {DOMElement}  
*/  
draw: function() {  
OpenLayers.Control.prototype.draw.apply(this, arguments);  
if (!this.gratLayer) {  
var gratStyle = new OpenLayers.Style({},{  
rules: [new OpenLayers.Rule({'symbolizer':  
{"Point":this.labelSymbolizer,  
"Line":this.lineSymbolizer}  
})]  
});  
this.gratLayer = new OpenLayers.Layer.Vector(this.layerName, {  
styleMap: new OpenLayers.StyleMap({'default':gratStyle}),  
visibility: this.visible,  
displayInLayerSwitcher: this.displayInLayerSwitcher  
});  
}  
return this.div;  
},  
 
/**  
* APIMethod: activate  
*/  
activate: function() {  
if (OpenLayers.Control.prototype.activate.apply(this, arguments)) {  
this.map.addLayer(this.gratLayer);  
this.map.events.register('moveend', this, this.update);  
this.update();  
return true;  
} else {  
return false;  
}  
},  
 
/**  
* APIMethod: deactivate  
*/  
deactivate: function() {  
if (OpenLayers.Control.prototype.deactivate.apply(this, arguments)) {  
this.map.events.unregister('moveend', this, this.update);  
this.map.removeLayer(this.gratLayer);  
return true;  
} else {  
return false;  
}  
},  
/**  
* Method: update  
*  
* calculates the grid to be displayed and actually draws it  
*  
* Returns:  
* {DOMElement}  
*/  
update: function() {  
//wait for the map to be initialized before proceeding  
var mapBounds = this.map.getExtent();  
if (!mapBounds) {  
return;  
}  
 
//clear out the old grid  
this.gratLayer.destroyFeatures();  
 
//get the projection objects required  
var llProj = new OpenLayers.Projection("EPSG:4326");  
var mapProj = this.map.getProjectionObject();  
var mapRes = this.map.getResolution();  
 
//if the map is in lon/lat, then the lines are straight and only one  
//point is required  
if (mapProj.proj && mapProj.proj.projName == "longlat") {  
this.numPoints = 1;  
}  
 
//get the map center in EPSG:4326  
var mapCenter = this.map.getCenter(); //lon and lat here are really map x and y  
var mapCenterLL = new OpenLayers.Pixel(mapCenter.lon, mapCenter.lat);  
OpenLayers.Projection.transform(mapCenterLL, mapProj, llProj);  
 
/* This block of code determines the lon/lat interval to use for the  
* grid by calculating the diagonal size of one grid cell at the map  
* center. Iterates through the intervals array until the diagonal  
* length is less than the targetSize option.  
*/  
//find lat/lon interval that results in a grid of less than the target size  
var testSq = this.targetSize*mapRes;  
testSq *= testSq; //compare squares rather than doing a square root to save time  
var llInterval;  
for (var i=0; i<this.intervals.length; ++i) {  
llInterval = this.intervals[i]; //could do this for both x and y??  
var delta = llInterval/2;  
var p1 = mapCenterLL.offset(new OpenLayers.Pixel(-delta, -delta)); //test coords in EPSG:4326 space  
var p2 = mapCenterLL.offset(new OpenLayers.Pixel( delta, delta));  
OpenLayers.Projection.transform(p1, llProj, mapProj); // convert them back to map projection  
OpenLayers.Projection.transform(p2, llProj, mapProj);  
var distSq = (p1.x-p2.x)*(p1.x-p2.x) + (p1.y-p2.y)*(p1.y-p2.y);  
if (distSq <= testSq) {  
break;  
}  
}  
//alert(llInterval);  
 
//round the LL center to an even number based on the interval  
mapCenterLL.x = Math.floor(mapCenterLL.x/llInterval)*llInterval;  
mapCenterLL.y = Math.floor(mapCenterLL.y/llInterval)*llInterval;  
//TODO adjust for minutses/seconds?  
 
/* The following 2 blocks calculate the nodes of the grid along a  
* line of constant longitude (then latitiude) running through the  
* center of the map until it reaches the map edge. The calculation  
* goes from the center in both directions to the edge.  
*/  
//get the central longitude line, increment the latitude  
var iter = 0;  
var centerLonPoints = [mapCenterLL.clone()];  
var newPoint = mapCenterLL.clone();  
var mapXY;  
do {  
newPoint = newPoint.offset(new OpenLayers.Pixel(0,llInterval));  
mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj);  
centerLonPoints.unshift(newPoint);  
} while (mapBounds.containsPixel(mapXY) && ++iter<1000);  
newPoint = mapCenterLL.clone();  
do {  
newPoint = newPoint.offset(new OpenLayers.Pixel(0,-llInterval));  
mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj);  
centerLonPoints.push(newPoint);  
} while (mapBounds.containsPixel(mapXY) && ++iter<1000);  
 
//get the central latitude line, increment the longitude  
iter = 0;  
var centerLatPoints = [mapCenterLL.clone()];  
newPoint = mapCenterLL.clone();  
do {  
newPoint = newPoint.offset(new OpenLayers.Pixel(-llInterval, 0));  
mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj);  
centerLatPoints.unshift(newPoint);  
} while (mapBounds.containsPixel(mapXY) && ++iter<1000);  
newPoint = mapCenterLL.clone();  
do {  
newPoint = newPoint.offset(new OpenLayers.Pixel(llInterval, 0));  
mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj);  
centerLatPoints.push(newPoint);  
} while (mapBounds.containsPixel(mapXY) && ++iter<1000);  
 
//now generate a line for each node in the central lat and lon lines  
//first loop over constant longitude  
var lines = [];  
for(var i=0; i < centerLatPoints.length; ++i) {  
var lon = centerLatPoints[i].x;  
var pointList = [];  
var labelPoint = null;  
var latEnd = Math.min(centerLonPoints[0].y, 90);  
var latStart = Math.max(centerLonPoints[centerLonPoints.length - 1].y, -90);  
var latDelta = (latEnd - latStart)/this.numPoints;  
var lat = latStart;  
for(var j=0; j<= this.numPoints; ++j) {  
var gridPoint = new OpenLayers.Geometry.Point(lon,lat);  
gridPoint.transform(llProj, mapProj);  
pointList.push(gridPoint);  
lat += latDelta;  
if (gridPoint.y >= mapBounds.bottom && !labelPoint) {  
labelPoint = gridPoint;  
}  
}  
if (this.labelled) {  
//keep track of when this grid line crosses the map bounds to set  
//the label position  
//labels along the bottom, add 10 pixel offset up into the map  
//TODO add option for labels on top  
var labelPos = new OpenLayers.Geometry.Point(labelPoint.x,mapBounds.bottom);  
var labelAttrs = {  
value: lon,  
label: this.labelled?OpenLayers.Util.getFormattedLonLat(lon, "lon", this.labelFormat):"",  
labelAlign: "cb",  
xOffset: 0,  
yOffset: 2  
};  
this.gratLayer.addFeatures(new OpenLayers.Feature.Vector(labelPos,labelAttrs));  
}  
var geom = new OpenLayers.Geometry.LineString(pointList);  
lines.push(new OpenLayers.Feature.Vector(geom));  
}  
 
//now draw the lines of constant latitude  
for (var j=0; j < centerLonPoints.length; ++j) {  
lat = centerLonPoints[j].y;  
if (lat<-90 || lat>90) { //latitudes only valid between -90 and 90  
continue;  
}  
var pointList = [];  
var lonStart = centerLatPoints[0].x;  
var lonEnd = centerLatPoints[centerLatPoints.length - 1].x;  
var lonDelta = (lonEnd - lonStart)/this.numPoints;  
var lon = lonStart;  
var labelPoint = null;  
for(var i=0; i <= this.numPoints ; ++i) {  
var gridPoint = new OpenLayers.Geometry.Point(lon,lat);  
gridPoint.transform(llProj, mapProj);  
pointList.push(gridPoint);  
lon += lonDelta;  
if (gridPoint.x < mapBounds.right) {  
labelPoint = gridPoint;  
}  
}  
if (this.labelled) {  
//keep track of when this grid line crosses the map bounds to set  
//the label position  
//labels along the right, 30 pixel offset left into the map  
//TODO add option for labels on left  
var labelPos = new OpenLayers.Geometry.Point(mapBounds.right, labelPoint.y);  
var labelAttrs = {  
value: lat,  
label: this.labelled?OpenLayers.Util.getFormattedLonLat(lat, "lat", this.labelFormat):"",  
labelAlign: "rb",  
xOffset: -2,  
yOffset: 2  
};  
this.gratLayer.addFeatures(new OpenLayers.Feature.Vector(labelPos,labelAttrs));  
}  
var geom = new OpenLayers.Geometry.LineString(pointList);  
lines.push(new OpenLayers.Feature.Vector(geom));  
}  
this.gratLayer.addFeatures(lines);  
},  
 
CLASS_NAME: "OpenLayers.Control.Graticule"  
});  
 
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Handler/Keyboard.js  
*/  
 
/**  
* Class: OpenLayers.Control.KeyboardDefaults  
* The KeyboardDefaults control adds panning and zooming functions, controlled  
* with the keyboard. By default arrow keys pan, +/- keys zoom & Page Up/Page  
* Down/Home/End scroll by three quarters of a page.  
*  
* This control has no visible appearance.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* APIProperty: autoActivate  
* {Boolean} Activate the control when it is added to a map. Default is  
* true.  
*/  
autoActivate: true,  
 
/**  
* APIProperty: slideFactor  
* Pixels to slide by.  
*/  
slideFactor: 75,  
 
/**  
* Constructor: OpenLayers.Control.KeyboardDefaults  
*/  
initialize: function() {  
OpenLayers.Control.prototype.initialize.apply(this, arguments);  
},  
 
/**  
* APIMethod: destroy  
*/  
destroy: function() {  
if (this.handler) {  
this.handler.destroy();  
}  
this.handler = null;  
 
OpenLayers.Control.prototype.destroy.apply(this, arguments);  
},  
 
/**  
* Method: draw  
* Create handler.  
*/  
draw: function() {  
this.handler = new OpenLayers.Handler.Keyboard( this, {  
"keydown": this.defaultKeyPress });  
},  
 
/**  
* Method: defaultKeyPress  
* When handling the key event, we only use evt.keyCode. This holds  
* some drawbacks, though we get around them below. When interpretting  
* the keycodes below (including the comments associated with them),  
* consult the URL below. For instance, the Safari browser returns  
* "IE keycodes", and so is supported by any keycode labeled "IE".  
*  
* Very informative URL:  
* http://unixpapa.com/js/key.html  
*  
* Parameters:  
* code - {Integer}  
*/  
defaultKeyPress: function (evt) {  
switch(evt.keyCode) {  
case OpenLayers.Event.KEY_LEFT:  
this.map.pan(-this.slideFactor, 0);  
break;  
case OpenLayers.Event.KEY_RIGHT:  
this.map.pan(this.slideFactor, 0);  
break;  
case OpenLayers.Event.KEY_UP:  
this.map.pan(0, -this.slideFactor);  
break;  
case OpenLayers.Event.KEY_DOWN:  
this.map.pan(0, this.slideFactor);  
break;  
 
case 33: // Page Up. Same in all browsers.  
var size = this.map.getSize();  
this.map.pan(0, -0.75*size.h);  
break;  
case 34: // Page Down. Same in all browsers.  
var size = this.map.getSize();  
this.map.pan(0, 0.75*size.h);  
break;  
case 35: // End. Same in all browsers.  
var size = this.map.getSize();  
this.map.pan(0.75*size.w, 0);  
break;  
case 36: // Home. Same in all browsers.  
var size = this.map.getSize();  
this.map.pan(-0.75*size.w, 0);  
break;  
 
case 43: // +/= (ASCII), keypad + (ASCII, Opera)  
case 61: // +/= (Mozilla, Opera, some ASCII)  
case 187: // +/= (IE)  
case 107: // keypad + (IE, Mozilla)  
this.map.zoomIn();  
break;  
case 45: // -/_ (ASCII, Opera), keypad - (ASCII, Opera)  
case 109: // -/_ (Mozilla), keypad - (Mozilla, IE)  
case 189: // -/_ (IE)  
case 95: // -/_ (some ASCII)  
this.map.zoomOut();  
break;  
}  
},  
 
CLASS_NAME: "OpenLayers.Control.KeyboardDefaults"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.LayerSwitcher  
* The LayerSwitcher control displays a table of contents for the map. This  
* allows the user interface to switch between BaseLasyers and to show or hide  
* Overlays. By default the switcher is shown minimized on the right edge of  
* the map, the user may expand it by clicking on the handle.  
*  
* To create the LayerSwitcher outside of the map, pass the Id of a html div  
* as the first argument to the constructor.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.LayerSwitcher =  
OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* APIProperty: roundedCorner  
* {Boolean} If true the Rico library is used for rounding the corners  
* of the layer switcher div, defaults to true.  
*/  
roundedCorner: true,  
 
/**  
* APIProperty: roundedCornerColor  
* {String} The color of the rounded corners, only applies if roundedCorner  
* is true, defaults to "darkblue".  
*/  
roundedCornerColor: "darkblue",  
 
/**  
* Property: layerStates  
* {Array(Object)} Basically a copy of the "state" of the map's layers  
* the last time the control was drawn. We have this in order to avoid  
* unnecessarily redrawing the control.  
*/  
layerStates: null,  
 
 
// DOM Elements  
 
/**  
* Property: layersDiv  
* {DOMElement}  
*/  
layersDiv: null,  
 
/**  
* Property: baseLayersDiv  
* {DOMElement}  
*/  
baseLayersDiv: null,  
 
/**  
* Property: baseLayers  
* {Array(<OpenLayers.Layer>)}  
*/  
baseLayers: null,  
 
 
/**  
* Property: dataLbl  
* {DOMElement}  
*/  
dataLbl: null,  
 
/**  
* Property: dataLayersDiv  
* {DOMElement}  
*/  
dataLayersDiv: null,  
 
/**  
* Property: dataLayers  
* {Array(<OpenLayers.Layer>)}  
*/  
dataLayers: null,  
 
 
/**  
* Property: minimizeDiv  
* {DOMElement}  
*/  
minimizeDiv: null,  
 
/**  
* Property: maximizeDiv  
* {DOMElement}  
*/  
maximizeDiv: null,  
 
/**  
* APIProperty: ascending  
* {Boolean}  
*/  
ascending: true,  
 
/**  
* Constructor: OpenLayers.Control.LayerSwitcher  
*  
* Parameters:  
* options - {Object}  
*/  
initialize: function(options) {  
OpenLayers.Control.prototype.initialize.apply(this, arguments);  
this.layerStates = [];  
},  
 
/**  
* APIMethod: destroy  
*/  
destroy: function() {  
 
OpenLayers.Event.stopObservingElement(this.div);  
 
OpenLayers.Event.stopObservingElement(this.minimizeDiv);  
OpenLayers.Event.stopObservingElement(this.maximizeDiv);  
 
//clear out layers info and unregister their events  
this.clearLayersArray("base");  
this.clearLayersArray("data");  
 
this.map.events.un({  
"addlayer": this.redraw,  
"changelayer": this.redraw,  
"removelayer": this.redraw,  
"changebaselayer": this.redraw,  
scope: this  
});  
 
OpenLayers.Control.prototype.destroy.apply(this, arguments);  
},  
 
/**  
* Method: setMap  
*  
* Properties:  
* map - {<OpenLayers.Map>}  
*/  
setMap: function(map) {  
OpenLayers.Control.prototype.setMap.apply(this, arguments);  
 
this.map.events.on({  
"addlayer": this.redraw,  
"changelayer": this.redraw,  
"removelayer": this.redraw,  
"changebaselayer": this.redraw,  
scope: this  
});  
},  
 
/**  
* Method: draw  
*  
* Returns:  
* {DOMElement} A reference to the DIV DOMElement containing the  
* switcher tabs.  
*/  
draw: function() {  
OpenLayers.Control.prototype.draw.apply(this);  
 
// create layout divs  
this.loadContents();  
 
// set mode to minimize  
if(!this.outsideViewport) {  
this.minimizeControl();  
}  
 
// populate div with current info  
this.redraw();  
 
return this.div;  
},  
 
/**  
* Method: clearLayersArray  
* User specifies either "base" or "data". we then clear all the  
* corresponding listeners, the div, and reinitialize a new array.  
*  
* Parameters:  
* layersType - {String}  
*/  
clearLayersArray: function(layersType) {  
var layers = this[layersType + "Layers"];  
if (layers) {  
for(var i=0, len=layers.length; i<len ; i++) {  
var layer = layers[i];  
OpenLayers.Event.stopObservingElement(layer.inputElem);  
OpenLayers.Event.stopObservingElement(layer.labelSpan);  
}  
}  
this[layersType + "LayersDiv"].innerHTML = "";  
this[layersType + "Layers"] = [];  
},  
 
 
/**  
* Method: checkRedraw  
* Checks if the layer state has changed since the last redraw() call.  
*  
* Returns:  
* {Boolean} The layer state changed since the last redraw() call.  
*/  
checkRedraw: function() {  
var redraw = false;  
if ( !this.layerStates.length ||  
(this.map.layers.length != this.layerStates.length) ) {  
redraw = true;  
} else {  
for (var i=0, len=this.layerStates.length; i<len; i++) {  
var layerState = this.layerStates[i];  
var layer = this.map.layers[i];  
if ( (layerState.name != layer.name) ||  
(layerState.inRange != layer.inRange) ||  
(layerState.id != layer.id) ||  
(layerState.visibility != layer.visibility) ) {  
redraw = true;  
break;  
}  
}  
}  
return redraw;  
},  
 
/**  
* Method: redraw  
* Goes through and takes the current state of the Map and rebuilds the  
* control to display that state. Groups base layers into a  
* radio-button group and lists each data layer with a checkbox.  
*  
* Returns:  
* {DOMElement} A reference to the DIV DOMElement containing the control  
*/  
redraw: function() {  
//if the state hasn't changed since last redraw, no need  
// to do anything. Just return the existing div.  
if (!this.checkRedraw()) {  
return this.div;  
}  
 
//clear out previous layers  
this.clearLayersArray("base");  
this.clearLayersArray("data");  
 
var containsOverlays = false;  
var containsBaseLayers = false;  
 
// Save state -- for checking layer if the map state changed.  
// We save this before redrawing, because in the process of redrawing  
// we will trigger more visibility changes, and we want to not redraw  
// and enter an infinite loop.  
var len = this.map.layers.length;  
this.layerStates = new Array(len);  
for (var i=0; i <len; i++) {  
var layer = this.map.layers[i];  
this.layerStates[i] = {  
'name': layer.name,  
'visibility': layer.visibility,  
'inRange': layer.inRange,  
'id': layer.id  
};  
}  
 
var layers = this.map.layers.slice();  
if (!this.ascending) { layers.reverse(); }  
for(var i=0, len=layers.length; i<len; i++) {  
var layer = layers[i];  
var baseLayer = layer.isBaseLayer;  
 
if (layer.displayInLayerSwitcher) {  
 
if (baseLayer) {  
containsBaseLayers = true;  
} else {  
containsOverlays = true;  
}  
 
// only check a baselayer if it is *the* baselayer, check data  
// layers if they are visible  
var checked = (baseLayer) ? (layer == this.map.baseLayer)  
: layer.getVisibility();  
 
// create input element  
var inputElem = document.createElement("input");  
inputElem.id = this.id + "_input_" + layer.name;  
inputElem.name = (baseLayer) ? this.id + "_baseLayers" : layer.name;  
inputElem.type = (baseLayer) ? "radio" : "checkbox";  
inputElem.value = layer.name;  
inputElem.checked = checked;  
inputElem.defaultChecked = checked;  
 
if (!baseLayer && !layer.inRange) {  
inputElem.disabled = true;  
}  
var context = {  
'inputElem': inputElem,  
'layer': layer,  
'layerSwitcher': this  
};  
OpenLayers.Event.observe(inputElem, "mouseup",  
OpenLayers.Function.bindAsEventListener(this.onInputClick,  
context)  
);  
 
// create span  
var labelSpan = document.createElement("span");  
OpenLayers.Element.addClass(labelSpan, "labelSpan")  
if (!baseLayer && !layer.inRange) {  
labelSpan.style.color = "gray";  
}  
labelSpan.innerHTML = layer.name;  
labelSpan.style.verticalAlign = (baseLayer) ? "bottom"  
: "baseline";  
OpenLayers.Event.observe(labelSpan, "click",  
OpenLayers.Function.bindAsEventListener(this.onInputClick,  
context)  
);  
// create line break  
var br = document.createElement("br");  
 
 
var groupArray = (baseLayer) ? this.baseLayers  
: this.dataLayers;  
groupArray.push({  
'layer': layer,  
'inputElem': inputElem,  
'labelSpan': labelSpan  
});  
 
 
var groupDiv = (baseLayer) ? this.baseLayersDiv  
: this.dataLayersDiv;  
groupDiv.appendChild(inputElem);  
groupDiv.appendChild(labelSpan);  
groupDiv.appendChild(br);  
}  
}  
 
// if no overlays, dont display the overlay label  
this.dataLbl.style.display = (containsOverlays) ? "" : "none";  
 
// if no baselayers, dont display the baselayer label  
this.baseLbl.style.display = (containsBaseLayers) ? "" : "none";  
 
return this.div;  
},  
 
/**  
* Method:  
* A label has been clicked, check or uncheck its corresponding input  
*  
* Parameters:  
* e - {Event}  
*  
* Context:  
* - {DOMElement} inputElem  
* - {<OpenLayers.Control.LayerSwitcher>} layerSwitcher  
* - {<OpenLayers.Layer>} layer  
*/  
 
onInputClick: function(e) {  
 
if (!this.inputElem.disabled) {  
if (this.inputElem.type == "radio") {  
this.inputElem.checked = true;  
this.layer.map.setBaseLayer(this.layer);  
} else {  
this.inputElem.checked = !this.inputElem.checked;  
this.layerSwitcher.updateMap();  
}  
}  
OpenLayers.Event.stop(e);  
},  
 
/**  
* Method: onLayerClick  
* Need to update the map accordingly whenever user clicks in either of  
* the layers.  
*  
* Parameters:  
* e - {Event}  
*/  
onLayerClick: function(e) {  
this.updateMap();  
},  
 
 
/**  
* Method: updateMap  
* Cycles through the loaded data and base layer input arrays and makes  
* the necessary calls to the Map object such that that the map's  
* visual state corresponds to what the user has selected in  
* the control.  
*/  
updateMap: function() {  
 
// set the newly selected base layer  
for(var i=0, len=this.baseLayers.length; i<len; i++) {  
var layerEntry = this.baseLayers[i];  
if (layerEntry.inputElem.checked) {  
this.map.setBaseLayer(layerEntry.layer, false);  
}  
}  
 
// set the correct visibilities for the overlays  
for(var i=0, len=this.dataLayers.length; i<len; i++) {  
var layerEntry = this.dataLayers[i];  
layerEntry.layer.setVisibility(layerEntry.inputElem.checked);  
}  
 
},  
 
/**  
* Method: maximizeControl  
* Set up the labels and divs for the control  
*  
* Parameters:  
* e - {Event}  
*/  
maximizeControl: function(e) {  
 
// set the div's width and height to empty values, so  
// the div dimensions can be controlled by CSS  
this.div.style.width = "";  
this.div.style.height = "";  
 
this.showControls(false);  
 
if (e != null) {  
OpenLayers.Event.stop(e);  
}  
},  
 
/**  
* Method: minimizeControl  
* Hide all the contents of the control, shrink the size,  
* add the maximize icon  
*  
* Parameters:  
* e - {Event}  
*/  
minimizeControl: function(e) {  
 
// to minimize the control we set its div's width  
// and height to 0px, we cannot just set "display"  
// to "none" because it would hide the maximize  
// div  
this.div.style.width = "0px";  
this.div.style.height = "0px";  
 
this.showControls(true);  
 
if (e != null) {  
OpenLayers.Event.stop(e);  
}  
},  
 
/**  
* Method: showControls  
* Hide/Show all LayerSwitcher controls depending on whether we are  
* minimized or not  
*  
* Parameters:  
* minimize - {Boolean}  
*/  
showControls: function(minimize) {  
 
this.maximizeDiv.style.display = minimize ? "" : "none";  
this.minimizeDiv.style.display = minimize ? "none" : "";  
 
this.layersDiv.style.display = minimize ? "none" : "";  
},  
 
/**  
* Method: loadContents  
* Set up the labels and divs for the control  
*/  
loadContents: function() {  
 
//configure main div  
 
OpenLayers.Event.observe(this.div, "mouseup",  
OpenLayers.Function.bindAsEventListener(this.mouseUp, this));  
OpenLayers.Event.observe(this.div, "click",  
this.ignoreEvent);  
OpenLayers.Event.observe(this.div, "mousedown",  
OpenLayers.Function.bindAsEventListener(this.mouseDown, this));  
OpenLayers.Event.observe(this.div, "dblclick", this.ignoreEvent);  
 
// layers list div  
this.layersDiv = document.createElement("div");  
this.layersDiv.id = this.id + "_layersDiv";  
OpenLayers.Element.addClass(this.layersDiv, "layersDiv");  
 
this.baseLbl = document.createElement("div");  
this.baseLbl.innerHTML = OpenLayers.i18n("baseLayer");  
OpenLayers.Element.addClass(this.baseLbl, "baseLbl");  
 
this.baseLayersDiv = document.createElement("div");  
OpenLayers.Element.addClass(this.baseLayersDiv, "baseLayersDiv");  
 
this.dataLbl = document.createElement("div");  
this.dataLbl.innerHTML = OpenLayers.i18n("overlays");  
OpenLayers.Element.addClass(this.dataLbl, "dataLbl");  
 
this.dataLayersDiv = document.createElement("div");  
OpenLayers.Element.addClass(this.dataLayersDiv, "dataLayersDiv");  
 
if (this.ascending) {  
this.layersDiv.appendChild(this.baseLbl);  
this.layersDiv.appendChild(this.baseLayersDiv);  
this.layersDiv.appendChild(this.dataLbl);  
this.layersDiv.appendChild(this.dataLayersDiv);  
} else {  
this.layersDiv.appendChild(this.dataLbl);  
this.layersDiv.appendChild(this.dataLayersDiv);  
this.layersDiv.appendChild(this.baseLbl);  
this.layersDiv.appendChild(this.baseLayersDiv);  
}  
 
this.div.appendChild(this.layersDiv);  
 
if(this.roundedCorner) {  
OpenLayers.Rico.Corner.round(this.div, {  
corners: "tl bl",  
bgColor: "transparent",  
color: this.roundedCornerColor,  
blend: false  
});  
OpenLayers.Rico.Corner.changeOpacity(this.layersDiv, 0.75);  
}  
 
var imgLocation = OpenLayers.Util.getImagesLocation();  
var sz = new OpenLayers.Size(18,18);  
 
// maximize button div  
var img = imgLocation + 'layer-switcher-maximize.png';  
this.maximizeDiv = OpenLayers.Util.createAlphaImageDiv(  
"OpenLayers_Control_MaximizeDiv",  
null,  
sz,  
img,  
"absolute");  
OpenLayers.Element.addClass(this.maximizeDiv, "maximizeDiv");  
this.maximizeDiv.style.display = "none";  
OpenLayers.Event.observe(this.maximizeDiv, "click",  
OpenLayers.Function.bindAsEventListener(this.maximizeControl, this)  
);  
 
this.div.appendChild(this.maximizeDiv);  
 
// minimize button div  
var img = imgLocation + 'layer-switcher-minimize.png';  
var sz = new OpenLayers.Size(18,18);  
this.minimizeDiv = OpenLayers.Util.createAlphaImageDiv(  
"OpenLayers_Control_MinimizeDiv",  
null,  
sz,  
img,  
"absolute");  
OpenLayers.Element.addClass(this.minimizeDiv, "minimizeDiv");  
this.minimizeDiv.style.display = "none";  
OpenLayers.Event.observe(this.minimizeDiv, "click",  
OpenLayers.Function.bindAsEventListener(this.minimizeControl, this)  
);  
 
this.div.appendChild(this.minimizeDiv);  
},  
 
/**  
* Method: ignoreEvent  
*  
* Parameters:  
* evt - {Event}  
*/  
ignoreEvent: function(evt) {  
OpenLayers.Event.stop(evt);  
},  
 
/**  
* Method: mouseDown  
* Register a local 'mouseDown' flag so that we'll know whether or not  
* to ignore a mouseUp event  
*  
* Parameters:  
* evt - {Event}  
*/  
mouseDown: function(evt) {  
this.isMouseDown = true;  
this.ignoreEvent(evt);  
},  
 
/**  
* Method: mouseUp  
* If the 'isMouseDown' flag has been set, that means that the drag was  
* started from within the LayerSwitcher control, and thus we can  
* ignore the mouseup. Otherwise, let the Event continue.  
*  
* Parameters:  
* evt - {Event}  
*/  
mouseUp: function(evt) {  
if (this.isMouseDown) {  
this.isMouseDown = false;  
this.ignoreEvent(evt);  
}  
},  
 
CLASS_NAME: "OpenLayers.Control.LayerSwitcher"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Feature/Vector.js  
*/  
 
/**  
* Class: OpenLayers.Control.Measure  
* Allows for drawing of features for measurements.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Constant: EVENT_TYPES  
* {Array(String)} Supported application event types. Register a listener  
* for a particular event with the following syntax:  
* (code)  
* control.events.register(type, obj, listener);  
* (end)  
*  
* Listeners will be called with a reference to an event object. The  
* properties of this event depends on exactly what happened.  
*  
* Supported control event types (in addition to those from <OpenLayers.Control>):  
* measure - Triggered when a measurement sketch is complete. Listeners  
* will receive an event with measure, units, order, and geometry  
* properties.  
* measurepartial - Triggered when a new point is added to the  
* measurement sketch. Listeners receive an event with measure,  
* units, order, and geometry.  
*/  
EVENT_TYPES: ['measure', 'measurepartial'],  
 
/**  
* APIProperty: handlerOptions  
* {Object} Used to set non-default properties on the control's handler  
*/  
handlerOptions: null,  
 
/**  
* Property: callbacks  
* {Object} The functions that are sent to the handler for callback  
*/  
callbacks: null,  
 
/**  
* Property: displaySystem  
* {String} Display system for output measurements. Supported values  
* are 'english', 'metric', and 'geographic'. Default is 'metric'.  
*/  
displaySystem: 'metric',  
 
/**  
* Property: geodesic  
* {Boolean} Calculate geodesic metrics instead of planar metrics. This  
* requires that geometries can be transformed into Geographic/WGS84  
* (if that is not already the map projection). Default is false.  
*/  
geodesic: false,  
 
/**  
* Property: displaySystemUnits  
* {Object} Units for various measurement systems. Values are arrays  
* of unit abbreviations (from OpenLayers.INCHES_PER_UNIT) in decreasing  
* order of length.  
*/  
displaySystemUnits: {  
geographic: ['dd'],  
english: ['mi', 'ft', 'in'],  
metric: ['km', 'm']  
},  
 
/**  
* Property: delay  
* {Number} Number of milliseconds between clicks before the event is  
* considered a double-click. The "measurepartial" event will not  
* be triggered if the sketch is completed within this time. This  
* is required for IE where creating a browser reflow (if a listener  
* is modifying the DOM by displaying the measurement values) messes  
* with the dblclick listener in the sketch handler.  
*/  
partialDelay: 300,  
 
/**  
* Property: delayedTrigger  
* {Number} Timeout id of trigger for measurepartial.  
*/  
delayedTrigger: null,  
 
/**  
* APIProperty: persist  
* {Boolean} Keep the temporary measurement sketch drawn after the  
* measurement is complete. The geometry will persist until a new  
* measurement is started, the control is deactivated, or <cancel> is  
* called.  
*/  
persist: false,  
 
/**  
* Constructor: OpenLayers.Control.Measure  
*  
* Parameters:  
* handler - {<OpenLayers.Handler>}  
* options - {Object}  
*/  
initialize: function(handler, options) {  
// concatenate events specific to measure with those from the base  
this.EVENT_TYPES =  
OpenLayers.Control.Measure.prototype.EVENT_TYPES.concat(  
OpenLayers.Control.prototype.EVENT_TYPES  
);  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
this.callbacks = OpenLayers.Util.extend(  
{done: this.measureComplete, point: this.measurePartial},  
this.callbacks  
);  
 
// let the handler options override, so old code that passes 'persist'  
// directly to the handler does not need an update  
this.handlerOptions = OpenLayers.Util.extend(  
{persist: this.persist}, this.handlerOptions  
);  
this.handler = new handler(this, this.callbacks, this.handlerOptions);  
},  
 
/**  
* APIMethod: cancel  
* Stop the control from measuring. If <persist> is true, the temporary  
* sketch will be erased.  
*/  
cancel: function() {  
this.handler.cancel();  
},  
 
/**  
* Method: updateHandler  
*  
* Parameters:  
* handler - {Function} One of the sketch handler constructors.  
* options - {Object} Options for the handler.  
*/  
updateHandler: function(handler, options) {  
var active = this.active;  
if(active) {  
this.deactivate();  
}  
this.handler = new handler(this, this.callbacks, options);  
if(active) {  
this.activate();  
}  
},  
 
/**  
* Method: measureComplete  
* Called when the measurement sketch is done.  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry>}  
*/  
measureComplete: function(geometry) {  
if(this.delayedTrigger) {  
window.clearTimeout(this.delayedTrigger);  
}  
this.measure(geometry, "measure");  
},  
 
/**  
* Method: measurePartial  
* Called each time a new point is added to the measurement sketch.  
*  
* Parameters:  
* point - {<OpenLayers.Geometry.Point>} The last point added.  
* geometry - {<OpenLayers.Geometry>} The sketch geometry.  
*/  
measurePartial: function(point, geometry) {  
if (geometry.getLength() > 0) {  
geometry = geometry.clone();  
this.delayedTrigger = window.setTimeout(  
OpenLayers.Function.bind(function() {  
this.measure(geometry, "measurepartial");  
}, this),  
this.partialDelay  
);  
}  
},  
 
/**  
* Method: measure  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry>}  
* eventType - {String}  
*/  
measure: function(geometry, eventType) {  
var stat, order;  
if(geometry.CLASS_NAME.indexOf('LineString') > -1) {  
stat = this.getBestLength(geometry);  
order = 1;  
} else {  
stat = this.getBestArea(geometry);  
order = 2;  
}  
this.events.triggerEvent(eventType, {  
measure: stat[0],  
units: stat[1],  
order: order,  
geometry: geometry  
});  
},  
 
/**  
* Method: getBestArea  
* Based on the <displaySystem> returns the area of a geometry.  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry>}  
*  
* Returns:  
* {Array([Float, String])} Returns a two item array containing the  
* area and the units abbreviation.  
*/  
getBestArea: function(geometry) {  
var units = this.displaySystemUnits[this.displaySystem];  
var unit, area;  
for(var i=0, len=units.length; i<len; ++i) {  
unit = units[i];  
area = this.getArea(geometry, unit);  
if(area > 1) {  
break;  
}  
}  
return [area, unit];  
},  
 
/**  
* Method: getArea  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry>}  
* units - {String} Unit abbreviation  
*  
* Returns:  
* {Float} The geometry area in the given units.  
*/  
getArea: function(geometry, units) {  
var area, geomUnits;  
if(this.geodesic) {  
area = geometry.getGeodesicArea(this.map.getProjectionObject());  
geomUnits = "m";  
} else {  
area = geometry.getArea();  
geomUnits = this.map.getUnits();  
}  
var inPerDisplayUnit = OpenLayers.INCHES_PER_UNIT[units];  
if(inPerDisplayUnit) {  
var inPerMapUnit = OpenLayers.INCHES_PER_UNIT[geomUnits];  
area *= Math.pow((inPerMapUnit / inPerDisplayUnit), 2);  
}  
return area;  
},  
 
/**  
* Method: getBestLength  
* Based on the <displaySystem> returns the length of a geometry.  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry>}  
*  
* Returns:  
* {Array([Float, String])} Returns a two item array containing the  
* length and the units abbreviation.  
*/  
getBestLength: function(geometry) {  
var units = this.displaySystemUnits[this.displaySystem];  
var unit, length;  
for(var i=0, len=units.length; i<len; ++i) {  
unit = units[i];  
length = this.getLength(geometry, unit);  
if(length > 1) {  
break;  
}  
}  
return [length, unit];  
},  
 
/**  
* Method: getLength  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry>}  
* units - {String} Unit abbreviation  
*  
* Returns:  
* {Float} The geometry length in the given units.  
*/  
getLength: function(geometry, units) {  
var length, geomUnits;  
if(this.geodesic) {  
length = geometry.getGeodesicLength(this.map.getProjectionObject());  
geomUnits = "m";  
} else {  
length = geometry.getLength();  
geomUnits = this.map.getUnits();  
}  
var inPerDisplayUnit = OpenLayers.INCHES_PER_UNIT[units];  
if(inPerDisplayUnit) {  
var inPerMapUnit = OpenLayers.INCHES_PER_UNIT[geomUnits];  
length *= (inPerMapUnit / inPerDisplayUnit);  
}  
return length;  
},  
 
CLASS_NAME: "OpenLayers.Control.Measure"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control/DragFeature.js  
* @requires OpenLayers/Control/SelectFeature.js  
* @requires OpenLayers/Handler/Keyboard.js  
*/  
 
/**  
* Class: OpenLayers.Control.ModifyFeature  
* Control to modify features. When activated, a click renders the vertices  
* of a feature - these vertices can then be dragged. By default, the  
* delete key will delete the vertex under the mouse. New features are  
* added by dragging "virtual vertices" between vertices. Create a new  
* control with the <OpenLayers.Control.ModifyFeature> constructor.  
*  
* Inherits From:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* APIProperty: geometryTypes  
* {Array(String)} To restrict modification to a limited set of geometry  
* types, send a list of strings corresponding to the geometry class  
* names.  
*/  
geometryTypes: null,  
 
/**  
* APIProperty: clickout  
* {Boolean} Unselect features when clicking outside any feature.  
* Default is true.  
*/  
clickout: true,  
 
/**  
* APIProperty: toggle  
* {Boolean} Unselect a selected feature on click.  
* Default is true.  
*/  
toggle: true,  
 
/**  
* APIProperty: standalone  
* {Boolean} Set to true to create a control without SelectFeature  
* capabilities. Default is false. If standalone is true, to modify  
* a feature, call the <selectFeature> method with the target feature.  
* Note that you must call the <unselectFeature> method to finish  
* feature modification in standalone mode (before starting to modify  
* another feature).  
*/  
standalone: false,  
 
/**  
* Property: layer  
* {<OpenLayers.Layer.Vector>}  
*/  
layer: null,  
 
/**  
* Property: feature  
* {<OpenLayers.Feature.Vector>} Feature currently available for modification.  
*/  
feature: null,  
 
/**  
* Property: vertices  
* {Array(<OpenLayers.Feature.Vector>)} Verticies currently available  
* for dragging.  
*/  
vertices: null,  
 
/**  
* Property: virtualVertices  
* {Array(<OpenLayers.Feature.Vector>)} Virtual vertices in the middle  
* of each edge.  
*/  
virtualVertices: null,  
 
/**  
* Property: selectControl  
* {<OpenLayers.Control.SelectFeature>}  
*/  
selectControl: null,  
 
/**  
* Property: dragControl  
* {<OpenLayers.Control.DragFeature>}  
*/  
dragControl: null,  
 
/**  
* Property: handlers  
* {Object}  
*/  
handlers: null,  
 
/**  
* APIProperty: deleteCodes  
* {Array(Integer)} Keycodes for deleting verticies. Set to null to disable  
* vertex deltion by keypress. If non-null, keypresses with codes  
* in this array will delete vertices under the mouse. Default  
* is 46 and 68, the 'delete' and lowercase 'd' keys.  
*/  
deleteCodes: null,  
 
/**  
* APIProperty: virtualStyle  
* {Object} A symbolizer to be used for virtual vertices.  
*/  
virtualStyle: null,  
 
/**  
* APIProperty: mode  
* {Integer} Bitfields specifying the modification mode. Defaults to  
* OpenLayers.Control.ModifyFeature.RESHAPE. To set the mode to a  
* combination of options, use the | operator. For example, to allow  
* the control to both resize and rotate features, use the following  
* syntax  
* (code)  
* control.mode = OpenLayers.Control.ModifyFeature.RESIZE |  
* OpenLayers.Control.ModifyFeature.ROTATE;  
* (end)  
*/  
mode: null,  
 
/**  
* Property: modified  
* {Boolean} The currently selected feature has been modified.  
*/  
modified: false,  
 
/**  
* Property: radiusHandle  
* {<OpenLayers.Feature.Vector>} A handle for rotating/resizing a feature.  
*/  
radiusHandle: null,  
 
/**  
* Property: dragHandle  
* {<OpenLayers.Feature.Vector>} A handle for dragging a feature.  
*/  
dragHandle: null,  
 
/**  
* APIProperty: onModificationStart  
* {Function} *Deprecated*. Register for "beforefeaturemodified" instead.  
* The "beforefeaturemodified" event is triggered on the layer before  
* any modification begins.  
*  
* Optional function to be called when a feature is selected  
* to be modified. The function should expect to be called with a  
* feature. This could be used for example to allow to lock the  
* feature on server-side.  
*/  
onModificationStart: function() {},  
 
/**  
* APIProperty: onModification  
* {Function} *Deprecated*. Register for "featuremodified" instead.  
* The "featuremodified" event is triggered on the layer with each  
* feature modification.  
*  
* Optional function to be called when a feature has been  
* modified. The function should expect to be called with a feature.  
*/  
onModification: function() {},  
 
/**  
* APIProperty: onModificationEnd  
* {Function} *Deprecated*. Register for "afterfeaturemodified" instead.  
* The "afterfeaturemodified" event is triggered on the layer after  
* a feature has been modified.  
*  
* Optional function to be called when a feature is finished  
* being modified. The function should expect to be called with a  
* feature.  
*/  
onModificationEnd: function() {},  
 
/**  
* Constructor: OpenLayers.Control.ModifyFeature  
* Create a new modify feature control.  
*  
* Parameters:  
* layer - {<OpenLayers.Layer.Vector>} Layer that contains features that  
* will be modified.  
* options - {Object} Optional object whose properties will be set on the  
* control.  
*/  
initialize: function(layer, options) {  
this.layer = layer;  
this.vertices = [];  
this.virtualVertices = [];  
this.virtualStyle = OpenLayers.Util.extend({},  
this.layer.style || this.layer.styleMap.createSymbolizer());  
this.virtualStyle.fillOpacity = 0.3;  
this.virtualStyle.strokeOpacity = 0.3;  
this.deleteCodes = [46, 68];  
this.mode = OpenLayers.Control.ModifyFeature.RESHAPE;  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
if(!(this.deleteCodes instanceof Array)) {  
this.deleteCodes = [this.deleteCodes];  
}  
var control = this;  
 
// configure the select control  
var selectOptions = {  
geometryTypes: this.geometryTypes,  
clickout: this.clickout,  
toggle: this.toggle,  
onBeforeSelect: this.beforeSelectFeature,  
onSelect: this.selectFeature,  
onUnselect: this.unselectFeature,  
scope: this  
};  
if(this.standalone === false) {  
this.selectControl = new OpenLayers.Control.SelectFeature(  
layer, selectOptions  
);  
}  
 
// configure the drag control  
var dragOptions = {  
geometryTypes: ["OpenLayers.Geometry.Point"],  
snappingOptions: this.snappingOptions,  
onStart: function(feature, pixel) {  
control.dragStart.apply(control, [feature, pixel]);  
},  
onDrag: function(feature, pixel) {  
control.dragVertex.apply(control, [feature, pixel]);  
},  
onComplete: function(feature) {  
control.dragComplete.apply(control, [feature]);  
},  
featureCallbacks: {  
over: function(feature) {  
/**  
* In normal mode, the feature handler is set up to allow  
* dragging of all points. In standalone mode, we only  
* want to allow dragging of sketch vertices and virtual  
* vertices - or, in the case of a modifiable point, the  
* point itself.  
*/  
if(control.standalone !== true || feature._sketch ||  
control.feature === feature) {  
control.dragControl.overFeature.apply(  
control.dragControl, [feature]);  
}  
}  
}  
};  
this.dragControl = new OpenLayers.Control.DragFeature(  
layer, dragOptions  
);  
 
// configure the keyboard handler  
var keyboardOptions = {  
keydown: this.handleKeypress  
};  
this.handlers = {  
keyboard: new OpenLayers.Handler.Keyboard(this, keyboardOptions)  
};  
},  
 
/**  
* APIMethod: destroy  
* Take care of things that are not handled in superclass.  
*/  
destroy: function() {  
this.layer = null;  
this.standalone || this.selectControl.destroy();  
this.dragControl.destroy();  
OpenLayers.Control.prototype.destroy.apply(this, []);  
},  
 
/**  
* APIMethod: activate  
* Activate the control.  
*  
* Returns:  
* {Boolean} Successfully activated the control.  
*/  
activate: function() {  
return ((this.standalone || this.selectControl.activate()) &&  
this.handlers.keyboard.activate() &&  
OpenLayers.Control.prototype.activate.apply(this, arguments));  
},  
 
/**  
* APIMethod: deactivate  
* Deactivate the control.  
*  
* Returns:  
* {Boolean} Successfully deactivated the control.  
*/  
deactivate: function() {  
var deactivated = false;  
// the return from the controls is unimportant in this case  
if(OpenLayers.Control.prototype.deactivate.apply(this, arguments)) {  
this.layer.removeFeatures(this.vertices, {silent: true});  
this.layer.removeFeatures(this.virtualVertices, {silent: true});  
this.vertices = [];  
this.dragControl.deactivate();  
var feature = this.feature;  
var valid = feature && feature.geometry && feature.layer;  
if(this.standalone === false) {  
if(valid) {  
this.selectControl.unselect.apply(this.selectControl,  
[feature]);  
}  
this.selectControl.deactivate();  
} else {  
if(valid) {  
this.unselectFeature(feature);  
}  
}  
this.handlers.keyboard.deactivate();  
deactivated = true;  
}  
return deactivated;  
},  
 
/**  
* Method: beforeSelectFeature  
* Called before a feature is selected.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>} The feature about to be selected.  
*/  
beforeSelectFeature: function(feature) {  
return this.layer.events.triggerEvent(  
"beforefeaturemodified", {feature: feature}  
);  
},  
 
/**  
* Method: selectFeature  
* Called when the select feature control selects a feature.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>} the selected feature.  
*/  
selectFeature: function(feature) {  
this.feature = feature;  
this.modified = false;  
this.resetVertices();  
this.dragControl.activate();  
this.onModificationStart(this.feature);  
},  
 
/**  
* Method: unselectFeature  
* Called when the select feature control unselects a feature.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>} The unselected feature.  
*/  
unselectFeature: function(feature) {  
this.layer.removeFeatures(this.vertices, {silent: true});  
this.vertices = [];  
this.layer.destroyFeatures(this.virtualVertices, {silent: true});  
this.virtualVertices = [];  
if(this.dragHandle) {  
this.layer.destroyFeatures([this.dragHandle], {silent: true});  
delete this.dragHandle;  
}  
if(this.radiusHandle) {  
this.layer.destroyFeatures([this.radiusHandle], {silent: true});  
delete this.radiusHandle;  
}  
this.feature = null;  
this.dragControl.deactivate();  
this.onModificationEnd(feature);  
this.layer.events.triggerEvent("afterfeaturemodified", {  
feature: feature,  
modified: this.modified  
});  
this.modified = false;  
},  
 
/**  
* Method: dragStart  
* Called by the drag feature control with before a feature is dragged.  
* This method is used to differentiate between points and vertices  
* of higher order geometries. This respects the <geometryTypes>  
* property and forces a select of points when the drag control is  
* already active (and stops events from propagating to the select  
* control).  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>} The point or vertex about to be  
* dragged.  
* pixel - {<OpenLayers.Pixel>} Pixel location of the mouse event.  
*/  
dragStart: function(feature, pixel) {  
// only change behavior if the feature is not in the vertices array  
if(feature != this.feature && !feature.geometry.parent &&  
feature != this.dragHandle && feature != this.radiusHandle) {  
if(this.standalone === false && this.feature) {  
// unselect the currently selected feature  
this.selectControl.clickFeature.apply(this.selectControl,  
[this.feature]);  
}  
// check any constraints on the geometry type  
if(this.geometryTypes == null ||  
OpenLayers.Util.indexOf(this.geometryTypes,  
feature.geometry.CLASS_NAME) != -1) {  
// select the point  
this.standalone || this.selectControl.clickFeature.apply(  
this.selectControl, [feature]);  
/**  
* TBD: These lines improve workflow by letting the user  
* immediately start dragging after the mouse down.  
* However, it is very ugly to be messing with controls  
* and their handlers in this way. I'd like a better  
* solution if the workflow change is necessary.  
*/  
// prepare the point for dragging  
this.dragControl.overFeature.apply(this.dragControl,  
[feature]);  
this.dragControl.lastPixel = pixel;  
this.dragControl.handlers.drag.started = true;  
this.dragControl.handlers.drag.start = pixel;  
this.dragControl.handlers.drag.last = pixel;  
}  
}  
},  
 
/**  
* Method: dragVertex  
* Called by the drag feature control with each drag move of a vertex.  
*  
* Parameters:  
* vertex - {<OpenLayers.Feature.Vector>} The vertex being dragged.  
* pixel - {<OpenLayers.Pixel>} Pixel location of the mouse event.  
*/  
dragVertex: function(vertex, pixel) {  
this.modified = true;  
/**  
* Five cases:  
* 1) dragging a simple point  
* 2) dragging a virtual vertex  
* 3) dragging a drag handle  
* 4) dragging a real vertex  
* 5) dragging a radius handle  
*/  
if(this.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {  
// dragging a simple point  
if(this.feature != vertex) {  
this.feature = vertex;  
}  
this.layer.events.triggerEvent("vertexmodified", {  
vertex: vertex.geometry,  
feature: this.feature,  
pixel: pixel  
});  
} else {  
if(vertex._index) {  
// dragging a virtual vertex  
vertex.geometry.parent.addComponent(vertex.geometry,  
vertex._index);  
// move from virtual to real vertex  
delete vertex._index;  
OpenLayers.Util.removeItem(this.virtualVertices, vertex);  
this.vertices.push(vertex);  
} else if(vertex == this.dragHandle) {  
// dragging a drag handle  
this.layer.removeFeatures(this.vertices, {silent: true});  
this.vertices = [];  
if(this.radiusHandle) {  
this.layer.destroyFeatures([this.radiusHandle], {silent: true});  
this.radiusHandle = null;  
}  
} else if(vertex !== this.radiusHandle) {  
// dragging a real vertex  
this.layer.events.triggerEvent("vertexmodified", {  
vertex: vertex.geometry,  
feature: this.feature,  
pixel: pixel  
});  
}  
// dragging a radius handle - no special treatment  
if(this.virtualVertices.length > 0) {  
this.layer.destroyFeatures(this.virtualVertices, {silent: true});  
this.virtualVertices = [];  
}  
this.layer.drawFeature(this.feature, this.standalone ? undefined :  
this.selectControl.renderIntent);  
}  
// keep the vertex on top so it gets the mouseout after dragging  
// this should be removed in favor of an option to draw under or  
// maintain node z-index  
this.layer.drawFeature(vertex);  
},  
 
/**  
* Method: dragComplete  
* Called by the drag feature control when the feature dragging is complete.  
*  
* Parameters:  
* vertex - {<OpenLayers.Feature.Vector>} The vertex being dragged.  
*/  
dragComplete: function(vertex) {  
this.resetVertices();  
this.setFeatureState();  
this.onModification(this.feature);  
this.layer.events.triggerEvent("featuremodified",  
{feature: this.feature});  
},  
 
/**  
* Method: setFeatureState  
* Called when the feature is modified. If the current state is not  
* INSERT or DELETE, the state is set to UPDATE.  
*/  
setFeatureState: function() {  
if(this.feature.state != OpenLayers.State.INSERT &&  
this.feature.state != OpenLayers.State.DELETE) {  
this.feature.state = OpenLayers.State.UPDATE;  
}  
},  
 
/**  
* Method: resetVertices  
*/  
resetVertices: function() {  
// if coming from a drag complete we're about to destroy the vertex  
// that was just dragged. For that reason, the drag feature control  
// will never detect a mouse-out on that vertex, meaning that the drag  
// handler won't be deactivated. This can cause errors because the drag  
// feature control still has a feature to drag but that feature is  
// destroyed. To prevent this, we call outFeature on the drag feature  
// control if the control actually has a feature to drag.  
if(this.dragControl.feature) {  
this.dragControl.outFeature(this.dragControl.feature);  
}  
if(this.vertices.length > 0) {  
this.layer.removeFeatures(this.vertices, {silent: true});  
this.vertices = [];  
}  
if(this.virtualVertices.length > 0) {  
this.layer.removeFeatures(this.virtualVertices, {silent: true});  
this.virtualVertices = [];  
}  
if(this.dragHandle) {  
this.layer.destroyFeatures([this.dragHandle], {silent: true});  
this.dragHandle = null;  
}  
if(this.radiusHandle) {  
this.layer.destroyFeatures([this.radiusHandle], {silent: true});  
this.radiusHandle = null;  
}  
if(this.feature &&  
this.feature.geometry.CLASS_NAME != "OpenLayers.Geometry.Point") {  
if((this.mode & OpenLayers.Control.ModifyFeature.DRAG)) {  
this.collectDragHandle();  
}  
if((this.mode & (OpenLayers.Control.ModifyFeature.ROTATE |  
OpenLayers.Control.ModifyFeature.RESIZE))) {  
this.collectRadiusHandle();  
}  
if(this.mode & OpenLayers.Control.ModifyFeature.RESHAPE){  
// Don't collect vertices when we're resizing  
if (!(this.mode & OpenLayers.Control.ModifyFeature.RESIZE)){  
this.collectVertices();  
}  
}  
}  
},  
 
/**  
* Method: handleKeypress  
* Called by the feature handler on keypress. This is used to delete  
* vertices. If the <deleteCode> property is set, vertices will  
* be deleted when a feature is selected for modification and  
* the mouse is over a vertex.  
*  
* Parameters:  
* {Integer} Key code corresponding to the keypress event.  
*/  
handleKeypress: function(evt) {  
var code = evt.keyCode;  
 
// check for delete key  
if(this.feature &&  
OpenLayers.Util.indexOf(this.deleteCodes, code) != -1) {  
var vertex = this.dragControl.feature;  
if(vertex &&  
OpenLayers.Util.indexOf(this.vertices, vertex) != -1 &&  
!this.dragControl.handlers.drag.dragging &&  
vertex.geometry.parent) {  
// remove the vertex  
vertex.geometry.parent.removeComponent(vertex.geometry);  
this.layer.drawFeature(this.feature, this.standalone ?  
undefined :  
this.selectControl.renderIntent);  
this.resetVertices();  
this.setFeatureState();  
this.onModification(this.feature);  
this.layer.events.triggerEvent("featuremodified",  
{feature: this.feature});  
}  
}  
},  
 
/**  
* Method: collectVertices  
* Collect the vertices from the modifiable feature's geometry and push  
* them on to the control's vertices array.  
*/  
collectVertices: function() {  
this.vertices = [];  
this.virtualVertices = [];  
var control = this;  
function collectComponentVertices(geometry) {  
var i, vertex, component, len;  
if(geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {  
vertex = new OpenLayers.Feature.Vector(geometry);  
vertex._sketch = true;  
control.vertices.push(vertex);  
} else {  
var numVert = geometry.components.length;  
if(geometry.CLASS_NAME == "OpenLayers.Geometry.LinearRing") {  
numVert -= 1;  
}  
for(i=0; i<numVert; ++i) {  
component = geometry.components[i];  
if(component.CLASS_NAME == "OpenLayers.Geometry.Point") {  
vertex = new OpenLayers.Feature.Vector(component);  
vertex._sketch = true;  
control.vertices.push(vertex);  
} else {  
collectComponentVertices(component);  
}  
}  
 
// add virtual vertices in the middle of each edge  
if(geometry.CLASS_NAME != "OpenLayers.Geometry.MultiPoint") {  
for(i=0, len=geometry.components.length; i<len-1; ++i) {  
var prevVertex = geometry.components[i];  
var nextVertex = geometry.components[i + 1];  
if(prevVertex.CLASS_NAME == "OpenLayers.Geometry.Point" &&  
nextVertex.CLASS_NAME == "OpenLayers.Geometry.Point") {  
var x = (prevVertex.x + nextVertex.x) / 2;  
var y = (prevVertex.y + nextVertex.y) / 2;  
var point = new OpenLayers.Feature.Vector(  
new OpenLayers.Geometry.Point(x, y),  
null, control.virtualStyle  
);  
// set the virtual parent and intended index  
point.geometry.parent = geometry;  
point._index = i + 1;  
point._sketch = true;  
control.virtualVertices.push(point);  
}  
}  
}  
}  
}  
collectComponentVertices.call(this, this.feature.geometry);  
this.layer.addFeatures(this.virtualVertices, {silent: true});  
this.layer.addFeatures(this.vertices, {silent: true});  
},  
 
/**  
* Method: collectDragHandle  
* Collect the drag handle for the selected geometry.  
*/  
collectDragHandle: function() {  
var geometry = this.feature.geometry;  
var center = geometry.getBounds().getCenterLonLat();  
var originGeometry = new OpenLayers.Geometry.Point(  
center.lon, center.lat  
);  
var origin = new OpenLayers.Feature.Vector(originGeometry);  
originGeometry.move = function(x, y) {  
OpenLayers.Geometry.Point.prototype.move.call(this, x, y);  
geometry.move(x, y);  
};  
origin._sketch = true;  
this.dragHandle = origin;  
this.layer.addFeatures([this.dragHandle], {silent: true});  
},  
 
/**  
* Method: collectRadiusHandle  
* Collect the radius handle for the selected geometry.  
*/  
collectRadiusHandle: function() {  
var geometry = this.feature.geometry;  
var bounds = geometry.getBounds();  
var center = bounds.getCenterLonLat();  
var originGeometry = new OpenLayers.Geometry.Point(  
center.lon, center.lat  
);  
var radiusGeometry = new OpenLayers.Geometry.Point(  
bounds.right, bounds.bottom  
);  
var radius = new OpenLayers.Feature.Vector(radiusGeometry);  
var resize = (this.mode & OpenLayers.Control.ModifyFeature.RESIZE);  
var reshape = (this.mode & OpenLayers.Control.ModifyFeature.RESHAPE);  
var rotate = (this.mode & OpenLayers.Control.ModifyFeature.ROTATE);  
 
radiusGeometry.move = function(x, y) {  
OpenLayers.Geometry.Point.prototype.move.call(this, x, y);  
var dx1 = this.x - originGeometry.x;  
var dy1 = this.y - originGeometry.y;  
var dx0 = dx1 - x;  
var dy0 = dy1 - y;  
if(rotate) {  
var a0 = Math.atan2(dy0, dx0);  
var a1 = Math.atan2(dy1, dx1);  
var angle = a1 - a0;  
angle *= 180 / Math.PI;  
geometry.rotate(angle, originGeometry);  
}  
if(resize) {  
var scale, ratio;  
// 'resize' together with 'reshape' implies that the aspect  
// ratio of the geometry will not be preserved whilst resizing  
if (reshape) {  
scale = dy1 / dy0;  
ratio = (dx1 / dx0) / scale;  
} else {  
var l0 = Math.sqrt((dx0 * dx0) + (dy0 * dy0));  
var l1 = Math.sqrt((dx1 * dx1) + (dy1 * dy1));  
scale = l1 / l0;  
}  
geometry.resize(scale, originGeometry, ratio);  
}  
};  
radius._sketch = true;  
this.radiusHandle = radius;  
this.layer.addFeatures([this.radiusHandle], {silent: true});  
},  
 
/**  
* Method: setMap  
* Set the map property for the control and all handlers.  
*  
* Parameters:  
* map - {<OpenLayers.Map>} The control's map.  
*/  
setMap: function(map) {  
this.standalone || this.selectControl.setMap(map);  
this.dragControl.setMap(map);  
OpenLayers.Control.prototype.setMap.apply(this, arguments);  
},  
 
CLASS_NAME: "OpenLayers.Control.ModifyFeature"  
});  
 
/**  
* Constant: RESHAPE  
* {Integer} Constant used to make the control work in reshape mode  
*/  
OpenLayers.Control.ModifyFeature.RESHAPE = 1;  
/**  
* Constant: RESIZE  
* {Integer} Constant used to make the control work in resize mode  
*/  
OpenLayers.Control.ModifyFeature.RESIZE = 2;  
/**  
* Constant: ROTATE  
* {Integer} Constant used to make the control work in rotate mode  
*/  
OpenLayers.Control.ModifyFeature.ROTATE = 4;  
/**  
* Constant: DRAG  
* {Integer} Constant used to make the control work in drag mode  
*/  
OpenLayers.Control.ModifyFeature.DRAG = 8;  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.MouseDefaults  
* This class is DEPRECATED in 2.4 and will be removed by 3.0.  
* If you need this functionality, use <OpenLayers.Control.Navigation>  
* instead!!!  
*  
* This class is DEPRECATED in 2.4 and will be removed by 3.0.  
* If you need this functionality, use Control.Navigation instead!!!  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.MouseDefaults = OpenLayers.Class(OpenLayers.Control, {  
 
/** WARNING WARNING WARNING!!!  
This class is DEPRECATED in 2.4 and will be removed by 3.0.  
If you need this functionality, use Control.Navigation instead!!! */  
 
/**  
* Property: performedDrag  
* {Boolean}  
*/  
performedDrag: false,  
 
/**  
* Property: wheelObserver  
* {Function}  
*/  
wheelObserver: null,  
 
/**  
* Constructor: OpenLayers.Control.MouseDefaults  
*/  
initialize: function() {  
OpenLayers.Control.prototype.initialize.apply(this, arguments);  
},  
 
/**  
* APIMethod: destroy  
*/  
destroy: function() {  
 
if (this.handler) {  
this.handler.destroy();  
}  
this.handler = null;  
 
this.map.events.un({  
"click": this.defaultClick,  
"dblclick": this.defaultDblClick,  
"mousedown": this.defaultMouseDown,  
"mouseup": this.defaultMouseUp,  
"mousemove": this.defaultMouseMove,  
"mouseout": this.defaultMouseOut,  
scope: this  
});  
 
//unregister mousewheel events specifically on the window and document  
OpenLayers.Event.stopObserving(window, "DOMMouseScroll",  
this.wheelObserver);  
OpenLayers.Event.stopObserving(window, "mousewheel",  
this.wheelObserver);  
OpenLayers.Event.stopObserving(document, "mousewheel",  
this.wheelObserver);  
this.wheelObserver = null;  
 
OpenLayers.Control.prototype.destroy.apply(this, arguments);  
},  
 
/**  
* Method: draw  
*/  
draw: function() {  
this.map.events.on({  
"click": this.defaultClick,  
"dblclick": this.defaultDblClick,  
"mousedown": this.defaultMouseDown,  
"mouseup": this.defaultMouseUp,  
"mousemove": this.defaultMouseMove,  
"mouseout": this.defaultMouseOut,  
scope: this  
});  
 
this.registerWheelEvents();  
 
},  
 
/**  
* Method: registerWheelEvents  
*/  
registerWheelEvents: function() {  
 
this.wheelObserver = OpenLayers.Function.bindAsEventListener(  
this.onWheelEvent, this  
);  
 
//register mousewheel events specifically on the window and document  
OpenLayers.Event.observe(window, "DOMMouseScroll", this.wheelObserver);  
OpenLayers.Event.observe(window, "mousewheel", this.wheelObserver);  
OpenLayers.Event.observe(document, "mousewheel", this.wheelObserver);  
},  
 
/**  
* Method: defaultClick  
*  
* Parameters:  
* evt - {Event}  
*  
* Returns:  
* {Boolean}  
*/  
defaultClick: function (evt) {  
if (!OpenLayers.Event.isLeftClick(evt)) {  
return;  
}  
var notAfterDrag = !this.performedDrag;  
this.performedDrag = false;  
return notAfterDrag;  
},  
 
/**  
* Method: defaultDblClick  
*  
* Parameters:  
* evt - {Event}  
*/  
defaultDblClick: function (evt) {  
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );  
this.map.setCenter(newCenter, this.map.zoom + 1);  
OpenLayers.Event.stop(evt);  
return false;  
},  
 
/**  
* Method: defaultMouseDown  
*  
* Parameters:  
* evt - {Event}  
*/  
defaultMouseDown: function (evt) {  
if (!OpenLayers.Event.isLeftClick(evt)) {  
return;  
}  
this.mouseDragStart = evt.xy.clone();  
this.performedDrag = false;  
if (evt.shiftKey) {  
this.map.div.style.cursor = "crosshair";  
this.zoomBox = OpenLayers.Util.createDiv('zoomBox',  
this.mouseDragStart,  
null,  
null,  
"absolute",  
"2px solid red");  
this.zoomBox.style.backgroundColor = "white";  
this.zoomBox.style.filter = "alpha(opacity=50)"; // IE  
this.zoomBox.style.opacity = "0.50";  
this.zoomBox.style.fontSize = "1px";  
this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;  
this.map.viewPortDiv.appendChild(this.zoomBox);  
}  
document.onselectstart = OpenLayers.Function.False;  
OpenLayers.Event.stop(evt);  
},  
 
/**  
* Method: defaultMouseMove  
*  
* Parameters:  
* evt - {Event}  
*/  
defaultMouseMove: function (evt) {  
// record the mouse position, used in onWheelEvent  
this.mousePosition = evt.xy.clone();  
 
if (this.mouseDragStart != null) {  
if (this.zoomBox) {  
var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x);  
var deltaY = Math.abs(this.mouseDragStart.y - evt.xy.y);  
this.zoomBox.style.width = Math.max(1, deltaX) + "px";  
this.zoomBox.style.height = Math.max(1, deltaY) + "px";  
if (evt.xy.x < this.mouseDragStart.x) {  
this.zoomBox.style.left = evt.xy.x+"px";  
}  
if (evt.xy.y < this.mouseDragStart.y) {  
this.zoomBox.style.top = evt.xy.y+"px";  
}  
} else {  
var deltaX = this.mouseDragStart.x - evt.xy.x;  
var deltaY = this.mouseDragStart.y - evt.xy.y;  
var size = this.map.getSize();  
var newXY = new OpenLayers.Pixel(size.w / 2 + deltaX,  
size.h / 2 + deltaY);  
var newCenter = this.map.getLonLatFromViewPortPx( newXY );  
this.map.setCenter(newCenter, null, true);  
this.mouseDragStart = evt.xy.clone();  
this.map.div.style.cursor = "move";  
}  
this.performedDrag = true;  
}  
},  
 
/**  
* Method: defaultMouseUp  
*  
* Parameters:  
* evt - {<OpenLayers.Event>}  
*/  
defaultMouseUp: function (evt) {  
if (!OpenLayers.Event.isLeftClick(evt)) {  
return;  
}  
if (this.zoomBox) {  
this.zoomBoxEnd(evt);  
} else {  
if (this.performedDrag) {  
this.map.setCenter(this.map.center);  
}  
}  
document.onselectstart=null;  
this.mouseDragStart = null;  
this.map.div.style.cursor = "";  
},  
 
/**  
* Method: defaultMouseOut  
*  
* Parameters:  
* evt - {Event}  
*/  
defaultMouseOut: function (evt) {  
if (this.mouseDragStart != null &&  
OpenLayers.Util.mouseLeft(evt, this.map.div)) {  
if (this.zoomBox) {  
this.removeZoomBox();  
}  
this.mouseDragStart = null;  
}  
},  
 
 
/**  
* Method: defaultWheelUp  
* User spun scroll wheel up  
*  
*/  
defaultWheelUp: function(evt) {  
if (this.map.getZoom() <= this.map.getNumZoomLevels()) {  
this.map.setCenter(this.map.getLonLatFromPixel(evt.xy),  
this.map.getZoom() + 1);  
}  
},  
 
/**  
* Method: defaultWheelDown  
* User spun scroll wheel down  
*/  
defaultWheelDown: function(evt) {  
if (this.map.getZoom() > 0) {  
this.map.setCenter(this.map.getLonLatFromPixel(evt.xy),  
this.map.getZoom() - 1);  
}  
},  
 
/**  
* Method: zoomBoxEnd  
* Zoombox function.  
*/  
zoomBoxEnd: function(evt) {  
if (this.mouseDragStart != null) {  
if (Math.abs(this.mouseDragStart.x - evt.xy.x) > 5 ||  
Math.abs(this.mouseDragStart.y - evt.xy.y) > 5) {  
var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart );  
var end = this.map.getLonLatFromViewPortPx( evt.xy );  
var top = Math.max(start.lat, end.lat);  
var bottom = Math.min(start.lat, end.lat);  
var left = Math.min(start.lon, end.lon);  
var right = Math.max(start.lon, end.lon);  
var bounds = new OpenLayers.Bounds(left, bottom, right, top);  
this.map.zoomToExtent(bounds);  
} else {  
var end = this.map.getLonLatFromViewPortPx( evt.xy );  
this.map.setCenter(new OpenLayers.LonLat(  
(end.lon),  
(end.lat)  
), this.map.getZoom() + 1);  
}  
this.removeZoomBox();  
}  
},  
 
/**  
* Method: removeZoomBox  
* Remove the zoombox from the screen and nullify our reference to it.  
*/  
removeZoomBox: function() {  
this.map.viewPortDiv.removeChild(this.zoomBox);  
this.zoomBox = null;  
},  
 
 
/**  
* Mouse ScrollWheel code thanks to http://adomas.org/javascript-mouse-wheel/  
*/  
 
 
/**  
* Method: onWheelEvent  
* Catch the wheel event and handle it xbrowserly  
*  
* Parameters:  
* e - {Event}  
*/  
onWheelEvent: function(e){  
 
// first determine whether or not the wheeling was inside the map  
var inMap = false;  
var elem = OpenLayers.Event.element(e);  
while(elem != null) {  
if (this.map && elem == this.map.div) {  
inMap = true;  
break;  
}  
elem = elem.parentNode;  
}  
 
if (inMap) {  
 
var delta = 0;  
if (!e) {  
e = window.event;  
}  
if (e.wheelDelta) {  
delta = e.wheelDelta/120;  
if (window.opera && window.opera.version() < 9.2) {  
delta = -delta;  
}  
} else if (e.detail) {  
delta = -e.detail / 3;  
}  
if (delta) {  
// add the mouse position to the event because mozilla has a bug  
// with clientX and clientY (see https://bugzilla.mozilla.org/show_bug.cgi?id=352179)  
// getLonLatFromViewPortPx(e) returns wrong values  
e.xy = this.mousePosition;  
 
if (delta < 0) {  
this.defaultWheelDown(e);  
} else {  
this.defaultWheelUp(e);  
}  
}  
 
//only wheel the map, not the window  
OpenLayers.Event.stop(e);  
}  
},  
 
CLASS_NAME: "OpenLayers.Control.MouseDefaults"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.MousePosition  
* The MousePosition control displays geographic coordinates of the mouse  
* pointer, as it is moved about the map.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* APIProperty: autoActivate  
* {Boolean} Activate the control when it is added to a map. Default is  
* true.  
*/  
autoActivate: true,  
 
/**  
* Property: element  
* {DOMElement}  
*/  
element: null,  
 
/**  
* APIProperty: prefix  
* {String}  
*/  
prefix: '',  
 
/**  
* APIProperty: separator  
* {String}  
*/  
separator: ', ',  
 
/**  
* APIProperty: suffix  
* {String}  
*/  
suffix: '',  
 
/**  
* APIProperty: numDigits  
* {Integer}  
*/  
numDigits: 5,  
 
/**  
* APIProperty: granularity  
* {Integer}  
*/  
granularity: 10,  
 
/**  
* APIProperty: emptyString  
* {String} Set this to some value to set when the mouse is outside the  
* map.  
*/  
emptyString: null,  
 
/**  
* Property: lastXy  
* {<OpenLayers.Pixel>}  
*/  
lastXy: null,  
 
/**  
* APIProperty: displayProjection  
* {<OpenLayers.Projection>} The projection in which the  
* mouse position is displayed  
*/  
displayProjection: null,  
 
/**  
* Constructor: OpenLayers.Control.MousePosition  
*  
* Parameters:  
* options - {Object} Options for control.  
*/  
initialize: function(options) {  
OpenLayers.Control.prototype.initialize.apply(this, arguments);  
},  
 
/**  
* Method: destroy  
*/  
destroy: function() {  
this.deactivate();  
OpenLayers.Control.prototype.destroy.apply(this, arguments);  
},  
 
/**  
* APIMethod: activate  
*/  
activate: function() {  
if (OpenLayers.Control.prototype.activate.apply(this, arguments)) {  
this.map.events.register('mousemove', this, this.redraw);  
this.map.events.register('mouseout', this, this.reset);  
this.redraw();  
return true;  
} else {  
return false;  
}  
},  
 
/**  
* APIMethod: deactivate  
*/  
deactivate: function() {  
if (OpenLayers.Control.prototype.deactivate.apply(this, arguments)) {  
this.map.events.unregister('mousemove', this, this.redraw);  
this.map.events.unregister('mouseout', this, this.reset);  
this.element.innerHTML = "";  
return true;  
} else {  
return false;  
}  
},  
 
/**  
* Method: draw  
* {DOMElement}  
*/  
draw: function() {  
OpenLayers.Control.prototype.draw.apply(this, arguments);  
 
if (!this.element) {  
this.div.left = "";  
this.div.top = "";  
this.element = this.div;  
}  
 
return this.div;  
},  
 
/**  
* Method: redraw  
*/  
redraw: function(evt) {  
 
var lonLat;  
 
if (evt == null) {  
this.reset();  
return;  
} else {  
if (this.lastXy == null ||  
Math.abs(evt.xy.x - this.lastXy.x) > this.granularity ||  
Math.abs(evt.xy.y - this.lastXy.y) > this.granularity)  
{  
this.lastXy = evt.xy;  
return;  
}  
 
lonLat = this.map.getLonLatFromPixel(evt.xy);  
if (!lonLat) {  
// map has not yet been properly initialized  
return;  
}  
if (this.displayProjection) {  
lonLat.transform(this.map.getProjectionObject(),  
this.displayProjection );  
}  
this.lastXy = evt.xy;  
 
}  
 
var newHtml = this.formatOutput(lonLat);  
 
if (newHtml != this.element.innerHTML) {  
this.element.innerHTML = newHtml;  
}  
},  
 
/**  
* Method: reset  
*/  
reset: function(evt) {  
if (this.emptyString != null) {  
this.element.innerHTML = this.emptyString;  
}  
},  
 
/**  
* Method: formatOutput  
* Override to provide custom display output  
*  
* Parameters:  
* lonLat - {<OpenLayers.LonLat>} Location to display  
*/  
formatOutput: function(lonLat) {  
var digits = parseInt(this.numDigits);  
var newHtml =  
this.prefix +  
lonLat.lon.toFixed(digits) +  
this.separator +  
lonLat.lat.toFixed(digits) +  
this.suffix;  
return newHtml;  
},  
 
CLASS_NAME: "OpenLayers.Control.MousePosition"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Control/MouseDefaults.js  
*/  
 
/**  
* Class: OpenLayers.Control.MouseToolbar  
* This class is DEPRECATED in 2.4 and will be removed by 3.0.  
* If you need this functionality, use <OpenLayers.Control.NavToolbar>  
* instead!!!  
*/  
OpenLayers.Control.MouseToolbar = OpenLayers.Class(  
OpenLayers.Control.MouseDefaults, {  
 
/**  
* Property: mode  
*/  
mode: null,  
/**  
* Property: buttons  
*/  
buttons: null,  
 
/**  
* APIProperty: direction  
* {String} 'vertical' or 'horizontal'  
*/  
direction: "vertical",  
 
/**  
* Property: buttonClicked  
* {String}  
*/  
buttonClicked: null,  
 
/**  
* Constructor: OpenLayers.Control.MouseToolbar  
*  
* Parameters:  
* position - {<OpenLayers.Pixel>}  
* direction - {String}  
*/  
initialize: function(position, direction) {  
OpenLayers.Control.prototype.initialize.apply(this, arguments);  
this.position = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,  
OpenLayers.Control.MouseToolbar.Y);  
if (position) {  
this.position = position;  
}  
if (direction) {  
this.direction = direction;  
}  
this.measureDivs = [];  
},  
 
/**  
* APIMethod: destroy  
*/  
destroy: function() {  
for( var btnId in this.buttons) {  
var btn = this.buttons[btnId];  
btn.map = null;  
btn.events.destroy();  
}  
OpenLayers.Control.MouseDefaults.prototype.destroy.apply(this,  
arguments);  
},  
 
/**  
* Method: draw  
*/  
draw: function() {  
OpenLayers.Control.prototype.draw.apply(this, arguments);  
OpenLayers.Control.MouseDefaults.prototype.draw.apply(this, arguments);  
this.buttons = {};  
var sz = new OpenLayers.Size(28,28);  
var centered = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,0);  
this._addButton("zoombox", "drag-rectangle-off.png", "drag-rectangle-on.png", centered, sz, "Shift->Drag to zoom to area");  
centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0));  
this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", centered, sz, "Drag the map to pan.");  
centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0));  
this.switchModeTo("pan");  
 
return this.div;  
},  
 
/**  
* Method: _addButton  
*/  
_addButton:function(id, img, activeImg, xy, sz, title) {  
var imgLocation = OpenLayers.Util.getImagesLocation() + img;  
var activeImgLocation = OpenLayers.Util.getImagesLocation() + activeImg;  
// var btn = new ol.AlphaImage("_"+id, imgLocation, xy, sz);  
var btn = OpenLayers.Util.createAlphaImageDiv(  
"OpenLayers_Control_MouseToolbar_" + id,  
xy, sz, imgLocation, "absolute");  
 
//we want to add the outer div  
this.div.appendChild(btn);  
btn.imgLocation = imgLocation;  
btn.activeImgLocation = activeImgLocation;  
 
btn.events = new OpenLayers.Events(this, btn, null, true);  
btn.events.on({  
"mousedown": this.buttonDown,  
"mouseup": this.buttonUp,  
"dblclick": OpenLayers.Event.stop,  
scope: this  
});  
btn.action = id;  
btn.title = title;  
btn.alt = title;  
btn.map = this.map;  
 
//we want to remember/reference the outer div  
this.buttons[id] = btn;  
return btn;  
},  
 
/**  
* Method: buttonDown  
*  
* Parameters:  
* evt - {Event}  
*/  
buttonDown: function(evt) {  
if (!OpenLayers.Event.isLeftClick(evt)) {  
return;  
}  
this.buttonClicked = evt.element.action;  
OpenLayers.Event.stop(evt);  
},  
 
/**  
* Method: buttonUp  
*  
* Parameters:  
* evt - {Event}  
*/  
buttonUp: function(evt) {  
if (!OpenLayers.Event.isLeftClick(evt)) {  
return;  
}  
if (this.buttonClicked != null) {  
if (this.buttonClicked == evt.element.action) {  
this.switchModeTo(evt.element.action);  
}  
OpenLayers.Event.stop(evt);  
this.buttonClicked = null;  
}  
},  
 
/**  
* Method: defaultDblClick  
*  
* Parameters:  
* evt - {Event}  
*/  
defaultDblClick: function (evt) {  
this.switchModeTo("pan");  
this.performedDrag = false;  
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );  
this.map.setCenter(newCenter, this.map.zoom + 1);  
OpenLayers.Event.stop(evt);  
return false;  
},  
 
/**  
* Method: defaultMouseDown  
*  
* Parameters:  
* evt - {Event}  
*/  
defaultMouseDown: function (evt) {  
if (!OpenLayers.Event.isLeftClick(evt)) {  
return;  
}  
this.mouseDragStart = evt.xy.clone();  
this.performedDrag = false;  
this.startViaKeyboard = false;  
if (evt.shiftKey && this.mode !="zoombox") {  
this.switchModeTo("zoombox");  
this.startViaKeyboard = true;  
} else if (evt.altKey && this.mode !="measure") {  
this.switchModeTo("measure");  
} else if (!this.mode) {  
this.switchModeTo("pan");  
}  
 
switch (this.mode) {  
case "zoombox":  
this.map.div.style.cursor = "crosshair";  
this.zoomBox = OpenLayers.Util.createDiv('zoomBox',  
this.mouseDragStart,  
null,  
null,  
"absolute",  
"2px solid red");  
this.zoomBox.style.backgroundColor = "white";  
this.zoomBox.style.filter = "alpha(opacity=50)"; // IE  
this.zoomBox.style.opacity = "0.50";  
this.zoomBox.style.fontSize = "1px";  
this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;  
this.map.viewPortDiv.appendChild(this.zoomBox);  
this.performedDrag = true;  
break;  
case "measure":  
var distance = "";  
if (this.measureStart) {  
var measureEnd = this.map.getLonLatFromViewPortPx(this.mouseDragStart);  
distance = OpenLayers.Util.distVincenty(this.measureStart, measureEnd);  
distance = Math.round(distance * 100) / 100;  
distance = distance + "km";  
this.measureStartBox = this.measureBox;  
}  
this.measureStart = this.map.getLonLatFromViewPortPx(this.mouseDragStart);;  
this.measureBox = OpenLayers.Util.createDiv(null,  
this.mouseDragStart.add(  
-2-parseInt(this.map.layerContainerDiv.style.left),  
-2-parseInt(this.map.layerContainerDiv.style.top)),  
null,  
null,  
"absolute");  
this.measureBox.style.width="4px";  
this.measureBox.style.height="4px";  
this.measureBox.style.fontSize = "1px";  
this.measureBox.style.backgroundColor="red";  
this.measureBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;  
this.map.layerContainerDiv.appendChild(this.measureBox);  
if (distance) {  
this.measureBoxDistance = OpenLayers.Util.createDiv(null,  
this.mouseDragStart.add(  
-2-parseInt(this.map.layerContainerDiv.style.left),  
2-parseInt(this.map.layerContainerDiv.style.top)),  
null,  
null,  
"absolute");  
 
this.measureBoxDistance.innerHTML = distance;  
this.measureBoxDistance.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;  
this.map.layerContainerDiv.appendChild(this.measureBoxDistance);  
this.measureDivs.push(this.measureBoxDistance);  
}  
this.measureBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;  
this.map.layerContainerDiv.appendChild(this.measureBox);  
this.measureDivs.push(this.measureBox);  
break;  
default:  
this.map.div.style.cursor = "move";  
break;  
}  
document.onselectstart = OpenLayers.Function.False;  
OpenLayers.Event.stop(evt);  
},  
 
/**  
* Method: switchModeTo  
*  
* Parameters:  
* mode - {String}  
*/  
switchModeTo: function(mode) {  
if (mode != this.mode) {  
 
 
if (this.mode && this.buttons[this.mode]) {  
OpenLayers.Util.modifyAlphaImageDiv(this.buttons[this.mode], null, null, null, this.buttons[this.mode].imgLocation);  
}  
if (this.mode == "measure" && mode != "measure") {  
for(var i=0, len=this.measureDivs.length; i<len; i++) {  
if (this.measureDivs[i]) {  
this.map.layerContainerDiv.removeChild(this.measureDivs[i]);  
}  
}  
this.measureDivs = [];  
this.measureStart = null;  
}  
this.mode = mode;  
if (this.buttons[mode]) {  
OpenLayers.Util.modifyAlphaImageDiv(this.buttons[mode], null, null, null, this.buttons[mode].activeImgLocation);  
}  
switch (this.mode) {  
case "zoombox":  
this.map.div.style.cursor = "crosshair";  
break;  
default:  
this.map.div.style.cursor = "";  
break;  
}  
 
}  
},  
 
/**  
* Method: leaveMode  
*/  
leaveMode: function() {  
this.switchModeTo("pan");  
},  
 
/**  
* Method: defaultMouseMove  
*  
* Parameters:  
* evt - {Event}  
*/  
defaultMouseMove: function (evt) {  
if (this.mouseDragStart != null) {  
switch (this.mode) {  
case "zoombox":  
var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x);  
var deltaY = Math.abs(this.mouseDragStart.y - evt.xy.y);  
this.zoomBox.style.width = Math.max(1, deltaX) + "px";  
this.zoomBox.style.height = Math.max(1, deltaY) + "px";  
if (evt.xy.x < this.mouseDragStart.x) {  
this.zoomBox.style.left = evt.xy.x+"px";  
}  
if (evt.xy.y < this.mouseDragStart.y) {  
this.zoomBox.style.top = evt.xy.y+"px";  
}  
break;  
default:  
var deltaX = this.mouseDragStart.x - evt.xy.x;  
var deltaY = this.mouseDragStart.y - evt.xy.y;  
var size = this.map.getSize();  
var newXY = new OpenLayers.Pixel(size.w / 2 + deltaX,  
size.h / 2 + deltaY);  
var newCenter = this.map.getLonLatFromViewPortPx( newXY );  
this.map.setCenter(newCenter, null, true);  
this.mouseDragStart = evt.xy.clone();  
}  
this.performedDrag = true;  
}  
},  
 
/**  
* Method: defaultMouseUp  
*  
* Parameters:  
* evt - {Event}  
*/  
defaultMouseUp: function (evt) {  
if (!OpenLayers.Event.isLeftClick(evt)) {  
return;  
}  
switch (this.mode) {  
case "zoombox":  
this.zoomBoxEnd(evt);  
if (this.startViaKeyboard) {  
this.leaveMode();  
}  
break;  
case "pan":  
if (this.performedDrag) {  
this.map.setCenter(this.map.center);  
}  
}  
document.onselectstart = null;  
this.mouseDragStart = null;  
this.map.div.style.cursor = "default";  
},  
 
/**  
* Method: defaultMouseOut  
*  
* Parameters:  
* evt - {Event}  
*/  
defaultMouseOut: function (evt) {  
if (this.mouseDragStart != null  
&& OpenLayers.Util.mouseLeft(evt, this.map.div)) {  
if (this.zoomBox) {  
this.removeZoomBox();  
if (this.startViaKeyboard) {  
this.leaveMode();  
}  
}  
this.mouseDragStart = null;  
this.map.div.style.cursor = "default";  
}  
},  
 
/**  
* Method: defaultClick  
*  
* Parameters:  
* evt - {Event}  
*/  
defaultClick: function (evt) {  
if (this.performedDrag) {  
this.performedDrag = false;  
return false;  
}  
},  
 
CLASS_NAME: "OpenLayers.Control.MouseToolbar"  
});  
 
OpenLayers.Control.MouseToolbar.X = 6;  
OpenLayers.Control.MouseToolbar.Y = 300;  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control/Panel.js  
* @requires OpenLayers/Control/Navigation.js  
* @requires OpenLayers/Control/ZoomBox.js  
*/  
 
/**  
* Class: OpenLayers.Control.NavToolbar  
* This Toolbar is an alternative to the Navigation control that displays  
* the state of the control, and provides a UI for changing state to  
* use the zoomBox via a Panel control.  
*  
* If you wish to change the properties of the Navigation control used  
* in the NavToolbar, see:  
* http://trac.openlayers.org/wiki/Toolbars#SubclassingNavToolbar  
*  
*  
* Inherits from:  
* - <OpenLayers.Control.Panel>  
*/  
OpenLayers.Control.NavToolbar = OpenLayers.Class(OpenLayers.Control.Panel, {  
 
/**  
* Constructor: OpenLayers.Control.NavToolbar  
* Add our two mousedefaults controls.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be used  
* to extend the control.  
*/  
initialize: function(options) {  
OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);  
this.addControls([  
new OpenLayers.Control.Navigation(),  
new OpenLayers.Control.ZoomBox()  
]);  
},  
 
/**  
* Method: draw  
* calls the default draw, and then activates mouse defaults.  
*/  
draw: function() {  
var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);  
this.activateControl(this.controls[0]);  
return div;  
},  
 
CLASS_NAME: "OpenLayers.Control.NavToolbar"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control/ZoomBox.js  
* @requires OpenLayers/Control/DragPan.js  
* @requires OpenLayers/Handler/MouseWheel.js  
* @requires OpenLayers/Handler/Click.js  
*/  
 
/**  
* Class: OpenLayers.Control.Navigation  
* The navigation control handles map browsing with mouse events (dragging,  
* double-clicking, and scrolling the wheel). Create a new navigation  
* control with the <OpenLayers.Control.Navigation> control.  
*  
* Note that this control is added to the map by default (if no controls  
* array is sent in the options object to the <OpenLayers.Map>  
* constructor).  
*  
* Inherits:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Property: dragPan  
* {<OpenLayers.Control.DragPan>}  
*/  
dragPan: null,  
 
/**  
* APIProprety: dragPanOptions  
* {Object} Options passed to the DragPan control.  
*/  
dragPanOptions: null,  
 
/**  
* APIProperty: documentDrag  
* {Boolean} Allow panning of the map by dragging outside map viewport.  
* Default is false.  
*/  
documentDrag: false,  
 
/**  
* Property: zoomBox  
* {<OpenLayers.Control.ZoomBox>}  
*/  
zoomBox: null,  
 
/**  
* APIProperty: zoomBoxEnabled  
* {Boolean} Whether the user can draw a box to zoom  
*/  
zoomBoxEnabled: true,  
 
/**  
* APIProperty: zoomWheelEnabled  
* {Boolean} Whether the mousewheel should zoom the map  
*/  
zoomWheelEnabled: true,  
 
/**  
* Property: mouseWheelOptions  
* {Object} Options passed to the MouseWheel control (only useful if  
* <zoomWheelEnabled> is set to true)  
*/  
mouseWheelOptions: null,  
 
/**  
* APIProperty: handleRightClicks  
* {Boolean} Whether or not to handle right clicks. Default is false.  
*/  
handleRightClicks: false,  
 
/**  
* APIProperty: zoomBoxKeyMask  
* {Integer} <OpenLayers.Handler> key code of the key, which has to be  
* pressed, while drawing the zoom box with the mouse on the screen.  
* You should probably set handleRightClicks to true if you use this  
* with MOD_CTRL, to disable the context menu for machines which use  
* CTRL-Click as a right click.  
* Default: <OpenLayers.Handler.MOD_SHIFT  
*/  
zoomBoxKeyMask: OpenLayers.Handler.MOD_SHIFT,  
 
/**  
* APIProperty: autoActivate  
* {Boolean} Activate the control when it is added to a map. Default is  
* true.  
*/  
autoActivate: true,  
 
/**  
* Constructor: OpenLayers.Control.Navigation  
* Create a new navigation control  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* the control  
*/  
initialize: function(options) {  
this.handlers = {};  
OpenLayers.Control.prototype.initialize.apply(this, arguments);  
},  
 
/**  
* Method: destroy  
* The destroy method is used to perform any clean up before the control  
* is dereferenced. Typically this is where event listeners are removed  
* to prevent memory leaks.  
*/  
destroy: function() {  
this.deactivate();  
 
if (this.dragPan) {  
this.dragPan.destroy();  
}  
this.dragPan = null;  
 
if (this.zoomBox) {  
this.zoomBox.destroy();  
}  
this.zoomBox = null;  
OpenLayers.Control.prototype.destroy.apply(this,arguments);  
},  
 
/**  
* Method: activate  
*/  
activate: function() {  
this.dragPan.activate();  
if (this.zoomWheelEnabled) {  
this.handlers.wheel.activate();  
}  
this.handlers.click.activate();  
if (this.zoomBoxEnabled) {  
this.zoomBox.activate();  
}  
return OpenLayers.Control.prototype.activate.apply(this,arguments);  
},  
 
/**  
* Method: deactivate  
*/  
deactivate: function() {  
this.zoomBox.deactivate();  
this.dragPan.deactivate();  
this.handlers.click.deactivate();  
this.handlers.wheel.deactivate();  
return OpenLayers.Control.prototype.deactivate.apply(this,arguments);  
},  
 
/**  
* Method: draw  
*/  
draw: function() {  
// disable right mouse context menu for support of right click events  
if (this.handleRightClicks) {  
this.map.viewPortDiv.oncontextmenu = OpenLayers.Function.False;  
}  
 
var clickCallbacks = {  
'dblclick': this.defaultDblClick,  
'dblrightclick': this.defaultDblRightClick  
};  
var clickOptions = {  
'double': true,  
'stopDouble': true  
};  
this.handlers.click = new OpenLayers.Handler.Click(  
this, clickCallbacks, clickOptions  
);  
this.dragPan = new OpenLayers.Control.DragPan(  
OpenLayers.Util.extend({  
map: this.map,  
documentDrag: this.documentDrag  
}, this.dragPanOptions)  
);  
this.zoomBox = new OpenLayers.Control.ZoomBox(  
{map: this.map, keyMask: this.zoomBoxKeyMask});  
this.dragPan.draw();  
this.zoomBox.draw();  
this.handlers.wheel = new OpenLayers.Handler.MouseWheel(  
this, {"up" : this.wheelUp,  
"down": this.wheelDown},  
this.mouseWheelOptions );  
},  
 
/**  
* Method: defaultDblClick  
*  
* Parameters:  
* evt - {Event}  
*/  
defaultDblClick: function (evt) {  
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );  
this.map.setCenter(newCenter, this.map.zoom + 1);  
},  
 
/**  
* Method: defaultDblRightClick  
*  
* Parameters:  
* evt - {Event}  
*/  
defaultDblRightClick: function (evt) {  
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );  
this.map.setCenter(newCenter, this.map.zoom - 1);  
},  
 
/**  
* Method: wheelChange  
*  
* Parameters:  
* evt - {Event}  
* deltaZ - {Integer}  
*/  
wheelChange: function(evt, deltaZ) {  
var currentZoom = this.map.getZoom();  
var newZoom = this.map.getZoom() + Math.round(deltaZ);  
newZoom = Math.max(newZoom, 0);  
newZoom = Math.min(newZoom, this.map.getNumZoomLevels());  
if (newZoom === currentZoom) {  
return;  
}  
var size = this.map.getSize();  
var deltaX = size.w/2 - evt.xy.x;  
var deltaY = evt.xy.y - size.h/2;  
var newRes = this.map.baseLayer.getResolutionForZoom(newZoom);  
var zoomPoint = this.map.getLonLatFromPixel(evt.xy);  
var newCenter = new OpenLayers.LonLat(  
zoomPoint.lon + deltaX * newRes,  
zoomPoint.lat + deltaY * newRes );  
this.map.setCenter( newCenter, newZoom );  
},  
 
/**  
* Method: wheelUp  
* User spun scroll wheel up  
*  
* Parameters:  
* evt - {Event}  
* delta - {Integer}  
*/  
wheelUp: function(evt, delta) {  
this.wheelChange(evt, delta || 1);  
},  
 
/**  
* Method: wheelDown  
* User spun scroll wheel down  
*  
* Parameters:  
* evt - {Event}  
* delta - {Integer}  
*/  
wheelDown: function(evt, delta) {  
this.wheelChange(evt, delta || -1);  
},  
 
/**  
* Method: disableZoomBox  
*/  
disableZoomBox : function() {  
this.zoomBoxEnabled = false;  
this.zoomBox.deactivate();  
},  
 
/**  
* Method: enableZoomBox  
*/  
enableZoomBox : function() {  
this.zoomBoxEnabled = true;  
if (this.active) {  
this.zoomBox.activate();  
}  
},  
 
/**  
* Method: disableZoomWheel  
*/  
 
disableZoomWheel : function() {  
this.zoomWheelEnabled = false;  
this.handlers.wheel.deactivate();  
},  
 
/**  
* Method: enableZoomWheel  
*/  
 
enableZoomWheel : function() {  
this.zoomWheelEnabled = true;  
if (this.active) {  
this.handlers.wheel.activate();  
}  
},  
 
CLASS_NAME: "OpenLayers.Control.Navigation"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Control/Button.js  
*/  
 
/**  
* Class: OpenLayers.Control.NavigationHistory  
* A navigation history control. This is a meta-control, that creates two  
* dependent controls: <previous> and <next>. Call the trigger method  
* on the <previous> and <next> controls to restore previous and next  
* history states. The previous and next controls will become active  
* when there are available states to restore and will become deactive  
* when there are no states to restore.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Property: type  
* {String} Note that this control is not intended to be added directly  
* to a control panel. Instead, add the sub-controls previous and  
* next. These sub-controls are button type controls that activate  
* and deactivate themselves. If this parent control is added to  
* a panel, it will act as a toggle.  
*/  
type: OpenLayers.Control.TYPE_TOGGLE,  
 
/**  
* APIProperty: previous  
* {<OpenLayers.Control>} A button type control whose trigger method restores  
* the previous state managed by this control.  
*/  
previous: null,  
 
/**  
* APIProperty: previousOptions  
* {Object} Set this property on the options argument of the constructor  
* to set optional properties on the <previous> control.  
*/  
previousOptions: null,  
 
/**  
* APIProperty: next  
* {<OpenLayers.Control>} A button type control whose trigger method restores  
* the next state managed by this control.  
*/  
next: null,  
 
/**  
* APIProperty: nextOptions  
* {Object} Set this property on the options argument of the constructor  
* to set optional properties on the <next> control.  
*/  
nextOptions: null,  
 
/**  
* APIProperty: limit  
* {Integer} Optional limit on the number of history items to retain. If  
* null, there is no limit. Default is 50.  
*/  
limit: 50,  
 
/**  
* APIProperty: autoActivate  
* {Boolean} Activate the control when it is added to a map. Default is  
* true.  
*/  
autoActivate: true,  
 
/**  
* Property: clearOnDeactivate  
* {Boolean} Clear the history when the control is deactivated. Default  
* is false.  
*/  
clearOnDeactivate: false,  
 
/**  
* Property: registry  
* {Object} An object with keys corresponding to event types. Values  
* are functions that return an object representing the current state.  
*/  
registry: null,  
 
/**  
* Property: nextStack  
* {Array} Array of items in the history.  
*/  
nextStack: null,  
 
/**  
* Property: previousStack  
* {Array} List of items in the history. First item represents the current  
* state.  
*/  
previousStack: null,  
 
/**  
* Property: listeners  
* {Object} An object containing properties corresponding to event types.  
* This object is used to configure the control and is modified on  
* construction.  
*/  
listeners: null,  
 
/**  
* Property: restoring  
* {Boolean} Currently restoring a history state. This is set to true  
* before calling restore and set to false after restore returns.  
*/  
restoring: false,  
 
/**  
* Constructor: OpenLayers.Control.NavigationHistory  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be used  
* to extend the control.  
*/  
initialize: function(options) {  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
 
this.registry = OpenLayers.Util.extend({  
"moveend": this.getState  
}, this.registry);  
 
var previousOptions = {  
trigger: OpenLayers.Function.bind(this.previousTrigger, this),  
displayClass: this.displayClass + " " + this.displayClass + "Previous"  
};  
OpenLayers.Util.extend(previousOptions, this.previousOptions);  
this.previous = new OpenLayers.Control.Button(previousOptions);  
 
var nextOptions = {  
trigger: OpenLayers.Function.bind(this.nextTrigger, this),  
displayClass: this.displayClass + " " + this.displayClass + "Next"  
};  
OpenLayers.Util.extend(nextOptions, this.nextOptions);  
this.next = new OpenLayers.Control.Button(nextOptions);  
 
this.clear();  
},  
 
/**  
* Method: onPreviousChange  
* Called when the previous history stack changes.  
*  
* Parameters:  
* state - {Object} An object representing the state to be restored  
* if previous is triggered again or null if no previous states remain.  
* length - {Integer} The number of remaining previous states that can  
* be restored.  
*/  
onPreviousChange: function(state, length) {  
if(state && !this.previous.active) {  
this.previous.activate();  
} else if(!state && this.previous.active) {  
this.previous.deactivate();  
}  
},  
 
/**  
* Method: onNextChange  
* Called when the next history stack changes.  
*  
* Parameters:  
* state - {Object} An object representing the state to be restored  
* if next is triggered again or null if no next states remain.  
* length - {Integer} The number of remaining next states that can  
* be restored.  
*/  
onNextChange: function(state, length) {  
if(state && !this.next.active) {  
this.next.activate();  
} else if(!state && this.next.active) {  
this.next.deactivate();  
}  
},  
 
/**  
* APIMethod: destroy  
* Destroy the control.  
*/  
destroy: function() {  
OpenLayers.Control.prototype.destroy.apply(this);  
this.previous.destroy();  
this.next.destroy();  
this.deactivate();  
for(var prop in this) {  
this[prop] = null;  
}  
},  
 
/**  
* Method: setMap  
* Set the map property for the control and <previous> and <next> child  
* controls.  
*  
* Parameters:  
* map - {<OpenLayers.Map>}  
*/  
setMap: function(map) {  
this.map = map;  
this.next.setMap(map);  
this.previous.setMap(map);  
},  
 
/**  
* Method: draw  
* Called when the control is added to the map.  
*/  
draw: function() {  
OpenLayers.Control.prototype.draw.apply(this, arguments);  
this.next.draw();  
this.previous.draw();  
},  
 
/**  
* Method: previousTrigger  
* Restore the previous state. If no items are in the previous history  
* stack, this has no effect.  
*  
* Returns:  
* {Object} Item representing state that was restored. Undefined if no  
* items are in the previous history stack.  
*/  
previousTrigger: function() {  
var current = this.previousStack.shift();  
var state = this.previousStack.shift();  
if(state != undefined) {  
this.nextStack.unshift(current);  
this.previousStack.unshift(state);  
this.restoring = true;  
this.restore(state);  
this.restoring = false;  
this.onNextChange(this.nextStack[0], this.nextStack.length);  
this.onPreviousChange(  
this.previousStack[1], this.previousStack.length - 1  
);  
} else {  
this.previousStack.unshift(current);  
}  
return state;  
},  
 
/**  
* APIMethod: nextTrigger  
* Restore the next state. If no items are in the next history  
* stack, this has no effect. The next history stack is populated  
* as states are restored from the previous history stack.  
*  
* Returns:  
* {Object} Item representing state that was restored. Undefined if no  
* items are in the next history stack.  
*/  
nextTrigger: function() {  
var state = this.nextStack.shift();  
if(state != undefined) {  
this.previousStack.unshift(state);  
this.restoring = true;  
this.restore(state);  
this.restoring = false;  
this.onNextChange(this.nextStack[0], this.nextStack.length);  
this.onPreviousChange(  
this.previousStack[1], this.previousStack.length - 1  
);  
}  
return state;  
},  
 
/**  
* APIMethod: clear  
* Clear history.  
*/  
clear: function() {  
this.previousStack = [];  
this.previous.deactivate();  
this.nextStack = [];  
this.next.deactivate();  
},  
 
/**  
* Method: getState  
* Get the current state and return it.  
*  
* Returns:  
* {Object} An object representing the current state.  
*/  
getState: function() {  
return {  
center: this.map.getCenter(),  
resolution: this.map.getResolution(),  
projection: this.map.getProjectionObject(),  
units: this.map.getProjectionObject().getUnits() ||  
this.map.units || this.map.baseLayer.units  
};  
},  
 
/**  
* Method: restore  
* Update the state with the given object.  
*  
* Parameters:  
* state - {Object} An object representing the state to restore.  
*/  
restore: function(state) {  
var center, zoom;  
if (this.map.getProjectionObject() == state.projection) {  
zoom = this.map.getZoomForResolution(state.resolution);  
center = state.center;  
} else {  
center = state.center.clone();  
center.transform(state.projection, this.map.getProjectionObject());  
var sourceUnits = state.units;  
var targetUnits = this.map.getProjectionObject().getUnits() ||  
this.map.units || this.map.baseLayer.units;  
var resolutionFactor = sourceUnits && targetUnits ?  
OpenLayers.INCHES_PER_UNIT[sourceUnits] / OpenLayers.INCHES_PER_UNIT[targetUnits] : 1;  
zoom = this.map.getZoomForResolution(resolutionFactor*state.resolution);  
}  
this.map.setCenter(center, zoom);  
},  
 
/**  
* Method: setListeners  
* Sets functions to be registered in the listeners object.  
*/  
setListeners: function() {  
this.listeners = {};  
for(var type in this.registry) {  
this.listeners[type] = OpenLayers.Function.bind(function() {  
if(!this.restoring) {  
var state = this.registry[type].apply(this, arguments);  
this.previousStack.unshift(state);  
if(this.previousStack.length > 1) {  
this.onPreviousChange(  
this.previousStack[1], this.previousStack.length - 1  
);  
}  
if(this.previousStack.length > (this.limit + 1)) {  
this.previousStack.pop();  
}  
if(this.nextStack.length > 0) {  
this.nextStack = [];  
this.onNextChange(null, 0);  
}  
}  
return true;  
}, this);  
}  
},  
 
/**  
* APIMethod: activate  
* Activate the control. This registers any listeners.  
*  
* Returns:  
* {Boolean} Control successfully activated.  
*/  
activate: function() {  
var activated = false;  
if(this.map) {  
if(OpenLayers.Control.prototype.activate.apply(this)) {  
if(this.listeners == null) {  
this.setListeners();  
}  
for(var type in this.listeners) {  
this.map.events.register(type, this, this.listeners[type]);  
}  
activated = true;  
if(this.previousStack.length == 0) {  
this.initStack();  
}  
}  
}  
return activated;  
},  
 
/**  
* Method: initStack  
* Called after the control is activated if the previous history stack is  
* empty.  
*/  
initStack: function() {  
if(this.map.getCenter()) {  
this.listeners.moveend();  
}  
},  
 
/**  
* APIMethod: deactivate  
* Deactivate the control. This unregisters any listeners.  
*  
* Returns:  
* {Boolean} Control successfully deactivated.  
*/  
deactivate: function() {  
var deactivated = false;  
if(this.map) {  
if(OpenLayers.Control.prototype.deactivate.apply(this)) {  
for(var type in this.listeners) {  
this.map.events.unregister(  
type, this, this.listeners[type]  
);  
}  
if(this.clearOnDeactivate) {  
this.clear();  
}  
deactivated = true;  
}  
}  
return deactivated;  
},  
 
CLASS_NAME: "OpenLayers.Control.NavigationHistory"  
});  
 
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/BaseTypes.js  
* @requires OpenLayers/Events.js  
*/  
 
/**  
* Class: OpenLayers.Control.OverviewMap  
* The OverMap control creates a small overview map, useful to display the  
* extent of a zoomed map and your main map and provide additional  
* navigation options to the User. By default the overview map is drawn in  
* the lower right corner of the main map. Create a new overview map with the  
* <OpenLayers.Control.OverviewMap> constructor.  
*  
* Inerits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Property: element  
* {DOMElement} The DOM element that contains the overview map  
*/  
element: null,  
 
/**  
* APIProperty: ovmap  
* {<OpenLayers.Map>} A reference to the overview map itself.  
*/  
ovmap: null,  
 
/**  
* APIProperty: size  
* {<OpenLayers.Size>} The overvew map size in pixels. Note that this is  
* the size of the map itself - the element that contains the map (default  
* class name olControlOverviewMapElement) may have padding or other style  
* attributes added via CSS.  
*/  
size: new OpenLayers.Size(180, 90),  
 
/**  
* APIProperty: layers  
* {Array(<OpenLayers.Layer>)} Ordered list of layers in the overview map.  
* If none are sent at construction, the base layer for the main map is used.  
*/  
layers: null,  
 
/**  
* APIProperty: minRectSize  
* {Integer} The minimum width or height (in pixels) of the extent  
* rectangle on the overview map. When the extent rectangle reaches  
* this size, it will be replaced depending on the value of the  
* <minRectDisplayClass> property. Default is 15 pixels.  
*/  
minRectSize: 15,  
 
/**  
* APIProperty: minRectDisplayClass  
* {String} Replacement style class name for the extent rectangle when  
* <minRectSize> is reached. This string will be suffixed on to the  
* displayClass. Default is "RectReplacement".  
*  
* Example CSS declaration:  
* (code)  
* .olControlOverviewMapRectReplacement {  
* overflow: hidden;  
* cursor: move;  
* background-image: url("img/overview_replacement.gif");  
* background-repeat: no-repeat;  
* background-position: center;  
* }  
* (end)  
*/  
minRectDisplayClass: "RectReplacement",  
 
/**  
* APIProperty: minRatio  
* {Float} The ratio of the overview map resolution to the main map  
* resolution at which to zoom farther out on the overview map.  
*/  
minRatio: 8,  
 
/**  
* APIProperty: maxRatio  
* {Float} The ratio of the overview map resolution to the main map  
* resolution at which to zoom farther in on the overview map.  
*/  
maxRatio: 32,  
 
/**  
* APIProperty: mapOptions  
* {Object} An object containing any non-default properties to be sent to  
* the overview map's map constructor. These should include any  
* non-default options that the main map was constructed with.  
*/  
mapOptions: null,  
 
/**  
* APIProperty: autoPan  
* {Boolean} Always pan the overview map, so the extent marker remains in  
* the center. Default is false. If true, when you drag the extent  
* marker, the overview map will update itself so the marker returns  
* to the center.  
*/  
autoPan: false,  
 
/**  
* Property: handlers  
* {Object}  
*/  
handlers: null,  
 
/**  
* Property: resolutionFactor  
* {Object}  
*/  
resolutionFactor: 1,  
 
/**  
* APIProperty: maximized  
* {Boolean} Start as maximized (visible). Defaults to false.  
*/  
maximized: false,  
 
/**  
* Constructor: OpenLayers.Control.OverviewMap  
* Create a new overview map  
*  
* Parameters:  
* object - {Object} Properties of this object will be set on the overview  
* map object. Note, to set options on the map object contained in this  
* control, set <mapOptions> as one of the options properties.  
*/  
initialize: function(options) {  
this.layers = [];  
this.handlers = {};  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* APIMethod: destroy  
* Deconstruct the control  
*/  
destroy: function() {  
if (!this.mapDiv) { // we've already been destroyed  
return;  
}  
if (this.handlers.click) {  
this.handlers.click.destroy();  
}  
if (this.handlers.drag) {  
this.handlers.drag.destroy();  
}  
 
this.mapDiv.removeChild(this.extentRectangle);  
this.extentRectangle = null;  
 
if (this.rectEvents) {  
this.rectEvents.destroy();  
this.rectEvents = null;  
}  
 
if (this.ovmap) {  
this.ovmap.destroy();  
this.ovmap = null;  
}  
 
this.element.removeChild(this.mapDiv);  
this.mapDiv = null;  
 
this.div.removeChild(this.element);  
this.element = null;  
 
if (this.maximizeDiv) {  
OpenLayers.Event.stopObservingElement(this.maximizeDiv);  
this.div.removeChild(this.maximizeDiv);  
this.maximizeDiv = null;  
}  
 
if (this.minimizeDiv) {  
OpenLayers.Event.stopObservingElement(this.minimizeDiv);  
this.div.removeChild(this.minimizeDiv);  
this.minimizeDiv = null;  
}  
 
this.map.events.un({  
"moveend": this.update,  
"changebaselayer": this.baseLayerDraw,  
scope: this  
});  
 
OpenLayers.Control.prototype.destroy.apply(this, arguments);  
},  
 
/**  
* Method: draw  
* Render the control in the browser.  
*/  
draw: function() {  
OpenLayers.Control.prototype.draw.apply(this, arguments);  
if(!(this.layers.length > 0)) {  
if (this.map.baseLayer) {  
var layer = this.map.baseLayer.clone();  
this.layers = [layer];  
} else {  
this.map.events.register("changebaselayer", this, this.baseLayerDraw);  
return this.div;  
}  
}  
 
// create overview map DOM elements  
this.element = document.createElement('div');  
this.element.className = this.displayClass + 'Element';  
this.element.style.display = 'none';  
 
this.mapDiv = document.createElement('div');  
this.mapDiv.style.width = this.size.w + 'px';  
this.mapDiv.style.height = this.size.h + 'px';  
this.mapDiv.style.position = 'relative';  
this.mapDiv.style.overflow = 'hidden';  
this.mapDiv.id = OpenLayers.Util.createUniqueID('overviewMap');  
 
this.extentRectangle = document.createElement('div');  
this.extentRectangle.style.position = 'absolute';  
this.extentRectangle.style.zIndex = 1000; //HACK  
this.extentRectangle.className = this.displayClass+'ExtentRectangle';  
this.mapDiv.appendChild(this.extentRectangle);  
 
this.element.appendChild(this.mapDiv);  
 
this.div.appendChild(this.element);  
 
// Optionally add min/max buttons if the control will go in the  
// map viewport.  
if(!this.outsideViewport) {  
this.div.className += " " + this.displayClass + 'Container';  
var imgLocation = OpenLayers.Util.getImagesLocation();  
// maximize button div  
var img = imgLocation + 'layer-switcher-maximize.png';  
this.maximizeDiv = OpenLayers.Util.createAlphaImageDiv(  
this.displayClass + 'MaximizeButton',  
null,  
new OpenLayers.Size(18,18),  
img,  
'absolute');  
this.maximizeDiv.style.display = 'none';  
this.maximizeDiv.className = this.displayClass + 'MaximizeButton';  
OpenLayers.Event.observe(this.maximizeDiv, 'click',  
OpenLayers.Function.bindAsEventListener(this.maximizeControl,  
this)  
);  
this.div.appendChild(this.maximizeDiv);  
 
// minimize button div  
var img = imgLocation + 'layer-switcher-minimize.png';  
this.minimizeDiv = OpenLayers.Util.createAlphaImageDiv(  
'OpenLayers_Control_minimizeDiv',  
null,  
new OpenLayers.Size(18,18),  
img,  
'absolute');  
this.minimizeDiv.style.display = 'none';  
this.minimizeDiv.className = this.displayClass + 'MinimizeButton';  
OpenLayers.Event.observe(this.minimizeDiv, 'click',  
OpenLayers.Function.bindAsEventListener(this.minimizeControl,  
this)  
);  
this.div.appendChild(this.minimizeDiv);  
 
var eventsToStop = ['dblclick','mousedown'];  
 
for (var i=0, len=eventsToStop.length; i<len; i++) {  
 
OpenLayers.Event.observe(this.maximizeDiv,  
eventsToStop[i],  
OpenLayers.Event.stop);  
 
OpenLayers.Event.observe(this.minimizeDiv,  
eventsToStop[i],  
OpenLayers.Event.stop);  
}  
 
this.minimizeControl();  
} else {  
// show the overview map  
this.element.style.display = '';  
}  
if(this.map.getExtent()) {  
this.update();  
}  
 
this.map.events.register('moveend', this, this.update);  
 
if (this.maximized) {  
this.maximizeControl();  
}  
return this.div;  
},  
 
/**  
* Method: baseLayerDraw  
* Draw the base layer - called if unable to complete in the initial draw  
*/  
baseLayerDraw: function() {  
this.draw();  
this.map.events.unregister("changebaselayer", this, this.baseLayerDraw);  
},  
 
/**  
* Method: rectDrag  
* Handle extent rectangle drag  
*  
* Parameters:  
* px - {<OpenLayers.Pixel>} The pixel location of the drag.  
*/  
rectDrag: function(px) {  
var deltaX = this.handlers.drag.last.x - px.x;  
var deltaY = this.handlers.drag.last.y - px.y;  
if(deltaX != 0 || deltaY != 0) {  
var rectTop = this.rectPxBounds.top;  
var rectLeft = this.rectPxBounds.left;  
var rectHeight = Math.abs(this.rectPxBounds.getHeight());  
var rectWidth = this.rectPxBounds.getWidth();  
// don't allow dragging off of parent element  
var newTop = Math.max(0, (rectTop - deltaY));  
newTop = Math.min(newTop,  
this.ovmap.size.h - this.hComp - rectHeight);  
var newLeft = Math.max(0, (rectLeft - deltaX));  
newLeft = Math.min(newLeft,  
this.ovmap.size.w - this.wComp - rectWidth);  
this.setRectPxBounds(new OpenLayers.Bounds(newLeft,  
newTop + rectHeight,  
newLeft + rectWidth,  
newTop));  
}  
},  
 
/**  
* Method: mapDivClick  
* Handle browser events  
*  
* Parameters:  
* evt - {<OpenLayers.Event>} evt  
*/  
mapDivClick: function(evt) {  
var pxCenter = this.rectPxBounds.getCenterPixel();  
var deltaX = evt.xy.x - pxCenter.x;  
var deltaY = evt.xy.y - pxCenter.y;  
var top = this.rectPxBounds.top;  
var left = this.rectPxBounds.left;  
var height = Math.abs(this.rectPxBounds.getHeight());  
var width = this.rectPxBounds.getWidth();  
var newTop = Math.max(0, (top + deltaY));  
newTop = Math.min(newTop, this.ovmap.size.h - height);  
var newLeft = Math.max(0, (left + deltaX));  
newLeft = Math.min(newLeft, this.ovmap.size.w - width);  
this.setRectPxBounds(new OpenLayers.Bounds(newLeft,  
newTop + height,  
newLeft + width,  
newTop));  
this.updateMapToRect();  
},  
 
/**  
* Method: maximizeControl  
* Unhide the control. Called when the control is in the map viewport.  
*  
* Parameters:  
* e - {<OpenLayers.Event>}  
*/  
maximizeControl: function(e) {  
this.element.style.display = '';  
this.showToggle(false);  
if (e != null) {  
OpenLayers.Event.stop(e);  
}  
},  
 
/**  
* Method: minimizeControl  
* Hide all the contents of the control, shrink the size,  
* add the maximize icon  
*  
* Parameters:  
* e - {<OpenLayers.Event>}  
*/  
minimizeControl: function(e) {  
this.element.style.display = 'none';  
this.showToggle(true);  
if (e != null) {  
OpenLayers.Event.stop(e);  
}  
},  
 
/**  
* Method: showToggle  
* Hide/Show the toggle depending on whether the control is minimized  
*  
* Parameters:  
* minimize - {Boolean}  
*/  
showToggle: function(minimize) {  
this.maximizeDiv.style.display = minimize ? '' : 'none';  
this.minimizeDiv.style.display = minimize ? 'none' : '';  
},  
 
/**  
* Method: update  
* Update the overview map after layers move.  
*/  
update: function() {  
if(this.ovmap == null) {  
this.createMap();  
}  
 
if(this.autoPan || !this.isSuitableOverview()) {  
this.updateOverview();  
}  
 
// update extent rectangle  
this.updateRectToMap();  
},  
 
/**  
* Method: isSuitableOverview  
* Determines if the overview map is suitable given the extent and  
* resolution of the main map.  
*/  
isSuitableOverview: function() {  
var mapExtent = this.map.getExtent();  
var maxExtent = this.map.maxExtent;  
var testExtent = new OpenLayers.Bounds(  
Math.max(mapExtent.left, maxExtent.left),  
Math.max(mapExtent.bottom, maxExtent.bottom),  
Math.min(mapExtent.right, maxExtent.right),  
Math.min(mapExtent.top, maxExtent.top));  
 
if (this.ovmap.getProjection() != this.map.getProjection()) {  
testExtent = testExtent.transform(  
this.map.getProjectionObject(),  
this.ovmap.getProjectionObject() );  
}  
 
var resRatio = this.ovmap.getResolution() / this.map.getResolution();  
return ((resRatio > this.minRatio) &&  
(resRatio <= this.maxRatio) &&  
(this.ovmap.getExtent().containsBounds(testExtent)));  
},  
 
/**  
* Method updateOverview  
* Called by <update> if <isSuitableOverview> returns true  
*/  
updateOverview: function() {  
var mapRes = this.map.getResolution();  
var targetRes = this.ovmap.getResolution();  
var resRatio = targetRes / mapRes;  
if(resRatio > this.maxRatio) {  
// zoom in overview map  
targetRes = this.minRatio * mapRes;  
} else if(resRatio <= this.minRatio) {  
// zoom out overview map  
targetRes = this.maxRatio * mapRes;  
}  
var center;  
if (this.ovmap.getProjection() != this.map.getProjection()) {  
center = this.map.center.clone();  
center.transform(this.map.getProjectionObject(),  
this.ovmap.getProjectionObject() );  
} else {  
center = this.map.center;  
}  
this.ovmap.setCenter(center, this.ovmap.getZoomForResolution(  
targetRes * this.resolutionFactor));  
this.updateRectToMap();  
},  
 
/**  
* Method: createMap  
* Construct the map that this control contains  
*/  
createMap: function() {  
// create the overview map  
var options = OpenLayers.Util.extend(  
{controls: [], maxResolution: 'auto',  
fallThrough: false}, this.mapOptions);  
this.ovmap = new OpenLayers.Map(this.mapDiv, options);  
 
// prevent ovmap from being destroyed when the page unloads, because  
// the OverviewMap control has to do this (and does it).  
OpenLayers.Event.stopObserving(window, 'unload', this.ovmap.unloadDestroy);  
 
this.ovmap.addLayers(this.layers);  
this.ovmap.zoomToMaxExtent();  
// check extent rectangle border width  
this.wComp = parseInt(OpenLayers.Element.getStyle(this.extentRectangle,  
'border-left-width')) +  
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,  
'border-right-width'));  
this.wComp = (this.wComp) ? this.wComp : 2;  
this.hComp = parseInt(OpenLayers.Element.getStyle(this.extentRectangle,  
'border-top-width')) +  
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,  
'border-bottom-width'));  
this.hComp = (this.hComp) ? this.hComp : 2;  
 
this.handlers.drag = new OpenLayers.Handler.Drag(  
this, {move: this.rectDrag, done: this.updateMapToRect},  
{map: this.ovmap}  
);  
this.handlers.click = new OpenLayers.Handler.Click(  
this, {  
"click": this.mapDivClick  
},{  
"single": true, "double": false,  
"stopSingle": true, "stopDouble": true,  
"pixelTolerance": 1,  
map: this.ovmap  
}  
);  
this.handlers.click.activate();  
 
this.rectEvents = new OpenLayers.Events(this, this.extentRectangle,  
null, true);  
this.rectEvents.register("mouseover", this, function(e) {  
if(!this.handlers.drag.active && !this.map.dragging) {  
this.handlers.drag.activate();  
}  
});  
this.rectEvents.register("mouseout", this, function(e) {  
if(!this.handlers.drag.dragging) {  
this.handlers.drag.deactivate();  
}  
});  
 
if (this.ovmap.getProjection() != this.map.getProjection()) {  
var sourceUnits = this.map.getProjectionObject().getUnits() ||  
this.map.units || this.map.baseLayer.units;  
var targetUnits = this.ovmap.getProjectionObject().getUnits() ||  
this.ovmap.units || this.ovmap.baseLayer.units;  
this.resolutionFactor = sourceUnits && targetUnits ?  
OpenLayers.INCHES_PER_UNIT[sourceUnits] /  
OpenLayers.INCHES_PER_UNIT[targetUnits] : 1;  
}  
},  
 
/**  
* Method: updateRectToMap  
* Updates the extent rectangle position and size to match the map extent  
*/  
updateRectToMap: function() {  
// If the projections differ we need to reproject  
var bounds;  
if (this.ovmap.getProjection() != this.map.getProjection()) {  
bounds = this.map.getExtent().transform(  
this.map.getProjectionObject(),  
this.ovmap.getProjectionObject() );  
} else {  
bounds = this.map.getExtent();  
}  
var pxBounds = this.getRectBoundsFromMapBounds(bounds);  
if (pxBounds) {  
this.setRectPxBounds(pxBounds);  
}  
},  
 
/**  
* Method: updateMapToRect  
* Updates the map extent to match the extent rectangle position and size  
*/  
updateMapToRect: function() {  
var lonLatBounds = this.getMapBoundsFromRectBounds(this.rectPxBounds);  
if (this.ovmap.getProjection() != this.map.getProjection()) {  
lonLatBounds = lonLatBounds.transform(  
this.ovmap.getProjectionObject(),  
this.map.getProjectionObject() );  
}  
this.map.panTo(lonLatBounds.getCenterLonLat());  
},  
 
/**  
* Method: setRectPxBounds  
* Set extent rectangle pixel bounds.  
*  
* Parameters:  
* pxBounds - {<OpenLayers.Bounds>}  
*/  
setRectPxBounds: function(pxBounds) {  
var top = Math.max(pxBounds.top, 0);  
var left = Math.max(pxBounds.left, 0);  
var bottom = Math.min(pxBounds.top + Math.abs(pxBounds.getHeight()),  
this.ovmap.size.h - this.hComp);  
var right = Math.min(pxBounds.left + pxBounds.getWidth(),  
this.ovmap.size.w - this.wComp);  
var width = Math.max(right - left, 0);  
var height = Math.max(bottom - top, 0);  
if(width < this.minRectSize || height < this.minRectSize) {  
this.extentRectangle.className = this.displayClass +  
this.minRectDisplayClass;  
var rLeft = left + (width / 2) - (this.minRectSize / 2);  
var rTop = top + (height / 2) - (this.minRectSize / 2);  
this.extentRectangle.style.top = Math.round(rTop) + 'px';  
this.extentRectangle.style.left = Math.round(rLeft) + 'px';  
this.extentRectangle.style.height = this.minRectSize + 'px';  
this.extentRectangle.style.width = this.minRectSize + 'px';  
} else {  
this.extentRectangle.className = this.displayClass +  
'ExtentRectangle';  
this.extentRectangle.style.top = Math.round(top) + 'px';  
this.extentRectangle.style.left = Math.round(left) + 'px';  
this.extentRectangle.style.height = Math.round(height) + 'px';  
this.extentRectangle.style.width = Math.round(width) + 'px';  
}  
this.rectPxBounds = new OpenLayers.Bounds(  
Math.round(left), Math.round(bottom),  
Math.round(right), Math.round(top)  
);  
},  
 
/**  
* Method: getRectBoundsFromMapBounds  
* Get the rect bounds from the map bounds.  
*  
* Parameters:  
* lonLatBounds - {<OpenLayers.Bounds>}  
*  
* Returns:  
* {<OpenLayers.Bounds>}A bounds which is the passed-in map lon/lat extent  
* translated into pixel bounds for the overview map  
*/  
getRectBoundsFromMapBounds: function(lonLatBounds) {  
var leftBottomLonLat = new OpenLayers.LonLat(lonLatBounds.left,  
lonLatBounds.bottom);  
var rightTopLonLat = new OpenLayers.LonLat(lonLatBounds.right,  
lonLatBounds.top);  
var leftBottomPx = this.getOverviewPxFromLonLat(leftBottomLonLat);  
var rightTopPx = this.getOverviewPxFromLonLat(rightTopLonLat);  
var bounds = null;  
if (leftBottomPx && rightTopPx) {  
bounds = new OpenLayers.Bounds(leftBottomPx.x, leftBottomPx.y,  
rightTopPx.x, rightTopPx.y);  
}  
return bounds;  
},  
 
/**  
* Method: getMapBoundsFromRectBounds  
* Get the map bounds from the rect bounds.  
*  
* Parameters:  
* pxBounds - {<OpenLayers.Bounds>}  
*  
* Returns:  
* {<OpenLayers.Bounds>} Bounds which is the passed-in overview rect bounds  
* translated into lon/lat bounds for the overview map  
*/  
getMapBoundsFromRectBounds: function(pxBounds) {  
var leftBottomPx = new OpenLayers.Pixel(pxBounds.left,  
pxBounds.bottom);  
var rightTopPx = new OpenLayers.Pixel(pxBounds.right,  
pxBounds.top);  
var leftBottomLonLat = this.getLonLatFromOverviewPx(leftBottomPx);  
var rightTopLonLat = this.getLonLatFromOverviewPx(rightTopPx);  
return new OpenLayers.Bounds(leftBottomLonLat.lon, leftBottomLonLat.lat,  
rightTopLonLat.lon, rightTopLonLat.lat);  
},  
 
/**  
* Method: getLonLatFromOverviewPx  
* Get a map location from a pixel location  
*  
* Parameters:  
* overviewMapPx - {<OpenLayers.Pixel>}  
*  
* Returns:  
* {<OpenLayers.LonLat>} Location which is the passed-in overview map  
* OpenLayers.Pixel, translated into lon/lat by the overview map  
*/  
getLonLatFromOverviewPx: function(overviewMapPx) {  
var size = this.ovmap.size;  
var res = this.ovmap.getResolution();  
var center = this.ovmap.getExtent().getCenterLonLat();  
 
var delta_x = overviewMapPx.x - (size.w / 2);  
var delta_y = overviewMapPx.y - (size.h / 2);  
 
return new OpenLayers.LonLat(center.lon + delta_x * res ,  
center.lat - delta_y * res);  
},  
 
/**  
* Method: getOverviewPxFromLonLat  
* Get a pixel location from a map location  
*  
* Parameters:  
* lonlat - {<OpenLayers.LonLat>}  
*  
* Returns:  
* {<OpenLayers.Pixel>} Location which is the passed-in OpenLayers.LonLat,  
* translated into overview map pixels  
*/  
getOverviewPxFromLonLat: function(lonlat) {  
var res = this.ovmap.getResolution();  
var extent = this.ovmap.getExtent();  
var px = null;  
if (extent) {  
px = new OpenLayers.Pixel(  
Math.round(1/res * (lonlat.lon - extent.left)),  
Math.round(1/res * (extent.top - lonlat.lat)));  
}  
return px;  
},  
 
CLASS_NAME: 'OpenLayers.Control.OverviewMap'  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.Pan  
* The Pan control is a single button to pan the map in one direction. For  
* a more complete control see <OpenLayers.Control.PanPanel>.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* APIProperty: slideFactor  
* {Integer} Number of pixels by which we'll pan the map in any direction  
* on clicking the arrow buttons, defaults to 50.  
*/  
slideFactor: 50,  
 
/**  
* Property: direction  
* {String} in {'North', 'South', 'East', 'West'}  
*/  
direction: null,  
 
/**  
* Property: type  
* {String} The type of <OpenLayers.Control> -- When added to a  
* <Control.Panel>, 'type' is used by the panel to determine how to  
* handle our events.  
*/  
type: OpenLayers.Control.TYPE_BUTTON,  
 
/**  
* Constructor: OpenLayers.Control.Pan  
* Control which handles the panning (in any of the cardinal directions)  
* of the map by a set px distance.  
*  
* Parameters:  
* direction - {String} The direction this button should pan.  
* options - {Object} An optional object whose properties will be used  
* to extend the control.  
*/  
initialize: function(direction, options) {  
 
this.direction = direction;  
this.CLASS_NAME += this.direction;  
 
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* Method: trigger  
*/  
trigger: function(){  
 
switch (this.direction) {  
case OpenLayers.Control.Pan.NORTH:  
this.map.pan(0, -this.slideFactor);  
break;  
case OpenLayers.Control.Pan.SOUTH:  
this.map.pan(0, this.slideFactor);  
break;  
case OpenLayers.Control.Pan.WEST:  
this.map.pan(-this.slideFactor, 0);  
break;  
case OpenLayers.Control.Pan.EAST:  
this.map.pan(this.slideFactor, 0);  
break;  
}  
},  
 
CLASS_NAME: "OpenLayers.Control.Pan"  
});  
 
OpenLayers.Control.Pan.NORTH = "North";  
OpenLayers.Control.Pan.SOUTH = "South";  
OpenLayers.Control.Pan.EAST = "East";  
OpenLayers.Control.Pan.WEST = "West";  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control/Panel.js  
* @requires OpenLayers/Control/Pan.js  
*/  
 
/**  
* Class: OpenLayers.Control.PanPanel  
* The PanPanel is visible control for panning the map North, South, East or  
* West in small steps. By default it is drawn in the top left corner of the  
* map.  
*  
* Note:  
* If you wish to use this class with the default images and you want  
* it to look nice in ie6, you should add the following, conditionally  
* added css stylesheet to your HTML file:  
*  
* (code)  
* <!--[if lte IE 6]>  
* <link rel="stylesheet" href="../theme/default/ie6-style.css" type="text/css" />  
* <![endif]-->  
* (end)  
*  
* Inherits from:  
* - <OpenLayers.Control.Panel>  
*/  
OpenLayers.Control.PanPanel = OpenLayers.Class(OpenLayers.Control.Panel, {  
 
/**  
* APIProperty: slideFactor  
* {Integer} Number of pixels by which we'll pan the map in any direction  
* on clicking the arrow buttons, defaults to 50.  
*/  
slideFactor: 50,  
 
/**  
* Constructor: OpenLayers.Control.PanPanel  
* Add the four directional pan buttons.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be used  
* to extend the control.  
*/  
initialize: function(options) {  
OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);  
this.addControls([  
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.NORTH,  
{slideFactor: this.slideFactor}),  
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.SOUTH,  
{slideFactor: this.slideFactor}),  
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.EAST,  
{slideFactor: this.slideFactor}),  
new OpenLayers.Control.Pan(OpenLayers.Control.Pan.WEST,  
{slideFactor: this.slideFactor})  
]);  
},  
 
CLASS_NAME: "OpenLayers.Control.PanPanel"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.PanZoom  
* The PanZoom is a visible control, composed of a  
* <OpenLayers.Control.PanPanel> and a <OpenLayers.Control.ZoomPanel>. By  
* default it is drawn in the upper left corner of the map.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.PanZoom = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* APIProperty: slideFactor  
* {Integer} Number of pixels by which we'll pan the map in any direction  
* on clicking the arrow buttons. If you want to pan by some ratio  
* of the map dimensions, use <slideRatio> instead.  
*/  
slideFactor: 50,  
 
/**  
* APIProperty: slideRatio  
* {Number} The fraction of map width/height by which we'll pan the map  
* on clicking the arrow buttons. Default is null. If set, will  
* override <slideFactor>. E.g. if slideRatio is .5, then the Pan Up  
* button will pan up half the map height.  
*/  
slideRatio: null,  
 
/**  
* Property: buttons  
* {Array(DOMElement)} Array of Button Divs  
*/  
buttons: null,  
 
/**  
* Property: position  
* {<OpenLayers.Pixel>}  
*/  
position: null,  
 
/**  
* Constructor: OpenLayers.Control.PanZoom  
*  
* Parameters:  
* options - {Object}  
*/  
initialize: function(options) {  
this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,  
OpenLayers.Control.PanZoom.Y);  
OpenLayers.Control.prototype.initialize.apply(this, arguments);  
},  
 
/**  
* APIMethod: destroy  
*/  
destroy: function() {  
OpenLayers.Control.prototype.destroy.apply(this, arguments);  
this.removeButtons();  
this.buttons = null;  
this.position = null;  
},  
 
/**  
* Method: draw  
*  
* Parameters:  
* px - {<OpenLayers.Pixel>}  
*  
* Returns:  
* {DOMElement} A reference to the container div for the PanZoom control.  
*/  
draw: function(px) {  
// initialize our internal div  
OpenLayers.Control.prototype.draw.apply(this, arguments);  
px = this.position;  
 
// place the controls  
this.buttons = [];  
 
var sz = new OpenLayers.Size(18,18);  
var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);  
 
this._addButton("panup", "north-mini.png", centered, sz);  
px.y = centered.y+sz.h;  
this._addButton("panleft", "west-mini.png", px, sz);  
this._addButton("panright", "east-mini.png", px.add(sz.w, 0), sz);  
this._addButton("pandown", "south-mini.png",  
centered.add(0, sz.h*2), sz);  
this._addButton("zoomin", "zoom-plus-mini.png",  
centered.add(0, sz.h*3+5), sz);  
this._addButton("zoomworld", "zoom-world-mini.png",  
centered.add(0, sz.h*4+5), sz);  
this._addButton("zoomout", "zoom-minus-mini.png",  
centered.add(0, sz.h*5+5), sz);  
return this.div;  
},  
 
/**  
* Method: _addButton  
*  
* Parameters:  
* id - {String}  
* img - {String}  
* xy - {<OpenLayers.Pixel>}  
* sz - {<OpenLayers.Size>}  
*  
* Returns:  
* {DOMElement} A Div (an alphaImageDiv, to be precise) that contains the  
* image of the button, and has all the proper event handlers set.  
*/  
_addButton:function(id, img, xy, sz) {  
var imgLocation = OpenLayers.Util.getImagesLocation() + img;  
var btn = OpenLayers.Util.createAlphaImageDiv(  
this.id + "_" + id,  
xy, sz, imgLocation, "absolute");  
 
//we want to add the outer div  
this.div.appendChild(btn);  
 
OpenLayers.Event.observe(btn, "mousedown",  
OpenLayers.Function.bindAsEventListener(this.buttonDown, btn));  
OpenLayers.Event.observe(btn, "dblclick",  
OpenLayers.Function.bindAsEventListener(this.doubleClick, btn));  
OpenLayers.Event.observe(btn, "click",  
OpenLayers.Function.bindAsEventListener(this.doubleClick, btn));  
btn.action = id;  
btn.map = this.map;  
 
if(!this.slideRatio){  
var slideFactorPixels = this.slideFactor;  
var getSlideFactor = function() {  
return slideFactorPixels;  
};  
} else {  
var slideRatio = this.slideRatio;  
var getSlideFactor = function(dim) {  
return this.map.getSize()[dim] * slideRatio;  
};  
}  
 
btn.getSlideFactor = getSlideFactor;  
 
//we want to remember/reference the outer div  
this.buttons.push(btn);  
return btn;  
},  
 
/**  
* Method: _removeButton  
*  
* Parameters:  
* btn - {Object}  
*/  
_removeButton: function(btn) {  
OpenLayers.Event.stopObservingElement(btn);  
btn.map = null;  
btn.getSlideFactor = null;  
this.div.removeChild(btn);  
OpenLayers.Util.removeItem(this.buttons, btn);  
},  
 
/**  
* Method: removeButtons  
*/  
removeButtons: function() {  
for(var i=this.buttons.length-1; i>=0; --i) {  
this._removeButton(this.buttons[i]);  
}  
},  
 
/**  
* Method: doubleClick  
*  
* Parameters:  
* evt - {Event}  
*  
* Returns:  
* {Boolean}  
*/  
doubleClick: function (evt) {  
OpenLayers.Event.stop(evt);  
return false;  
},  
 
/**  
* Method: buttonDown  
*  
* Parameters:  
* evt - {Event}  
*/  
buttonDown: function (evt) {  
if (!OpenLayers.Event.isLeftClick(evt)) {  
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(evt);  
},  
 
CLASS_NAME: "OpenLayers.Control.PanZoom"  
});  
 
/**  
* Constant: X  
* {Integer}  
*/  
OpenLayers.Control.PanZoom.X = 4;  
 
/**  
* Constant: Y  
* {Integer}  
*/  
OpenLayers.Control.PanZoom.Y = 4;  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Control/PanZoom.js  
*/  
 
/**  
* Class: OpenLayers.Control.PanZoomBar  
* The PanZoomBar is a visible control composed of a  
* <OpenLayers.Control.PanPanel> and a <OpenLayers.Control.ZoomBar>.  
* By default it is displayed in the upper left corner of the map as 4  
* directional arrows above a vertical slider.  
*  
* Inherits from:  
* - <OpenLayers.Control.PanZoom>  
*/  
OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {  
 
/**  
* APIProperty: zoomStopWidth  
*/  
zoomStopWidth: 18,  
 
/**  
* APIProperty: zoomStopHeight  
*/  
zoomStopHeight: 11,  
 
/**  
* Property: slider  
*/  
slider: null,  
 
/**  
* Property: sliderEvents  
* {<OpenLayers.Events>}  
*/  
sliderEvents: null,  
 
/**  
* Property: zoombarDiv  
* {DOMElement}  
*/  
zoombarDiv: null,  
 
/**  
* Property: divEvents  
* {<OpenLayers.Events>}  
*/  
divEvents: null,  
 
/**  
* APIProperty: zoomWorldIcon  
* {Boolean}  
*/  
zoomWorldIcon: false,  
 
/**  
* APIProperty: forceFixedZoomLevel  
* {Boolean} Force a fixed zoom level even though the map has  
* fractionalZoom  
*/  
forceFixedZoomLevel: false,  
 
/**  
* Property: mouseDragStart  
* {<OpenLayers.Pixel>}  
*/  
mouseDragStart: null,  
 
/**  
* Property: zoomStart  
* {<OpenLayers.Pixel>}  
*/  
zoomStart: null,  
 
/**  
* Constructor: OpenLayers.Control.PanZoomBar  
*/  
initialize: function() {  
OpenLayers.Control.PanZoom.prototype.initialize.apply(this, arguments);  
},  
 
/**  
* APIMethod: destroy  
*/  
destroy: function() {  
 
this._removeZoomBar();  
 
this.map.events.un({  
"changebaselayer": this.redraw,  
scope: this  
});  
 
OpenLayers.Control.PanZoom.prototype.destroy.apply(this, arguments);  
 
delete this.mouseDragStart;  
delete this.zoomStart;  
},  
 
/**  
* Method: setMap  
*  
* Parameters:  
* map - {<OpenLayers.Map>}  
*/  
setMap: function(map) {  
OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments);  
this.map.events.register("changebaselayer", this, this.redraw);  
},  
 
/**  
* Method: redraw  
* clear the div and start over.  
*/  
redraw: function() {  
if (this.div != null) {  
this.removeButtons();  
this._removeZoomBar();  
}  
this.draw();  
},  
 
/**  
* Method: draw  
*  
* Parameters:  
* px - {<OpenLayers.Pixel>}  
*/  
draw: function(px) {  
// initialize our internal div  
OpenLayers.Control.prototype.draw.apply(this, arguments);  
px = this.position.clone();  
 
// place the controls  
this.buttons = [];  
 
var sz = new OpenLayers.Size(18,18);  
var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);  
var wposition = sz.w;  
 
if (this.zoomWorldIcon) {  
centered = new OpenLayers.Pixel(px.x+sz.w, px.y);  
}  
 
this._addButton("panup", "north-mini.png", centered, sz);  
px.y = centered.y+sz.h;  
this._addButton("panleft", "west-mini.png", px, sz);  
if (this.zoomWorldIcon) {  
this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w, 0), sz);  
 
wposition *= 2;  
}  
this._addButton("panright", "east-mini.png", px.add(wposition, 0), sz);  
this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz);  
this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz);  
centered = this._addZoomBar(centered.add(0, sz.h*4 + 5));  
this._addButton("zoomout", "zoom-minus-mini.png", centered, sz);  
return this.div;  
},  
 
/**  
* Method: _addZoomBar  
*  
* Parameters:  
* location - {<OpenLayers.Pixel>} where zoombar drawing is to start.  
*/  
_addZoomBar:function(centered) {  
var imgLocation = OpenLayers.Util.getImagesLocation();  
 
var id = this.id + "_" + this.map.id;  
var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom();  
var slider = OpenLayers.Util.createAlphaImageDiv(id,  
centered.add(-1, zoomsToEnd * this.zoomStopHeight),  
new OpenLayers.Size(20,9),  
imgLocation+"slider.png",  
"absolute");  
this.slider = slider;  
 
this.sliderEvents = new OpenLayers.Events(this, slider, null, true,  
{includeXY: true});  
this.sliderEvents.on({  
"mousedown": this.zoomBarDown,  
"mousemove": this.zoomBarDrag,  
"mouseup": this.zoomBarUp,  
"dblclick": this.doubleClick,  
"click": this.doubleClick  
});  
 
var sz = new OpenLayers.Size();  
sz.h = this.zoomStopHeight * this.map.getNumZoomLevels();  
sz.w = this.zoomStopWidth;  
var div = null;  
 
if (OpenLayers.Util.alphaHack()) {  
var id = this.id + "_" + this.map.id;  
div = OpenLayers.Util.createAlphaImageDiv(id, centered,  
new OpenLayers.Size(sz.w,  
this.zoomStopHeight),  
imgLocation + "zoombar.png",  
"absolute", null, "crop");  
div.style.height = sz.h + "px";  
} else {  
div = OpenLayers.Util.createDiv(  
'OpenLayers_Control_PanZoomBar_Zoombar' + this.map.id,  
centered,  
sz,  
imgLocation+"zoombar.png");  
}  
 
this.zoombarDiv = div;  
 
this.divEvents = new OpenLayers.Events(this, div, null, true,  
{includeXY: true});  
this.divEvents.on({  
"mousedown": this.divClick,  
"mousemove": this.passEventToSlider,  
"dblclick": this.doubleClick,  
"click": this.doubleClick  
});  
 
this.div.appendChild(div);  
 
this.startTop = parseInt(div.style.top);  
this.div.appendChild(slider);  
 
this.map.events.register("zoomend", this, this.moveZoomBar);  
 
centered = centered.add(0,  
this.zoomStopHeight * this.map.getNumZoomLevels());  
return centered;  
},  
 
/**  
* Method: _removeZoomBar  
*/  
_removeZoomBar: function() {  
this.sliderEvents.un({  
"mousedown": this.zoomBarDown,  
"mousemove": this.zoomBarDrag,  
"mouseup": this.zoomBarUp,  
"dblclick": this.doubleClick,  
"click": this.doubleClick  
});  
this.sliderEvents.destroy();  
 
this.divEvents.un({  
"mousedown": this.divClick,  
"mousemove": this.passEventToSlider,  
"dblclick": this.doubleClick,  
"click": this.doubleClick  
});  
this.divEvents.destroy();  
 
this.div.removeChild(this.zoombarDiv);  
this.zoombarDiv = null;  
this.div.removeChild(this.slider);  
this.slider = null;  
 
this.map.events.unregister("zoomend", this, this.moveZoomBar);  
},  
 
/**  
* Method: passEventToSlider  
* This function is used to pass events that happen on the div, or the map,  
* through to the slider, which then does its moving thing.  
*  
* Parameters:  
* evt - {<OpenLayers.Event>}  
*/  
passEventToSlider:function(evt) {  
this.sliderEvents.handleBrowserEvent(evt);  
},  
 
/**  
* Method: divClick  
* Picks up on clicks directly on the zoombar div  
* and sets the zoom level appropriately.  
*/  
divClick: function (evt) {  
if (!OpenLayers.Event.isLeftClick(evt)) {  
return;  
}  
var y = evt.xy.y;  
var top = OpenLayers.Util.pagePosition(evt.object)[1];  
var levels = (y - top)/this.zoomStopHeight;  
if(this.forceFixedZoomLevel || !this.map.fractionalZoom) {  
levels = Math.floor(levels);  
}  
var zoom = (this.map.getNumZoomLevels() - 1) - levels;  
zoom = Math.min(Math.max(zoom, 0), this.map.getNumZoomLevels() - 1);  
this.map.zoomTo(zoom);  
OpenLayers.Event.stop(evt);  
},  
 
/*  
* Method: zoomBarDown  
* event listener for clicks on the slider  
*  
* Parameters:  
* evt - {<OpenLayers.Event>}  
*/  
zoomBarDown:function(evt) {  
if (!OpenLayers.Event.isLeftClick(evt)) {  
return;  
}  
this.map.events.on({  
"mousemove": this.passEventToSlider,  
"mouseup": this.passEventToSlider,  
scope: this  
});  
this.mouseDragStart = evt.xy.clone();  
this.zoomStart = evt.xy.clone();  
this.div.style.cursor = "move";  
// reset the div offsets just in case the div moved  
this.zoombarDiv.offsets = null;  
OpenLayers.Event.stop(evt);  
},  
 
/*  
* Method: zoomBarDrag  
* This is what happens when a click has occurred, and the client is  
* dragging. Here we must ensure that the slider doesn't go beyond the  
* bottom/top of the zoombar div, as well as moving the slider to its new  
* visual location  
*  
* Parameters:  
* evt - {<OpenLayers.Event>}  
*/  
zoomBarDrag:function(evt) {  
if (this.mouseDragStart != null) {  
var deltaY = this.mouseDragStart.y - evt.xy.y;  
var offsets = OpenLayers.Util.pagePosition(this.zoombarDiv);  
if ((evt.clientY - offsets[1]) > 0 &&  
(evt.clientY - offsets[1]) < parseInt(this.zoombarDiv.style.height) - 2) {  
var newTop = parseInt(this.slider.style.top) - deltaY;  
this.slider.style.top = newTop+"px";  
this.mouseDragStart = evt.xy.clone();  
}  
OpenLayers.Event.stop(evt);  
}  
},  
 
/*  
* Method: zoomBarUp  
* Perform cleanup when a mouseup event is received -- discover new zoom  
* level and switch to it.  
*  
* Parameters:  
* evt - {<OpenLayers.Event>}  
*/  
zoomBarUp:function(evt) {  
if (!OpenLayers.Event.isLeftClick(evt)) {  
return;  
}  
if (this.mouseDragStart) {  
this.div.style.cursor="";  
this.map.events.un({  
"mouseup": this.passEventToSlider,  
"mousemove": this.passEventToSlider,  
scope: this  
});  
var deltaY = this.zoomStart.y - evt.xy.y;  
var zoomLevel = this.map.zoom;  
if (!this.forceFixedZoomLevel && this.map.fractionalZoom) {  
zoomLevel += deltaY/this.zoomStopHeight;  
zoomLevel = Math.min(Math.max(zoomLevel, 0),  
this.map.getNumZoomLevels() - 1);  
} else {  
zoomLevel += Math.round(deltaY/this.zoomStopHeight);  
}  
this.map.zoomTo(zoomLevel);  
this.mouseDragStart = null;  
this.zoomStart = null;  
OpenLayers.Event.stop(evt);  
}  
},  
 
/*  
* Method: moveZoomBar  
* Change the location of the slider to match the current zoom level.  
*/  
moveZoomBar:function() {  
var newTop =  
((this.map.getNumZoomLevels()-1) - this.map.getZoom()) *  
this.zoomStopHeight + this.startTop + 1;  
this.slider.style.top = newTop + "px";  
},  
 
CLASS_NAME: "OpenLayers.Control.PanZoomBar"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.Panel  
* The Panel control is a container for other controls. With it toolbars  
* may be composed.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, {  
/**  
* Property: controls  
* {Array(<OpenLayers.Control>)}  
*/  
controls: null,  
 
/**  
* APIProperty: autoActivate  
* {Boolean} Activate the control when it is added to a map. Default is  
* true.  
*/  
autoActivate: true,  
 
/**  
* APIProperty: defaultControl  
* {<OpenLayers.Control>} The control which is activated when the control is  
* activated (turned on), which also happens at instantiation.  
* If <saveState> is true, <defaultControl> will be nullified after the  
* first activation of the panel.  
*/  
defaultControl: null,  
 
/**  
* APIProperty: saveState  
* {Boolean} If set to true, the active state of this panel's controls will  
* be stored on panel deactivation, and restored on reactivation. Default  
* is false.  
*/  
saveState: false,  
 
/**  
* Property: activeState  
* {Object} stores the active state of this panel's controls.  
*/  
activeState: null,  
 
/**  
* Constructor: OpenLayers.Control.Panel  
* Create a new control panel.  
*  
* Each control in the panel is represented by an icon. When clicking  
* on an icon, the <activateControl> method is called.  
*  
* Specific properties for controls on a panel:  
* type - {Number} One of <OpenLayers.Control.TYPE_TOOL>,  
* <OpenLayers.Control.TYPE_TOGGLE>, <OpenLayers.Control.TYPE_BUTTON>.  
* If not provided, <OpenLayers.Control.TYPE_TOOL> is assumed.  
* title - {string} Text displayed when mouse is over the icon that  
* represents the control.  
*  
* The <OpenLayers.Control.type> of a control determines the behavior when  
* clicking its icon:  
* <OpenLayers.Control.TYPE_TOOL> - The control is activated and other  
* controls of this type in the same panel are deactivated. This is  
* the default type.  
* <OpenLayers.Control.TYPE_TOGGLE> - The active state of the control is  
* toggled.  
* <OpenLayers.Control.TYPE_BUTTON> - The  
* <OpenLayers.Control.Button.trigger> method of the control is called,  
* but its active state is not changed.  
*  
* If a control is <OpenLayers.Control.active>, it will be drawn with the  
* olControl[Name]ItemActive class, otherwise with the  
* olControl[Name]ItemInactive class.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be used  
* to extend the control.  
*/  
initialize: function(options) {  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
this.controls = [];  
this.activeState = {};  
},  
 
/**  
* APIMethod: destroy  
*/  
destroy: function() {  
OpenLayers.Control.prototype.destroy.apply(this, arguments);  
for(var i = this.controls.length - 1 ; i >= 0; i--) {  
if(this.controls[i].events) {  
this.controls[i].events.un({  
"activate": this.redraw,  
"deactivate": this.redraw,  
scope: this  
});  
}  
OpenLayers.Event.stopObservingElement(this.controls[i].panel_div);  
this.controls[i].panel_div = null;  
}  
this.activeState = null;  
},  
 
/**  
* APIMethod: activate  
*/  
activate: function() {  
if (OpenLayers.Control.prototype.activate.apply(this, arguments)) {  
var control;  
for (var i=0, len=this.controls.length; i<len; i++) {  
control = this.controls[i];  
if (control === this.defaultControl ||  
(this.saveState && this.activeState[control.id])) {  
control.activate();  
}  
}  
if (this.saveState === true) {  
this.defaultControl = null;  
}  
this.redraw();  
return true;  
} else {  
return false;  
}  
},  
 
/**  
* APIMethod: deactivate  
*/  
deactivate: function() {  
if (OpenLayers.Control.prototype.deactivate.apply(this, arguments)) {  
var control;  
for (var i=0, len=this.controls.length; i<len; i++) {  
control = this.controls[i];  
this.activeState[control.id] = control.deactivate();  
}  
return true;  
} else {  
return false;  
}  
},  
 
/**  
* Method: draw  
*  
* Returns:  
* {DOMElement}  
*/  
draw: function() {  
OpenLayers.Control.prototype.draw.apply(this, arguments);  
this.addControlsToMap(this.controls);  
return this.div;  
},  
 
/**  
* Method: redraw  
*/  
redraw: function() {  
if (this.div.children.length>0) {  
for (var l=this.div.children.length, i=l-1 ; i>=0 ; i--) {  
this.div.removeChild(this.div.children[i]);  
}  
}  
this.div.innerHTML = "";  
if (this.active) {  
for (var i=0, len=this.controls.length; i<len; i++) {  
var element = this.controls[i].panel_div;  
if (this.controls[i].active) {  
element.className = this.controls[i].displayClass + "ItemActive";  
} else {  
element.className = this.controls[i].displayClass + "ItemInactive";  
}  
this.div.appendChild(element);  
}  
}  
},  
 
/**  
* APIMethod: activateControl  
* This method is called when the user click on the icon representing a  
* control in the panel.  
*  
* Parameters:  
* control - {<OpenLayers.Control>}  
*/  
activateControl: function (control) {  
if (!this.active) { return false; }  
if (control.type == OpenLayers.Control.TYPE_BUTTON) {  
control.trigger();  
this.redraw();  
return;  
}  
if (control.type == OpenLayers.Control.TYPE_TOGGLE) {  
if (control.active) {  
control.deactivate();  
} else {  
control.activate();  
}  
this.redraw();  
return;  
}  
var c;  
for (var i=0, len=this.controls.length; i<len; i++) {  
c = this.controls[i];  
if (c != control &&  
(c.type === OpenLayers.Control.TYPE_TOOL || c.type == null)) {  
c.deactivate();  
}  
}  
control.activate();  
},  
 
/**  
* APIMethod: addControls  
* To build a toolbar, you add a set of controls to it. addControls  
* lets you add a single control or a list of controls to the  
* Control Panel.  
*  
* Parameters:  
* controls - {<OpenLayers.Control>} Controls to add in the panel.  
*/  
addControls: function(controls) {  
if (!(controls instanceof Array)) {  
controls = [controls];  
}  
this.controls = this.controls.concat(controls);  
 
// Give each control a panel_div which will be used later.  
// Access to this div is via the panel_div attribute of the  
// control added to the panel.  
// Also, stop mousedowns and clicks, but don't stop mouseup,  
// since they need to pass through.  
for (var i=0, len=controls.length; i<len; i++) {  
var element = document.createElement("div");  
controls[i].panel_div = element;  
if (controls[i].title != "") {  
controls[i].panel_div.title = controls[i].title;  
}  
OpenLayers.Event.observe(controls[i].panel_div, "click",  
OpenLayers.Function.bind(this.onClick, this, controls[i]));  
OpenLayers.Event.observe(controls[i].panel_div, "dblclick",  
OpenLayers.Function.bind(this.onDoubleClick, this, controls[i]));  
OpenLayers.Event.observe(controls[i].panel_div, "mousedown",  
OpenLayers.Function.bindAsEventListener(OpenLayers.Event.stop));  
}  
 
if (this.map) { // map.addControl() has already been called on the panel  
this.addControlsToMap(controls);  
this.redraw();  
}  
},  
 
/**  
* Method: addControlsToMap  
* Only for internal use in draw() and addControls() methods.  
*  
* Parameters:  
* controls - {Array(<OpenLayers.Control>)} Controls to add into map.  
*/  
addControlsToMap: function (controls) {  
var control;  
for (var i=0, len=controls.length; i<len; i++) {  
control = controls[i];  
if (control.autoActivate === true) {  
control.autoActivate = false;  
this.map.addControl(control);  
control.autoActivate = true;  
} else {  
this.map.addControl(control);  
control.deactivate();  
}  
control.events.on({  
"activate": this.redraw,  
"deactivate": this.redraw,  
scope: this  
});  
}  
},  
 
/**  
* Method: onClick  
*/  
onClick: function (ctrl, evt) {  
OpenLayers.Event.stop(evt ? evt : window.event);  
this.activateControl(ctrl);  
},  
 
/**  
* Method: onDoubleClick  
*/  
onDoubleClick: function(ctrl, evt) {  
OpenLayers.Event.stop(evt ? evt : window.event);  
},  
 
/**  
* APIMethod: getControlsBy  
* Get a list of controls with properties matching the given criteria.  
*  
* Parameter:  
* property - {String} A control property to be matched.  
* match - {String | Object} A string to match. Can also be a regular  
* expression literal or object. In addition, it can be any object  
* with a method named test. For reqular expressions or other, if  
* match.test(control[property]) evaluates to true, the control will be  
* included in the array returned. If no controls are found, an empty  
* array is returned.  
*  
* Returns:  
* {Array(<OpenLayers.Control>)} A list of controls matching the given criteria.  
* An empty array is returned if no matches are found.  
*/  
getControlsBy: function(property, match) {  
var test = (typeof match.test == "function");  
var found = OpenLayers.Array.filter(this.controls, function(item) {  
return item[property] == match || (test && match.test(item[property]));  
});  
return found;  
},  
 
/**  
* APIMethod: getControlsByName  
* Get a list of contorls with names matching the given name.  
*  
* Parameter:  
* match - {String | Object} A control name. The name can also be a regular  
* expression literal or object. In addition, it can be any object  
* with a method named test. For reqular expressions or other, if  
* name.test(control.name) evaluates to true, the control will be included  
* in the list of controls returned. If no controls are found, an empty  
* array is returned.  
*  
* Returns:  
* {Array(<OpenLayers.Control>)} A list of controls matching the given name.  
* An empty array is returned if no matches are found.  
*/  
getControlsByName: function(match) {  
return this.getControlsBy("name", match);  
},  
 
/**  
* APIMethod: getControlsByClass  
* Get a list of controls of a given type (CLASS_NAME).  
*  
* Parameter:  
* match - {String | Object} A control class name. The type can also be a  
* regular expression literal or object. In addition, it can be any  
* object with a method named test. For reqular expressions or other,  
* if type.test(control.CLASS_NAME) evaluates to true, the control will  
* be included in the list of controls returned. If no controls are  
* found, an empty array is returned.  
*  
* Returns:  
* {Array(<OpenLayers.Control>)} A list of controls matching the given type.  
* An empty array is returned if no matches are found.  
*/  
getControlsByClass: function(match) {  
return this.getControlsBy("CLASS_NAME", match);  
},  
 
CLASS_NAME: "OpenLayers.Control.Panel"  
});  
 
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Control/ArgParser.js  
*/  
 
/**  
* Class: OpenLayers.Control.Permalink  
* The Permalink control is hyperlink that will return the user to the  
* current map view. By default it is drawn in the lower right corner of the  
* map. The href is updated as the map is zoomed, panned and whilst layers  
* are switched.  
* `  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* APIProperty: argParserClass  
* {Class} The ArgParser control class (not instance) to use with this  
* control.  
*/  
argParserClass: OpenLayers.Control.ArgParser,  
 
/**  
* Property: element  
* {DOMElement}  
*/  
element: null,  
 
/**  
* APIProperty: base  
* {String}  
*/  
base: '',  
 
/**  
* APIProperty: displayProjection  
* {<OpenLayers.Projection>} Requires proj4js support. Projection used  
* when creating the coordinates in the link. This will reproject the  
* map coordinates into display coordinates. If you are using this  
* functionality, the permalink which is last added to the map will  
* determine the coordinate type which is read from the URL, which  
* means you should not add permalinks with different  
* displayProjections to the same map.  
*/  
displayProjection: null,  
 
/**  
* Constructor: OpenLayers.Control.Permalink  
*  
* Parameters:  
* element - {DOMElement}  
* base - {String}  
* options - {Object} options to the control.  
*/  
initialize: function(element, base, options) {  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
this.element = OpenLayers.Util.getElement(element);  
this.base = base || document.location.href;  
},  
 
/**  
* APIMethod: destroy  
*/  
destroy: function() {  
if (this.element.parentNode == this.div) {  
this.div.removeChild(this.element);  
}  
this.element = null;  
 
this.map.events.unregister('moveend', this, this.updateLink);  
 
OpenLayers.Control.prototype.destroy.apply(this, arguments);  
},  
 
/**  
* Method: setMap  
* Set the map property for the control.  
*  
* Parameters:  
* map - {<OpenLayers.Map>}  
*/  
setMap: function(map) {  
OpenLayers.Control.prototype.setMap.apply(this, arguments);  
 
//make sure we have an arg parser attached  
for(var i=0, len=this.map.controls.length; i<len; i++) {  
var control = this.map.controls[i];  
if (control.CLASS_NAME == this.argParserClass.CLASS_NAME) {  
 
// If a permalink is added to the map, and an ArgParser already  
// exists, we override the displayProjection to be the one  
// on the permalink.  
if (control.displayProjection != this.displayProjection) {  
this.displayProjection = control.displayProjection;  
}  
 
break;  
}  
}  
if (i == this.map.controls.length) {  
this.map.addControl(new this.argParserClass(  
{ 'displayProjection': this.displayProjection }));  
}  
 
},  
 
/**  
* Method: draw  
*  
* Returns:  
* {DOMElement}  
*/  
draw: function() {  
OpenLayers.Control.prototype.draw.apply(this, arguments);  
 
if (!this.element) {  
this.div.className = this.displayClass;  
this.element = document.createElement("a");  
this.element.innerHTML = OpenLayers.i18n("permalink");  
this.element.href="";  
this.div.appendChild(this.element);  
}  
this.map.events.on({  
'moveend': this.updateLink,  
'changelayer': this.updateLink,  
'changebaselayer': this.updateLink,  
scope: this  
});  
 
// Make it so there is at least a link even though the map may not have  
// moved yet.  
this.updateLink();  
 
return this.div;  
},  
 
/**  
* Method: updateLink  
*/  
updateLink: function() {  
var href = this.base;  
if (href.indexOf('?') != -1) {  
href = href.substring( 0, href.indexOf('?') );  
}  
 
href += '?' + OpenLayers.Util.getParameterString(this.createParams());  
this.element.href = href;  
},  
 
/**  
* APIMethod: createParams  
* Creates the parameters that need to be encoded into the permalink url.  
*  
* Parameters:  
* center - {<OpenLayers.LonLat>} center to encode in the permalink.  
* Defaults to the current map center.  
* zoom - {Integer} zoom level to encode in the permalink. Defaults to the  
* current map zoom level.  
* layers - {Array(<OpenLayers.Layer>)} layers to encode in the permalink.  
* Defaults to the current map layers.  
*  
* Returns:  
* {Object} Hash of parameters that will be url-encoded into the  
* permalink.  
*/  
createParams: function(center, zoom, layers) {  
center = center || this.map.getCenter();  
 
var params = OpenLayers.Util.getParameters(this.base);  
 
// If there's still no center, map is not initialized yet.  
// Break out of this function, and simply return the params from the  
// base link.  
if (center) {  
 
//zoom  
params.zoom = zoom || this.map.getZoom();  
 
//lon,lat  
var lat = center.lat;  
var lon = center.lon;  
 
if (this.displayProjection) {  
var mapPosition = OpenLayers.Projection.transform(  
{ x: lon, y: lat },  
this.map.getProjectionObject(),  
this.displayProjection );  
lon = mapPosition.x;  
lat = mapPosition.y;  
}  
params.lat = Math.round(lat*100000)/100000;  
params.lon = Math.round(lon*100000)/100000;  
 
//layers  
layers = layers || this.map.layers;  
params.layers = '';  
for (var i=0, len=layers.length; i<len; i++) {  
var layer = layers[i];  
 
if (layer.isBaseLayer) {  
params.layers += (layer == this.map.baseLayer) ? "B" : "0";  
} else {  
params.layers += (layer.getVisibility()) ? "T" : "F";  
}  
}  
}  
 
return params;  
},  
 
CLASS_NAME: "OpenLayers.Control.Permalink"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Layer/WMS/Post.js  
* @requires OpenLayers/Handler/RegularPolygon.js  
* @requires OpenLayers/Handler/Polygon.js  
* @requires OpenLayers/Handler/Path.js  
* @requires OpenLayers/Handler/Click.js  
* @requires OpenLayers/Filter/Spatial.js  
*/  
 
/**  
* Class: OpenLayers.Control.SLDSelect  
* Perform selections on WMS layers using Styled Layer Descriptor (SLD)  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Constant: EVENT_TYPES  
* {Array(String)} Supported application event types. Register a listener  
* for a particular event with the following syntax:  
* (code)  
* control.events.register(type, obj, listener);  
* (end)  
*  
* Listeners will be called with a reference to an event object. The  
* properties of this event depends on exactly what happened.  
*  
* Supported control event types (in addition to those from  
* <OpenLayers.Control>):  
* selected - Triggered when a selection occurs. Listeners receive an  
* event with *filters* and *layer* properties. Filters will be an  
* array of OpenLayers.Filter objects created in order to perform  
* the particular selection.  
*/  
EVENT_TYPES: ["selected"],  
 
/**  
* APIProperty: clearOnDeactivate  
* {Boolean} Should the selection be cleared when the control is  
* deactivated. Default value is false.  
*/  
clearOnDeactivate: false,  
 
/**  
* APIProperty: layers  
* {Array(<OpenLayers.Layer.WMS>)} The WMS layers this control will work  
* on.  
*/  
layers: null,  
 
/**  
* Property: callbacks  
* {Object} The functions that are sent to the handler for callback  
*/  
callbacks: null,  
 
/**  
* APIProperty: selectionSymbolizer  
* {Object} Determines the styling of the selected objects. Default is  
* a selection in red.  
*/  
selectionSymbolizer: {  
'Polygon': {fillColor: '#FF0000', stroke: false},  
'Line': {strokeColor: '#FF0000', strokeWidth: 2},  
'Point': {graphicName: 'square', fillColor: '#FF0000', pointRadius: 5}  
},  
 
/**  
* APIProperty: layerOptions  
* {Object} The options to apply to the selection layer, by default the  
* selection layer will be kept out of the layer switcher.  
*/  
layerOptions: null,  
 
/**  
* APIProperty: handlerOptions  
* {Object} Used to set non-default properties on the control's handler  
*/  
handlerOptions: null,  
 
/**  
* APIProperty: sketchStyle  
* {<OpenLayers.Style>|Object} Style or symbolizer to use for the sketch  
* handler. The recommended way of styling the sketch layer, however, is  
* to configure an <OpenLayers.StyleMap> in the layerOptions of the  
* <handlerOptions>:  
*  
* (code)  
* new OpenLayers.Control.SLDSelect(OpenLayers.Handler.Path, {  
* handlerOptions: {  
* layerOptions: {  
* styleMap: new OpenLayers.StyleMap({  
* "default": {strokeColor: "yellow"}  
* });  
* }  
* }  
* });  
* (end)  
*/  
sketchStyle: null,  
 
/**  
* APIProperty: wfsCache  
* {Object} Cache to use for storing parsed results from  
* <OpenLayers.Format.WFSDescribeFeatureType.read>. If not provided,  
* these will be cached on the prototype.  
*/  
wfsCache: {},  
 
/**  
* APIProperty: layerCache  
* {Object} Cache to use for storing references to the selection layers.  
* Normally each source layer will have exactly 1 selection layer of  
* type OpenLayers.Layer.WMS.Post. If not provided, layers will  
* be cached on the prototype. Note that if <clearOnDeactivate> is  
* true, the layer will no longer be cached after deactivating the  
* control.  
*/  
layerCache: {},  
 
/**  
* Constructor: OpenLayers.Control.SLDSelect  
* Create a new control for selecting features in WMS layers using  
* Styled Layer Descriptor (SLD).  
*  
* Parameters:  
* handler - {<OpenLayers.Class>} A sketch handler class. This determines  
* the type of selection, e.g. box (<OpenLayers.Handler.Box>), point  
* (<OpenLayers.Handler.Point>), path (<OpenLayers.Handler.Path>) or  
* polygon (<OpenLayers.Handler.Polygon>) selection. To use circle  
* type selection, use <OpenLayers.Handler.RegularPolygon> and pass  
* the number of desired sides (e.g. 40) as "sides" property to the  
* <handlerOptions>.  
* options - {Object} An object containing all configuration properties for  
* the control.  
*  
* Valid options:  
* layers - Array({<OpenLayers.Layer.WMS>}) The layers to perform the  
* selection on.  
*/  
initialize: function(handler, options) {  
// concatenate events specific to this control with those from the base  
this.EVENT_TYPES =  
OpenLayers.Control.SLDSelect.prototype.EVENT_TYPES.concat(  
OpenLayers.Control.prototype.EVENT_TYPES  
);  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
 
this.callbacks = OpenLayers.Util.extend({done: this.select,  
click: this.select}, this.callbacks);  
this.handlerOptions = this.handlerOptions || {};  
this.layerOptions = OpenLayers.Util.applyDefaults(this.layerOptions, {  
displayInLayerSwitcher: false  
});  
if (this.sketchStyle) {  
this.handlerOptions.layerOptions = OpenLayers.Util.applyDefaults(  
this.handlerOptions.layerOptions,  
{styleMap: new OpenLayers.StyleMap({"default": this.sketchStyle})}  
);  
}  
this.handler = new handler(this, this.callbacks, this.handlerOptions);  
},  
 
/**  
* APIMethod: destroy  
* Take care of things that are not handled in superclass.  
*/  
destroy: function() {  
for (var key in this.layerCache) {  
delete this.layerCache[key];  
}  
for (var key in this.wfsCache) {  
delete this.wfsCache[key];  
}  
OpenLayers.Control.prototype.destroy.apply(this, arguments);  
},  
 
/**  
* Method: coupleLayerVisiblity  
* Couple the selection layer and the source layer with respect to  
* layer visibility. So if the source layer is turned off, the  
* selection layer is also turned off.  
*  
* Parameters:  
* evt - {Object}  
*/  
coupleLayerVisiblity: function(evt) {  
this.setVisibility(evt.object.getVisibility());  
},  
 
/**  
* Method: createSelectionLayer  
* Creates a "clone" from the source layer in which the selection can  
* be drawn. This ensures both the source layer and the selection are  
* visible and not only the selection.  
*  
* Parameters:  
* source - {<OpenLayers.Layer.WMS>} The source layer on which the selection  
* is performed.  
*  
* Returns:  
* {<OpenLayers.Layer.WMS.Post>} A WMS Post layer since SLD selections can  
* easily get quite long.  
*/  
createSelectionLayer: function(source) {  
// check if we already have a selection layer for the source layer  
var selectionLayer;  
if (!this.layerCache[source.id]) {  
selectionLayer = new OpenLayers.Layer.WMS.Post(source.name,  
source.url, source.params,  
OpenLayers.Util.applyDefaults(  
this.layerOptions,  
source.getOptions())  
);  
this.layerCache[source.id] = selectionLayer;  
// make sure the layers are coupled wrt visibility, but only  
// if they are not displayed in the layer switcher, because in  
// that case the user cannot control visibility.  
if (this.layerOptions.displayInLayerSwitcher === false) {  
source.events.on({  
"visibilitychanged": this.coupleLayerVisiblity,  
scope: selectionLayer});  
}  
this.map.addLayer(selectionLayer);  
} else {  
selectionLayer = this.layerCache[source.id];  
}  
return selectionLayer;  
},  
 
/**  
* Method: createSLD  
* Create the SLD document for the layer using the supplied filters.  
*  
* Parameters:  
* layer - {<OpenLayers.Layer.WMS>}  
* filters - Array({<OpenLayers.Filter>}) The filters to be applied.  
* geometryAttributes - Array({Object}) The geometry attributes of the  
* layer.  
*  
* Returns:  
* {String} The SLD document generated as a string.  
*/  
createSLD: function(layer, filters, geometryAttributes) {  
var sld = {version: "1.0.0", namedLayers: {}};  
var layerNames = [layer.params.LAYERS].join(",").split(",");  
for (var i=0, len=layerNames.length; i<len; i++) {  
var name = layerNames[i];  
sld.namedLayers[name] = {name: name, userStyles: []};  
var symbolizer = this.selectionSymbolizer;  
var geometryAttribute = geometryAttributes[i];  
if (geometryAttribute.type.indexOf('Polygon') >= 0) {  
symbolizer = {Polygon: this.selectionSymbolizer['Polygon']};  
} else if (geometryAttribute.type.indexOf('LineString') >= 0) {  
symbolizer = {Line: this.selectionSymbolizer['Line']};  
} else if (geometryAttribute.type.indexOf('Point') >= 0) {  
symbolizer = {Point: this.selectionSymbolizer['Point']};  
}  
var filter = filters[i];  
sld.namedLayers[name].userStyles.push({name: 'default', rules: [  
new OpenLayers.Rule({symbolizer: symbolizer,  
filter: filter,  
maxScaleDenominator: layer.options.minScale})  
]});  
}  
return new OpenLayers.Format.SLD().write(sld);  
},  
 
/**  
* Method: parseDescribeLayer  
* Parse the SLD WMS DescribeLayer response and issue the corresponding  
* WFS DescribeFeatureType request  
*  
* request - {XMLHttpRequest} The request object.  
*/  
parseDescribeLayer: function(request) {  
var format = new OpenLayers.Format.WMSDescribeLayer();  
var doc = request.responseXML;  
if(!doc || !doc.documentElement) {  
doc = request.responseText;  
}  
var describeLayer = format.read(doc);  
var typeNames = [];  
var url = null;  
for (var i=0, len=describeLayer.length; i<len; i++) {  
// perform a WFS DescribeFeatureType request  
if (describeLayer[i].owsType == "WFS") {  
typeNames.push(describeLayer[i].typeName);  
url = describeLayer[i].owsURL;  
}  
}  
var options = {  
url: url,  
params: {  
SERVICE: "WFS",  
TYPENAME: typeNames.toString(),  
REQUEST: "DescribeFeatureType",  
VERSION: "1.0.0"  
},  
callback: function(request) {  
var format = new OpenLayers.Format.WFSDescribeFeatureType();  
var doc = request.responseXML;  
if(!doc || !doc.documentElement) {  
doc = request.responseText;  
}  
var describeFeatureType = format.read(doc);  
this.control.wfsCache[this.layer.id] = describeFeatureType;  
this.control._queue && this.control.applySelection();  
},  
scope: this  
};  
OpenLayers.Request.GET(options);  
},  
 
/**  
* Method: getGeometryAttributes  
* Look up the geometry attributes from the WFS DescribeFeatureType response  
*  
* Parameters:  
* layer - {<OpenLayers.Layer.WMS>} The layer for which to look up the  
* geometry attributes.  
*  
* Returns:  
* Array({Object}) Array of geometry attributes  
*/  
getGeometryAttributes: function(layer) {  
var result = [];  
var cache = this.wfsCache[layer.id];  
for (var i=0, len=cache.featureTypes.length; i<len; i++) {  
var typeName = cache.featureTypes[i];  
var properties = typeName.properties;  
for (var j=0, lenj=properties.length; j < lenj; j++) {  
var property = properties[j];  
var type = property.type;  
if ((type.indexOf('LineString') >= 0) ||  
(type.indexOf('GeometryAssociationType') >=0) ||  
(type.indexOf('GeometryPropertyType') >= 0) ||  
(type.indexOf('Point') >= 0) ||  
(type.indexOf('Polygon') >= 0) ) {  
result.push(property);  
}  
}  
}  
return result;  
},  
 
/**  
* APIMethod: activate  
* Activate the control. Activating the control will perform a SLD WMS  
* DescribeLayer request followed by a WFS DescribeFeatureType request  
* so that the proper symbolizers can be chosen based on the geometry  
* type.  
*/  
activate: function() {  
var activated = OpenLayers.Control.prototype.activate.call(this);  
if(activated) {  
for (var i=0, len=this.layers.length; i<len; i++) {  
var layer = this.layers[i];  
if (layer && !this.wfsCache[layer.id]) {  
var options = {  
url: layer.url,  
params: {  
SERVICE: "WMS",  
VERSION: layer.params.VERSION,  
LAYERS: layer.params.LAYERS,  
REQUEST: "DescribeLayer"  
},  
callback: this.parseDescribeLayer,  
scope: {layer: layer, control: this}  
};  
OpenLayers.Request.GET(options);  
}  
}  
}  
return activated;  
},  
 
/**  
* APIMethod: deactivate  
* Deactivate the control. If clearOnDeactivate is true, remove the  
* selection layer(s).  
*/  
deactivate: function() {  
var deactivated = OpenLayers.Control.prototype.deactivate.call(this);  
if(deactivated) {  
for (var i=0, len=this.layers.length; i<len; i++) {  
var layer = this.layers[i];  
if (layer && this.clearOnDeactivate === true) {  
var layerCache = this.layerCache;  
var selectionLayer = layerCache[layer.id];  
if (selectionLayer) {  
layer.events.un({  
"visibilitychanged": this.coupleLayerVisiblity,  
scope: selectionLayer});  
selectionLayer.destroy();  
delete layerCache[layer.id];  
}  
}  
}  
}  
return deactivated;  
},  
 
/**  
* APIMethod: setLayers  
* Set the layers on which the selection should be performed. Call the  
* setLayers method if the layer(s) to be used change and the same  
* control should be used on a new set of layers.  
* If the control is already active, it will be active after the new  
* set of layers is set.  
*  
* Parameters:  
* layers - {Array(<OpenLayers.Layer.WMS>)} The new set of layers on which  
* the selection should be performed.  
*/  
setLayers: function(layers) {  
if(this.active) {  
this.deactivate();  
this.layers = layers;  
this.activate();  
} else {  
this.layers = layers;  
}  
},  
 
/**  
* Function: createFilter  
* Create the filter to be used in the SLD.  
*  
* Parameters:  
* geometryAttribute - {Object} Used to get the name of the geometry  
* attribute which is needed for constructing the spatial filter.  
* geometry - {<OpenLayers.Geometry>} The geometry to use.  
*  
* Returns:  
* {<OpenLayers.Filter.Spatial>} The spatial filter created.  
*/  
createFilter: function(geometryAttribute, geometry) {  
var filter = null;  
if (this.handler instanceof OpenLayers.Handler.RegularPolygon) {  
// box  
if (this.handler.irregular === true) {  
filter = new OpenLayers.Filter.Spatial({  
type: OpenLayers.Filter.Spatial.BBOX,  
property: geometryAttribute.name,  
value: geometry.getBounds()}  
);  
} else {  
filter = new OpenLayers.Filter.Spatial({  
type: OpenLayers.Filter.Spatial.INTERSECTS,  
property: geometryAttribute.name,  
value: geometry}  
);  
}  
} else if (this.handler instanceof OpenLayers.Handler.Polygon) {  
filter = new OpenLayers.Filter.Spatial({  
type: OpenLayers.Filter.Spatial.INTERSECTS,  
property: geometryAttribute.name,  
value: geometry}  
);  
} else if (this.handler instanceof OpenLayers.Handler.Path) {  
// if source layer is point based, use DWITHIN instead  
if (geometryAttribute.type.indexOf('Point') >= 0) {  
filter = new OpenLayers.Filter.Spatial({  
type: OpenLayers.Filter.Spatial.DWITHIN,  
property: geometryAttribute.name,  
distance: this.map.getExtent().getWidth()*0.01 ,  
distanceUnits: this.map.getUnits(),  
value: geometry}  
);  
} else {  
filter = new OpenLayers.Filter.Spatial({  
type: OpenLayers.Filter.Spatial.INTERSECTS,  
property: geometryAttribute.name,  
value: geometry}  
);  
}  
} else if (this.handler instanceof OpenLayers.Handler.Click) {  
if (geometryAttribute.type.indexOf('Polygon') >= 0) {  
filter = new OpenLayers.Filter.Spatial({  
type: OpenLayers.Filter.Spatial.INTERSECTS,  
property: geometryAttribute.name,  
value: geometry}  
);  
} else {  
filter = new OpenLayers.Filter.Spatial({  
type: OpenLayers.Filter.Spatial.DWITHIN,  
property: geometryAttribute.name,  
distance: this.map.getExtent().getWidth()*0.01 ,  
distanceUnits: this.map.getUnits(),  
value: geometry}  
);  
}  
}  
return filter;  
},  
 
/**  
* Method: select  
* When the handler is done, use SLD_BODY on the selection layer to  
* display the selection in the map.  
*  
* Parameters:  
* geometry - {Object} or {<OpenLayers.Geometry>}  
*/  
select: function(geometry) {  
this._queue = function() {  
for (var i=0, len=this.layers.length; i<len; i++) {  
var layer = this.layers[i];  
var geometryAttributes = this.getGeometryAttributes(layer);  
var filters = [];  
for (var j=0, lenj=geometryAttributes.length; j<lenj; j++) {  
var geometryAttribute = geometryAttributes[j];  
if (geometryAttribute !== null) {  
// from the click handler we will not get an actual  
// geometry so transform  
if (!(geometry instanceof OpenLayers.Geometry)) {  
var point = this.map.getLonLatFromPixel(  
geometry.xy);  
geometry = new OpenLayers.Geometry.Point(  
point.lon, point.lat);  
}  
var filter = this.createFilter(geometryAttribute,  
geometry);  
if (filter !== null) {  
filters.push(filter);  
}  
}  
}  
 
var selectionLayer = this.createSelectionLayer(layer);  
var sld = this.createSLD(layer, filters, geometryAttributes);  
 
this.events.triggerEvent("selected", {  
layer: layer,  
filters: filters  
});  
 
selectionLayer.mergeNewParams({SLD_BODY: sld});  
delete this._queue;  
}  
};  
this.applySelection();  
},  
 
/**  
* Method: applySelection  
* Checks if all required wfs data is cached, and applies the selection  
*/  
applySelection: function() {  
var canApply = true;  
for (var i=0, len=this.layers.length; i<len; i++) {  
if(!this.wfsCache[this.layers[i].id]) {  
canApply = false;  
break;  
}  
}  
canApply && this._queue.call(this);  
},  
 
CLASS_NAME: "OpenLayers.Control.SLDSelect"  
});  
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.Scale  
* The Scale control displays the current map scale as a ratio (e.g. Scale =  
* 1:1M). By default it is displayed in the lower right corner of the map.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.Scale = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Parameter: element  
* {DOMElement}  
*/  
element: null,  
 
/**  
* APIProperty: geodesic  
* {Boolean} Use geodesic measurement. Default is false. The recommended  
* setting for maps in EPSG:4326 is false, and true EPSG:900913. If set to  
* true, the scale will be calculated based on the horizontal size of the  
* pixel in the center of the map viewport.  
*/  
geodesic: false,  
 
/**  
* Constructor: OpenLayers.Control.Scale  
*  
* Parameters:  
* element - {DOMElement}  
* options - {Object}  
*/  
initialize: function(element, options) {  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
this.element = OpenLayers.Util.getElement(element);  
},  
 
/**  
* Method: draw  
*  
* Returns:  
* {DOMElement}  
*/  
draw: function() {  
OpenLayers.Control.prototype.draw.apply(this, arguments);  
if (!this.element) {  
this.element = document.createElement("div");  
this.div.appendChild(this.element);  
}  
this.map.events.register( 'moveend', this, this.updateScale);  
this.updateScale();  
return this.div;  
},  
 
/**  
* Method: updateScale  
*/  
updateScale: function() {  
var scale;  
if(this.geodesic === true) {  
var units = this.map.getUnits();  
if(!units) {  
return;  
}  
var inches = OpenLayers.INCHES_PER_UNIT;  
scale = (this.map.getGeodesicPixelSize().w || 0.000001) *  
inches["km"] * OpenLayers.DOTS_PER_INCH;  
} else {  
scale = this.map.getScale();  
}  
 
if (!scale) {  
return;  
}  
 
if (scale >= 9500 && scale <= 950000) {  
scale = Math.round(scale / 1000) + "K";  
} else if (scale >= 950000) {  
scale = Math.round(scale / 1000000) + "M";  
} else {  
scale = Math.round(scale);  
}  
 
this.element.innerHTML = OpenLayers.i18n("scale", {'scaleDenom':scale});  
},  
 
CLASS_NAME: "OpenLayers.Control.Scale"  
});  
 
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.ScaleLine  
* The ScaleLine displays a small line indicator representing the current  
* map scale on the map. By default it is drawn in the lower left corner of  
* the map.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*  
* Is a very close copy of:  
* - <OpenLayers.Control.Scale>  
*/  
OpenLayers.Control.ScaleLine = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Property: maxWidth  
* {Integer} Maximum width of the scale line in pixels. Default is 100.  
*/  
maxWidth: 100,  
 
/**  
* Property: topOutUnits  
* {String} Units for zoomed out on top bar. Default is km.  
*/  
topOutUnits: "km",  
 
/**  
* Property: topInUnits  
* {String} Units for zoomed in on top bar. Default is m.  
*/  
topInUnits: "m",  
 
/**  
* Property: bottomOutUnits  
* {String} Units for zoomed out on bottom bar. Default is mi.  
*/  
bottomOutUnits: "mi",  
 
/**  
* Property: bottomInUnits  
* {String} Units for zoomed in on bottom bar. Default is ft.  
*/  
bottomInUnits: "ft",  
 
/**  
* Property: eTop  
* {DOMElement}  
*/  
eTop: null,  
 
/**  
* Property: eBottom  
* {DOMElement}  
*/  
eBottom:null,  
 
/**  
* APIProperty: geodesic  
* {Boolean} Use geodesic measurement. Default is false. The recommended  
* setting for maps in EPSG:4326 is false, and true EPSG:900913. If set to  
* true, the scale will be calculated based on the horizontal size of the  
* pixel in the center of the map viewport.  
*/  
geodesic: false,  
 
/**  
* Constructor: OpenLayers.Control.ScaleLine  
* Create a new scale line control.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be used  
* to extend the control.  
*/  
initialize: function(options) {  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* Method: draw  
*  
* Returns:  
* {DOMElement}  
*/  
draw: function() {  
OpenLayers.Control.prototype.draw.apply(this, arguments);  
if (!this.eTop) {  
// stick in the top bar  
this.eTop = document.createElement("div");  
this.eTop.className = this.displayClass + "Top";  
var theLen = this.topInUnits.length;  
this.div.appendChild(this.eTop);  
if((this.topOutUnits == "") || (this.topInUnits == "")) {  
this.eTop.style.visibility = "hidden";  
} else {  
this.eTop.style.visibility = "visible";  
}  
 
// and the bottom bar  
this.eBottom = document.createElement("div");  
this.eBottom.className = this.displayClass + "Bottom";  
this.div.appendChild(this.eBottom);  
if((this.bottomOutUnits == "") || (this.bottomInUnits == "")) {  
this.eBottom.style.visibility = "hidden";  
} else {  
this.eBottom.style.visibility = "visible";  
}  
}  
this.map.events.register('moveend', this, this.update);  
this.update();  
return this.div;  
},  
 
/**  
* Method: getBarLen  
* Given a number, round it down to the nearest 1,2,5 times a power of 10.  
* That seems a fairly useful set of number groups to use.  
*  
* Parameters:  
* maxLen - {float} the number we're rounding down from  
*  
* Returns:  
* {Float} the rounded number (less than or equal to maxLen)  
*/  
getBarLen: function(maxLen) {  
// nearest power of 10 lower than maxLen  
var digits = parseInt(Math.log(maxLen) / Math.log(10));  
var pow10 = Math.pow(10, digits);  
 
// ok, find first character  
var firstChar = parseInt(maxLen / pow10);  
 
// right, put it into the correct bracket  
var barLen;  
if(firstChar > 5) {  
barLen = 5;  
} else if(firstChar > 2) {  
barLen = 2;  
} else {  
barLen = 1;  
}  
 
// scale it up the correct power of 10  
return barLen * pow10;  
},  
 
/**  
* Method: update  
* Update the size of the bars, and the labels they contain.  
*/  
update: function() {  
var res = this.map.getResolution();  
if (!res) {  
return;  
}  
 
var curMapUnits = this.map.getUnits();  
var inches = OpenLayers.INCHES_PER_UNIT;  
 
// convert maxWidth to map units  
var maxSizeData = this.maxWidth * res * inches[curMapUnits];  
var geodesicRatio = 1;  
if(this.geodesic === true) {  
var maxSizeGeodesic = (this.map.getGeodesicPixelSize().w ||  
0.000001) * this.maxWidth;  
var maxSizeKilometers = maxSizeData / inches["km"];  
geodesicRatio = maxSizeGeodesic / maxSizeKilometers;  
maxSizeData *= geodesicRatio;  
}  
 
// decide whether to use large or small scale units  
var topUnits;  
var bottomUnits;  
if(maxSizeData > 100000) {  
topUnits = this.topOutUnits;  
bottomUnits = this.bottomOutUnits;  
} else {  
topUnits = this.topInUnits;  
bottomUnits = this.bottomInUnits;  
}  
 
// and to map units units  
var topMax = maxSizeData / inches[topUnits];  
var bottomMax = maxSizeData / inches[bottomUnits];  
 
// now trim this down to useful block length  
var topRounded = this.getBarLen(topMax);  
var bottomRounded = this.getBarLen(bottomMax);  
 
// and back to display units  
topMax = topRounded / inches[curMapUnits] * inches[topUnits];  
bottomMax = bottomRounded / inches[curMapUnits] * inches[bottomUnits];  
 
// and to pixel units  
var topPx = topMax / res / geodesicRatio;  
var bottomPx = bottomMax / res / geodesicRatio;  
 
// now set the pixel widths  
// and the values inside them  
 
if (this.eBottom.style.visibility == "visible"){  
this.eBottom.style.width = Math.round(bottomPx) + "px";  
this.eBottom.innerHTML = bottomRounded + " " + bottomUnits ;  
}  
 
if (this.eTop.style.visibility == "visible"){  
this.eTop.style.width = Math.round(topPx) + "px";  
this.eTop.innerHTML = topRounded + " " + topUnits;  
}  
 
},  
 
CLASS_NAME: "OpenLayers.Control.ScaleLine"  
});  
 
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Feature/Vector.js  
* @requires OpenLayers/Handler/Feature.js  
* @requires OpenLayers/Layer/Vector/RootContainer.js  
*/  
 
/**  
* Class: OpenLayers.Control.SelectFeature  
* The SelectFeature control selects vector features from a given layer on  
* click or hover.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Constant: EVENT_TYPES  
*  
* Supported event types:  
* - *beforefeaturehighlighted* Triggered before a feature is highlighted  
* - *featurehighlighted* Triggered when a feature is highlighted  
* - *featureunhighlighted* Triggered when a feature is unhighlighted  
*/  
EVENT_TYPES: ["beforefeaturehighlighted", "featurehighlighted", "featureunhighlighted"],  
 
/**  
* Property: multipleKey  
* {String} An event modifier ('altKey' or 'shiftKey') that temporarily sets  
* the <multiple> property to true. Default is null.  
*/  
multipleKey: null,  
 
/**  
* Property: toggleKey  
* {String} An event modifier ('altKey' or 'shiftKey') that temporarily sets  
* the <toggle> property to true. Default is null.  
*/  
toggleKey: null,  
 
/**  
* APIProperty: multiple  
* {Boolean} Allow selection of multiple geometries. Default is false.  
*/  
multiple: false,  
 
/**  
* APIProperty: clickout  
* {Boolean} Unselect features when clicking outside any feature.  
* Default is true.  
*/  
clickout: true,  
 
/**  
* APIProperty: toggle  
* {Boolean} Unselect a selected feature on click. Default is false. Only  
* has meaning if hover is false.  
*/  
toggle: false,  
 
/**  
* APIProperty: hover  
* {Boolean} Select on mouse over and deselect on mouse out. If true, this  
* ignores clicks and only listens to mouse moves.  
*/  
hover: false,  
 
/**  
* APIProperty: highlightOnly  
* {Boolean} If true do not actually select features (i.e. place them in the  
* layer's selected features array), just highlight them. This property has  
* no effect if hover is false. Defaults to false.  
*/  
highlightOnly: false,  
 
/**  
* APIProperty: box  
* {Boolean} Allow feature selection by drawing a box.  
*/  
box: false,  
 
/**  
* Property: onBeforeSelect  
* {Function} Optional function to be called before a feature is selected.  
* The function should expect to be called with a feature.  
*/  
onBeforeSelect: function() {},  
 
/**  
* APIProperty: onSelect  
* {Function} Optional function to be called when a feature is selected.  
* The function should expect to be called with a feature.  
*/  
onSelect: function() {},  
 
/**  
* APIProperty: onUnselect  
* {Function} Optional function to be called when a feature is unselected.  
* The function should expect to be called with a feature.  
*/  
onUnselect: function() {},  
 
/**  
* Property: scope  
* {Object} The scope to use with the onBeforeSelect, onSelect, onUnselect  
* callbacks. If null the scope will be this control.  
*/  
scope: null,  
 
/**  
* APIProperty: geometryTypes  
* {Array(String)} To restrict selecting to a limited set of geometry types,  
* send a list of strings corresponding to the geometry class names.  
*/  
geometryTypes: null,  
 
/**  
* Property: layer  
* {<OpenLayers.Layer.Vector>} The vector layer with a common renderer  
* root for all layers this control is configured with (if an array of  
* layers was passed to the constructor), or the vector layer the control  
* was configured with (if a single layer was passed to the constructor).  
*/  
layer: null,  
 
/**  
* Property: layers  
* {Array(<OpenLayers.Layer.Vector>} The layers this control will work on,  
* or null if the control was configured with a single layer  
*/  
layers: null,  
 
/**  
* APIProperty: callbacks  
* {Object} The functions that are sent to the handlers.feature for callback  
*/  
callbacks: null,  
 
/**  
* APIProperty: selectStyle  
* {Object} Hash of styles  
*/  
selectStyle: null,  
 
/**  
* Property: renderIntent  
* {String} key used to retrieve the select style from the layer's  
* style map.  
*/  
renderIntent: "select",  
 
/**  
* Property: handlers  
* {Object} Object with references to multiple <OpenLayers.Handler>  
* instances.  
*/  
handlers: null,  
 
/**  
* Constructor: OpenLayers.Control.SelectFeature  
* Create a new control for selecting features.  
*  
* Parameters:  
* layers - {<OpenLayers.Layer.Vector>}, or an array of vector layers. The  
* layer(s) this control will select features from.  
* options - {Object}  
*/  
initialize: function(layers, options) {  
// concatenate events specific to this control with those from the base  
this.EVENT_TYPES =  
OpenLayers.Control.SelectFeature.prototype.EVENT_TYPES.concat(  
OpenLayers.Control.prototype.EVENT_TYPES  
);  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
 
if(this.scope === null) {  
this.scope = this;  
}  
this.initLayer(layers);  
var callbacks = {  
click: this.clickFeature,  
clickout: this.clickoutFeature  
};  
if (this.hover) {  
callbacks.over = this.overFeature;  
callbacks.out = this.outFeature;  
}  
 
this.callbacks = OpenLayers.Util.extend(callbacks, this.callbacks);  
this.handlers = {  
feature: new OpenLayers.Handler.Feature(  
this, this.layer, this.callbacks,  
{geometryTypes: this.geometryTypes}  
)  
};  
 
if (this.box) {  
this.handlers.box = new OpenLayers.Handler.Box(  
this, {done: this.selectBox},  
{boxDivClassName: "olHandlerBoxSelectFeature"}  
);  
}  
},  
 
/**  
* Method: initLayer  
* Assign the layer property. If layers is an array, we need to use  
* a RootContainer.  
*  
* Parameters:  
* layers - {<OpenLayers.Layer.Vector>}, or an array of vector layers.  
*/  
initLayer: function(layers) {  
if(layers instanceof Array) {  
this.layers = layers;  
this.layer = new OpenLayers.Layer.Vector.RootContainer(  
this.id + "_container", {  
layers: layers  
}  
);  
} else {  
this.layer = layers;  
}  
},  
 
/**  
* Method: destroy  
*/  
destroy: function() {  
if(this.active && this.layers) {  
this.map.removeLayer(this.layer);  
}  
OpenLayers.Control.prototype.destroy.apply(this, arguments);  
if(this.layers) {  
this.layer.destroy();  
}  
},  
 
/**  
* Method: activate  
* Activates the control.  
*  
* Returns:  
* {Boolean} The control was effectively activated.  
*/  
activate: function () {  
if (!this.active) {  
if(this.layers) {  
this.map.addLayer(this.layer);  
}  
this.handlers.feature.activate();  
if(this.box && this.handlers.box) {  
this.handlers.box.activate();  
}  
}  
return OpenLayers.Control.prototype.activate.apply(  
this, arguments  
);  
},  
 
/**  
* Method: deactivate  
* Deactivates the control.  
*  
* Returns:  
* {Boolean} The control was effectively deactivated.  
*/  
deactivate: function () {  
if (this.active) {  
this.handlers.feature.deactivate();  
if(this.handlers.box) {  
this.handlers.box.deactivate();  
}  
if(this.layers) {  
this.map.removeLayer(this.layer);  
}  
}  
return OpenLayers.Control.prototype.deactivate.apply(  
this, arguments  
);  
},  
 
/**  
* Method: unselectAll  
* Unselect all selected features. To unselect all except for a single  
* feature, set the options.except property to the feature.  
*  
* Parameters:  
* options - {Object} Optional configuration object.  
*/  
unselectAll: function(options) {  
// we'll want an option to supress notification here  
var layers = this.layers || [this.layer];  
var layer, feature;  
for(var l=0; l<layers.length; ++l) {  
layer = layers[l];  
for(var i=layer.selectedFeatures.length-1; i>=0; --i) {  
feature = layer.selectedFeatures[i];  
if(!options || options.except != feature) {  
this.unselect(feature);  
}  
}  
}  
},  
 
/**  
* Method: clickFeature  
* Called on click in a feature  
* Only responds if this.hover is false.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>}  
*/  
clickFeature: function(feature) {  
if(!this.hover) {  
var selected = (OpenLayers.Util.indexOf(  
feature.layer.selectedFeatures, feature) > -1);  
if(selected) {  
if(this.toggleSelect()) {  
this.unselect(feature);  
} else if(!this.multipleSelect()) {  
this.unselectAll({except: feature});  
}  
} else {  
if(!this.multipleSelect()) {  
this.unselectAll({except: feature});  
}  
this.select(feature);  
}  
}  
},  
 
/**  
* Method: multipleSelect  
* Allow for multiple selected features based on <multiple> property and  
* <multipleKey> event modifier.  
*  
* Returns:  
* {Boolean} Allow for multiple selected features.  
*/  
multipleSelect: function() {  
return this.multiple || (this.handlers.feature.evt &&  
this.handlers.feature.evt[this.multipleKey]);  
},  
 
/**  
* Method: toggleSelect  
* Event should toggle the selected state of a feature based on <toggle>  
* property and <toggleKey> event modifier.  
*  
* Returns:  
* {Boolean} Toggle the selected state of a feature.  
*/  
toggleSelect: function() {  
return this.toggle || (this.handlers.feature.evt &&  
this.handlers.feature.evt[this.toggleKey]);  
},  
 
/**  
* Method: clickoutFeature  
* Called on click outside a previously clicked (selected) feature.  
* Only responds if this.hover is false.  
*  
* Parameters:  
* feature - {<OpenLayers.Vector.Feature>}  
*/  
clickoutFeature: function(feature) {  
if(!this.hover && this.clickout) {  
this.unselectAll();  
}  
},  
 
/**  
* Method: overFeature  
* Called on over a feature.  
* Only responds if this.hover is true.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>}  
*/  
overFeature: function(feature) {  
var layer = feature.layer;  
if(this.hover) {  
if(this.highlightOnly) {  
this.highlight(feature);  
} else if(OpenLayers.Util.indexOf(  
layer.selectedFeatures, feature) == -1) {  
this.select(feature);  
}  
}  
},  
 
/**  
* Method: outFeature  
* Called on out of a selected feature.  
* Only responds if this.hover is true.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>}  
*/  
outFeature: function(feature) {  
if(this.hover) {  
if(this.highlightOnly) {  
// we do nothing if we're not the last highlighter of the  
// feature  
if(feature._lastHighlighter == this.id) {  
// if another select control had highlighted the feature before  
// we did it ourself then we use that control to highlight the  
// feature as it was before we highlighted it, else we just  
// unhighlight it  
if(feature._prevHighlighter &&  
feature._prevHighlighter != this.id) {  
delete feature._lastHighlighter;  
var control = this.map.getControl(  
feature._prevHighlighter);  
if(control) {  
control.highlight(feature);  
}  
} else {  
this.unhighlight(feature);  
}  
}  
} else {  
this.unselect(feature);  
}  
}  
},  
 
/**  
* Method: highlight  
* Redraw feature with the select style.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>}  
*/  
highlight: function(feature) {  
var layer = feature.layer;  
var cont = this.events.triggerEvent("beforefeaturehighlighted", {  
feature : feature  
});  
if(cont !== false) {  
feature._prevHighlighter = feature._lastHighlighter;  
feature._lastHighlighter = this.id;  
var style = this.selectStyle || this.renderIntent;  
layer.drawFeature(feature, style);  
this.events.triggerEvent("featurehighlighted", {feature : feature});  
}  
},  
 
/**  
* Method: unhighlight  
* Redraw feature with the "default" style  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>}  
*/  
unhighlight: function(feature) {  
var layer = feature.layer;  
feature._lastHighlighter = feature._prevHighlighter;  
delete feature._prevHighlighter;  
layer.drawFeature(feature, feature.style || feature.layer.style ||  
"default");  
this.events.triggerEvent("featureunhighlighted", {feature : feature});  
},  
 
/**  
* Method: select  
* Add feature to the layer's selectedFeature array, render the feature as  
* selected, and call the onSelect function.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>}  
*/  
select: function(feature) {  
var cont = this.onBeforeSelect.call(this.scope, feature);  
var layer = feature.layer;  
if(cont !== false) {  
cont = layer.events.triggerEvent("beforefeatureselected", {  
feature: feature  
});  
if(cont !== false) {  
layer.selectedFeatures.push(feature);  
this.highlight(feature);  
// if the feature handler isn't involved in the feature  
// selection (because the box handler is used or the  
// feature is selected programatically) we fake the  
// feature handler to allow unselecting on click  
if(!this.handlers.feature.lastFeature) {  
this.handlers.feature.lastFeature = layer.selectedFeatures[0];  
}  
layer.events.triggerEvent("featureselected", {feature: feature});  
this.onSelect.call(this.scope, feature);  
}  
}  
},  
 
/**  
* Method: unselect  
* Remove feature from the layer's selectedFeature array, render the feature as  
* normal, and call the onUnselect function.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>}  
*/  
unselect: function(feature) {  
var layer = feature.layer;  
// Store feature style for restoration later  
this.unhighlight(feature);  
OpenLayers.Util.removeItem(layer.selectedFeatures, feature);  
layer.events.triggerEvent("featureunselected", {feature: feature});  
this.onUnselect.call(this.scope, feature);  
},  
 
/**  
* Method: selectBox  
* Callback from the handlers.box set up when <box> selection is true  
* on.  
*  
* Parameters:  
* position - {<OpenLayers.Bounds> || <OpenLayers.Pixel> }  
*/  
selectBox: function(position) {  
if (position instanceof OpenLayers.Bounds) {  
var minXY = this.map.getLonLatFromPixel(  
new OpenLayers.Pixel(position.left, position.bottom)  
);  
var maxXY = this.map.getLonLatFromPixel(  
new OpenLayers.Pixel(position.right, position.top)  
);  
var bounds = new OpenLayers.Bounds(  
minXY.lon, minXY.lat, maxXY.lon, maxXY.lat  
);  
 
// if multiple is false, first deselect currently selected features  
if (!this.multipleSelect()) {  
this.unselectAll();  
}  
 
// because we're using a box, we consider we want multiple selection  
var prevMultiple = this.multiple;  
this.multiple = true;  
var layers = this.layers || [this.layer];  
var layer;  
for(var l=0; l<layers.length; ++l) {  
layer = layers[l];  
for(var i=0, len = layer.features.length; i<len; ++i) {  
var feature = layer.features[i];  
// check if the feature is displayed  
if (!feature.getVisibility()) {  
continue;  
}  
 
if (this.geometryTypes == null || OpenLayers.Util.indexOf(  
this.geometryTypes, feature.geometry.CLASS_NAME) > -1) {  
if (bounds.toGeometry().intersects(feature.geometry)) {  
if (OpenLayers.Util.indexOf(layer.selectedFeatures, feature) == -1) {  
this.select(feature);  
}  
}  
}  
}  
}  
this.multiple = prevMultiple;  
}  
},  
 
/**  
* Method: setMap  
* Set the map property for the control.  
*  
* Parameters:  
* map - {<OpenLayers.Map>}  
*/  
setMap: function(map) {  
this.handlers.feature.setMap(map);  
if (this.box) {  
this.handlers.box.setMap(map);  
}  
OpenLayers.Control.prototype.setMap.apply(this, arguments);  
},  
 
/**  
* APIMethod: setLayer  
* Attach a new layer to the control, overriding any existing layers.  
*  
* Parameters:  
* layers - Array of {<OpenLayers.Layer.Vector>} or a single  
* {<OpenLayers.Layer.Vector>}  
*/  
setLayer: function(layers) {  
var isActive = this.active;  
this.unselectAll();  
this.deactivate();  
if(this.layers) {  
this.layer.destroy();  
this.layers = null;  
}  
this.initLayer(layers);  
this.handlers.feature.layer = this.layer;  
if (isActive) {  
this.activate();  
}  
},  
 
CLASS_NAME: "OpenLayers.Control.SelectFeature"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Layer/Vector.js  
*/  
 
/**  
* Class: OpenLayers.Control.Snapping  
* Acts as a snapping agent while editing vector features.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.Snapping = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Constant: EVENT_TYPES  
* {Array(String)} Supported application event types. Register a listener  
* for a particular event with the following syntax:  
* (code)  
* control.events.register(type, obj, listener);  
* (end)  
*  
* Listeners will be called with a reference to an event object. The  
* properties of this event depends on exactly what happened.  
*  
* Supported control event types (in addition to those from <OpenLayers.Control>):  
* beforesnap - Triggered before a snap occurs. Listeners receive an  
* event object with *point*, *x*, *y*, *distance*, *layer*, and  
* *snapType* properties. The point property will be original point  
* geometry considered for snapping. The x and y properties represent  
* coordinates the point will receive. The distance is the distance  
* of the snap. The layer is the target layer. The snapType property  
* will be one of "node", "vertex", or "edge". Return false to stop  
* snapping from occurring.  
* snap - Triggered when a snap occurs. Listeners receive an event with  
* *point*, *snapType*, *layer*, and *distance* properties. The point  
* will be the location snapped to. The snapType will be one of "node",  
* "vertex", or "edge". The layer will be the target layer. The  
* distance will be the distance of the snap in map units.  
* unsnap - Triggered when a vertex is unsnapped. Listeners receive an  
* event with a *point* property.  
*/  
EVENT_TYPES: ["beforesnap", "snap", "unsnap"],  
 
/**  
* CONSTANT: DEFAULTS  
* Default target properties.  
*/  
DEFAULTS: {  
tolerance: 10,  
node: true,  
edge: true,  
vertex: true  
},  
 
/**  
* Property: greedy  
* {Boolean} Snap to closest feature in first layer with an eligible  
* feature. Default is true.  
*/  
greedy: true,  
 
/**  
* Property: precedence  
* {Array} List representing precedence of different snapping types.  
* Default is "node", "vertex", "edge".  
*/  
precedence: ["node", "vertex", "edge"],  
 
/**  
* Property: resolution  
* {Float} The map resolution for the previously considered snap.  
*/  
resolution: null,  
 
/**  
* Property: geoToleranceCache  
* {Object} A cache of geo-tolerances. Tolerance values (in map units) are  
* calculated when the map resolution changes.  
*/  
geoToleranceCache: null,  
 
/**  
* Property: layer  
* {<OpenLayers.Layer.Vector>} The current editable layer. Set at  
* construction or after construction with <setLayer>.  
*/  
layer: null,  
 
/**  
* Property: feature  
* {<OpenLayers.Feature.Vector>} The current editable feature.  
*/  
feature: null,  
 
/**  
* Property: point  
* {<OpenLayers.Geometry.Point>} The currently snapped vertex.  
*/  
point: null,  
 
/**  
* Constructor: OpenLayers.Control.Snapping  
* Creates a new snapping control. A control is constructed with an editable  
* layer and a set of configuration objects for target layers. While the  
* control is active, dragging vertices while drawing new features or  
* modifying existing features on the editable layer will engage  
* snapping to features on the target layers. Whether a vertex snaps to  
* a feature on a target layer depends on the target layer configuration.  
*  
* Parameters:  
* options - {Object} An object containing all configuration properties for  
* the control.  
*  
* Valid options:  
* layer - {OpenLayers.Layer.Vector} The editable layer. Features from this  
* layer that are digitized or modified may have vertices snapped to  
* features from any of the target layers.  
* targets - {Array(Object | OpenLayers.Layer.Vector)} A list of objects for  
* configuring target layers. See valid properties of the target  
* objects below. If the items in the targets list are vector layers  
* (instead of configuration objects), the defaults from the <defaults>  
* property will apply. The editable layer itself may be a target  
* layer - allowing newly created or edited features to be snapped to  
* existing features from the same layer. If no targets are provided  
* the layer given in the constructor (as <layer>) will become the  
* initial target.  
* defaults - {Object} An object with default properties to be applied  
* to all target objects.  
* greedy - {Boolean} Snap to closest feature in first target layer that  
* applies. Default is true. If false, all features in all target  
* layers will be checked and the closest feature in all target layers  
* will be chosen. The greedy property determines if the order of the  
* target layers is significant. By default, the order of the target  
* layers is significant where layers earlier in the target layer list  
* have precedence over layers later in the list. Within a single  
* layer, the closest feature is always chosen for snapping. This  
* property only determines whether the search for a closer feature  
* continues after an eligible feature is found in a target layer.  
*  
* Valid target properties:  
* layer - {OpenLayers.Layer.Vector} A target layer. Features from this  
* layer will be eligible to act as snapping target for the editable  
* layer.  
* tolerance - {Float} The distance (in pixels) at which snapping may occur.  
* Default is 10.  
* node - {Boolean} Snap to nodes (first or last point in a geometry) in  
* target layer. Default is true.  
* nodeTolerance - {Float} Optional distance at which snapping may occur  
* for nodes specifically. If none is provided, <tolerance> will be  
* used.  
* vertex - {Boolean} Snap to vertices in target layer. Default is true.  
* vertexTolerance - {Float} Optional distance at which snapping may occur  
* for vertices specifically. If none is provided, <tolerance> will be  
* used.  
* edge - {Boolean} Snap to edges in target layer. Default is true.  
* edgeTolerance - {Float} Optional distance at which snapping may occur  
* for edges specifically. If none is provided, <tolerance> will be  
* used.  
* filter - {OpenLayers.Filter} Optional filter to evaluate to determine if  
* feature is eligible for snapping. If filter evaluates to true for a  
* target feature a vertex may be snapped to the feature.  
*/  
initialize: function(options) {  
// concatenate events specific to measure with those from the base  
Array.prototype.push.apply(  
this.EVENT_TYPES, OpenLayers.Control.prototype.EVENT_TYPES  
);  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
this.options = options || {}; // TODO: this could be done by the super  
 
// set the editable layer if provided  
if(this.options.layer) {  
this.setLayer(this.options.layer);  
}  
// configure target layers  
var defaults = OpenLayers.Util.extend({}, this.options.defaults);  
this.defaults = OpenLayers.Util.applyDefaults(defaults, this.DEFAULTS);  
this.setTargets(this.options.targets);  
if(this.targets.length === 0 && this.layer) {  
this.addTargetLayer(this.layer);  
}  
 
this.geoToleranceCache = {};  
},  
 
/**  
* APIMethod: setLayer  
* Set the editable layer. Call the setLayer method if the editable layer  
* changes and the same control should be used on a new editable layer.  
* If the control is already active, it will be active after the new  
* layer is set.  
*  
* Parameters:  
* layer - {OpenLayers.Layer.Vector} The new editable layer.  
*/  
setLayer: function(layer) {  
if(this.active) {  
this.deactivate();  
this.layer = layer;  
this.activate();  
} else {  
this.layer = layer;  
}  
},  
 
/**  
* Method: setTargets  
* Set the targets for the snapping agent.  
*  
* Parameters:  
* targets - {Array} An array of target configs or target layers.  
*/  
setTargets: function(targets) {  
this.targets = [];  
if(targets && targets.length) {  
var target;  
for(var i=0, len=targets.length; i<len; ++i) {  
target = targets[i];  
if(target instanceof OpenLayers.Layer.Vector) {  
this.addTargetLayer(target);  
} else {  
this.addTarget(target);  
}  
}  
}  
},  
 
/**  
* Method: addTargetLayer  
* Add a target layer with the default target config.  
*  
* Parameters:  
* layer - {<OpenLayers.Layer.Vector>} A target layer.  
*/  
addTargetLayer: function(layer) {  
this.addTarget({layer: layer});  
},  
 
/**  
* Method: addTarget  
* Add a configured target layer.  
*  
* Parameters:  
* target - {Object} A target config.  
*/  
addTarget: function(target) {  
target = OpenLayers.Util.applyDefaults(target, this.defaults);  
target.nodeTolerance = target.nodeTolerance || target.tolerance;  
target.vertexTolerance = target.vertexTolerance || target.tolerance;  
target.edgeTolerance = target.edgeTolerance || target.tolerance;  
this.targets.push(target);  
},  
 
/**  
* Method: removeTargetLayer  
* Remove a target layer.  
*  
* Parameters:  
* layer - {<OpenLayers.Layer.Vector>} The target layer to remove.  
*/  
removeTargetLayer: function(layer) {  
var target;  
for(var i=this.targets.length-1; i>=0; --i) {  
target = this.targets[i];  
if(target.layer === layer) {  
this.removeTarget(target);  
}  
}  
},  
 
/**  
* Method: removeTarget  
* Remove a target.  
*  
* Parameters:  
* target - {Object} A target config.  
*  
* Returns:  
* {Array} The targets array.  
*/  
removeTarget: function(target) {  
return OpenLayers.Util.removeItem(this.targets, target);  
},  
 
/**  
* APIMethod: activate  
* Activate the control. Activating the control registers listeners for  
* editing related events so that during feature creation and  
* modification, moving vertices will trigger snapping.  
*/  
activate: function() {  
var activated = OpenLayers.Control.prototype.activate.call(this);  
if(activated) {  
if(this.layer && this.layer.events) {  
this.layer.events.on({  
sketchstarted: this.onSketchModified,  
sketchmodified: this.onSketchModified,  
vertexmodified: this.onVertexModified,  
scope: this  
});  
}  
}  
return activated;  
},  
 
/**  
* APIMethod: deactivate  
* Deactivate the control. Deactivating the control unregisters listeners  
* so feature editing may proceed without engaging the snapping agent.  
*/  
deactivate: function() {  
var deactivated = OpenLayers.Control.prototype.deactivate.call(this);  
if(deactivated) {  
if(this.layer && this.layer.events) {  
this.layer.events.un({  
sketchstarted: this.onSketchModified,  
sketchmodified: this.onSketchModified,  
vertexmodified: this.onVertexModified,  
scope: this  
});  
}  
}  
this.feature = null;  
this.point = null;  
return deactivated;  
},  
 
/**  
* Method: onSketchModified  
* Registered as a listener for the sketchmodified event on the editable  
* layer.  
*  
* Parameters:  
* event - {Object} The sketch modified event.  
*/  
onSketchModified: function(event) {  
this.feature = event.feature;  
this.considerSnapping(event.vertex, event.vertex);  
},  
 
/**  
* Method: onVertexModified  
* Registered as a listener for the vertexmodified event on the editable  
* layer.  
*  
* Parameters:  
* event - {Object} The vertex modified event.  
*/  
onVertexModified: function(event) {  
this.feature = event.feature;  
var loc = this.layer.map.getLonLatFromViewPortPx(event.pixel);  
this.considerSnapping(  
event.vertex, new OpenLayers.Geometry.Point(loc.lon, loc.lat)  
);  
},  
 
/**  
* Method: considerSnapping  
*  
* Parameters:  
* point - {<OpenLayers.Geometry.Point}} The vertex to be snapped (or  
* unsnapped).  
* loc - {<OpenLayers.Geometry.Point>} The location of the mouse in map  
* coords.  
*/  
considerSnapping: function(point, loc) {  
var best = {  
rank: Number.POSITIVE_INFINITY,  
dist: Number.POSITIVE_INFINITY,  
x: null, y: null  
};  
var snapped = false;  
var result, target;  
for(var i=0, len=this.targets.length; i<len; ++i) {  
target = this.targets[i];  
result = this.testTarget(target, loc);  
if(result) {  
if(this.greedy) {  
best = result;  
best.target = target;  
snapped = true;  
break;  
} else {  
if((result.rank < best.rank) ||  
(result.rank === best.rank && result.dist < best.dist)) {  
best = result;  
best.target = target;  
snapped = true;  
}  
}  
}  
}  
if(snapped) {  
var proceed = this.events.triggerEvent("beforesnap", {  
point: point, x: best.x, y: best.y, distance: best.dist,  
layer: best.target.layer, snapType: this.precedence[best.rank]  
});  
if(proceed !== false) {  
point.x = best.x;  
point.y = best.y;  
this.point = point;  
this.events.triggerEvent("snap", {  
point: point,  
snapType: this.precedence[best.rank],  
layer: best.target.layer,  
distance: best.dist  
});  
} else {  
snapped = false;  
}  
}  
if(this.point && !snapped) {  
point.x = loc.x;  
point.y = loc.y;  
this.point = null;  
this.events.triggerEvent("unsnap", {point: point});  
}  
},  
 
/**  
* Method: testTarget  
*  
* Parameters:  
* target - {Object} Object with target layer configuration.  
* loc - {<OpenLayers.Geometry.Point>} The location of the mouse in map  
* coords.  
*  
* Returns:  
* {Object} A result object with rank, dist, x, and y properties.  
* Returns null if candidate is not eligible for snapping.  
*/  
testTarget: function(target, loc) {  
var tolerance = {  
node: this.getGeoTolerance(target.nodeTolerance),  
vertex: this.getGeoTolerance(target.vertexTolerance),  
edge: this.getGeoTolerance(target.edgeTolerance)  
};  
// this could be cached if we don't support setting tolerance values directly  
var maxTolerance = Math.max(  
tolerance.node, tolerance.vertex, tolerance.edge  
);  
var result = {  
rank: Number.POSITIVE_INFINITY, dist: Number.POSITIVE_INFINITY  
};  
var eligible = false;  
var features = target.layer.features;  
var feature, type, vertices, vertex, closest, dist, found;  
var numTypes = this.precedence.length;  
var ll = new OpenLayers.LonLat(loc.x, loc.y);  
for(var i=0, len=features.length; i<len; ++i) {  
feature = features[i];  
if(feature !== this.feature && !feature._sketch &&  
feature.state !== OpenLayers.State.DELETE &&  
(!target.filter || target.filter.evaluate(feature.attributes))) {  
if(feature.atPoint(ll, maxTolerance, maxTolerance)) {  
for(var j=0, stop=Math.min(result.rank+1, numTypes); j<stop; ++j) {  
type = this.precedence[j];  
if(target[type]) {  
if(type === "edge") {  
closest = feature.geometry.distanceTo(loc, {details: true});  
dist = closest.distance;  
if(dist <= tolerance[type] && dist < result.dist) {  
result = {  
rank: j, dist: dist,  
x: closest.x0, y: closest.y0 // closest coords on feature  
};  
eligible = true;  
// don't look for lower precedence types for this feature  
break;  
}  
} else {  
// look for nodes or vertices  
vertices = feature.geometry.getVertices(type === "node");  
found = false;  
for(var k=0, klen=vertices.length; k<klen; ++k) {  
vertex = vertices[k];  
dist = vertex.distanceTo(loc);  
if(dist <= tolerance[type] &&  
(j < result.rank || (j === result.rank && dist < result.dist))) {  
result = {  
rank: j, dist: dist,  
x: vertex.x, y: vertex.y  
};  
eligible = true;  
found = true;  
}  
}  
if(found) {  
// don't look for lower precedence types for this feature  
break;  
}  
}  
}  
}  
}  
}  
}  
return eligible ? result : null;  
},  
 
/**  
* Method: getGeoTolerance  
* Calculate a tolerance in map units given a tolerance in pixels. This  
* takes advantage of the <geoToleranceCache> when the map resolution  
* has not changed.  
*  
* Parameters:  
* tolerance - {Number} A tolerance value in pixels.  
*  
* Returns:  
* {Number} A tolerance value in map units.  
*/  
getGeoTolerance: function(tolerance) {  
var resolution = this.layer.map.getResolution();  
if(resolution !== this.resolution) {  
this.resolution = resolution;  
this.geoToleranceCache = {};  
}  
var geoTolerance = this.geoToleranceCache[tolerance];  
if(geoTolerance === undefined) {  
geoTolerance = tolerance * resolution;  
this.geoToleranceCache[tolerance] = geoTolerance;  
}  
return geoTolerance;  
},  
 
/**  
* Method: destroy  
* Clean up the control.  
*/  
destroy: function() {  
if(this.active) {  
this.deactivate(); // TODO: this should be handled by the super  
}  
delete this.layer;  
delete this.targets;  
OpenLayers.Control.prototype.destroy.call(this);  
},  
 
CLASS_NAME: "OpenLayers.Control.Snapping"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Handler/Path.js  
* @requires OpenLayers/Layer/Vector.js  
*/  
 
/**  
* Class: OpenLayers.Control.Split  
* Acts as a split feature agent while editing vector features.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.Split = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Constant: EVENT_TYPES  
* {Array(String)} Supported application event types. Register a listener  
* for a particular event with the following syntax:  
* (code)  
* control.events.register(type, obj, listener);  
* (end)  
*  
* Listeners will be called with a reference to an event object. The  
* properties of this event depends on exactly what happened.  
*  
* Supported control event types (in addition to those from <OpenLayers.Control>):  
* beforesplit - Triggered before a split occurs. Listeners receive an  
* event object with *source* and *target* properties.  
* split - Triggered when a split occurs. Listeners receive an event with  
* an *original* property and a *features* property. The original  
* is a reference to the target feature that the sketch or modified  
* feature intersects. The features property is a list of all features  
* that result from this single split. This event is triggered before  
* the resulting features are added to the layer (while the layer still  
* has a reference to the original).  
* aftersplit - Triggered after all splits resulting from a single sketch  
* or feature modification have occurred. The original features  
* have been destroyed and features that result from the split  
* have already been added to the layer. Listeners receive an event  
* with a *source* and *features* property. The source references the  
* sketch or modified feature used as a splitter. The features  
* property is a list of all resulting features.  
*/  
EVENT_TYPES: ["beforesplit", "split", "aftersplit"],  
 
/**  
* APIProperty: layer  
* {<OpenLayers.Layer.Vector>} The target layer with features to be split.  
* Set at construction or after construction with <setLayer>.  
*/  
layer: null,  
 
/**  
* Property: source  
* {<OpenLayers.Layer.Vector>} Optional source layer. Any newly created  
* or modified features from this layer will be used to split features  
* on the target layer. If not provided, a temporary sketch layer will  
* be created.  
*/  
source: null,  
 
/**  
* Property: sourceOptions  
* {Options} If a temporary sketch layer is created, these layer options  
* will be applied.  
*/  
sourceOptions: null,  
 
/**  
* APIProperty: tolerance  
* {Number} Distance between the calculated intersection and a vertex on  
* the source geometry below which the existing vertex will be used  
* for the split. Default is null.  
*/  
tolerance: null,  
 
/**  
* APIProperty: edge  
* {Boolean} Allow splits given intersection of edges only. Default is  
* true. If false, a vertex on the source must be within the  
* <tolerance> distance of the calculated intersection for a split  
* to occur.  
*/  
edge: true,  
 
/**  
* APIProperty: deferDelete  
* {Boolean} Instead of removing features from the layer, set feature  
* states of split features to DELETE. This assumes a save strategy  
* or other component is in charge of removing features from the  
* layer. Default is false. If false, split features will be  
* immediately deleted from the layer.  
*/  
deferDelete: false,  
 
/**  
* APIProperty: mutual  
* {Boolean} If source and target layers are the same, split source  
* features and target features where they intersect. Default is  
* true. If false, only target features will be split.  
*/  
mutual: true,  
 
/**  
* APIProperty: targetFilter  
* {OpenLayers.Filter} Optional filter that will be evaluated  
* to determine if a feature from the target layer is eligible for  
* splitting.  
*/  
targetFilter: null,  
 
/**  
* APIProperty: sourceFilter  
* {OpenLayers.Filter} Optional filter that will be evaluated  
* to determine if a feature from the target layer is eligible for  
* splitting.  
*/  
sourceFilter: null,  
 
/**  
* Property: handler  
* {<OpenLayers.Handler.Path>} The temporary sketch handler created if  
* no source layer is provided.  
*/  
handler: null,  
 
/**  
* Constructor: OpenLayers.Control.Split  
* Creates a new split control. A control is constructed with a target  
* layer and an optional source layer. While the control is active,  
* creating new features or modifying existing features on the source  
* layer will result in splitting any eligible features on the target  
* layer. If no source layer is provided, a temporary sketch layer will  
* be created to create lines for splitting features on the target.  
*  
* Parameters:  
* options - {Object} An object containing all configuration properties for  
* the control.  
*  
* Valid options:  
* layer - {OpenLayers.Layer.Vector} The target layer. Features from this  
* layer will be split by new or modified features on the source layer  
* or temporary sketch layer.  
* source - {OpenLayers.Layer.Vector} Optional source layer. If provided  
* newly created features or modified features will be used to split  
* features on the target layer. If not provided, a temporary sketch  
* layer will be created for drawing lines.  
* tolerance - {Number} Optional value for the distance between a source  
* vertex and the calculated intersection below which the split will  
* occur at the vertex.  
* edge - {Boolean} Allow splits given intersection of edges only. Default  
* is true. If false, a vertex on the source must be within the  
* <tolerance> distance of the calculated intersection for a split  
* to occur.  
* mutual - {Boolean} If source and target are the same, split source  
* features and target features where they intersect. Default is  
* true. If false, only target features will be split.  
* targetFilter - {OpenLayers.Filter} Optional filter that will be evaluated  
* to determine if a feature from the target layer is eligible for  
* splitting.  
* sourceFilter - {OpenLayers.Filter} Optional filter that will be evaluated  
* to determine if a feature from the target layer is eligible for  
* splitting.  
*/  
initialize: function(options) {  
// concatenate events specific to measure with those from the base  
Array.prototype.push.apply(  
this.EVENT_TYPES, OpenLayers.Control.prototype.EVENT_TYPES  
);  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
this.options = options || {}; // TODO: this could be done by the super  
 
// set the source layer if provided  
if(this.options.source) {  
this.setSource(this.options.source);  
}  
},  
 
/**  
* APIMethod: setSource  
* Set the source layer for edits layer.  
*  
* Parameters:  
* layer - {OpenLayers.Layer.Vector} The new source layer layer. If  
* null, a temporary sketch layer will be created.  
*/  
setSource: function(layer) {  
if(this.active) {  
this.deactivate();  
if(this.handler) {  
this.handler.destroy();  
delete this.handler;  
}  
this.source = layer;  
this.activate();  
} else {  
this.source = layer;  
}  
},  
 
/**  
* APIMethod: activate  
* Activate the control. Activating the control registers listeners for  
* editing related events so that during feature creation and  
* modification, features in the target will be considered for  
* splitting.  
*/  
activate: function() {  
var activated = OpenLayers.Control.prototype.activate.call(this);  
if(activated) {  
if(!this.source) {  
if(!this.handler) {  
this.handler = new OpenLayers.Handler.Path(this,  
{done: function(geometry) {  
this.onSketchComplete({  
feature: new OpenLayers.Feature.Vector(geometry)  
});  
}},  
{layerOptions: this.sourceOptions}  
);  
}  
this.handler.activate();  
} else if(this.source.events) {  
this.source.events.on({  
sketchcomplete: this.onSketchComplete,  
afterfeaturemodified: this.afterFeatureModified,  
scope: this  
});  
}  
}  
return activated;  
},  
 
/**  
* APIMethod: deactivate  
* Deactivate the control. Deactivating the control unregisters listeners  
* so feature editing may proceed without engaging the split agent.  
*/  
deactivate: function() {  
var deactivated = OpenLayers.Control.prototype.deactivate.call(this);  
if(deactivated) {  
if(this.source && this.source.events) {  
this.layer.events.un({  
sketchcomplete: this.onSketchComplete,  
afterfeaturemodified: this.afterFeatureModified,  
scope: this  
});  
}  
}  
return deactivated;  
},  
 
/**  
* Method: onSketchComplete  
* Registered as a listener for the sketchcomplete event on the editable  
* layer.  
*  
* Parameters:  
* event - {Object} The sketch complete event.  
*  
* Returns:  
* {Boolean} Stop the sketch from being added to the layer (it has been  
* split).  
*/  
onSketchComplete: function(event) {  
this.feature = null;  
return !this.considerSplit(event.feature);  
},  
 
/**  
* Method: afterFeatureModified  
* Registered as a listener for the afterfeaturemodified event on the  
* editable layer.  
*  
* Parameters:  
* event - {Object} The after feature modified event.  
*/  
afterFeatureModified: function(event) {  
if(event.modified) {  
var feature = event.feature;  
if(feature.geometry instanceof OpenLayers.Geometry.LineString ||  
feature.geometry instanceof OpenLayers.Geometry.MultiLineString) {  
this.feature = event.feature;  
this.considerSplit(event.feature);  
}  
}  
},  
 
/**  
* Method: removeByGeometry  
* Remove a feature from a list based on the given geometry.  
*  
* Parameters:  
* features - {Array(<OpenLayers.Feature.Vector>} A list of features.  
* geometry - {<OpenLayers.Geometry>} A geometry.  
*/  
removeByGeometry: function(features, geometry) {  
for(var i=0, len=features.length; i<len; ++i) {  
if(features[i].geometry === geometry) {  
features.splice(i, 1);  
break;  
}  
}  
},  
 
/**  
* Method: isEligible  
* Test if a target feature is eligible for splitting.  
*  
* Parameters:  
* target - {<OpenLayers.Feature.Vector>} The target feature.  
*  
* Returns:  
* {Boolean} The target is eligible for splitting.  
*/  
isEligible: function(target) {  
return (  
target.state !== OpenLayers.State.DELETE  
) && (  
target.geometry instanceof OpenLayers.Geometry.LineString ||  
target.geometry instanceof OpenLayers.Geometry.MultiLineString  
) && (  
this.feature !== target  
) && (  
!this.targetFilter ||  
this.targetFilter.evaluate(target.attributes)  
);  
},  
 
/**  
* Method: considerSplit  
* Decide whether or not to split target features with the supplied  
* feature. If <mutual> is true, both the source and target features  
* will be split if eligible.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector}} The newly created or modified  
* feature.  
*  
* Returns:  
* {Boolean} The supplied feature was split (and destroyed).  
*/  
considerSplit: function(feature) {  
var sourceSplit = false;  
var targetSplit = false;  
if(!this.sourceFilter ||  
this.sourceFilter.evaluate(feature.attributes)) {  
var features = this.layer && this.layer.features || [];  
var target, results, proceed;  
var additions = [], removals = [];  
var mutual = (this.layer === this.source) && this.mutual;  
var options = {  
edge: this.edge,  
tolerance: this.tolerance,  
mutual: mutual  
};  
var sourceParts = [feature.geometry];  
var targetFeature, targetParts;  
var source, parts;  
for(var i=0, len=features.length; i<len; ++i) {  
targetFeature = features[i];  
if(this.isEligible(targetFeature)) {  
targetParts = [targetFeature.geometry];  
// work through source geoms - this array may change  
for(var j=0; j<sourceParts.length; ++j) {  
source = sourceParts[j];  
// work through target parts - this array may change  
for(var k=0; k<targetParts.length; ++k) {  
target = targetParts[k];  
if(source.getBounds().intersectsBounds(target.getBounds())) {  
results = source.split(target, options);  
if(results) {  
proceed = this.events.triggerEvent(  
"beforesplit", {source: feature, target: targetFeature}  
);  
if(proceed !== false) {  
if(mutual) {  
parts = results[0];  
// handle parts that result from source splitting  
if(parts.length > 1) {  
// splice in new source parts  
parts.unshift(j, 1); // add args for splice below  
Array.prototype.splice.apply(sourceParts, parts);  
j += parts.length - 3;  
}  
results = results[1];  
}  
// handle parts that result from target splitting  
if(results.length > 1) {  
// splice in new target parts  
results.unshift(k, 1); // add args for splice below  
Array.prototype.splice.apply(targetParts, results);  
k += results.length - 3;  
}  
}  
}  
}  
}  
}  
if(targetParts && targetParts.length > 1) {  
this.geomsToFeatures(targetFeature, targetParts);  
this.events.triggerEvent("split", {  
original: targetFeature,  
features: targetParts  
});  
Array.prototype.push.apply(additions, targetParts);  
removals.push(targetFeature);  
targetSplit = true;  
}  
}  
}  
if(sourceParts && sourceParts.length > 1) {  
this.geomsToFeatures(feature, sourceParts);  
this.events.triggerEvent("split", {  
original: feature,  
features: sourceParts  
});  
Array.prototype.push.apply(additions, sourceParts);  
removals.push(feature);  
sourceSplit = true;  
}  
if(sourceSplit || targetSplit) {  
// remove and add feature events are suppressed  
// listen for split event on this control instead  
if(this.deferDelete) {  
// Set state instead of removing. Take care to avoid  
// setting delete for features that have not yet been  
// inserted - those should be destroyed immediately.  
var feat, destroys = [];  
for(var i=0, len=removals.length; i<len; ++i) {  
feat = removals[i];  
if(feat.state === OpenLayers.State.INSERT) {  
destroys.push(feat);  
} else {  
feat.state = OpenLayers.State.DELETE;  
this.layer.drawFeature(feat);  
}  
}  
this.layer.destroyFeatures(destroys, {silent: true});  
for(var i=0, len=additions.length; i<len; ++i) {  
additions[i].state = OpenLayers.State.INSERT;  
}  
} else {  
this.layer.destroyFeatures(removals, {silent: true});  
}  
this.layer.addFeatures(additions, {silent: true});  
this.events.triggerEvent("aftersplit", {  
source: feature,  
features: additions  
});  
}  
}  
return sourceSplit;  
},  
 
/**  
* Method: geomsToFeatures  
* Create new features given a template feature and a list of geometries.  
* The list of geometries is modified in place. The result will be  
* a list of new features.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>} The feature to be cloned.  
* geoms - {Array(<OpenLayers.Geometry>)} List of goemetries. This will  
* become a list of new features.  
*/  
geomsToFeatures: function(feature, geoms) {  
var clone = feature.clone();  
delete clone.geometry;  
var newFeature;  
for(var i=0, len=geoms.length; i<len; ++i) {  
// turn results list from geoms to features  
newFeature = clone.clone();  
newFeature.geometry = geoms[i];  
newFeature.state = OpenLayers.State.INSERT;  
geoms[i] = newFeature;  
}  
},  
 
/**  
* Method: destroy  
* Clean up the control.  
*/  
destroy: function() {  
if(this.active) {  
this.deactivate(); // TODO: this should be handled by the super  
}  
OpenLayers.Control.prototype.destroy.call(this);  
},  
 
CLASS_NAME: "OpenLayers.Control.Split"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Control/DragFeature.js  
* @requires OpenLayers/Feature/Vector.js  
* @requires OpenLayers/Geometry/LineString.js  
* @requires OpenLayers/Geometry/Point.js  
*/  
 
/**  
* Class: OpenLayers.Control.TransformFeature  
* Control to transform features with a standard transformation box.  
*  
* Inherits From:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Constant: EVENT_TYPES  
*  
* Supported event types:  
* - *beforesetfeature* Triggered before a feature is set for  
* tranformation. The feature will not be set if a listener returns  
* false. Listeners receive a *feature* property, with the feature  
* that will be set for transformation. Listeners are allowed to  
* set the control's *scale*, *ratio* and *rotation* properties,  
* which will set the initial scale, ratio and rotation of the  
* feature, like the <setFeature> method's initialParams argument.  
* - *setfeature* Triggered when a feature is set for tranformation.  
* Listeners receive a *feature* property, with the feature that  
* is now set for transformation.  
* - *beforetransform* Triggered while dragging, before a feature is  
* transformed. The feature will not be transformed if a listener  
* returns false (but the box still will). Listeners receive one or  
* more of *center*, *scale*, *ratio* and *rotation*. The *center*  
* property is an <OpenLayers.Geometry.Point> object with the new  
* center of the transformed feature, the others are Floats with the  
* scale, ratio or rotation change since the last transformation.  
* - *transform* Triggered while dragging, when a feature is transformed.  
* Listeners receive an event object with one or more of *center*,  
* *scale*, *ratio* and *rotation*. The *center* property is an  
* <OpenLayers.Geometry.Point> object with the new center of the  
* transformed feature, the others are Floats with the scale, ratio  
* or rotation change of the feature since the last transformation.  
* - *transformcomplete* Triggered after dragging. Listeners receive  
* an event object with the transformed *feature*.  
*/  
EVENT_TYPES: ["beforesetfeature", "setfeature", "beforetransform",  
"transform", "transformcomplete"],  
 
/**  
* APIProperty: geometryTypes  
* {Array(String)} To restrict transformation to a limited set of geometry  
* types, send a list of strings corresponding to the geometry class  
* names.  
*/  
geometryTypes: null,  
 
/**  
* Property: layer  
* {<OpenLayers.Layer.Vector>}  
*/  
layer: null,  
 
/**  
* APIProperty: preserveAspectRatio  
* {Boolean} set to true to not change the feature's aspect ratio.  
*/  
preserveAspectRatio: false,  
 
/**  
* APIProperty: rotate  
* {Boolean} set to false if rotation should be disabled. Default is true.  
* To be passed with the constructor or set when the control is not  
* active.  
*/  
rotate: true,  
 
/**  
* APIProperty: feature  
* {<OpenLayers.Feature.Vector>} Feature currently available for  
* transformation. Read-only, use <setFeature> to set it manually.  
*/  
feature: null,  
 
/**  
* APIProperty: renderIntent  
* {String|Object} Render intent for the transformation box and  
* handles. A symbolizer object can also be provided here.  
*/  
renderIntent: "temporary",  
 
/**  
* APIProperty: rotationHandleSymbolizer  
* {Object|String} Optional. A custom symbolizer for the rotation handles.  
* A render intent can also be provided here. Defaults to  
* (code)  
* {  
* stroke: false,  
* pointRadius: 10,  
* fillOpacity: 0,  
* cursor: "pointer"  
* }  
* (end)  
*/  
rotationHandleSymbolizer: null,  
 
/**  
* APIProperty: box  
* {<OpenLayers.Feature.Vector>} The transformation box rectangle.  
* Read-only.  
*/  
box: null,  
 
/**  
* APIProperty: center  
* {<OpenLayers.Geometry.Point>} The center of the feature bounds.  
* Read-only.  
*/  
center: null,  
 
/**  
* APIProperty: scale  
* {Float} The scale of the feature, relative to the scale the time the  
* feature was set. Read-only, except for *beforesetfeature*  
* listeners.  
*/  
scale: 1,  
 
/**  
* APIProperty: ratio  
* {Float} The ratio of the feature relative to the ratio the time the  
* feature was set. Read-only, except for *beforesetfeature*  
* listeners.  
*/  
ratio: 1,  
 
/**  
* Property: rotation  
* {Integer} the current rotation angle of the box. Read-only, except for  
* *beforesetfeature* listeners.  
*/  
rotation: 0,  
 
/**  
* APIProperty: handles  
* {Array(<OpenLayers.Feature.Vector>)} The 8 handles currently available  
* for scaling/resizing. Numbered counterclockwise, starting from the  
* southwest corner. Read-only.  
*/  
handles: null,  
 
/**  
* APIProperty: rotationHandles  
* {Array(<OpenLayers.Feature.Vector>)} The 4 rotation handles currently  
* available for rotating. Numbered counterclockwise, starting from  
* the southwest corner. Read-only.  
*/  
rotationHandles: null,  
 
/**  
* Property: dragControl  
* {<OpenLayers.Control.DragFeature>}  
*/  
dragControl: null,  
 
/**  
* Constructor: OpenLayers.Control.TransformFeature  
* Create a new transform feature control.  
*  
* Parameters:  
* layer - {<OpenLayers.Layer.Vector>} Layer that contains features that  
* will be transformed.  
* options - {Object} Optional object whose properties will be set on the  
* control.  
*/  
initialize: function(layer, options) {  
// concatenate events specific to this control with those from the base  
this.EVENT_TYPES =  
OpenLayers.Control.TransformFeature.prototype.EVENT_TYPES.concat(  
OpenLayers.Control.prototype.EVENT_TYPES  
);  
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
 
this.layer = layer;  
 
if(!this.rotationHandleSymbolizer) {  
this.rotationHandleSymbolizer = {  
stroke: false,  
pointRadius: 10,  
fillOpacity: 0,  
cursor: "pointer"  
};  
}  
 
this.createBox();  
this.createControl();  
},  
 
/**  
* APIMethod: activate  
* Activates the control.  
*/  
activate: function() {  
var activated = false;  
if(OpenLayers.Control.prototype.activate.apply(this, arguments)) {  
this.dragControl.activate();  
this.layer.addFeatures([this.box]);  
this.rotate && this.layer.addFeatures(this.rotationHandles);  
this.layer.addFeatures(this.handles);  
activated = true;  
}  
return activated;  
},  
 
/**  
* APIMethod: deactivate  
* Deactivates the control.  
*/  
deactivate: function() {  
var deactivated = false;  
if(OpenLayers.Control.prototype.deactivate.apply(this, arguments)) {  
this.layer.removeFeatures(this.handles);  
this.rotate && this.layer.removeFeatures(this.rotationHandles);  
this.layer.removeFeatures([this.box]);  
this.dragControl.deactivate();  
deactivated = true;  
}  
return deactivated;  
},  
 
/**  
* Method: setMap  
*  
* Parameters:  
* map - {<OpenLayers.Map>}  
*/  
setMap: function(map) {  
this.dragControl.setMap(map);  
OpenLayers.Control.prototype.setMap.apply(this, arguments);  
},  
 
/**  
* APIMethod: setFeature  
* Place the transformation box on a feature and start transforming it.  
* If the control is not active, it will be activated.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>}  
* initialParams - {Object} Initial values for rotation, scale or ratio.  
* Setting a rotation value here will cause the transformation box to  
* start rotated. Setting a scale or ratio will not affect the  
* transormation box, but applications may use this to keep track of  
* scale and ratio of a feature across multiple transforms.  
*/  
setFeature: function(feature, initialParams) {  
initialParams = OpenLayers.Util.applyDefaults(initialParams, {  
rotation: 0,  
scale: 1,  
ratio: 1  
});  
var evt = {feature: feature};  
 
var oldRotation = this.rotation;  
var oldCenter = this.center;  
OpenLayers.Util.extend(this, initialParams);  
 
if(this.events.triggerEvent("beforesetfeature", evt) === false) {  
return;  
}  
 
this.feature = feature;  
this.activate();  
 
this._setfeature = true;  
 
var featureBounds = this.feature.geometry.getBounds();  
this.box.move(featureBounds.getCenterLonLat());  
this.box.geometry.rotate(-oldRotation, oldCenter);  
this._angle = 0;  
 
var ll;  
if(this.rotation) {  
var geom = feature.geometry.clone();  
geom.rotate(-this.rotation, this.center);  
var box = new OpenLayers.Feature.Vector(  
geom.getBounds().toGeometry());  
box.geometry.rotate(this.rotation, this.center);  
this.box.geometry.rotate(this.rotation, this.center);  
this.box.move(box.geometry.getBounds().getCenterLonLat());  
var llGeom = box.geometry.components[0].components[0];  
ll = llGeom.getBounds().getCenterLonLat();  
} else {  
ll = new OpenLayers.LonLat(featureBounds.left, featureBounds.bottom);  
}  
this.handles[0].move(ll);  
 
delete this._setfeature;  
 
this.events.triggerEvent("setfeature", evt);  
},  
 
/**  
* Method: createBox  
* Creates the box with all handles and transformation handles.  
*/  
createBox: function() {  
var control = this;  
 
this.center = new OpenLayers.Geometry.Point(0, 0);  
var box = new OpenLayers.Feature.Vector(  
new OpenLayers.Geometry.LineString([  
new OpenLayers.Geometry.Point(-1, -1),  
new OpenLayers.Geometry.Point(0, -1),  
new OpenLayers.Geometry.Point(1, -1),  
new OpenLayers.Geometry.Point(1, 0),  
new OpenLayers.Geometry.Point(1, 1),  
new OpenLayers.Geometry.Point(0, 1),  
new OpenLayers.Geometry.Point(-1, 1),  
new OpenLayers.Geometry.Point(-1, 0),  
new OpenLayers.Geometry.Point(-1, -1)  
]), null,  
typeof this.renderIntent == "string" ? null : this.renderIntent  
);  
 
// Override for box move - make sure that the center gets updated  
box.geometry.move = function(x, y) {  
control._moving = true;  
OpenLayers.Geometry.LineString.prototype.move.apply(this, arguments);  
control.center.move(x, y);  
delete control._moving;  
};  
 
// Overrides for vertex move, resize and rotate - make sure that  
// handle and rotationHandle geometries are also moved, resized and  
// rotated.  
var vertexMoveFn = function(x, y) {  
OpenLayers.Geometry.Point.prototype.move.apply(this, arguments);  
this._rotationHandle && this._rotationHandle.geometry.move(x, y);  
this._handle.geometry.move(x, y);  
};  
var vertexResizeFn = function(scale, center, ratio) {  
OpenLayers.Geometry.Point.prototype.resize.apply(this, arguments);  
this._rotationHandle && this._rotationHandle.geometry.resize(  
scale, center, ratio);  
this._handle.geometry.resize(scale, center, ratio);  
};  
var vertexRotateFn = function(angle, center) {  
OpenLayers.Geometry.Point.prototype.rotate.apply(this, arguments);  
this._rotationHandle && this._rotationHandle.geometry.rotate(  
angle, center);  
this._handle.geometry.rotate(angle, center);  
};  
 
// Override for handle move - make sure that the box and other handles  
// are updated, and finally transform the feature.  
var handleMoveFn = function(x, y) {  
var oldX = this.x, oldY = this.y;  
OpenLayers.Geometry.Point.prototype.move.call(this, x, y);  
if(control._moving) {  
return;  
}  
var evt = control.dragControl.handlers.drag.evt;  
var preserveAspectRatio = !control._setfeature &&  
control.preserveAspectRatio;  
var reshape = !preserveAspectRatio && !(evt && evt.shiftKey);  
var oldGeom = new OpenLayers.Geometry.Point(oldX, oldY);  
var centerGeometry = control.center;  
this.rotate(-control.rotation, centerGeometry);  
oldGeom.rotate(-control.rotation, centerGeometry);  
var dx1 = this.x - centerGeometry.x;  
var dy1 = this.y - centerGeometry.y;  
var dx0 = dx1 - (this.x - oldGeom.x);  
var dy0 = dy1 - (this.y - oldGeom.y);  
this.x = oldX;  
this.y = oldY;  
var scale, ratio = 1;  
if (reshape) {  
scale = Math.abs(dy0) < 0.00001 ? 1 : dy1 / dy0;  
ratio = (Math.abs(dx0) < 0.00001 ? 1 : (dx1 / dx0)) / scale;  
} else {  
var l0 = Math.sqrt((dx0 * dx0) + (dy0 * dy0));  
var l1 = Math.sqrt((dx1 * dx1) + (dy1 * dy1));  
scale = l1 / l0;  
}  
 
// rotate the box to 0 before resizing - saves us some  
// calculations and is inexpensive because we don't drawFeature.  
control._moving = true;  
control.box.geometry.rotate(-control.rotation, centerGeometry);  
delete control._moving;  
 
control.box.geometry.resize(scale, centerGeometry, ratio);  
control.box.geometry.rotate(control.rotation, centerGeometry);  
control.transformFeature({scale: scale, ratio: ratio});  
};  
 
// Override for rotation handle move - make sure that the box and  
// other handles are updated, and finally transform the feature.  
var rotationHandleMoveFn = function(x, y){  
var oldX = this.x, oldY = this.y;  
OpenLayers.Geometry.Point.prototype.move.call(this, x, y);  
if(control._moving) {  
return;  
}  
var evt = control.dragControl.handlers.drag.evt;  
var constrain = (evt && evt.shiftKey) ? 45 : 1;  
var centerGeometry = control.center;  
var dx1 = this.x - centerGeometry.x;  
var dy1 = this.y - centerGeometry.y;  
var dx0 = dx1 - x;  
var dy0 = dy1 - y;  
this.x = oldX;  
this.y = oldY;  
var a0 = Math.atan2(dy0, dx0);  
var a1 = Math.atan2(dy1, dx1);  
var angle = a1 - a0;  
angle *= 180 / Math.PI;  
control._angle = (control._angle + angle) % 360;  
var diff = control.rotation % constrain;  
if(Math.abs(control._angle) >= constrain || diff !== 0) {  
angle = Math.round(control._angle / constrain) * constrain -  
diff;  
control._angle = 0;  
control.box.geometry.rotate(angle, centerGeometry);  
control.transformFeature({rotation: angle});  
}  
};  
 
var handles = new Array(8);  
var rotationHandles = new Array(4);  
var geom, handle, rotationHandle;  
for(var i=0; i<8; ++i) {  
geom = box.geometry.components[i];  
handle = new OpenLayers.Feature.Vector(geom.clone(), null,  
typeof this.renderIntent == "string" ? null :  
this.renderIntent);  
if(i % 2 == 0) {  
rotationHandle = new OpenLayers.Feature.Vector(geom.clone(),  
null, typeof this.rotationHandleSymbolizer == "string" ?  
null : this.rotationHandleSymbolizer);  
rotationHandle.geometry.move = rotationHandleMoveFn;  
geom._rotationHandle = rotationHandle;  
rotationHandles[i/2] = rotationHandle;  
}  
geom.move = vertexMoveFn;  
geom.resize = vertexResizeFn;  
geom.rotate = vertexRotateFn;  
handle.geometry.move = handleMoveFn;  
geom._handle = handle;  
handles[i] = handle;  
}  
 
this.box = box;  
this.rotationHandles = rotationHandles;  
this.handles = handles;  
},  
 
/**  
* Method: createControl  
* Creates a DragFeature control for this control.  
*/  
createControl: function() {  
var control = this;  
this.dragControl = new OpenLayers.Control.DragFeature(this.layer, {  
documentDrag: true,  
// avoid moving the feature itself - move the box instead  
moveFeature: function(pixel) {  
if(this.feature === control.feature) {  
this.feature = control.box;  
}  
OpenLayers.Control.DragFeature.prototype.moveFeature.apply(this,  
arguments);  
},  
// transform while dragging  
onDrag: function(feature, pixel) {  
if(feature === control.box) {  
control.transformFeature({center: control.center});  
control.drawHandles();  
}  
},  
// set a new feature  
onStart: function(feature, pixel) {  
var eligible = !control.geometryTypes ||  
OpenLayers.Util.indexOf(control.geometryTypes,  
feature.geometry.CLASS_NAME) !== -1;  
var i = OpenLayers.Util.indexOf(control.handles, feature);  
i += OpenLayers.Util.indexOf(control.rotationHandles,  
feature);  
if(feature !== control.feature && feature !== control.box &&  
i == -2 && eligible) {  
control.setFeature(feature);  
}  
},  
onComplete: function(feature, pixel) {  
control.events.triggerEvent("transformcomplete",  
{feature: control.feature});  
}  
});  
},  
 
/**  
* Method: drawHandles  
* Draws the handles to match the box.  
*/  
drawHandles: function() {  
var layer = this.layer;  
for(var i=0; i<8; ++i) {  
if(this.rotate && i % 2 === 0) {  
layer.drawFeature(this.rotationHandles[i/2],  
this.rotationHandleSymbolizer);  
}  
layer.drawFeature(this.handles[i], this.renderIntent);  
}  
},  
 
/**  
* Method: transformFeature  
* Transforms the feature.  
*  
* Parameters:  
* mods - {Object} An object with optional scale, ratio, rotation and  
* center properties.  
*/  
transformFeature: function(mods) {  
if(!this._setfeature) {  
this.scale *= (mods.scale || 1);  
this.ratio *= (mods.ratio || 1);  
var oldRotation = this.rotation;  
this.rotation = (this.rotation + (mods.rotation || 0)) % 360;  
 
if(this.events.triggerEvent("beforetransform", mods) !== false) {  
var feature = this.feature;  
var geom = feature.geometry;  
var center = this.center;  
geom.rotate(-oldRotation, center);  
if(mods.scale || mods.ratio) {  
geom.resize(mods.scale, center, mods.ratio);  
} else if(mods.center) {  
feature.move(mods.center.getBounds().getCenterLonLat());  
}  
geom.rotate(this.rotation, center);  
this.layer.drawFeature(feature);  
feature.toState(OpenLayers.State.UPDATE);  
this.events.triggerEvent("transform", mods);  
}  
}  
this.layer.drawFeature(this.box, this.renderIntent);  
this.drawHandles();  
},  
 
/**  
* APIMethod: destroy  
* Take care of things that are not handled in superclass.  
*/  
destroy: function() {  
var geom;  
for(var i=0; i<8; ++i) {  
geom = this.box.geometry.components[i];  
geom._handle.destroy();  
geom._handle = null;  
geom._rotationHandle && geom._rotationHandle.destroy();  
geom._rotationHandle = null;  
}  
this.box.destroy();  
this.box = null;  
this.layer = null;  
this.dragControl.destroy();  
OpenLayers.Control.prototype.destroy.apply(this, arguments);  
},  
 
CLASS_NAME: "OpenLayers.Control.TransformFeature"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Handler/Click.js  
* @requires OpenLayers/Handler/Hover.js  
* @requires OpenLayers/Request.js  
*/  
 
/**  
* Class: OpenLayers.Control.WMSGetFeatureInfo  
* The WMSGetFeatureInfo control uses a WMS query to get information about a point on the map. The  
* information may be in a display-friendly format such as HTML, or a machine-friendly format such  
* as GML, depending on the server's capabilities and the client's configuration. This control  
* handles click or hover events, attempts to parse the results using an OpenLayers.Format, and  
* fires a 'getfeatureinfo' event with the click position, the raw body of the response, and an  
* array of features if it successfully read the response.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* APIProperty: hover  
* {Boolean} Send GetFeatureInfo requests when mouse stops moving.  
* Default is false.  
*/  
hover: false,  
 
/**  
* APIProperty: drillDown  
* {Boolean} Drill down over all WMS layers in the map. When  
* using drillDown mode, hover is not possible, and an infoFormat that  
* returns parseable features is required. Default is false.  
*/  
drillDown: false,  
 
/**  
* APIProperty: maxFeatures  
* {Integer} Maximum number of features to return from a WMS query. This  
* sets the feature_count parameter on WMS GetFeatureInfo  
* requests.  
*/  
maxFeatures: 10,  
 
/** APIProperty: clickCallback  
* {String} The click callback to register in the  
* {<OpenLayers.Handler.Click>} object created when the hover  
* option is set to false. Default is "click".  
*/  
clickCallback: "click",  
 
/**  
* Property: layers  
* {Array(<OpenLayers.Layer.WMS>)} The layers to query for feature info.  
* If omitted, all map WMS layers with a url that matches this <url> or  
* <layerUrls> will be considered.  
*/  
layers: null,  
 
/**  
* Property: queryVisible  
* {Boolean} If true, filter out hidden layers when searching the map for  
* layers to query. Default is false.  
*/  
queryVisible: false,  
 
/**  
* Property: url  
* {String} The URL of the WMS service to use. If not provided, the url  
* of the first eligible layer will be used.  
*/  
url: null,  
 
/**  
* Property: layerUrls  
* {Array(String)} Optional list of urls for layers that should be queried.  
* This can be used when the layer url differs from the url used for  
* making GetFeatureInfo requests (in the case of a layer using cached  
* tiles).  
*/  
layerUrls: null,  
 
/**  
* Property: infoFormat  
* {String} The mimetype to request from the server  
*/  
infoFormat: 'text/html',  
 
/**  
* Property: vendorParams  
* {Object} Additional parameters that will be added to the request, for  
* WMS implementations that support them. This could e.g. look like  
* (start code)  
* {  
* radius: 5  
* }  
* (end)  
*/  
vendorParams: {},  
 
/**  
* Property: format  
* {<OpenLayers.Format>} A format for parsing GetFeatureInfo responses.  
* Default is <OpenLayers.Format.WMSGetFeatureInfo>.  
*/  
format: null,  
 
/**  
* Property: formatOptions  
* {Object} Optional properties to set on the format (if one is not provided  
* in the <format> property.  
*/  
formatOptions: null,  
 
/**  
* APIProperty: handlerOptions  
* {Object} Additional options for the handlers used by this control, e.g.  
* (start code)  
* {  
* "click": {delay: 100},  
* "hover": {delay: 300}  
* }  
* (end)  
*/  
handlerOptions: null,  
 
/**  
* Property: handler  
* {Object} Reference to the <OpenLayers.Handler> for this control  
*/  
handler: null,  
 
/**  
* Property: hoverRequest  
* {<OpenLayers.Request>} contains the currently running hover request  
* (if any).  
*/  
hoverRequest: null,  
 
/**  
* Constant: EVENT_TYPES  
*  
* Supported event types (in addition to those from <OpenLayers.Control>):  
* beforegetfeatureinfo - Triggered before the request is sent.  
* The event object has an *xy* property with the position of the  
* mouse click or hover event that triggers the request.  
* nogetfeatureinfo - no queryable layers were found.  
* getfeatureinfo - Triggered when a GetFeatureInfo response is received.  
* The event object has a *text* property with the body of the  
* response (String), a *features* property with an array of the  
* parsed features, an *xy* property with the position of the mouse  
* click or hover event that triggered the request, and a *request*  
* property with the request itself. If drillDown is set to true and  
* multiple requests were issued to collect feature info from all  
* layers, *text* and *request* will only contain the response body  
* and request object of the last request.  
*/  
EVENT_TYPES: ["beforegetfeatureinfo", "nogetfeatureinfo", "getfeatureinfo"],  
 
/**  
* Constructor: <OpenLayers.Control.WMSGetFeatureInfo>  
*  
* Parameters:  
* options - {Object}  
*/  
initialize: function(options) {  
// concatenate events specific to vector with those from the base  
this.EVENT_TYPES =  
OpenLayers.Control.WMSGetFeatureInfo.prototype.EVENT_TYPES.concat(  
OpenLayers.Control.prototype.EVENT_TYPES  
);  
 
options = options || {};  
options.handlerOptions = options.handlerOptions || {};  
 
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
 
if(!this.format) {  
this.format = new OpenLayers.Format.WMSGetFeatureInfo(  
options.formatOptions  
);  
}  
 
if(this.drillDown === true) {  
this.hover = false;  
}  
 
if(this.hover) {  
this.handler = new OpenLayers.Handler.Hover(  
this, {  
'move': this.cancelHover,  
'pause': this.getInfoForHover  
},  
OpenLayers.Util.extend(this.handlerOptions.hover || {}, {  
'delay': 250  
}));  
} else {  
var callbacks = {};  
callbacks[this.clickCallback] = this.getInfoForClick;  
this.handler = new OpenLayers.Handler.Click(  
this, callbacks, this.handlerOptions.click || {});  
}  
},  
 
/**  
* Method: activate  
* Activates the control.  
*  
* Returns:  
* {Boolean} The control was effectively activated.  
*/  
activate: function () {  
if (!this.active) {  
this.handler.activate();  
}  
return OpenLayers.Control.prototype.activate.apply(  
this, arguments  
);  
},  
 
/**  
* Method: deactivate  
* Deactivates the control.  
*  
* Returns:  
* {Boolean} The control was effectively deactivated.  
*/  
deactivate: function () {  
return OpenLayers.Control.prototype.deactivate.apply(  
this, arguments  
);  
},  
 
/**  
* Method: getInfoForClick  
* Called on click  
*  
* Parameters:  
* evt - {<OpenLayers.Event>}  
*/  
getInfoForClick: function(evt) {  
this.events.triggerEvent("beforegetfeatureinfo", {xy: evt.xy});  
// Set the cursor to "wait" to tell the user we're working on their  
// click.  
OpenLayers.Element.addClass(this.map.viewPortDiv, "olCursorWait");  
this.request(evt.xy, {});  
},  
 
/**  
* Method: getInfoForHover  
* Pause callback for the hover handler  
*  
* Parameters:  
* evt - {Object}  
*/  
getInfoForHover: function(evt) {  
this.events.triggerEvent("beforegetfeatureinfo", {xy: evt.xy});  
this.request(evt.xy, {hover: true});  
},  
 
/**  
* Method: cancelHover  
* Cancel callback for the hover handler  
*/  
cancelHover: function() {  
if (this.hoverRequest) {  
this.hoverRequest.abort();  
this.hoverRequest = null;  
}  
},  
 
/**  
* Method: findLayers  
* Internal method to get the layers, independent of whether we are  
* inspecting the map or using a client-provided array  
*/  
findLayers: function() {  
 
var candidates = this.layers || this.map.layers;  
var layers = [];  
var layer, url;  
for(var i=0, len=candidates.length; i<len; ++i) {  
layer = candidates[i];  
if(layer instanceof OpenLayers.Layer.WMS &&  
(!this.queryVisible || layer.getVisibility())) {  
url = layer.url instanceof Array ? layer.url[0] : layer.url;  
// if the control was not configured with a url, set it  
// to the first layer url  
if(this.drillDown === false && !this.url) {  
this.url = url;  
}  
if(this.drillDown === true || this.urlMatches(url)) {  
layers.push(layer);  
}  
}  
}  
return layers;  
},  
 
/**  
* Method: urlMatches  
* Test to see if the provided url matches either the control <url> or one  
* of the <layerUrls>.  
*  
* Parameters:  
* url - {String} The url to test.  
*  
* Returns:  
* {Boolean} The provided url matches the control <url> or one of the  
* <layerUrls>.  
*/  
urlMatches: function(url) {  
var matches = OpenLayers.Util.isEquivalentUrl(this.url, url);  
if(!matches && this.layerUrls) {  
for(var i=0, len=this.layerUrls.length; i<len; ++i) {  
if(OpenLayers.Util.isEquivalentUrl(this.layerUrls[i], url)) {  
matches = true;  
break;  
}  
}  
}  
return matches;  
},  
 
/**  
* Method: buildWMSOptions  
* Build an object with the relevant WMS options for the GetFeatureInfo request  
*  
* Parameters:  
* url - {String} The url to be used for sending the request  
* layers - {Array(<OpenLayers.Layer.WMS)} An array of layers  
* clickPosition - {<OpenLayers.Pixel>} The position on the map where the mouse  
* event occurred.  
* format - {String} The format from the corresponding GetMap request  
*/  
buildWMSOptions: function(url, layers, clickPosition, format) {  
var layerNames = [], styleNames = [];  
for (var i = 0, len = layers.length; i < len; i++) {  
layerNames = layerNames.concat(layers[i].params.LAYERS);  
styleNames = styleNames.concat(this.getStyleNames(layers[i]));  
}  
var params = OpenLayers.Util.extend({  
service: "WMS",  
version: layers[0].params.VERSION,  
request: "GetFeatureInfo",  
layers: layerNames,  
query_layers: layerNames,  
styles: styleNames,  
bbox: this.map.getExtent().toBBOX(null,  
layers[0].reverseAxisOrder()),  
feature_count: this.maxFeatures,  
height: this.map.getSize().h,  
width: this.map.getSize().w,  
format: format,  
info_format: this.infoFormat  
}, (parseFloat(layers[0].params.VERSION) >= 1.3) ?  
{  
crs: this.map.getProjection(),  
i: clickPosition.x,  
j: clickPosition.y  
} :  
{  
srs: this.map.getProjection(),  
x: clickPosition.x,  
y: clickPosition.y  
}  
);  
OpenLayers.Util.applyDefaults(params, this.vendorParams);  
return {  
url: url,  
params: OpenLayers.Util.upperCaseObject(params),  
callback: function(request) {  
this.handleResponse(clickPosition, request);  
},  
scope: this  
};  
},  
 
/**  
* Method: getStyleNames  
* Gets the STYLES parameter for the layer. Make sure the STYLES parameter  
* matches the LAYERS parameter  
*  
* Parameters:  
* layer - {<OpenLayers.Layer.WMS>}  
*  
* Returns:  
* {Array(String)} The STYLES parameter  
*/  
getStyleNames: function(layer) {  
// in the event of a WMS layer bundling multiple layers but not  
// specifying styles,we need the same number of commas to specify  
// the default style for each of the layers. We can't just leave it  
// blank as we may be including other layers that do specify styles.  
var styleNames;  
if (layer.params.STYLES) {  
styleNames = layer.params.STYLES;  
} else {  
if (layer.params.LAYERS instanceof Array) {  
styleNames = new Array(layer.params.LAYERS.length);  
} else { // Assume it's a String  
styleNames = layer.params.LAYERS.replace(/[^,]/g, "");  
}  
}  
return styleNames;  
},  
 
/**  
* Method: request  
* Sends a GetFeatureInfo request to the WMS  
*  
* Parameters:  
* clickPosition - {<OpenLayers.Pixel>} The position on the map where the  
* mouse event occurred.  
* options - {Object} additional options for this method.  
*  
* Valid options:  
* - *hover* {Boolean} true if we do the request for the hover handler  
*/  
request: function(clickPosition, options) {  
var layers = this.findLayers();  
if(layers.length == 0) {  
this.events.triggerEvent("nogetfeatureinfo");  
// Reset the cursor.  
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");  
return;  
}  
 
options = options || {};  
if(this.drillDown === false) {  
var wmsOptions = this.buildWMSOptions(this.url, layers,  
clickPosition, layers[0].params.FORMAT);  
var request = OpenLayers.Request.GET(wmsOptions);  
 
if (options.hover === true) {  
this.hoverRequest = request;  
}  
} else {  
this._requestCount = 0;  
this._numRequests = 0;  
this.features = [];  
// group according to service url to combine requests  
var services = {}, url;  
for(var i=0, len=layers.length; i<len; i++) {  
var layer = layers[i];  
var service, found = false;  
url = layer.url instanceof Array ? layer.url[0] : layer.url;  
if(url in services) {  
services[url].push(layer);  
} else {  
this._numRequests++;  
services[url] = [layer];  
}  
}  
var layers;  
for (var url in services) {  
layers = services[url];  
var wmsOptions = this.buildWMSOptions(url, layers,  
clickPosition, layers[0].params.FORMAT);  
OpenLayers.Request.GET(wmsOptions);  
}  
}  
},  
 
/**  
* Method: triggerGetFeatureInfo  
* Trigger the getfeatureinfo event when all is done  
*  
* Parameters:  
* request - {XMLHttpRequest} The request object  
* xy - {<OpenLayers.Pixel>} The position on the map where the  
* mouse event occurred.  
* features - {Array(<OpenLayers.Feature.Vector>)}  
*/  
triggerGetFeatureInfo: function(request, xy, features) {  
this.events.triggerEvent("getfeatureinfo", {  
text: request.responseText,  
features: features,  
request: request,  
xy: xy  
});  
 
// Reset the cursor.  
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");  
},  
 
/**  
* Method: handleResponse  
* Handler for the GetFeatureInfo response.  
*  
* Parameters:  
* xy - {<OpenLayers.Pixel>} The position on the map where the  
* mouse event occurred.  
* request - {XMLHttpRequest} The request object.  
*/  
handleResponse: function(xy, request) {  
 
var doc = request.responseXML;  
if(!doc || !doc.documentElement) {  
doc = request.responseText;  
}  
var features = this.format.read(doc);  
if (this.drillDown === false) {  
this.triggerGetFeatureInfo(request, xy, features);  
} else {  
this._requestCount++;  
this._features = (this._features || []).concat(features);  
if (this._requestCount === this._numRequests) {  
this.triggerGetFeatureInfo(request, xy, this._features.concat());  
delete this._features;  
delete this._requestCount;  
delete this._numRequests;  
}  
}  
},  
 
CLASS_NAME: "OpenLayers.Control.WMSGetFeatureInfo"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Handler/Click.js  
* @requires OpenLayers/Handler/Hover.js  
* @requires OpenLayers/Request.js  
* @requires OpenLayers/Format/WMSGetFeatureInfo.js  
*/  
 
/**  
* Class: OpenLayers.Control.WMTSGetFeatureInfo  
* The WMTSGetFeatureInfo control uses a WMTS query to get information about a  
* point on the map. The information may be in a display-friendly format  
* such as HTML, or a machine-friendly format such as GML, depending on the  
* server's capabilities and the client's configuration. This control  
* handles click or hover events, attempts to parse the results using an  
* OpenLayers.Format, and fires a 'getfeatureinfo' event for each layer  
* queried.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.WMTSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* APIProperty: hover  
* {Boolean} Send GetFeatureInfo requests when mouse stops moving.  
* Default is false.  
*/  
hover: false,  
 
/**  
* Property: requestEncoding  
* {String} One of "KVP" or "REST". Only KVP encoding is supported at this  
* time.  
*/  
requestEncoding: "KVP",  
 
/**  
* APIProperty: drillDown  
* {Boolean} Drill down over all WMTS layers in the map. When  
* using drillDown mode, hover is not possible. A getfeatureinfo event  
* will be fired for each layer queried.  
*/  
drillDown: false,  
 
/**  
* APIProperty: maxFeatures  
* {Integer} Maximum number of features to return from a WMTS query. This  
* sets the feature_count parameter on WMTS GetFeatureInfo  
* requests.  
*/  
maxFeatures: 10,  
 
/** APIProperty: clickCallback  
* {String} The click callback to register in the  
* {<OpenLayers.Handler.Click>} object created when the hover  
* option is set to false. Default is "click".  
*/  
clickCallback: "click",  
 
/**  
* Property: layers  
* {Array(<OpenLayers.Layer.WMTS>)} The layers to query for feature info.  
* If omitted, all map WMTS layers will be considered.  
*/  
layers: null,  
 
/**  
* APIProperty: queryVisible  
* {Boolean} Filter out hidden layers when searching the map for layers to  
* query. Default is true.  
*/  
queryVisible: true,  
 
/**  
* Property: infoFormat  
* {String} The mimetype to request from the server  
*/  
infoFormat: 'text/html',  
 
/**  
* Property: vendorParams  
* {Object} Additional parameters that will be added to the request, for  
* WMTS implementations that support them. This could e.g. look like  
* (start code)  
* {  
* radius: 5  
* }  
* (end)  
*/  
vendorParams: {},  
 
/**  
* Property: format  
* {<OpenLayers.Format>} A format for parsing GetFeatureInfo responses.  
* Default is <OpenLayers.Format.WMSGetFeatureInfo>.  
*/  
format: null,  
 
/**  
* Property: formatOptions  
* {Object} Optional properties to set on the format (if one is not provided  
* in the <format> property.  
*/  
formatOptions: null,  
 
/**  
* APIProperty: handlerOptions  
* {Object} Additional options for the handlers used by this control, e.g.  
* (start code)  
* {  
* "click": {delay: 100},  
* "hover": {delay: 300}  
* }  
* (end)  
*/  
handlerOptions: null,  
 
/**  
* Property: handler  
* {Object} Reference to the <OpenLayers.Handler> for this control  
*/  
handler: null,  
 
/**  
* Property: hoverRequest  
* {<OpenLayers.Request>} contains the currently running hover request  
* (if any).  
*/  
hoverRequest: null,  
 
/**  
* Constant: EVENT_TYPES  
*  
* Supported event types (in addition to those from <OpenLayers.Control>):  
* beforegetfeatureinfo - Triggered before each request is sent.  
* The event object has an *xy* property with the position of the  
* mouse click or hover event that triggers the request and a *layer*  
* property referencing the layer about to be queried. If a listener  
* returns false, the request will not be issued.  
* getfeatureinfo - Triggered when a GetFeatureInfo response is received.  
* The event object has a *text* property with the body of the  
* response (String), a *features* property with an array of the  
* parsed features, an *xy* property with the position of the mouse  
* click or hover event that triggered the request, a *layer* property  
* referencing the layer queried and a *request* property with the  
* request itself. If drillDown is set to true, one event will be fired  
* for each layer queried.  
* exception - Triggered when a GetFeatureInfo request fails (with a  
* status other than 200) or whenparsing fails. Listeners will receive  
* an event with *request*, *xy*, and *layer* properties. In the case  
* of a parsing error, the event will also contain an *error* property.  
*/  
EVENT_TYPES: ["beforegetfeatureinfo", "getfeatureinfo", "exception"],  
 
/**  
* Property: pending  
* {Number} The number of pending requests.  
*/  
pending: 0,  
 
/**  
* Constructor: <OpenLayers.Control.WMTSGetFeatureInfo>  
*  
* Parameters:  
* options - {Object}  
*/  
initialize: function(options) {  
// concatenate events specific to vector with those from the base  
this.EVENT_TYPES =  
OpenLayers.Control.WMTSGetFeatureInfo.prototype.EVENT_TYPES.concat(  
OpenLayers.Control.prototype.EVENT_TYPES  
);  
 
options = options || {};  
options.handlerOptions = options.handlerOptions || {};  
 
OpenLayers.Control.prototype.initialize.apply(this, [options]);  
 
if (!this.format) {  
this.format = new OpenLayers.Format.WMSGetFeatureInfo(  
options.formatOptions  
);  
}  
 
if (this.drillDown === true) {  
this.hover = false;  
}  
 
if (this.hover) {  
this.handler = new OpenLayers.Handler.Hover(  
this, {  
move: this.cancelHover,  
pause: this.getInfoForHover  
},  
OpenLayers.Util.extend(  
this.handlerOptions.hover || {}, {delay: 250}  
)  
);  
} else {  
var callbacks = {};  
callbacks[this.clickCallback] = this.getInfoForClick;  
this.handler = new OpenLayers.Handler.Click(  
this, callbacks, this.handlerOptions.click || {}  
);  
}  
},  
 
/**  
* Method: activate  
* Activates the control.  
*  
* Returns:  
* {Boolean} The control was effectively activated.  
*/  
activate: function () {  
if (!this.active) {  
this.handler.activate();  
}  
return OpenLayers.Control.prototype.activate.apply(  
this, arguments  
);  
},  
 
/**  
* Method: deactivate  
* Deactivates the control.  
*  
* Returns:  
* {Boolean} The control was effectively deactivated.  
*/  
deactivate: function () {  
return OpenLayers.Control.prototype.deactivate.apply(  
this, arguments  
);  
},  
 
/**  
* Method: getInfoForClick  
* Called on click  
*  
* Parameters:  
* evt - {<OpenLayers.Event>}  
*/  
getInfoForClick: function(evt) {  
this.request(evt.xy, {});  
},  
 
/**  
* Method: getInfoForHover  
* Pause callback for the hover handler  
*  
* Parameters:  
* evt - {Object}  
*/  
getInfoForHover: function(evt) {  
this.request(evt.xy, {hover: true});  
},  
 
/**  
* Method: cancelHover  
* Cancel callback for the hover handler  
*/  
cancelHover: function() {  
if (this.hoverRequest) {  
--this.pending;  
if (this.pending <= 0) {  
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");  
this.pending = 0;  
}  
this.hoverRequest.abort();  
this.hoverRequest = null;  
}  
},  
 
/**  
* Method: findLayers  
* Internal method to get the layers, independent of whether we are  
* inspecting the map or using a client-provided array  
*/  
findLayers: function() {  
var candidates = this.layers || this.map.layers;  
var layers = [];  
var layer;  
for (var i=candidates.length-1; i>=0; --i) {  
layer = candidates[i];  
if (layer instanceof OpenLayers.Layer.WMTS &&  
layer.requestEncoding === this.requestEncoding &&  
(!this.queryVisible || layer.getVisibility())) {  
layers.push(layer);  
if (!this.drillDown || this.hover) {  
break;  
}  
}  
}  
return layers;  
},  
 
/**  
* Method: buildRequestOptions  
* Build an object with the relevant options for the GetFeatureInfo request.  
*  
* Parameters:  
* layer - {<OpenLayers.Layer.WMTS>} A WMTS layer.  
* xy - {<OpenLayers.Pixel>} The position on the map where the  
* mouse event occurred.  
*/  
buildRequestOptions: function(layer, xy) {  
var loc = this.map.getLonLatFromPixel(xy);  
var getTileUrl = layer.getURL(  
new OpenLayers.Bounds(loc.lon, loc.lat, loc.lon, loc.lat)  
);  
var params = OpenLayers.Util.getParameters(getTileUrl);  
var tileInfo = layer.getTileInfo(loc);  
OpenLayers.Util.extend(params, {  
service: "WMTS",  
version: layer.version,  
request: "GetFeatureInfo",  
infoFormat: this.infoFormat,  
i: tileInfo.i,  
j: tileInfo.j  
});  
OpenLayers.Util.applyDefaults(params, this.vendorParams);  
return {  
url: layer.url instanceof Array ? layer.url[0] : layer.url,  
params: OpenLayers.Util.upperCaseObject(params),  
callback: function(request) {  
this.handleResponse(xy, request, layer);  
},  
scope: this  
};  
},  
 
/**  
* Method: request  
* Sends a GetFeatureInfo request to the WMTS  
*  
* Parameters:  
* xy - {<OpenLayers.Pixel>} The position on the map where the mouse event  
* occurred.  
* options - {Object} additional options for this method.  
*  
* Valid options:  
* - *hover* {Boolean} true if we do the request for the hover handler  
*/  
request: function(xy, options) {  
options = options || {};  
var layers = this.findLayers();  
if (layers.length > 0) {  
var issue, layer;  
for (var i=0, len=layers.length; i<len; i++) {  
layer = layers[i];  
issue = this.events.triggerEvent("beforegetfeatureinfo", {  
xy: xy,  
layer: layer  
});  
if (issue !== false) {  
++this.pending;  
var requestOptions = this.buildRequestOptions(layer, xy);  
var request = OpenLayers.Request.GET(requestOptions);  
if (options.hover === true) {  
this.hoverRequest = request;  
}  
}  
}  
if (this.pending > 0) {  
OpenLayers.Element.addClass(this.map.viewPortDiv, "olCursorWait");  
}  
}  
},  
 
/**  
* Method: handleResponse  
* Handler for the GetFeatureInfo response.  
*  
* Parameters:  
* xy - {<OpenLayers.Pixel>} The position on the map where the mouse event  
* occurred.  
* request - {XMLHttpRequest} The request object.  
* layer - {<OpenLayers.Layer.WMTS>} The queried layer.  
*/  
handleResponse: function(xy, request, layer) {  
--this.pending;  
if (this.pending <= 0) {  
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");  
this.pending = 0;  
}  
if (request.status && (request.status < 200 || request.status >= 300)) {  
this.events.triggerEvent("exception", {  
xy: xy,  
request: request,  
layer: layer  
});  
} else {  
var doc = request.responseXML;  
if (!doc || !doc.documentElement) {  
doc = request.responseText;  
}  
var features, except;  
try {  
features = this.format.read(doc);  
} catch (error) {  
except = true;  
this.events.triggerEvent("exception", {  
xy: xy,  
request: request,  
error: error,  
layer: layer  
});  
}  
if (!except) {  
this.events.triggerEvent("getfeatureinfo", {  
text: request.responseText,  
features: features,  
request: request,  
xy: xy,  
layer: layer  
});  
}  
}  
},  
 
/**  
* Method: setMap  
* Set the map property for the control.  
*  
* Parameters:  
* map - {<OpenLayers.Map>}  
*/  
setMap: function(map) {  
this.handler.setMap(map);  
OpenLayers.Control.prototype.setMap.apply(this, arguments);  
},  
 
CLASS_NAME: "OpenLayers.Control.WMTSGetFeatureInfo"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
* @requires OpenLayers/Handler/Box.js  
*/  
 
/**  
* Class: OpenLayers.Control.ZoomBox  
* The ZoomBox control enables zooming directly to a given extent, by drawing  
* a box on the map. The box is drawn by holding down shift, whilst dragging  
* the mouse.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {  
/**  
* Property: type  
* {OpenLayers.Control.TYPE}  
*/  
type: OpenLayers.Control.TYPE_TOOL,  
 
/**  
* Property: out  
* {Boolean} Should the control be used for zooming out?  
*/  
out: false,  
 
/**  
* Property: alwaysZoom  
* {Boolean} Always zoom in/out, when box drawed  
*/  
alwaysZoom: false,  
 
/**  
* Method: draw  
*/  
draw: function() {  
this.handler = new OpenLayers.Handler.Box( this,  
{done: this.zoomBox}, {keyMask: this.keyMask} );  
},  
 
/**  
* Method: zoomBox  
*  
* Parameters:  
* position - {<OpenLayers.Bounds>} or {<OpenLayers.Pixel>}  
*/  
zoomBox: function (position) {  
if (position instanceof OpenLayers.Bounds) {  
var bounds;  
if (!this.out) {  
var minXY = this.map.getLonLatFromPixel(  
new OpenLayers.Pixel(position.left, position.bottom));  
var maxXY = this.map.getLonLatFromPixel(  
new OpenLayers.Pixel(position.right, position.top));  
bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat,  
maxXY.lon, maxXY.lat);  
} else {  
var pixWidth = Math.abs(position.right-position.left);  
var pixHeight = Math.abs(position.top-position.bottom);  
var zoomFactor = Math.min((this.map.size.h / pixHeight),  
(this.map.size.w / pixWidth));  
var extent = this.map.getExtent();  
var center = this.map.getLonLatFromPixel(  
position.getCenterPixel());  
var xmin = center.lon - (extent.getWidth()/2)*zoomFactor;  
var xmax = center.lon + (extent.getWidth()/2)*zoomFactor;  
var ymin = center.lat - (extent.getHeight()/2)*zoomFactor;  
var ymax = center.lat + (extent.getHeight()/2)*zoomFactor;  
bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax);  
}  
// always zoom in/out  
var lastZoom = this.map.getZoom();  
this.map.zoomToExtent(bounds);  
if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){  
this.map.zoomTo(lastZoom + (this.out ? -1 : 1));  
}  
} else { // it's a pixel  
if (!this.out) {  
this.map.setCenter(this.map.getLonLatFromPixel(position),  
this.map.getZoom() + 1);  
} else {  
this.map.setCenter(this.map.getLonLatFromPixel(position),  
this.map.getZoom() - 1);  
}  
}  
},  
 
CLASS_NAME: "OpenLayers.Control.ZoomBox"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.ZoomIn  
* The ZoomIn control is a button to increase the zoom level of a map.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.ZoomIn = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Property: type  
* {String} The type of <OpenLayers.Control> -- When added to a  
* <Control.Panel>, 'type' is used by the panel to determine how to  
* handle our events.  
*/  
type: OpenLayers.Control.TYPE_BUTTON,  
 
/**  
* Method: trigger  
*/  
trigger: function(){  
this.map.zoomIn();  
},  
 
CLASS_NAME: "OpenLayers.Control.ZoomIn"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.ZoomOut  
* The ZoomOut control is a button to decrease the zoom level of a map.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.ZoomOut = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Property: type  
* {String} The type of <OpenLayers.Control> -- When added to a  
* <Control.Panel>, 'type' is used by the panel to determine how to  
* handle our events.  
*/  
type: OpenLayers.Control.TYPE_BUTTON,  
 
/**  
* Method: trigger  
*/  
trigger: function(){  
this.map.zoomOut();  
},  
 
CLASS_NAME: "OpenLayers.Control.ZoomOut"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control/Panel.js  
* @requires OpenLayers/Control/ZoomIn.js  
* @requires OpenLayers/Control/ZoomOut.js  
* @requires OpenLayers/Control/ZoomToMaxExtent.js  
*/  
 
/**  
* Class: OpenLayers.Control.ZoomPanel  
* The ZoomPanel control is a compact collecton of 3 zoom controls: a  
* <OpenLayers.Control.ZoomIn>, a <OpenLayers.Control.ZoomToMaxExtent>, and a  
* <OpenLayers.Control.ZoomOut>. By default it is drawn in the upper left  
* corner of the map.  
*  
* Note:  
* If you wish to use this class with the default images and you want  
* it to look nice in ie6, you should add the following, conditionally  
* added css stylesheet to your HTML file:  
*  
* (code)  
* <!--[if lte IE 6]>  
* <link rel="stylesheet" href="../theme/default/ie6-style.css" type="text/css" />  
* <![endif]-->  
* (end)  
*  
* Inherits from:  
* - <OpenLayers.Control.Panel>  
*/  
OpenLayers.Control.ZoomPanel = OpenLayers.Class(OpenLayers.Control.Panel, {  
 
/**  
* Constructor: OpenLayers.Control.ZoomPanel  
* Add the three zooming controls.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be used  
* to extend the control.  
*/  
initialize: function(options) {  
OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);  
this.addControls([  
new OpenLayers.Control.ZoomIn(),  
new OpenLayers.Control.ZoomToMaxExtent(),  
new OpenLayers.Control.ZoomOut()  
]);  
},  
 
CLASS_NAME: "OpenLayers.Control.ZoomPanel"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Control.js  
*/  
 
/**  
* Class: OpenLayers.Control.ZoomToMaxExtent  
* The ZoomToMaxExtent control is a button that zooms out to the maximum  
* extent of the map. It is designed to be used with a  
* <OpenLayers.Control.Panel>.  
*  
* Inherits from:  
* - <OpenLayers.Control>  
*/  
OpenLayers.Control.ZoomToMaxExtent = OpenLayers.Class(OpenLayers.Control, {  
 
/**  
* Property: type  
* {String} The type of <OpenLayers.Control> -- When added to a  
* <Control.Panel>, 'type' is used by the panel to determine how to  
* handle our events.  
*/  
type: OpenLayers.Control.TYPE_BUTTON,  
 
/*  
* Method: trigger  
* Do the zoom.  
*/  
trigger: function() {  
if (this.map) {  
this.map.zoomToMaxExtent();  
}  
},  
 
CLASS_NAME: "OpenLayers.Control.ZoomToMaxExtent"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Util.js  
*/  
 
/**  
* Namespace: OpenLayers.Event  
* Utility functions for event handling.  
*/  
OpenLayers.Event = {  
 
/**  
* Property: observers  
* {Object} A hashtable cache of the event observers. Keyed by  
* element._eventCacheID  
*/  
observers: false,  
 
/**  
* Constant: KEY_BACKSPACE  
* {int}  
*/  
KEY_BACKSPACE: 8,  
 
/**  
* Constant: KEY_TAB  
* {int}  
*/  
KEY_TAB: 9,  
 
/**  
* Constant: KEY_RETURN  
* {int}  
*/  
KEY_RETURN: 13,  
 
/**  
* Constant: KEY_ESC  
* {int}  
*/  
KEY_ESC: 27,  
 
/**  
* Constant: KEY_LEFT  
* {int}  
*/  
KEY_LEFT: 37,  
 
/**  
* Constant: KEY_UP  
* {int}  
*/  
KEY_UP: 38,  
 
/**  
* Constant: KEY_RIGHT  
* {int}  
*/  
KEY_RIGHT: 39,  
 
/**  
* Constant: KEY_DOWN  
* {int}  
*/  
KEY_DOWN: 40,  
 
/**  
* Constant: KEY_DELETE  
* {int}  
*/  
KEY_DELETE: 46,  
 
 
/**  
* Method: element  
* Cross browser event element detection.  
*  
* Parameters:  
* event - {Event}  
*  
* Returns:  
* {DOMElement} The element that caused the event  
*/  
element: function(event) {  
return event.target || event.srcElement;  
},  
 
/**  
* Method: isLeftClick  
* Determine whether event was caused by a left click.  
*  
* Parameters:  
* event - {Event}  
*  
* Returns:  
* {Boolean}  
*/  
isLeftClick: function(event) {  
return (((event.which) && (event.which == 1)) ||  
((event.button) && (event.button == 1)));  
},  
 
/**  
* Method: isRightClick  
* Determine whether event was caused by a right mouse click.  
*  
* Parameters:  
* event - {Event}  
*  
* Returns:  
* {Boolean}  
*/  
isRightClick: function(event) {  
return (((event.which) && (event.which == 3)) ||  
((event.button) && (event.button == 2)));  
},  
 
/**  
* Method: stop  
* Stops an event from propagating.  
*  
* Parameters:  
* event - {Event}  
* allowDefault - {Boolean} If true, we stop the event chain but  
* still allow the default browser  
* behaviour (text selection, radio-button  
* clicking, etc)  
* Default false  
*/  
stop: function(event, allowDefault) {  
 
if (!allowDefault) {  
if (event.preventDefault) {  
event.preventDefault();  
} else {  
event.returnValue = false;  
}  
}  
 
if (event.stopPropagation) {  
event.stopPropagation();  
} else {  
event.cancelBubble = true;  
}  
},  
 
/**  
* Method: findElement  
*  
* Parameters:  
* event - {Event}  
* tagName - {String}  
*  
* Returns:  
* {DOMElement} The first node with the given tagName, starting from the  
* node the event was triggered on and traversing the DOM upwards  
*/  
findElement: function(event, tagName) {  
var element = OpenLayers.Event.element(event);  
while (element.parentNode && (!element.tagName ||  
(element.tagName.toUpperCase() != tagName.toUpperCase()))){  
element = element.parentNode;  
}  
return element;  
},  
 
/**  
* Method: observe  
*  
* Parameters:  
* elementParam - {DOMElement || String}  
* name - {String}  
* observer - {function}  
* useCapture - {Boolean}  
*/  
observe: function(elementParam, name, observer, useCapture) {  
var element = OpenLayers.Util.getElement(elementParam);  
useCapture = useCapture || false;  
 
if (name == 'keypress' &&  
(navigator.appVersion.match(/Konqueror|Safari|KHTML/)  
|| element.attachEvent)) {  
name = 'keydown';  
}  
 
//if observers cache has not yet been created, create it  
if (!this.observers) {  
this.observers = {};  
}  
 
//if not already assigned, make a new unique cache ID  
if (!element._eventCacheID) {  
var idPrefix = "eventCacheID_";  
if (element.id) {  
idPrefix = element.id + "_" + idPrefix;  
}  
element._eventCacheID = OpenLayers.Util.createUniqueID(idPrefix);  
}  
 
var cacheID = element._eventCacheID;  
 
//if there is not yet a hash entry for this element, add one  
if (!this.observers[cacheID]) {  
this.observers[cacheID] = [];  
}  
 
//add a new observer to this element's list  
this.observers[cacheID].push({  
'element': element,  
'name': name,  
'observer': observer,  
'useCapture': useCapture  
});  
 
//add the actual browser event listener  
if (element.addEventListener) {  
element.addEventListener(name, observer, useCapture);  
} else if (element.attachEvent) {  
element.attachEvent('on' + name, observer);  
}  
},  
 
/**  
* Method: stopObservingElement  
* Given the id of an element to stop observing, cycle through the  
* element's cached observers, calling stopObserving on each one,  
* skipping those entries which can no longer be removed.  
*  
* parameters:  
* elementParam - {DOMElement || String}  
*/  
stopObservingElement: function(elementParam) {  
var element = OpenLayers.Util.getElement(elementParam);  
var cacheID = element._eventCacheID;  
 
this._removeElementObservers(OpenLayers.Event.observers[cacheID]);  
},  
 
/**  
* Method: _removeElementObservers  
*  
* Parameters:  
* elementObservers - {Array(Object)} Array of (element, name,  
* observer, usecapture) objects,  
* taken directly from hashtable  
*/  
_removeElementObservers: function(elementObservers) {  
if (elementObservers) {  
for(var i = elementObservers.length-1; i >= 0; i--) {  
var entry = elementObservers[i];  
var args = new Array(entry.element,  
entry.name,  
entry.observer,  
entry.useCapture);  
var removed = OpenLayers.Event.stopObserving.apply(this, args);  
}  
}  
},  
 
/**  
* Method: stopObserving  
*  
* Parameters:  
* elementParam - {DOMElement || String}  
* name - {String}  
* observer - {function}  
* useCapture - {Boolean}  
*  
* Returns:  
* {Boolean} Whether or not the event observer was removed  
*/  
stopObserving: function(elementParam, name, observer, useCapture) {  
useCapture = useCapture || false;  
 
var element = OpenLayers.Util.getElement(elementParam);  
var cacheID = element._eventCacheID;  
 
if (name == 'keypress') {  
if ( navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||  
element.detachEvent) {  
name = 'keydown';  
}  
}  
 
// find element's entry in this.observers cache and remove it  
var foundEntry = false;  
var elementObservers = OpenLayers.Event.observers[cacheID];  
if (elementObservers) {  
 
// find the specific event type in the element's list  
var i=0;  
while(!foundEntry && i < elementObservers.length) {  
var cacheEntry = elementObservers[i];  
 
if ((cacheEntry.name == name) &&  
(cacheEntry.observer == observer) &&  
(cacheEntry.useCapture == useCapture)) {  
 
elementObservers.splice(i, 1);  
if (elementObservers.length == 0) {  
delete OpenLayers.Event.observers[cacheID];  
}  
foundEntry = true;  
break;  
}  
i++;  
}  
}  
 
//actually remove the event listener from browser  
if (foundEntry) {  
if (element.removeEventListener) {  
element.removeEventListener(name, observer, useCapture);  
} else if (element && element.detachEvent) {  
element.detachEvent('on' + name, observer);  
}  
}  
return foundEntry;  
},  
 
/**  
* Method: unloadCache  
* Cycle through all the element entries in the events cache and call  
* stopObservingElement on each.  
*/  
unloadCache: function() {  
// check for OpenLayers.Event before checking for observers, because  
// OpenLayers.Event may be undefined in IE if no map instance was  
// created  
if (OpenLayers.Event && OpenLayers.Event.observers) {  
for (var cacheID in OpenLayers.Event.observers) {  
var elementObservers = OpenLayers.Event.observers[cacheID];  
OpenLayers.Event._removeElementObservers.apply(this,  
[elementObservers]);  
}  
OpenLayers.Event.observers = false;  
}  
},  
 
CLASS_NAME: "OpenLayers.Event"  
};  
 
/* prevent memory leaks in IE */  
OpenLayers.Event.observe(window, 'unload', OpenLayers.Event.unloadCache, false);  
 
// FIXME: Remove this in 3.0. In 3.0, Event.stop will no longer be provided  
// by OpenLayers.  
if (window.Event) {  
OpenLayers.Util.applyDefaults(window.Event, OpenLayers.Event);  
} else {  
var Event = OpenLayers.Event;  
}  
 
/**  
* Class: OpenLayers.Events  
*/  
OpenLayers.Events = OpenLayers.Class({  
 
/**  
* Constant: BROWSER_EVENTS  
* {Array(String)} supported events  
*/  
BROWSER_EVENTS: [  
"mouseover", "mouseout",  
"mousedown", "mouseup", "mousemove",  
"click", "dblclick", "rightclick", "dblrightclick",  
"resize", "focus", "blur"  
],  
 
/**  
* Property: listeners  
* {Object} Hashtable of Array(Function): events listener functions  
*/  
listeners: null,  
 
/**  
* Property: object  
* {Object} the code object issuing application events  
*/  
object: null,  
 
/**  
* Property: element  
* {DOMElement} the DOM element receiving browser events  
*/  
element: null,  
 
/**  
* Property: eventTypes  
* {Array(String)} list of support application events  
*/  
eventTypes: null,  
 
/**  
* Property: eventHandler  
* {Function} bound event handler attached to elements  
*/  
eventHandler: null,  
 
/**  
* APIProperty: fallThrough  
* {Boolean}  
*/  
fallThrough: null,  
 
/**  
* APIProperty: includeXY  
* {Boolean} Should the .xy property automatically be created for browser  
* mouse events? In general, this should be false. If it is true, then  
* mouse events will automatically generate a '.xy' property on the  
* event object that is passed. (Prior to OpenLayers 2.7, this was true  
* by default.) Otherwise, you can call the getMousePosition on the  
* relevant events handler on the object available via the 'evt.object'  
* property of the evt object. So, for most events, you can call:  
* function named(evt) {  
* this.xy = this.object.events.getMousePosition(evt)  
* }  
*  
* This option typically defaults to false for performance reasons:  
* when creating an events object whose primary purpose is to manage  
* relatively positioned mouse events within a div, it may make  
* sense to set it to true.  
*  
* This option is also used to control whether the events object caches  
* offsets. If this is false, it will not: the reason for this is that  
* it is only expected to be called many times if the includeXY property  
* is set to true. If you set this to true, you are expected to clear  
* the offset cache manually (using this.clearMouseCache()) if:  
* the border of the element changes  
* the location of the element in the page changes  
*/  
includeXY: false,  
 
/**  
* Method: clearMouseListener  
* A version of <clearMouseCache> that is bound to this instance so that  
* it can be used with <OpenLayers.Event.observe> and  
* <OpenLayers.Event.stopObserving>.  
*/  
clearMouseListener: null,  
 
/**  
* Constructor: OpenLayers.Events  
* Construct an OpenLayers.Events object.  
*  
* Parameters:  
* object - {Object} The js object to which this Events object is being  
* added element - {DOMElement} A dom element to respond to browser events  
* eventTypes - {Array(String)} Array of custom application events  
* fallThrough - {Boolean} Allow events to fall through after these have  
* been handled?  
* options - {Object} Options for the events object.  
*/  
initialize: function (object, element, eventTypes, fallThrough, options) {  
OpenLayers.Util.extend(this, options);  
this.object = object;  
this.fallThrough = fallThrough;  
this.listeners = {};  
 
// keep a bound copy of handleBrowserEvent() so that we can  
// pass the same function to both Event.observe() and .stopObserving()  
this.eventHandler = OpenLayers.Function.bindAsEventListener(  
this.handleBrowserEvent, this  
);  
 
// to be used with observe and stopObserving  
this.clearMouseListener = OpenLayers.Function.bind(  
this.clearMouseCache, this  
);  
 
// if eventTypes is specified, create a listeners list for each  
// custom application event.  
this.eventTypes = [];  
if (eventTypes != null) {  
for (var i=0, len=eventTypes.length; i<len; i++) {  
this.addEventType(eventTypes[i]);  
}  
}  
 
// if a dom element is specified, add a listeners list  
// for browser events on the element and register them  
if (element != null) {  
this.attachToElement(element);  
}  
},  
 
/**  
* APIMethod: destroy  
*/  
destroy: function () {  
if (this.element) {  
OpenLayers.Event.stopObservingElement(this.element);  
if(this.element.hasScrollEvent) {  
OpenLayers.Event.stopObserving(  
window, "scroll", this.clearMouseListener  
);  
}  
}  
this.element = null;  
 
this.listeners = null;  
this.object = null;  
this.eventTypes = null;  
this.fallThrough = null;  
this.eventHandler = null;  
},  
 
/**  
* APIMethod: addEventType  
* Add a new event type to this events object.  
* If the event type has already been added, do nothing.  
*  
* Parameters:  
* eventName - {String}  
*/  
addEventType: function(eventName) {  
if (!this.listeners[eventName]) {  
this.eventTypes.push(eventName);  
this.listeners[eventName] = [];  
}  
},  
 
/**  
* Method: attachToElement  
*  
* Parameters:  
* element - {HTMLDOMElement} a DOM element to attach browser events to  
*/  
attachToElement: function (element) {  
if(this.element) {  
OpenLayers.Event.stopObservingElement(this.element);  
}  
this.element = element;  
for (var i=0, len=this.BROWSER_EVENTS.length; i<len; i++) {  
var eventType = this.BROWSER_EVENTS[i];  
 
// every browser event has a corresponding application event  
// (whether it's listened for or not).  
this.addEventType(eventType);  
 
// use Prototype to register the event cross-browser  
OpenLayers.Event.observe(element, eventType, this.eventHandler);  
}  
// disable dragstart in IE so that mousedown/move/up works normally  
OpenLayers.Event.observe(element, "dragstart", OpenLayers.Event.stop);  
},  
 
/**  
* APIMethod: on  
* Convenience method for registering listeners with a common scope.  
* Internally, this method calls <register> as shown in the examples  
* below.  
*  
* Example use:  
* (code)  
* // register a single listener for the "loadstart" event  
* events.on({"loadstart", loadStartListener});  
*  
* // this is equivalent to the following  
* events.register("loadstart", undefined, loadStartListener);  
*  
* // register multiple listeners to be called with the same `this` object  
* events.on({  
* "loadstart": loadStartListener,  
* "loadend": loadEndListener,  
* scope: object  
* });  
*  
* // this is equivalent to the following  
* events.register("loadstart", object, loadStartListener);  
* events.register("loadstart", object, loadEndListener);  
* (end)  
*/  
on: function(object) {  
for(var type in object) {  
if(type != "scope") {  
this.register(type, object.scope, object[type]);  
}  
}  
},  
 
/**  
* APIMethod: register  
* Register an event on the events object.  
*  
* When the event is triggered, the 'func' function will be called, in the  
* context of 'obj'. Imagine we were to register an event, specifying an  
* OpenLayers.Bounds Object as 'obj'. When the event is triggered, the  
* context in the callback function will be our Bounds object. This means  
* that within our callback function, we can access the properties and  
* methods of the Bounds object through the "this" variable. So our  
* callback could execute something like:  
* : leftStr = "Left: " + this.left;  
*  
* or  
*  
* : centerStr = "Center: " + this.getCenterLonLat();  
*  
* Parameters:  
* type - {String} Name of the event to register  
* obj - {Object} The object to bind the context to for the callback#.  
* If no object is specified, default is the Events's  
* 'object' property.  
* func - {Function} The callback function. If no callback is  
* specified, this function does nothing.  
*  
*  
*/  
register: function (type, obj, func) {  
 
if ( (func != null) &&  
(OpenLayers.Util.indexOf(this.eventTypes, type) != -1) ) {  
 
if (obj == null) {  
obj = this.object;  
}  
var listeners = this.listeners[type];  
listeners.push( {obj: obj, func: func} );  
}  
},  
 
/**  
* APIMethod: registerPriority  
* Same as register() but adds the new listener to the *front* of the  
* events queue instead of to the end.  
*  
* TODO: get rid of this in 3.0 - Decide whether listeners should be  
* called in the order they were registered or in reverse order.  
*  
*  
* Parameters:  
* type - {String} Name of the event to register  
* obj - {Object} The object to bind the context to for the callback#.  
* If no object is specified, default is the Events's  
* 'object' property.  
* func - {Function} The callback function. If no callback is  
* specified, this function does nothing.  
*/  
registerPriority: function (type, obj, func) {  
 
if (func != null) {  
if (obj == null) {  
obj = this.object;  
}  
var listeners = this.listeners[type];  
if (listeners != null) {  
listeners.unshift( {obj: obj, func: func} );  
}  
}  
},  
 
/**  
* APIMethod: un  
* Convenience method for unregistering listeners with a common scope.  
* Internally, this method calls <unregister> as shown in the examples  
* below.  
*  
* Example use:  
* (code)  
* // unregister a single listener for the "loadstart" event  
* events.un({"loadstart", loadStartListener});  
*  
* // this is equivalent to the following  
* events.unregister("loadstart", undefined, loadStartListener);  
*  
* // unregister multiple listeners with the same `this` object  
* events.un({  
* "loadstart": loadStartListener,  
* "loadend": loadEndListener,  
* scope: object  
* });  
*  
* // this is equivalent to the following  
* events.unregister("loadstart", object, loadStartListener);  
* events.unregister("loadstart", object, loadEndListener);  
* (end)  
*/  
un: function(object) {  
for(var type in object) {  
if(type != "scope") {  
this.unregister(type, object.scope, object[type]);  
}  
}  
},  
 
/**  
* APIMethod: unregister  
*  
* Parameters:  
* type - {String}  
* obj - {Object} If none specified, defaults to this.object  
* func - {Function}  
*/  
unregister: function (type, obj, func) {  
if (obj == null) {  
obj = this.object;  
}  
var listeners = this.listeners[type];  
if (listeners != null) {  
for (var i=0, len=listeners.length; i<len; i++) {  
if (listeners[i].obj == obj && listeners[i].func == func) {  
listeners.splice(i, 1);  
break;  
}  
}  
}  
},  
 
/**  
* Method: remove  
* Remove all listeners for a given event type. If type is not registered,  
* does nothing.  
*  
* Parameters:  
* type - {String}  
*/  
remove: function(type) {  
if (this.listeners[type] != null) {  
this.listeners[type] = [];  
}  
},  
 
/**  
* APIMethod: triggerEvent  
* Trigger a specified registered event.  
*  
* Parameters:  
* type - {String}  
* evt - {Event}  
*  
* Returns:  
* {Boolean} The last listener return. If a listener returns false, the  
* chain of listeners will stop getting called.  
*/  
triggerEvent: function (type, evt) {  
var listeners = this.listeners[type];  
 
// fast path  
if(!listeners || listeners.length == 0) {  
return;  
}  
 
// prep evt object with object & div references  
if (evt == null) {  
evt = {};  
}  
evt.object = this.object;  
evt.element = this.element;  
if(!evt.type) {  
evt.type = type;  
}  
 
// execute all callbacks registered for specified type  
// get a clone of the listeners array to  
// allow for splicing during callbacks  
var listeners = listeners.slice(), continueChain;  
for (var i=0, len=listeners.length; i<len; i++) {  
var callback = listeners[i];  
// bind the context to callback.obj  
continueChain = callback.func.apply(callback.obj, [evt]);  
 
if ((continueChain != undefined) && (continueChain == false)) {  
// if callback returns false, execute no more callbacks.  
break;  
}  
}  
// don't fall through to other DOM elements  
if (!this.fallThrough) {  
OpenLayers.Event.stop(evt, true);  
}  
return continueChain;  
},  
 
/**  
* Method: handleBrowserEvent  
* Basically just a wrapper to the triggerEvent() function, but takes  
* care to set a property 'xy' on the event with the current mouse  
* position.  
*  
* Parameters:  
* evt - {Event}  
*/  
handleBrowserEvent: function (evt) {  
if (this.includeXY) {  
evt.xy = this.getMousePosition(evt);  
}  
this.triggerEvent(evt.type, evt);  
},  
 
/**  
* APIMethod: clearMouseCache  
* Clear cached data about the mouse position. This should be called any  
* time the element that events are registered on changes position  
* within the page.  
*/  
clearMouseCache: function() {  
this.element.scrolls = null;  
this.element.lefttop = null;  
this.element.offsets = null;  
},  
 
/**  
* Method: getMousePosition  
*  
* Parameters:  
* evt - {Event}  
*  
* Returns:  
* {<OpenLayers.Pixel>} The current xy coordinate of the mouse, adjusted  
* for offsets  
*/  
getMousePosition: function (evt) {  
if (!this.includeXY) {  
this.clearMouseCache();  
} else if (!this.element.hasScrollEvent) {  
OpenLayers.Event.observe(window, "scroll", this.clearMouseListener);  
this.element.hasScrollEvent = true;  
}  
 
if (!this.element.scrolls) {  
this.element.scrolls = [  
(document.documentElement.scrollLeft  
|| document.body.scrollLeft),  
(document.documentElement.scrollTop  
|| document.body.scrollTop)  
];  
}  
 
if (!this.element.lefttop) {  
this.element.lefttop = [  
(document.documentElement.clientLeft || 0),  
(document.documentElement.clientTop || 0)  
];  
}  
 
if (!this.element.offsets) {  
this.element.offsets = OpenLayers.Util.pagePosition(this.element);  
this.element.offsets[0] += this.element.scrolls[0];  
this.element.offsets[1] += this.element.scrolls[1];  
}  
return new OpenLayers.Pixel(  
(evt.clientX + this.element.scrolls[0]) - this.element.offsets[0]  
- this.element.lefttop[0],  
(evt.clientY + this.element.scrolls[1]) - this.element.offsets[1]  
- this.element.lefttop[1]  
);  
},  
 
CLASS_NAME: "OpenLayers.Events"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Util.js  
* @requires OpenLayers/Marker.js  
* @requires OpenLayers/Popup/AnchoredBubble.js  
*/  
 
/**  
* Class: OpenLayers.Feature  
* Features are combinations of geography and attributes. The OpenLayers.Feature  
* class specifically combines a marker and a lonlat.  
*/  
OpenLayers.Feature = OpenLayers.Class({  
 
/**  
* Property: layer  
* {<OpenLayers.Layer>}  
*/  
layer: null,  
 
/**  
* Property: id  
* {String}  
*/  
id: null,  
 
/**  
* Property: lonlat  
* {<OpenLayers.LonLat>}  
*/  
lonlat: null,  
 
/**  
* Property: data  
* {Object}  
*/  
data: null,  
 
/**  
* Property: marker  
* {<OpenLayers.Marker>}  
*/  
marker: null,  
 
/**  
* APIProperty: popupClass  
* {<OpenLayers.Class>} The class which will be used to instantiate  
* a new Popup. Default is <OpenLayers.Popup.AnchoredBubble>.  
*/  
popupClass: OpenLayers.Popup.AnchoredBubble,  
 
/**  
* Property: popup  
* {<OpenLayers.Popup>}  
*/  
popup: null,  
 
/**  
* Constructor: OpenLayers.Feature  
* Constructor for features.  
*  
* Parameters:  
* layer - {<OpenLayers.Layer>}  
* lonlat - {<OpenLayers.LonLat>}  
* data - {Object}  
*  
* Returns:  
* {<OpenLayers.Feature>}  
*/  
initialize: function(layer, lonlat, data) {  
this.layer = layer;  
this.lonlat = lonlat;  
this.data = (data != null) ? data : {};  
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");  
},  
 
/**  
* Method: destroy  
* nullify references to prevent circular references and memory leaks  
*/  
destroy: function() {  
 
//remove the popup from the map  
if ((this.layer != null) && (this.layer.map != null)) {  
if (this.popup != null) {  
this.layer.map.removePopup(this.popup);  
}  
}  
// remove the marker from the layer  
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;  
}  
},  
 
/**  
* Method: onScreen  
*  
* Returns:  
* {Boolean} Whether or not the feature is currently visible on screen  
* (based on its 'lonlat' property)  
*/  
onScreen:function() {  
 
var onScreen = false;  
if ((this.layer != null) && (this.layer.map != null)) {  
var screenBounds = this.layer.map.getExtent();  
onScreen = screenBounds.containsLonLat(this.lonlat);  
}  
return onScreen;  
},  
 
 
/**  
* Method: createMarker  
* Based on the data associated with the Feature, create and return a marker object.  
*  
* Returns:  
* {<OpenLayers.Marker>} A Marker Object created from the 'lonlat' and 'icon' properties  
* set in this.data. If no 'lonlat' is set, returns null. If no  
* 'icon' is set, OpenLayers.Marker() will load the default image.  
*  
* Note - this.marker is set to return value  
*  
*/  
createMarker: function() {  
 
if (this.lonlat != null) {  
this.marker = new OpenLayers.Marker(this.lonlat, this.data.icon);  
}  
return this.marker;  
},  
 
/**  
* Method: destroyMarker  
* Destroys marker.  
* If user overrides the createMarker() function, s/he should be able  
* to also specify an alternative function for destroying it  
*/  
destroyMarker: function() {  
this.marker.destroy();  
},  
 
/**  
* Method: createPopup  
* Creates a popup object created from the 'lonlat', 'popupSize',  
* and 'popupContentHTML' properties set in this.data. It uses  
* this.marker.icon as default anchor.  
*  
* If no 'lonlat' is set, returns null.  
* If no this.marker has been created, no anchor is sent.  
*  
* Note - the returned popup object is 'owned' by the feature, so you  
* cannot use the popup's destroy method to discard the popup.  
* Instead, you must use the feature's destroyPopup  
*  
* Note - this.popup is set to return value  
*  
* Parameters:  
* closeBox - {Boolean} create popup with closebox or not  
*  
* Returns:  
* {<OpenLayers.Popup>} Returns the created popup, which is also set  
* as 'popup' property of this feature. Will be of whatever type  
* specified by this feature's 'popupClass' property, but must be  
* of type <OpenLayers.Popup>.  
*  
*/  
createPopup: function(closeBox) {  
 
if (this.lonlat != null) {  
 
var id = this.id + "_popup";  
var anchor = (this.marker) ? this.marker.icon : null;  
 
if (!this.popup) {  
this.popup = new this.popupClass(id,  
this.lonlat,  
this.data.popupSize,  
this.data.popupContentHTML,  
anchor,  
closeBox);  
}  
if (this.data.overflow != null) {  
this.popup.contentDiv.style.overflow = this.data.overflow;  
}  
 
this.popup.feature = this;  
}  
return this.popup;  
},  
 
 
/**  
* Method: destroyPopup  
* Destroys the popup created via createPopup.  
*  
* As with the marker, if user overrides the createPopup() function, s/he  
* should also be able to override the destruction  
*/  
destroyPopup: function() {  
if (this.popup) {  
this.popup.feature = null;  
this.popup.destroy();  
this.popup = null;  
}  
},  
 
CLASS_NAME: "OpenLayers.Feature"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
// TRASH THIS  
OpenLayers.State = {  
/** states */  
UNKNOWN: 'Unknown',  
INSERT: 'Insert',  
UPDATE: 'Update',  
DELETE: 'Delete'  
};  
 
/**  
* @requires OpenLayers/Feature.js  
* @requires OpenLayers/Util.js  
*/  
 
/**  
* Class: OpenLayers.Feature.Vector  
* Vector features use the OpenLayers.Geometry classes as geometry description.  
* They have an 'attributes' property, which is the data object, and a 'style'  
* property, the default values of which are defined in the  
* <OpenLayers.Feature.Vector.style> objects.  
*  
* Inherits from:  
* - <OpenLayers.Feature>  
*/  
OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {  
 
/**  
* Property: fid  
* {String}  
*/  
fid: null,  
 
/**  
* APIProperty: geometry  
* {<OpenLayers.Geometry>}  
*/  
geometry: null,  
 
/**  
* APIProperty: attributes  
* {Object} This object holds arbitrary, serializable properties that  
* describe the feature.  
*/  
attributes: null,  
 
/**  
* Property: bounds  
* {<OpenLayers.Bounds>} The box bounding that feature's geometry, that  
* property can be set by an <OpenLayers.Format> object when  
* deserializing the feature, so in most cases it represents an  
* information set by the server.  
*/  
bounds: null,  
 
/**  
* Property: state  
* {String}  
*/  
state: null,  
 
/**  
* APIProperty: style  
* {Object}  
*/  
style: null,  
 
/**  
* APIProperty: url  
* {String} If this property is set it will be taken into account by  
* {<OpenLayers.HTTP>} when upadting or deleting the feature.  
*/  
url: null,  
 
/**  
* Property: renderIntent  
* {String} rendering intent currently being used  
*/  
renderIntent: "default",  
 
/**  
* Constructor: OpenLayers.Feature.Vector  
* Create a vector feature.  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry>} The geometry that this feature  
* represents.  
* attributes - {Object} An optional object that will be mapped to the  
* <attributes> property.  
* style - {Object} An optional style object.  
*/  
initialize: function(geometry, attributes, style) {  
OpenLayers.Feature.prototype.initialize.apply(this,  
[null, null, attributes]);  
this.lonlat = null;  
this.geometry = geometry ? geometry : null;  
this.state = null;  
this.attributes = {};  
if (attributes) {  
this.attributes = OpenLayers.Util.extend(this.attributes,  
attributes);  
}  
this.style = style ? style : null;  
},  
 
/**  
* Method: destroy  
* nullify references to prevent circular references and memory leaks  
*/  
destroy: function() {  
if (this.layer) {  
this.layer.removeFeatures(this);  
this.layer = null;  
}  
 
this.geometry = null;  
OpenLayers.Feature.prototype.destroy.apply(this, arguments);  
},  
 
/**  
* Method: clone  
* Create a clone of this vector feature. Does not set any non-standard  
* properties.  
*  
* Returns:  
* {<OpenLayers.Feature.Vector>} An exact clone of this vector feature.  
*/  
clone: function () {  
return new OpenLayers.Feature.Vector(  
this.geometry ? this.geometry.clone() : null,  
this.attributes,  
this.style);  
},  
 
/**  
* Method: onScreen  
* Determine whether the feature is within the map viewport. This method  
* tests for an intersection between the geometry and the viewport  
* bounds. If a more effecient but less precise geometry bounds  
* intersection is desired, call the method with the boundsOnly  
* parameter true.  
*  
* Parameters:  
* boundsOnly - {Boolean} Only test whether a feature's bounds intersects  
* the viewport bounds. Default is false. If false, the feature's  
* geometry must intersect the viewport for onScreen to return true.  
*  
* Returns:  
* {Boolean} The feature is currently visible on screen (optionally  
* based on its bounds if boundsOnly is true).  
*/  
onScreen:function(boundsOnly) {  
var onScreen = false;  
if(this.layer && this.layer.map) {  
var screenBounds = this.layer.map.getExtent();  
if(boundsOnly) {  
var featureBounds = this.geometry.getBounds();  
onScreen = screenBounds.intersectsBounds(featureBounds);  
} else {  
var screenPoly = screenBounds.toGeometry();  
onScreen = screenPoly.intersects(this.geometry);  
}  
}  
return onScreen;  
},  
 
/**  
* Method: getVisibility  
* Determine whether the feature is displayed or not. It may not displayed  
* because:  
* - its style display property is set to 'none',  
* - it doesn't belong to any layer,  
* - the styleMap creates a symbolizer with display property set to 'none'  
* for it,  
* - the layer which it belongs to is not visible.  
*  
* Returns:  
* {Boolean} The feature is currently displayed.  
*/  
getVisibility: function() {  
return !(this.style && this.style.display == 'none' ||  
!this.layer ||  
this.layer && this.layer.styleMap &&  
this.layer.styleMap.createSymbolizer(this, this.renderIntent).display == 'none' ||  
this.layer && !this.layer.getVisibility());  
},  
 
/**  
* Method: createMarker  
* HACK - we need to decide if all vector features should be able to  
* create markers  
*  
* Returns:  
* {<OpenLayers.Marker>} For now just returns null  
*/  
createMarker: function() {  
return null;  
},  
 
/**  
* Method: destroyMarker  
* HACK - we need to decide if all vector features should be able to  
* delete markers  
*  
* If user overrides the createMarker() function, s/he should be able  
* to also specify an alternative function for destroying it  
*/  
destroyMarker: function() {  
// pass  
},  
 
/**  
* Method: createPopup  
* HACK - we need to decide if all vector features should be able to  
* create popups  
*  
* Returns:  
* {<OpenLayers.Popup>} For now just returns null  
*/  
createPopup: function() {  
return null;  
},  
 
/**  
* Method: atPoint  
* Determins whether the feature intersects with the specified location.  
*  
* Parameters:  
* lonlat - {<OpenLayers.LonLat>}  
* toleranceLon - {float} Optional tolerance in Geometric Coords  
* toleranceLat - {float} Optional tolerance in Geographic Coords  
*  
* Returns:  
* {Boolean} Whether or not the feature is at the specified location  
*/  
atPoint: function(lonlat, toleranceLon, toleranceLat) {  
var atPoint = false;  
if(this.geometry) {  
atPoint = this.geometry.atPoint(lonlat, toleranceLon,  
toleranceLat);  
}  
return atPoint;  
},  
 
/**  
* Method: destroyPopup  
* HACK - we need to decide if all vector features should be able to  
* delete popups  
*/  
destroyPopup: function() {  
// pass  
},  
 
/**  
* Method: move  
* Moves the feature and redraws it at its new location  
*  
* Parameters:  
* state - {OpenLayers.LonLat or OpenLayers.Pixel} the  
* location to which to move the feature.  
*/  
move: function(location) {  
 
if(!this.layer || !this.geometry.move){  
//do nothing if no layer or immoveable geometry  
return;  
}  
 
var pixel;  
if (location.CLASS_NAME == "OpenLayers.LonLat") {  
pixel = this.layer.getViewPortPxFromLonLat(location);  
} else {  
pixel = location;  
}  
 
var lastPixel = this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());  
var res = this.layer.map.getResolution();  
this.geometry.move(res * (pixel.x - lastPixel.x),  
res * (lastPixel.y - pixel.y));  
this.layer.drawFeature(this);  
return lastPixel;  
},  
 
/**  
* Method: toState  
* Sets the new state  
*  
* Parameters:  
* state - {String}  
*/  
toState: function(state) {  
if (state == OpenLayers.State.UPDATE) {  
switch (this.state) {  
case OpenLayers.State.UNKNOWN:  
case OpenLayers.State.DELETE:  
this.state = state;  
break;  
case OpenLayers.State.UPDATE:  
case OpenLayers.State.INSERT:  
break;  
}  
} else if (state == OpenLayers.State.INSERT) {  
switch (this.state) {  
case OpenLayers.State.UNKNOWN:  
break;  
default:  
this.state = state;  
break;  
}  
} else if (state == OpenLayers.State.DELETE) {  
switch (this.state) {  
case OpenLayers.State.INSERT:  
// the feature should be destroyed  
break;  
case OpenLayers.State.DELETE:  
break;  
case OpenLayers.State.UNKNOWN:  
case OpenLayers.State.UPDATE:  
this.state = state;  
break;  
}  
} else if (state == OpenLayers.State.UNKNOWN) {  
this.state = state;  
}  
},  
 
CLASS_NAME: "OpenLayers.Feature.Vector"  
});  
 
 
/**  
* Constant: OpenLayers.Feature.Vector.style  
* OpenLayers features can have a number of style attributes. The 'default'  
* style will typically be used if no other style is specified. These  
* styles correspond for the most part, to the styling properties defined  
* by the SVG standard.  
* Information on fill properties: http://www.w3.org/TR/SVG/painting.html#FillProperties  
* Information on stroke properties: http://www.w3.org/TR/SVG/painting.html#StrokeProperties  
*  
* Symbolizer properties:  
* fill - {Boolean} Set to false if no fill is desired.  
* fillColor - {String} Hex fill color. Default is "#ee9900".  
* fillOpacity - {Number} Fill opacity (0-1). Default is 0.4  
* stroke - {Boolean} Set to false if no stroke is desired.  
* strokeColor - {String} Hex stroke color. Default is "#ee9900".  
* strokeOpacity - {Number} Stroke opacity (0-1). Default is 1.  
* strokeWidth - {Number} Pixel stroke width. Default is 1.  
* strokeLinecap - {String} Stroke cap type. Default is "round". [butt | round | square]  
* strokeDashstyle - {String} Stroke dash style. Default is "solid". [dot | dash | dashdot | longdash | longdashdot | solid]  
* graphic - {Boolean} Set to false if no graphic is desired.  
* pointRadius - {Number} Pixel point radius. Default is 6.  
* pointerEvents - {String} Default is "visiblePainted".  
* cursor - {String} Default is "".  
* externalGraphic - {String} Url to an external graphic that will be used for rendering points.  
* graphicWidth - {Number} Pixel width for sizing an external graphic.  
* graphicHeight - {Number} Pixel height for sizing an external graphic.  
* graphicOpacity - {Number} Opacity (0-1) for an external graphic.  
* graphicXOffset - {Number} Pixel offset along the positive x axis for displacing an external graphic.  
* graphicYOffset - {Number} Pixel offset along the positive y axis for displacing an external graphic.  
* rotation - {Number} For point symbolizers, this is the rotation of a graphic in the clockwise direction about its center point (or any point off center as specified by graphicXOffset and graphicYOffset).  
* graphicZIndex - {Number} The integer z-index value to use in rendering.  
* graphicName - {String} Named graphic to use when rendering points. Supported values include "circle" (default),  
* "square", "star", "x", "cross", "triangle".  
* graphicTitle - {String} Tooltip for an external graphic. Only supported in Firefox and Internet Explorer.  
* backgroundGraphic - {String} Url to a graphic to be used as the background under an externalGraphic.  
* backgroundGraphicZIndex - {Number} The integer z-index value to use in rendering the background graphic.  
* backgroundXOffset - {Number} The x offset (in pixels) for the background graphic.  
* backgroundYOffset - {Number} The y offset (in pixels) for the background graphic.  
* backgroundHeight - {Number} The height of the background graphic. If not provided, the graphicHeight will be used.  
* backgroundWidth - {Number} The width of the background width. If not provided, the graphicWidth will be used.  
* label - {String} The text for an optional label. For browsers that use the canvas renderer, this requires either  
* fillText or mozDrawText to be available.  
* labelAlign - {String} Label alignment. This specifies the insertion point relative to the text. It is a string  
* composed of two characters. The first character is for the horizontal alignment, the second for the vertical  
* alignment. Valid values for horizontal alignment: "l"=left, "c"=center, "r"=right. Valid values for vertical  
* alignment: "t"=top, "m"=middle, "b"=bottom. Example values: "lt", "cm", "rb". The canvas renderer does not  
* support vertical alignment, it will always use "b".  
* labelXOffset - {Number} Pixel offset along the positive x axis for displacing the label.  
* labelYOffset - {Number} Pixel offset along the positive y axis for displacing the label.  
* labelSelect - {Boolean} If set to true, labels will be selectable using SelectFeature or similar controls.  
* Default is false.  
* fontColor - {String} The font color for the label, to be provided like CSS.  
* fontOpacity - {Number} Opacity (0-1) for the label  
* fontFamily - {String} The font family for the label, to be provided like in CSS.  
* fontSize - {String} The font size for the label, to be provided like in CSS.  
* fontWeight - {String} The font weight for the label, to be provided like in CSS.  
* display - {String} Symbolizers will have no effect if display is set to "none". All other values have no effect.  
*/  
OpenLayers.Feature.Vector.style = {  
'default': {  
fillColor: "#ee9900",  
fillOpacity: 0.4,  
hoverFillColor: "white",  
hoverFillOpacity: 0.8,  
strokeColor: "#ee9900",  
strokeOpacity: 1,  
strokeWidth: 1,  
strokeLinecap: "round",  
strokeDashstyle: "solid",  
hoverStrokeColor: "red",  
hoverStrokeOpacity: 1,  
hoverStrokeWidth: 0.2,  
pointRadius: 6,  
hoverPointRadius: 1,  
hoverPointUnit: "%",  
pointerEvents: "visiblePainted",  
cursor: "inherit"  
},  
'select': {  
fillColor: "blue",  
fillOpacity: 0.4,  
hoverFillColor: "white",  
hoverFillOpacity: 0.8,  
strokeColor: "blue",  
strokeOpacity: 1,  
strokeWidth: 2,  
strokeLinecap: "round",  
strokeDashstyle: "solid",  
hoverStrokeColor: "red",  
hoverStrokeOpacity: 1,  
hoverStrokeWidth: 0.2,  
pointRadius: 6,  
hoverPointRadius: 1,  
hoverPointUnit: "%",  
pointerEvents: "visiblePainted",  
cursor: "pointer"  
},  
'temporary': {  
fillColor: "#66cccc",  
fillOpacity: 0.2,  
hoverFillColor: "white",  
hoverFillOpacity: 0.8,  
strokeColor: "#66cccc",  
strokeOpacity: 1,  
strokeLinecap: "round",  
strokeWidth: 2,  
strokeDashstyle: "solid",  
hoverStrokeColor: "red",  
hoverStrokeOpacity: 1,  
hoverStrokeWidth: 0.2,  
pointRadius: 6,  
hoverPointRadius: 1,  
hoverPointUnit: "%",  
pointerEvents: "visiblePainted",  
cursor: "inherit"  
},  
'delete': {  
display: "none"  
}  
};  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Feature.js  
*/  
 
/**  
* Class: OpenLayers.Feature.WFS  
* WFS handling class, for use as a featureClass on the WFS layer for handling  
* 'point' WFS types. Good for subclassing when creating a custom WFS like  
* XML application.  
*  
* Inherits from:  
* - <OpenLayers.Feature>  
*/  
OpenLayers.Feature.WFS = OpenLayers.Class(OpenLayers.Feature, {  
 
/**  
* Constructor: OpenLayers.Feature.WFS  
* Create a WFS feature.  
*  
* Parameters:  
* layer - {<OpenLayers.Layer>}  
* xmlNode - {XMLNode}  
*/  
initialize: function(layer, xmlNode) {  
var newArguments = arguments;  
var data = this.processXMLNode(xmlNode);  
newArguments = new Array(layer, data.lonlat, data);  
OpenLayers.Feature.prototype.initialize.apply(this, newArguments);  
this.createMarker();  
this.layer.addMarker(this.marker);  
},  
 
/**  
* Method: destroy  
* nullify references to prevent circular references and memory leaks  
*/  
destroy: function() {  
if (this.marker != null) {  
this.layer.removeMarker(this.marker);  
}  
OpenLayers.Feature.prototype.destroy.apply(this, arguments);  
},  
 
/**  
* Method: processXMLNode  
* When passed an xmlNode, parses it for a GML point, and passes  
* back an object describing that point.  
*  
* For subclasses of Feature.WFS, this is the feature to change.  
*  
* Parameters:  
* xmlNode - {XMLNode}  
*  
* Returns:  
* {Object} Data Object with 'id', 'lonlat', and private properties set  
*/  
processXMLNode: function(xmlNode) {  
//this should be overridden by subclasses  
// must return an Object with 'id' and 'lonlat' values set  
var point = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, "http://www.opengis.net/gml", "gml", "Point");  
var text = OpenLayers.Util.getXmlNodeValue(OpenLayers.Ajax.getElementsByTagNameNS(point[0], "http://www.opengis.net/gml","gml", "coordinates")[0]);  
var floats = text.split(",");  
return {lonlat: new OpenLayers.LonLat(parseFloat(floats[0]),  
parseFloat(floats[1])),  
id: null};  
 
},  
 
CLASS_NAME: "OpenLayers.Feature.WFS"  
});  
 
 
 
 
 
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Util.js  
* @requires OpenLayers/Style.js  
*/  
 
/**  
* Class: OpenLayers.Filter  
* This class represents an OGC Filter.  
*/  
OpenLayers.Filter = OpenLayers.Class({  
 
/**  
* Constructor: OpenLayers.Filter  
* This is an abstract class. Create an instance of a filter subclass.  
*  
* Parameters:  
* options - {Object} Optional object whose properties will be set on the  
* instance.  
*  
* Returns:  
* {<OpenLayers.Filter>}  
*/  
initialize: function(options) {  
OpenLayers.Util.extend(this, options);  
},  
 
/**  
* APIMethod: destroy  
* Remove reference to anything added.  
*/  
destroy: function() {  
},  
 
/**  
* APIMethod: evaluate  
* Evaluates this filter in a specific context. Should be implemented by  
* subclasses.  
*  
* Parameters:  
* context - {Object} Context to use in evaluating the filter. If a vector  
* feature is provided, the feature.attributes will be used as context.  
*  
* Returns:  
* {Boolean} The filter applies.  
*/  
evaluate: function(context) {  
return true;  
},  
 
/**  
* APIMethod: clone  
* Clones this filter. Should be implementted by subclasses.  
*  
* Returns:  
* {<OpenLayers.Filter>} Clone of this filter.  
*/  
clone: function() {  
return null;  
},  
 
CLASS_NAME: "OpenLayers.Filter"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Filter.js  
* @requires OpenLayers/Console.js  
*/  
 
/**  
* Class: OpenLayers.Filter.Comparison  
* This class represents a comparison filter.  
*  
* Inherits from  
* - <OpenLayers.Filter>  
*/  
OpenLayers.Filter.Comparison = OpenLayers.Class(OpenLayers.Filter, {  
 
/**  
* APIProperty: type  
* {String} type: type of the comparison. This is one of  
* - OpenLayers.Filter.Comparison.EQUAL_TO = "==";  
* - OpenLayers.Filter.Comparison.NOT_EQUAL_TO = "!=";  
* - OpenLayers.Filter.Comparison.LESS_THAN = "<";  
* - OpenLayers.Filter.Comparison.GREATER_THAN = ">";  
* - OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO = "<=";  
* - OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = ">=";  
* - OpenLayers.Filter.Comparison.BETWEEN = "..";  
* - OpenLayers.Filter.Comparison.LIKE = "~";  
*/  
type: null,  
 
/**  
* APIProperty: property  
* {String}  
* name of the context property to compare  
*/  
property: null,  
 
/**  
* APIProperty: value  
* {Number} or {String}  
* comparison value for binary comparisons. In the case of a String, this  
* can be a combination of text and propertyNames in the form  
* "literal ${propertyName}"  
*/  
value: null,  
 
/**  
* Property: matchCase  
* {Boolean} Force case sensitive searches for EQUAL_TO and NOT_EQUAL_TO  
* comparisons. The Filter Encoding 1.1 specification added a matchCase  
* attribute to ogc:PropertyIsEqualTo and ogc:PropertyIsNotEqualTo  
* elements. This property will be serialized with those elements only  
* if using the v1.1.0 filter format. However, when evaluating filters  
* here, the matchCase property will always be respected (for EQUAL_TO  
* and NOT_EQUAL_TO). Default is true.  
*/  
matchCase: true,  
 
/**  
* APIProperty: lowerBoundary  
* {Number} or {String}  
* lower boundary for between comparisons. In the case of a String, this  
* can be a combination of text and propertyNames in the form  
* "literal ${propertyName}"  
*/  
lowerBoundary: null,  
 
/**  
* APIProperty: upperBoundary  
* {Number} or {String}  
* upper boundary for between comparisons. In the case of a String, this  
* can be a combination of text and propertyNames in the form  
* "literal ${propertyName}"  
*/  
upperBoundary: null,  
 
/**  
* Constructor: OpenLayers.Filter.Comparison  
* Creates a comparison rule.  
*  
* Parameters:  
* options - {Object} An optional object with properties to set on the  
* rule  
*  
* Returns:  
* {<OpenLayers.Filter.Comparison>}  
*/  
initialize: function(options) {  
OpenLayers.Filter.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* APIMethod: evaluate  
* Evaluates this filter in a specific context.  
*  
* Parameters:  
* context - {Object} Context to use in evaluating the filter. If a vector  
* feature is provided, the feature.attributes will be used as context.  
*  
* Returns:  
* {Boolean} The filter applies.  
*/  
evaluate: function(context) {  
if (context instanceof OpenLayers.Feature.Vector) {  
context = context.attributes;  
}  
var result = false;  
var got = context[this.property];  
switch(this.type) {  
case OpenLayers.Filter.Comparison.EQUAL_TO:  
var exp = this.value;  
if(!this.matchCase &&  
typeof got == "string" && typeof exp == "string") {  
result = (got.toUpperCase() == exp.toUpperCase());  
} else {  
result = (got == exp);  
}  
break;  
case OpenLayers.Filter.Comparison.NOT_EQUAL_TO:  
var exp = this.value;  
if(!this.matchCase &&  
typeof got == "string" && typeof exp == "string") {  
result = (got.toUpperCase() != exp.toUpperCase());  
} else {  
result = (got != exp);  
}  
break;  
case OpenLayers.Filter.Comparison.LESS_THAN:  
result = got < this.value;  
break;  
case OpenLayers.Filter.Comparison.GREATER_THAN:  
result = got > this.value;  
break;  
case OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO:  
result = got <= this.value;  
break;  
case OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO:  
result = got >= this.value;  
break;  
case OpenLayers.Filter.Comparison.BETWEEN:  
result = (got >= this.lowerBoundary) &&  
(got <= this.upperBoundary);  
break;  
case OpenLayers.Filter.Comparison.LIKE:  
var regexp = new RegExp(this.value, "gi");  
result = regexp.test(got);  
break;  
}  
return result;  
},  
 
/**  
* APIMethod: value2regex  
* Converts the value of this rule into a regular expression string,  
* according to the wildcard characters specified. This method has to  
* be called after instantiation of this class, if the value is not a  
* regular expression already.  
*  
* Parameters:  
* wildCard - {<Char>} wildcard character in the above value, default  
* is "*"  
* singleChar - {<Char>) single-character wildcard in the above value  
* default is "."  
* escape - {<Char>) escape character in the above value, default is  
* "!"  
*  
* Returns:  
* {String} regular expression string  
*/  
value2regex: function(wildCard, singleChar, escapeChar) {  
if (wildCard == ".") {  
var msg = "'.' is an unsupported wildCard character for "+  
"OpenLayers.Filter.Comparison";  
OpenLayers.Console.error(msg);  
return null;  
}  
 
 
// set UMN MapServer defaults for unspecified parameters  
wildCard = wildCard ? wildCard : "*";  
singleChar = singleChar ? singleChar : ".";  
escapeChar = escapeChar ? escapeChar : "!";  
 
this.value = this.value.replace(  
new RegExp("\\"+escapeChar+"(.|$)", "g"), "\\$1");  
this.value = this.value.replace(  
new RegExp("\\"+singleChar, "g"), ".");  
this.value = this.value.replace(  
new RegExp("\\"+wildCard, "g"), ".*");  
this.value = this.value.replace(  
new RegExp("\\\\.\\*", "g"), "\\"+wildCard);  
this.value = this.value.replace(  
new RegExp("\\\\\\.", "g"), "\\"+singleChar);  
 
return this.value;  
},  
 
/**  
* Method: regex2value  
* Convert the value of this rule from a regular expression string into an  
* ogc literal string using a wildCard of *, a singleChar of ., and an  
* escape of !. Leaves the <value> property unmodified.  
*  
* Returns:  
* {String} A string value.  
*/  
regex2value: function() {  
 
var value = this.value;  
 
// replace ! with !!  
value = value.replace(/!/g, "!!");  
 
// replace \. with !. (watching out for \\.)  
value = value.replace(/(\\)?\\\./g, function($0, $1) {  
return $1 ? $0 : "!.";  
});  
 
// replace \* with #* (watching out for \\*)  
value = value.replace(/(\\)?\\\*/g, function($0, $1) {  
return $1 ? $0 : "!*";  
});  
 
// replace \\ with \  
value = value.replace(/\\\\/g, "\\");  
 
// convert .* to * (the sequence #.* is not allowed)  
value = value.replace(/\.\*/g, "*");  
 
return value;  
},  
 
/**  
* APIMethod: clone  
* Clones this filter.  
*  
* Returns:  
* {<OpenLayers.Filter.Comparison>} Clone of this filter.  
*/  
clone: function() {  
return OpenLayers.Util.extend(new OpenLayers.Filter.Comparison(), this);  
},  
 
CLASS_NAME: "OpenLayers.Filter.Comparison"  
});  
 
 
OpenLayers.Filter.Comparison.EQUAL_TO = "==";  
OpenLayers.Filter.Comparison.NOT_EQUAL_TO = "!=";  
OpenLayers.Filter.Comparison.LESS_THAN = "<";  
OpenLayers.Filter.Comparison.GREATER_THAN = ">";  
OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO = "<=";  
OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = ">=";  
OpenLayers.Filter.Comparison.BETWEEN = "..";  
OpenLayers.Filter.Comparison.LIKE = "~";  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Filter.js  
*/  
 
/**  
* Class: OpenLayers.Filter.FeatureId  
* This class represents a ogc:FeatureId Filter, as being used for rule-based SLD  
* styling  
*  
* Inherits from  
* - <OpenLayers.Filter>  
*/  
OpenLayers.Filter.FeatureId = OpenLayers.Class(OpenLayers.Filter, {  
 
/**  
* APIProperty: fids  
* {Array(String)} Feature Ids to evaluate this rule against. To be passed  
* To be passed inside the params object.  
*/  
fids: null,  
 
/**  
* Constructor: OpenLayers.Filter.FeatureId  
* Creates an ogc:FeatureId rule.  
*  
* Parameters:  
* options - {Object} An optional object with properties to set on the  
* rule  
*  
* Returns:  
* {<OpenLayers.Filter.FeatureId>}  
*/  
initialize: function(options) {  
this.fids = [];  
OpenLayers.Filter.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* APIMethod: evaluate  
* evaluates this rule for a specific feature  
*  
* Parameters:  
* feature - {<OpenLayers.Feature>} feature to apply the rule to.  
* For vector features, the check is run against the fid,  
* for plain features against the id.  
*  
* Returns:  
* {Boolean} true if the rule applies, false if it does not  
*/  
evaluate: function(feature) {  
for (var i=0, len=this.fids.length; i<len; i++) {  
var fid = feature.fid || feature.id;  
if (fid == this.fids[i]) {  
return true;  
}  
}  
return false;  
},  
 
/**  
* APIMethod: clone  
* Clones this filter.  
*  
* Returns:  
* {<OpenLayers.Filter.FeatureId>} Clone of this filter.  
*/  
clone: function() {  
var filter = new OpenLayers.Filter.FeatureId();  
OpenLayers.Util.extend(filter, this);  
filter.fids = this.fids.slice();  
return filter;  
},  
 
CLASS_NAME: "OpenLayers.Filter.FeatureId"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
 
/**  
* @requires OpenLayers/Filter.js  
*/  
 
/**  
* Class: OpenLayers.Filter.Logical  
* This class represents ogc:And, ogc:Or and ogc:Not rules.  
*  
* Inherits from  
* - <OpenLayers.Filter>  
*/  
OpenLayers.Filter.Logical = OpenLayers.Class(OpenLayers.Filter, {  
 
/**  
* APIProperty: filters  
* {Array(<OpenLayers.Filter>)} Child filters for this filter.  
*/  
filters: null,  
 
/**  
* APIProperty: type  
* {String} type of logical operator. Available types are:  
* - OpenLayers.Filter.Logical.AND = "&&";  
* - OpenLayers.Filter.Logical.OR = "||";  
* - OpenLayers.Filter.Logical.NOT = "!";  
*/  
type: null,  
 
/**  
* Constructor: OpenLayers.Filter.Logical  
* Creates a logical filter (And, Or, Not).  
*  
* Parameters:  
* options - {Object} An optional object with properties to set on the  
* filter.  
*  
* Returns:  
* {<OpenLayers.Filter.Logical>}  
*/  
initialize: function(options) {  
this.filters = [];  
OpenLayers.Filter.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* APIMethod: destroy  
* Remove reference to child filters.  
*/  
destroy: function() {  
this.filters = null;  
OpenLayers.Filter.prototype.destroy.apply(this);  
},  
 
/**  
* APIMethod: evaluate  
* Evaluates this filter in a specific context.  
*  
* Parameters:  
* context - {Object} Context to use in evaluating the filter. A vector  
* feature may also be provided to evaluate feature attributes in  
* comparison filters or geometries in spatial filters.  
*  
* Returns:  
* {Boolean} The filter applies.  
*/  
evaluate: function(context) {  
switch(this.type) {  
case OpenLayers.Filter.Logical.AND:  
for (var i=0, len=this.filters.length; i<len; i++) {  
if (this.filters[i].evaluate(context) == false) {  
return false;  
}  
}  
return true;  
 
case OpenLayers.Filter.Logical.OR:  
for (var i=0, len=this.filters.length; i<len; i++) {  
if (this.filters[i].evaluate(context) == true) {  
return true;  
}  
}  
return false;  
 
case OpenLayers.Filter.Logical.NOT:  
return (!this.filters[0].evaluate(context));  
}  
},  
 
/**  
* APIMethod: clone  
* Clones this filter.  
*  
* Returns:  
* {<OpenLayers.Filter.Logical>} Clone of this filter.  
*/  
clone: function() {  
var filters = [];  
for(var i=0, len=this.filters.length; i<len; ++i) {  
filters.push(this.filters[i].clone());  
}  
return new OpenLayers.Filter.Logical({  
type: this.type,  
filters: filters  
});  
},  
 
CLASS_NAME: "OpenLayers.Filter.Logical"  
});  
 
 
OpenLayers.Filter.Logical.AND = "&&";  
OpenLayers.Filter.Logical.OR = "||";  
OpenLayers.Filter.Logical.NOT = "!";  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Filter.js  
* @requires OpenLayers/Console.js  
*/  
 
/**  
* Class: OpenLayers.Filter.Spatial  
* This class represents a spatial filter.  
* Currently implemented: BBOX, DWithin and Intersects  
*  
* Inherits from  
* - <OpenLayers.Filter>  
*/  
OpenLayers.Filter.Spatial = OpenLayers.Class(OpenLayers.Filter, {  
 
/**  
* APIProperty: type  
* {String} Type of spatial filter.  
*  
* The type should be one of:  
* - OpenLayers.Filter.Spatial.BBOX  
* - OpenLayers.Filter.Spatial.INTERSECTS  
* - OpenLayers.Filter.Spatial.DWITHIN  
* - OpenLayers.Filter.Spatial.WITHIN  
* - OpenLayers.Filter.Spatial.CONTAINS  
*/  
type: null,  
 
/**  
* APIProperty: property  
* {String} Name of the context property to compare.  
*/  
property: null,  
 
/**  
* APIProperty: value  
* {<OpenLayers.Bounds> || <OpenLayers.Geometry>} The bounds or geometry  
* to be used by the filter. Use bounds for BBOX filters and geometry  
* for INTERSECTS or DWITHIN filters.  
*/  
value: null,  
 
/**  
* APIProperty: distance  
* {Number} The distance to use in a DWithin spatial filter.  
*/  
distance: null,  
 
/**  
* APIProperty: distanceUnits  
* {String} The units to use for the distance, e.g. 'm'.  
*/  
distanceUnits: null,  
 
/**  
* Constructor: OpenLayers.Filter.Spatial  
* Creates a spatial filter.  
*  
* Parameters:  
* options - {Object} An optional object with properties to set on the  
* filter.  
*  
* Returns:  
* {<OpenLayers.Filter.Spatial>}  
*/  
initialize: function(options) {  
OpenLayers.Filter.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* Method: evaluate  
* Evaluates this filter for a specific feature.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>} feature to apply the filter to.  
*  
* Returns:  
* {Boolean} The feature meets filter criteria.  
*/  
evaluate: function(feature) {  
var intersect = false;  
switch(this.type) {  
case OpenLayers.Filter.Spatial.BBOX:  
case OpenLayers.Filter.Spatial.INTERSECTS:  
if(feature.geometry) {  
var geom = this.value;  
if(this.value.CLASS_NAME == "OpenLayers.Bounds") {  
geom = this.value.toGeometry();  
}  
if(feature.geometry.intersects(geom)) {  
intersect = true;  
}  
}  
break;  
default:  
OpenLayers.Console.error(  
OpenLayers.i18n("filterEvaluateNotImplemented"));  
break;  
}  
return intersect;  
},  
 
/**  
* APIMethod: clone  
* Clones this filter.  
*  
* Returns:  
* {<OpenLayers.Filter.Spatial>} Clone of this filter.  
*/  
clone: function() {  
var options = OpenLayers.Util.applyDefaults({  
value: this.value && this.value.clone && this.value.clone()  
}, this);  
return new OpenLayers.Filter.Spatial(options);  
},  
CLASS_NAME: "OpenLayers.Filter.Spatial"  
});  
 
OpenLayers.Filter.Spatial.BBOX = "BBOX";  
OpenLayers.Filter.Spatial.INTERSECTS = "INTERSECTS";  
OpenLayers.Filter.Spatial.DWITHIN = "DWITHIN";  
OpenLayers.Filter.Spatial.WITHIN = "WITHIN";  
OpenLayers.Filter.Spatial.CONTAINS = "CONTAINS";  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Util.js  
* @requires OpenLayers/Console.js  
*/  
 
/**  
* Class: OpenLayers.Format  
* Base class for format reading/writing a variety of formats. Subclasses  
* of OpenLayers.Format are expected to have read and write methods.  
*/  
OpenLayers.Format = OpenLayers.Class({  
 
/**  
* Property: options  
* {Object} A reference to options passed to the constructor.  
*/  
options: null,  
 
/**  
* APIProperty: externalProjection  
* {<OpenLayers.Projection>} When passed a externalProjection and  
* internalProjection, the format will reproject the geometries it  
* reads or writes. The externalProjection is the projection used by  
* the content which is passed into read or which comes out of write.  
* In order to reproject, a projection transformation function for the  
* specified projections must be available. This support may be  
* provided via proj4js or via a custom transformation function. See  
* {<OpenLayers.Projection.addTransform>} for more information on  
* custom transformations.  
*/  
externalProjection: null,  
 
/**  
* APIProperty: internalProjection  
* {<OpenLayers.Projection>} When passed a externalProjection and  
* internalProjection, the format will reproject the geometries it  
* reads or writes. The internalProjection is the projection used by  
* the geometries which are returned by read or which are passed into  
* write. In order to reproject, a projection transformation function  
* for the specified projections must be available. This support may be  
* provided via proj4js or via a custom transformation function. See  
* {<OpenLayers.Projection.addTransform>} for more information on  
* custom transformations.  
*/  
internalProjection: null,  
 
/**  
* APIProperty: data  
* {Object} When <keepData> is true, this is the parsed string sent to  
* <read>.  
*/  
data: null,  
 
/**  
* APIProperty: keepData  
* {Object} Maintain a reference (<data>) to the most recently read data.  
* Default is false.  
*/  
keepData: false,  
 
/**  
* Constructor: OpenLayers.Format  
* Instances of this class are not useful. See one of the subclasses.  
*  
* Parameters:  
* options - {Object} An optional object with properties to set on the  
* format  
*  
* Valid options:  
* keepData - {Boolean} If true, upon <read>, the data property will be  
* set to the parsed object (e.g. the json or xml object).  
*  
* Returns:  
* An instance of OpenLayers.Format  
*/  
initialize: function(options) {  
OpenLayers.Util.extend(this, options);  
this.options = options;  
},  
 
/**  
* APIMethod: destroy  
* Clean up.  
*/  
destroy: function() {  
},  
 
/**  
* Method: read  
* Read data from a string, and return an object whose type depends on the  
* subclass.  
*  
* Parameters:  
* data - {string} Data to read/parse.  
*  
* Returns:  
* Depends on the subclass  
*/  
read: function(data) {  
OpenLayers.Console.userError(OpenLayers.i18n("readNotImplemented"));  
},  
 
/**  
* Method: write  
* Accept an object, and return a string.  
*  
* Parameters:  
* object - {Object} Object to be serialized  
*  
* Returns:  
* {String} A string representation of the object.  
*/  
write: function(object) {  
OpenLayers.Console.userError(OpenLayers.i18n("writeNotImplemented"));  
},  
 
CLASS_NAME: "OpenLayers.Format"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/XML.js  
* @requires OpenLayers/Geometry/Polygon.js  
* @requires OpenLayers/Geometry/Point.js  
* @requires OpenLayers/Geometry/MultiPolygon.js  
* @requires OpenLayers/Geometry/LinearRing.js  
*/  
 
/**  
* Class: OpenLayers.Format.ArcXML  
* Read/Wite ArcXML. Create a new instance with the <OpenLayers.Format.ArcXML>  
* constructor.  
*  
* Inherits from:  
* - <OpenLayers.Format>  
*/  
OpenLayers.Format.ArcXML = OpenLayers.Class(OpenLayers.Format.XML, {  
 
/**  
* Property: fontStyleKeys  
* {Array} List of keys used in font styling.  
*/  
fontStyleKeys: [  
'antialiasing', 'blockout', 'font', 'fontcolor','fontsize', 'fontstyle',  
'glowing', 'interval', 'outline', 'printmode', 'shadow', 'transparency'  
],  
 
/**  
* Property: request  
* A get_image request destined for an ArcIMS server.  
*/  
request: null,  
 
/**  
* Property: response  
* A parsed response from an ArcIMS server.  
*/  
response: null,  
 
/**  
* Constructor: OpenLayers.Format.ArcXML  
* Create a new parser/writer for ArcXML. Create an instance of this class  
* to begin authoring a request to an ArcIMS service. This is used  
* primarily by the ArcIMS layer, but could be used to do other wild  
* stuff, like geocoding.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*/  
initialize: function(options) {  
this.request = new OpenLayers.Format.ArcXML.Request();  
this.response = new OpenLayers.Format.ArcXML.Response();  
 
if (options) {  
if (options.requesttype == "feature") {  
this.request.get_image = null;  
 
var qry = this.request.get_feature.query;  
this.addCoordSys(qry.featurecoordsys, options.featureCoordSys);  
this.addCoordSys(qry.filtercoordsys, options.filterCoordSys);  
 
if (options.polygon) {  
qry.isspatial = true;  
qry.spatialfilter.polygon = options.polygon;  
} else if (options.envelope) {  
qry.isspatial = true;  
qry.spatialfilter.envelope = {minx:0, miny:0, maxx:0, maxy:0};  
this.parseEnvelope(qry.spatialfilter.envelope, options.envelope);  
}  
} else if (options.requesttype == "image") {  
this.request.get_feature = null;  
 
var props = this.request.get_image.properties;  
this.parseEnvelope(props.envelope, options.envelope);  
 
this.addLayers(props.layerlist, options.layers);  
this.addImageSize(props.imagesize, options.tileSize);  
this.addCoordSys(props.featurecoordsys, options.featureCoordSys);  
this.addCoordSys(props.filtercoordsys, options.filterCoordSys);  
} else {  
// if an arcxml object is being created with no request type, it is  
// probably going to consume a response, so do not throw an error if  
// the requesttype is not defined  
this.request = null;  
}  
}  
 
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* Method: parseEnvelope  
* Parse an array of coordinates into an ArcXML envelope structure.  
*  
* Parameters:  
* env - {Object} An envelope object that will contain the parsed coordinates.  
* arr - {Array(double)} An array of coordinates in the order: [ minx, miny, maxx, maxy ]  
*/  
parseEnvelope: function(env, arr) {  
if (arr && arr.length == 4) {  
env.minx = arr[0];  
env.miny = arr[1];  
env.maxx = arr[2];  
env.maxy = arr[3];  
}  
},  
 
/**  
* Method: addLayers  
* Add a collection of layers to another collection of layers. Each layer in the list is tuple of  
* { id, visible }. These layer collections represent the  
* /ARCXML/REQUEST/get_image/PROPERTIES/LAYERLIST/LAYERDEF items in ArcXML  
*  
* TODO: Add support for dynamic layer rendering.  
*  
* Parameters:  
* ll - {Array({id,visible})} A list of layer definitions.  
* lyrs - {Array({id,visible})} A list of layer definitions.  
*/  
addLayers: function(ll, lyrs) {  
for(var lind = 0, len=lyrs.length; lind < len; lind++) {  
ll.push(lyrs[lind]);  
}  
},  
 
/**  
* Method: addImageSize  
* Set the size of the requested image.  
*  
* Parameters:  
* imsize - {Object} An ArcXML imagesize object.  
* olsize - {OpenLayers.Size} The image size to set.  
*/  
addImageSize: function(imsize, olsize) {  
if (olsize !== null) {  
imsize.width = olsize.w;  
imsize.height = olsize.h;  
imsize.printwidth = olsize.w;  
imsize.printheight = olsize.h;  
}  
},  
 
/**  
* Method: addCoordSys  
* Add the coordinate system information to an object. The object may be  
*  
* Parameters:  
* featOrFilt - {Object} A featurecoordsys or filtercoordsys ArcXML structure.  
* fsys - {String} or {OpenLayers.Projection} or {filtercoordsys} or  
* {featurecoordsys} A projection representation. If it's a {String},  
* the value is assumed to be the SRID. If it's a {OpenLayers.Projection}  
* AND Proj4js is available, the projection number and name are extracted  
* from there. If it's a filter or feature ArcXML structure, it is copied.  
*/  
addCoordSys: function(featOrFilt, fsys) {  
if (typeof fsys == "string") {  
featOrFilt.id = parseInt(fsys);  
featOrFilt.string = fsys;  
}  
// is this a proj4js instance?  
else if (typeof fsys == "object" && fsys.proj !== null){  
featOrFilt.id = fsys.proj.srsProjNumber;  
featOrFilt.string = fsys.proj.srsCode;  
} else {  
featOrFilt = fsys;  
}  
},  
 
/**  
* APIMethod: iserror  
* Check to see if the response from the server was an error.  
*  
* Parameters:  
* data - {String} or {DOMElement} data to read/parse. If nothing is supplied,  
* the current response is examined.  
*  
* Returns:  
* {Boolean} true if the response was an error.  
*/  
iserror: function(data) {  
var ret = null;  
 
if (!data) {  
ret = (this.response.error !== '');  
} else {  
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);  
var errorNodes = data.documentElement.getElementsByTagName("ERROR");  
ret = (errorNodes !== null && errorNodes.length > 0);  
}  
 
return ret;  
},  
 
/**  
* APIMethod: read  
* Read data from a string, and return an response.  
*  
* Parameters:  
* data - {String} or {DOMElement} data to read/parse.  
*  
* Returns:  
* {OpenLayers.Format.ArcXML.Response} An ArcXML response. Note that this response  
* data may change in the future.  
*/  
read: function(data) {  
if(typeof data == "string") {  
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);  
}  
 
var arcNode = null;  
if (data && data.documentElement) {  
if(data.documentElement.nodeName == "ARCXML") {  
arcNode = data.documentElement;  
} else {  
arcNode = data.documentElement.getElementsByTagName("ARCXML")[0];  
}  
}  
 
// in Safari, arcNode will be there but will have a child named  
// parsererror  
if (!arcNode || arcNode.firstChild.nodeName === 'parsererror') {  
var error, source;  
try {  
error = data.firstChild.nodeValue;  
source = data.firstChild.childNodes[1].firstChild.nodeValue;  
} catch (err) {  
// pass  
}  
throw {  
message: "Error parsing the ArcXML request",  
error: error,  
source: source  
};  
}  
 
var response = this.parseResponse(arcNode);  
return response;  
},  
 
/**  
* APIMethod: write  
* Generate an ArcXml document string for sending to an ArcIMS server.  
*  
* Returns:  
* {String} A string representing the ArcXML document request.  
*/  
write: function(request) {  
if (!request) {  
request = this.request;  
}  
var root = this.createElementNS("", "ARCXML");  
root.setAttribute("version","1.1");  
 
var reqElem = this.createElementNS("", "REQUEST");  
 
if (request.get_image != null) {  
var getElem = this.createElementNS("", "GET_IMAGE");  
reqElem.appendChild(getElem);  
 
var propElem = this.createElementNS("", "PROPERTIES");  
getElem.appendChild(propElem);  
 
var props = request.get_image.properties;  
if (props.featurecoordsys != null) {  
var feat = this.createElementNS("", "FEATURECOORDSYS");  
propElem.appendChild(feat);  
 
if (props.featurecoordsys.id === 0) {  
feat.setAttribute("string", props.featurecoordsys['string']);  
}  
else {  
feat.setAttribute("id", props.featurecoordsys.id);  
}  
}  
 
if (props.filtercoordsys != null) {  
var filt = this.createElementNS("", "FILTERCOORDSYS");  
propElem.appendChild(filt);  
 
if (props.filtercoordsys.id === 0) {  
filt.setAttribute("string", props.filtercoordsys.string);  
}  
else {  
filt.setAttribute("id", props.filtercoordsys.id);  
}  
}  
 
if (props.envelope != null) {  
var env = this.createElementNS("", "ENVELOPE");  
propElem.appendChild(env);  
 
env.setAttribute("minx", props.envelope.minx);  
env.setAttribute("miny", props.envelope.miny);  
env.setAttribute("maxx", props.envelope.maxx);  
env.setAttribute("maxy", props.envelope.maxy);  
}  
 
var imagesz = this.createElementNS("", "IMAGESIZE");  
propElem.appendChild(imagesz);  
 
imagesz.setAttribute("height", props.imagesize.height);  
imagesz.setAttribute("width", props.imagesize.width);  
 
if (props.imagesize.height != props.imagesize.printheight ||  
props.imagesize.width != props.imagesize.printwidth) {  
imagesz.setAttribute("printheight", props.imagesize.printheight);  
imagesz.setArrtibute("printwidth", props.imagesize.printwidth);  
}  
 
if (props.background != null) {  
var backgrnd = this.createElementNS("", "BACKGROUND");  
propElem.appendChild(backgrnd);  
 
backgrnd.setAttribute("color",  
props.background.color.r + "," +  
props.background.color.g + "," +  
props.background.color.b);  
 
if (props.background.transcolor !== null) {  
backgrnd.setAttribute("transcolor",  
props.background.transcolor.r + "," +  
props.background.transcolor.g + "," +  
props.background.transcolor.b);  
}  
}  
 
if (props.layerlist != null && props.layerlist.length > 0) {  
var layerlst = this.createElementNS("", "LAYERLIST");  
propElem.appendChild(layerlst);  
 
for (var ld = 0; ld < props.layerlist.length; ld++) {  
var ldef = this.createElementNS("", "LAYERDEF");  
layerlst.appendChild(ldef);  
 
ldef.setAttribute("id", props.layerlist[ld].id);  
ldef.setAttribute("visible", props.layerlist[ld].visible);  
 
if (typeof props.layerlist[ld].query == "object") {  
var query = props.layerlist[ld].query;  
 
if (query.where.length < 0) {  
continue;  
}  
 
var queryElem = null;  
if (typeof query.spatialfilter == "boolean" && query.spatialfilter) {  
// handle spatial filter madness  
queryElem = this.createElementNS("", "SPATIALQUERY");  
}  
else {  
queryElem = this.createElementNS("", "QUERY");  
}  
 
queryElem.setAttribute("where", query.where);  
 
if (typeof query.accuracy == "number" && query.accuracy > 0) {  
queryElem.setAttribute("accuracy", query.accuracy);  
}  
if (typeof query.featurelimit == "number" && query.featurelimit < 2000) {  
queryElem.setAttribute("featurelimit", query.featurelimit);  
}  
if (typeof query.subfields == "string" && query.subfields != "#ALL#") {  
queryElem.setAttribute("subfields", query.subfields);  
}  
if (typeof query.joinexpression == "string" && query.joinexpression.length > 0) {  
queryElem.setAttribute("joinexpression", query.joinexpression);  
}  
if (typeof query.jointables == "string" && query.jointables.length > 0) {  
queryElem.setAttribute("jointables", query.jointables);  
}  
 
ldef.appendChild(queryElem);  
}  
 
if (typeof props.layerlist[ld].renderer == "object") {  
this.addRenderer(ldef, props.layerlist[ld].renderer);  
}  
}  
}  
} else if (request.get_feature != null) {  
var getElem = this.createElementNS("", "GET_FEATURES");  
getElem.setAttribute("outputmode", "newxml");  
getElem.setAttribute("checkesc", "true");  
 
if (request.get_feature.geometry) {  
getElem.setAttribute("geometry", request.get_feature.geometry);  
}  
else {  
getElem.setAttribute("geometry", "false");  
}  
 
if (request.get_feature.compact) {  
getElem.setAttribute("compact", request.get_feature.compact);  
}  
 
if (request.get_feature.featurelimit == "number") {  
getElem.setAttribute("featurelimit", request.get_feature.featurelimit);  
}  
 
getElem.setAttribute("globalenvelope", "true");  
reqElem.appendChild(getElem);  
 
if (request.get_feature.layer != null && request.get_feature.layer.length > 0) {  
var lyrElem = this.createElementNS("", "LAYER");  
lyrElem.setAttribute("id", request.get_feature.layer);  
getElem.appendChild(lyrElem);  
}  
 
var fquery = request.get_feature.query;  
if (fquery != null) {  
var qElem = null;  
if (fquery.isspatial) {  
qElem = this.createElementNS("", "SPATIALQUERY");  
} else {  
qElem = this.createElementNS("", "QUERY");  
}  
getElem.appendChild(qElem);  
 
if (typeof fquery.accuracy == "number") {  
qElem.setAttribute("accuracy", fquery.accuracy);  
}  
//qElem.setAttribute("featurelimit", "5");  
 
if (fquery.featurecoordsys != null) {  
var fcsElem1 = this.createElementNS("", "FEATURECOORDSYS");  
 
if (fquery.featurecoordsys.id == 0) {  
fcsElem1.setAttribute("string", fquery.featurecoordsys.string);  
} else {  
fcsElem1.setAttribute("id", fquery.featurecoordsys.id);  
}  
qElem.appendChild(fcsElem1);  
}  
 
if (fquery.filtercoordsys != null) {  
var fcsElem2 = this.createElementNS("", "FILTERCOORDSYS");  
 
if (fquery.filtercoordsys.id === 0) {  
fcsElem2.setAttribute("string", fquery.filtercoordsys.string);  
} else {  
fcsElem2.setAttribute("id", fquery.filtercoordsys.id);  
}  
qElem.appendChild(fcsElem2);  
}  
 
if (fquery.buffer > 0) {  
var bufElem = this.createElementNS("", "BUFFER");  
bufElem.setAttribute("distance", fquery.buffer);  
qElem.appendChild(bufElem);  
}  
 
if (fquery.isspatial) {  
var spfElem = this.createElementNS("", "SPATIALFILTER");  
spfElem.setAttribute("relation", fquery.spatialfilter.relation);  
qElem.appendChild(spfElem);  
 
if (fquery.spatialfilter.envelope) {  
var envElem = this.createElementNS("", "ENVELOPE");  
envElem.setAttribute("minx", fquery.spatialfilter.envelope.minx);  
envElem.setAttribute("miny", fquery.spatialfilter.envelope.miny);  
envElem.setAttribute("maxx", fquery.spatialfilter.envelope.maxx);  
envElem.setAttribute("maxy", fquery.spatialfilter.envelope.maxy);  
spfElem.appendChild(envElem);  
} else if(typeof fquery.spatialfilter.polygon == "object") {  
spfElem.appendChild(this.writePolygonGeometry(fquery.spatialfilter.polygon));  
}  
}  
 
if (fquery.where != null && fquery.where.length > 0) {  
qElem.setAttribute("where", fquery.where);  
}  
}  
}  
 
root.appendChild(reqElem);  
 
return OpenLayers.Format.XML.prototype.write.apply(this, [root]);  
},  
 
 
addGroupRenderer: function(ldef, toprenderer) {  
var topRelem = this.createElementNS("", "GROUPRENDERER");  
ldef.appendChild(topRelem);  
 
for (var rind = 0; rind < toprenderer.length; rind++) {  
var renderer = toprenderer[rind];  
this.addRenderer(topRelem, renderer);  
}  
},  
 
 
addRenderer: function(topRelem, renderer) {  
if (renderer instanceof Array) {  
this.addGroupRenderer(topRelem, renderer);  
} else {  
var renderElem = this.createElementNS("", renderer.type.toUpperCase() + "RENDERER");  
topRelem.appendChild(renderElem);  
 
if (renderElem.tagName == "VALUEMAPRENDERER") {  
this.addValueMapRenderer(renderElem, renderer);  
} else if (renderElem.tagName == "VALUEMAPLABELRENDERER") {  
this.addValueMapLabelRenderer(renderElem, renderer);  
} else if (renderElem.tagName == "SIMPLELABELRENDERER") {  
this.addSimpleLabelRenderer(renderElem, renderer);  
} else if (renderElem.tagName == "SCALEDEPENDENTRENDERER") {  
this.addScaleDependentRenderer(renderElem, renderer);  
}  
}  
},  
 
 
addScaleDependentRenderer: function(renderElem, renderer) {  
if (typeof renderer.lower == "string" || typeof renderer.lower == "number") {  
renderElem.setAttribute("lower", renderer.lower);  
}  
if (typeof renderer.upper == "string" || typeof renderer.upper == "number") {  
renderElem.setAttribute("upper", renderer.upper);  
}  
 
this.addRenderer(renderElem, renderer.renderer);  
},  
 
 
addValueMapLabelRenderer: function(renderElem, renderer) {  
renderElem.setAttribute("lookupfield", renderer.lookupfield);  
renderElem.setAttribute("labelfield", renderer.labelfield);  
 
if (typeof renderer.exacts == "object") {  
for (var ext=0, extlen=renderer.exacts.length; ext<extlen; ext++) {  
var exact = renderer.exacts[ext];  
 
var eelem = this.createElementNS("", "EXACT");  
 
if (typeof exact.value == "string") {  
eelem.setAttribute("value", exact.value);  
}  
if (typeof exact.label == "string") {  
eelem.setAttribute("label", exact.label);  
}  
if (typeof exact.method == "string") {  
eelem.setAttribute("method", exact.method);  
}  
 
renderElem.appendChild(eelem);  
 
if (typeof exact.symbol == "object") {  
var selem = null;  
 
if (exact.symbol.type == "text") {  
selem = this.createElementNS("", "TEXTSYMBOL");  
}  
 
if (selem != null) {  
var keys = this.fontStyleKeys;  
for (var i = 0, len = keys.length; i < len; i++) {  
var key = keys[i];  
if (exact.symbol[key]) {  
selem.setAttribute(key, exact.symbol[key]);  
}  
}  
eelem.appendChild(selem);  
}  
}  
} // for each exact  
}  
},  
 
addValueMapRenderer: function(renderElem, renderer) {  
renderElem.setAttribute("lookupfield", renderer.lookupfield);  
 
if (typeof renderer.ranges == "object") {  
for(var rng=0, rnglen=renderer.ranges.length; rng<rnglen; rng++) {  
var range = renderer.ranges[rng];  
 
var relem = this.createElementNS("", "RANGE");  
relem.setAttribute("lower", range.lower);  
relem.setAttribute("upper", range.upper);  
 
renderElem.appendChild(relem);  
 
if (typeof range.symbol == "object") {  
var selem = null;  
 
if (range.symbol.type == "simplepolygon") {  
selem = this.createElementNS("", "SIMPLEPOLYGONSYMBOL");  
}  
 
if (selem != null) {  
if (typeof range.symbol.boundarycolor == "string") {  
selem.setAttribute("boundarycolor", range.symbol.boundarycolor);  
}  
if (typeof range.symbol.fillcolor == "string") {  
selem.setAttribute("fillcolor", range.symbol.fillcolor);  
}  
if (typeof range.symbol.filltransparency == "number") {  
selem.setAttribute("filltransparency", range.symbol.filltransparency);  
}  
relem.appendChild(selem);  
}  
}  
} // for each range  
} else if (typeof renderer.exacts == "object") {  
for (var ext=0, extlen=renderer.exacts.length; ext<extlen; ext++) {  
var exact = renderer.exacts[ext];  
 
var eelem = this.createElementNS("", "EXACT");  
if (typeof exact.value == "string") {  
eelem.setAttribute("value", exact.value);  
}  
if (typeof exact.label == "string") {  
eelem.setAttribute("label", exact.label);  
}  
if (typeof exact.method == "string") {  
eelem.setAttribute("method", exact.method);  
}  
 
renderElem.appendChild(eelem);  
 
if (typeof exact.symbol == "object") {  
var selem = null;  
 
if (exact.symbol.type == "simplemarker") {  
selem = this.createElementNS("", "SIMPLEMARKERSYMBOL");  
}  
 
if (selem != null) {  
if (typeof exact.symbol.antialiasing == "string") {  
selem.setAttribute("antialiasing", exact.symbol.antialiasing);  
}  
if (typeof exact.symbol.color == "string") {  
selem.setAttribute("color", exact.symbol.color);  
}  
if (typeof exact.symbol.outline == "string") {  
selem.setAttribute("outline", exact.symbol.outline);  
}  
if (typeof exact.symbol.overlap == "string") {  
selem.setAttribute("overlap", exact.symbol.overlap);  
}  
if (typeof exact.symbol.shadow == "string") {  
selem.setAttribute("shadow", exact.symbol.shadow);  
}  
if (typeof exact.symbol.transparency == "number") {  
selem.setAttribute("transparency", exact.symbol.transparency);  
}  
//if (typeof exact.symbol.type == "string")  
// selem.setAttribute("type", exact.symbol.type);  
if (typeof exact.symbol.usecentroid == "string") {  
selem.setAttribute("usecentroid", exact.symbol.usecentroid);  
}  
if (typeof exact.symbol.width == "number") {  
selem.setAttribute("width", exact.symbol.width);  
}  
 
eelem.appendChild(selem);  
}  
}  
} // for each exact  
}  
},  
 
 
addSimpleLabelRenderer: function(renderElem, renderer) {  
renderElem.setAttribute("field", renderer.field);  
var keys = ['featureweight', 'howmanylabels', 'labelbufferratio',  
'labelpriorities', 'labelweight', 'linelabelposition',  
'rotationalangles'];  
for (var i=0, len=keys.length; i<len; i++) {  
var key = keys[i];  
if (renderer[key]) {  
renderElem.setAttribute(key, renderer[key]);  
}  
}  
 
if (renderer.symbol.type == "text") {  
var symbol = renderer.symbol;  
var selem = this.createElementNS("", "TEXTSYMBOL");  
renderElem.appendChild(selem);  
 
var keys = this.fontStyleKeys;  
for (var i=0, len=keys.length; i<len; i++) {  
var key = keys[i];  
if (symbol[key]) {  
selem.setAttribute(key, renderer[key]);  
}  
}  
}  
},  
 
writePolygonGeometry: function(polygon) {  
if (!(polygon instanceof OpenLayers.Geometry.Polygon)) {  
throw {  
message:'Cannot write polygon geometry to ArcXML with an ' +  
polygon.CLASS_NAME + ' object.',  
geometry: polygon  
};  
}  
 
var polyElem = this.createElementNS("", "POLYGON");  
 
for (var ln=0, lnlen=polygon.components.length; ln<lnlen; ln++) {  
var ring = polygon.components[ln];  
var ringElem = this.createElementNS("", "RING");  
 
for (var rn=0, rnlen=ring.components.length; rn<rnlen; rn++) {  
var point = ring.components[rn];  
var pointElem = this.createElementNS("", "POINT");  
 
pointElem.setAttribute("x", point.x);  
pointElem.setAttribute("y", point.y);  
 
ringElem.appendChild(pointElem);  
}  
 
polyElem.appendChild(ringElem);  
}  
 
return polyElem;  
},  
 
/**  
* Method: parseResponse  
* Take an ArcXML response, and parse in into this object's internal properties.  
*  
* Parameters:  
* data - {String} or {DOMElement} The ArcXML response, as either a string or the  
* top level DOMElement of the response.  
*/  
parseResponse: function(data) {  
if(typeof data == "string") {  
var newData = new OpenLayers.Format.XML();  
data = newData.read(data);  
}  
var response = new OpenLayers.Format.ArcXML.Response();  
 
var errorNode = data.getElementsByTagName("ERROR");  
 
if (errorNode != null && errorNode.length > 0) {  
response.error = this.getChildValue(errorNode, "Unknown error.");  
} else {  
var responseNode = data.getElementsByTagName("RESPONSE");  
 
if (responseNode == null || responseNode.length == 0) {  
response.error = "No RESPONSE tag found in ArcXML response.";  
return response;  
}  
 
var rtype = responseNode[0].firstChild.nodeName;  
if (rtype == "#text") {  
rtype = responseNode[0].firstChild.nextSibling.nodeName;  
}  
 
if (rtype == "IMAGE") {  
var envelopeNode = data.getElementsByTagName("ENVELOPE");  
var outputNode = data.getElementsByTagName("OUTPUT");  
 
if (envelopeNode == null || envelopeNode.length == 0) {  
response.error = "No ENVELOPE tag found in ArcXML response.";  
} else if (outputNode == null || outputNode.length == 0) {  
response.error = "No OUTPUT tag found in ArcXML response.";  
} else {  
var envAttr = this.parseAttributes(envelopeNode[0]);  
var outputAttr = this.parseAttributes(outputNode[0]);  
 
if (typeof outputAttr.type == "string") {  
response.image = {  
envelope: envAttr,  
output: {  
type: outputAttr.type,  
data: this.getChildValue(outputNode[0])  
}  
};  
} else {  
response.image = { envelope: envAttr, output: outputAttr };  
}  
}  
} else if (rtype == "FEATURES") {  
var features = responseNode[0].getElementsByTagName("FEATURES");  
 
// get the feature count  
var featureCount = features[0].getElementsByTagName("FEATURECOUNT");  
response.features.featurecount = featureCount[0].getAttribute("count");  
 
if (response.features.featurecount > 0) {  
// get the feature envelope  
var envelope = features[0].getElementsByTagName("ENVELOPE");  
response.features.envelope = this.parseAttributes(envelope[0], typeof(0));  
 
// get the field values per feature  
var featureList = features[0].getElementsByTagName("FEATURE");  
for (var fn = 0; fn < featureList.length; fn++) {  
var feature = new OpenLayers.Feature.Vector();  
var fields = featureList[fn].getElementsByTagName("FIELD");  
 
for (var fdn = 0; fdn < fields.length; fdn++) {  
var fieldName = fields[fdn].getAttribute("name");  
var fieldValue = fields[fdn].getAttribute("value");  
feature.attributes[ fieldName ] = fieldValue;  
}  
 
var geom = featureList[fn].getElementsByTagName("POLYGON");  
 
if (geom.length > 0) {  
// if there is a polygon, create an openlayers polygon, and assign  
// it to the .geometry property of the feature  
var ring = geom[0].getElementsByTagName("RING");  
 
var polys = [];  
for (var rn = 0; rn < ring.length; rn++) {  
var linearRings = [];  
linearRings.push(this.parsePointGeometry(ring[rn]));  
 
var holes = ring[rn].getElementsByTagName("HOLE");  
for (var hn = 0; hn < holes.length; hn++) {  
linearRings.push(this.parsePointGeometry(holes[hn]));  
}  
holes = null;  
polys.push(new OpenLayers.Geometry.Polygon(linearRings));  
linearRings = null;  
}  
ring = null;  
 
if (polys.length == 1) {  
feature.geometry = polys[0];  
} else  
{  
feature.geometry = new OpenLayers.Geometry.MultiPolygon(polys);  
}  
}  
 
response.features.feature.push(feature);  
}  
}  
} else {  
response.error = "Unidentified response type.";  
}  
}  
return response;  
},  
 
 
/**  
* Method: parseAttributes  
*  
* Parameters:  
* node - {<DOMElement>} An element to parse attributes from.  
*  
* Returns:  
* {Object} An attributes object, with properties set to attribute values.  
*/  
parseAttributes: function(node,type) {  
var attributes = {};  
for(var attr = 0; attr < node.attributes.length; attr++) {  
if (type == "number") {  
attributes[node.attributes[attr].nodeName] = parseFloat(node.attributes[attr].nodeValue);  
} else {  
attributes[node.attributes[attr].nodeName] = node.attributes[attr].nodeValue;  
}  
}  
return attributes;  
},  
 
 
/**  
* Method: parsePointGeometry  
*  
* Parameters:  
* node - {<DOMElement>} An element to parse <COORDS> or <POINT> arcxml data from.  
*  
* Returns:  
* {OpenLayers.Geometry.LinearRing} A linear ring represented by the node's points.  
*/  
parsePointGeometry: function(node) {  
var ringPoints = [];  
var coords = node.getElementsByTagName("COORDS");  
 
if (coords.length > 0) {  
// if coords is present, it's the only coords item  
var coordArr = this.getChildValue(coords[0]);  
coordArr = coordArr.split(/;/);  
for (var cn = 0; cn < coordArr.length; cn++) {  
var coordItems = coordArr[cn].split(/ /);  
ringPoints.push(new OpenLayers.Geometry.Point(parseFloat(coordItems[0]), parseFloat(coordItems[1])));  
}  
coords = null;  
} else {  
var point = node.getElementsByTagName("POINT");  
if (point.length > 0) {  
for (var pn = 0; pn < point.length; pn++) {  
ringPoints.push(  
new OpenLayers.Geometry.Point(  
parseFloat(point[pn].getAttribute("x")),  
parseFloat(point[pn].getAttribute("y"))  
)  
);  
}  
}  
point = null;  
}  
 
return new OpenLayers.Geometry.LinearRing(ringPoints);  
},  
 
CLASS_NAME: "OpenLayers.Format.ArcXML"  
});  
 
OpenLayers.Format.ArcXML.Request = OpenLayers.Class({  
initialize: function(params) {  
var defaults = {  
get_image: {  
properties: {  
background: null,  
/*{  
color: { r:255, g:255, b:255 },  
transcolor: null  
},*/  
draw: true,  
envelope: {  
minx: 0,  
miny: 0,  
maxx: 0,  
maxy: 0  
},  
featurecoordsys: {  
id:0,  
string:"",  
datumtransformid:0,  
datumtransformstring:""  
},  
filtercoordsys:{  
id:0,  
string:"",  
datumtransformid:0,  
datumtransformstring:""  
},  
imagesize:{  
height:0,  
width:0,  
dpi:96,  
printheight:0,  
printwidth:0,  
scalesymbols:false  
},  
layerlist:[],  
/* no support for legends */  
output:{  
baseurl:"",  
legendbaseurl:"",  
legendname:"",  
legendpath:"",  
legendurl:"",  
name:"",  
path:"",  
type:"jpg",  
url:""  
}  
}  
},  
 
get_feature: {  
layer: "",  
query: {  
isspatial: false,  
featurecoordsys: {  
id:0,  
string:"",  
datumtransformid:0,  
datumtransformstring:""  
},  
filtercoordsys: {  
id:0,  
string:"",  
datumtransformid:0,  
datumtransformstring:""  
},  
buffer:0,  
where:"",  
spatialfilter: {  
relation: "envelope_intersection",  
envelope: null  
}  
}  
},  
 
environment: {  
separators: {  
cs:" ",  
ts:";"  
}  
},  
 
layer: [],  
workspaces: []  
};  
 
return OpenLayers.Util.extend(this, defaults);  
},  
 
CLASS_NAME: "OpenLayers.Format.ArcXML.Request"  
});  
 
OpenLayers.Format.ArcXML.Response = OpenLayers.Class({  
initialize: function(params) {  
var defaults = {  
image: {  
envelope:null,  
output:''  
},  
 
features: {  
featurecount: 0,  
envelope: null,  
feature: []  
},  
 
error:''  
};  
 
return OpenLayers.Util.extend(this, defaults);  
},  
 
CLASS_NAME: "OpenLayers.Format.ArcXML.Response"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/ArcXML.js  
*/  
 
/**  
* Class: OpenLayers.Format.ArcXML.Features  
* Read/Wite ArcXML features. Create a new instance with the  
* <OpenLayers.Format.ArcXML.Features> constructor.  
*  
* Inherits from:  
* - <OpenLayers.Format.XML>  
*/  
OpenLayers.Format.ArcXML.Features = OpenLayers.Class(OpenLayers.Format.XML, {  
 
/**  
* Constructor: OpenLayers.Format.ArcXML.Features  
* Create a new parser/writer for ArcXML Features. Create an instance of this class  
* to get a set of features from an ArcXML response.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*/  
initialize: function(options) {  
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* APIMethod: read  
* Read data from a string of ArcXML, and return a set of OpenLayers features.  
*  
* Parameters:  
* data - {String} or {DOMElement} data to read/parse.  
*  
* Returns:  
* {Array(<OpenLayers.Feature.Vector>)} A collection of features.  
*/  
read: function(data) {  
var axl = new OpenLayers.Format.ArcXML();  
var parsed = axl.read(data);  
 
return parsed.features.feature;  
}  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/XML.js  
* @requires OpenLayers/Format/GML/v3.js  
* @requires OpenLayers/Feature/Vector.js  
*/  
 
/**  
* Class: OpenLayers.Format.Atom  
* Read/write Atom feeds. Create a new instance with the  
* <OpenLayers.Format.AtomFeed> constructor.  
*  
* Inherits from:  
* - <OpenLayers.Format.XML>  
*/  
OpenLayers.Format.Atom = OpenLayers.Class(OpenLayers.Format.XML, {  
 
/**  
* Property: namespaces  
* {Object} Mapping of namespace aliases to namespace URIs. Properties  
* of this object should not be set individually. Read-only. All  
* XML subclasses should have their own namespaces object. Use  
* <setNamespace> to add or set a namespace alias after construction.  
*/  
namespaces: {  
atom: "http://www.w3.org/2005/Atom",  
georss: "http://www.georss.org/georss"  
},  
 
/**  
* APIProperty: feedTitle  
* {String} Atom feed elements require a title. Default is "untitled".  
*/  
feedTitle: "untitled",  
 
/**  
* APIProperty: defaultEntryTitle  
* {String} Atom entry elements require a title. In cases where one is  
* not provided in the feature attributes, this will be used. Default  
* is "untitled".  
*/  
defaultEntryTitle: "untitled",  
 
/**  
* Property: gmlParse  
* {Object} GML Format object for parsing features  
* Non-API and only created if necessary  
*/  
gmlParser: null,  
 
/**  
* APIProperty: xy  
* {Boolean} Order of the GML coordinate: true:(x,y) or false:(y,x)  
* For GeoRSS the default is (y,x), therefore: false  
*/  
xy: false,  
 
/**  
* Constructor: OpenLayers.Format.AtomEntry  
* Create a new parser for Atom.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*/  
initialize: function(options) {  
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* APIMethod: read  
* Return a list of features from an Atom feed or entry document.  
 
* Parameters:  
* doc - {Element} or {String}  
*  
* Returns:  
* An Array of <OpenLayers.Feature.Vector>s  
*/  
read: function(doc) {  
if (typeof doc == "string") {  
doc = OpenLayers.Format.XML.prototype.read.apply(this, [doc]);  
}  
return this.parseFeatures(doc);  
},  
 
/**  
* APIMethod: write  
* Serialize or more feature nodes to Atom documents.  
*  
* Parameters:  
* features - a single {<OpenLayers.Feature.Vector>} or an  
* Array({<OpenLayers.Feature.Vector>}).  
*  
* Returns:  
* {String} an Atom entry document if passed one feature node, or a feed  
* document if passed an array of feature nodes.  
*/  
write: function(features) {  
var doc;  
if (features instanceof Array) {  
doc = this.createElementNSPlus("atom:feed");  
doc.appendChild(  
this.createElementNSPlus("atom:title", {  
value: this.feedTitle  
})  
);  
for (var i=0, ii=features.length; i<ii; i++) {  
doc.appendChild(this.buildEntryNode(features[i]));  
}  
}  
else {  
doc = this.buildEntryNode(features);  
}  
return OpenLayers.Format.XML.prototype.write.apply(this, [doc]);  
},  
 
/**  
* Method: buildContentNode  
*  
* Parameters:  
* content - {Object}  
*  
* Returns:  
* {DOMElement} an Atom content node.  
*  
* TODO: types other than text.  
*/  
buildContentNode: function(content) {  
var node = this.createElementNSPlus("atom:content", {  
attributes: {  
type: content.type || null  
}  
});  
if (content.src) {  
node.setAttribute("src", content.src);  
} else {  
if (content.type == "text" || content.type == null) {  
node.appendChild(  
this.createTextNode(content.value)  
);  
} else if (content.type == "html") {  
if (typeof content.value != "string") {  
throw "HTML content must be in form of an escaped string";  
}  
node.appendChild(  
this.createTextNode(content.value)  
);  
} else if (content.type == "xhtml") {  
node.appendChild(content.value);  
} else if (content.type == "xhtml" ||  
content.type.match(/(\+|\/)xml$/)) {  
node.appendChild(content.value);  
}  
else { // MUST be a valid Base64 encoding  
node.appendChild(  
this.createTextNode(content.value)  
);  
}  
}  
return node;  
},  
 
/**  
* Method: buildEntryNode  
* Build an Atom entry node from a feature object.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>}  
*  
* Returns:  
* {DOMElement} an Atom entry node.  
*  
* These entries are geared for publication using AtomPub.  
*  
* TODO: support extension elements  
*/  
buildEntryNode: function(feature) {  
var attrib = feature.attributes;  
var atomAttrib = attrib.atom || {};  
var entryNode = this.createElementNSPlus("atom:entry");  
 
// atom:author  
if (atomAttrib.authors) {  
var authors = atomAttrib.authors instanceof Array ?  
atomAttrib.authors : [atomAttrib.authors];  
for (var i=0, ii=authors.length; i<ii; i++) {  
entryNode.appendChild(  
this.buildPersonConstructNode(  
"author", authors[i]  
)  
);  
}  
}  
 
// atom:category  
if (atomAttrib.categories) {  
var categories = atomAttrib.categories instanceof Array ?  
atomAttrib.categories : [atomAttrib.categories];  
var category;  
for (var i=0, ii=categories.length; i<ii; i++) {  
category = categories[i];  
entryNode.appendChild(  
this.createElementNSPlus("atom:category", {  
attributes: {  
term: category.term,  
scheme: category.scheme || null,  
label: category.label || null  
}  
})  
);  
}  
}  
 
// atom:content  
if (atomAttrib.content) {  
entryNode.appendChild(this.buildContentNode(atomAttrib.content));  
}  
 
// atom:contributor  
if (atomAttrib.contributors) {  
var contributors = atomAttrib.contributors instanceof Array ?  
atomAttrib.contributors : [atomAttrib.contributors];  
for (var i=0, ii=contributors.length; i<ii; i++) {  
entryNode.appendChild(  
this.buildPersonConstructNode(  
"contributor",  
contributors[i]  
)  
);  
}  
}  
 
// atom:id  
if (feature.fid) {  
entryNode.appendChild(  
this.createElementNSPlus("atom:id", {  
value: feature.fid  
})  
);  
}  
 
// atom:link  
if (atomAttrib.links) {  
var links = atomAttrib.links instanceof Array ?  
atomAttrib.links : [atomAttrib.links];  
var link;  
for (var i=0, ii=links.length; i<ii; i++) {  
link = links[i];  
entryNode.appendChild(  
this.createElementNSPlus("atom:link", {  
attributes: {  
href: link.href,  
rel: link.rel || null,  
type: link.type || null,  
hreflang: link.hreflang || null,  
title: link.title || null,  
length: link.length || null  
}  
})  
);  
}  
}  
 
// atom:published  
if (atomAttrib.published) {  
entryNode.appendChild(  
this.createElementNSPlus("atom:published", {  
value: atomAttrib.published  
})  
);  
}  
 
// atom:rights  
if (atomAttrib.rights) {  
entryNode.appendChild(  
this.createElementNSPlus("atom:rights", {  
value: atomAttrib.rights  
})  
);  
}  
 
// atom:source not implemented  
 
// atom:summary  
if (atomAttrib.summary || attrib.description) {  
entryNode.appendChild(  
this.createElementNSPlus("atom:summary", {  
value: atomAttrib.summary || attrib.description  
})  
);  
}  
 
// atom:title  
entryNode.appendChild(  
this.createElementNSPlus("atom:title", {  
value: atomAttrib.title || attrib.title || this.defaultEntryTitle  
})  
);  
 
// atom:updated  
if (atomAttrib.updated) {  
entryNode.appendChild(  
this.createElementNSPlus("atom:updated", {  
value: atomAttrib.updated  
})  
);  
}  
 
// georss:where  
if (feature.geometry) {  
var whereNode = this.createElementNSPlus("georss:where");  
whereNode.appendChild(  
this.buildGeometryNode(feature.geometry)  
);  
entryNode.appendChild(whereNode);  
}  
 
return entryNode;  
},  
 
/**  
* Method: initGmlParser  
* Creates a GML parser.  
*/  
initGmlParser: function() {  
this.gmlParser = new OpenLayers.Format.GML.v3({  
xy: this.xy,  
featureNS: "http://example.com#feature",  
internalProjection: this.internalProjection,  
externalProjection: this.externalProjection  
});  
},  
 
/**  
* Method: buildGeometryNode  
* builds a GeoRSS node with a given geometry  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry>}  
*  
* Returns:  
* {DOMElement} A gml node.  
*/  
buildGeometryNode: function(geometry) {  
if (!this.gmlParser) {  
this.initGmlParser();  
}  
var node = this.gmlParser.writeNode("feature:_geometry", geometry);  
return node.firstChild;  
},  
 
/**  
* Method: buildPersonConstructNode  
*  
* Parameters:  
* name - {String}  
* value - {Object}  
*  
* Returns:  
* {DOMElement} an Atom person construct node.  
*  
* Example:  
* >>> buildPersonConstructNode("author", {name: "John Smith"})  
* {<author><name>John Smith</name></author>}  
*  
* TODO: how to specify extension elements? Add to the oNames array?  
*/  
buildPersonConstructNode: function(name, value) {  
var oNames = ["uri", "email"];  
var personNode = this.createElementNSPlus("atom:" + name);  
personNode.appendChild(  
this.createElementNSPlus("atom:name", {  
value: value.name  
})  
);  
for (var i=0, ii=oNames.length; i<ii; i++) {  
if (value[oNames[i]]) {  
personNode.appendChild(  
this.createElementNSPlus("atom:" + oNames[i], {  
value: value[oNames[i]]  
})  
);  
}  
}  
return personNode;  
},  
 
/**  
* Method: getFirstChildValue  
*  
* Parameters:  
* node - {DOMElement}  
* nsuri - {String} Child node namespace uri ("*" for any).  
* name - {String} Child node name.  
* def - {String} Optional string default to return if no child found.  
*  
* Returns:  
* {String} The value of the first child with the given tag name. Returns  
* default value or empty string if none found.  
*/  
getFirstChildValue: function(node, nsuri, name, def) {  
var value;  
var nodes = this.getElementsByTagNameNS(node, nsuri, name);  
if (nodes && nodes.length > 0) {  
value = this.getChildValue(nodes[0], def);  
} else {  
value = def;  
}  
return value;  
},  
 
/**  
* Method: parseFeature  
* Parse feature from an Atom entry node..  
*  
* Parameters:  
* node - {DOMElement} An Atom entry or feed node.  
*  
* Returns:  
* An <OpenLayers.Feature.Vector>.  
*/  
parseFeature: function(node) {  
var atomAttrib = {};  
var value = null;  
var nodes = null;  
var attval = null;  
var atomns = this.namespaces.atom;  
 
// atomAuthor*  
this.parsePersonConstructs(node, "author", atomAttrib);  
 
// atomCategory*  
nodes = this.getElementsByTagNameNS(node, atomns, "category");  
if (nodes.length > 0) {  
atomAttrib.categories = [];  
}  
for (var i=0, ii=nodes.length; i<ii; i++) {  
value = {};  
value.term = nodes[i].getAttribute("term");  
attval = nodes[i].getAttribute("scheme");  
if (attval) { value.scheme = attval; }  
attval = nodes[i].getAttribute("label");  
if (attval) { value.label = attval; }  
atomAttrib.categories.push(value);  
}  
 
// atomContent?  
nodes = this.getElementsByTagNameNS(node, atomns, "content");  
if (nodes.length > 0) {  
value = {};  
attval = nodes[0].getAttribute("type");  
if (attval) {  
value.type = attval;  
}  
attval = nodes[0].getAttribute("src");  
if (attval) {  
value.src = attval;  
} else {  
if (value.type == "text" ||  
value.type == "html" ||  
value.type == null ) {  
value.value = this.getFirstChildValue(  
node,  
atomns,  
"content",  
null  
);  
} else if (value.type == "xhtml" ||  
value.type.match(/(\+|\/)xml$/)) {  
value.value = this.getChildEl(nodes[0]);  
} else { // MUST be base64 encoded  
value.value = this.getFirstChildValue(  
node,  
atomns,  
"content",  
null  
);  
}  
atomAttrib.content = value;  
}  
}  
 
// atomContributor*  
this.parsePersonConstructs(node, "contributor", atomAttrib);  
 
// atomId  
atomAttrib.id = this.getFirstChildValue(node, atomns, "id", null);  
 
// atomLink*  
nodes = this.getElementsByTagNameNS(node, atomns, "link");  
if (nodes.length > 0) {  
atomAttrib.links = new Array(nodes.length);  
}  
var oAtts = ["rel", "type", "hreflang", "title", "length"];  
for (var i=0, ii=nodes.length; i<ii; i++) {  
value = {};  
value.href = nodes[i].getAttribute("href");  
for (var j=0, jj=oAtts.length; j<jj; j++) {  
attval = nodes[i].getAttribute(oAtts[j]);  
if (attval) {  
value[oAtts[j]] = attval;  
}  
}  
atomAttrib.links[i] = value;  
}  
 
// atomPublished?  
value = this.getFirstChildValue(node, atomns, "published", null);  
if (value) {  
atomAttrib.published = value;  
}  
 
// atomRights?  
value = this.getFirstChildValue(node, atomns, "rights", null);  
if (value) {  
atomAttrib.rights = value;  
}  
 
// atomSource? -- not implemented  
 
// atomSummary?  
value = this.getFirstChildValue(node, atomns, "summary", null);  
if (value) {  
atomAttrib.summary = value;  
}  
 
// atomTitle  
atomAttrib.title = this.getFirstChildValue(  
node, atomns, "title", null  
);  
 
// atomUpdated  
atomAttrib.updated = this.getFirstChildValue(  
node, atomns, "updated", null  
);  
 
var featureAttrib = {  
title: atomAttrib.title,  
description: atomAttrib.summary,  
atom: atomAttrib  
};  
var geometry = this.parseLocations(node)[0];  
var feature = new OpenLayers.Feature.Vector(geometry, featureAttrib);  
feature.fid = atomAttrib.id;  
return feature;  
},  
 
/**  
* Method: parseFeatures  
* Return features from an Atom entry or feed.  
*  
* Parameters:  
* node - {DOMElement} An Atom entry or feed node.  
*  
* Returns:  
* An Array of <OpenLayers.Feature.Vector>s.  
*/  
parseFeatures: function(node) {  
var features = [];  
var entries = this.getElementsByTagNameNS(  
node, this.namespaces.atom, "entry"  
);  
if (entries.length == 0) {  
entries = [node];  
}  
for (var i=0, ii=entries.length; i<ii; i++) {  
features.push(this.parseFeature(entries[i]));  
}  
return features;  
},  
 
/**  
* Method: parseLocations  
* Parse the locations from an Atom entry or feed.  
*  
* Parameters:  
* node - {DOMElement} An Atom entry or feed node.  
*  
* Returns:  
* An Array of <OpenLayers.Geometry>s.  
*/  
parseLocations: function(node) {  
var georssns = this.namespaces.georss;  
 
var locations = {components: []};  
var where = this.getElementsByTagNameNS(node, georssns, "where");  
if (where && where.length > 0) {  
if (!this.gmlParser) {  
this.initGmlParser();  
}  
for (var i=0, ii=where.length; i<ii; i++) {  
this.gmlParser.readChildNodes(where[i], locations);  
}  
}  
 
var components = locations.components;  
var point = this.getElementsByTagNameNS(node, georssns, "point");  
if (point && point.length > 0) {  
for (var i=0, ii=point.length; i<ii; i++) {  
var xy = OpenLayers.String.trim(  
point[i].firstChild.nodeValue  
).split(/\s+/);  
if (xy.length !=2) {  
xy = OpenLayers.String.trim(  
point[i].firstChild.nodeValue  
).split(/\s*,\s*/);  
}  
components.push(  
new OpenLayers.Geometry.Point(  
parseFloat(xy[1]),  
parseFloat(xy[0])  
)  
);  
}  
}  
 
var line = this.getElementsByTagNameNS(node, georssns, "line");  
if (line && line.length > 0) {  
var coords;  
var p;  
var points;  
for (var i=0, ii=line.length; i<ii; i++) {  
coords = OpenLayers.String.trim(  
line[i].firstChild.nodeValue  
).split(/\s+/);  
points = [];  
for (var j=0, jj=coords.length; j<jj; j+=2) {  
p = new OpenLayers.Geometry.Point(  
parseFloat(coords[j+1]),  
parseFloat(coords[j])  
);  
points.push(p);  
}  
components.push(  
new OpenLayers.Geometry.LineString(points)  
);  
}  
}  
 
var polygon = this.getElementsByTagNameNS(node, georssns, "polygon");  
if (polygon && polygon.length > 0) {  
var coords;  
var p;  
var points;  
for (var i=0, ii=polygon.length; i<ii; i++) {  
coords = OpenLayers.String.trim(  
polygon[i].firstChild.nodeValue  
).split(/\s+/);  
points = [];  
for (var j=0, jj=coords.length; j<jj; j+=2) {  
p = new OpenLayers.Geometry.Point(  
parseFloat(coords[j+1]),  
parseFloat(coords[j])  
);  
points.push(p);  
}  
components.push(  
new OpenLayers.Geometry.Polygon(  
[new OpenLayers.Geometry.LinearRing(components)]  
)  
);  
}  
}  
 
if (this.internalProjection && this.externalProjection) {  
for (var i=0, ii=components.length; i<ii; i++) {  
if (components[i]) {  
components[i].transform(  
this.externalProjection,  
this.internalProjection  
);  
}  
}  
}  
 
return components;  
},  
 
/**  
* Method: parsePersonConstruct  
* Parse Atom person constructs from an Atom entry node.  
*  
* Parameters:  
* node - {DOMElement} An Atom entry or feed node.  
* name - {String} Construcy name ("author" or "contributor")  
* data = {Object} Object in which to put parsed persons.  
*  
* Returns:  
* An {Object}.  
*/  
parsePersonConstructs: function(node, name, data) {  
var persons = [];  
var atomns = this.namespaces.atom;  
var nodes = this.getElementsByTagNameNS(node, atomns, name);  
var oAtts = ["uri", "email"];  
for (var i=0, ii=nodes.length; i<ii; i++) {  
var value = {};  
value.name = this.getFirstChildValue(  
nodes[i],  
atomns,  
"name",  
null  
);  
for (var j=0, jj=oAtts.length; j<jj; j++) {  
var attval = this.getFirstChildValue(  
nodes[i],  
atomns,  
oAtts[j],  
null);  
if (attval) {  
value[oAtts[j]] = attval;  
}  
}  
persons.push(value);  
}  
if (persons.length > 0) {  
data[name + "s"] = persons;  
}  
},  
 
CLASS_NAME: "OpenLayers.Format.Atom"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format.js  
*/  
 
/**  
* Function: OpenLayers.Format.CSWGetDomain.  
* Default version is 2.0.2.  
*  
* Returns:  
* {<OpenLayers.Format>} A CSWGetDomain format of the given version.  
*/  
OpenLayers.Format.CSWGetDomain = function(options) {  
options = OpenLayers.Util.applyDefaults(  
options, OpenLayers.Format.CSWGetDomain.DEFAULTS  
);  
var cls = OpenLayers.Format.CSWGetDomain["v"+options.version.replace(/\./g, "_")];  
if(!cls) {  
throw "Unsupported CSWGetDomain version: " + options.version;  
}  
return new cls(options);  
};  
 
/**  
* Constant: OpenLayers.Format.CSWGetDomain.DEFAULTS  
* {Object} Default properties for the CSWGetDomain format.  
*/  
OpenLayers.Format.CSWGetDomain.DEFAULTS = {  
"version": "2.0.2"  
};  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/XML.js  
* @requires OpenLayers/Format/CSWGetDomain.js  
*/  
 
/**  
* Class: OpenLayers.Format.CSWGetDomain.v2_0_2  
* A format for creating CSWGetDomain v2.0.2 transactions.  
* Create a new instance with the  
* <OpenLayers.Format.CSWGetDomain.v2_0_2> constructor.  
*  
* Inherits from:  
* - <OpenLayers.Format.XML>  
*/  
OpenLayers.Format.CSWGetDomain.v2_0_2 = OpenLayers.Class(OpenLayers.Format.XML, {  
 
/**  
* Property: namespaces  
* {Object} Mapping of namespace aliases to namespace URIs.  
*/  
namespaces: {  
xlink: "http://www.w3.org/1999/xlink",  
xsi: "http://www.w3.org/2001/XMLSchema-instance",  
csw: "http://www.opengis.net/cat/csw/2.0.2"  
},  
 
/**  
* Property: defaultPrefix  
* {String} The default prefix (used by Format.XML).  
*/  
defaultPrefix: "csw",  
 
/**  
* Property: version  
* {String} CSW version number.  
*/  
version: "2.0.2",  
 
/**  
* Property: schemaLocation  
* {String} http://www.opengis.net/cat/csw/2.0.2  
* http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd  
*/  
schemaLocation: "http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd",  
 
/**  
* APIProperty: PropertyName  
* {String} Value of the csw:PropertyName element, used when  
* writing a GetDomain document.  
*/  
PropertyName: null,  
 
/**  
* APIProperty: ParameterName  
* {String} Value of the csw:ParameterName element, used when  
* writing a GetDomain document.  
*/  
ParameterName: null,  
 
/**  
* Constructor: OpenLayers.Format.CSWGetDomain.v2_0_2  
* A class for parsing and generating CSWGetDomain v2.0.2 transactions.  
*  
* Parameters:  
* options - {Object} Optional object whose properties will be set on the  
* instance.  
*  
* Valid options properties:  
* - PropertyName  
* - ParameterName  
*/  
initialize: function(options) {  
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* APIMethod: read  
* Parse the response from a GetDomain request.  
*/  
read: function(data) {  
if(typeof data == "string") {  
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);  
}  
if(data && data.nodeType == 9) {  
data = data.documentElement;  
}  
var obj = {};  
this.readNode(data, obj);  
return obj;  
},  
 
/**  
* Property: readers  
* Contains public functions, grouped by namespace prefix, that will  
* be applied when a namespaced node is found matching the function  
* name. The function will be applied in the scope of this parser  
* with two arguments: the node being read and a context object passed  
* from the parent.  
*/  
readers: {  
"csw": {  
"GetDomainResponse": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"DomainValues": function(node, obj) {  
if (!(obj.DomainValues instanceof Array)) {  
obj.DomainValues = [];  
}  
var attrs = node.attributes;  
var domainValue = {};  
for(var i=0, len=attrs.length; i<len; ++i) {  
domainValue[attrs[i].name] = attrs[i].nodeValue;  
}  
this.readChildNodes(node, domainValue);  
obj.DomainValues.push(domainValue);  
},  
"PropertyName": function(node, obj) {  
obj.PropertyName = this.getChildValue(node);  
},  
"ParameterName": function(node, obj) {  
obj.ParameterName = this.getChildValue(node);  
},  
"ListOfValues": function(node, obj) {  
if (!(obj.ListOfValues instanceof Array)) {  
obj.ListOfValues = [];  
}  
this.readChildNodes(node, obj.ListOfValues);  
},  
"Value": function(node, obj) {  
var attrs = node.attributes;  
var value = {}  
for(var i=0, len=attrs.length; i<len; ++i) {  
value[attrs[i].name] = attrs[i].nodeValue;  
}  
value.value = this.getChildValue(node);  
obj.push({Value: value});  
},  
"ConceptualScheme": function(node, obj) {  
obj.ConceptualScheme = {};  
this.readChildNodes(node, obj.ConceptualScheme);  
},  
"Name": function(node, obj) {  
obj.Name = this.getChildValue(node);  
},  
"Document": function(node, obj) {  
obj.Document = this.getChildValue(node);  
},  
"Authority": function(node, obj) {  
obj.Authority = this.getChildValue(node);  
},  
"RangeOfValues": function(node, obj) {  
obj.RangeOfValues = {};  
this.readChildNodes(node, obj.RangeOfValues);  
},  
"MinValue": function(node, obj) {  
var attrs = node.attributes;  
var value = {}  
for(var i=0, len=attrs.length; i<len; ++i) {  
value[attrs[i].name] = attrs[i].nodeValue;  
}  
value.value = this.getChildValue(node);  
obj.MinValue = value;  
},  
"MaxValue": function(node, obj) {  
var attrs = node.attributes;  
var value = {}  
for(var i=0, len=attrs.length; i<len; ++i) {  
value[attrs[i].name] = attrs[i].nodeValue;  
}  
value.value = this.getChildValue(node);  
obj.MaxValue = value;  
}  
}  
},  
 
/**  
* APIMethod: write  
* Given an configuration js object, write a CSWGetDomain request.  
*  
* Parameters:  
* options - {Object} A object mapping the request.  
*  
* Returns:  
* {String} A serialized CSWGetDomain request.  
*/  
write: function(options) {  
var node = this.writeNode("csw:GetDomain", options);  
return OpenLayers.Format.XML.prototype.write.apply(this, [node]);  
},  
 
/**  
* Property: writers  
* As a compliment to the readers property, this structure contains public  
* writing functions grouped by namespace alias and named like the  
* node names they produce.  
*/  
writers: {  
"csw": {  
"GetDomain": function(options) {  
var node = this.createElementNSPlus("csw:GetDomain", {  
attributes: {  
service: "CSW",  
version: this.version  
}  
});  
if (options.PropertyName || this.PropertyName) {  
this.writeNode(  
"csw:PropertyName",  
options.PropertyName || this.PropertyName,  
node  
);  
} else if (options.ParameterName || this.ParameterName) {  
this.writeNode(  
"csw:ParameterName",  
options.ParameterName || this.ParameterName,  
node  
);  
}  
this.readChildNodes(node, options);  
return node;  
},  
"PropertyName": function(value) {  
var node = this.createElementNSPlus("csw:PropertyName", {  
value: value  
});  
return node;  
},  
"ParameterName": function(value) {  
var node = this.createElementNSPlus("csw:ParameterName", {  
value: value  
});  
return node;  
}  
}  
},  
 
CLASS_NAME: "OpenLayers.Format.CSWGetDomain.v2_0_2"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format.js  
*/  
 
/**  
* Function: OpenLayers.Format.CSWGetRecords.  
* Default version is 2.0.2.  
*  
* Returns:  
* {<OpenLayers.Format>} A CSWGetRecords format of the given version.  
*/  
OpenLayers.Format.CSWGetRecords = function(options) {  
options = OpenLayers.Util.applyDefaults(  
options, OpenLayers.Format.CSWGetRecords.DEFAULTS  
);  
var cls = OpenLayers.Format.CSWGetRecords["v"+options.version.replace(/\./g, "_")];  
if(!cls) {  
throw "Unsupported CSWGetRecords version: " + options.version;  
}  
return new cls(options);  
};  
 
/**  
* Constant: OpenLayers.Format.CSWGetRecords.DEFAULTS  
* {Object} Default properties for the CSWGetRecords format.  
*/  
OpenLayers.Format.CSWGetRecords.DEFAULTS = {  
"version": "2.0.2"  
};  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/XML.js  
* @requires OpenLayers/Format/CSWGetRecords.js  
* @requires OpenLayers/Format/Filter/v1_0_0.js  
* @requires OpenLayers/Format/Filter/v1_1_0.js  
* @requires OpenLayers/Format/OWSCommon/v1_0_0.js  
*/  
 
/**  
* Class: OpenLayers.Format.CSWGetRecords.v2_0_2  
* A format for creating CSWGetRecords v2.0.2 transactions.  
* Create a new instance with the  
* <OpenLayers.Format.CSWGetRecords.v2_0_2> constructor.  
*  
* Inherits from:  
* - <OpenLayers.Format.XML>  
*/  
OpenLayers.Format.CSWGetRecords.v2_0_2 = OpenLayers.Class(OpenLayers.Format.XML, {  
 
/**  
* Property: namespaces  
* {Object} Mapping of namespace aliases to namespace URIs.  
*/  
namespaces: {  
xlink: "http://www.w3.org/1999/xlink",  
xsi: "http://www.w3.org/2001/XMLSchema-instance",  
csw: "http://www.opengis.net/cat/csw/2.0.2",  
dc: "http://purl.org/dc/elements/1.1/",  
dct: "http://purl.org/dc/terms/",  
ows: "http://www.opengis.net/ows"  
},  
 
/**  
* Property: defaultPrefix  
* {String} The default prefix (used by Format.XML).  
*/  
defaultPrefix: "csw",  
 
/**  
* Property: version  
* {String} CSW version number.  
*/  
version: "2.0.2",  
 
/**  
* Property: schemaLocation  
* {String} http://www.opengis.net/cat/csw/2.0.2  
* http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd  
*/  
schemaLocation: "http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd",  
 
/**  
* APIProperty: requestId  
* {String} Value of the requestId attribute of the GetRecords element.  
*/  
requestId: null,  
 
/**  
* APIProperty: resultType  
* {String} Value of the resultType attribute of the GetRecords element,  
* specifies the result type in the GetRecords response, "hits" is  
* the default.  
*/  
resultType: null,  
 
/**  
* APIProperty: outputFormat  
* {String} Value of the outputFormat attribute of the GetRecords element,  
* specifies the format of the GetRecords response,  
* "application/xml" is the default.  
*/  
outputFormat: null,  
 
/**  
* APIProperty: outputSchema  
* {String} Value of the outputSchema attribute of the GetRecords element,  
* specifies the schema of the GetRecords response.  
*/  
outputSchema: null,  
 
/**  
* APIProperty: startPosition  
* {String} Value of the startPosition attribute of the GetRecords element,  
* specifies the start position (offset+1) for the GetRecords response,  
* 1 is the default.  
*/  
startPosition: null,  
 
/**  
* APIProperty: maxRecords  
* {String} Value of the maxRecords attribute of the GetRecords element,  
* specifies the maximum number of records in the GetRecords response,  
* 10 is the default.  
*/  
maxRecords: null,  
 
/**  
* APIProperty: DistributedSearch  
* {String} Value of the csw:DistributedSearch element, used when writing  
* a csw:GetRecords document.  
*/  
DistributedSearch: null,  
 
/**  
* APIProperty: ResponseHandler  
* {Array({String})} Values of the csw:ResponseHandler elements, used when  
* writting a csw:GetRecords document.  
*/  
ResponseHandler: null,  
 
/**  
* APIProperty: Query  
* {String} Value of the csw:Query element, used when writing a csw:GetRecords  
* document.  
*/  
Query: null,  
 
/**  
* Property: regExes  
* Compiled regular expressions for manipulating strings.  
*/  
regExes: {  
trimSpace: (/^\s*|\s*$/g),  
removeSpace: (/\s*/g),  
splitSpace: (/\s+/),  
trimComma: (/\s*,\s*/g)  
},  
 
/**  
* Constructor: OpenLayers.Format.CSWGetRecords.v2_0_2  
* A class for parsing and generating CSWGetRecords v2.0.2 transactions.  
*  
* Parameters:  
* options - {Object} Optional object whose properties will be set on the  
* instance.  
*  
* Valid options properties (documented as class properties):  
* - requestId  
* - resultType  
* - outputFormat  
* - outputSchema  
* - startPosition  
* - maxRecords  
* - DistributedSearch  
* - ResponseHandler  
* - Query  
*/  
initialize: function(options) {  
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* APIMethod: read  
* Parse the response from a GetRecords request.  
*/  
read: function(data) {  
if(typeof data == "string") {  
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);  
}  
if(data && data.nodeType == 9) {  
data = data.documentElement;  
}  
var obj = {};  
this.readNode(data, obj);  
return obj;  
},  
 
/**  
* Property: readers  
* Contains public functions, grouped by namespace prefix, that will  
* be applied when a namespaced node is found matching the function  
* name. The function will be applied in the scope of this parser  
* with two arguments: the node being read and a context object passed  
* from the parent.  
*/  
readers: {  
"csw": {  
"GetRecordsResponse": function(node, obj) {  
obj.records = [];  
this.readChildNodes(node, obj);  
var version = this.getAttributeNS(node, "", 'version');  
if (version != "") {  
obj.version = version;  
}  
},  
"RequestId": function(node, obj) {  
obj.RequestId = this.getChildValue(node);  
},  
"SearchStatus": function(node, obj) {  
obj.SearchStatus = {};  
var timestamp = this.getAttributeNS(node, "", 'timestamp');  
if (timestamp != "") {  
obj.SearchStatus.timestamp = timestamp;  
}  
},  
"SearchResults": function(node, obj) {  
this.readChildNodes(node, obj);  
var attrs = node.attributes;  
var SearchResults = {};  
for(var i=0, len=attrs.length; i<len; ++i) {  
if ((attrs[i].name == "numberOfRecordsMatched") ||  
(attrs[i].name == "numberOfRecordsReturned") ||  
(attrs[i].name == "nextRecord")) {  
SearchResults[attrs[i].name] = parseInt(attrs[i].nodeValue);  
} else {  
SearchResults[attrs[i].name] = attrs[i].nodeValue;  
}  
}  
obj.SearchResults = SearchResults;  
},  
"SummaryRecord": function(node, obj) {  
var record = {type: "SummaryRecord"};  
this.readChildNodes(node, record);  
obj.records.push(record);  
},  
"BriefRecord": function(node, obj) {  
var record = {type: "BriefRecord"};  
this.readChildNodes(node, record);  
obj.records.push(record);  
},  
"DCMIRecord": function(node, obj) {  
var record = {type: "DCMIRecord"};  
this.readChildNodes(node, record);  
obj.records.push(record);  
},  
"Record": function(node, obj) {  
var record = {type: "Record"};  
this.readChildNodes(node, record);  
obj.records.push(record);  
}  
},  
"dc": {  
// audience, contributor, coverage, creator, date, description, format,  
// identifier, language, provenance, publisher, relation, rights,  
// rightsHolder, source, subject, title, type, URI  
"*": function(node, obj) {  
var name = node.localName || node.nodeName.split(":").pop();  
if (!(obj[name] instanceof Array)) {  
obj[name] = new Array();  
}  
var dc_element = {};  
var attrs = node.attributes;  
for(var i=0, len=attrs.length; i<len; ++i) {  
dc_element[attrs[i].name] = attrs[i].nodeValue;  
}  
dc_element.value = this.getChildValue(node);  
obj[name].push(dc_element);  
}  
},  
"dct": {  
// abstract, modified, spatial  
"*": function(node, obj) {  
var name = node.localName || node.nodeName.split(":").pop();  
if (!(obj[name] instanceof Array)) {  
obj[name] = new Array();  
}  
obj[name].push(this.getChildValue(node));  
}  
},  
"ows": OpenLayers.Util.applyDefaults({  
"BoundingBox": function(node, obj) {  
if (obj.bounds) {  
obj.BoundingBox = [{crs: obj.projection, value:  
[  
obj.bounds.left,  
obj.bounds.bottom,  
obj.bounds.right,  
obj.bounds.top  
]  
}];  
delete obj.projection;  
delete obj.bounds;  
}  
OpenLayers.Format.OWSCommon.v1_0_0.prototype.readers["ows"]["BoundingBox"].apply(  
this, arguments);  
}  
}, OpenLayers.Format.OWSCommon.v1_0_0.prototype.readers["ows"])  
},  
 
/**  
* Method: write  
* Given an configuration js object, write a CSWGetRecords request.  
*  
* Parameters:  
* options - {Object} A object mapping the request.  
*  
* Returns:  
* {String} A serialized CSWGetRecords request.  
*/  
write: function(options) {  
var node = this.writeNode("csw:GetRecords", options);  
return OpenLayers.Format.XML.prototype.write.apply(this, [node]);  
},  
 
/**  
* Property: writers  
* As a compliment to the readers property, this structure contains public  
* writing functions grouped by namespace alias and named like the  
* node names they produce.  
*/  
writers: {  
"csw": {  
"GetRecords": function(options) {  
if (!options) {  
options = {};  
}  
var node = this.createElementNSPlus("csw:GetRecords", {  
attributes: {  
service: "CSW",  
version: this.version,  
requestId: options.requestId || this.requestId,  
resultType: options.resultType || this.resultType,  
outputFormat: options.outputFormat || this.outputFormat,  
outputSchema: options.outputSchema || this.outputSchema,  
startPosition: options.startPosition || this.startPosition,  
maxRecords: options.maxRecords || this.maxRecords  
}  
});  
if (options.DistributedSearch || this.DistributedSearch) {  
this.writeNode(  
"csw:DistributedSearch",  
options.DistributedSearch || this.DistributedSearch,  
node  
);  
}  
var ResponseHandler = options.ResponseHandler || this.ResponseHandler;  
if (ResponseHandler instanceof Array && ResponseHandler.length > 0) {  
// ResponseHandler must be a non-empty array  
for(var i=0, len=ResponseHandler.length; i<len; i++) {  
this.writeNode(  
"csw:ResponseHandler",  
ResponseHandler[i],  
node  
);  
}  
}  
this.writeNode("Query", options.Query || this.Query, node);  
return node;  
},  
"DistributedSearch": function(options) {  
var node = this.createElementNSPlus("csw:DistributedSearch", {  
attributes: {  
hopCount: options.hopCount  
}  
});  
return node;  
},  
"ResponseHandler": function(options) {  
var node = this.createElementNSPlus("csw:ResponseHandler", {  
value: options.value  
});  
return node;  
},  
"Query": function(options) {  
if (!options) {  
options = {};  
}  
var node = this.createElementNSPlus("csw:Query", {  
attributes: {  
typeNames: options.typeNames || "csw:Record"  
}  
});  
var ElementName = options.ElementName;  
if (ElementName instanceof Array && ElementName.length > 0) {  
// ElementName must be a non-empty array  
for(var i=0, len=ElementName.length; i<len; i++) {  
this.writeNode(  
"csw:ElementName",  
ElementName[i],  
node  
);  
}  
} else {  
this.writeNode(  
"csw:ElementSetName",  
options.ElementSetName || {value: 'summary'},  
node  
);  
}  
if (options.Constraint) {  
this.writeNode(  
"csw:Constraint",  
options.Constraint,  
node  
);  
}  
//TODO: not implemented in ogc filters?  
//if (options.SortBy) {  
//this.writeNode(  
//"ogc:SortBy",  
//options.SortBy,  
//node  
//);  
//}  
return node;  
},  
"ElementName": function(options) {  
var node = this.createElementNSPlus("csw:ElementName", {  
value: options.value  
});  
return node;  
},  
"ElementSetName": function(options) {  
var node = this.createElementNSPlus("csw:ElementSetName", {  
attributes: {  
typeNames: options.typeNames  
},  
value: options.value  
});  
return node;  
},  
"Constraint": function(options) {  
var node = this.createElementNSPlus("csw:Constraint", {  
attributes: {  
version: options.version  
}  
});  
if (options.Filter) {  
var format = new OpenLayers.Format.Filter({  
version: options.version  
});  
node.appendChild(format.write(options.Filter));  
} else if (options.CqlText) {  
var child = this.createElementNSPlus("CqlText", {  
value: options.CqlText.value  
});  
node.appendChild(child);  
}  
return node;  
}  
}  
},  
 
CLASS_NAME: "OpenLayers.Format.CSWGetRecords.v2_0_2"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/XML.js  
*/  
 
/**  
* Class: OpenLayers.Format.Context  
* Base class for both Format.WMC and Format.OWSContext  
*/  
OpenLayers.Format.Context = OpenLayers.Class({  
 
/**  
* APIProperty: version  
* {String} Specify a version string if one is known.  
*/  
version: null,  
 
/**  
* Property: layerOptions  
* {Object} Default options for layers created by the parser. These  
* options are overridden by the options which are read from the  
* capabilities document.  
*/  
layerOptions: null,  
 
/**  
* Property: layerParams  
* {Object} Default parameters for layers created by the parser. This  
* can be used e.g. to override DEFAULT_PARAMS for  
* OpenLayers.Layer.WMS.  
*/  
layerParams: null,  
 
/**  
* Property: parser  
* {Object} Instance of the versioned parser. Cached for multiple read and  
* write calls of the same version.  
*/  
parser: null,  
 
/**  
* Constructor: OpenLayers.Format.Context  
* Create a new parser for Context documents.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*/  
initialize: function(options) {  
OpenLayers.Util.extend(this, options);  
this.options = options;  
},  
 
/**  
* APIMethod: read  
* Read Context data from a string, and return an object with map  
* properties and a list of layers.  
*  
* Parameters:  
* data - {String} or {DOMElement} data to read/parse.  
* options - {Object} The options object must contain a map property. If  
* the map property is a string, it must be the id of a dom element  
* where the new map will be placed. If the map property is an  
* <OpenLayers.Map>, the layers from the context document will be added  
* to the map.  
*  
* Returns:  
* {<OpenLayers.Map>} A map based on the context.  
*/  
read: function(data, options) {  
if(typeof data == "string") {  
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);  
}  
var root = data.documentElement;  
var version = this.version;  
if(!version) {  
version = root.getAttribute("version");  
}  
var parser = this.getParser(version);  
var context = parser.read(data, options);  
var map;  
if(options && options.map) {  
this.context = context;  
if(options.map instanceof OpenLayers.Map) {  
map = this.mergeContextToMap(context, options.map);  
} else {  
var mapOptions = options.map;  
if(OpenLayers.Util.isElement(mapOptions) ||  
typeof mapOptions == "string") {  
// we assume mapOptions references a div  
// element  
mapOptions = {div: mapOptions};  
}  
map = this.contextToMap(context, mapOptions);  
}  
} else {  
// not documented as part of the API, provided as a non-API option  
map = context;  
}  
return map;  
},  
 
/**  
* Method: getLayerFromContext  
* Create a WMS layer from a layerContext object.  
*  
* Parameters:  
* layerContext - {Object} An object representing a WMS layer.  
*  
* Returns:  
* {<OpenLayers.Layer.WMS>} A WMS layer.  
*/  
getLayerFromContext: function(layerContext) {  
var i, len;  
// fill initial options object from layerContext  
var options = {  
queryable: layerContext.queryable, //keep queryable for api compatibility  
visibility: layerContext.visibility,  
maxExtent: layerContext.maxExtent,  
metadata: OpenLayers.Util.applyDefaults(layerContext.metadata,  
{styles: layerContext.styles}),  
numZoomLevels: layerContext.numZoomLevels,  
units: layerContext.units,  
isBaseLayer: layerContext.isBaseLayer,  
opacity: layerContext.opacity,  
displayInLayerSwitcher: layerContext.displayInLayerSwitcher,  
singleTile: layerContext.singleTile,  
tileSize: (layerContext.tileSize) ?  
new OpenLayers.Size(  
layerContext.tileSize.width,  
layerContext.tileSize.height  
) : undefined,  
minScale: layerContext.minScale || layerContext.maxScaleDenominator,  
maxScale: layerContext.maxScale || layerContext.minScaleDenominator  
};  
if (this.layerOptions) {  
OpenLayers.Util.applyDefaults(options, this.layerOptions);  
}  
 
var params = {  
layers: layerContext.name,  
transparent: layerContext.transparent,  
version: layerContext.version  
};  
if (layerContext.formats && layerContext.formats.length>0) {  
// set default value for params if current attribute is not positionned  
params.format = layerContext.formats[0].value;  
for (i=0, len=layerContext.formats.length; i<len; i++) {  
var format = layerContext.formats[i];  
if (format.current == true) {  
params.format = format.value;  
break;  
}  
}  
}  
if (layerContext.styles && layerContext.styles.length>0) {  
for (i=0, len=layerContext.styles.length; i<len; i++) {  
var style = layerContext.styles[i];  
if (style.current == true) {  
// three style types to consider  
// 1) linked SLD  
// 2) inline SLD  
// 3) named style  
if(style.href) {  
params.sld = style.href;  
} else if(style.body) {  
params.sld_body = style.body;  
} else {  
params.styles = style.name;  
}  
break;  
}  
}  
}  
if (this.layerParams) {  
OpenLayers.Util.applyDefaults(params, this.layerParams);  
}  
 
var layer = null;  
var service = layerContext.service;  
if (service == OpenLayers.Format.Context.serviceTypes.WFS) {  
options.strategies = [new OpenLayers.Strategy.BBOX()];  
options.protocol = new OpenLayers.Protocol.WFS({  
url: layerContext.url,  
// since we do not know featureNS, let the protocol  
// determine it automagically using featurePrefix  
featurePrefix: layerContext.name.split(":")[0],  
featureType: layerContext.name.split(":").pop()  
});  
layer = new OpenLayers.Layer.Vector(  
layerContext.title || layerContext.name,  
options  
);  
} else if (service == OpenLayers.Format.Context.serviceTypes.KML) {  
// use a vector layer with an HTTP Protcol and a Fixed strategy  
options.strategies = [new OpenLayers.Strategy.Fixed()];  
options.protocol = new OpenLayers.Protocol.HTTP({  
url: layerContext.url,  
format: new OpenLayers.Format.KML()  
});  
layer = new OpenLayers.Layer.Vector(  
layerContext.title || layerContext.name,  
options  
);  
} else if (service == OpenLayers.Format.Context.serviceTypes.GML) {  
// use a vector layer with a HTTP Protocol and a Fixed strategy  
options.strategies = [new OpenLayers.Strategy.Fixed()];  
options.protocol = new OpenLayers.Protocol.HTTP({  
url: layerContext.url,  
format: new OpenLayers.Format.GML()  
});  
layer = new OpenLayers.Layer.Vector(  
layerContext.title || layerContext.name,  
options  
);  
} else if (layerContext.features) {  
// inline GML or KML features  
layer = new OpenLayers.Layer.Vector(  
layerContext.title || layerContext.name,  
options  
);  
layer.addFeatures(layerContext.features);  
} else if (layerContext.categoryLayer !== true) {  
layer = new OpenLayers.Layer.WMS(  
layerContext.title || layerContext.name,  
layerContext.url,  
params,  
options  
);  
}  
return layer;  
},  
 
/**  
* Method: getLayersFromContext  
* Create an array of layers from an array of layerContext objects.  
*  
* Parameters:  
* layersContext - {Array(Object)} An array of objects representing layers.  
*  
* Returns:  
* {Array(<OpenLayers.Layer>)} An array of layers.  
*/  
getLayersFromContext: function(layersContext) {  
var layers = [];  
for (var i=0, len=layersContext.length; i<len; i++) {  
var layer = this.getLayerFromContext(layersContext[i]);  
if (layer !== null) {  
layers.push(layer);  
}  
}  
return layers;  
},  
 
/**  
* Method: contextToMap  
* Create a map given a context object.  
*  
* Parameters:  
* context - {Object} The context object.  
* options - {Object} Default map options.  
*  
* Returns:  
* {<OpenLayers.Map>} A map based on the context object.  
*/  
contextToMap: function(context, options) {  
options = OpenLayers.Util.applyDefaults({  
maxExtent: context.maxExtent,  
projection: context.projection  
}, options);  
var map = new OpenLayers.Map(options);  
map.addLayers(this.getLayersFromContext(context.layersContext));  
map.setCenter(  
context.bounds.getCenterLonLat(),  
map.getZoomForExtent(context.bounds, true)  
);  
return map;  
},  
 
/**  
* Method: mergeContextToMap  
* Add layers from a context object to a map.  
*  
* Parameters:  
* context - {Object} The context object.  
* map - {<OpenLayers.Map>} The map.  
*  
* Returns:  
* {<OpenLayers.Map>} The same map with layers added.  
*/  
mergeContextToMap: function(context, map) {  
map.addLayers(this.getLayersFromContext(context.layersContext));  
return map;  
},  
 
/**  
* APIMethod: write  
* Write a context document given a map.  
*  
* Parameters:  
* obj - {<OpenLayers.Map> | Object} A map or context object.  
* options - {Object} Optional configuration object.  
*  
* Returns:  
* {String} A context document string.  
*/  
write: function(obj, options) {  
obj = this.toContext(obj);  
var version = options && options.version;  
var parser = this.getParser(version);  
var context = parser.write(obj, options);  
return context;  
},  
 
CLASS_NAME: "OpenLayers.Format.Context"  
});  
 
/**  
* Constant: OpenLayers.Format.Context.serviceTypes  
* Enumeration for service types  
*/  
OpenLayers.Format.Context.serviceTypes = {  
"WMS": "urn:ogc:serviceType:WMS",  
"WFS": "urn:ogc:serviceType:WFS",  
"WCS": "urn:ogc:serviceType:WCS",  
"GML": "urn:ogc:serviceType:GML",  
"SLD": "urn:ogc:serviceType:SLD",  
"FES": "urn:ogc:serviceType:FES",  
"KML": "urn:ogc:serviceType:KML"  
};  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/XML.js  
* @requires OpenLayers/Filter/FeatureId.js  
* @requires OpenLayers/Filter/Logical.js  
* @requires OpenLayers/Filter/Comparison.js  
*/  
 
/**  
* Class: OpenLayers.Format.Filter  
* Read/Wite ogc:Filter. Create a new instance with the <OpenLayers.Format.Filter>  
* constructor.  
*  
* Inherits from:  
* - <OpenLayers.Format.XML>  
*/  
OpenLayers.Format.Filter = OpenLayers.Class(OpenLayers.Format.XML, {  
 
/**  
* APIProperty: defaultVersion  
* {String} Version number to assume if none found. Default is "1.0.0".  
*/  
defaultVersion: "1.0.0",  
 
/**  
* APIProperty: version  
* {String} Specify a version string if one is known.  
*/  
version: null,  
 
/**  
* Property: parser  
* {Object} Instance of the versioned parser. Cached for multiple read and  
* write calls of the same version.  
*/  
parser: null,  
 
/**  
* Constructor: OpenLayers.Format.Filter  
* Create a new parser for Filter.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*/  
initialize: function(options) {  
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* APIMethod: write  
* Write an ogc:Filter given a filter object.  
*  
* Parameters:  
* filter - {<OpenLayers.Filter>} An filter.  
* options - {Object} Optional configuration object.  
*  
* Returns:  
* {Elment} An ogc:Filter element node.  
*/  
write: function(filter, options) {  
var version = (options && options.version) ||  
this.version || this.defaultVersion;  
if(!this.parser || this.parser.VERSION != version) {  
var format = OpenLayers.Format.Filter[  
"v" + version.replace(/\./g, "_")  
];  
if(!format) {  
throw "Can't find a Filter parser for version " +  
version;  
}  
this.parser = new format(this.options);  
}  
return this.parser.write(filter);  
//return OpenLayers.Format.XML.prototype.write.apply(this, [root]);  
},  
 
/**  
* APIMethod: read  
* Read and Filter doc and return an object representing the Filter.  
*  
* Parameters:  
* data - {String | DOMElement} Data to read.  
*  
* Returns:  
* {<OpenLayers.Filter>} A filter object.  
*/  
read: function(data) {  
if(typeof data == "string") {  
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);  
}  
var version = this.version;  
if(!version) {  
version = this.defaultVersion;  
}  
if(!this.parser || this.parser.VERSION != version) {  
var format = OpenLayers.Format.Filter[  
"v" + version.replace(/\./g, "_")  
];  
if(!format) {  
throw "Can't find a Filter parser for version " +  
version;  
}  
this.parser = new format(this.options);  
}  
var filter = this.parser.read(data);  
return filter;  
},  
 
CLASS_NAME: "OpenLayers.Format.Filter"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
/**  
* @requires OpenLayers/Format/Filter.js  
* @requires OpenLayers/Format/XML.js  
*/  
 
/**  
* Class: OpenLayers.Format.Filter.v1  
* Superclass for Filter version 1 parsers.  
*  
* Inherits from:  
* - <OpenLayers.Format.XML>  
*/  
OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {  
 
/**  
* Property: namespaces  
* {Object} Mapping of namespace aliases to namespace URIs.  
*/  
namespaces: {  
ogc: "http://www.opengis.net/ogc",  
gml: "http://www.opengis.net/gml",  
xlink: "http://www.w3.org/1999/xlink",  
xsi: "http://www.w3.org/2001/XMLSchema-instance"  
},  
 
/**  
* Property: defaultPrefix  
*/  
defaultPrefix: "ogc",  
 
/**  
* Property: schemaLocation  
* {String} Schema location for a particular minor version.  
*/  
schemaLocation: null,  
 
/**  
* Constructor: OpenLayers.Format.Filter.v1  
* Instances of this class are not created directly. Use the  
* <OpenLayers.Format.Filter> constructor instead.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*/  
initialize: function(options) {  
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* Method: read  
*  
* Parameters:  
* data - {DOMElement} A Filter document element.  
*  
* Returns:  
* {<OpenLayers.Filter>} A filter object.  
*/  
read: function(data) {  
var obj = {};  
this.readers.ogc["Filter"].apply(this, [data, obj]);  
return obj.filter;  
},  
 
/**  
* Property: readers  
* Contains public functions, grouped by namespace prefix, that will  
* be applied when a namespaced node is found matching the function  
* name. The function will be applied in the scope of this parser  
* with two arguments: the node being read and a context object passed  
* from the parent.  
*/  
readers: {  
"ogc": {  
"Filter": function(node, parent) {  
// Filters correspond to subclasses of OpenLayers.Filter.  
// Since they contain information we don't persist, we  
// create a temporary object and then pass on the filter  
// (ogc:Filter) to the parent obj.  
var obj = {  
fids: [],  
filters: []  
};  
this.readChildNodes(node, obj);  
if(obj.fids.length > 0) {  
parent.filter = new OpenLayers.Filter.FeatureId({  
fids: obj.fids  
});  
} else if(obj.filters.length > 0) {  
parent.filter = obj.filters[0];  
}  
},  
"FeatureId": function(node, obj) {  
var fid = node.getAttribute("fid");  
if(fid) {  
obj.fids.push(fid);  
}  
},  
"And": function(node, obj) {  
var filter = new OpenLayers.Filter.Logical({  
type: OpenLayers.Filter.Logical.AND  
});  
this.readChildNodes(node, filter);  
obj.filters.push(filter);  
},  
"Or": function(node, obj) {  
var filter = new OpenLayers.Filter.Logical({  
type: OpenLayers.Filter.Logical.OR  
});  
this.readChildNodes(node, filter);  
obj.filters.push(filter);  
},  
"Not": function(node, obj) {  
var filter = new OpenLayers.Filter.Logical({  
type: OpenLayers.Filter.Logical.NOT  
});  
this.readChildNodes(node, filter);  
obj.filters.push(filter);  
},  
"PropertyIsLessThan": function(node, obj) {  
var filter = new OpenLayers.Filter.Comparison({  
type: OpenLayers.Filter.Comparison.LESS_THAN  
});  
this.readChildNodes(node, filter);  
obj.filters.push(filter);  
},  
"PropertyIsGreaterThan": function(node, obj) {  
var filter = new OpenLayers.Filter.Comparison({  
type: OpenLayers.Filter.Comparison.GREATER_THAN  
});  
this.readChildNodes(node, filter);  
obj.filters.push(filter);  
},  
"PropertyIsLessThanOrEqualTo": function(node, obj) {  
var filter = new OpenLayers.Filter.Comparison({  
type: OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO  
});  
this.readChildNodes(node, filter);  
obj.filters.push(filter);  
},  
"PropertyIsGreaterThanOrEqualTo": function(node, obj) {  
var filter = new OpenLayers.Filter.Comparison({  
type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO  
});  
this.readChildNodes(node, filter);  
obj.filters.push(filter);  
},  
"PropertyIsBetween": function(node, obj) {  
var filter = new OpenLayers.Filter.Comparison({  
type: OpenLayers.Filter.Comparison.BETWEEN  
});  
this.readChildNodes(node, filter);  
obj.filters.push(filter);  
},  
"Literal": function(node, obj) {  
obj.value = OpenLayers.String.numericIf(  
this.getChildValue(node));  
},  
"PropertyName": function(node, filter) {  
filter.property = this.getChildValue(node);  
},  
"LowerBoundary": function(node, filter) {  
filter.lowerBoundary = OpenLayers.String.numericIf(  
this.readOgcExpression(node));  
},  
"UpperBoundary": function(node, filter) {  
filter.upperBoundary = OpenLayers.String.numericIf(  
this.readOgcExpression(node));  
},  
"Intersects": function(node, obj) {  
this.readSpatial(node, obj, OpenLayers.Filter.Spatial.INTERSECTS);  
},  
"Within": function(node, obj) {  
this.readSpatial(node, obj, OpenLayers.Filter.Spatial.WITHIN);  
},  
"Contains": function(node, obj) {  
this.readSpatial(node, obj, OpenLayers.Filter.Spatial.CONTAINS);  
},  
"DWithin": function(node, obj) {  
this.readSpatial(node, obj, OpenLayers.Filter.Spatial.DWITHIN);  
},  
"Distance": function(node, obj) {  
obj.distance = parseInt(this.getChildValue(node));  
obj.distanceUnits = node.getAttribute("units");  
}  
}  
},  
 
/**  
* Method: readSpatial  
*  
* Read a {<OpenLayers.Filter.Spatial>} filter.  
*  
* Parameters:  
* node - {DOMElement} A DOM element that contains an ogc:expression.  
* obj - {Object} The target object.  
* type - {String} One of the OpenLayers.Filter.Spatial.* constants.  
*  
* Returns:  
* {<OpenLayers.Filter.Spatial>} The created filter.  
*/  
readSpatial: function(node, obj, type) {  
var filter = new OpenLayers.Filter.Spatial({  
type: type  
});  
this.readChildNodes(node, filter);  
filter.value = filter.components[0];  
delete filter.components;  
obj.filters.push(filter);  
},  
 
/**  
* Method: readOgcExpression  
* Limited support for OGC expressions.  
*  
* Parameters:  
* node - {DOMElement} A DOM element that contains an ogc:expression.  
*  
* Returns:  
* {String} A value to be used in a symbolizer.  
*/  
readOgcExpression: function(node) {  
var obj = {};  
this.readChildNodes(node, obj);  
var value = obj.value;  
if(value === undefined) {  
value = this.getChildValue(node);  
}  
return value;  
},  
 
/**  
* Method: write  
*  
* Parameters:  
* filter - {<OpenLayers.Filter>} A filter object.  
*  
* Returns:  
* {DOMElement} An ogc:Filter element.  
*/  
write: function(filter) {  
return this.writers.ogc["Filter"].apply(this, [filter]);  
},  
 
/**  
* Property: writers  
* As a compliment to the readers property, this structure contains public  
* writing functions grouped by namespace alias and named like the  
* node names they produce.  
*/  
writers: {  
"ogc": {  
"Filter": function(filter) {  
var node = this.createElementNSPlus("ogc:Filter");  
var sub = filter.CLASS_NAME.split(".").pop();  
if(sub == "FeatureId") {  
for(var i=0; i<filter.fids.length; ++i) {  
this.writeNode("FeatureId", filter.fids[i], node);  
}  
} else {  
this.writeNode(this.getFilterType(filter), filter, node);  
}  
return node;  
},  
"FeatureId": function(fid) {  
return this.createElementNSPlus("ogc:FeatureId", {  
attributes: {fid: fid}  
});  
},  
"And": function(filter) {  
var node = this.createElementNSPlus("ogc:And");  
var childFilter;  
for(var i=0; i<filter.filters.length; ++i) {  
childFilter = filter.filters[i];  
this.writeNode(  
this.getFilterType(childFilter), childFilter, node  
);  
}  
return node;  
},  
"Or": function(filter) {  
var node = this.createElementNSPlus("ogc:Or");  
var childFilter;  
for(var i=0; i<filter.filters.length; ++i) {  
childFilter = filter.filters[i];  
this.writeNode(  
this.getFilterType(childFilter), childFilter, node  
);  
}  
return node;  
},  
"Not": function(filter) {  
var node = this.createElementNSPlus("ogc:Not");  
var childFilter = filter.filters[0];  
this.writeNode(  
this.getFilterType(childFilter), childFilter, node  
);  
return node;  
},  
"PropertyIsLessThan": function(filter) {  
var node = this.createElementNSPlus("ogc:PropertyIsLessThan");  
// no ogc:expression handling for now  
this.writeNode("PropertyName", filter, node);  
this.writeNode("Literal", filter.value, node);  
return node;  
},  
"PropertyIsGreaterThan": function(filter) {  
var node = this.createElementNSPlus("ogc:PropertyIsGreaterThan");  
// no ogc:expression handling for now  
this.writeNode("PropertyName", filter, node);  
this.writeNode("Literal", filter.value, node);  
return node;  
},  
"PropertyIsLessThanOrEqualTo": function(filter) {  
var node = this.createElementNSPlus("ogc:PropertyIsLessThanOrEqualTo");  
// no ogc:expression handling for now  
this.writeNode("PropertyName", filter, node);  
this.writeNode("Literal", filter.value, node);  
return node;  
},  
"PropertyIsGreaterThanOrEqualTo": function(filter) {  
var node = this.createElementNSPlus("ogc:PropertyIsGreaterThanOrEqualTo");  
// no ogc:expression handling for now  
this.writeNode("PropertyName", filter, node);  
this.writeNode("Literal", filter.value, node);  
return node;  
},  
"PropertyIsBetween": function(filter) {  
var node = this.createElementNSPlus("ogc:PropertyIsBetween");  
// no ogc:expression handling for now  
this.writeNode("PropertyName", filter, node);  
this.writeNode("LowerBoundary", filter, node);  
this.writeNode("UpperBoundary", filter, node);  
return node;  
},  
"PropertyName": function(filter) {  
// no ogc:expression handling for now  
return this.createElementNSPlus("ogc:PropertyName", {  
value: filter.property  
});  
},  
"Literal": function(value) {  
// no ogc:expression handling for now  
return this.createElementNSPlus("ogc:Literal", {  
value: value  
});  
},  
"LowerBoundary": function(filter) {  
// no ogc:expression handling for now  
var node = this.createElementNSPlus("ogc:LowerBoundary");  
this.writeNode("Literal", filter.lowerBoundary, node);  
return node;  
},  
"UpperBoundary": function(filter) {  
// no ogc:expression handling for now  
var node = this.createElementNSPlus("ogc:UpperBoundary");  
this.writeNode("Literal", filter.upperBoundary, node);  
return node;  
},  
"INTERSECTS": function(filter) {  
return this.writeSpatial(filter, "Intersects");  
},  
"WITHIN": function(filter) {  
return this.writeSpatial(filter, "Within");  
},  
"CONTAINS": function(filter) {  
return this.writeSpatial(filter, "Contains");  
},  
"DWITHIN": function(filter) {  
var node = this.writeSpatial(filter, "DWithin");  
this.writeNode("Distance", filter, node);  
return node;  
},  
"Distance": function(filter) {  
return this.createElementNSPlus("ogc:Distance", {  
attributes: {  
units: filter.distanceUnits  
},  
value: filter.distance  
});  
}  
}  
},  
 
/**  
* Method: getFilterType  
*/  
getFilterType: function(filter) {  
var filterType = this.filterMap[filter.type];  
if(!filterType) {  
throw "Filter writing not supported for rule type: " + filter.type;  
}  
return filterType;  
},  
 
/**  
* Property: filterMap  
* {Object} Contains a member for each filter type. Values are node names  
* for corresponding OGC Filter child elements.  
*/  
filterMap: {  
"&&": "And",  
"||": "Or",  
"!": "Not",  
"==": "PropertyIsEqualTo",  
"!=": "PropertyIsNotEqualTo",  
"<": "PropertyIsLessThan",  
">": "PropertyIsGreaterThan",  
"<=": "PropertyIsLessThanOrEqualTo",  
">=": "PropertyIsGreaterThanOrEqualTo",  
"..": "PropertyIsBetween",  
"~": "PropertyIsLike",  
"BBOX": "BBOX",  
"DWITHIN": "DWITHIN",  
"WITHIN": "WITHIN",  
"CONTAINS": "CONTAINS",  
"INTERSECTS": "INTERSECTS"  
},  
 
CLASS_NAME: "OpenLayers.Format.Filter.v1"  
 
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/GML/v2.js  
* @requires OpenLayers/Format/Filter/v1.js  
*/  
 
/**  
* Class: OpenLayers.Format.Filter.v1_0_0  
* Write ogc:Filter version 1.0.0.  
*  
* Inherits from:  
* - <OpenLayers.Format.GML.v2>  
* - <OpenLayers.Format.Filter.v1>  
*/  
OpenLayers.Format.Filter.v1_0_0 = OpenLayers.Class(  
OpenLayers.Format.GML.v2, OpenLayers.Format.Filter.v1, {  
 
/**  
* Constant: VERSION  
* {String} 1.0.0  
*/  
VERSION: "1.0.0",  
 
/**  
* Property: schemaLocation  
* {String} http://www.opengis.net/ogc/filter/1.0.0/filter.xsd  
*/  
schemaLocation: "http://www.opengis.net/ogc/filter/1.0.0/filter.xsd",  
 
/**  
* Constructor: OpenLayers.Format.Filter.v1_0_0  
* Instances of this class are not created directly. Use the  
* <OpenLayers.Format.Filter> constructor instead.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*/  
initialize: function(options) {  
OpenLayers.Format.GML.v2.prototype.initialize.apply(  
this, [options]  
);  
},  
 
/**  
* Property: readers  
* Contains public functions, grouped by namespace prefix, that will  
* be applied when a namespaced node is found matching the function  
* name. The function will be applied in the scope of this parser  
* with two arguments: the node being read and a context object passed  
* from the parent.  
*/  
readers: {  
"ogc": OpenLayers.Util.applyDefaults({  
"PropertyIsEqualTo": function(node, obj) {  
var filter = new OpenLayers.Filter.Comparison({  
type: OpenLayers.Filter.Comparison.EQUAL_TO  
});  
this.readChildNodes(node, filter);  
obj.filters.push(filter);  
},  
"PropertyIsNotEqualTo": function(node, obj) {  
var filter = new OpenLayers.Filter.Comparison({  
type: OpenLayers.Filter.Comparison.NOT_EQUAL_TO  
});  
this.readChildNodes(node, filter);  
obj.filters.push(filter);  
},  
"PropertyIsLike": function(node, obj) {  
var filter = new OpenLayers.Filter.Comparison({  
type: OpenLayers.Filter.Comparison.LIKE  
});  
this.readChildNodes(node, filter);  
var wildCard = node.getAttribute("wildCard");  
var singleChar = node.getAttribute("singleChar");  
var esc = node.getAttribute("escape");  
filter.value2regex(wildCard, singleChar, esc);  
obj.filters.push(filter);  
}  
}, OpenLayers.Format.Filter.v1.prototype.readers["ogc"]),  
"gml": OpenLayers.Format.GML.v2.prototype.readers["gml"],  
"feature": OpenLayers.Format.GML.v2.prototype.readers["feature"]  
},  
 
/**  
* Property: writers  
* As a compliment to the readers property, this structure contains public  
* writing functions grouped by namespace alias and named like the  
* node names they produce.  
*/  
writers: {  
"ogc": OpenLayers.Util.applyDefaults({  
"PropertyIsEqualTo": function(filter) {  
var node = this.createElementNSPlus("ogc:PropertyIsEqualTo");  
// no ogc:expression handling for now  
this.writeNode("PropertyName", filter, node);  
this.writeNode("Literal", filter.value, node);  
return node;  
},  
"PropertyIsNotEqualTo": function(filter) {  
var node = this.createElementNSPlus("ogc:PropertyIsNotEqualTo");  
// no ogc:expression handling for now  
this.writeNode("PropertyName", filter, node);  
this.writeNode("Literal", filter.value, node);  
return node;  
},  
"PropertyIsLike": function(filter) {  
var node = this.createElementNSPlus("ogc:PropertyIsLike", {  
attributes: {  
wildCard: "*", singleChar: ".", escape: "!"  
}  
});  
// no ogc:expression handling for now  
this.writeNode("PropertyName", filter, node);  
// convert regex string to ogc string  
this.writeNode("Literal", filter.regex2value(), node);  
return node;  
},  
"BBOX": function(filter) {  
var node = this.createElementNSPlus("ogc:BBOX");  
this.writeNode("PropertyName", filter, node);  
var box = this.writeNode("gml:Box", filter.value, node);  
if(filter.projection) {  
box.setAttribute("srsName", filter.projection);  
}  
return node;  
}}, OpenLayers.Format.Filter.v1.prototype.writers["ogc"]),  
 
"gml": OpenLayers.Format.GML.v2.prototype.writers["gml"],  
"feature": OpenLayers.Format.GML.v2.prototype.writers["feature"]  
 
},  
 
/**  
* Method: writeSpatial  
*  
* Read a {<OpenLayers.Filter.Spatial>} filter and converts it into XML.  
*  
* Parameters:  
* filter - {<OpenLayers.Filter.Spatial>} The filter.  
* name - {String} Name of the generated XML element.  
*  
* Returns:  
* {DOMElement} The created XML element.  
*/  
writeSpatial: function(filter, name) {  
var node = this.createElementNSPlus("ogc:"+name);  
this.writeNode("PropertyName", filter, node);  
var child;  
if(filter.value instanceof OpenLayers.Geometry) {  
child = this.writeNode("feature:_geometry", filter.value).firstChild;  
} else {  
child = this.writeNode("gml:Box", filter.value);  
}  
if(filter.projection) {  
child.setAttribute("srsName", filter.projection);  
}  
node.appendChild(child);  
return node;  
},  
 
 
CLASS_NAME: "OpenLayers.Format.Filter.v1_0_0"  
 
});  
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/Filter/v1.js  
* @requires OpenLayers/Format/GML/v3.js  
*/  
 
/**  
* Class: OpenLayers.Format.Filter.v1_1_0  
* Write ogc:Filter version 1.1.0.  
*  
* Differences from the v1.0.0 parser:  
* - uses GML v3 instead of GML v2  
* - reads matchCase attribute on ogc:PropertyIsEqual and  
* ogc:PropertyIsNotEqualelements.  
* - writes matchCase attribute from comparison filters of type EQUAL_TO and  
* type NOT_EQUAL_TO.  
*  
* Inherits from:  
* - <OpenLayers.Format.Filter.v1>  
*/  
OpenLayers.Format.Filter.v1_1_0 = OpenLayers.Class(  
OpenLayers.Format.GML.v3, OpenLayers.Format.Filter.v1, {  
 
/**  
* Constant: VERSION  
* {String} 1.1.0  
*/  
VERSION: "1.1.0",  
 
/**  
* Property: schemaLocation  
* {String} http://www.opengis.net/ogc/filter/1.1.0/filter.xsd  
*/  
schemaLocation: "http://www.opengis.net/ogc/filter/1.1.0/filter.xsd",  
 
/**  
* Constructor: OpenLayers.Format.Filter.v1_1_0  
* Instances of this class are not created directly. Use the  
* <OpenLayers.Format.Filter> constructor instead.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*/  
initialize: function(options) {  
OpenLayers.Format.GML.v3.prototype.initialize.apply(  
this, [options]  
);  
},  
 
/**  
* Property: readers  
* Contains public functions, grouped by namespace prefix, that will  
* be applied when a namespaced node is found matching the function  
* name. The function will be applied in the scope of this parser  
* with two arguments: the node being read and a context object passed  
* from the parent.  
*/  
readers: {  
"ogc": OpenLayers.Util.applyDefaults({  
"PropertyIsEqualTo": function(node, obj) {  
var matchCase = node.getAttribute("matchCase");  
var filter = new OpenLayers.Filter.Comparison({  
type: OpenLayers.Filter.Comparison.EQUAL_TO,  
matchCase: !(matchCase === "false" || matchCase === "0")  
});  
this.readChildNodes(node, filter);  
obj.filters.push(filter);  
},  
"PropertyIsNotEqualTo": function(node, obj) {  
var matchCase = node.getAttribute("matchCase");  
var filter = new OpenLayers.Filter.Comparison({  
type: OpenLayers.Filter.Comparison.NOT_EQUAL_TO,  
matchCase: !(matchCase === "false" || matchCase === "0")  
});  
this.readChildNodes(node, filter);  
obj.filters.push(filter);  
},  
"PropertyIsLike": function(node, obj) {  
var filter = new OpenLayers.Filter.Comparison({  
type: OpenLayers.Filter.Comparison.LIKE  
});  
this.readChildNodes(node, filter);  
var wildCard = node.getAttribute("wildCard");  
var singleChar = node.getAttribute("singleChar");  
var esc = node.getAttribute("escapeChar");  
filter.value2regex(wildCard, singleChar, esc);  
obj.filters.push(filter);  
}  
}, OpenLayers.Format.Filter.v1.prototype.readers["ogc"]),  
"gml": OpenLayers.Format.GML.v3.prototype.readers["gml"],  
"feature": OpenLayers.Format.GML.v3.prototype.readers["feature"]  
},  
 
/**  
* Property: writers  
* As a compliment to the readers property, this structure contains public  
* writing functions grouped by namespace alias and named like the  
* node names they produce.  
*/  
writers: {  
"ogc": OpenLayers.Util.applyDefaults({  
"PropertyIsEqualTo": function(filter) {  
var node = this.createElementNSPlus("ogc:PropertyIsEqualTo", {  
attributes: {matchCase: filter.matchCase}  
});  
// no ogc:expression handling for now  
this.writeNode("PropertyName", filter, node);  
this.writeNode("Literal", filter.value, node);  
return node;  
},  
"PropertyIsNotEqualTo": function(filter) {  
var node = this.createElementNSPlus("ogc:PropertyIsNotEqualTo", {  
attributes: {matchCase: filter.matchCase}  
});  
// no ogc:expression handling for now  
this.writeNode("PropertyName", filter, node);  
this.writeNode("Literal", filter.value, node);  
return node;  
},  
"PropertyIsLike": function(filter) {  
var node = this.createElementNSPlus("ogc:PropertyIsLike", {  
attributes: {  
wildCard: "*", singleChar: ".", escapeChar: "!"  
}  
});  
// no ogc:expression handling for now  
this.writeNode("PropertyName", filter, node);  
// convert regex string to ogc string  
this.writeNode("Literal", filter.regex2value(), node);  
return node;  
},  
"BBOX": function(filter) {  
var node = this.createElementNSPlus("ogc:BBOX");  
this.writeNode("PropertyName", filter, node);  
var box = this.writeNode("gml:Envelope", filter.value);  
if(filter.projection) {  
box.setAttribute("srsName", filter.projection);  
}  
node.appendChild(box);  
return node;  
}}, OpenLayers.Format.Filter.v1.prototype.writers["ogc"]),  
 
"gml": OpenLayers.Format.GML.v3.prototype.writers["gml"],  
"feature": OpenLayers.Format.GML.v3.prototype.writers["feature"]  
},  
 
/**  
* Method: writeSpatial  
*  
* Read a {<OpenLayers.Filter.Spatial>} filter and converts it into XML.  
*  
* Parameters:  
* filter - {<OpenLayers.Filter.Spatial>} The filter.  
* name - {String} Name of the generated XML element.  
*  
* Returns:  
* {DOMElement} The created XML element.  
*/  
writeSpatial: function(filter, name) {  
var node = this.createElementNSPlus("ogc:"+name);  
this.writeNode("PropertyName", filter, node);  
var child;  
if(filter.value instanceof OpenLayers.Geometry) {  
child = this.writeNode("feature:_geometry", filter.value).firstChild;  
} else {  
child = this.writeNode("gml:Envelope", filter.value);  
}  
if(filter.projection) {  
child.setAttribute("srsName", filter.projection);  
}  
node.appendChild(child);  
return node;  
},  
 
CLASS_NAME: "OpenLayers.Format.Filter.v1_1_0"  
 
});  
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/XML.js  
* @requires OpenLayers/Feature/Vector.js  
* @requires OpenLayers/Geometry/Point.js  
* @requires OpenLayers/Geometry/MultiPoint.js  
* @requires OpenLayers/Geometry/LineString.js  
* @requires OpenLayers/Geometry/MultiLineString.js  
* @requires OpenLayers/Geometry/Polygon.js  
* @requires OpenLayers/Geometry/MultiPolygon.js  
* @requires OpenLayers/Console.js  
*/  
 
/**  
* Class: OpenLayers.Format.GML  
* Read/Wite GML. Create a new instance with the <OpenLayers.Format.GML>  
* constructor. Supports the GML simple features profile.  
*  
* Inherits from:  
* - <OpenLayers.Format>  
*/  
OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, {  
 
/*  
* APIProperty: featureNS  
* {String} Namespace used for feature attributes. Default is  
* "http://mapserver.gis.umn.edu/mapserver".  
*/  
featureNS: "http://mapserver.gis.umn.edu/mapserver",  
 
/**  
* APIProperty: featurePrefix  
* {String} Namespace alias (or prefix) for feature nodes. Default is  
* "feature".  
*/  
featurePrefix: "feature",  
 
/*  
* APIProperty: featureName  
* {String} Element name for features. Default is "featureMember".  
*/  
featureName: "featureMember",  
 
/*  
* APIProperty: layerName  
* {String} Name of data layer. Default is "features".  
*/  
layerName: "features",  
 
/**  
* APIProperty: geometryName  
* {String} Name of geometry element. Defaults to "geometry".  
*/  
geometryName: "geometry",  
 
/**  
* APIProperty: collectionName  
* {String} Name of featureCollection element.  
*/  
collectionName: "FeatureCollection",  
 
/**  
* APIProperty: gmlns  
* {String} GML Namespace.  
*/  
gmlns: "http://www.opengis.net/gml",  
 
/**  
* APIProperty: extractAttributes  
* {Boolean} Extract attributes from GML.  
*/  
extractAttributes: true,  
 
/**  
* APIProperty: xy  
* {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x)  
* Changing is not recommended, a new Format should be instantiated.  
*/  
xy: true,  
 
/**  
* Constructor: OpenLayers.Format.GML  
* Create a new parser for GML.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*/  
initialize: function(options) {  
// compile regular expressions once instead of every time they are used  
this.regExes = {  
trimSpace: (/^\s*|\s*$/g),  
removeSpace: (/\s*/g),  
splitSpace: (/\s+/),  
trimComma: (/\s*,\s*/g)  
};  
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* APIMethod: read  
* Read data from a string, and return a list of features.  
*  
* Parameters:  
* data - {String} or {DOMElement} data to read/parse.  
*  
* Returns:  
* {Array(<OpenLayers.Feature.Vector>)} An array of features.  
*/  
read: function(data) {  
if(typeof data == "string") {  
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);  
}  
var featureNodes = this.getElementsByTagNameNS(data.documentElement,  
this.gmlns,  
this.featureName);  
var features = [];  
for(var i=0; i<featureNodes.length; i++) {  
var feature = this.parseFeature(featureNodes[i]);  
if(feature) {  
features.push(feature);  
}  
}  
return features;  
},  
 
/**  
* Method: parseFeature  
* This function is the core of the GML parsing code in OpenLayers.  
* It creates the geometries that are then attached to the returned  
* feature, and calls parseAttributes() to get attribute data out.  
*  
* Parameters:  
* node - {DOMElement} A GML feature node.  
*/  
parseFeature: function(node) {  
// only accept one geometry per feature - look for highest "order"  
var order = ["MultiPolygon", "Polygon",  
"MultiLineString", "LineString",  
"MultiPoint", "Point", "Envelope"];  
// FIXME: In case we parse a feature with no geometry, but boundedBy an Envelope,  
// this code creates a geometry derived from the Envelope. This is not correct.  
var type, nodeList, geometry, parser;  
for(var i=0; i<order.length; ++i) {  
type = order[i];  
nodeList = this.getElementsByTagNameNS(node, this.gmlns, type);  
if(nodeList.length > 0) {  
// only deal with first geometry of this type  
parser = this.parseGeometry[type.toLowerCase()];  
if(parser) {  
geometry = parser.apply(this, [nodeList[0]]);  
if (this.internalProjection && this.externalProjection) {  
geometry.transform(this.externalProjection,  
this.internalProjection);  
}  
} else {  
OpenLayers.Console.error(OpenLayers.i18n(  
"unsupportedGeometryType", {'geomType':type}));  
}  
// stop looking for different geometry types  
break;  
}  
}  
 
var bounds;  
var boxNodes = this.getElementsByTagNameNS(node, this.gmlns, "Box");  
for(i=0; i<boxNodes.length; ++i) {  
var boxNode = boxNodes[i];  
var box = this.parseGeometry["box"].apply(this, [boxNode]);  
var parentNode = boxNode.parentNode;  
var parentName = parentNode.localName ||  
parentNode.nodeName.split(":").pop();  
if(parentName === "boundedBy") {  
bounds = box;  
} else {  
geometry = box.toGeometry();  
}  
}  
 
// construct feature (optionally with attributes)  
var attributes;  
if(this.extractAttributes) {  
attributes = this.parseAttributes(node);  
}  
var feature = new OpenLayers.Feature.Vector(geometry, attributes);  
feature.bounds = bounds;  
 
feature.gml = {  
featureType: node.firstChild.nodeName.split(":")[1],  
featureNS: node.firstChild.namespaceURI,  
featureNSPrefix: node.firstChild.prefix  
};  
 
// assign fid - this can come from a "fid" or "id" attribute  
var childNode = node.firstChild;  
var fid;  
while(childNode) {  
if(childNode.nodeType == 1) {  
fid = childNode.getAttribute("fid") ||  
childNode.getAttribute("id");  
if(fid) {  
break;  
}  
}  
childNode = childNode.nextSibling;  
}  
feature.fid = fid;  
return feature;  
},  
 
/**  
* Property: parseGeometry  
* Properties of this object are the functions that parse geometries based  
* on their type.  
*/  
parseGeometry: {  
 
/**  
* Method: parseGeometry.point  
* Given a GML node representing a point geometry, create an OpenLayers  
* point geometry.  
*  
* Parameters:  
* node - {DOMElement} A GML node.  
*  
* Returns:  
* {<OpenLayers.Geometry.Point>} A point geometry.  
*/  
point: function(node) {  
/**  
* Three coordinate variations to consider:  
* 1) <gml:pos>x y z</gml:pos>  
* 2) <gml:coordinates>x, y, z</gml:coordinates>  
* 3) <gml:coord><gml:X>x</gml:X><gml:Y>y</gml:Y></gml:coord>  
*/  
var nodeList, coordString;  
var coords = [];  
 
// look for <gml:pos>  
var nodeList = this.getElementsByTagNameNS(node, this.gmlns, "pos");  
if(nodeList.length > 0) {  
coordString = nodeList[0].firstChild.nodeValue;  
coordString = coordString.replace(this.regExes.trimSpace, "");  
coords = coordString.split(this.regExes.splitSpace);  
}  
 
// look for <gml:coordinates>  
if(coords.length == 0) {  
nodeList = this.getElementsByTagNameNS(node, this.gmlns,  
"coordinates");  
if(nodeList.length > 0) {  
coordString = nodeList[0].firstChild.nodeValue;  
coordString = coordString.replace(this.regExes.removeSpace,  
"");  
coords = coordString.split(",");  
}  
}  
 
// look for <gml:coord>  
if(coords.length == 0) {  
nodeList = this.getElementsByTagNameNS(node, this.gmlns,  
"coord");  
if(nodeList.length > 0) {  
var xList = this.getElementsByTagNameNS(nodeList[0],  
this.gmlns, "X");  
var yList = this.getElementsByTagNameNS(nodeList[0],  
this.gmlns, "Y");  
if(xList.length > 0 && yList.length > 0) {  
coords = [xList[0].firstChild.nodeValue,  
yList[0].firstChild.nodeValue];  
}  
}  
}  
 
// preserve third dimension  
if(coords.length == 2) {  
coords[2] = null;  
}  
 
if (this.xy) {  
return new OpenLayers.Geometry.Point(coords[0], coords[1],  
coords[2]);  
}  
else{  
return new OpenLayers.Geometry.Point(coords[1], coords[0],  
coords[2]);  
}  
},  
 
/**  
* Method: parseGeometry.multipoint  
* Given a GML node representing a multipoint geometry, create an  
* OpenLayers multipoint geometry.  
*  
* Parameters:  
* node - {DOMElement} A GML node.  
*  
* Returns:  
* {<OpenLayers.Geometry.MultiPoint>} A multipoint geometry.  
*/  
multipoint: function(node) {  
var nodeList = this.getElementsByTagNameNS(node, this.gmlns,  
"Point");  
var components = [];  
if(nodeList.length > 0) {  
var point;  
for(var i=0; i<nodeList.length; ++i) {  
point = this.parseGeometry.point.apply(this, [nodeList[i]]);  
if(point) {  
components.push(point);  
}  
}  
}  
return new OpenLayers.Geometry.MultiPoint(components);  
},  
 
/**  
* Method: parseGeometry.linestring  
* Given a GML node representing a linestring geometry, create an  
* OpenLayers linestring geometry.  
*  
* Parameters:  
* node - {DOMElement} A GML node.  
*  
* Returns:  
* {<OpenLayers.Geometry.LineString>} A linestring geometry.  
*/  
linestring: function(node, ring) {  
/**  
* Two coordinate variations to consider:  
* 1) <gml:posList dimension="d">x0 y0 z0 x1 y1 z1</gml:posList>  
* 2) <gml:coordinates>x0, y0, z0 x1, y1, z1</gml:coordinates>  
*/  
var nodeList, coordString;  
var coords = [];  
var points = [];  
 
// look for <gml:posList>  
nodeList = this.getElementsByTagNameNS(node, this.gmlns, "posList");  
if(nodeList.length > 0) {  
coordString = this.getChildValue(nodeList[0]);  
coordString = coordString.replace(this.regExes.trimSpace, "");  
coords = coordString.split(this.regExes.splitSpace);  
var dim = parseInt(nodeList[0].getAttribute("dimension"));  
var j, x, y, z;  
for(var i=0; i<coords.length/dim; ++i) {  
j = i * dim;  
x = coords[j];  
y = coords[j+1];  
z = (dim == 2) ? null : coords[j+2];  
if (this.xy) {  
points.push(new OpenLayers.Geometry.Point(x, y, z));  
} else {  
points.push(new OpenLayers.Geometry.Point(y, x, z));  
}  
}  
}  
 
// look for <gml:coordinates>  
if(coords.length == 0) {  
nodeList = this.getElementsByTagNameNS(node, this.gmlns,  
"coordinates");  
if(nodeList.length > 0) {  
coordString = this.getChildValue(nodeList[0]);  
coordString = coordString.replace(this.regExes.trimSpace,  
"");  
coordString = coordString.replace(this.regExes.trimComma,  
",");  
var pointList = coordString.split(this.regExes.splitSpace);  
for(var i=0; i<pointList.length; ++i) {  
coords = pointList[i].split(",");  
if(coords.length == 2) {  
coords[2] = null;  
}  
if (this.xy) {  
points.push(new OpenLayers.Geometry.Point(coords[0],  
coords[1],  
coords[2]));  
} else {  
points.push(new OpenLayers.Geometry.Point(coords[1],  
coords[0],  
coords[2]));  
}  
}  
}  
}  
 
var line = null;  
if(points.length != 0) {  
if(ring) {  
line = new OpenLayers.Geometry.LinearRing(points);  
} else {  
line = new OpenLayers.Geometry.LineString(points);  
}  
}  
return line;  
},  
 
/**  
* Method: parseGeometry.multilinestring  
* Given a GML node representing a multilinestring geometry, create an  
* OpenLayers multilinestring geometry.  
*  
* Parameters:  
* node - {DOMElement} A GML node.  
*  
* Returns:  
* {<OpenLayers.Geometry.MultiLineString>} A multilinestring geometry.  
*/  
multilinestring: function(node) {  
var nodeList = this.getElementsByTagNameNS(node, this.gmlns,  
"LineString");  
var components = [];  
if(nodeList.length > 0) {  
var line;  
for(var i=0; i<nodeList.length; ++i) {  
line = this.parseGeometry.linestring.apply(this,  
[nodeList[i]]);  
if(line) {  
components.push(line);  
}  
}  
}  
return new OpenLayers.Geometry.MultiLineString(components);  
},  
 
/**  
* Method: parseGeometry.polygon  
* Given a GML node representing a polygon geometry, create an  
* OpenLayers polygon geometry.  
*  
* Parameters:  
* node - {DOMElement} A GML node.  
*  
* Returns:  
* {<OpenLayers.Geometry.Polygon>} A polygon geometry.  
*/  
polygon: function(node) {  
var nodeList = this.getElementsByTagNameNS(node, this.gmlns,  
"LinearRing");  
var components = [];  
if(nodeList.length > 0) {  
// this assumes exterior ring first, inner rings after  
var ring;  
for(var i=0; i<nodeList.length; ++i) {  
ring = this.parseGeometry.linestring.apply(this,  
[nodeList[i], true]);  
if(ring) {  
components.push(ring);  
}  
}  
}  
return new OpenLayers.Geometry.Polygon(components);  
},  
 
/**  
* Method: parseGeometry.multipolygon  
* Given a GML node representing a multipolygon geometry, create an  
* OpenLayers multipolygon geometry.  
*  
* Parameters:  
* node - {DOMElement} A GML node.  
*  
* Returns:  
* {<OpenLayers.Geometry.MultiPolygon>} A multipolygon geometry.  
*/  
multipolygon: function(node) {  
var nodeList = this.getElementsByTagNameNS(node, this.gmlns,  
"Polygon");  
var components = [];  
if(nodeList.length > 0) {  
var polygon;  
for(var i=0; i<nodeList.length; ++i) {  
polygon = this.parseGeometry.polygon.apply(this,  
[nodeList[i]]);  
if(polygon) {  
components.push(polygon);  
}  
}  
}  
return new OpenLayers.Geometry.MultiPolygon(components);  
},  
 
envelope: function(node) {  
var components = [];  
var coordString;  
var envelope;  
 
var lpoint = this.getElementsByTagNameNS(node, this.gmlns, "lowerCorner");  
if (lpoint.length > 0) {  
var coords = [];  
 
if(lpoint.length > 0) {  
coordString = lpoint[0].firstChild.nodeValue;  
coordString = coordString.replace(this.regExes.trimSpace, "");  
coords = coordString.split(this.regExes.splitSpace);  
}  
 
if(coords.length == 2) {  
coords[2] = null;  
}  
if (this.xy) {  
var lowerPoint = new OpenLayers.Geometry.Point(coords[0], coords[1],coords[2]);  
} else {  
var lowerPoint = new OpenLayers.Geometry.Point(coords[1], coords[0],coords[2]);  
}  
}  
 
var upoint = this.getElementsByTagNameNS(node, this.gmlns, "upperCorner");  
if (upoint.length > 0) {  
var coords = [];  
 
if(upoint.length > 0) {  
coordString = upoint[0].firstChild.nodeValue;  
coordString = coordString.replace(this.regExes.trimSpace, "");  
coords = coordString.split(this.regExes.splitSpace);  
}  
 
if(coords.length == 2) {  
coords[2] = null;  
}  
if (this.xy) {  
var upperPoint = new OpenLayers.Geometry.Point(coords[0], coords[1],coords[2]);  
} else {  
var upperPoint = new OpenLayers.Geometry.Point(coords[1], coords[0],coords[2]);  
}  
}  
 
if (lowerPoint && upperPoint) {  
components.push(new OpenLayers.Geometry.Point(lowerPoint.x, lowerPoint.y));  
components.push(new OpenLayers.Geometry.Point(upperPoint.x, lowerPoint.y));  
components.push(new OpenLayers.Geometry.Point(upperPoint.x, upperPoint.y));  
components.push(new OpenLayers.Geometry.Point(lowerPoint.x, upperPoint.y));  
components.push(new OpenLayers.Geometry.Point(lowerPoint.x, lowerPoint.y));  
 
var ring = new OpenLayers.Geometry.LinearRing(components);  
envelope = new OpenLayers.Geometry.Polygon([ring]);  
}  
return envelope;  
},  
 
/**  
* Method: parseGeometry.box  
* Given a GML node representing a box geometry, create an  
* OpenLayers.Bounds.  
*  
* Parameters:  
* node - {DOMElement} A GML node.  
*  
* Returns:  
* {<OpenLayers.Bounds>} A bounds representing the box.  
*/  
box: function(node) {  
var nodeList = this.getElementsByTagNameNS(node, this.gmlns,  
"coordinates");  
var coordString;  
var coords, beginPoint = null, endPoint = null;  
if (nodeList.length > 0) {  
coordString = nodeList[0].firstChild.nodeValue;  
coords = coordString.split(" ");  
if (coords.length == 2) {  
beginPoint = coords[0].split(",");  
endPoint = coords[1].split(",");  
}  
}  
if (beginPoint !== null && endPoint !== null) {  
return new OpenLayers.Bounds(parseFloat(beginPoint[0]),  
parseFloat(beginPoint[1]),  
parseFloat(endPoint[0]),  
parseFloat(endPoint[1]) );  
}  
}  
 
},  
 
/**  
* Method: parseAttributes  
*  
* Parameters:  
* node - {<DOMElement>}  
*  
* Returns:  
* {Object} An attributes object.  
*/  
parseAttributes: function(node) {  
var attributes = {};  
// assume attributes are children of the first type 1 child  
var childNode = node.firstChild;  
var children, i, child, grandchildren, grandchild, name, value;  
while(childNode) {  
if(childNode.nodeType == 1) {  
// attributes are type 1 children with one type 3 child  
children = childNode.childNodes;  
for(i=0; i<children.length; ++i) {  
child = children[i];  
if(child.nodeType == 1) {  
grandchildren = child.childNodes;  
if(grandchildren.length == 1) {  
grandchild = grandchildren[0];  
if(grandchild.nodeType == 3 ||  
grandchild.nodeType == 4) {  
name = (child.prefix) ?  
child.nodeName.split(":")[1] :  
child.nodeName;  
value = grandchild.nodeValue.replace(  
this.regExes.trimSpace, "");  
attributes[name] = value;  
}  
} else {  
// If child has no childNodes (grandchildren),  
// set an attribute with null value.  
// e.g. <prefix:fieldname/> becomes  
// {fieldname: null}  
attributes[child.nodeName.split(":").pop()] = null;  
}  
}  
}  
break;  
}  
childNode = childNode.nextSibling;  
}  
return attributes;  
},  
 
/**  
* APIMethod: write  
* Generate a GML document string given a list of features.  
*  
* Parameters:  
* features - {Array(<OpenLayers.Feature.Vector>)} List of features to  
* serialize into a string.  
*  
* Returns:  
* {String} A string representing the GML document.  
*/  
write: function(features) {  
if(!(features instanceof Array)) {  
features = [features];  
}  
var gml = this.createElementNS("http://www.opengis.net/wfs",  
"wfs:" + this.collectionName);  
for(var i=0; i<features.length; i++) {  
gml.appendChild(this.createFeatureXML(features[i]));  
}  
return OpenLayers.Format.XML.prototype.write.apply(this, [gml]);  
},  
 
/**  
* Method: createFeatureXML  
* Accept an OpenLayers.Feature.Vector, and build a GML node for it.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>} The feature to be built as GML.  
*  
* Returns:  
* {DOMElement} A node reprensting the feature in GML.  
*/  
createFeatureXML: function(feature) {  
var geometry = feature.geometry;  
var geometryNode = this.buildGeometryNode(geometry);  
var geomContainer = this.createElementNS(this.featureNS,  
this.featurePrefix + ":" +  
this.geometryName);  
geomContainer.appendChild(geometryNode);  
var featureNode = this.createElementNS(this.gmlns,  
"gml:" + this.featureName);  
var featureContainer = this.createElementNS(this.featureNS,  
this.featurePrefix + ":" +  
this.layerName);  
var fid = feature.fid || feature.id;  
featureContainer.setAttribute("fid", fid);  
featureContainer.appendChild(geomContainer);  
for(var attr in feature.attributes) {  
var attrText = this.createTextNode(feature.attributes[attr]);  
var nodename = attr.substring(attr.lastIndexOf(":") + 1);  
var attrContainer = this.createElementNS(this.featureNS,  
this.featurePrefix + ":" +  
nodename);  
attrContainer.appendChild(attrText);  
featureContainer.appendChild(attrContainer);  
}  
featureNode.appendChild(featureContainer);  
return featureNode;  
},  
 
/**  
* APIMethod: buildGeometryNode  
*/  
buildGeometryNode: function(geometry) {  
if (this.externalProjection && this.internalProjection) {  
geometry = geometry.clone();  
geometry.transform(this.internalProjection,  
this.externalProjection);  
}  
var className = geometry.CLASS_NAME;  
var type = className.substring(className.lastIndexOf(".") + 1);  
var builder = this.buildGeometry[type.toLowerCase()];  
return builder.apply(this, [geometry]);  
},  
 
/**  
* Property: buildGeometry  
* Object containing methods to do the actual geometry node building  
* based on geometry type.  
*/  
buildGeometry: {  
// TBD retrieve the srs from layer  
// srsName is non-standard, so not including it until it's right.  
// gml.setAttribute("srsName",  
// "http://www.opengis.net/gml/srs/epsg.xml#4326");  
 
/**  
* Method: buildGeometry.point  
* Given an OpenLayers point geometry, create a GML point.  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry.Point>} A point geometry.  
*  
* Returns:  
* {DOMElement} A GML point node.  
*/  
point: function(geometry) {  
var gml = this.createElementNS(this.gmlns, "gml:Point");  
gml.appendChild(this.buildCoordinatesNode(geometry));  
return gml;  
},  
 
/**  
* Method: buildGeometry.multipoint  
* Given an OpenLayers multipoint geometry, create a GML multipoint.  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry.MultiPoint>} A multipoint geometry.  
*  
* Returns:  
* {DOMElement} A GML multipoint node.  
*/  
multipoint: function(geometry) {  
var gml = this.createElementNS(this.gmlns, "gml:MultiPoint");  
var points = geometry.components;  
var pointMember, pointGeom;  
for(var i=0; i<points.length; i++) {  
pointMember = this.createElementNS(this.gmlns,  
"gml:pointMember");  
pointGeom = this.buildGeometry.point.apply(this,  
[points[i]]);  
pointMember.appendChild(pointGeom);  
gml.appendChild(pointMember);  
}  
return gml;  
},  
 
/**  
* Method: buildGeometry.linestring  
* Given an OpenLayers linestring geometry, create a GML linestring.  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry.LineString>} A linestring geometry.  
*  
* Returns:  
* {DOMElement} A GML linestring node.  
*/  
linestring: function(geometry) {  
var gml = this.createElementNS(this.gmlns, "gml:LineString");  
gml.appendChild(this.buildCoordinatesNode(geometry));  
return gml;  
},  
 
/**  
* Method: buildGeometry.multilinestring  
* Given an OpenLayers multilinestring geometry, create a GML  
* multilinestring.  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry.MultiLineString>} A multilinestring  
* geometry.  
*  
* Returns:  
* {DOMElement} A GML multilinestring node.  
*/  
multilinestring: function(geometry) {  
var gml = this.createElementNS(this.gmlns, "gml:MultiLineString");  
var lines = geometry.components;  
var lineMember, lineGeom;  
for(var i=0; i<lines.length; ++i) {  
lineMember = this.createElementNS(this.gmlns,  
"gml:lineStringMember");  
lineGeom = this.buildGeometry.linestring.apply(this,  
[lines[i]]);  
lineMember.appendChild(lineGeom);  
gml.appendChild(lineMember);  
}  
return gml;  
},  
 
/**  
* Method: buildGeometry.linearring  
* Given an OpenLayers linearring geometry, create a GML linearring.  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry.LinearRing>} A linearring geometry.  
*  
* Returns:  
* {DOMElement} A GML linearring node.  
*/  
linearring: function(geometry) {  
var gml = this.createElementNS(this.gmlns, "gml:LinearRing");  
gml.appendChild(this.buildCoordinatesNode(geometry));  
return gml;  
},  
 
/**  
* Method: buildGeometry.polygon  
* Given an OpenLayers polygon geometry, create a GML polygon.  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry.Polygon>} A polygon geometry.  
*  
* Returns:  
* {DOMElement} A GML polygon node.  
*/  
polygon: function(geometry) {  
var gml = this.createElementNS(this.gmlns, "gml:Polygon");  
var rings = geometry.components;  
var ringMember, ringGeom, type;  
for(var i=0; i<rings.length; ++i) {  
type = (i==0) ? "outerBoundaryIs" : "innerBoundaryIs";  
ringMember = this.createElementNS(this.gmlns,  
"gml:" + type);  
ringGeom = this.buildGeometry.linearring.apply(this,  
[rings[i]]);  
ringMember.appendChild(ringGeom);  
gml.appendChild(ringMember);  
}  
return gml;  
},  
 
/**  
* Method: buildGeometry.multipolygon  
* Given an OpenLayers multipolygon geometry, create a GML multipolygon.  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry.MultiPolygon>} A multipolygon  
* geometry.  
*  
* Returns:  
* {DOMElement} A GML multipolygon node.  
*/  
multipolygon: function(geometry) {  
var gml = this.createElementNS(this.gmlns, "gml:MultiPolygon");  
var polys = geometry.components;  
var polyMember, polyGeom;  
for(var i=0; i<polys.length; ++i) {  
polyMember = this.createElementNS(this.gmlns,  
"gml:polygonMember");  
polyGeom = this.buildGeometry.polygon.apply(this,  
[polys[i]]);  
polyMember.appendChild(polyGeom);  
gml.appendChild(polyMember);  
}  
return gml;  
 
},  
 
/**  
* Method: buildGeometry.bounds  
* Given an OpenLayers bounds, create a GML box.  
*  
* Parameters:  
* bounds - {<OpenLayers.Geometry.Bounds>} A bounds object.  
*  
* Returns:  
* {DOMElement} A GML box node.  
*/  
bounds: function(bounds) {  
var gml = this.createElementNS(this.gmlns, "gml:Box");  
gml.appendChild(this.buildCoordinatesNode(bounds));  
return gml;  
}  
},  
 
/**  
* Method: buildCoordinates  
* builds the coordinates XmlNode  
* (code)  
* <gml:coordinates decimal="." cs="," ts=" ">...</gml:coordinates>  
* (end)  
* Parameters:  
* geometry - {<OpenLayers.Geometry>}  
*  
* Returns:  
* {XmlNode} created xmlNode  
*/  
buildCoordinatesNode: function(geometry) {  
var coordinatesNode = this.createElementNS(this.gmlns,  
"gml:coordinates");  
coordinatesNode.setAttribute("decimal", ".");  
coordinatesNode.setAttribute("cs", ",");  
coordinatesNode.setAttribute("ts", " ");  
 
var parts = [];  
 
if(geometry instanceof OpenLayers.Bounds){  
parts.push(geometry.left + "," + geometry.bottom);  
parts.push(geometry.right + "," + geometry.top);  
} else {  
var points = (geometry.components) ? geometry.components : [geometry];  
for(var i=0; i<points.length; i++) {  
parts.push(points[i].x + "," + points[i].y);  
}  
}  
 
var txtNode = this.createTextNode(parts.join(" "));  
coordinatesNode.appendChild(txtNode);  
 
return coordinatesNode;  
},  
 
CLASS_NAME: "OpenLayers.Format.GML"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/XML.js  
* @requires OpenLayers/Format/GML.js  
*/  
 
/**  
* Though required in the full build, if the GML format is excluded, we set  
* the namespace here.  
*/  
if(!OpenLayers.Format.GML) {  
OpenLayers.Format.GML = {};  
}  
 
/**  
* Class: OpenLayers.Format.GML.Base  
* Superclass for GML parsers.  
*  
* Inherits from:  
* - <OpenLayers.Format.XML>  
*/  
OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {  
 
/**  
* Property: namespaces  
* {Object} Mapping of namespace aliases to namespace URIs.  
*/  
namespaces: {  
gml: "http://www.opengis.net/gml",  
xlink: "http://www.w3.org/1999/xlink",  
xsi: "http://www.w3.org/2001/XMLSchema-instance",  
wfs: "http://www.opengis.net/wfs" // this is a convenience for reading wfs:FeatureCollection  
},  
 
/**  
* Property: defaultPrefix  
*/  
defaultPrefix: "gml",  
 
/**  
* Property: schemaLocation  
* {String} Schema location for a particular minor version.  
*/  
schemaLocation: null,  
 
/**  
* APIProperty: featureType  
* {Array(String) or String} The local (without prefix) feature typeName(s).  
*/  
featureType: null,  
 
/**  
* APIProperty: featureNS  
* {String} The feature namespace. Must be set in the options at  
* construction.  
*/  
featureNS: null,  
 
/**  
* APIProperty: geometry  
* {String} Name of geometry element. Defaults to "geometry".  
*/  
geometryName: "geometry",  
 
/**  
* APIProperty: extractAttributes  
* {Boolean} Extract attributes from GML. Default is true.  
*/  
extractAttributes: true,  
 
/**  
* APIProperty: srsName  
* {String} URI for spatial reference system. This is optional for  
* single part geometries and mandatory for collections and multis.  
* If set, the srsName attribute will be written for all geometries.  
* Default is null.  
*/  
srsName: null,  
 
/**  
* APIProperty: xy  
* {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x)  
* Changing is not recommended, a new Format should be instantiated.  
*/  
xy: true,  
 
/**  
* Property: geometryTypes  
* {Object} Maps OpenLayers geometry class names to GML element names.  
* Use <setGeometryTypes> before accessing this property.  
*/  
geometryTypes: null,  
 
/**  
* Property: singleFeatureType  
* {Boolean} True if there is only 1 featureType, and not an array  
* of featuretypes.  
*/  
singleFeatureType: null,  
 
/**  
* Property: regExes  
* Compiled regular expressions for manipulating strings.  
*/  
regExes: {  
trimSpace: (/^\s*|\s*$/g),  
removeSpace: (/\s*/g),  
splitSpace: (/\s+/),  
trimComma: (/\s*,\s*/g)  
},  
 
/**  
* Constructor: OpenLayers.Format.GML.Base  
* Instances of this class are not created directly. Use the  
* <OpenLayers.Format.GML.v2> or <OpenLayers.Format.GML.v3> constructor  
* instead.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*  
* Valid options properties:  
* featureType - {Array(String) or String} Local (without prefix) feature  
* typeName(s) (required).  
* featureNS - {String} Feature namespace (required).  
* geometryName - {String} Geometry element name.  
*/  
initialize: function(options) {  
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);  
this.setGeometryTypes();  
if(options && options.featureNS) {  
this.setNamespace("feature", options.featureNS);  
}  
this.singleFeatureType = !options || (typeof options.featureType === "string");  
},  
 
/**  
* Method: read  
*  
* Parameters:  
* data - {DOMElement} A gml:featureMember element, a gml:featureMembers  
* element, or an element containing either of the above at any level.  
*  
* Returns:  
* {Array(<OpenLayers.Feature.Vector>)} An array of features.  
*/  
read: function(data) {  
if(typeof data == "string") {  
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);  
}  
if(data && data.nodeType == 9) {  
data = data.documentElement;  
}  
var features = [];  
this.readNode(data, {features: features});  
if(features.length == 0) {  
// look for gml:featureMember elements  
var elements = this.getElementsByTagNameNS(  
data, this.namespaces.gml, "featureMember"  
);  
if(elements.length) {  
for(var i=0, len=elements.length; i<len; ++i) {  
this.readNode(elements[i], {features: features});  
}  
} else {  
// look for gml:featureMembers elements (this is v3, but does no harm here)  
var elements = this.getElementsByTagNameNS(  
data, this.namespaces.gml, "featureMembers"  
);  
if(elements.length) {  
// there can be only one  
this.readNode(elements[0], {features: features});  
}  
}  
}  
return features;  
},  
 
/**  
* Property: readers  
* Contains public functions, grouped by namespace prefix, that will  
* be applied when a namespaced node is found matching the function  
* name. The function will be applied in the scope of this parser  
* with two arguments: the node being read and a context object passed  
* from the parent.  
*/  
readers: {  
"gml": {  
"featureMember": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"featureMembers": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"name": function(node, obj) {  
obj.name = this.getChildValue(node);  
},  
"boundedBy": function(node, obj) {  
var container = {};  
this.readChildNodes(node, container);  
if(container.components && container.components.length > 0) {  
obj.bounds = container.components[0];  
}  
},  
"Point": function(node, container) {  
var obj = {points: []};  
this.readChildNodes(node, obj);  
if(!container.components) {  
container.components = [];  
}  
container.components.push(obj.points[0]);  
},  
"coordinates": function(node, obj) {  
var str = this.getChildValue(node).replace(  
this.regExes.trimSpace, ""  
);  
str = str.replace(this.regExes.trimComma, ",");  
var pointList = str.split(this.regExes.splitSpace);  
var coords;  
var numPoints = pointList.length;  
var points = new Array(numPoints);  
for(var i=0; i<numPoints; ++i) {  
coords = pointList[i].split(",");  
if (this.xy) {  
points[i] = new OpenLayers.Geometry.Point(  
coords[0], coords[1], coords[2]  
);  
} else {  
points[i] = new OpenLayers.Geometry.Point(  
coords[1], coords[0], coords[2]  
);  
}  
}  
obj.points = points;  
},  
"coord": function(node, obj) {  
var coord = {};  
this.readChildNodes(node, coord);  
if(!obj.points) {  
obj.points = [];  
}  
obj.points.push(new OpenLayers.Geometry.Point(  
coord.x, coord.y, coord.z  
));  
},  
"X": function(node, coord) {  
coord.x = this.getChildValue(node);  
},  
"Y": function(node, coord) {  
coord.y = this.getChildValue(node);  
},  
"Z": function(node, coord) {  
coord.z = this.getChildValue(node);  
},  
"MultiPoint": function(node, container) {  
var obj = {components: []};  
this.readChildNodes(node, obj);  
container.components = [  
new OpenLayers.Geometry.MultiPoint(obj.components)  
];  
},  
"pointMember": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"LineString": function(node, container) {  
var obj = {};  
this.readChildNodes(node, obj);  
if(!container.components) {  
container.components = [];  
}  
container.components.push(  
new OpenLayers.Geometry.LineString(obj.points)  
);  
},  
"MultiLineString": function(node, container) {  
var obj = {components: []};  
this.readChildNodes(node, obj);  
container.components = [  
new OpenLayers.Geometry.MultiLineString(obj.components)  
];  
},  
"lineStringMember": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"Polygon": function(node, container) {  
var obj = {outer: null, inner: []};  
this.readChildNodes(node, obj);  
obj.inner.unshift(obj.outer);  
if(!container.components) {  
container.components = [];  
}  
container.components.push(  
new OpenLayers.Geometry.Polygon(obj.inner)  
);  
},  
"LinearRing": function(node, obj) {  
var container = {};  
this.readChildNodes(node, container);  
obj.components = [new OpenLayers.Geometry.LinearRing(  
container.points  
)];  
},  
"MultiPolygon": function(node, container) {  
var obj = {components: []};  
this.readChildNodes(node, obj);  
container.components = [  
new OpenLayers.Geometry.MultiPolygon(obj.components)  
];  
},  
"polygonMember": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"GeometryCollection": function(node, container) {  
var obj = {components: []};  
this.readChildNodes(node, obj);  
container.components = [  
new OpenLayers.Geometry.Collection(obj.components)  
];  
},  
"geometryMember": function(node, obj) {  
this.readChildNodes(node, obj);  
}  
},  
"feature": {  
"*": function(node, obj) {  
// The node can either be named like the featureType, or it  
// can be a child of the feature:featureType. Children can be  
// geometry or attributes.  
var name;  
var local = node.localName || node.nodeName.split(":").pop();  
// Since an attribute can have the same name as the feature type  
// we only want to read the node as a feature if the parent  
// node can have feature nodes as children. In this case, the  
// obj.features property is set.  
if (obj.features) {  
if (!this.singleFeatureType &&  
(OpenLayers.Util.indexOf(this.featureType, local) !== -1)) {  
name = "_typeName";  
} else if(local === this.featureType) {  
name = "_typeName";  
}  
} else {  
// Assume attribute elements have one child node and that the child  
// is a text node. Otherwise assume it is a geometry node.  
if(node.childNodes.length == 0 ||  
(node.childNodes.length == 1 && node.firstChild.nodeType == 3)) {  
if(this.extractAttributes) {  
name = "_attribute";  
}  
} else {  
name = "_geometry";  
}  
}  
if(name) {  
this.readers.feature[name].apply(this, [node, obj]);  
}  
},  
"_typeName": function(node, obj) {  
var container = {components: [], attributes: {}};  
this.readChildNodes(node, container);  
// look for common gml namespaced elements  
if(container.name) {  
container.attributes.name = container.name;  
}  
var feature = new OpenLayers.Feature.Vector(  
container.components[0], container.attributes  
);  
if (!this.singleFeatureType) {  
feature.type = node.nodeName.split(":").pop();  
feature.namespace = node.namespaceURI;  
}  
var fid = node.getAttribute("fid") ||  
this.getAttributeNS(node, this.namespaces["gml"], "id");  
if(fid) {  
feature.fid = fid;  
}  
if(this.internalProjection && this.externalProjection &&  
feature.geometry) {  
feature.geometry.transform(  
this.externalProjection, this.internalProjection  
);  
}  
if(container.bounds) {  
feature.bounds = container.bounds;  
}  
obj.features.push(feature);  
},  
"_geometry": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"_attribute": function(node, obj) {  
var local = node.localName || node.nodeName.split(":").pop();  
var value = this.getChildValue(node);  
obj.attributes[local] = value;  
}  
},  
"wfs": {  
"FeatureCollection": function(node, obj) {  
this.readChildNodes(node, obj);  
}  
}  
},  
 
/**  
* Method: write  
*  
* Parameters:  
* features - {Array(<OpenLayers.Feature.Vector>) | OpenLayers.Feature.Vector}  
* An array of features or a single feature.  
*  
* Returns:  
* {String} Given an array of features, a doc with a gml:featureMembers  
* element will be returned. Given a single feature, a doc with a  
* gml:featureMember element will be returned.  
*/  
write: function(features) {  
var name;  
if(features instanceof Array) {  
name = "featureMembers";  
} else {  
name = "featureMember";  
}  
var root = this.writeNode("gml:" + name, features);  
this.setAttributeNS(  
root, this.namespaces["xsi"],  
"xsi:schemaLocation", this.schemaLocation  
);  
 
return OpenLayers.Format.XML.prototype.write.apply(this, [root]);  
},  
 
/**  
* Property: writers  
* As a compliment to the readers property, this structure contains public  
* writing functions grouped by namespace alias and named like the  
* node names they produce.  
*/  
writers: {  
"gml": {  
"featureMember": function(feature) {  
var node = this.createElementNSPlus("gml:featureMember");  
this.writeNode("feature:_typeName", feature, node);  
return node;  
},  
"MultiPoint": function(geometry) {  
var node = this.createElementNSPlus("gml:MultiPoint");  
for(var i=0; i<geometry.components.length; ++i) {  
this.writeNode("pointMember", geometry.components[i], node);  
}  
return node;  
},  
"pointMember": function(geometry) {  
var node = this.createElementNSPlus("gml:pointMember");  
this.writeNode("Point", geometry, node);  
return node;  
},  
"MultiLineString": function(geometry) {  
var node = this.createElementNSPlus("gml:MultiLineString");  
for(var i=0; i<geometry.components.length; ++i) {  
this.writeNode("lineStringMember", geometry.components[i], node);  
}  
return node;  
},  
"lineStringMember": function(geometry) {  
var node = this.createElementNSPlus("gml:lineStringMember");  
this.writeNode("LineString", geometry, node);  
return node;  
},  
"MultiPolygon": function(geometry) {  
var node = this.createElementNSPlus("gml:MultiPolygon");  
for(var i=0; i<geometry.components.length; ++i) {  
this.writeNode(  
"polygonMember", geometry.components[i], node  
);  
}  
return node;  
},  
"polygonMember": function(geometry) {  
var node = this.createElementNSPlus("gml:polygonMember");  
this.writeNode("Polygon", geometry, node);  
return node;  
},  
"GeometryCollection": function(geometry) {  
var node = this.createElementNSPlus("gml:GeometryCollection");  
for(var i=0, len=geometry.components.length; i<len; ++i) {  
this.writeNode("geometryMember", geometry.components[i], node);  
}  
return node;  
},  
"geometryMember": function(geometry) {  
var node = this.createElementNSPlus("gml:geometryMember");  
var child = this.writeNode("feature:_geometry", geometry);  
node.appendChild(child.firstChild);  
return node;  
}  
},  
"feature": {  
"_typeName": function(feature) {  
var node = this.createElementNSPlus("feature:" + this.featureType, {  
attributes: {fid: feature.fid}  
});  
if(feature.geometry) {  
this.writeNode("feature:_geometry", feature.geometry, node);  
}  
for(var name in feature.attributes) {  
var value = feature.attributes[name];  
if(value != null) {  
this.writeNode(  
"feature:_attribute",  
{name: name, value: value}, node  
);  
}  
}  
return node;  
},  
"_geometry": function(geometry) {  
if(this.externalProjection && this.internalProjection) {  
geometry = geometry.clone().transform(  
this.internalProjection, this.externalProjection  
);  
}  
var node = this.createElementNSPlus(  
"feature:" + this.geometryName  
);  
var type = this.geometryTypes[geometry.CLASS_NAME];  
var child = this.writeNode("gml:" + type, geometry, node);  
if(this.srsName) {  
child.setAttribute("srsName", this.srsName);  
}  
return node;  
},  
"_attribute": function(obj) {  
return this.createElementNSPlus("feature:" + obj.name, {  
value: obj.value  
});  
}  
},  
"wfs": {  
"FeatureCollection": function(features) {  
/**  
* This is only here because GML2 only describes abstract  
* feature collections. Typically, you would not be using  
* the GML format to write wfs elements. This just provides  
* some way to write out lists of features. GML3 defines the  
* featureMembers element, so that is used by default instead.  
*/  
var node = this.createElementNSPlus("wfs:FeatureCollection");  
for(var i=0, len=features.length; i<len; ++i) {  
this.writeNode("gml:featureMember", features[i], node);  
}  
return node;  
}  
}  
},  
 
/**  
* Function: setGeometryTypes  
* Sets the <geometryTypes> mapping.  
*/  
setGeometryTypes: function() {  
this.geometryTypes = {  
"OpenLayers.Geometry.Point": "Point",  
"OpenLayers.Geometry.MultiPoint": "MultiPoint",  
"OpenLayers.Geometry.LineString": "LineString",  
"OpenLayers.Geometry.MultiLineString": "MultiLineString",  
"OpenLayers.Geometry.Polygon": "Polygon",  
"OpenLayers.Geometry.MultiPolygon": "MultiPolygon",  
"OpenLayers.Geometry.Collection": "GeometryCollection"  
};  
},  
 
CLASS_NAME: "OpenLayers.Format.GML.Base"  
 
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/GML/Base.js  
*/  
 
/**  
* Class: OpenLayers.Format.GML.v2  
* Parses GML version 2.  
*  
* Inherits from:  
* - <OpenLayers.Format.GML.Base>  
*/  
OpenLayers.Format.GML.v2 = OpenLayers.Class(OpenLayers.Format.GML.Base, {  
 
/**  
* Property: schemaLocation  
* {String} Schema location for a particular minor version.  
*/  
schemaLocation: "http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd",  
 
/**  
* Constructor: OpenLayers.Format.GML.v2  
* Create a parser for GML v2.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*  
* Valid options properties:  
* featureType - {String} Local (without prefix) feature typeName (required).  
* featureNS - {String} Feature namespace (required).  
* geometryName - {String} Geometry element name.  
*/  
initialize: function(options) {  
OpenLayers.Format.GML.Base.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* Property: readers  
* Contains public functions, grouped by namespace prefix, that will  
* be applied when a namespaced node is found matching the function  
* name. The function will be applied in the scope of this parser  
* with two arguments: the node being read and a context object passed  
* from the parent.  
*/  
readers: {  
"gml": OpenLayers.Util.applyDefaults({  
"outerBoundaryIs": function(node, container) {  
var obj = {};  
this.readChildNodes(node, obj);  
container.outer = obj.components[0];  
},  
"innerBoundaryIs": function(node, container) {  
var obj = {};  
this.readChildNodes(node, obj);  
container.inner.push(obj.components[0]);  
},  
"Box": function(node, container) {  
var obj = {};  
this.readChildNodes(node, obj);  
if(!container.components) {  
container.components = [];  
}  
var min = obj.points[0];  
var max = obj.points[1];  
container.components.push(  
new OpenLayers.Bounds(min.x, min.y, max.x, max.y)  
);  
}  
}, OpenLayers.Format.GML.Base.prototype.readers["gml"]),  
"feature": OpenLayers.Format.GML.Base.prototype.readers["feature"],  
"wfs": OpenLayers.Format.GML.Base.prototype.readers["wfs"]  
},  
 
/**  
* Method: write  
*  
* Parameters:  
* features - {Array(<OpenLayers.Feature.Vector>) | OpenLayers.Feature.Vector}  
* An array of features or a single feature.  
*  
* Returns:  
* {String} Given an array of features, a doc with a gml:featureMembers  
* element will be returned. Given a single feature, a doc with a  
* gml:featureMember element will be returned.  
*/  
write: function(features) {  
var name;  
if(features instanceof Array) {  
// GML2 only has abstract feature collections  
// wfs provides a feature collection from a well-known schema  
name = "wfs:FeatureCollection";  
} else {  
name = "gml:featureMember";  
}  
var root = this.writeNode(name, features);  
this.setAttributeNS(  
root, this.namespaces["xsi"],  
"xsi:schemaLocation", this.schemaLocation  
);  
 
return OpenLayers.Format.XML.prototype.write.apply(this, [root]);  
},  
 
/**  
* Property: writers  
* As a compliment to the readers property, this structure contains public  
* writing functions grouped by namespace alias and named like the  
* node names they produce.  
*/  
writers: {  
"gml": OpenLayers.Util.applyDefaults({  
"Point": function(geometry) {  
var node = this.createElementNSPlus("gml:Point");  
this.writeNode("coordinates", [geometry], node);  
return node;  
},  
"coordinates": function(points) {  
var numPoints = points.length;  
var parts = new Array(numPoints);  
var point;  
for(var i=0; i<numPoints; ++i) {  
point = points[i];  
if(this.xy) {  
parts[i] = point.x + "," + point.y;  
} else {  
parts[i] = point.y + "," + point.x;  
}  
if(point.z != undefined) { // allow null or undefined  
parts[i] += "," + point.z;  
}  
}  
return this.createElementNSPlus("gml:coordinates", {  
attributes: {  
decimal: ".", cs: ",", ts: " "  
},  
value: (numPoints == 1) ? parts[0] : parts.join(" ")  
});  
},  
"LineString": function(geometry) {  
var node = this.createElementNSPlus("gml:LineString");  
this.writeNode("coordinates", geometry.components, node);  
return node;  
},  
"Polygon": function(geometry) {  
var node = this.createElementNSPlus("gml:Polygon");  
this.writeNode("outerBoundaryIs", geometry.components[0], node);  
for(var i=1; i<geometry.components.length; ++i) {  
this.writeNode(  
"innerBoundaryIs", geometry.components[i], node  
);  
}  
return node;  
},  
"outerBoundaryIs": function(ring) {  
var node = this.createElementNSPlus("gml:outerBoundaryIs");  
this.writeNode("LinearRing", ring, node);  
return node;  
},  
"innerBoundaryIs": function(ring) {  
var node = this.createElementNSPlus("gml:innerBoundaryIs");  
this.writeNode("LinearRing", ring, node);  
return node;  
},  
"LinearRing": function(ring) {  
var node = this.createElementNSPlus("gml:LinearRing");  
this.writeNode("coordinates", ring.components, node);  
return node;  
},  
"Box": function(bounds) {  
var node = this.createElementNSPlus("gml:Box");  
this.writeNode("coordinates", [  
{x: bounds.left, y: bounds.bottom},  
{x: bounds.right, y: bounds.top}  
], node);  
// srsName attribute is optional for gml:Box  
if(this.srsName) {  
node.setAttribute("srsName", this.srsName);  
}  
return node;  
}  
}, OpenLayers.Format.GML.Base.prototype.writers["gml"]),  
"feature": OpenLayers.Format.GML.Base.prototype.writers["feature"],  
"wfs": OpenLayers.Format.GML.Base.prototype.writers["wfs"]  
},  
 
CLASS_NAME: "OpenLayers.Format.GML.v2"  
 
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/GML/Base.js  
*/  
 
/**  
* Class: OpenLayers.Format.GML.v3  
* Parses GML version 3.  
*  
* Inherits from:  
* - <OpenLayers.Format.GML.Base>  
*/  
OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {  
 
/**  
* Property: schemaLocation  
* {String} Schema location for a particular minor version. The writers  
* conform with the Simple Features Profile for GML.  
*/  
schemaLocation: "http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",  
 
/**  
* Property: curve  
* {Boolean} Write gml:Curve instead of gml:LineString elements. This also  
* affects the elements in multi-part geometries. Default is false.  
* To write gml:Curve elements instead of gml:LineString, set curve  
* to true in the options to the contstructor (cannot be changed after  
* instantiation).  
*/  
curve: false,  
 
/**  
* Property: multiCurve  
* {Boolean} Write gml:MultiCurve instead of gml:MultiLineString. Since  
* the latter is deprecated in GML 3, the default is true. To write  
* gml:MultiLineString instead of gml:MultiCurve, set multiCurve to  
* false in the options to the constructor (cannot be changed after  
* instantiation).  
*/  
multiCurve: true,  
 
/**  
* Property: surface  
* {Boolean} Write gml:Surface instead of gml:Polygon elements. This also  
* affects the elements in multi-part geometries. Default is false.  
* To write gml:Surface elements instead of gml:Polygon, set surface  
* to true in the options to the contstructor (cannot be changed after  
* instantiation).  
*/  
surface: false,  
 
/**  
* Property: multiSurface  
* {Boolean} Write gml:multiSurface instead of gml:MultiPolygon. Since  
* the latter is deprecated in GML 3, the default is true. To write  
* gml:MultiPolygon instead of gml:multiSurface, set multiSurface to  
* false in the options to the constructor (cannot be changed after  
* instantiation).  
*/  
multiSurface: true,  
 
/**  
* Constructor: OpenLayers.Format.GML.v3  
* Create a parser for GML v3.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*  
* Valid options properties:  
* featureType - {String} Local (without prefix) feature typeName (required).  
* featureNS - {String} Feature namespace (required).  
* geometryName - {String} Geometry element name.  
*/  
initialize: function(options) {  
OpenLayers.Format.GML.Base.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* Property: readers  
* Contains public functions, grouped by namespace prefix, that will  
* be applied when a namespaced node is found matching the function  
* name. The function will be applied in the scope of this parser  
* with two arguments: the node being read and a context object passed  
* from the parent.  
*/  
readers: {  
"gml": OpenLayers.Util.applyDefaults({  
"featureMembers": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"Curve": function(node, container) {  
var obj = {points: []};  
this.readChildNodes(node, obj);  
if(!container.components) {  
container.components = [];  
}  
container.components.push(  
new OpenLayers.Geometry.LineString(obj.points)  
);  
},  
"segments": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"LineStringSegment": function(node, container) {  
var obj = {};  
this.readChildNodes(node, obj);  
if(obj.points) {  
Array.prototype.push.apply(container.points, obj.points);  
}  
},  
"pos": function(node, obj) {  
var str = this.getChildValue(node).replace(  
this.regExes.trimSpace, ""  
);  
var coords = str.split(this.regExes.splitSpace);  
var point;  
if(this.xy) {  
point = new OpenLayers.Geometry.Point(  
coords[0], coords[1], coords[2]  
);  
} else {  
point = new OpenLayers.Geometry.Point(  
coords[1], coords[0], coords[2]  
);  
}  
obj.points = [point];  
},  
"posList": function(node, obj) {  
var str = this.getChildValue(node).replace(  
this.regExes.trimSpace, ""  
);  
var coords = str.split(this.regExes.splitSpace);  
var dim = parseInt(node.getAttribute("dimension")) || 2;  
var j, x, y, z;  
var numPoints = coords.length / dim;  
var points = new Array(numPoints);  
for(var i=0, len=coords.length; i<len; i += dim) {  
x = coords[i];  
y = coords[i+1];  
z = (dim == 2) ? undefined : coords[i+2];  
if (this.xy) {  
points[i/dim] = new OpenLayers.Geometry.Point(x, y, z);  
} else {  
points[i/dim] = new OpenLayers.Geometry.Point(y, x, z);  
}  
}  
obj.points = points;  
},  
"Surface": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"patches": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"PolygonPatch": function(node, obj) {  
this.readers.gml.Polygon.apply(this, [node, obj]);  
},  
"exterior": function(node, container) {  
var obj = {};  
this.readChildNodes(node, obj);  
container.outer = obj.components[0];  
},  
"interior": function(node, container) {  
var obj = {};  
this.readChildNodes(node, obj);  
container.inner.push(obj.components[0]);  
},  
"MultiCurve": function(node, container) {  
var obj = {components: []};  
this.readChildNodes(node, obj);  
if(obj.components.length > 0) {  
container.components = [  
new OpenLayers.Geometry.MultiLineString(obj.components)  
];  
}  
},  
"curveMember": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"MultiSurface": function(node, container) {  
var obj = {components: []};  
this.readChildNodes(node, obj);  
if(obj.components.length > 0) {  
container.components = [  
new OpenLayers.Geometry.MultiPolygon(obj.components)  
];  
}  
},  
"surfaceMember": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"surfaceMembers": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"pointMembers": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"lineStringMembers": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"polygonMembers": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"geometryMembers": function(node, obj) {  
this.readChildNodes(node, obj);  
},  
"Envelope": function(node, container) {  
var obj = {points: new Array(2)};  
this.readChildNodes(node, obj);  
if(!container.components) {  
container.components = [];  
}  
var min = obj.points[0];  
var max = obj.points[1];  
container.components.push(  
new OpenLayers.Bounds(min.x, min.y, max.x, max.y)  
);  
},  
"lowerCorner": function(node, container) {  
var obj = {};  
this.readers.gml.pos.apply(this, [node, obj]);  
container.points[0] = obj.points[0];  
},  
"upperCorner": function(node, container) {  
var obj = {};  
this.readers.gml.pos.apply(this, [node, obj]);  
container.points[1] = obj.points[0];  
}  
}, OpenLayers.Format.GML.Base.prototype.readers["gml"]),  
"feature": OpenLayers.Format.GML.Base.prototype.readers["feature"],  
"wfs": OpenLayers.Format.GML.Base.prototype.readers["wfs"]  
},  
 
/**  
* Method: write  
*  
* Parameters:  
* features - {Array(<OpenLayers.Feature.Vector>) | OpenLayers.Feature.Vector}  
* An array of features or a single feature.  
*  
* Returns:  
* {String} Given an array of features, a doc with a gml:featureMembers  
* element will be returned. Given a single feature, a doc with a  
* gml:featureMember element will be returned.  
*/  
write: function(features) {  
var name;  
if(features instanceof Array) {  
name = "featureMembers";  
} else {  
name = "featureMember";  
}  
var root = this.writeNode("gml:" + name, features);  
this.setAttributeNS(  
root, this.namespaces["xsi"],  
"xsi:schemaLocation", this.schemaLocation  
);  
 
return OpenLayers.Format.XML.prototype.write.apply(this, [root]);  
},  
 
/**  
* Property: writers  
* As a compliment to the readers property, this structure contains public  
* writing functions grouped by namespace alias and named like the  
* node names they produce.  
*/  
writers: {  
"gml": OpenLayers.Util.applyDefaults({  
"featureMembers": function(features) {  
var node = this.createElementNSPlus("gml:featureMembers");  
for(var i=0, len=features.length; i<len; ++i) {  
this.writeNode("feature:_typeName", features[i], node);  
}  
return node;  
},  
"Point": function(geometry) {  
var node = this.createElementNSPlus("gml:Point");  
this.writeNode("pos", geometry, node);  
return node;  
},  
"pos": function(point) {  
// only 2d for simple features profile  
var pos = (this.xy) ?  
(point.x + " " + point.y) : (point.y + " " + point.x);  
return this.createElementNSPlus("gml:pos", {  
value: pos  
});  
},  
"LineString": function(geometry) {  
var node = this.createElementNSPlus("gml:LineString");  
this.writeNode("posList", geometry.components, node);  
return node;  
},  
"Curve": function(geometry) {  
var node = this.createElementNSPlus("gml:Curve");  
this.writeNode("segments", geometry, node);  
return node;  
},  
"segments": function(geometry) {  
var node = this.createElementNSPlus("gml:segments");  
this.writeNode("LineStringSegment", geometry, node);  
return node;  
},  
"LineStringSegment": function(geometry) {  
var node = this.createElementNSPlus("gml:LineStringSegment");  
this.writeNode("posList", geometry.components, node);  
return node;  
},  
"posList": function(points) {  
// only 2d for simple features profile  
var len = points.length;  
var parts = new Array(len);  
var point;  
for(var i=0; i<len; ++i) {  
point = points[i];  
if(this.xy) {  
parts[i] = point.x + " " + point.y;  
} else {  
parts[i] = point.y + " " + point.x;  
}  
}  
return this.createElementNSPlus("gml:posList", {  
value: parts.join(" ")  
});  
},  
"Surface": function(geometry) {  
var node = this.createElementNSPlus("gml:Surface");  
this.writeNode("patches", geometry, node);  
return node;  
},  
"patches": function(geometry) {  
var node = this.createElementNSPlus("gml:patches");  
this.writeNode("PolygonPatch", geometry, node);  
return node;  
},  
"PolygonPatch": function(geometry) {  
var node = this.createElementNSPlus("gml:PolygonPatch", {  
attributes: {interpolation: "planar"}  
});  
this.writeNode("exterior", geometry.components[0], node);  
for(var i=1, len=geometry.components.length; i<len; ++i) {  
this.writeNode(  
"interior", geometry.components[i], node  
);  
}  
return node;  
},  
"Polygon": function(geometry) {  
var node = this.createElementNSPlus("gml:Polygon");  
this.writeNode("exterior", geometry.components[0], node);  
for(var i=1, len=geometry.components.length; i<len; ++i) {  
this.writeNode(  
"interior", geometry.components[i], node  
);  
}  
return node;  
},  
"exterior": function(ring) {  
var node = this.createElementNSPlus("gml:exterior");  
this.writeNode("LinearRing", ring, node);  
return node;  
},  
"interior": function(ring) {  
var node = this.createElementNSPlus("gml:interior");  
this.writeNode("LinearRing", ring, node);  
return node;  
},  
"LinearRing": function(ring) {  
var node = this.createElementNSPlus("gml:LinearRing");  
this.writeNode("posList", ring.components, node);  
return node;  
},  
"MultiCurve": function(geometry) {  
var node = this.createElementNSPlus("gml:MultiCurve");  
for(var i=0, len=geometry.components.length; i<len; ++i) {  
this.writeNode("curveMember", geometry.components[i], node);  
}  
return node;  
},  
"curveMember": function(geometry) {  
var node = this.createElementNSPlus("gml:curveMember");  
if(this.curve) {  
this.writeNode("Curve", geometry, node);  
} else {  
this.writeNode("LineString", geometry, node);  
}  
return node;  
},  
"MultiSurface": function(geometry) {  
var node = this.createElementNSPlus("gml:MultiSurface");  
for(var i=0, len=geometry.components.length; i<len; ++i) {  
this.writeNode("surfaceMember", geometry.components[i], node);  
}  
return node;  
},  
"surfaceMember": function(polygon) {  
var node = this.createElementNSPlus("gml:surfaceMember");  
if(this.surface) {  
this.writeNode("Surface", polygon, node);  
} else {  
this.writeNode("Polygon", polygon, node);  
}  
return node;  
},  
"Envelope": function(bounds) {  
var node = this.createElementNSPlus("gml:Envelope");  
this.writeNode("lowerCorner", bounds, node);  
this.writeNode("upperCorner", bounds, node);  
// srsName attribute is required for gml:Envelope  
if(this.srsName) {  
node.setAttribute("srsName", this.srsName);  
}  
return node;  
},  
"lowerCorner": function(bounds) {  
// only 2d for simple features profile  
var pos = (this.xy) ?  
(bounds.left + " " + bounds.bottom) :  
(bounds.bottom + " " + bounds.left);  
return this.createElementNSPlus("gml:lowerCorner", {  
value: pos  
});  
},  
"upperCorner": function(bounds) {  
// only 2d for simple features profile  
var pos = (this.xy) ?  
(bounds.right + " " + bounds.top) :  
(bounds.top + " " + bounds.right);  
return this.createElementNSPlus("gml:upperCorner", {  
value: pos  
});  
}  
}, OpenLayers.Format.GML.Base.prototype.writers["gml"]),  
"feature": OpenLayers.Format.GML.Base.prototype.writers["feature"],  
"wfs": OpenLayers.Format.GML.Base.prototype.writers["wfs"]  
},  
 
/**  
* Function: setGeometryTypes  
* Sets the <geometryTypes> mapping.  
*/  
setGeometryTypes: function() {  
this.geometryTypes = {  
"OpenLayers.Geometry.Point": "Point",  
"OpenLayers.Geometry.MultiPoint": "MultiPoint",  
"OpenLayers.Geometry.LineString": (this.curve === true) ? "Curve": "LineString",  
"OpenLayers.Geometry.MultiLineString": (this.multiCurve === false) ? "MultiLineString" : "MultiCurve",  
"OpenLayers.Geometry.Polygon": (this.surface === true) ? "Surface" : "Polygon",  
"OpenLayers.Geometry.MultiPolygon": (this.multiSurface === false) ? "MultiPolygon" : "MultiSurface",  
"OpenLayers.Geometry.Collection": "GeometryCollection"  
};  
},  
 
CLASS_NAME: "OpenLayers.Format.GML.v3"  
 
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/XML.js  
* @requires OpenLayers/Feature/Vector.js  
* @requires OpenLayers/Geometry/Point.js  
* @requires OpenLayers/Geometry/LineString.js  
* @requires OpenLayers/Projection.js  
*/  
 
/**  
* Class: OpenLayers.Format.GPX  
* Read/write GPX parser. Create a new instance with the  
* <OpenLayers.Format.GPX> constructor.  
*  
* Inherits from:  
* - <OpenLayers.Format.XML>  
*/  
OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, {  
/**  
* APIProperty: extractWaypoints  
* {Boolean} Extract waypoints from GPX. (default: true)  
*/  
extractWaypoints: true,  
 
/**  
* APIProperty: extractTracks  
* {Boolean} Extract tracks from GPX. (default: true)  
*/  
extractTracks: true,  
 
/**  
* APIProperty: extractRoutes  
* {Boolean} Extract routes from GPX. (default: true)  
*/  
extractRoutes: true,  
 
/**  
* APIProperty: extractAttributes  
* {Boolean} Extract feature attributes from GPX. (default: true)  
* NOTE: Attributes as part of extensions to the GPX standard may not  
* be extracted.  
*/  
extractAttributes: true,  
 
/**  
* Constructor: OpenLayers.Format.GPX  
* Create a new parser for GPX.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*/  
initialize: function(options) {  
// GPX coordinates are always in longlat WGS84  
this.externalProjection = new OpenLayers.Projection("EPSG:4326");  
 
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* APIMethod: read  
* Return a list of features from a GPX doc  
*  
* Parameters:  
* doc - {Element}  
*  
* Returns:  
* An Array of <OpenLayers.Feature.Vector>s  
*/  
read: function(doc) {  
if (typeof doc == "string") {  
doc = OpenLayers.Format.XML.prototype.read.apply(this, [doc]);  
}  
var features = [];  
 
if(this.extractTracks) {  
var tracks = doc.getElementsByTagName("trk");  
for (var i=0, len=tracks.length; i<len; i++) {  
// Attributes are only in trk nodes, not trkseg nodes  
var attrs = {};  
if(this.extractAttributes) {  
attrs = this.parseAttributes(tracks[i]);  
}  
 
var segs = this.getElementsByTagNameNS(tracks[i], tracks[i].namespaceURI, "trkseg");  
for (var j = 0, seglen = segs.length; j < seglen; j++) {  
// We don't yet support extraction of trkpt attributes  
// All trksegs of a trk get that trk's attributes  
var track = this.extractSegment(segs[j], "trkpt");  
features.push(new OpenLayers.Feature.Vector(track, attrs));  
}  
}  
}  
 
if(this.extractRoutes) {  
var routes = doc.getElementsByTagName("rte");  
for (var k=0, klen=routes.length; k<klen; k++) {  
var attrs = {};  
if(this.extractAttributes) {  
attrs = this.parseAttributes(routes[k]);  
}  
var route = this.extractSegment(routes[k], "rtept");  
features.push(new OpenLayers.Feature.Vector(route, attrs));  
}  
}  
 
if(this.extractWaypoints) {  
var waypoints = doc.getElementsByTagName("wpt");  
for (var l = 0, len = waypoints.length; l < len; l++) {  
var attrs = {};  
if(this.extractAttributes) {  
attrs = this.parseAttributes(waypoints[l]);  
}  
var wpt = new OpenLayers.Geometry.Point(waypoints[l].getAttribute("lon"), waypoints[l].getAttribute("lat"));  
features.push(new OpenLayers.Feature.Vector(wpt, attrs));  
}  
}  
 
if (this.internalProjection && this.externalProjection) {  
for (var g = 0, featLength = features.length; g < featLength; g++) {  
features[g].geometry.transform(this.externalProjection,  
this.internalProjection);  
}  
}  
 
return features;  
},  
 
/**  
* Method: extractSegment  
*  
* Parameters:  
* segment - {<DOMElement>} a trkseg or rte node to parse  
* segmentType - {String} nodeName of waypoints that form the line  
*  
* Returns:  
* {<OpenLayers.Geometry.LineString>} A linestring geometry  
*/  
extractSegment: function(segment, segmentType) {  
var points = this.getElementsByTagNameNS(segment, segment.namespaceURI, segmentType);  
var point_features = [];  
for (var i = 0, len = points.length; i < len; i++) {  
point_features.push(new OpenLayers.Geometry.Point(points[i].getAttribute("lon"), points[i].getAttribute("lat")));  
}  
return new OpenLayers.Geometry.LineString(point_features);  
},  
 
/**  
* Method: parseAttributes  
*  
* Parameters:  
* node - {<DOMElement>}  
*  
* Returns:  
* {Object} An attributes object.  
*/  
parseAttributes: function(node) {  
// node is either a wpt, trk or rte  
// attributes are children of the form <attr>value</attr>  
var attributes = {};  
var attrNode = node.firstChild;  
while(attrNode) {  
if(attrNode.nodeType == 1) {  
var value = attrNode.firstChild;  
if(value.nodeType == 3 || value.nodeType == 4) {  
name = (attrNode.prefix) ?  
attrNode.nodeName.split(":")[1] :  
attrNode.nodeName;  
if(name != "trkseg" && name != "rtept") {  
attributes[name] = value.nodeValue;  
}  
}  
}  
attrNode = attrNode.nextSibling;  
}  
return attributes;  
},  
 
CLASS_NAME: "OpenLayers.Format.GPX"  
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/JSON.js  
* @requires OpenLayers/Feature/Vector.js  
* @requires OpenLayers/Geometry/Point.js  
* @requires OpenLayers/Geometry/MultiPoint.js  
* @requires OpenLayers/Geometry/LineString.js  
* @requires OpenLayers/Geometry/MultiLineString.js  
* @requires OpenLayers/Geometry/Polygon.js  
* @requires OpenLayers/Geometry/MultiPolygon.js  
* @requires OpenLayers/Console.js  
*/  
 
/**  
* Class: OpenLayers.Format.GeoJSON  
* Read and write GeoJSON. Create a new parser with the  
* <OpenLayers.Format.GeoJSON> constructor.  
*  
* Inherits from:  
* - <OpenLayers.Format.JSON>  
*/  
OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {  
 
/**  
* APIProperty: ignoreExtraDims  
* {Boolean} Ignore dimensions higher than 2 when reading geometry  
* coordinates.  
*/  
ignoreExtraDims: false,  
 
/**  
* Constructor: OpenLayers.Format.GeoJSON  
* Create a new parser for GeoJSON.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*/  
initialize: function(options) {  
OpenLayers.Format.JSON.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* APIMethod: read  
* Deserialize a GeoJSON string.  
*  
* Parameters:  
* json - {String} A GeoJSON string  
* type - {String} Optional string that determines the structure of  
* the output. Supported values are "Geometry", "Feature", and  
* "FeatureCollection". If absent or null, a default of  
* "FeatureCollection" is assumed.  
* filter - {Function} A function which will be called for every key and  
* value at every level of the final result. Each value will be  
* replaced by the result of the filter function. This can be used to  
* reform generic objects into instances of classes, or to transform  
* date strings into Date objects.  
*  
* Returns:  
* {Object} The return depends on the value of the type argument. If type  
* is "FeatureCollection" (the default), the return will be an array  
* of <OpenLayers.Feature.Vector>. If type is "Geometry", the input json  
* must represent a single geometry, and the return will be an  
* <OpenLayers.Geometry>. If type is "Feature", the input json must  
* represent a single feature, and the return will be an  
* <OpenLayers.Feature.Vector>.  
*/  
read: function(json, type, filter) {  
type = (type) ? type : "FeatureCollection";  
var results = null;  
var obj = null;  
if (typeof json == "string") {  
obj = OpenLayers.Format.JSON.prototype.read.apply(this,  
[json, filter]);  
} else {  
obj = json;  
}  
if(!obj) {  
OpenLayers.Console.error("Bad JSON: " + json);  
} else if(typeof(obj.type) != "string") {  
OpenLayers.Console.error("Bad GeoJSON - no type: " + json);  
} else if(this.isValidType(obj, type)) {  
switch(type) {  
case "Geometry":  
try {  
results = this.parseGeometry(obj);  
} catch(err) {  
OpenLayers.Console.error(err);  
}  
break;  
case "Feature":  
try {  
results = this.parseFeature(obj);  
results.type = "Feature";  
} catch(err) {  
OpenLayers.Console.error(err);  
}  
break;  
case "FeatureCollection":  
// for type FeatureCollection, we allow input to be any type  
results = [];  
switch(obj.type) {  
case "Feature":  
try {  
results.push(this.parseFeature(obj));  
} catch(err) {  
results = null;  
OpenLayers.Console.error(err);  
}  
break;  
case "FeatureCollection":  
for(var i=0, len=obj.features.length; i<len; ++i) {  
try {  
results.push(this.parseFeature(obj.features[i]));  
} catch(err) {  
results = null;  
OpenLayers.Console.error(err);  
}  
}  
break;  
default:  
try {  
var geom = this.parseGeometry(obj);  
results.push(new OpenLayers.Feature.Vector(geom));  
} catch(err) {  
results = null;  
OpenLayers.Console.error(err);  
}  
}  
break;  
}  
}  
return results;  
},  
 
/**  
* Method: isValidType  
* Check if a GeoJSON object is a valid representative of the given type.  
*  
* Returns:  
* {Boolean} The object is valid GeoJSON object of the given type.  
*/  
isValidType: function(obj, type) {  
var valid = false;  
switch(type) {  
case "Geometry":  
if(OpenLayers.Util.indexOf(  
["Point", "MultiPoint", "LineString", "MultiLineString",  
"Polygon", "MultiPolygon", "Box", "GeometryCollection"],  
obj.type) == -1) {  
// unsupported geometry type  
OpenLayers.Console.error("Unsupported geometry type: " +  
obj.type);  
} else {  
valid = true;  
}  
break;  
case "FeatureCollection":  
// allow for any type to be converted to a feature collection  
valid = true;  
break;  
default:  
// for Feature types must match  
if(obj.type == type) {  
valid = true;  
} else {  
OpenLayers.Console.error("Cannot convert types from " +  
obj.type + " to " + type);  
}  
}  
return valid;  
},  
 
/**  
* Method: parseFeature  
* Convert a feature object from GeoJSON into an  
* <OpenLayers.Feature.Vector>.  
*  
* Parameters:  
* obj - {Object} An object created from a GeoJSON object  
*  
* Returns:  
* {<OpenLayers.Feature.Vector>} A feature.  
*/  
parseFeature: function(obj) {  
var feature, geometry, attributes, bbox;  
attributes = (obj.properties) ? obj.properties : {};  
bbox = (obj.geometry && obj.geometry.bbox) || obj.bbox;  
try {  
geometry = this.parseGeometry(obj.geometry);  
} catch(err) {  
// deal with bad geometries  
throw err;  
}  
feature = new OpenLayers.Feature.Vector(geometry, attributes);  
if(bbox) {  
feature.bounds = OpenLayers.Bounds.fromArray(bbox);  
}  
if(obj.id) {  
feature.fid = obj.id;  
}  
return feature;  
},  
 
/**  
* Method: parseGeometry  
* Convert a geometry object from GeoJSON into an <OpenLayers.Geometry>.  
*  
* Parameters:  
* obj - {Object} An object created from a GeoJSON object  
*  
* Returns:  
* {<OpenLayers.Geometry>} A geometry.  
*/  
parseGeometry: function(obj) {  
if (obj == null) {  
return null;  
}  
var geometry, collection = false;  
if(obj.type == "GeometryCollection") {  
if(!(obj.geometries instanceof Array)) {  
throw "GeometryCollection must have geometries array: " + obj;  
}  
var numGeom = obj.geometries.length;  
var components = new Array(numGeom);  
for(var i=0; i<numGeom; ++i) {  
components[i] = this.parseGeometry.apply(  
this, [obj.geometries[i]]  
);  
}  
geometry = new OpenLayers.Geometry.Collection(components);  
collection = true;  
} else {  
if(!(obj.coordinates instanceof Array)) {  
throw "Geometry must have coordinates array: " + obj;  
}  
if(!this.parseCoords[obj.type.toLowerCase()]) {  
throw "Unsupported geometry type: " + obj.type;  
}  
try {  
geometry = this.parseCoords[obj.type.toLowerCase()].apply(  
this, [obj.coordinates]  
);  
} catch(err) {  
// deal with bad coordinates  
throw err;  
}  
}  
// We don't reproject collections because the children are reprojected  
// for us when they are created.  
if (this.internalProjection && this.externalProjection && !collection) {  
geometry.transform(this.externalProjection,  
this.internalProjection);  
}  
return geometry;  
},  
 
/**  
* Property: parseCoords  
* Object with properties corresponding to the GeoJSON geometry types.  
* Property values are functions that do the actual parsing.  
*/  
parseCoords: {  
/**  
* Method: parseCoords.point  
* Convert a coordinate array from GeoJSON into an  
* <OpenLayers.Geometry>.  
*  
* Parameters:  
* array - {Object} The coordinates array from the GeoJSON fragment.  
*  
* Returns:  
* {<OpenLayers.Geometry>} A geometry.  
*/  
"point": function(array) {  
if (this.ignoreExtraDims == false &&  
array.length != 2) {  
throw "Only 2D points are supported: " + array;  
}  
return new OpenLayers.Geometry.Point(array[0], array[1]);  
},  
 
/**  
* Method: parseCoords.multipoint  
* Convert a coordinate array from GeoJSON into an  
* <OpenLayers.Geometry>.  
*  
* Parameters:  
* array {Object} The coordinates array from the GeoJSON fragment.  
*  
* Returns:  
* {<OpenLayers.Geometry>} A geometry.  
*/  
"multipoint": function(array) {  
var points = [];  
var p = null;  
for(var i=0, len=array.length; i<len; ++i) {  
try {  
p = this.parseCoords["point"].apply(this, [array[i]]);  
} catch(err) {  
throw err;  
}  
points.push(p);  
}  
return new OpenLayers.Geometry.MultiPoint(points);  
},  
 
/**  
* Method: parseCoords.linestring  
* Convert a coordinate array from GeoJSON into an  
* <OpenLayers.Geometry>.  
*  
* Parameters:  
* array - {Object} The coordinates array from the GeoJSON fragment.  
*  
* Returns:  
* {<OpenLayers.Geometry>} A geometry.  
*/  
"linestring": function(array) {  
var points = [];  
var p = null;  
for(var i=0, len=array.length; i<len; ++i) {  
try {  
p = this.parseCoords["point"].apply(this, [array[i]]);  
} catch(err) {  
throw err;  
}  
points.push(p);  
}  
return new OpenLayers.Geometry.LineString(points);  
},  
 
/**  
* Method: parseCoords.multilinestring  
* Convert a coordinate array from GeoJSON into an  
* <OpenLayers.Geometry>.  
*  
* Parameters:  
* array - {Object} The coordinates array from the GeoJSON fragment.  
*  
* Returns:  
* {<OpenLayers.Geometry>} A geometry.  
*/  
"multilinestring": function(array) {  
var lines = [];  
var l = null;  
for(var i=0, len=array.length; i<len; ++i) {  
try {  
l = this.parseCoords["linestring"].apply(this, [array[i]]);  
} catch(err) {  
throw err;  
}  
lines.push(l);  
}  
return new OpenLayers.Geometry.MultiLineString(lines);  
},  
 
/**  
* Method: parseCoords.polygon  
* Convert a coordinate array from GeoJSON into an  
* <OpenLayers.Geometry>.  
*  
* Returns:  
* {<OpenLayers.Geometry>} A geometry.  
*/  
"polygon": function(array) {  
var rings = [];  
var r, l;  
for(var i=0, len=array.length; i<len; ++i) {  
try {  
l = this.parseCoords["linestring"].apply(this, [array[i]]);  
} catch(err) {  
throw err;  
}  
r = new OpenLayers.Geometry.LinearRing(l.components);  
rings.push(r);  
}  
return new OpenLayers.Geometry.Polygon(rings);  
},  
 
/**  
* Method: parseCoords.multipolygon  
* Convert a coordinate array from GeoJSON into an  
* <OpenLayers.Geometry>.  
*  
* Parameters:  
* array - {Object} The coordinates array from the GeoJSON fragment.  
*  
* Returns:  
* {<OpenLayers.Geometry>} A geometry.  
*/  
"multipolygon": function(array) {  
var polys = [];  
var p = null;  
for(var i=0, len=array.length; i<len; ++i) {  
try {  
p = this.parseCoords["polygon"].apply(this, [array[i]]);  
} catch(err) {  
throw err;  
}  
polys.push(p);  
}  
return new OpenLayers.Geometry.MultiPolygon(polys);  
},  
 
/**  
* Method: parseCoords.box  
* Convert a coordinate array from GeoJSON into an  
* <OpenLayers.Geometry>.  
*  
* Parameters:  
* array - {Object} The coordinates array from the GeoJSON fragment.  
*  
* Returns:  
* {<OpenLayers.Geometry>} A geometry.  
*/  
"box": function(array) {  
if(array.length != 2) {  
throw "GeoJSON box coordinates must have 2 elements";  
}  
return new OpenLayers.Geometry.Polygon([  
new OpenLayers.Geometry.LinearRing([  
new OpenLayers.Geometry.Point(array[0][0], array[0][1]),  
new OpenLayers.Geometry.Point(array[1][0], array[0][1]),  
new OpenLayers.Geometry.Point(array[1][0], array[1][1]),  
new OpenLayers.Geometry.Point(array[0][0], array[1][1]),  
new OpenLayers.Geometry.Point(array[0][0], array[0][1])  
])  
]);  
}  
 
},  
 
/**  
* APIMethod: write  
* Serialize a feature, geometry, array of features into a GeoJSON string.  
*  
* Parameters:  
* obj - {Object} An <OpenLayers.Feature.Vector>, <OpenLayers.Geometry>,  
* or an array of features.  
* pretty - {Boolean} Structure the output with newlines and indentation.  
* Default is false.  
*  
* Returns:  
* {String} The GeoJSON string representation of the input geometry,  
* features, or array of features.  
*/  
write: function(obj, pretty) {  
var geojson = {  
"type": null  
};  
if(obj instanceof Array) {  
geojson.type = "FeatureCollection";  
var numFeatures = obj.length;  
geojson.features = new Array(numFeatures);  
for(var i=0; i<numFeatures; ++i) {  
var element = obj[i];  
if(!element instanceof OpenLayers.Feature.Vector) {  
var msg = "FeatureCollection only supports collections " +  
"of features: " + element;  
throw msg;  
}  
geojson.features[i] = this.extract.feature.apply(  
this, [element]  
);  
}  
} else if (obj.CLASS_NAME.indexOf("OpenLayers.Geometry") == 0) {  
geojson = this.extract.geometry.apply(this, [obj]);  
} else if (obj instanceof OpenLayers.Feature.Vector) {  
geojson = this.extract.feature.apply(this, [obj]);  
if(obj.layer && obj.layer.projection) {  
geojson.crs = this.createCRSObject(obj);  
}  
}  
return OpenLayers.Format.JSON.prototype.write.apply(this,  
[geojson, pretty]);  
},  
 
/**  
* Method: createCRSObject  
* Create the CRS object for an object.  
*  
* Parameters:  
* object - {<OpenLayers.Feature.Vector>}  
*  
* Returns:  
* {Object} An object which can be assigned to the crs property  
* of a GeoJSON object.  
*/  
createCRSObject: function(object) {  
var proj = object.layer.projection.toString();  
var crs = {};  
if (proj.match(/epsg:/i)) {  
var code = parseInt(proj.substring(proj.indexOf(":") + 1));  
if (code == 4326) {  
crs = {  
"type": "OGC",  
"properties": {  
"urn": "urn:ogc:def:crs:OGC:1.3:CRS84"  
}  
};  
} else {  
crs = {  
"type": "EPSG",  
"properties": {  
"code": code  
}  
};  
}  
}  
return crs;  
},  
 
/**  
* Property: extract  
* Object with properties corresponding to the GeoJSON types.  
* Property values are functions that do the actual value extraction.  
*/  
extract: {  
/**  
* Method: extract.feature  
* Return a partial GeoJSON object representing a single feature.  
*  
* Parameters:  
* feature - {<OpenLayers.Feature.Vector>}  
*  
* Returns:  
* {Object} An object representing the point.  
*/  
'feature': function(feature) {  
var geom = this.extract.geometry.apply(this, [feature.geometry]);  
return {  
"type": "Feature",  
"id": feature.fid == null ? feature.id : feature.fid,  
"properties": feature.attributes,  
"geometry": geom  
};  
},  
 
/**  
* Method: extract.geometry  
* Return a GeoJSON object representing a single geometry.  
*  
* Parameters:  
* geometry - {<OpenLayers.Geometry>}  
*  
* Returns:  
* {Object} An object representing the geometry.  
*/  
'geometry': function(geometry) {  
if (geometry == null) {  
return null;  
}  
if (this.internalProjection && this.externalProjection) {  
geometry = geometry.clone();  
geometry.transform(this.internalProjection,  
this.externalProjection);  
}  
var geometryType = geometry.CLASS_NAME.split('.')[2];  
var data = this.extract[geometryType.toLowerCase()].apply(this, [geometry]);  
var json;  
if(geometryType == "Collection") {  
json = {  
"type": "GeometryCollection",  
"geometries": data  
};  
} else {  
json = {  
"type": geometryType,  
"coordinates": data  
};  
}  
 
return json;  
},  
 
/**  
* Method: extract.point  
* Return an array of coordinates from a point.  
*  
* Parameters:  
* point - {<OpenLayers.Geometry.Point>}  
*  
* Returns:  
* {Array} An array of coordinates representing the point.  
*/  
'point': function(point) {  
return [point.x, point.y];  
},  
 
/**  
* Method: extract.multipoint  
* Return an array of point coordinates from a multipoint.  
*  
* Parameters:  
* multipoint - {<OpenLayers.Geometry.MultiPoint>}  
*  
* Returns:  
* {Array} An array of point coordinate arrays representing  
* the multipoint.  
*/  
'multipoint': function(multipoint) {  
var array = [];  
for(var i=0, len=multipoint.components.length; i<len; ++i) {  
array.push(this.extract.point.apply(this, [multipoint.components[i]]));  
}  
return array;  
},  
 
/**  
* Method: extract.linestring  
* Return an array of coordinate arrays from a linestring.  
*  
* Parameters:  
* linestring - {<OpenLayers.Geometry.LineString>}  
*  
* Returns:  
* {Array} An array of coordinate arrays representing  
* the linestring.  
*/  
'linestring': function(linestring) {  
var array = [];  
for(var i=0, len=linestring.components.length; i<len; ++i) {  
array.push(this.extract.point.apply(this, [linestring.components[i]]));  
}  
return array;  
},  
 
/**  
* Method: extract.multilinestring  
* Return an array of linestring arrays from a linestring.  
*  
* Parameters:  
* linestring - {<OpenLayers.Geometry.MultiLineString>}  
*  
* Returns:  
* {Array} An array of linestring arrays representing  
* the multilinestring.  
*/  
'multilinestring': function(multilinestring) {  
var array = [];  
for(var i=0, len=multilinestring.components.length; i<len; ++i) {  
array.push(this.extract.linestring.apply(this, [multilinestring.components[i]]));  
}  
return array;  
},  
 
/**  
* Method: extract.polygon  
* Return an array of linear ring arrays from a polygon.  
*  
* Parameters:  
* polygon - {<OpenLayers.Geometry.Polygon>}  
*  
* Returns:  
* {Array} An array of linear ring arrays representing the polygon.  
*/  
'polygon': function(polygon) {  
var array = [];  
for(var i=0, len=polygon.components.length; i<len; ++i) {  
array.push(this.extract.linestring.apply(this, [polygon.components[i]]));  
}  
return array;  
},  
 
/**  
* Method: extract.multipolygon  
* Return an array of polygon arrays from a multipolygon.  
*  
* Parameters:  
* multipolygon - {<OpenLayers.Geometry.MultiPolygon>}  
*  
* Returns:  
* {Array} An array of polygon arrays representing  
* the multipolygon  
*/  
'multipolygon': function(multipolygon) {  
var array = [];  
for(var i=0, len=multipolygon.components.length; i<len; ++i) {  
array.push(this.extract.polygon.apply(this, [multipolygon.components[i]]));  
}  
return array;  
},  
 
/**  
* Method: extract.collection  
* Return an array of geometries from a geometry collection.  
*  
* Parameters:  
* collection - {<OpenLayers.Geometry.Collection>}  
*  
* Returns:  
* {Array} An array of geometry objects representing the geometry  
* collection.  
*/  
'collection': function(collection) {  
var len = collection.components.length;  
var array = new Array(len);  
for(var i=0; i<len; ++i) {  
array[i] = this.extract.geometry.apply(  
this, [collection.components[i]]  
);  
}  
return array;  
}  
 
 
},  
 
CLASS_NAME: "OpenLayers.Format.GeoJSON"  
 
});  
 
/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for  
* full list of contributors). Published under the Clear BSD license.  
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the  
* full text of the license. */  
 
/**  
* @requires OpenLayers/Format/XML.js  
* @requires OpenLayers/Feature/Vector.js  
* @requires OpenLayers/Geometry/Point.js  
* @requires OpenLayers/Geometry/LineString.js  
* @requires OpenLayers/Geometry/Polygon.js  
*/  
 
/**  
* Class: OpenLayers.Format.GeoRSS  
* Read/write GeoRSS parser. Create a new instance with the  
* <OpenLayers.Format.GeoRSS> constructor.  
*  
* Inherits from:  
* - <OpenLayers.Format.XML>  
*/  
OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, {  
 
/**  
* APIProperty: rssns  
* {String} RSS namespace to use. Defaults to  
* "http://backend.userland.com/rss2"  
*/  
rssns: "http://backend.userland.com/rss2",  
 
/**  
* APIProperty: featurens  
* {String} Feature Attributes namespace. Defaults to  
* "http://mapserver.gis.umn.edu/mapserver"  
*/  
featureNS: "http://mapserver.gis.umn.edu/mapserver",  
 
/**  
* APIProperty: georssns  
* {String} GeoRSS namespace to use. Defaults to  
* "http://www.georss.org/georss"  
*/  
georssns: "http://www.georss.org/georss",  
 
/**  
* APIProperty: geons  
* {String} W3C Geo namespace to use. Defaults to  
* "http://www.w3.org/2003/01/geo/wgs84_pos#"  
*/  
geons: "http://www.w3.org/2003/01/geo/wgs84_pos#",  
 
/**  
* APIProperty: featureTitle  
* {String} Default title for features. Defaults to "Untitled"  
*/  
featureTitle: "Untitled",  
 
/**  
* APIProperty: featureDescription  
* {String} Default description for features. Defaults to "No Description"  
*/  
featureDescription: "No Description",  
 
/**  
* Property: gmlParse  
* {Object} GML Format object for parsing features  
* Non-API and only created if necessary  
*/  
gmlParser: null,  
 
/**  
* APIProperty: xy  
* {Boolean} Order of the GML coordinate: true:(x,y) or false:(y,x)  
* For GeoRSS the default is (y,x), therefore: false  
*/  
xy: false,  
 
/**  
* Constructor: OpenLayers.Format.GeoRSS  
* Create a new parser for GeoRSS.  
*  
* Parameters:  
* options - {Object} An optional object whose properties will be set on  
* this instance.  
*/  
initialize: function(options) {  
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);  
},  
 
/**  
* Method: createGeometryFromItem  
* Return a geometry from a GeoRSS Item.  
*  
* Parameters:  
* item - {DOMElement} A GeoRSS item node.  
*  
* Returns:  
* {<OpenLayers.Geometry>} A geometry representing the node.  
*/  
createGeometryFromItem: function(item) {  
var point = this.getElementsByTagNameNS(item, this.georssns, "point");  
var lat = this.getElementsByTagNameNS(item, this.geons, 'lat');  
var lon = this.getElementsByTagNameNS(item, this.geons, 'long');  
 
var line = this.getElementsByTagNameNS(item,  
this.georssns,  
"line");  
var polygon = this.getElementsByTagNameNS(item,  
this.georssns,  
"polygon");  
var where = this.getElementsByTagNameNS(item,  
this.georssns,  
"where");  
var box = this.getElementsByTagNameNS(item,  
this.georssns,  
"box");  
 
if (point.length > 0 || (lat.length > 0 && lon.length > 0)) {  
var location;  
if (point.length > 0) {  
location = OpenLayers.String.trim(  
point[0].firstChild.nodeValue).split(/\s+/);  
if (location.length !=2) {  
location = OpenLayers.String.trim(  
point[0].firstChild.nodeValue).split(/\s*,\s*/);  
}  
} else {  
location = [parseFloat(lat[0].firstChild.nodeValue),  
parseFloat(lon[0].firstChild.nodeValue)];  
}  
 
var geometry = new OpenLayers.Geometry.Point(parseFloat(location[1]),  
parseFloat(location[0]));  
 
} else if (line.length > 0) {  
var coords = OpenLayers.String.trim(this.concatChildValues(line[0])).split(/\s+/);  
var components = [];  
var point;  
for (var i=0, len=coords.length; i<len; i+=2) {  
point = new OpenLayers.Geometry.Point(parseFloat(coords[i+1]),  
parseFloat(coords[i]));  
components.push(point);  
}  
geometry = new OpenLayers.Geometry.LineString(components);  
} else if (polygon.length > 0) {  
var coords = OpenLayers.String.trim(this.concatChildValues(polygon[0])).split(/\s+/);  
var components = [];  
var point;  
for (var i=0, len=coords.length; i<len; i+=2) {  
point = new OpenLayers.Geometry.Point(parseFloat(coords[i+1]),  
parseFloat(coords[i]));  
components.push(point);  
}  
geometry = new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(components)]);  
} else if (where.length > 0) {  
if (!this.gmlParser) {  
this.gmlParser = new OpenLayers.Format.GML({'xy': this.xy});  
}  
var feature = this.gmlParser.parseFeature(where[0]);  
geometry = feature.geometry;  
} else if (box.length > 0) {  
var coords = OpenLayers.String.trim(box[0].firstChild.nodeValue).split(/\s+/);  
var components = [];  
var point;  
if (coords.length > 3) {  
point = new OpenLayers.Geometry.Point(parseFloat(coords[1]),  
parseFloat(coords[0]));  
components.push(point);  
point = new OpenLayers.Geometry.Point(parseFloat(coords[1]),  
parseFloat(coords[2]));  
components.push(point);  
point = new OpenLayers.Geometry.Point(parseFloat(coords[3]),  
parseFloat(coords[2]));  
components.push(point);  
point = new OpenLayers.Geometry.Point(parseFloat(coords[3]),  
parseFloat(coords[0]));  
components.push(point);  
point = new OpenLayers.Geometry.Point(parseFloat(coords[1]),  
parseFloat(coords[0]));  
components.push(point);  
}  
geometry = new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(components)]);  
}  
 
if (geometry && this.internalProjection && this.externalProjection) {  
geometry.transform(this.externalProjection,  
this.internalProjection);  
}  
 
return geometry;  
},  
 
/**  
* Method: createFeatureFromItem  
* Return a feature from a GeoRSS Item.  
*  
* Parameters:  
* item - {DOMElement} A GeoRSS item node.  
*  
* Returns:  
* {<OpenLayers.Feature.Vector>} A feature representing the item.  
*/  
createFeatureFromItem: function(item) {  
var geometry = this.createGeometryFromItem(item);  
 
/* Provide defaults for title and description */  
var title = this.getChildValue(item, "*", "title", this.featureTitle);  
 
/* First try RSS descriptions, then Atom summaries */  
var description = this.getChildValue(  
item, "*", "description",  
this.getChildValue(item, "*", "content",  
this.getChildValue(item, "*", "summary", this.featureDescription)));  
 
/* If no link URL is found in the first child node, try the  
href attribute */  
var link = this.getChildValue(item, "*", "link");  
if(!link) {  
try {  
link = this.getElementsByTagNameNS(item, "*", "link")[0].getAttribute("href");  
} catch(e) {  
link = null;  
}  
}  
 
var id = this.getChildValue(item, "*", "id", null);  
 
var data = {  
"title": title,  
"description": description,  
"link": link  
};  
var feature = new OpenLayers.Feature.Vector(geometry, data);  
feature.fid = id;  
return feature;  
},  
 
/**  
* Method: getChildValue  
*  
* Parameters:  
* node - {DOMElement}  
* nsuri - {String} Child node namespace uri ("*" for any).  
* name - {String} Child node name.  
* def - {String} Optional string default to return if no child found.  
*  
* Returns:  
* {String} The value of the first child with the given tag name. Returns  
* default value or empty string if none found.  
*/  
getChildValue: function(node, nsuri, name, def) {  
var value;  
var eles = this.getElementsByTagNameNS(node, nsuri, name);  
if(eles && eles[0] && eles[0].firstChild  
&& eles[0].firstChild.nodeValue) {  
value = eles[0].firstChild.nodeValue;  
} else {  
value = (def == undefined) ? "" : def;  
}  
return value;  
},  
 
/**  
* APIMethod: read  
* Return a list of features from a GeoRSS doc  
 
* Parameters:  
* data - {Element}  
*  
* Returns:  
* An Array of <OpenLayers.Feature.Vector>s  
*/  
read: function(doc) {  
if (typeof doc == "string") {  
doc = OpenLayers.Format.XML.prototype.read.apply(this, [doc]);  
}  
 
/* Try RSS items first, then Atom entries */