]> git.openstreetmap.org Git - rails.git/blob - public/javascripts/OpenLayers.js
Extra check that nodes/segments in ways are visible
[rails.git] / public / javascripts / OpenLayers.js
1 /*
2
3   OpenLayers.js -- OpenLayers Map Viewer Library
4
5   Copyright 2005-2006 MetaCarta, Inc., released under the BSD License.
6   Please see http://svn.openlayers.org/trunk/openlayers/license.txt
7   for the full text of the license.
8
9   Includes compressed code under the following licenses:
10
11   (For uncompressed versions of the code used please see the
12   OpenLayers SVN repository: <http://openlayers.org/>)
13
14 */
15
16 /*  Prototype JavaScript framework, version 1.4.0
17  *  (c) 2005 Sam Stephenson <sam@conio.net>
18  *
19  *  Prototype is freely distributable under the terms of an MIT-style license.
20  *  For details, see the Prototype web site: http://prototype.conio.net/
21  *
22 /*--------------------------------------------------------------------------*/
23
24 /**  
25 *  
26 *  Contains portions of Rico <http://openrico.org/>
27
28 *  Copyright 2005 Sabre Airline Solutions  
29 *  
30 *  Licensed under the Apache License, Version 2.0 (the "License"); you
31 *  may not use this file except in compliance with the License. You
32 *  may obtain a copy of the License at
33 *  
34 *         http://www.apache.org/licenses/LICENSE-2.0  
35 *  
36 *  Unless required by applicable law or agreed to in writing, software
37 *  distributed under the License is distributed on an "AS IS" BASIS,
38 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
39 *  implied. See the License for the specific language governing
40 *  permissions and limitations under the License. 
41 *
42 **/
43
44
45 var Prototype={Version:'1.4.0',ScriptFragment:'(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',emptyFunction:function(){},K:function(x){return x}}
46 var Class={create:function(){return function(){this.initialize.apply(this,arguments);}}}
47 var Abstract=new Object();Object.extend=function(destination,source){for(property in source){destination[property]=source[property];}
48 return destination;}
49 Object.inspect=function(object){try{if(object==undefined)return'undefined';if(object==null)return'null';return object.inspect?object.inspect():object.toString();}catch(e){if(e instanceof RangeError)return'...';throw e;}}
50 Function.prototype.bind=function(){var __method=this,args=$A(arguments),object=args.shift();return function(){return __method.apply(object,args.concat($A(arguments)));}}
51 Function.prototype.bindAsEventListener=function(object){var __method=this;return function(event){return __method.call(object,event||window.event);}}
52 Object.extend(Number.prototype,{toColorPart:function(){var digits=this.toString(16);if(this<16)return'0'+digits;return digits;},succ:function(){return this+1;},times:function(iterator){$R(0,this,true).each(iterator);return this;}});var Try={these:function(){var returnValue;for(var i=0;i<arguments.length;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
53 return returnValue;}}
54 var PeriodicalExecuter=Class.create();PeriodicalExecuter.prototype={initialize:function(callback,frequency){this.callback=callback;this.frequency=frequency;this.currentlyExecuting=false;this.registerCallback();},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.callback();}finally{this.currentlyExecuting=false;}}}}
55 function $(){var elements=new Array();for(var i=0;i<arguments.length;i++){var element=arguments[i];if(typeof element=='string')
56 element=document.getElementById(element);if(arguments.length==1)
57 return element;elements.push(element);}
58 return elements;}
59 Object.extend(String.prototype,{stripTags:function(){return this.replace(/<\/?[^>]+>/gi,'');},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,'img'),'');},extractScripts:function(){var matchAll=new RegExp(Prototype.ScriptFragment,'img');var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1];});},evalScripts:function(){return this.extractScripts().map(eval);},escapeHTML:function(){var div=document.createElement('div');var text=document.createTextNode(this);div.appendChild(text);return div.innerHTML;},unescapeHTML:function(){var div=document.createElement('div');div.innerHTML=this.stripTags();return div.childNodes[0]?div.childNodes[0].nodeValue:'';},toQueryParams:function(){var pairs=this.match(/^\??(.*)$/)[1].split('&');return pairs.inject({},function(params,pairString){var pair=pairString.split('=');params[pair[0]]=pair[1];return params;});},toArray:function(){return this.split('');},camelize:function(){var oStringList=this.split('-');if(oStringList.length==1)return oStringList[0];var camelizedString=this.indexOf('-')==0?oStringList[0].charAt(0).toUpperCase()+oStringList[0].substring(1):oStringList[0];for(var i=1,len=oStringList.length;i<len;i++){var s=oStringList[i];camelizedString+=s.charAt(0).toUpperCase()+s.substring(1);}
60 return camelizedString;},inspect:function(){return"'"+this.replace('\\','\\\\').replace("'",'\\\'')+"'";}});String.prototype.parseQuery=String.prototype.toQueryParams;var $break=new Object();var $continue=new Object();var Enumerable={each:function(iterator){var index=0;try{this._each(function(value){try{iterator(value,index++);}catch(e){if(e!=$continue)throw e;}});}catch(e){if(e!=$break)throw e;}},all:function(iterator){var result=true;this.each(function(value,index){result=result&&!!(iterator||Prototype.K)(value,index);if(!result)throw $break;});return result;},any:function(iterator){var result=true;this.each(function(value,index){if(result=!!(iterator||Prototype.K)(value,index))
61 throw $break;});return result;},collect:function(iterator){var results=[];this.each(function(value,index){results.push(iterator(value,index));});return results;},detect:function(iterator){var result;this.each(function(value,index){if(iterator(value,index)){result=value;throw $break;}});return result;},findAll:function(iterator){var results=[];this.each(function(value,index){if(iterator(value,index))
62 results.push(value);});return results;},grep:function(pattern,iterator){var results=[];this.each(function(value,index){var stringValue=value.toString();if(stringValue.match(pattern))
63 results.push((iterator||Prototype.K)(value,index));})
64 return results;},include:function(object){var found=false;this.each(function(value){if(value==object){found=true;throw $break;}});return found;},inject:function(memo,iterator){this.each(function(value,index){memo=iterator(memo,value,index);});return memo;},invoke:function(method){var args=$A(arguments).slice(1);return this.collect(function(value){return value[method].apply(value,args);});},max:function(iterator){var result;this.each(function(value,index){value=(iterator||Prototype.K)(value,index);if(value>=(result||value))
65 result=value;});return result;},min:function(iterator){var result;this.each(function(value,index){value=(iterator||Prototype.K)(value,index);if(value<=(result||value))
66 result=value;});return result;},partition:function(iterator){var trues=[],falses=[];this.each(function(value,index){((iterator||Prototype.K)(value,index)?trues:falses).push(value);});return[trues,falses];},pluck:function(property){var results=[];this.each(function(value,index){results.push(value[property]);});return results;},reject:function(iterator){var results=[];this.each(function(value,index){if(!iterator(value,index))
67 results.push(value);});return results;},sortBy:function(iterator){return this.collect(function(value,index){return{value:value,criteria:iterator(value,index)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}).pluck('value');},toArray:function(){return this.collect(Prototype.K);},zip:function(){var iterator=Prototype.K,args=$A(arguments);if(typeof args.last()=='function')
68 iterator=args.pop();var collections=[this].concat(args).map($A);return this.map(function(value,index){iterator(value=collections.pluck(index));return value;});},inspect:function(){return'#<Enumerable:'+this.toArray().inspect()+'>';}}
69 Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});var $A=Array.from=function(iterable){if(!iterable)return[];if(iterable.toArray){return iterable.toArray();}else{var results=[];for(var i=0;i<iterable.length;i++)
70 results.push(iterable[i]);return results;}}
71 Object.extend(Array.prototype,Enumerable);Array.prototype._reverse=Array.prototype.reverse;Object.extend(Array.prototype,{_each:function(iterator){for(var i=0;i<this.length;i++)
72 iterator(this[i]);},clear:function(){this.length=0;return this;},first:function(){return this[0];},last:function(){return this[this.length-1];},compact:function(){return this.select(function(value){return value!=undefined||value!=null;});},flatten:function(){return this.inject([],function(array,value){return array.concat(value.constructor==Array?value.flatten():[value]);});},without:function(){var values=$A(arguments);return this.select(function(value){return!values.include(value);});},indexOf:function(object){for(var i=0;i<this.length;i++)
73 if(this[i]==object)return i;return-1;},reverse:function(inline){return(inline!==false?this:this.toArray())._reverse();},shift:function(){var result=this[0];for(var i=0;i<this.length-1;i++)
74 this[i]=this[i+1];this.length--;return result;},inspect:function(){return'['+this.map(Object.inspect).join(', ')+']';}});var Hash={_each:function(iterator){for(key in this){var value=this[key];if(typeof value=='function')continue;var pair=[key,value];pair.key=key;pair.value=value;iterator(pair);}},keys:function(){return this.pluck('key');},values:function(){return this.pluck('value');},merge:function(hash){return $H(hash).inject($H(this),function(mergedHash,pair){mergedHash[pair.key]=pair.value;return mergedHash;});},toQueryString:function(){return this.map(function(pair){return pair.map(encodeURIComponent).join('=');}).join('&');},inspect:function(){return'#<Hash:{'+this.map(function(pair){return pair.map(Object.inspect).join(': ');}).join(', ')+'}>';}}
75 function $H(object){var hash=Object.extend({},object||{});Object.extend(hash,Enumerable);Object.extend(hash,Hash);return hash;}
76 ObjectRange=Class.create();Object.extend(ObjectRange.prototype,Enumerable);Object.extend(ObjectRange.prototype,{initialize:function(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive;},_each:function(iterator){var value=this.start;do{iterator(value);value=value.succ();}while(this.include(value));},include:function(value){if(value<this.start)
77 return false;if(this.exclusive)
78 return value<this.end;return value<=this.end;}});var $R=function(start,end,exclusive){return new ObjectRange(start,end,exclusive);}
79 var Ajax={getTransport:function(){return Try.these(function(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXObject('Microsoft.XMLHTTP')},function(){return new XMLHttpRequest()})||false;},activeRequestCount:0}
80 Ajax.Responders={responders:[],_each:function(iterator){this.responders._each(iterator);},register:function(responderToAdd){if(!this.include(responderToAdd))
81 this.responders.push(responderToAdd);},unregister:function(responderToRemove){this.responders=this.responders.without(responderToRemove);},dispatch:function(callback,request,transport,json){this.each(function(responder){if(responder[callback]&&typeof responder[callback]=='function'){try{responder[callback].apply(responder,[request,transport,json]);}catch(e){}}});}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++;},onComplete:function(){Ajax.activeRequestCount--;}});Ajax.Base=function(){};Ajax.Base.prototype={setOptions:function(options){this.options={method:'post',asynchronous:true,parameters:''}
82 Object.extend(this.options,options||{});},responseIsSuccess:function(){return this.transport.status==undefined||this.transport.status==0||(this.transport.status>=200&&this.transport.status<300);},responseIsFailure:function(){return!this.responseIsSuccess();}}
83 Ajax.Request=Class.create();Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Request.prototype=Object.extend(new Ajax.Base(),{initialize:function(url,options){this.transport=Ajax.getTransport();this.setOptions(options);this.request(url);},request:function(url){var parameters=this.options.parameters||'';if(parameters.length>0)parameters+='&_=';try{this.url=url;if(this.options.method=='get'&&parameters.length>0)
84 this.url+=(this.url.match(/\?/)?'&':'?')+parameters;Ajax.Responders.dispatch('onCreate',this,this.transport);this.transport.open(this.options.method,this.url,this.options.asynchronous);if(this.options.asynchronous){this.transport.onreadystatechange=this.onStateChange.bind(this);setTimeout((function(){this.respondToReadyState(1)}).bind(this),10);}
85 this.setRequestHeaders();var body=this.options.postBody?this.options.postBody:parameters;this.transport.send(this.options.method=='post'?body:null);}catch(e){this.dispatchException(e);}},setRequestHeaders:function(){var requestHeaders=['X-Requested-With','XMLHttpRequest','X-Prototype-Version',Prototype.Version];if(this.options.method=='post'){requestHeaders.push('Content-type','application/x-www-form-urlencoded');if(this.transport.overrideMimeType)
86 requestHeaders.push('Connection','close');}
87 if(this.options.requestHeaders)
88 requestHeaders.push.apply(requestHeaders,this.options.requestHeaders);for(var i=0;i<requestHeaders.length;i+=2)
89 this.transport.setRequestHeader(requestHeaders[i],requestHeaders[i+1]);},onStateChange:function(){var readyState=this.transport.readyState;if(readyState!=1)
90 this.respondToReadyState(this.transport.readyState);},header:function(name){try{return this.transport.getResponseHeader(name);}catch(e){}},evalJSON:function(){try{return eval(this.header('X-JSON'));}catch(e){}},evalResponse:function(){try{return eval(this.transport.responseText);}catch(e){this.dispatchException(e);}},respondToReadyState:function(readyState){var event=Ajax.Request.Events[readyState];var transport=this.transport,json=this.evalJSON();if(event=='Complete'){try{(this.options['on'+this.transport.status]||this.options['on'+(this.responseIsSuccess()?'Success':'Failure')]||Prototype.emptyFunction)(transport,json);}catch(e){this.dispatchException(e);}
91 if((this.header('Content-type')||'').match(/^text\/javascript/i))
92 this.evalResponse();}
93 try{(this.options['on'+event]||Prototype.emptyFunction)(transport,json);Ajax.Responders.dispatch('on'+event,this,transport,json);}catch(e){this.dispatchException(e);}
94 if(event=='Complete')
95 this.transport.onreadystatechange=Prototype.emptyFunction;},dispatchException:function(exception){(this.options.onException||Prototype.emptyFunction)(this,exception);Ajax.Responders.dispatch('onException',this,exception);}});Ajax.Updater=Class.create();Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(container,url,options){this.containers={success:container.success?$(container.success):$(container),failure:container.failure?$(container.failure):(container.success?null:$(container))}
96 this.transport=Ajax.getTransport();this.setOptions(options);var onComplete=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=(function(transport,object){this.updateContent();onComplete(transport,object);}).bind(this);this.request(url);},updateContent:function(){var receiver=this.responseIsSuccess()?this.containers.success:this.containers.failure;var response=this.transport.responseText;if(!this.options.evalScripts)
97 response=response.stripScripts();if(receiver){if(this.options.insertion){new this.options.insertion(receiver,response);}else{Element.update(receiver,response);}}
98 if(this.responseIsSuccess()){if(this.onComplete)
99 setTimeout(this.onComplete.bind(this),10);}}});Ajax.PeriodicalUpdater=Class.create();Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(container,url,options){this.setOptions(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;this.url=url;this.start();},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent();},stop:function(){this.updater.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments);},updateComplete:function(request){if(this.options.decay){this.decay=(request.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=request.responseText;}
100 this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000);},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options);}});document.getElementsByClassName=function(className,parentElement){var children=($(parentElement)||document.body).getElementsByTagName('*');return $A(children).inject([],function(elements,child){if(child.className.match(new RegExp("(^|\\s)"+className+"(\\s|$)")))
101 elements.push(child);return elements;});}
102 if(!window.Element){var Element=new Object();}
103 Object.extend(Element,{visible:function(element){return $(element).style.display!='none';},toggle:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);Element[Element.visible(element)?'hide':'show'](element);}},hide:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);element.style.display='none';}},show:function(){for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);element.style.display='';}},remove:function(element){element=$(element);element.parentNode.removeChild(element);},update:function(element,html){$(element).innerHTML=html.stripScripts();setTimeout(function(){html.evalScripts()},10);},getHeight:function(element){element=$(element);return element.offsetHeight;},classNames:function(element){return new Element.ClassNames(element);},hasClassName:function(element,className){if(!(element=$(element)))return;return Element.classNames(element).include(className);},addClassName:function(element,className){if(!(element=$(element)))return;return Element.classNames(element).add(className);},removeClassName:function(element,className){if(!(element=$(element)))return;return Element.classNames(element).remove(className);},cleanWhitespace:function(element){element=$(element);for(var i=0;i<element.childNodes.length;i++){var node=element.childNodes[i];if(node.nodeType==3&&!/\S/.test(node.nodeValue))
104 Element.remove(node);}},empty:function(element){return $(element).innerHTML.match(/^\s*$/);},scrollTo:function(element){element=$(element);var x=element.x?element.x:element.offsetLeft,y=element.y?element.y:element.offsetTop;window.scrollTo(x,y);},getStyle:function(element,style){element=$(element);var value=element.style[style.camelize()];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[style.camelize()];}}
105 if(window.opera&&['left','top','right','bottom'].include(style))
106 if(Element.getStyle(element,'position')=='static')value='auto';return value=='auto'?null:value;},setStyle:function(element,style){element=$(element);for(name in style)
107 element.style[name.camelize()]=style[name];},getDimensions:function(element){element=$(element);if(Element.getStyle(element,'display')!='none')
108 return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;els.visibility='hidden';els.position='absolute';els.display='';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display='none';els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight};},makePositioned:function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(window.opera){element.style.top=0;element.style.left=0;}}},undoPositioned:function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right='';}},makeClipping:function(element){element=$(element);if(element._overflow)return;element._overflow=element.style.overflow;if((Element.getStyle(element,'overflow')||'visible')!='hidden')
109 element.style.overflow='hidden';},undoClipping:function(element){element=$(element);if(element._overflow)return;element.style.overflow=element._overflow;element._overflow=undefined;}});var Toggle=new Object();Toggle.display=Element.toggle;Abstract.Insertion=function(adjacency){this.adjacency=adjacency;}
110 Abstract.Insertion.prototype={initialize:function(element,content){this.element=$(element);this.content=content.stripScripts();if(this.adjacency&&this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency,this.content);}catch(e){if(this.element.tagName.toLowerCase()=='tbody'){this.insertContent(this.contentFromAnonymousTable());}else{throw e;}}}else{this.range=this.element.ownerDocument.createRange();if(this.initializeRange)this.initializeRange();this.insertContent([this.range.createContextualFragment(this.content)]);}
111 setTimeout(function(){content.evalScripts()},10);},contentFromAnonymousTable:function(){var div=document.createElement('div');div.innerHTML='<table><tbody>'+this.content+'</tbody></table>';return $A(div.childNodes[0].childNodes[0].childNodes);}}
112 var Insertion=new Object();Insertion.Before=Class.create();Insertion.Before.prototype=Object.extend(new Abstract.Insertion('beforeBegin'),{initializeRange:function(){this.range.setStartBefore(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.parentNode.insertBefore(fragment,this.element);}).bind(this));}});Insertion.Top=Class.create();Insertion.Top.prototype=Object.extend(new Abstract.Insertion('afterBegin'),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(true);},insertContent:function(fragments){fragments.reverse(false).each((function(fragment){this.element.insertBefore(fragment,this.element.firstChild);}).bind(this));}});Insertion.Bottom=Class.create();Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion('beforeEnd'),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.appendChild(fragment);}).bind(this));}});Insertion.After=Class.create();Insertion.After.prototype=Object.extend(new Abstract.Insertion('afterEnd'),{initializeRange:function(){this.range.setStartAfter(this.element);},insertContent:function(fragments){fragments.each((function(fragment){this.element.parentNode.insertBefore(fragment,this.element.nextSibling);}).bind(this));}});Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){this.element=$(element);},_each:function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set(this.toArray().concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set(this.select(function(className){return className!=classNameToRemove;}).join(' '));},toString:function(){return this.toArray().join(' ');}}
113 Object.extend(Element.ClassNames.prototype,Enumerable);var Field={clear:function(){for(var i=0;i<arguments.length;i++)
114 $(arguments[i]).value='';},focus:function(element){$(element).focus();},present:function(){for(var i=0;i<arguments.length;i++)
115 if($(arguments[i]).value=='')return false;return true;},select:function(element){$(element).select();},activate:function(element){element=$(element);element.focus();if(element.select)
116 element.select();}}
117 var Form={serialize:function(form){var elements=Form.getElements($(form));var queryComponents=new Array();for(var i=0;i<elements.length;i++){var queryComponent=Form.Element.serialize(elements[i]);if(queryComponent)
118 queryComponents.push(queryComponent);}
119 return queryComponents.join('&');},getElements:function(form){form=$(form);var elements=new Array();for(tagName in Form.Element.Serializers){var tagElements=form.getElementsByTagName(tagName);for(var j=0;j<tagElements.length;j++)
120 elements.push(tagElements[j]);}
121 return elements;},getInputs:function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)
122 return inputs;var matchingInputs=new Array();for(var i=0;i<inputs.length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))
123 continue;matchingInputs.push(input);}
124 return matchingInputs;},disable:function(form){var elements=Form.getElements(form);for(var i=0;i<elements.length;i++){var element=elements[i];element.blur();element.disabled='true';}},enable:function(form){var elements=Form.getElements(form);for(var i=0;i<elements.length;i++){var element=elements[i];element.disabled='';}},findFirstElement:function(form){return Form.getElements(form).find(function(element){return element.type!='hidden'&&!element.disabled&&['input','select','textarea'].include(element.tagName.toLowerCase());});},focusFirstElement:function(form){Field.activate(Form.findFirstElement(form));},reset:function(form){$(form).reset();}}
125 Form.Element={serialize:function(element){element=$(element);var method=element.tagName.toLowerCase();var parameter=Form.Element.Serializers[method](element);if(parameter){var key=encodeURIComponent(parameter[0]);if(key.length==0)return;if(parameter[1].constructor!=Array)
126 parameter[1]=[parameter[1]];return parameter[1].map(function(value){return key+'='+encodeURIComponent(value);}).join('&');}},getValue:function(element){element=$(element);var method=element.tagName.toLowerCase();var parameter=Form.Element.Serializers[method](element);if(parameter)
127 return parameter[1];}}
128 Form.Element.Serializers={input:function(element){switch(element.type.toLowerCase()){case'submit':case'hidden':case'password':case'text':return Form.Element.Serializers.textarea(element);case'checkbox':case'radio':return Form.Element.Serializers.inputSelector(element);}
129 return false;},inputSelector:function(element){if(element.checked)
130 return[element.name,element.value];},textarea:function(element){return[element.name,element.value];},select:function(element){return Form.Element.Serializers[element.type=='select-one'?'selectOne':'selectMany'](element);},selectOne:function(element){var value='',opt,index=element.selectedIndex;if(index>=0){opt=element.options[index];value=opt.value;if(!value&&!('value'in opt))
131 value=opt.text;}
132 return[element.name,value];},selectMany:function(element){var value=new Array();for(var i=0;i<element.length;i++){var opt=element.options[i];if(opt.selected){var optValue=opt.value;if(!optValue&&!('value'in opt))
133 optValue=opt.text;value.push(optValue);}}
134 return[element.name,value];}}
135 var $F=Form.Element.getValue;Abstract.TimedObserver=function(){}
136 Abstract.TimedObserver.prototype={initialize:function(element,frequency,callback){this.frequency=frequency;this.element=$(element);this.callback=callback;this.lastValue=this.getValue();this.registerCallback();},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},onTimerEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value;}}}
137 Form.Element.Observer=Class.create();Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.Element.getValue(this.element);}});Form.Observer=Class.create();Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.serialize(this.element);}});Abstract.EventObserver=function(){}
138 Abstract.EventObserver.prototype={initialize:function(element,callback){this.element=$(element);this.callback=callback;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=='form')
139 this.registerFormCallbacks();else
140 this.registerCallback(this.element);},onElementEvent:function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value;}},registerFormCallbacks:function(){var elements=Form.getElements(this.element);for(var i=0;i<elements.length;i++)
141 this.registerCallback(elements[i]);},registerCallback:function(element){if(element.type){switch(element.type.toLowerCase()){case'checkbox':case'radio':Event.observe(element,'click',this.onElementEvent.bind(this));break;case'password':case'text':case'textarea':case'select-one':case'select-multiple':Event.observe(element,'change',this.onElementEvent.bind(this));break;}}}}
142 Form.Element.EventObserver=Class.create();Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.Element.getValue(this.element);}});Form.EventObserver=Class.create();Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.serialize(this.element);}});if(!window.Event){var Event=new Object();}
143 Object.extend(Event,{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)));},pointerX:function(event){return event.pageX||(event.clientX+
144 (document.documentElement.scrollLeft||document.body.scrollLeft));},pointerY:function(event){return event.pageY||(event.clientY+
145 (document.documentElement.scrollTop||document.body.scrollTop));},stop:function(event){if(event.preventDefault){event.preventDefault();event.stopPropagation();}else{event.returnValue=false;event.cancelBubble=true;}},findElement:function(event,tagName){var element=Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase())))
146 element=element.parentNode;return element;},observers:false,_observeAndCache:function(element,name,observer,useCapture){if(!this.observers)this.observers=[];if(element.addEventListener){this.observers.push([element,name,observer,useCapture]);element.addEventListener(name,observer,useCapture);}else if(element.attachEvent){this.observers.push([element,name,observer,useCapture]);element.attachEvent('on'+name,observer);}},unloadCache:function(){if(!Event.observers)return;for(var i=0;i<Event.observers.length;i++){Event.stopObserving.apply(this,Event.observers[i]);Event.observers[i][0]=null;}
147 Event.observers=false;},observe:function(elementParam,name,observer,useCapture){var element=$(elementParam);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent))
148 name='keydown';this._observeAndCache(element,name,observer,useCapture);},stopObserving:function(elementParam,name,observer,useCapture){var element=$(elementParam);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent))
149 name='keydown';if(element.removeEventListener){element.removeEventListener(name,observer,useCapture);}else if(element.detachEvent){element.detachEvent('on'+name,observer);}}});Event.observe(window,'unload',Event.unloadCache,false);var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;},realOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode;}while(element);return[valueL,valueT];},cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return[valueL,valueT];},positionedOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){p=Element.getStyle(element,'position');if(p=='relative'||p=='absolute')break;}}while(element);return[valueL,valueT];},offsetParent:function(element){if(element.offsetParent)return element.offsetParent;if(element==document.body)return element;while((element=element.parentNode)&&element!=document.body)
150 if(Element.getStyle(element,'position')!='static')
151 return element;return document.body;},within:function(element,x,y){if(this.includeScrollOffsets)
152 return this.withinIncludingScrolloffsets(element,x,y);this.xcomp=x;this.ycomp=y;this.offset=this.cumulativeOffset(element);return(y>=this.offset[1]&&y<this.offset[1]+element.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+element.offsetWidth);},withinIncludingScrolloffsets:function(element,x,y){var offsetcache=this.realOffset(element);this.xcomp=x+offsetcache[0]-this.deltaX;this.ycomp=y+offsetcache[1]-this.deltaY;this.offset=this.cumulativeOffset(element);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+element.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+element.offsetWidth);},overlap:function(mode,element){if(!mode)return 0;if(mode=='vertical')
153 return((this.offset[1]+element.offsetHeight)-this.ycomp)/element.offsetHeight;if(mode=='horizontal')
154 return((this.offset[0]+element.offsetWidth)-this.xcomp)/element.offsetWidth;},clone:function(source,target){source=$(source);target=$(target);target.style.position='absolute';var offsets=this.cumulativeOffset(source);target.style.top=offsets[1]+'px';target.style.left=offsets[0]+'px';target.style.width=source.offsetWidth+'px';target.style.height=source.offsetHeight+'px';},page:function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
155 if(Element.getStyle(element,'position')=='absolute')break;}while(element=element.offsetParent);element=forElement;do{valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;}while(element=element.parentNode);return[valueL,valueT];},clone:function(source,target){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{})
156 source=$(source);var p=Position.page(source);target=$(target);var delta=[0,0];var parent=null;if(Element.getStyle(target,'position')=='absolute'){parent=Position.offsetParent(target);delta=Position.page(parent);}
157 if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop;}
158 if(options.setLeft)target.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop)target.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth)target.style.width=source.offsetWidth+'px';if(options.setHeight)target.style.height=source.offsetHeight+'px';},absolutize:function(element){element=$(element);if(element.style.position=='absolute')return;Position.prepare();var offsets=Position.positionedOffset(element);var top=offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element.clientHeight;element._originalLeft=left-parseFloat(element.style.left||0);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';;element.style.left=left+'px';;element.style.width=width+'px';;element.style.height=height+'px';;},relativize:function(element){element=$(element);if(element.style.position=='relative')return;Position.prepare();element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth;}}
159 if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){Position.cumulativeOffset=function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
160 if(Element.getStyle(element,'position')=='absolute')break;element=element.offsetParent;}while(element);return[valueL,valueT];}}
161 var Rico=new Object();Rico.Corner={round:function(e,options){var e=$(e);this._setOptions(options);var color=this.options.color;if(this.options.color=="fromElement")
162 color=this._background(e);var bgColor=this.options.bgColor;if(this.options.bgColor=="fromParent")
163 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)
164 this._renderBorder(e,bgColor);if(this._isTopRounded())
165 this._roundTopCorners(e,color,bgColor);if(this._isBottomRounded())
166 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++)
167 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--)
168 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;}
169 else if(borderColor){inStyle.borderColor=borderColor;inStyle.borderStyle="solid";inStyle.borderWidth="0px 1px";}
170 if(!this.options.compact&&(n==(this.options.numSlices-1)))
171 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}
172 Object.extend(this.options,options||{});this.options.numSlices=this.options.compact?2:4;if(this._isTransparent())
173 this.options.blend=false;},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top"))
174 return"";if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0)
175 return"";if(this.options.corners.indexOf("tl")>=0)
176 return"left";else if(this.options.corners.indexOf("tr")>=0)
177 return"right";return"";},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom"))
178 return"";if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0)
179 return"";if(this.options.corners.indexOf("bl")>=0)
180 return"left";else if(this.options.corners.indexOf("br")>=0)
181 return"right";return"";},_borderColor:function(color,bgColor){if(color=="transparent")
182 return bgColor;else if(this.options.border)
183 return this.options.border;else if(this.options.blend)
184 return this._blend(bgColor,color);else
185 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";}
186 else if(whichSide=="right"){el.style.marginRight=marginSize+"px";el.style.marginLeft="0px";}
187 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";}
188 else if(whichSide=="right"){el.style.borderRightWidth=borderSize+"px";el.style.borderLeftWidth="0px";}
189 else{el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth=borderSize+"px";}
190 if(this.options.border!=false)
191 el.style.borderLeftWidth=borderSize+"px";el.style.borderRightWidth=borderSize+"px";},_marginSize:function(n){if(this._isTransparent())
192 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)
193 return smBlendedMarginSizes[n];else if(this.options.compact)
194 return compactMarginSizes[n];else if(this.options.blend)
195 return blendedMarginSizes[n];else
196 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()))
197 return 1;else if(this.options.compact)
198 return compactBorderSizes[n];else if(this.options.blend)
199 return blendedBorderSizes[n];else if(this.options.border)
200 return actualBorderSizes[n];else if(this._isTransparent())
201 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=Rico.Color.createFromHex(c1);cc1.blend(Rico.Color.createFromHex(c2));return cc1;},_background:function(el){try{return 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;}}
202 _OPENLAYERS_SFL_=true
203 OpenLayers=new Object();OpenLayers._scriptName=(typeof(_OPENLAYERS_SFL_)=="undefined"?"lib/OpenLayers.js":"OpenLayers.js");OpenLayers._getScriptLocation=function(){var scriptLocation="";var SCRIPT_NAME=OpenLayers._scriptName;var scripts=document.getElementsByTagName('script');for(var i=0;i<scripts.length;i++){var src=scripts[i].getAttribute('src');if(src){var index=src.lastIndexOf(SCRIPT_NAME);if((index>-1)&&(index+SCRIPT_NAME.length==src.length)){scriptLocation=src.slice(0,-SCRIPT_NAME.length);break;}}}
204 return scriptLocation;}
205 if(typeof(_OPENLAYERS_SFL_)=="undefined"){(function(){var jsfiles=new Array("Prototype.js","Rico/Corner.js","Rico/Color.js","OpenLayers/BaseTypes.js","OpenLayers/Util.js","OpenLayers/Ajax.js","OpenLayers/Events.js","OpenLayers/Map.js","OpenLayers/Layer.js","OpenLayers/Icon.js","OpenLayers/Marker.js","OpenLayers/Marker/Box.js","OpenLayers/Popup.js","OpenLayers/Tile.js","OpenLayers/Feature.js","OpenLayers/Feature/WFS.js","OpenLayers/Tile/Image.js","OpenLayers/Tile/WFS.js","OpenLayers/Layer/EventPane.js","OpenLayers/Layer/FixedZoomLevels.js","OpenLayers/Layer/Google.js","OpenLayers/Layer/VirtualEarth.js","OpenLayers/Layer/Yahoo.js","OpenLayers/Layer/HTTPRequest.js","OpenLayers/Layer/Grid.js","OpenLayers/Layer/KaMap.js","OpenLayers/Layer/LikeGoogle.js","OpenLayers/Layer/MultiMap.js","OpenLayers/Layer/Markers.js","OpenLayers/Layer/Text.js","OpenLayers/Layer/WorldWind.js","OpenLayers/Layer/WMS.js","OpenLayers/Layer/WFS.js","OpenLayers/Layer/WMS/Untiled.js","OpenLayers/Layer/GeoRSS.js","OpenLayers/Layer/Boxes.js","OpenLayers/Layer/Canvas.js","OpenLayers/Popup/Anchored.js","OpenLayers/Popup/AnchoredBubble.js","OpenLayers/Control.js","OpenLayers/Control/MouseDefaults.js","OpenLayers/Control/MouseToolbar.js","OpenLayers/Control/KeyboardDefaults.js","OpenLayers/Control/PanZoom.js","OpenLayers/Control/PanZoomBar.js","OpenLayers/Control/Permalink.js","OpenLayers/Control/Scale.js","OpenLayers/Control/LayerSwitcher.js","OpenLayers/Control/LayerTabs.js");var allScriptTags="";var host=OpenLayers._getScriptLocation()+"lib/";var start=1;try{x=Prototype;}
206 catch(e){start=0;}
207 for(var i=start;i<jsfiles.length;i++){var currentScriptTag="<script src='"+host+jsfiles[i]+"'></script>";allScriptTags+=currentScriptTag;}
208 document.write(allScriptTags);})();}
209 OpenLayers.ProxyHost="";OpenLayers.nullHandler=function(request){alert("Unhandled request return "+request.statusText);};OpenLayers.loadURL=function(uri,params,caller,onComplete,onFailure){if(OpenLayers.ProxyHost&&uri.startsWith("http")){uri=OpenLayers.ProxyHost+escape(uri);}
210 var success=(onComplete)?onComplete.bind(caller):OpenLayers.nullHandler;var failure=(onFailure)?onFailure.bind(caller):OpenLayers.nullHandler;new Ajax.Request(uri,{method:'get',parameters:params,onComplete:success,onFailure:failure});};OpenLayers.parseXMLString=function(text){var index=text.indexOf('<');if(index>0){text=text.substring(index);}
211 var ajaxResponse=Try.these(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");}
212 req.send(null);return req.responseXML;});return ajaxResponse;};OpenLayers.Pixel=Class.create();OpenLayers.Pixel.prototype={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)));}
213 return equals;},add:function(x,y){return new OpenLayers.Pixel(this.x+x,this.y+y);},offset:function(px){return this.add(px.x,px.y);},CLASS_NAME:"OpenLayers.Pixel"};OpenLayers.Size=Class.create();OpenLayers.Size.prototype={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)));}
214 return equals;},CLASS_NAME:"OpenLayers.Size"};OpenLayers.LonLat=Class.create();OpenLayers.LonLat.prototype={lon:0.0,lat:0.0,initialize:function(lon,lat){this.lon=parseFloat(lon);this.lat=parseFloat(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){return new OpenLayers.LonLat(this.lon+lon,this.lat+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)));}
215 return equals;},CLASS_NAME:"OpenLayers.LonLat"};OpenLayers.LonLat.fromString=function(str){var pair=str.split(",");return new OpenLayers.LonLat(parseFloat(pair[0]),parseFloat(pair[1]));};OpenLayers.Bounds=Class.create();OpenLayers.Bounds.prototype={left:0.0,bottom:0.0,right:0.0,top:0.0,initialize:function(left,bottom,right,top){this.left=parseFloat(left);this.bottom=parseFloat(bottom);this.right=parseFloat(right);this.top=parseFloat(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));}
216 return equals;},toString:function(){return("left-bottom=("+this.left+","+this.bottom+")"
217 +" right-top=("+this.right+","+this.top+")");},toBBOX:function(){return(this.left+","+this.bottom+","
218 +this.right+","+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(){return new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2);},add:function(x,y){return new OpenLayers.Bounds(this.left+x,this.bottom+y,this.right+x,this.top+y);},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;}
219 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));}
220 return contains;},containsBounds:function(bounds,partial,inclusive){if(partial==null){partial=false;}
221 if(inclusive==null){inclusive=true;}
222 var inLeft;var inTop;var inRight;var inBottom;if(inclusive){inLeft=(bounds.left>=this.left)&&(bounds.left<=this.right);inTop=(bounds.top>=this.bottom)&&(bounds.top<=this.top);inRight=(bounds.right>=this.left)&&(bounds.right<=this.right);inBottom=(bounds.bottom>=this.bottom)&&(bounds.bottom<=this.top);}else{inLeft=(bounds.left>this.left)&&(bounds.left<this.right);inTop=(bounds.top>this.bottom)&&(bounds.top<this.top);inRight=(bounds.right>this.left)&&(bounds.right<this.right);inBottom=(bounds.bottom>this.bottom)&&(bounds.bottom<this.top);}
223 return(partial)?(inTop||inBottom)&&(inLeft||inRight):(inTop&&inLeft&&inBottom&&inRight);},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;},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;};String.prototype.startsWith=function(sStart){return(this.substr(0,sStart.length)==sStart);};String.prototype.contains=function(str){return(this.indexOf(str)!=-1);};String.prototype.trim=function(){var b=0;while(this.substr(b,1)==" "){b++;}
224 var e=this.length-1;while(this.substr(e,1)==" "){e--;}
225 return this.substring(b,e+1);};Array.prototype.remove=function(item){for(var i=0;i<this.length;i++){if(this[i]==item){this.splice(i,1);}}
226 return this;}
227 Array.prototype.clone=function(){var clone=new Array();for(var i=0;i<this.length;i++){clone[i]=this[i];}
228 return clone;};Array.prototype.clear=function(){this.length=0;};Number.prototype.limitSigDigs=function(sig){var number=(sig>0)?this.toString():0;if(sig<number.length){var exp=number.length-sig;number=Math.round(this/Math.pow(10,exp))*Math.pow(10,exp);}
229 return parseInt(number);}
230 OpenLayers.Control=Class.create();OpenLayers.Control.prototype={id:null,map:null,div:null,position:null,mouseDragStart:null,initialize:function(options){Object.extend(this,options);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){this.map=null;},setMap:function(map){this.map=map;},draw:function(px){if(this.div==null){this.div=OpenLayers.Util.createDiv();this.div.id=this.id;}
231 if(px!=null){this.position=px.clone();}
232 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.x+"px";}},CLASS_NAME:"OpenLayers.Control"};OpenLayers.Events=Class.create();OpenLayers.Events.prototype={BROWSER_EVENTS:["mouseover","mouseout","mousedown","mouseup","mousemove","click","dblclick","resize","focus","blur"],listeners:null,object:null,element:null,eventTypes:null,initialize:function(object,element,eventTypes,fallThrough){this.object=object;this.element=element;this.eventTypes=eventTypes;this.fallThrough=fallThrough;this.listeners=new Object();if(this.eventTypes!=null)
233 for(var i=0;i<this.eventTypes.length;i++)
234 this.listeners[this.eventTypes[i]]=new Array();if(this.element!=null)
235 this.attachToElement(element);},attachToElement:function(element){for(var i=0;i<this.BROWSER_EVENTS.length;i++){var eventType=this.BROWSER_EVENTS[i];if(this.listeners[eventType]==null)
236 this.listeners[eventType]=new Array();Event.observe(element,eventType,this.handleBrowserEvent.bindAsEventListener(this));}
237 Event.observe(element,"dragstart",Event.stop);},register:function(type,obj,func){if(func!=null){if(obj==null){obj=this.object;}
238 var listeners=this.listeners[type];if(listeners!=null){listeners.push({obj:obj,func:func});}}},unregister:function(type,obj,func){if(obj==null){obj=this.object;}
239 var listeners=this.listeners[type];if(listeners!=null){for(var i=0;i<listeners.length;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]=new Array();}},triggerEvent:function(type,evt){if(evt==null){evt=new Object();}
240 evt.object=this.object;evt.element=this.element;var listeners=this.listeners[type];if((listeners!=null)&&(listeners.length>0)){for(var i=0;i<listeners.length;i++){var callback=listeners[i];var continueChain;if(callback.obj!=null){continueChain=callback.func.call(callback.obj,evt);}else{continueChain=callback.func(evt);}
241 if((continueChain!=null)&&(continueChain==false)){break;}}
242 if(!this.fallThrough){Event.stop(evt);}}},handleBrowserEvent:function(evt){evt.xy=this.getMousePosition(evt);this.triggerEvent(evt.type,evt)},getMousePosition:function(evt){if(!this.element.offsets){this.element.offsets=Position.page(this.element);}
243 return new OpenLayers.Pixel((evt.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))-this.element.offsets[0],(evt.clientY+(document.documentElement.scrollTop||document.body.scrollTop))-this.element.offsets[1]);},CLASS_NAME:"OpenLayers.Events"};OpenLayers.Icon=Class.create();OpenLayers.Icon.prototype={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(0,0);this.calculateOffset=calculateOffset;this.imageDiv=OpenLayers.Util.createAlphaImageDiv();},destroy:function(){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;}
244 this.draw();},draw:function(px){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,this.size,this.url,"absolute");this.moveTo(px);return this.imageDiv;},moveTo:function(px){if(px!=null){this.px=px;}
245 if(this.imageDiv!=null){if(this.px==null){this.display(false);}else{if(this.calculateOffset){this.offset=this.calculateOffset(this.size);}
246 var offsetPx=this.px.offset(this.offset);OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,offsetPx);this.display(true);}}},display:function(display){this.imageDiv.style.display=(display)?"":"none";},CLASS_NAME:"OpenLayers.Icon"};OpenLayers.Layer=Class.create();OpenLayers.Layer.prototype={id:null,name:null,div:null,map:null,isBaseLayer:false,alpha:false,options:null,projection:null,units:null,scales:null,resolutions:null,maxExtent:null,minExtent:null,maxResolution:null,minResolution:null,numZoomLevels:null,minScale:null,maxScale:null,initialize:function(name,options){if(arguments.length>0){this.options=Object.extend(new Object(),options);Object.extend(this,this.options);this.name=name;this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");if(this.div==null){this.div=OpenLayers.Util.createDiv();this.div.style.width="100%";this.div.style.height="100%";this.div.id=this.id;}}},destroy:function(){if(this.map!=null){this.map.removeLayer(this);}
247 this.map=null;this.name=null;this.div=null;this.options=null;},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer(this.name,this.options);}
248 OpenLayers.Util.applyDefaults(obj,this);obj.map=null;return obj;},setName:function(newName){this.name=newName;if(this.map!=null)
249 this.map.events.triggerEvent("changelayer");},addOptions:function(newOptions){Object.extend(this.options,newOptions);Object.extend(this,this.options);},onMapResize:function(){},moveTo:function(bounds,zoomChanged,minor){},setMap:function(map){this.map=map;var properties=new Array('projection','units','scales','resolutions','maxScale','minScale','maxResolution','minResolution','minExtent','maxExtent','numZoomLevels');if(this.map.maxZoomLevel&&!this.numZoomLevels){this.numZoomLevels=this.map.maxZoomLevel+1;}
250 for(var i=0;i<properties.length;i++){if(this[properties[i]]==null){this[properties[i]]=this.map[properties[i]];}}
251 if(this.isBaseLayer){this.initResolutions();}},getVisibility:function(){return(this.div.style.display!="none");},setVisibility:function(visible,noEvent){if(visible!=this.getVisibility()){this.div.style.display=(visible)?"block":"none";if((visible)&&(this.map!=null)){var extent=this.map.getExtent();if(extent!=null){this.moveTo(this.map.getExtent(),true);}}
252 if((this.map!=null)&&((noEvent==null)||(noEvent==false))){this.map.events.triggerEvent("changelayer");}}},setIsBaseLayer:function(isBaseLayer){this.isBaseLayer=isBaseLayer;if(this.map!=null){this.map.events.triggerEvent("changelayer");}},initResolutions:function(){if((this.scales!=null)||(this.resolutions!=null)){if(this.scales!=null){this.resolutions=new Array();for(var i=0;i<this.scales.length;i++){this.resolutions[i]=OpenLayers.Util.getResolutionFromScale(this.scales[i],this.units);}}
253 this.numZoomLevels=this.resolutions.length;}else{this.resolutions=new Array();if(this.minScale){this.maxResolution=OpenLayers.Util.getResolutionFromScale(this.minScale,this.units);}else if(this.maxResolution=="auto"){var viewSize=this.map.getSize();var wRes=this.maxExtent.getWidth()/viewSize.w;var hRes=this.maxExtent.getHeight()/viewSize.h;this.maxResolution=Math.max(wRes,hRes);}
254 if(this.maxScale!=null){this.minResolution=OpenLayers.Util.getResolutionFromScale(this.maxScale);}else if((this.minResolution=="auto")&&(this.minExtent!=null)){var viewSize=this.map.getSize();var wRes=this.minExtent.getWidth()/viewSize.w;var hRes=this.minExtent.getHeight()/viewSize.h;this.minResolution=Math.max(wRes,hRes);}
255 if(this.minResolution!=null){var ratio=this.maxResolution/this.minResolution;this.numZoomLevels=Math.floor(Math.log(ratio)/Math.log(2))+1;}
256 for(var i=0;i<this.numZoomLevels;i++){this.resolutions.push(this.maxResolution/Math.pow(2,i));}}},getResolution:function(){var zoom=this.map.getZoom();return this.resolutions[zoom];},getExtent:function(resolution){var extent=null;var center=this.map.getCenter();if(center!=null){if(resolution==null){resolution=this.getResolution();}
257 var size=this.map.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);}
258 return extent;},getZoomForExtent:function(extent){var viewSize=this.map.getSize();var idealResolution=Math.max(extent.getWidth()/viewSize.w,extent.getHeight()/viewSize.h);return this.getZoomForResolution(idealResolution);},getZoomForResolution:function(resolution){for(var i=1;i<this.resolutions.length;i++){if(this.resolutions[i]<resolution){break;}}
259 return(i-1);},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if(viewPortPx!=null){var size=this.map.getSize();var center=this.map.getCenter();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);}
260 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(Math.round(1/resolution*(lonlat.lon-extent.left)),Math.round(1/resolution*(extent.top-lonlat.lat)));}
261 return px;},setOpacity:function(opacity){this.opacity=opacity;for(var i=0;i<this.div.childNodes.length;++i){var element=this.div.childNodes[i];OpenLayers.Util.setOpacity(element,opacity);}},CLASS_NAME:"OpenLayers.Layer"};OpenLayers.Layer.FixedZoomLevels=Class.create();OpenLayers.Layer.FixedZoomLevels.prototype={initialize:function(){},initResolutions:function(){},getResolution:function(){var viewSize=this.map.getSize();var extent=this.getExtent();return Math.max(extent.getWidth()/viewSize.w,extent.getHeight()/viewSize.h);},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);}
262 return extent;},getZoomForResolution:function(resolution){var extent=OpenLayers.Layer.prototype.getExtent.apply(this,[resolution]);return this.getZoomForExtent(extent);},CLASS_NAME:"FixedZoomLevels.js"};OpenLayers.Marker=Class.create();OpenLayers.Marker.prototype={icon:null,lonlat:null,events:null,map:null,initialize:function(lonlat,icon){if(arguments.length>0){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;}
263 this.events=new OpenLayers.Events(this,this.icon.imageDiv,null);}},destroy:function(){this.map=null;if(this.icon!=null){this.icon.destroy();this.icon=null;}},draw:function(px){return this.icon.draw(px);},moveTo:function(px){if((px!=null)&&(this.icon!=null)){this.icon.moveTo(px);}},onScreen:function(){var onScreen=false;if(this.map){var screenBounds=this.map.getExtent();onScreen=screenBounds.containsLonLat(this.lonlat);}
264 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);}},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=Class.create();OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;OpenLayers.Popup.COLOR="white";OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";OpenLayers.Popup.prototype={events:null,id:"",lonlat:null,div:null,size:null,contentHTML:"",backgroundColor:"",opacity:"",border:"",map:null,initialize:function(id,lonlat,size,contentHTML){if(id==null){id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");}
265 this.id=id;this.lonlat=lonlat;this.size=(size!=null)?size:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);if(contentHTML!=null){this.contentHTML=contentHTML;}
266 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.registerEvents();},destroy:function(){if(this.map!=null){this.map.removePopup(this);}
267 this.div=null;this.map=null;},draw:function(px){if(px==null){if((this.lonlat!=null)&&(this.map!=null)){px=this.map.getLayerPxFromLonLat(this.lonlat);}}
268 this.setSize();this.setBackgroundColor();this.setOpacity();this.setBorder();this.setContentHTML();this.moveTo(px);return this.div;},updatePosition:function(){if((this.lonlat)&&(this.map)){var px=this.map.getLayerPxFromLonLat(this.lonlat);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 Element.visible(this.div);},toggle:function(){Element.toggle(this.div);},show:function(){Element.show(this.div);},hide:function(){Element.hide(this.div);},setSize:function(size){if(size!=undefined){this.size=size;}
269 if(this.div!=null){this.div.style.width=this.size.w+"px";this.div.style.height=this.size.h+"px";}},setBackgroundColor:function(color){if(color!=undefined){this.backgroundColor=color;}
270 if(this.div!=null){this.div.style.backgroundColor=this.backgroundColor;}},setOpacity:function(opacity){if(opacity!=undefined){this.opacity=opacity;}
271 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;}
272 if(this.div!=null){this.div.style.border=this.border;}},setContentHTML:function(contentHTML){if(contentHTML!=null){this.contentHTML=contentHTML;}
273 if(this.div!=null){this.div.innerHTML=this.contentHTML;}},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,true);this.events.register("mousedown",this,this.onmousedown);this.events.register("mousemove",this,this.onmousemove);this.events.register("mouseup",this,this.onmouseup);this.events.register("click",this,OpenLayers.Util.safeStopPropagation);this.events.register("mouseout",this,this.onmouseout);this.events.register("dblclick",this,OpenLayers.Util.safeStopPropagation);},onmousedown:function(evt){this.mousedown=true;OpenLayers.Util.safeStopPropagation(evt);},onmousemove:function(evt){if(this.mousedown){OpenLayers.Util.safeStopPropagation(evt);}},onmouseup:function(evt){if(this.mousedown){this.mousedown=false;OpenLayers.Util.safeStopPropagation(evt);}},onmouseout:function(evt){this.mousedown=false;},CLASS_NAME:"OpenLayers.Popup"};OpenLayers.Tile=Class.create();OpenLayers.Tile.prototype={id:null,layer:null,url:null,bounds:null,size:null,position:null,drawn:false,initialize:function(layer,position,bounds,url,size){if(arguments.length>0){this.layer=layer;this.position=position;this.bounds=bounds;this.url=url;this.size=size;this.id=OpenLayers.Util.createUniqueID("Tile_");}},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;},draw:function(){this.drawn=true;},moveTo:function(bounds,position,redraw){if(redraw==null){redraw=true;}
274 this.clear();this.bounds=bounds.clone();this.position=position.clone();if(redraw){this.draw();}},clear:function(){this.drawn=false;},CLASS_NAME:"OpenLayers.Tile"};OpenLayers.Util=new Object();OpenLayers.Util.modifyDOMElement=function(element,id,px,sz,position,border,overflow){if(id){element.id=id;}
275 if(px){element.style.left=px.x+"px";element.style.top=px.y+"px";}
276 if(sz){element.style.width=sz.w+"px";element.style.height=sz.h+"px";}
277 if(position){element.style.position=position;}
278 if(border){element.style.border=border;}
279 if(overflow){element.style.overflow=overflow;}};OpenLayers.Util.createDiv=function(id,px,sz,imgURL,position,border,overflow){var dom=document.createElement('div');dom.style.padding="0";dom.style.margin="0";if(imgURL){dom.style.backgroundImage='url('+imgURL+')';}
280 if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv");}
281 if(!position){position="absolute";}
282 OpenLayers.Util.modifyDOMElement(dom,id,px,sz,position,border,overflow);return dom;};OpenLayers.Util.createImage=function(id,px,sz,imgURL,position,border,delayDisplay){image=document.createElement("img");if(delayDisplay){image.style.display="none";Event.observe(image,"load",OpenLayers.Util.onImageLoad.bindAsEventListener(image));Event.observe(image,"error",OpenLayers.Util.onImageLoadError.bindAsEventListener(image));}
283 image.style.alt=id;image.galleryImg="no";if(imgURL){image.src=imgURL;}
284 if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv");}
285 if(!position){position="relative";}
286 OpenLayers.Util.modifyDOMElement(image,id,px,sz,position,border);return image;};OpenLayers.Util.setOpacity=function(element,opacity){element.style.opacity=opacity;element.style.filter='alpha(opacity='+(opacity*100)+')';}
287 OpenLayers.Util.onImageLoad=function(){this.style.backgroundColor=null;this.style.display="";};OpenLayers.Util.onImageLoadErrorColor="pink";OpenLayers.Util.onImageLoadError=function(){this.style.backgroundColor=OpenLayers.Util.onImageLoadErrorColor;this.style.display="";};OpenLayers.Util.alphaHack=function(){var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);return((document.body.filters)&&(version>=5.5)&&(version<7));}
288 OpenLayers.Util.modifyAlphaImageDiv=function(div,id,px,sz,imgURL,position,border,sizing){OpenLayers.Util.modifyDOMElement(div,id,px,sz);var img=div.childNodes[0];if(imgURL){img.src=imgURL;}
289 OpenLayers.Util.modifyDOMElement(img,div.id+"_innerImage",null,sz,"relative",border);if(OpenLayers.Util.alphaHack()){div.style.display="inline-block";if(sizing==null){sizing="scale";}
290 div.style.filter="progid:DXImageTransform.Microsoft"+".AlphaImageLoader(src='"+img.src+"', "+"sizingMethod='"+sizing+"')";img.style.filter="progid:DXImageTransform.Microsoft"+".Alpha(opacity=0)";}};OpenLayers.Util.createAlphaImageDiv=function(id,px,sz,imgURL,position,border,sizing,delayDisplay){var div=OpenLayers.Util.createDiv();var img=OpenLayers.Util.createImage(null,null,null,null,null,null,false);div.appendChild(img);if(delayDisplay){img.style.display="none";Event.observe(img,"load",OpenLayers.Util.onImageLoad.bindAsEventListener(div));Event.observe(img,"error",OpenLayers.Util.onImageLoadError.bindAsEventListener(div));}
291 OpenLayers.Util.modifyAlphaImageDiv(div,id,px,sz,imgURL,position,border,sizing);return div;};OpenLayers.Util.upperCaseObject=function(object){var uObject=new Object();for(var key in object){uObject[key.toUpperCase()]=object[key];}
292 return uObject;};OpenLayers.Util.applyDefaults=function(to,from){for(var key in from){if(to[key]==null){to[key]=from[key];}}};OpenLayers.Util.getParameterString=function(params){paramsArray=new Array();for(var key in params){var value=params[key];if((value!=null)&&(typeof value!='function')){paramsArray.push(key+"="+value);}}
293 return paramsArray.join("&");};OpenLayers.Util.getImagesLocation=function(){return OpenLayers._getScriptLocation()+"img/";};OpenLayers.Util.getNodes=function(p,tagName){var nodes=Try.these(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=new Array();for(var i=0;i<nodes.length;i++){if(nodes[i].nodeName==tagName){retArray.push(nodes[i]);}}
294 return retArray;};OpenLayers.Util.getTagText=function(parent,item,index){var result=OpenLayers.Util.getNodes(parent,item);if(result&&(result.length>0))
295 {if(!index){index=0;}
296 if(result[index].childNodes.length>1){return result.childNodes[1].nodeValue;}
297 else if(result[index].childNodes.length==1){return result[index].firstChild.nodeValue;}}else{return"";}};OpenLayers.Util.getXmlNodeValue=function(node){var val=null;Try.these(function(){val=node.text;if(!val)
298 val=node.textContent;},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;}
299 return(target!=div);};OpenLayers.Util.rad=function(x){return x*Math.PI/180;};OpenLayers.Util.distVincenty=function(p1,p2){var a=6378137,b=6356752.3142,f=1/298.257223563;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)+
300 (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)));}
301 if(iterLimit==0)return NaN
302 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)-
303 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.getArgs=function(){var args=new Object();var query=location.search.substring(1);var pairs=query.split("&");for(var i=0;i<pairs.length;i++){var pos=pairs[i].indexOf('=');if(pos==-1)continue;var argname=pairs[i].substring(0,pos);var value=pairs[i].substring(pos+1);args[argname]=unescape(value);}
304 return args;};OpenLayers.Util.createUniqueID=function(prefix){if(prefix==null){prefix="id_";}
305 return prefix+Math.round(Math.random()*10000);};OpenLayers.INCHES_PER_UNIT={'inches':1.0,'ft':12.0,'mi':63360.0,'m':39.3701,'km':39370.1,'dd':4374754};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT["degrees"]=OpenLayers.INCHES_PER_UNIT.dd;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){if(units==null){units="degrees";}
306 var normScale=OpenLayers.Util.normalizeScale(scale);var resolution=1/(normScale*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH);return resolution;};OpenLayers.Util.safeStopPropagation=function(evt){if(evt.stopPropagation){evt.stopPropagation();}
307 evt.cancelBubble=true;};Rico.Color=Class.create();Rico.Color.prototype={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=Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b);},setSaturation:function(s){var hsb=this.asHSB();hsb.s=s;this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b);},setBrightness:function(b){var hsb=this.asHSB();hsb.b=b;this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,hsb.b);},darken:function(percent){var hsb=this.asHSB();this.rgb=Rico.Color.HSBtoRGB(hsb.h,hsb.s,Math.max(hsb.b-percent,0));},brighten:function(percent){var hsb=this.asHSB();this.rgb=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 Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b);},toString:function(){return this.asHex();}};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)+
308 shortHexCode.charAt(i));}
309 if(hexCode.indexOf('#')==0)
310 hexCode=hexCode.substring(1);var red=hexCode.substring(0,2);var green=hexCode.substring(2,4);var blue=hexCode.substring(4,6);return new Rico.Color(parseInt(red,16),parseInt(green,16),parseInt(blue,16));}
311 Rico.Color.createColorFromBackground=function(elem){var actualColor=RicoUtil.getElementsComputedStyle($(elem),"backgroundColor","background-color");if(actualColor=="transparent"&&elem.parentNode)
312 return Rico.Color.createColorFromBackground(elem.parentNode);if(actualColor==null)
313 return new Rico.Color(255,255,255);if(actualColor.indexOf("rgb(")==0){var colors=actualColor.substring(4,actualColor.length-1);var colorArray=colors.split(",");return new Rico.Color(parseInt(colorArray[0]),parseInt(colorArray[1]),parseInt(colorArray[2]));}
314 else if(actualColor.indexOf("#")==0){return Rico.Color.createFromHex(actualColor);}
315 else
316 return new Rico.Color(255,255,255);}
317 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;}
318 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;}}
319 return{r:parseInt(red),g:parseInt(green),b:parseInt(blue)};}
320 Rico.Color.RGBtoHSB=function(r,g,b){var hue;var saturation;var brightness;var cmax=(r>g)?r:g;if(b>cmax)
321 cmax=b;var cmin=(r<g)?r:g;if(b<cmin)
322 cmin=b;brightness=cmax/255.0;if(cmax!=0)
323 saturation=(cmax-cmin)/cmax;else
324 saturation=0;if(saturation==0)
325 hue=0;else{var redc=(cmax-r)/(cmax-cmin);var greenc=(cmax-g)/(cmax-cmin);var bluec=(cmax-b)/(cmax-cmin);if(r==cmax)
326 hue=bluec-greenc;else if(g==cmax)
327 hue=2.0+redc-bluec;else
328 hue=4.0+greenc-redc;hue=hue/6.0;if(hue<0)
329 hue=hue+1.0;}
330 return{h:hue,s:saturation,b:brightness};}
331 OpenLayers.Control.LayerSwitcher=Class.create();OpenLayers.Control.LayerSwitcher.prototype=Object.extend(new OpenLayers.Control(),{activeColor:"darkblue",layersDiv:null,baseLayersDiv:null,baseLayerInputs:null,dataLbl:null,dataLayersDiv:null,dataLayerInputs:null,minimizeDiv:null,maximizeDiv:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("addlayer",this,this.redraw);this.map.events.register("changelayer",this,this.redraw);this.map.events.register("removelayer",this,this.redraw);this.map.events.register("changebaselayer",this,this.redraw);},draw:function(){OpenLayers.Control.prototype.draw.apply(this);this.loadContents();this.minimizeControl();this.redraw();return this.div;},redraw:function(){this.baseLayersDiv.innerHTML="";this.baseLayerInputs=new Array();this.dataLayersDiv.innerHTML="";this.dataLayerInputs=new Array();var containsOverlays=false;for(var i=0;i<this.map.layers.length;i++){var layer=this.map.layers[i];var baseLayer=layer.isBaseLayer;if(!baseLayer){containsOverlays=true;}
332 var checked=(baseLayer)?(layer==this.map.baseLayer):layer.getVisibility();var inputElem=document.createElement("input");inputElem.id="input_"+layer.name;inputElem.name=(baseLayer)?"baseLayers":layer.name;inputElem.type=(baseLayer)?"radio":"checkbox";inputElem.value=layer.name;inputElem.checked=checked;inputElem.defaultChecked=checked;inputElem.layer=layer;inputElem.control=this;Event.observe(inputElem,"mouseup",this.onInputClick.bindAsEventListener(inputElem));var labelSpan=document.createElement("span");labelSpan.innerHTML=layer.name;labelSpan.style.verticalAlign=(baseLayer)?"bottom":"baseline";Event.observe(labelSpan,"click",this.onInputClick.bindAsEventListener(inputElem));var br=document.createElement("br");var groupArray=(baseLayer)?this.baseLayerInputs:this.dataLayerInputs;groupArray.push(inputElem);var groupDiv=(baseLayer)?this.baseLayersDiv:this.dataLayersDiv;groupDiv.appendChild(inputElem);groupDiv.appendChild(labelSpan);groupDiv.appendChild(br);}
333 this.dataLbl.style.display=(containsOverlays)?"":"none";return this.div;},onInputClick:function(e){if(this.type=="radio"){this.checked=true;this.layer.map.setBaseLayer(this.layer,true);this.layer.map.events.triggerEvent("changebaselayer");}else{this.checked=!this.checked;this.control.updateMap();}
334 Event.stop(e);},onLayerClick:function(e){this.updateMap();},updateMap:function(){for(var i=0;i<this.baseLayerInputs.length;i++){var input=this.baseLayerInputs[i];if(input.checked){this.map.setBaseLayer(input.layer,false);}}
335 for(var i=0;i<this.dataLayerInputs.length;i++){var input=this.dataLayerInputs[i];input.layer.setVisibility(input.checked,true);}},maximizeControl:function(e){this.div.style.width="20em";this.div.style.height="";this.showControls(false);if(e!=null){Event.stop(e);}},minimizeControl:function(e){this.div.style.width="0px";this.div.style.height="0px";this.showControls(true);if(e!=null){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(){this.div.style.position="absolute";this.div.style.top="10px";this.div.style.right="0px";this.div.style.left="";this.div.style.fontFamily="sans-serif";this.div.style.fontWeight="bold";this.div.style.marginTop="3px";this.div.style.marginLeft="3px";this.div.style.marginBottom="3px";this.div.style.fontSize="smaller";this.div.style.color="white";this.div.style.backgroundColor="transparent";Event.observe(this.div,"mouseup",this.mouseUp.bindAsEventListener(this));Event.observe(this.div,"click",this.ignoreEvent);Event.observe(this.div,"mousedown",this.mouseDown.bindAsEventListener(this));Event.observe(this.div,"dblclick",this.ignoreEvent);this.layersDiv=document.createElement("div");this.layersDiv.id="layersDiv";this.layersDiv.style.paddingTop="5px";this.layersDiv.style.paddingLeft="10px";this.layersDiv.style.paddingBottom="5px";this.layersDiv.style.paddingRight="75px";this.layersDiv.style.backgroundColor=this.activeColor;this.layersDiv.style.width="100%";this.layersDiv.style.height="100%";var baseLbl=document.createElement("div");baseLbl.innerHTML="<u>Base Layer</u>";baseLbl.style.marginTop="3px";baseLbl.style.marginLeft="3px";baseLbl.style.marginBottom="3px";this.layersDiv.appendChild(baseLbl);this.baseLayersDiv=document.createElement("div");this.baseLayersDiv.style.paddingLeft="10px";this.layersDiv.appendChild(this.baseLayersDiv);this.dataLbl=document.createElement("div");this.dataLbl.innerHTML="<u>Overlays</u>";this.dataLbl.style.marginTop="3px";this.dataLbl.style.marginLeft="3px";this.dataLbl.style.marginBottom="3px";this.layersDiv.appendChild(this.dataLbl);this.dataLayersDiv=document.createElement("div");this.dataLayersDiv.style.paddingLeft="10px";this.layersDiv.appendChild(this.dataLayersDiv);this.div.appendChild(this.layersDiv);Rico.Corner.round(this.div,{corners:"tl bl",bgColor:"transparent",color:this.activeColor,blend:false});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");this.maximizeDiv.style.top="5px";this.maximizeDiv.style.right="0px";this.maximizeDiv.style.left="";this.maximizeDiv.style.display="none";Event.observe(this.maximizeDiv,"click",this.maximizeControl.bindAsEventListener(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");this.minimizeDiv.style.top="5px";this.minimizeDiv.style.right="0px";this.minimizeDiv.style.left="";this.minimizeDiv.style.display="none";Event.observe(this.minimizeDiv,"click",this.minimizeControl.bindAsEventListener(this));this.div.appendChild(this.minimizeDiv);},ignoreEvent:function(evt){Event.stop(evt);},mouseDown:function(evt){this.mouseDown=true;this.ignoreEvent(evt);},mouseUp:function(evt){if(this.mouseDown){this.mouseDown=false;this.ignoreEvent(evt);}},CLASS_NAME:"OpenLayers.Control.LayerSwitcher"});OpenLayers.Control.LayerTabs=Class.create();OpenLayers.Control.LayerTabs.ACTIVE_COLOR="darkblue";OpenLayers.Control.LayerTabs.NONACTIVE_COLOR="lightblue";OpenLayers.Control.LayerTabs.prototype=Object.extend(new OpenLayers.Control(),{activeColor:"",nonActiveColor:"",mode:"checkbox",initialize:function(options){this.activeColor=OpenLayers.Control.LayerTabs.ACTIVE_COLOR;this.nonActiveColor=OpenLayers.Control.LayerTabs.NONACTIVE_COLOR;this.backdrops=[];OpenLayers.Control.prototype.initialize.apply(this,arguments);},draw:function(){OpenLayers.Control.prototype.draw.apply(this);this.div.style.position="absolute";this.div.style.top="10px";this.div.style.right="0px";this.div.style.left="";this.div.style.fontFamily="sans-serif";this.div.style.color="white";this.div.style.fontWeight="bold";this.div.style.marginTop="3px";this.div.style.marginLeft="3px";this.div.style.marginBottom="3px";this.div.style.fontSize="smaller";this.div.style.width="10em";this.map.events.register("addlayer",this,this.redraw);this.map.events.register("removelayer",this,this.redraw);return this.redraw();},redraw:function(){this.div.innerHTML="";var visible=false;for(var i=0;i<this.map.layers.length;i++){if(visible&&this.mode=="radio"){this.map.layers[i].setVisibility(false);}else{visible=this.map.layers[i].getVisibility();}
336 this.addTab(this.map.layers[i]);}
337 return this.div;},singleClick:function(evt){var div=Event.element(evt);div=div.labelElement||div;var layer=div.layer;if(this.mode=="radio"){for(var i=0;i<this.backdrops.length;i++){this.setTabActivation(this.backdrops[i],false);this.backdrops[i].layer.setVisibility(false);}
338 this.setTabActivation(div,true);layer.setVisibility(true);}else{var visible=layer.getVisibility();this.setTabActivation(div,!visible);layer.setVisibility(!visible);}
339 Event.stop(evt);},ignoreEvent:function(evt){Event.stop(evt);return false;},addTab:function(layer){var backdropLabelOuter=document.createElement('div');backdropLabelOuter.id="LayerTabs_"+layer.name+"_Tab";backdropLabelOuter.style.marginTop="4px";backdropLabelOuter.style.marginBottom="4px";this._setEventHandlers(backdropLabelOuter);var backdropLabel=document.createElement('p');backdropLabel.innerHTML=layer.name;backdropLabel.style.marginTop="0px";backdropLabel.style.marginBottom="0px";backdropLabel.style.paddingLeft="10px";backdropLabel.style.paddingRight="10px";backdropLabel.layer=layer;this._setEventHandlers(backdropLabel);backdropLabelOuter.appendChild(backdropLabel);this.backdrops.push(backdropLabel);this.div.appendChild(backdropLabelOuter);Rico.Corner.round(backdropLabelOuter,{corners:"tl bl",bgColor:"transparent",color:"white",blend:false});var spanElements=backdropLabel.parentNode.getElementsByTagName("span");for(var currIdx=0;currIdx<spanElements.length;currIdx++){this._setEventHandlers(spanElements[currIdx],backdropLabel);}
340 this.setTabActivation(backdropLabel,layer.getVisibility());},_setEventHandlers:function(element,labelDiv){element.onclick=this.singleClick.bindAsEventListener(this);element.ondblclick=this.singleClick.bindAsEventListener(this);element.onmouseup=this.ignoreEvent.bindAsEventListener(this);element.onmousedown=this.ignoreEvent.bindAsEventListener(this);if(labelDiv){element.labelElement=labelDiv;}},setTabActivation:function(div,activate){var color=(activate)?this.activeColor:this.nonActiveColor;Rico.Corner.changeColor(div,color);},CLASS_NAME:"OpenLayers.Control.LayerTabs"});OpenLayers.Control.MouseDefaults=Class.create();OpenLayers.Control.MouseDefaults.prototype=Object.extend(new OpenLayers.Control(),{performedDrag:false,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments);Event.observe(window,"DOMMouseScroll",this.onWheelEvent.bindAsEventListener(this));Event.observe(window,"mousewheel",this.onWheelEvent.bindAsEventListener(this));Event.observe(document,"mousewheel",this.onWheelEvent.bindAsEventListener(this));},draw:function(){this.map.events.register("click",this,this.defaultClick);this.map.events.register("dblclick",this,this.defaultDblClick);this.map.events.register("mousedown",this,this.defaultMouseDown);this.map.events.register("mouseup",this,this.defaultMouseUp);this.map.events.register("mousemove",this,this.defaultMouseMove);this.map.events.register("mouseout",this,this.defaultMouseOut);},defaultClick:function(evt){if(!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);Event.stop(evt);return false;},defaultMouseDown:function(evt){if(!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);}
341 document.onselectstart=function(){return false;}
342 Event.stop(evt);},defaultMouseMove:function(evt){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";}
343 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";}
344 this.performedDrag=true;}},defaultMouseUp:function(evt){if(!Event.isLeftClick(evt))return;if(this.zoomBox){this.zoomBoxEnd(evt);}else{if(this.performedDrag){this.map.setCenter(this.map.center);}}
345 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();}
346 this.mouseDragStart=null;}},defaultWheelUp:function(){this.map.zoomIn();},defaultWheelDown:function(){this.map.zoomOut();},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);var zoom=this.map.getZoomForExtent(bounds);this.map.setCenter(new OpenLayers.LonLat((start.lon+end.lon)/2,(start.lat+end.lat)/2),zoom);}else{var end=this.map.getLonLatFromViewPortPx(evt.xy);this.map.setCenter(new OpenLayers.LonLat((end.lon),(end.lat)),this.map.getZoom()+1);}
347 this.removeZoomBox();}},removeZoomBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null;},onWheelEvent:function(e){var inMap=false;var elem=Event.element(e);while(elem!=null){if(this.map&&elem==this.map.div){inMap=true;break;}
348 elem=elem.parentNode;}
349 if(inMap){var delta=0;if(!e){e=window.event;}
350 if(e.wheelDelta){delta=e.wheelDelta/120;if(window.opera){delta=-delta;}}else if(e.detail){delta=-e.detail/3;}
351 if(delta){if(delta<0){this.defaultWheelDown();}else{this.defaultWheelUp();}}
352 Event.stop(e);}},CLASS_NAME:"OpenLayers.Control.MouseDefaults"});OpenLayers.Control.PanZoom=Class.create();OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Control.PanZoom.prototype=Object.extend(new OpenLayers.Control(),{slideFactor:50,buttons:null,position:null,initialize:function(){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,OpenLayers.Control.PanZoom.Y);},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);px=this.position;this.buttons=new Array();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("OpenLayers_Control_PanZoom_"+id,xy,sz,imgLocation,"absolute");this.div.appendChild(btn);btn.onmousedown=this.buttonDown.bindAsEventListener(btn);btn.ondblclick=this.doubleClick.bindAsEventListener(btn);btn.onclick=this.doubleClick.bindAsEventListener(btn);btn.action=id;btn.map=this.map;btn.slideFactor=this.slideFactor;this.buttons.push(btn);return btn;},doubleClick:function(evt){Event.stop(evt);return false;},buttonDown:function(evt){if(!Event.isLeftClick(evt))return;switch(this.action){case"panup":this.map.pan(0,-50);break;case"pandown":this.map.pan(0,50);break;case"panleft":this.map.pan(-50,0);break;case"panright":this.map.pan(50,0);break;case"zoomin":this.map.zoomIn();break;case"zoomout":this.map.zoomOut();break;case"zoomworld":this.map.zoomToMaxExtent();break;}
353 Event.stop(evt);},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);for(i=0;i<this.buttons.length;i++){this.buttons[i].map=null;}},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.Permalink=Class.create();OpenLayers.Control.Permalink.prototype=Object.extend(new OpenLayers.Control(),{element:null,base:'',initialize:function(element,base){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.element=element;if(base)this.base=base;},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);var args=OpenLayers.Util.getArgs();if(args.lat&&args.lon){this.map.setCenter(new OpenLayers.LonLat(parseFloat(args.lon),parseFloat(args.lat)));}
354 if(args.zoom){this.map.zoomTo(parseInt(args.zoom));}
355 if(!this.element){this.element=document.createElement("a");this.div.style.right="3px";this.div.style.bottom="3px";this.div.style.left="";this.div.style.top="";this.div.style.display="block";this.div.style.position="absolute";this.element.style.fontSize="smaller";this.element.innerHTML="Permalink";this.element.href="";this.div.appendChild(this.element);}
356 this.map.events.register('moveend',this,this.updateLink);return this.div;},updateLink:function(){var center=this.map.getCenter();var zoom=this.map.getZoom();var lat=Math.round(center.lat*100000)/100000;var lon=Math.round(center.lon*100000)/100000;this.element.href=this.base+"?lat="+lat+"&lon="+lon+"&zoom="+zoom;},CLASS_NAME:"OpenLayers.Control.Permalink"});OpenLayers.Control.Scale=Class.create();OpenLayers.Control.Scale.prototype=Object.extend(new OpenLayers.Control(),{element:null,initialize:function(element){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.element=element;},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.element){this.element=document.createElement("div");this.div.style.right="3px";this.div.style.bottom="2em";this.div.style.left="";this.div.style.top="";this.div.style.display="block";this.div.style.position="absolute";this.element.style.fontSize="smaller";this.div.appendChild(this.element);}
357 this.map.events.register('moveend',this,this.updateScale);this.updateScale();return this.div;},updateScale:function(){var 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/100)*100;}
358 this.element.innerHTML="Scale = 1 : "+scale;},CLASS_NAME:"OpenLayers.Control.Scale"});OpenLayers.Feature=Class.create();OpenLayers.Feature.prototype={events:null,layer:null,id:null,lonlat:null,data:null,marker:null,popup:null,initialize:function(layer,lonlat,data){this.layer=layer;this.lonlat=lonlat;this.data=(data!=null)?data:new Object();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);}}
359 this.events=null;this.layer=null;this.id=null;this.lonlat=null;this.data=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null;}
360 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);}
361 return onScreen;},createMarker:function(){var marker=null;if(this.lonlat!=null){this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon);}
362 return this.marker;},destroyMarker:function(){this.marker.destroy();},createPopup:function(){if(this.lonlat!=null){var id=this.id+"_popup";var anchor=(this.marker)?this.marker.icon:null;this.popup=new OpenLayers.Popup.AnchoredBubble(id,this.lonlat,this.data.popupSize,this.data.popupContentHTML,anchor);}
363 return this.popup;},destroyPopup:function(){this.popup.destroy()},CLASS_NAME:"OpenLayers.Feature"};OpenLayers.Layer.Canvas=Class.create();OpenLayers.Layer.Canvas.prototype=Object.extend(new OpenLayers.Layer(),{isBaseLayer:false,isFixed:true,canvas:null,lines:new Array(),initialize:function(name,options){OpenLayers.Layer.prototype.initialize.apply(this,arguments);},destroy:function(){canvas=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},moveTo:function(bounds,zoomChanged,minor){this.redraw();},setStrokeColor:function(color){var ctx=this.canvas.getContext("2d");ctx.strokeStyle=color;},setStrokeWidth:function(width){var ctx=this.canvas.getContext("2d");ctx.lineWidth=width;},setAlpha:function(alpha){var ctx=this.canvas.getContext("2d");ctx.globalAlpha=alpha;},clearCanvas:function(){if(this.canvas!=null){this.canvas.getContext("2d").clearRect(0,0,this.map.getSize().w,this.map.getSize().h);}},drawLine:function(start,end){var ctx=this.canvas.getContext("2d");this.addLine(start,end);this.lines.push(new Array(start,end,ctx.strokeStyle,ctx.lineWidth,ctx.globalAlpha));},addLine:function(start,end){var ctx=this.canvas.getContext("2d");var startpx=this.map.getPixelFromLonLat(start);var endpx=this.map.getPixelFromLonLat(end);ctx.beginPath();ctx.moveTo(startpx.x,startpx.y);ctx.lineTo(endpx.x,endpx.y);ctx.closePath();ctx.stroke();},redraw:function(){if(!this.canvas){this.canvas=document.createElement("CANVAS");this.canvas.setAttribute("width",this.map.getSize().w);this.canvas.setAttribute("height",this.map.getSize().h);this.div.appendChild(this.canvas);}else{this.clearCanvas();}
364 for(var i=0;i<this.lines.length;i++){this.setStrokeColor(this.lines[i][2]);this.setStrokeWidth(this.lines[i][3]);this.setAlpha(this.lines[i][4]);this.addLine(this.lines[i][0],this.lines[i][1]);}},CLASS_NAME:"OpenLayers.Layer.Canvas"});OpenLayers.Layer.EventPane=Class.create();OpenLayers.Layer.EventPane.prototype=Object.extend(new OpenLayers.Layer,{isBaseLayer:true,isFixed:true,pane:null,initialize:function(name,options){OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(arguments.length>0){if(this.pane==null){this.pane=OpenLayers.Util.createDiv();}}},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(/MSIE/.test(navigator.userAgent)){this.pane.style.background="url("+OpenLayers.Util.getImagesLocation()+"blank.gif)";}
365 if(this.isFixed){this.map.viewPortDiv.appendChild(this.pane);}else{this.map.layerContainerDiv.appendChild(this.pane);}},setVisibility:function(visible,noEvent){OpenLayers.Layer.prototype.setVisibility.apply(this,arguments);this.pane.style.display=this.div.style.display;},CLASS_NAME:"OpenLayers.Layer.EventPane"});OpenLayers.Layer.HTTPRequest=Class.create();OpenLayers.Layer.HTTPRequest.prototype=Object.extend(new OpenLayers.Layer(),{url:null,params:null,initialize:function(name,url,params,options){var newArguments=arguments;if(arguments.length>0){newArguments=[name,options];}
366 OpenLayers.Layer.prototype.initialize.apply(this,newArguments);this.url=url;this.params=Object.extend(new Object(),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.options);}
367 obj=OpenLayers.Layer.prototype.clone.apply(this,[obj]);return obj;},setUrl:function(newUrl){this.url=newUrl;},mergeNewParams:function(newParams){this.params=Object.extend(this.params,newParams);},getFullRequestString:function(newParams,altUrl){var url=(altUrl==null)?this.url:altUrl;var requestString=url;var allParams=Object.extend(new Object(),this.params);var allParams=Object.extend(allParams,newParams);var paramsString=OpenLayers.Util.getParameterString(allParams);if(paramsString!=""){var lastServerChar=this.url.charAt(this.url.length-1);if((lastServerChar=="&")||(lastServerChar=="?")){requestString+=paramsString;}else{if(this.url.indexOf('?')==-1){requestString+='?'+paramsString;}else{requestString+='&'+paramsString;}}}
368 return requestString;},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});OpenLayers.Layer.Markers=Class.create();OpenLayers.Layer.Markers.prototype=Object.extend(new OpenLayers.Layer(),{isBaseLayer:false,markers:null,initialize:function(name,options){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.markers=new Array();},destroy:function(){this.clearMarkers();markers=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},moveTo:function(bounds,zoomChanged,minor){if(zoomChanged){this.redraw();}},addMarker:function(marker){this.markers.push(marker);if(this.map&&this.map.getExtent()){marker.map=this.map;this.drawMarker(marker);}},removeMarker:function(marker){this.markers.remove(marker);if((marker.icon!=null)&&(marker.icon.imageDiv!=null)&&(marker.icon.imageDiv.parentNode==this.div)){this.div.removeChild(marker.icon.imageDiv);}},clearMarkers:function(){if(this.markers!=null){while(this.markers.length>0){this.removeMarker(this.markers[0]);}}},redraw:function(){for(i=0;i<this.markers.length;i++){this.drawMarker(this.markers[i]);}},drawMarker:function(marker){var px=this.map.getLayerPxFromLonLat(marker.lonlat);if(px==null){marker.display(false);}else{var markerImg=marker.draw(px);if(!marker.drawn){this.div.appendChild(markerImg);marker.drawn=true;}}},CLASS_NAME:"OpenLayers.Layer.Markers"});OpenLayers.Map=Class.create();OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;OpenLayers.Map.prototype={Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Popup:750,Control:1000},EVENT_TYPES:["addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer"],events:null,div:null,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,zoom:0,tileSize:null,projection:"EPSG:4326",units:'degrees',maxResolution:1.40625,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,numZoomLevels:16,initialize:function(div,options){this.div=div=$(div);var id=div.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.div.appendChild(this.viewPortDiv);id=div.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,div,this.EVENT_TYPES);this.updateSize();if(navigator.appName.contains("Microsoft")){this.events.register("resize",this,this.updateSize);}else{Event.observe(window,'resize',this.updateSize.bindAsEventListener(this));}
369 this.setOptions(options);this.layers=[];if(this.controls==null){this.controls=[new OpenLayers.Control.MouseDefaults(),new OpenLayers.Control.PanZoom()];}
370 for(var i=0;i<this.controls.length;i++){this.addControlToMap(this.controls[i]);}
371 this.popups=new Array();Event.observe(window,'unload',this.destroy.bindAsEventListener(this));},destroy:function(){if(this.layers!=null){for(var i=0;i<this.layers.length;i++){this.layers[i].destroy();}
372 this.layers=null;}
373 if(this.controls!=null){for(var i=0;i<this.controls.length;i++){this.controls[i].destroy();}
374 this.controls=null;}},setOptions:function(options){this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);Object.extend(this,options);},getTileSize:function(){return this.tileSize;},getLayer:function(id){var foundLayer=null;for(var i=0;i<this.layers.length;i++){var layer=this.layers[i];if(layer.id==id){foundLayer=layer;}}
375 return foundLayer;},addLayer:function(layer){layer.div.style.overflow="";layer.div.style.zIndex=this.Z_INDEX_BASE[layer.isBaseLayer?'BaseLayer':'Overlay']
376 +this.layers.length*5;if(layer.isFixed){this.viewPortDiv.appendChild(layer.div);}else{this.layerContainerDiv.appendChild(layer.div);}
377 this.layers.push(layer);layer.setMap(this);this.events.triggerEvent("addlayer");if(this.center!=null){var bounds=this.getExtent();layer.moveTo(bounds,true);}
378 if(layer.isBaseLayer){if(this.baseLayer==null){this.setBaseLayer(layer);this.events.triggerEvent("changebaselayer");}else{layer.setVisibility(false);}}},addLayers:function(layers){for(var i=0;i<layers.length;i++){this.addLayer(layers[i]);}},removeLayer:function(layer){if(layer.isFixed){this.viewPortDiv.removeChild(layer.div);}else{this.layerContainerDiv.removeChild(layer.div);}
379 layer.map=null;this.layers.remove(layer);if(this.baseLayer==layer){this.baseLayer=null;for(i=0;i<this.layers.length;i++){var iLayer=this.layers[i];if(iLayer.isBaseLayer){this.setBaseLayer(iLayer);break;}}}
380 this.events.triggerEvent("removelayer");},setBaseLayer:function(newBaseLayer,noEvent){if(newBaseLayer!=this.baseLayer){if(this.layers.indexOf(newBaseLayer)!=-1){if(this.baseLayer!=null){this.baseLayer.setVisibility(false,noEvent);}
381 this.baseLayer=newBaseLayer;this.baseLayer.setVisibility(true,noEvent);var center=this.getCenter();if(center!=null){var zoom=this.getZoom();this.zoom=null;if(zoom>this.baseLayer.numZoomLevels-1){zoom=this.baseLayer.numZoomLevels-1;}
382 this.setCenter(center,zoom);}
383 if((noEvent==null)||(noEvent==false)){this.events.triggerEvent("changebaselayer");}}}},addControl:function(control,px){this.controls.push(control);this.addControlToMap(control,px);},addControlToMap:function(control,px){control.setMap(this);var div=control.draw(px);if(div){div.style.zIndex=this.Z_INDEX_BASE['Control']+
384 this.controls.length;this.viewPortDiv.appendChild(div);}},addPopup:function(popup,exclusive){if(exclusive){for(var i=0;i<this.popups.length;i++){this.removePopup(this.popups[i]);}}
385 popup.map=this;this.popups.push(popup);var popupDiv=popup.draw();if(popupDiv){popupDiv.style.zIndex=this.Z_INDEX_BASE['Popup']+
386 this.popups.length;this.layerContainerDiv.appendChild(popupDiv);}},removePopup:function(popup){this.popups.remove(popup);if(popup.div){try{this.layerContainerDiv.removeChild(popup.div);}
387 catch(e){}}
388 popup.map=null;},getSize:function(){var size=null;if(this.size!=null){size=this.size.clone();}
389 return size;},updateSize:function(){var newSize=this.getCurrentSize();var oldSize=this.getSize();if(oldSize==null)
390 this.size=oldSize=newSize;if(!newSize.equals(oldSize)){for(var i=0;i<this.layers.length;i++){this.layers[i].onMapResize();}
391 this.size=newSize;this.events.element.offsets=null;if(this.baseLayer!=null){var center=new OpenLayers.Pixel(newSize.w/2,newSize.h/2);var centerLL=this.getLonLatFromViewPortPx(center);var zoom=this.getZoom();this.zoom=null;this.setCenter(this.getCenter(),zoom);}}},getCurrentSize:function(){var size=new OpenLayers.Size(this.div.clientWidth,this.div.clientHeight);if(size.w==0&&size.h==0){var dim=Element.getDimensions(this.div);size.w=dim.width;size.h=dim.height;}
392 if(size.w==0&&size.h==0){size.w=parseInt(this.div.style.width);size.h=parseInt(this.div.style.height);}
393 return size;},getCenter:function(){return this.center;},getZoom:function(){return this.zoom;},pan:function(dx,dy){var centerPx=this.getViewPortPxFromLonLat(this.getCenter());var newCenterPx=centerPx.add(dx,dy);if(!newCenterPx.equals(centerPx)){var newCenterLonLat=this.getLonLatFromViewPortPx(newCenterPx);this.setCenter(newCenterLonLat);}},setCenter:function(lonlat,zoom,minor){var zoomChanged=(this.isValidZoomLevel(zoom))&&(zoom!=this.getZoom());var centerChanged=(this.isValidLonLat(lonlat))&&(!lonlat.equals(this.center));if(zoomChanged||centerChanged||!minor){if(!minor){this.events.triggerEvent("movestart");}
394 if(centerChanged){if((!zoomChanged)&&(this.center)){this.centerLayerContainer(lonlat);}
395 this.center=lonlat.clone();}
396 if((zoomChanged)||(this.layerContainerOrigin==null)){this.layerContainerOrigin=this.center.clone();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px";}
397 if(zoomChanged){this.zoom=zoom;for(var i=0;i<this.popups.length;i++){this.popups[i].updatePosition();}}
398 var bounds=this.getExtent();for(var i=0;i<this.layers.length;i++){var layer=this.layers[i];if(layer.getVisibility()){layer.moveTo(bounds,zoomChanged,minor);}}
399 this.events.triggerEvent("move");if(zoomChanged){this.events.triggerEvent("zoomend");}}
400 if(!minor){this.events.triggerEvent("moveend");}},centerLayerContainer:function(lonlat){var originPx=this.getViewPortPxFromLonLat(this.layerContainerOrigin);var newPx=this.getViewPortPxFromLonLat(lonlat);this.layerContainerDiv.style.left=(originPx.x-newPx.x)+"px";this.layerContainerDiv.style.top=(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);}
401 return valid;},getProjection:function(){var projection=null;if(this.baseLayer!=null){projection=this.baseLayer.projection;}
402 return projection;},getMaxResolution:function(){var maxResolution=null;if(this.baseLayer!=null){maxResolution=this.baseLayer.maxResolution;}
403 return maxResolution;},getMaxExtent:function(){var maxExtent=null;if(this.baseLayer!=null){maxExtent=this.baseLayer.maxExtent;}
404 return maxExtent;},getNumZoomLevels:function(){var numZoomLevels=null;if(this.baseLayer!=null){numZoomLevels=this.baseLayer.numZoomLevels;}
405 return numZoomLevels;},getExtent:function(){var extent=null;if(this.baseLayer!=null){extent=this.baseLayer.getExtent();}
406 return extent;},getResolution:function(){var resolution=null;if(this.baseLayer!=null){resolution=this.baseLayer.getResolution();}
407 return resolution;},getScale:function(){var scale=null;if(this.baseLayer!=null){var res=this.getResolution();var units=this.baseLayer.units;scale=res*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH;}
408 return scale;},getZoomForExtent:function(bounds){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForExtent(bounds);}
409 return zoom;},getZoomForResolution:function(resolution){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForResolution(resolution);}
410 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){this.setCenter(bounds.getCenterLonLat(),this.getZoomForExtent(bounds));},zoomToMaxExtent:function(){this.zoomToExtent(this.getMaxExtent());},zoomToScale:function(scale){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);},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if(this.baseLayer!=null){lonlat=this.baseLayer.getLonLatFromViewPortPx(viewPortPx);}
411 return lonlat;},getViewPortPxFromLonLat:function(lonlat){var px=null;if(this.baseLayer!=null){px=this.baseLayer.getViewPortPxFromLonLat(lonlat);}
412 return px;},getLonLatFromPixel:function(px){return this.getLonLatFromViewPortPx(px);},getPixelFromLonLat:function(lonlat){return this.getViewPortPxFromLonLat(lonlat);},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);}
413 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;}}
414 return layerPx;},getLonLatFromLayerPx:function(px){px=this.getViewPortPxFromLayerPx(px);return this.getLonLatFromViewPortPx(px);},getLayerPxFromLonLat:function(lonlat){var px=this.getViewPortPxFromLonLat(lonlat);return this.getLayerPxFromViewPortPx(px);},CLASS_NAME:"OpenLayers.Map"};OpenLayers.Marker.Box=Class.create();OpenLayers.Marker.Box.prototype=Object.extend(new OpenLayers.Marker(),{bounds:null,div:null,initialize:function(bounds,borderColor,borderWidth){if(arguments.length>0){this.bounds=bounds;this.div=OpenLayers.Util.createDiv();this.events=new OpenLayers.Events(this,this.div,null);this.setBorder(borderColor,borderWidth);}},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);}
415 return onScreen;},display:function(display){this.div.style.display=(display)?"":"none";},CLASS_NAME:"OpenLayers.Marker.Box"});OpenLayers.Popup.Anchored=Class.create();OpenLayers.Popup.Anchored.prototype=Object.extend(new OpenLayers.Popup(),{relativePosition:null,anchor:null,initialize:function(id,lonlat,size,contentHTML,anchor){var newArguments=new Array(id,lonlat,size,contentHTML);OpenLayers.Popup.prototype.initialize.apply(this,newArguments);this.anchor=(anchor!=null)?anchor:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)};},draw:function(px){if(px==null){if((this.lonlat!=null)&&(this.map!=null)){px=this.map.getLayerPxFromLonLat(this.lonlat);}}
416 this.relativePosition=this.calculateRelativePosition(px);return OpenLayers.Popup.prototype.draw.apply(this,arguments);},calculateRelativePosition:function(px){var lonlat=this.map.getLonLatFromLayerPx(px);var extent=this.map.getExtent();var quadrant=extent.determineQuadrant(lonlat);return OpenLayers.Bounds.oppositeQuadrant(quadrant);},moveTo:function(px){var newPx=this.calculateNewPx(px);var newArguments=new Array(newPx);OpenLayers.Popup.prototype.moveTo.apply(this,newArguments);},setSize:function(size){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if((this.lonlat)&&(this.map)){var px=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(px);}},calculateNewPx:function(px){var newPx=px.offset(this.anchor.offset);var top=(this.relativePosition.charAt(0)=='t');newPx.y+=(top)?-this.size.h:this.anchor.size.h;var left=(this.relativePosition.charAt(1)=='l');newPx.x+=(left)?-this.size.w:this.anchor.size.w;return newPx;},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.Tile.Image=Class.create();OpenLayers.Tile.Image.prototype=Object.extend(new OpenLayers.Tile(),{imgDiv:null,initialize:function(layer,position,bounds,url,size){OpenLayers.Tile.prototype.initialize.apply(this,arguments);},destroy:function(){if((this.imgDiv!=null)&&(this.imgDiv.parentNode==this.layer.div)){this.layer.div.removeChild(this.imgDiv);}
417 this.imgDiv=null;OpenLayers.Tile.prototype.destroy.apply(this,arguments);},draw:function(){OpenLayers.Tile.prototype.draw.apply(this,arguments);if(this.imgDiv==null){this.initImgDiv();}
418 this.imgDiv.style.display="none";if(this.layer.alpha){OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,this.position,this.size,this.url);}else{this.imgDiv.src=this.url;OpenLayers.Util.modifyDOMElement(this.imgDiv,null,this.position,this.size);}},clear:function(){OpenLayers.Tile.prototype.clear.apply(this,arguments);if(this.imgDiv){this.imgDiv.style.display="none";}},moveTo:function(bounds,position,redraw){this.url=this.layer.getURL(bounds);OpenLayers.Tile.prototype.moveTo.apply(this,arguments);},initImgDiv:function(){if(this.layer.alpha){this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,this.position,this.size,null,"absolute",null,null,true);}else{this.imgDiv=OpenLayers.Util.createImage(null,this.position,this.size,null,"absolute",null,true);}
419 this.layer.div.appendChild(this.imgDiv);if(this.layer.opacity!=null){OpenLayers.Util.setOpacity(this.imgDiv,this.layer.opacity);}},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.WFS=Class.create();OpenLayers.Tile.WFS.prototype=Object.extend(new OpenLayers.Tile(),{features:null,urls:null,initialize:function(layer,position,bounds,urls,size){var newArguments=arguments;if(arguments.length>0){newArguments=[layer,position,bounds,null,size];}
420 OpenLayers.Tile.prototype.initialize.apply(this,newArguments);this.urls=urls;this.features=new Array();},destroy:function(){OpenLayers.Tile.prototype.destroy.apply(this,arguments);this.destroyAllFeatures();this.features=null;this.urls=null;},clear:function(){OpenLayers.Tile.prototype.clear.apply(this,arguments);this.destroyAllFeatures();},draw:function(){if(this.drawn){this.clear();}
421 OpenLayers.Tile.prototype.draw.apply(this,arguments);this.loadFeaturesForRegion(this.requestSuccess);},loadFeaturesForRegion:function(success,failure){if(this.urls!=null){for(var i=0;i<this.urls.length;i++){var params={BBOX:this.bounds.toBBOX()};var url=this.urls[i]+"&"+
422 OpenLayers.Util.getParameterString(params);OpenLayers.loadURL(url,null,this,success,failure);}}},requestSuccess:function(request){var doc=request.responseXML;if(!doc||request.fileType!="XML"){doc=OpenLayers.parseXMLString(request.responseText);}
423 var resultFeatures=doc.getElementsByTagName("featureMember");this.addResults(resultFeatures);},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.MouseToolbar=Class.create();OpenLayers.Control.MouseToolbar.X=6;OpenLayers.Control.MouseToolbar.Y=300;OpenLayers.Control.MouseToolbar.prototype=Object.extend(new OpenLayers.Control(),Object.extend(new 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;}
424 if(direction){this.direction=direction;}
425 this.measureDivs=[];},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);OpenLayers.Control.MouseDefaults.prototype.draw.apply(this,arguments);this.buttons=new Object();var sz=new OpenLayers.Size(28,28);var centered=this.position;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.register("mousedown",this,this.buttonDown);btn.events.register("mouseup",this,this.buttonUp);btn.events.register("dblclick",this,Event.stop);btn.action=id;btn.title=title;btn.alt=title;btn.map=this.map;this.buttons[id]=btn;return btn;},buttonDown:function(evt){if(!Event.isLeftClick(evt))return;this.buttonClicked=evt.element.action;Event.stop(evt);},buttonUp:function(evt){if(!Event.isLeftClick(evt))return;if(this.buttonClicked!=null){if(this.buttonClicked==evt.element.action){this.switchModeTo(evt.element.action);}
426 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);Event.stop(evt);return false;},defaultMouseDown:function(evt){if(!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");}
427 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){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;}
428 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);}
429 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;}
430 document.onselectstart=function(){return false;}
431 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);}
432 if(this.mode=="measure"&&mode!="measure"){for(var i=0;i<this.measureDivs.length;i++){if(this.measureDivs[i]){this.map.layerContainerDiv.removeChild(this.measureDivs[i]);}}
433 this.measureDivs=[];this.measureStart=null;}
434 this.mode=mode;if(this.buttons[mode]){OpenLayers.Util.modifyAlphaImageDiv(this.buttons[mode],null,null,null,this.buttons[mode].activeImgLocation);}
435 switch(this.mode){case"zoombox":this.map.div.style.cursor="crosshair";break;default:this.map.div.style.cursor="default";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";}
436 if(evt.xy.y<this.mouseDragStart.y){this.zoomBox.style.top=evt.xy.y+"px";}
437 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();}
438 this.performedDrag=true;}},defaultMouseUp:function(evt){if(!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);}}
439 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();}
440 this.mouseDragStart=null;this.map.div.style.cursor="default";}},defaultClick:function(evt){if(this.performedDrag){this.performedDrag=false;return false;}}}));OpenLayers.Control.PanZoomBar=Class.create();OpenLayers.Control.PanZoomBar.X=4;OpenLayers.Control.PanZoomBar.Y=4;OpenLayers.Control.PanZoomBar.prototype=Object.extend(new OpenLayers.Control.PanZoom(),{buttons:null,zoomStopWidth:18,zoomStopHeight:11,initialize:function(){OpenLayers.Control.PanZoom.prototype.initialize.apply(this,arguments);this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoomBar.X,OpenLayers.Control.PanZoomBar.Y);},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.div.innerHTML="";}
441 this.draw();},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);px=this.position.clone();this.buttons=new Array();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);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="OpenLayers_Control_PanZoomBar_Slider"+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);this.sliderEvents.register("mousedown",this,this.zoomBarDown);this.sliderEvents.register("mousemove",this,this.zoomBarDrag);this.sliderEvents.register("mouseup",this,this.zoomBarUp);this.sliderEvents.register("dblclick",this,this.doubleClick);this.sliderEvents.register("click",this,this.doubleClick);sz=new OpenLayers.Size();sz.h=this.zoomStopHeight*this.map.getNumZoomLevels();sz.w=this.zoomStopWidth;var div=null
442 if(OpenLayers.Util.alphaHack()){var id="OpenLayers_Control_PanZoomBar"+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;}else{div=OpenLayers.Util.createDiv('OpenLayers_Control_PanZoomBar_Zoombar'+this.map.id,centered,sz,imgLocation+"zoombar.png");}
443 this.zoombarDiv=div;this.divEvents=new OpenLayers.Events(this,div,null,true);this.divEvents.register("mousedown",this,this.divClick);this.divEvents.register("mousemove",this,this.passEventToSlider);this.divEvents.register("dblclick",this,this.doubleClick);this.divEvents.register("click",this,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;},passEventToSlider:function(evt){this.sliderEvents.handleBrowserEvent(evt);},divClick:function(evt){if(!Event.isLeftClick(evt))return;var y=evt.xy.y;var top=Position.page(evt.object)[1];var levels=Math.floor((y-top)/this.zoomStopHeight);this.map.zoomTo((this.map.getNumZoomLevels()-1)-levels);Event.stop(evt);},zoomBarDown:function(evt){if(!Event.isLeftClick(evt))return;this.map.events.register("mousemove",this,this.passEventToSlider);this.map.events.register("mouseup",this,this.passEventToSlider);this.mouseDragStart=evt.xy.clone();this.zoomStart=evt.xy.clone();this.div.style.cursor="move";Event.stop(evt);},zoomBarDrag:function(evt){if(this.mouseDragStart!=null){var deltaY=this.mouseDragStart.y-evt.xy.y
444 var offsets=Position.page(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";}
445 this.mouseDragStart=evt.xy.clone();Event.stop(evt);}},zoomBarUp:function(evt){if(!Event.isLeftClick(evt))return;if(this.zoomStart){this.div.style.cursor="default";this.map.events.unregister("mouseup",this,this.passEventToSlider);this.map.events.unregister("mousemove",this,this.passEventToSlider);var deltaY=this.zoomStart.y-evt.xy.y
446 this.map.zoomTo(this.map.zoom+Math.round(deltaY/this.zoomStopHeight));this.moveZoomBar();this.mouseDragStart=null;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.Feature.WFS=Class.create();OpenLayers.Feature.WFS.prototype=Object.extend(new OpenLayers.Feature(),{initialize:function(layer,xmlNode){var newArguments=arguments;if(arguments.length>0){var data=this.processXMLNode(xmlNode);newArguments=new Array(layer,data.lonlat,data)}
447 OpenLayers.Feature.prototype.initialize.apply(this,newArguments);if(arguments.length>0){this.createMarker();this.layer.addMarker(this.marker);}},destroy:function(){if(this.marker!=null){this.layer.removeMarker(this.marker);}
448 OpenLayers.Feature.prototype.destroy.apply(this,arguments);},processXMLNode:function(xmlNode){var point=xmlNode.getElementsByTagName("Point");var text=OpenLayers.Util.getXmlNodeValue(point[0].getElementsByTagName("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.Layer.Boxes=Class.create();OpenLayers.Layer.Boxes.prototype=Object.extend(new OpenLayers.Layer.Markers(),{initialize:function(){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(botright.x-topleft.x,botright.y-topleft.y);var markerDiv=marker.draw(topleft,sz);if(!marker.drawn){this.div.appendChild(markerDiv);marker.drawn=true;}}},CLASS_NAME:"OpenLayers.Layer.Boxes"});OpenLayers.Layer.GeoRSS=Class.create();OpenLayers.Layer.GeoRSS.prototype=Object.extend(new OpenLayers.Layer.Markers(),{location:null,features:null,selectedFeature:null,initialize:function(name,location){OpenLayers.Layer.Markers.prototype.initialize.apply(this,[name]);this.location=location;this.features=new Array();OpenLayers.loadURL(location,null,this,this.parseData);},destroy:function(){this.clearFeatures();this.features=null;OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments);},parseData:function(ajaxRequest){var doc=ajaxRequest.responseXML;if(!doc||ajaxRequest.fileType!="XML"){doc=OpenLayers.parseXMLString(ajaxRequest.responseText);}
449 this.name=doc.getElementsByTagName("title")[0].firstChild.nodeValue;var itemlist=doc.getElementsByTagName('item');for(var i=0;i<itemlist.length;i++){var data={};var point=OpenLayers.Util.getNodes(itemlist[i],'georss:point');var lat=OpenLayers.Util.getNodes(itemlist[i],'geo:lat');var lon=OpenLayers.Util.getNodes(itemlist[i],'geo:long');if(point.length>0){var location=point[0].firstChild.nodeValue.split(" ");if(location.length!=2){var location=point[0].firstChild.nodeValue.split(",");}}else if(lat.length>0&&lon.length>0){var location=[parseFloat(lat[0].firstChild.nodeValue),parseFloat(lon[0].firstChild.nodeValue)];}else{continue;}
450 location=new OpenLayers.LonLat(parseFloat(location[1]),parseFloat(location[0]));var title="No title";try{title=OpenLayers.Util.getNodes(itemlist[i],"title")[0].firstChild.nodeValue;}
451 catch(e){alert(e);}
452 var description="No description";try{description=OpenLayers.Util.getNodes(itemlist[i],"description")[0].firstChild.nodeValue;}
453 catch(e){alert(e);}
454 try{var link=OpenLayers.Util.getNodes(itemlist[i],"link")[0].firstChild.nodeValue;}catch(e){}
455 data.icon=OpenLayers.Marker.defaultIcon();data.popupSize=new OpenLayers.Size(250,100);if((title!=null)&&(description!=null)){contentHTML="<br />";contentHTML+="<div style='margin: -0.5em 0.5em 0.5em 0.5em'>"
456 contentHTML+="<div style='height: 1.3em; overflow: hidden'>";contentHTML+="<span style='font-size: 1.2em; font-weight: bold'>";if(link)contentHTML+="<a href='"+link+"' target='_blank'>";contentHTML+=title;if(link)contentHTML+="</a>";contentHTML+="</span>";contentHTML+="</div>";contentHTML+="<span style='font-size: 0.7em; align:center'>";contentHTML+=description;contentHTML+="</span>";contentHTML+="</div>"
457 data['popupContentHTML']=contentHTML;}
458 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);}},markerClick:function(evt){sameMarkerClicked=(this==this.layer.selectedFeature);this.layer.selectedFeature=(!sameMarkerClicked)?this:null;for(var i=0;i<this.layer.map.popups.length;i++){this.layer.map.removePopup(this.layer.map.popups[i]);}
459 if(!sameMarkerClicked){var popup=this.createPopup();Event.observe(popup.div,"click",function(){for(var i=0;i<this.layer.map.popups.length;i++){this.layer.map.removePopup(this.layer.map.popups[i]);}}.bindAsEventListener(this));this.layer.map.addPopup(popup);}
460 Event.stop(evt);},clearFeatures:function(){if(this.features!=null){while(this.features.length>0){var feature=this.features[0];this.features.remove(feature);feature.destroy();}}},CLASS_NAME:"OpenLayers.Layer.GeoRSS"});OpenLayers.Layer.Google=Class.create();OpenLayers.Layer.Google.prototype=Object.extend(new OpenLayers.Layer.EventPane(),Object.extend(new OpenLayers.Layer.FixedZoomLevels(),{isFixed:true,gmap:null,type:null,minZoomLevel:0,maxZoomLevel:16,initialize:function(name,options){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);if(this.maxExtent==null){this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);}
461 this.addContainerPxFunction();this.numZoomLevels=this.maxZoomLevel-this.minZoomLevel+1;},destroy:function(){this.gmap=null;OpenLayers.Layer.EventPane.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Layer.EventPane.prototype.setMap.apply(this,arguments);this.loadGMap();},moveTo:function(bounds,zoomChanged,minor){if((this.gmap!=null)&&(!this.dragging)){var newOLCenter=this.map.getCenter();var newOLZoom=this.map.getZoom();if(newOLCenter!=null){var oldGCenter=this.gmap.getCenter();var oldOLCenter=this.getOLLonLatFromGLatLng(oldGCenter);var oldGZoom=this.gmap.getZoom();var oldOLZoom=this.getOLZoomFromGZoom(oldGZoom);if(!(newOLCenter.equals(oldOLCenter))||!(newOLZoom==oldOLZoom)){var newGCenter=this.getGLatLngFromOLLonLat(newOLCenter);var newGZoom=this.getGZoomFromOLZoom(newOLZoom);this.gmap.setCenter(newGCenter,newGZoom);if(this.type!=null){this.gmap.setMapType(this.type);this.type=null;}}}}},loadGMap:function(){try{this.gmap=new GMap2(this.div);this.gmap.disableDragging();this.moveTo();}catch(e){this.loadWarningMessage();}},onMapResize:function(){this.gmap.checkResize();},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var html="";html+="The Google Layer was unable to load correctly.<br>";html+="<br>";html+="To get rid of this message, click on the Google Layer's "
462 html+="tab in the layer switcher in the upper-right corner.<br>";html+="<br>";html+="Most likely, this is because the Google Maps library";html+=" script was either not included, or does not contain the";html+=" correct API key for your site.<br>";html+="<br>";html+="Developers: For help getting this working correctly, ";html+="<a href='http://trac.openlayers.org/wiki/GoogleMapsLayer' "
463 html+="target='_blank'>";html+="click here";html+="</a>";var viewSize=this.map.getSize();msgW=Math.min(viewSize.w,300);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("gmapsWarning",topLeft,size,null,null,null,"auto");div.style.padding="7px";div.style.backgroundColor="yellow";div.innerHTML=html;this.div.appendChild(div);},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if((this.gmap!=null)&&(this.gmap.getCenter()!=null)){var gPoint=this.getGPointFromOLPixel(viewPortPx);var gLatLng=this.gmap.fromContainerPixelToLatLng(gPoint)
464 lonlat=this.getOLLonLatFromGLatLng(gLatLng);}
465 return lonlat;},getViewPortPxFromLonLat:function(lonlat){var viewPortPx=null;if((this.gmap!=null)&&(this.gmap.getCenter()!=null)){var gLatLng=this.getGLatLngFromOLLonLat(lonlat);var gPoint=this.gmap.fromLatLngToContainerPixel(gLatLng);viewPortPx=this.getOLPixelFromGPoint(gPoint);}
466 return viewPortPx;},getZoomForExtent:function(bounds){var zoom=null;if((this.gmap!=null)&&(this.gmap.getCenter()!=null)){var gBounds=this.getGLatLngBoundsFromOLBounds(bounds);var gZoom=this.gmap.getBoundsZoomLevel(gBounds);var gZoom=Math.min(Math.max(gZoom,this.minZoomLevel),this.maxZoomLevel);zoom=this.getOLZoomFromGZoom(gZoom);}
467 return zoom;},getOLZoomFromGZoom:function(gZoom){var zoom=null;if(gZoom!=null){zoom=gZoom-this.minZoomLevel;}
468 return zoom;},getGZoomFromOLZoom:function(olZoom){var zoom=null;if(olZoom!=null){zoom=olZoom+this.minZoomLevel;}
469 return zoom;},getOLLonLatFromGLatLng:function(gLatLng){var olLonLat=null;if(gLatLng!=null){olLonLat=new OpenLayers.LonLat(gLatLng.lng(),gLatLng.lat());}
470 return olLonLat;},getGLatLngFromOLLonLat:function(olLonLat){var gLatLng=null;if(olLonLat!=null){gLatLng=new GLatLng(olLonLat.lat,olLonLat.lon);}
471 return gLatLng;},getOLPixelFromGPoint:function(gPoint){var olPixel=null;if(gPoint!=null){olPixel=new OpenLayers.Pixel(gPoint.x,gPoint.y);}
472 return olPixel;},getGPointFromOLPixel:function(olPixel){var gPoint=null;if(olPixel!=null){gPoint=new GPoint(olPixel.x,olPixel.y);}
473 return gPoint;},getOLBoundsFromGLatLngBounds:function(gLatLngBounds){var olBounds=null;if(gLatLngBounds!=null){var sw=gLatLngBounds.getSouthWest();var ne=gLatLngBounds.getNorthEast();olBounds=new OpenLayers.Bounds(sw.lng(),sw.lat(),ne.lng(),ne.lat());}
474 return olBounds;},getGLatLngBoundsFromOLBounds:function(olBounds){var gLatLngBounds=null;if(olBounds!=null){var sw=new GLatLng(olBounds.bottom,olBounds.left);var ne=new GLatLng(olBounds.top,olBounds.right);gLatLngBounds=new GLatLngBounds(sw,ne);}
475 return gLatLngBounds;},addContainerPxFunction:function(){if(typeof GMap2!="undefined"&&!GMap2.fromLatLngToContainerPixel){GMap2.prototype.fromLatLngToContainerPixel=function(gLatLng){var gPoint=this.fromLatLngToDivPixel(gLatLng);var div=this.b.firstChild.firstChild;gPoint.x+=div.offsetLeft;gPoint.y+=div.offsetTop;return gPoint;};}},CLASS_NAME:"OpenLayers.Layer.Google"}));OpenLayers.Layer.Grid=Class.create();OpenLayers.Layer.Grid.prototype=Object.extend(new OpenLayers.Layer.HTTPRequest(),{tileSize:null,grid:null,buffer:2,initialize:function(name,url,params,options){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.grid=new Array();},destroy:function(){this.clearGrid();this.grid=null;this.tileSize=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.options);}
476 obj=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[obj]);if(this.tileSize!=null){obj.tileSize=this.tileSize.clone();}
477 obj.grid=null;return obj;},setMap:function(map){OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this,arguments);if(this.tileSize==null){this.tileSize=this.map.getTileSize();}},moveTo:function(bounds,zoomChanged,dragging){if(bounds==null){bounds=this.map.getExtent();}
478 if(bounds!=null){if(!this.grid.length||zoomChanged||!this.getGridBounds().containsBounds(bounds,true)){this._initTiles();}else{while(true){var tlLayer=this.grid[0][0].position;var tlViewPort=this.map.getViewPortPxFromLayerPx(tlLayer);if(tlViewPort.x>-this.tileSize.w*(this.buffer-1)){this.shiftColumn(true);}else if(tlViewPort.x<-this.tileSize.w*this.buffer){this.shiftColumn(false);}else if(tlViewPort.y>-this.tileSize.h*(this.buffer-1)){this.shiftRow(true);}else if(tlViewPort.y<-this.tileSize.h*this.buffer){this.shiftRow(false);}else{break;}}}}},getGridBounds:function(){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];return new OpenLayers.Bounds(bottomLeftTile.bounds.left,bottomLeftTile.bounds.bottom,topRightTile.bounds.right,topRightTile.bounds.top);},_initTiles:function(){var viewSize=this.map.getSize();var bounds=this.map.getExtent();var extent=this.map.getMaxExtent();var resolution=this.map.getResolution();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;tileoffsetx=Math.round(tileoffsetx);tileoffsety=Math.round(tileoffsety);this.origin=new OpenLayers.Pixel(tileoffsetx,tileoffsety);var startX=tileoffsetx;var startLon=tileoffsetlon;var rowidx=0;do{var row=this.grid[rowidx++];if(!row){row=new Array();this.grid.push(row);}
479 tileoffsetlon=startLon;tileoffsetx=startX;var colidx=0;do{var tileBounds=new OpenLayers.Bounds(tileoffsetlon,tileoffsetlat,tileoffsetlon+tilelon,tileoffsetlat+tilelat);var x=tileoffsetx;x-=parseInt(this.map.layerContainerDiv.style.left);var y=tileoffsety;y-=parseInt(this.map.layerContainerDiv.style.top);var px=new OpenLayers.Pixel(x,y);var tile=row[colidx++];if(!tile){tile=this.addTile(tileBounds,px);row.push(tile);}else{tile.moveTo(tileBounds,px,false);}
480 tileoffsetlon+=tilelon;tileoffsetx+=this.tileSize.w;}while(tileoffsetlon<=bounds.right+tilelon*this.buffer)
481 tileoffsetlat-=tilelat;tileoffsety+=this.tileSize.h;}while(tileoffsetlat>=bounds.bottom-tilelat*this.buffer)
482 this.spiralTileLoad();},spiralTileLoad:function(){var tileQueue=new Array();var directions=["right","down","left","up"];var iRow=0;var iCell=-1;var direction=directions.indexOf("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;}
483 var tile=null;if((testRow<this.grid.length)&&(testRow>=0)&&(testCell<this.grid[0].length)&&(testCell>=0)){tile=this.grid[testRow][testCell];}
484 if((tile!=null)&&(!tile.queued)){tileQueue.unshift(tile);tile.queued=true;directionsTried=0;iRow=testRow;iCell=testCell;}else{direction=(direction+1)%4;directionsTried++;}}
485 for(var i=0;i<tileQueue.length;i++){var tile=tileQueue[i]
486 tile.draw();tile.queued=false;}},addTile:function(bounds,position){},clearGrid:function(){if(this.grid){for(var iRow=0;iRow<this.grid.length;iRow++){var row=this.grid[iRow];for(var iCol=0;iCol<row.length;iCol++){row[iCol].clear();}}}},shiftRow:function(prepend){var modelRowIndex=(prepend)?0:(this.grid.length-1);var modelRow=this.grid[modelRowIndex];var resolution=this.map.getResolution();var deltaY=(prepend)?-this.tileSize.h:this.tileSize.h;var deltaLat=resolution*-deltaY;var row=(prepend)?this.grid.pop():this.grid.shift();for(var i=0;i<modelRow.length;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);}
487 if(prepend){this.grid.unshift(row);}else{this.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;i<this.grid.length;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()
488 tile.moveTo(bounds,position);if(prepend){this.grid[i].unshift(tile);}else{this.grid[i].push(tile);}}},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Layer.MultiMap=Class.create();OpenLayers.Layer.MultiMap.prototype=Object.extend(new OpenLayers.Layer.EventPane(),{multimap:null,minZoomLevel:1,maxZoomLevel:17,initialize:function(name){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);this.numZoomLevels=this.maxZoomLevel-this.minZoomLevel+1;},setMap:function(map){OpenLayers.Layer.EventPane.prototype.setMap.apply(this,arguments);this.loadMMMap();},moveTo:function(bounds,zoomChanged,minor){if(this.multimap!=null){var olCenter=this.map.getCenter();var mmCenter=this.getMMLatLongFromOLLonLat(olCenter);if(zoomChanged){var olZoom=this.map.getZoom();var mmZoom=this.getMMZoomFromOLZoom(olZoom);this.multimap.goToPosition(mmCenter,mmZoom);}else{this.multimap.goToPosition(mmCenter);}}},loadMMMap:function(){try{this.multimap=new MultimapViewer(this.div);}catch(e){}
489 if(this.multimap==null){this.loadWarningMessage();}},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var html="";html+="The MM Layer was unable to load correctly.<br>";html+="<br>";html+="To get rid of this message, click on the MM Layer's "
490 html+="tab in the layer switcher in the upper-right corner.<br>";html+="<br>";html+="Most likely, this is because the MM library";html+=" script was either not correctly included.<br>";html+="<br>";html+="Demmlopers: For help getting this working correctly, ";html+="<a href='http://trac.openlayers.org/wiki/MultiMapLayer' "
491 html+="target='_blank'>";html+="click here";html+="</a>";var viewSize=this.map.getSize();msgW=Math.min(viewSize.w,300);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("mmWarning",topLeft,size,null,null,null,"auto");div.style.padding="7px";div.style.backgroundColor="yellow";div.innerHTML=html;this.div.appendChild(div);},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if(this.multimap!=null){var pixel=this.getPixelFromOLPixel(viewPortPx);var zoom=this.multimap.getZoomFactor();pixel.x=pixel.x-(this.map.getSize().w/2);pixel.y=pixel.y-(this.map.getSize().h/2);var mmLatLong=this.multimap.getMapPositionAt(pixel);lonlat=this.getOLLonLatFromMMLatLong(mmLatLong);}
492 return lonlat;},getViewPortPxFromLonLat:function(lonlat){var viewPortPx=null;if(this.multimap!=null){var mmLatLong=this.getMMLatLongFromOLLonLat(lonlat);var pixel=this.multimap.geoPosToContainerPixels(mmLatLong);viewPortPx=this.getOLPixelFromPixel(pixel);}
493 return viewPortPx;},getZoomForExtent:function(bounds){var zoom=null;if(this.multimap!=null){var maxRes=this.map.getMaxResolution();var viewSize=this.map.getSize();var width=bounds.getWidth();var height=bounds.getHeight();var degPerPixel=(width>height)?width/viewSize.w:height/viewSize.h;var mmZoom=Math.floor((Math.log(maxRes/degPerPixel))/Math.log(2));var mmZoom=Math.min(Math.max(mmZoom,this.minZoomLevel),this.maxZoomLevel);zoom=this.getOLZoomFromMMZoom(mmZoom);}
494 return zoom;},getOLZoomFromMMZoom:function(mmZoom){if(mmZoom)return mmZoom-1;return null;},getMMZoomFromOLZoom:function(olZoom){if(olZoom)return olZoom+1;return null;},getOLLonLatFromMMLatLong:function(mmLatLong){var olLonLat=null;if(mmLatLong!=null){olLonLat=new OpenLayers.LonLat(mmLatLong.lon,mmLatLong.lat);}
495 return olLonLat;},getMMLatLongFromOLLonLat:function(olLonLat){var mmLatLong=null;if(olLonLat!=null){mmLatLong=new MMLatLon(olLonLat.lat,olLonLat.lon);}
496 return mmLatLong;},getOLPixelFromPixel:function(pixel){var olPixel=null;if(pixel!=null){olPixel=new OpenLayers.Pixel(pixel.x,pixel.y);}
497 return olPixel;},getPixelFromOLPixel:function(olPixel){var pixel=null;if(olPixel!=null){pixel=new MMPoint(olPixel.x,olPixel.y);}
498 return pixel;},destroy:function(){this.multimap=null;OpenLayers.Layer.EventPane.prototype.destroy.apply(this,arguments);},CLASS_NAME:"OpenLayers.Layer.MultiMap"});OpenLayers.Layer.Text=Class.create();OpenLayers.Layer.Text.prototype=Object.extend(new OpenLayers.Layer.Markers(),{location:null,features:null,selectedFeature:null,initialize:function(name,options){OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments);this.features=new Array();if(this.location!=null){OpenLayers.loadURL(this.location,null,this,this.parseData);}},destroy:function(){this.clearFeatures();this.features=null;OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments);},parseData:function(ajaxRequest){var text=ajaxRequest.responseText;var lines=text.split('\n');var columns;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 location=new OpenLayers.LonLat(0,0);var title;var url;var icon,iconSize,iconOffset;var set=false;for(var valIndex=0;valIndex<vals.length;valIndex++){if(vals[valIndex]){if(columns[valIndex]=='point'){var coords=vals[valIndex].split(',');location.lat=parseFloat(coords[0]);location.lon=parseFloat(coords[1]);set=true;}else if(columns[valIndex]=='lat'){location.lat=parseFloat(vals[valIndex]);set=true;}else if(columns[valIndex]=='lon'){location.lon=parseFloat(vals[valIndex]);set=true;}else if(columns[valIndex]=='title')
499 title=vals[valIndex];else if(columns[valIndex]=='image'||columns[valIndex]=='icon')
500 url=vals[valIndex];else if(columns[valIndex]=='iconSize'){var size=vals[valIndex].split(',');iconSize=new OpenLayers.Size(parseFloat(size[0]),parseFloat(size[1]));}else if(columns[valIndex]=='iconOffset'){var offset=vals[valIndex].split(',');iconOffset=new OpenLayers.Pixel(parseFloat(offset[0]),parseFloat(offset[1]));}else if(columns[valIndex]=='title'){title=vals[valIndex];}else if(columns[valIndex]=='description'){description=vals[valIndex];}}}
501 if(set){var data=new Object();if(url!=null){data.icon=new OpenLayers.Icon(url,iconSize,iconOffset);}else{data.icon=OpenLayers.Marker.defaultIcon();if(iconSize!=null){data.icon.setSize(iconSize);}}
502 if((title!=null)&&(description!=null)){data['popupContentHTML']='<h2>'+title+'</h2><p>'+description+'</p>';}
503 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);}}}}},markerClick:function(evt){sameMarkerClicked=(this==this.layer.selectedFeature);this.layer.selectedFeature=(!sameMarkerClicked)?this:null;for(var i=0;i<this.layer.map.popups.length;i++){this.layer.map.removePopup(this.layer.map.popups[i]);}
504 if(!sameMarkerClicked){this.layer.map.addPopup(this.createPopup());}
505 Event.stop(evt);},clearFeatures:function(){if(this.features!=null){while(this.features.length>0){var feature=this.features[0];this.features.remove(feature);feature.destroy();}}},CLASS_NAME:"OpenLayers.Text"});OpenLayers.Layer.VirtualEarth=Class.create();OpenLayers.Layer.VirtualEarth.prototype=Object.extend(new OpenLayers.Layer.EventPane(),Object.extend(new OpenLayers.Layer.FixedZoomLevels(),{vemap:null,minZoomLevel:1,maxZoomLevel:17,initialize:function(name){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);this.numZoomLevels=this.maxZoomLevel-this.minZoomLevel+1;},setMap:function(map){OpenLayers.Layer.EventPane.prototype.setMap.apply(this,arguments);this.loadVEMap();},moveTo:function(bounds,zoomChanged,minor){if(this.vemap!=null){var olCenter=this.map.getCenter();var veCenter=this.getVELatLongFromOLLonLat(olCenter);if(zoomChanged){var olZoom=this.map.getZoom();var veZoom=this.getVEZoomFromOLZoom(olZoom);this.vemap.SetCenterAndZoom(veCenter,veZoom);}else{this.vemap.PanToLatLong(veCenter);}}},loadVEMap:function(){var veDiv=OpenLayers.Util.createDiv(this.name);var sz=this.map.getSize();veDiv.style.width=sz.w;veDiv.style.height=sz.h;this.div.appendChild(veDiv);try{this.vemap=new VEMap(this.name);}catch(e){}
506 if(this.vemap==null){this.loadWarningMessage();}else{try{this.vemap.LoadMap();}catch(e){}
507 this.vemap.HideDashboard();}},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var html="";html+="The VE Layer was unable to load correctly.<br>";html+="<br>";html+="To get rid of this message, click on the VE Layer's "
508 html+="tab in the layer switcher in the upper-right corner.<br>";html+="<br>";html+="Most likely, this is because the VE library";html+=" script was either not correctly included.<br>";html+="<br>";html+="Developers: For help getting this working correctly, ";html+="<a href='http://trac.openlayers.org/wiki/VirtualEarthLayer' "
509 html+="target='_blank'>";html+="click here";html+="</a>";var viewSize=this.map.getSize();msgW=Math.min(viewSize.w,300);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("veWarning",topLeft,size,null,null,null,"auto");div.style.padding="7px";div.style.backgroundColor="yellow";div.innerHTML=html;this.div.appendChild(div);},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if(this.vemap!=null){var pixel=this.getPixelFromOLPixel(viewPortPx);var zoom=this.vemap.GetZoomLevel();var veLatLong=this.vemap.PixelToLatLong(pixel.x,pixel.y,zoom);lonlat=this.getOLLonLatFromVELatLong(veLatLong);}
510 return lonlat;},getViewPortPxFromLonLat:function(lonlat){var viewPortPx=null;if(this.vemap!=null){var veLatLong=this.getVELatLongFromOLLonLat(lonlat);var pixel=this.vemap.LatLongToPixel(veLatLong);viewPortPx=this.getOLPixelFromPixel(pixel);}
511 return viewPortPx;},getZoomForExtent:function(bounds){var zoom=null;if(this.vemap!=null){var maxRes=this.map.getMaxResolution();var viewSize=this.map.getSize();var width=bounds.getWidth();var height=bounds.getHeight();var degPerPixel=(width>height)?width/viewSize.w:height/viewSize.h;var veZoom=Math.floor((Math.log(maxRes/degPerPixel))/Math.log(2));var veZoom=Math.min(Math.max(veZoom,this.minZoomLevel),this.maxZoomLevel);zoom=this.getOLZoomFromVEZoom(veZoom);}
512 return zoom;},getOLZoomFromVEZoom:function(veZoom){var zoom=null;if(veZoom!=null){zoom=veZoom-this.minZoomLevel;}
513 return zoom;},getVEZoomFromOLZoom:function(olZoom){var zoom=null;if(olZoom!=null){zoom=olZoom+this.minZoomLevel;}
514 return zoom;},getOLLonLatFromVELatLong:function(veLatLong){var olLonLat=null;if(veLatLong!=null){olLonLat=new OpenLayers.LonLat(veLatLong.Longitude,veLatLong.Latitude);}
515 return olLonLat;},getVELatLongFromOLLonLat:function(olLonLat){var veLatLong=null;if(olLonLat!=null){veLatLong=new VELatLong(olLonLat.lat,olLonLat.lon);}
516 return veLatLong;},getOLPixelFromPixel:function(pixel){var olPixel=null;if(pixel!=null){olPixel=new OpenLayers.Pixel(pixel.x,pixel.y);}
517 return olPixel;},getPixelFromOLPixel:function(olPixel){var pixel=null;if(olPixel!=null){pixel=new Msn.VE.Pixel(olPixel.x,olPixel.y);}
518 return pixel;},CLASS_NAME:"OpenLayers.Layer.VirtualEarth"}));OpenLayers.Popup.AnchoredBubble=Class.create();OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;OpenLayers.Popup.AnchoredBubble.prototype=Object.extend(new OpenLayers.Popup.Anchored(),{contentDiv:null,initialize:function(id,lonlat,size,contentHTML,anchor){OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);},draw:function(px){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);var contentSize=this.size.clone();contentSize.h-=(2*OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);var id=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(id,null,contentSize,null,"relative",null,"hidden");this.div.appendChild(this.contentDiv);this.setContentHTML();this.setRicoCorners(true);this.setBackgroundColor();this.setOpacity();return this.div;},setSize:function(size){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);if(this.contentDiv!=null){var contentSize=this.size.clone();contentSize.h-=(2*OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);this.contentDiv.style.height=contentSize.h+"px";this.setRicoCorners(false);}},setBackgroundColor:function(color){if(color!=undefined){this.backgroundColor=color;}
519 if(this.div!=null){if(this.contentDiv!=null){this.div.style.background="transparent";Rico.Corner.changeColor(this.contentDiv,this.backgroundColor);}}},setOpacity:function(opacity){if(opacity!=undefined){this.opacity=opacity;}
520 if(this.div!=null){if(this.contentDiv!=null){Rico.Corner.changeOpacity(this.contentDiv,this.opacity);}}},setBorder:function(border){this.border=0;},setContentHTML:function(contentHTML){if(contentHTML!=null){this.contentHTML=contentHTML;}
521 if(this.contentDiv!=null){this.contentDiv.innerHTML=this.contentHTML;}},setRicoCorners:function(firstTime){var corners=this.getCornersToRound(this.relativePosition);var options={corners:corners,color:this.backgroundColor,bgColor:"transparent",blend:false};if(firstTime){Rico.Corner.round(this.div,options);}else{Rico.Corner.reRound(this.contentDiv,options);this.setBackgroundColor();this.setOpacity();}},getCornersToRound:function(){var corners=['tl','tr','bl','br'];var corner=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);corners.remove(corner);return corners.join(" ");},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});OpenLayers.Layer.KaMap=Class.create();OpenLayers.Layer.KaMap.prototype=Object.extend(new 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=new Array();newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);this.params=(params?params:{});if(arguments.length>0&&params){OpenLayers.Util.applyDefaults(this.params,this.DEFAULT_PARAMS);}},getURL:function(bounds){var mapRes=this.map.getResolution();var scale=Math.round((this.map.getScale()*10000))/10000;var cellSize=new OpenLayers.Size(mapRes*this.tileSize.w,mapRes*this.tileSize.h);var pX=Math.round(((bounds.left)/cellSize.w)*this.tileSize.w);var pY=-Math.round(((bounds.top)/cellSize.h)*this.tileSize.h);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);},_initTiles:function(){var viewSize=this.map.getSize();var bounds=this.map.getExtent();var extent=this.map.getMaxExtent();var resolution=this.map.getResolution();var tilelon=resolution*this.tileSize.w;var tilelat=resolution*this.tileSize.h;var offsetlon=bounds.left;var tilecol=Math.floor(offsetlon/tilelon);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);var tilerowremain=tilerow-offsetlat/tilelat;var tileoffsety=-(tilerowremain+1)*this.tileSize.h;var tileoffsetlat=tilerow*tilelat;tileoffsetx=Math.round(tileoffsetx);tileoffsety=Math.round(tileoffsety);this.origin=new OpenLayers.Pixel(tileoffsetx,tileoffsety);var startX=tileoffsetx;var startLon=tileoffsetlon;var rowidx=0;do{var row;row=this.grid[rowidx++];if(!row){row=new Array();this.grid.push(row);}
522 tileoffsetlon=startLon;tileoffsetx=startX;var colidx=0;do{var tileBounds=new OpenLayers.Bounds(tileoffsetlon,tileoffsetlat,tileoffsetlon+tilelon,tileoffsetlat+tilelat);var x=tileoffsetx;x-=parseInt(this.map.layerContainerDiv.style.left);var y=tileoffsety;y-=parseInt(this.map.layerContainerDiv.style.top);var px=new OpenLayers.Pixel(x,y);var tile;tile=row[colidx++];if(!tile){tile=this.addTile(tileBounds,px);row.push(tile);}else{tile.moveTo(tileBounds,px,false);}
523 tileoffsetlon+=tilelon;tileoffsetx+=this.tileSize.w;}while(tileoffsetlon<=bounds.right+tilelon*this.buffer)
524 tileoffsetlat-=tilelat;tileoffsety+=this.tileSize.h;}while(tileoffsetlat>=bounds.bottom-tilelat*this.buffer)
525 this.spiralTileLoad();},CLASS_NAME:"OpenLayers.Layer.KaMap"});OpenLayers.Layer.LikeGoogle=Class.create();OpenLayers.Layer.LikeGoogle.prototype=Object.extend(new OpenLayers.Layer.Grid,{reproject:false,isBaseLayer:true,initialize:function(name,url,options){var newArguments=new Array();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.LikeGoogle(this.name,this.url,this.options);}
526 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();return this.url+z+"/"+x+"/"+y+"."+this.type;},addTile:function(bounds,position){url=this.getURL(bounds);return new OpenLayers.Tile.Image(this,position,bounds,url,this.tileSize);},CLASS_NAME:"OpenLayers.Layer.LikeGoogle"});OpenLayers.Layer.WFS=Class.create();OpenLayers.Layer.WFS.prototype=Object.extend(new OpenLayers.Layer.Grid(),Object.extend(new OpenLayers.Layer.Markers(),{isBaseLayer:false,buffer:1,featureClass:OpenLayers.Feature.WFS,tileClass:OpenLayers.Tile.WFS,DEFAULT_PARAMS:{service:"WFS",version:"1.0.0",request:"GetFeature",typename:"docpoint"},initialize:function(name,url,params,options){var newArguments=new Array();if(arguments.length>0){params=OpenLayers.Util.upperCaseObject(params);newArguments.push(name,url,params,options);}
527 OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);var newArguments=new Array();if(arguments.length>0){newArguments.push(name,options);}
528 OpenLayers.Layer.Markers.prototype.initialize.apply(this,newArguments);if(arguments.length>0){OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments);OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);OpenLayers.Layer.Markers.prototype.setMap.apply(this,arguments);},moveTo:function(bounds,zoomChanged,minor){OpenLayers.Layer.Grid.prototype.moveTo.apply(this,arguments);OpenLayers.Layer.Markers.prototype.moveTo.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.WFS(this.name,this.url,this.params,this.options);}
529 obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},addTile:function(bounds,position){var urls=new Array();urls.push(this.getFullRequestString());if(this.urls!=null){for(var i=0;i<this.urls.length;i++){urls.push(this.getFullRequestString(null,this.urls[i]));}}
530 return new this.tileClass(this,position,bounds,urls,this.tileSize);},mergeNewParams:function(newParams){var upperParams=OpenLayers.Util.upperCaseObject(newParams);var newArguments=[upperParams];OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,newArguments);if(this.grid!=null){this._initTiles();}},getFullRequestString:function(newParams){var projection=this.map.getProjection();this.params.SRS=(projection=="none")?null:projection;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments);},getFeature:function(featureID){var foundFeature=null;if(featureID!=null){if(this.grid){for(var iRow=0;iRow<this.grid.length;iRow++){var row=this.grid[iRow];for(var iCol=0;iCol<row.length;iCol++){var tile=row[iCol];for(var i=0;i<tile.features.length;i++){var feature=tile.features[i];if(feature.id==featureID){foundFeature=feature;}}}}}}
531 return foundFeature;},CLASS_NAME:"OpenLayers.Layer.WFS"}));OpenLayers.Layer.WMS=Class.create();OpenLayers.Layer.WMS.prototype=Object.extend(new OpenLayers.Layer.Grid(),{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",exceptions:"application/vnd.ogc.se_inimage",format:"image/jpeg"},initialize:function(name,url,params,options){var newArguments=new Array();if(arguments.length>0){params=OpenLayers.Util.upperCaseObject(params);newArguments.push(name,url,params,options);}
532 OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);if(arguments.length>0){OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));}
533 if((options==null)||!(options.isBaseLayer)){this.isBaseLayer=((this.params.TRANSPARENT!="true")&&(this.params.TRANSPARENT!=true));}},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.options);}
534 obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){return this.getFullRequestString({BBOX:bounds.toBBOX(),WIDTH:this.tileSize.w,HEIGHT:this.tileSize.h});},addTile:function(bounds,position){url=this.getURL(bounds);return new OpenLayers.Tile.Image(this,position,bounds,url,this.tileSize);},mergeNewParams:function(newParams){var upperParams=OpenLayers.Util.upperCaseObject(newParams);var newArguments=[upperParams];OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,newArguments);if(this.map!=null){this._initTiles();}},getFullRequestString:function(newParams){var projection=this.map.getProjection();this.params.SRS=(projection=="none")?null:projection;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments);},CLASS_NAME:"OpenLayers.Layer.WMS"});OpenLayers.Layer.WorldWind=Class.create();OpenLayers.Layer.WorldWind.prototype=Object.extend(new 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=new Array();newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);this.params=(params?params:{});if(arguments.length>0&&params){OpenLayers.Util.applyDefaults(this.params,this.DEFAULT_PARAMS);}},addTile:function(bounds,position){if(this.map.getResolution()<=(this.lzd/512)&&this.getZoom()<=this.zoomLevels){return new OpenLayers.Tile.Image(this,position,bounds,url,this.tileSize);}else{return new OpenLayers.Tile.Image(this,position,bounds,OpenLayers.Util.getImagesLocation()+"blank.gif",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){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.WMS.Untiled=Class.create();OpenLayers.Layer.WMS.Untiled.prototype=Object.extend(new OpenLayers.Layer.HTTPRequest(),{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",exceptions:"application/vnd.ogc.se_inimage",format:"image/jpeg"},imgDiv:null,initialize:function(name,url,params,options){var newArguments=new Array();if(arguments.length>0){params=OpenLayers.Util.upperCaseObject(params);newArguments.push(name,url,params,options);}
535 OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,newArguments);if(arguments.length>0){OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));}
536 if((options==null)||(options.isBaseLayer==null)){this.isBaseLayer=((this.params.TRANSPARENT!="true")&&(this.params.TRANSPARENT!=true));}},destroy:function(){this.imgDiv=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.WMS.Untiled(this.name,this.url,this.params,this.options);}
537 obj=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[obj]);return obj;},setMap:function(map){OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this,arguments);this.loadImageDiv();},moveTo:function(bounds,zoomChanged,minor){if(!minor){if(bounds==null){bounds=this.map.getExtent();}
538 var size=this.map.getSize().clone();var url=this.getFullRequestString({BBOX:bounds.toBBOX(),WIDTH:size.w,HEIGHT:size.h});var tl=new OpenLayers.Pixel(0,0);var pos=this.map.getLayerPxFromViewPortPx(tl);Element.hide(this.imgDiv);var img=this.imgDiv;if(this.params.TRANSPARENT=='true'){OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,pos,size,url);img=this.imgDiv.childNodes[0];}else{OpenLayers.Util.modifyDOMElement(this.imgDiv,null,pos,size);this.imgDiv.src=url;}
539 Event.observe(img,"load",this.showDiv.bindAsEventListener(this));}},showDiv:function(){Element.show(this.imgDiv);},setUrl:function(newUrl){OpenLayers.Layer.HTTPRequest.prototype.setUrl.apply(this,arguments);this.moveTo();},mergeNewParams:function(newParams){var upperParams=OpenLayers.Util.upperCaseObject(newParams);var newArguments=[upperParams];OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,newArguments);this.moveTo();},getFullRequestString:function(newParams){var projection=this.map.getProjection();this.params.SRS=(projection=="none")?null:projection;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments);},loadImageDiv:function(){var size=this.map.getSize().clone();var bounds=this.map.getExtent();var url="";if(bounds!=null){url=this.getFullRequestString({BBOX:bounds.toBBOX(),WIDTH:size.w,HEIGHT:size.h});}
540 this.div.innerHTML="";var tl=new OpenLayers.Pixel(0,0);var pos=this.map.getLayerPxFromViewPortPx(tl);if(this.params.TRANSPARENT=='true'){this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,pos,size,url,"absolute");}else{this.imgDiv=OpenLayers.Util.createImage(null,pos,size,url,"absolute");}
541 this.div.appendChild(this.imgDiv);},CLASS_NAME:"OpenLayers.Layer.WMS.Untiled"});