
var Fusion={singleFile:true};var Jx={};Object.inheritFrom=function(destination,source,args){var parent;if(typeof source=="function"){parent=source.prototype;}else{parent=source;}
for(property in parent){if(typeof destination[property]=='undefined'){destination[property]=parent[property];}}
if(parent.initialize){parent.initialize.apply(destination,args);}};(function(){var singleFile=(typeof Fusion=="object"&&Fusion.singleFile);window.Fusion={Tool:{},Widget:{},Event:{lastEventId:1},Lib:{},Layers:{},Constant:{},applicationDefinition:null,sConfigFileURL:"",sWebAgentURL:"",sWebTierURL:"",sRedirectScript:"",bForceRedirect:false,sScriptLang:"",locale:'en',Strings:{},fusionURL:null,configuration:null,oBroker:null,aScripts:[],aLoadingScripts:[],loadState:null,UNLOADED:0,LOAD_CONFIG:1,LOAD_WIDGETS:2,LOAD_COMPLETE:3,UNKNOWN:0,INCHES:1,FEET:2,YARDS:3,MILES:4,NAUTICALMILES:5,MILLIMETERS:6,CENTIMETERS:7,METERS:8,KILOMETERS:9,DEGREES:10,DECIMALDEGREES:11,DMS:12,PIXELS:13,aUnitPerMeter:[1.0,39.37,3.2808,1.0936133,0.00062137,0.000539956803,1000.0,100.0,1.0,0.001,0.000009044,0.000009044,0.000009044,1.0],aMeterPerUnit:[1.0,0.0254,0.3048,0.9144,1609.344,1852,0.001,0.01,1.0,1000.0,111061.75033,111061.75033,111061.75033,1.0],aUnitNames:['Unknown','Inches','Feet','Yards','Miles','Nautical Miles','Millimeters','Centimeters','Meters','Kilometers','Degrees','Decimal Degrees','Degrees Minutes Seconds','Pixels'],aUnitAbbr:['unk','in','ft','yd','mi','nm','mm','cm','m','km','&deg;','&deg;','&deg;','px'],initialize:function(options){options=options||{};var sessionIdParam=this.getQueryParam('Session');this.sessionId=sessionIdParam||(options.sessionId||null);if(options.applicationDefinitionURL){this.applicationDefinitionURL=options.applicationDefinitionURL;}else{var queryAppDef=this.getQueryParam('ApplicationDefinition');if(queryAppDef){this.applicationDefinitionURL=queryAppDef.split('+').join(' ');this.appDefJson=null;}else{this.applicationDefinitionURL='ApplicationDefinition.xml';}}
if(Fusion._singleFile){OpenLayers._getScriptLocation=function(){return Fusion.fusionURL+'lib/OpenLayers/';};}
this.initializeLocale();this.sWebagentURL="";this.sScriptLang="";var test=window.location.protocol+'//'+window.location.host;var configUrl='config.json';if(((this.fusionURL.indexOf("http://")<0)||(this.fusionURL.indexOf(test,0)==0))&&!(this.bForceRedirect)){this.sRedirectScript='';}else{this.sRedirectScript='redirect.php';configUrl+='&method=get';}
this.sScriptLang='php';if(Fusion.configuration){this.serverSet();}else{var options={onSuccess:OpenLayers.Function.bind(this.getConfigCB,this),onFailure:OpenLayers.Function.bind(this.serverFailed,this),method:'get'};this.ajaxRequest(configUrl,options);}},initializeLocale:function(locale){OpenLayers.Lang.setCode(locale?locale:window._FusionLocale);this.locale=OpenLayers.Lang.code;if(!OpenLayers.Lang[this.locale]){OpenLayers.Lang[this.locale]=OpenLayers.Lang[OpenLayers.Lang.defaultCode];}
if(!Fusion.Strings[this.locale]){Fusion.Strings[this.locale]=Fusion.Strings[OpenLayers.Lang.defaultCode];}
OpenLayers.Util.extend(OpenLayers.Lang[this.locale],Fusion.Strings[this.locale]);},setLoadState:function(state){this.loadState=state;switch(state){case this.LOAD_CONFIG:this.loadConfig();break;case this.LOAD_WIDGETS:this.loadQueuedScripts();break;case this.LOAD_COMPLETE:if(this.applicationDefinition){this.applicationDefinition.create();this.triggerEvent(Fusion.Event.FUSION_INITIALIZED);}else{Fusion.reportError(new Fusion.Error(Fusion.Error.FATAL,'failed to create AppDef object'));}
break;}},loadQueuedScripts:function(){if(this.aScripts.length==0){this.setLoadState(this.LOAD_COMPLETE);return;}
this.aLoadingScripts=[];for(var i=0;i<this.aScripts.length;i++){this.aLoadingScripts[i]=this.aScripts[i];}
this.aScripts=[];for(var i=0;i<this.aLoadingScripts.length;i++){document.getElementsByTagName('head')[0].appendChild(this.aLoadingScripts[i]);}
this.checkLoadInterval=window.setInterval(OpenLayers.Function.bind(this.checkLoadingScripts,this),500);},queueScript:function(url){if(!document.getElementById(url)&&!this.aScripts[url]){var script=document.createElement('script');script.defer=false;script.type="text/javascript";script.id=url;script.src=this.getFusionURL()+url;script.onload=OpenLayers.Function.bind(this.scriptLoaded,this,url);script.onerror=OpenLayers.Function.bind(this.scriptFailed,this,script.src);this.aScripts[url]=script;this.aScripts.push(script);}},scriptFailed:function(url){Fusion.reportError(new Fusion.Error(Fusion.Error.FATAL,OpenLayers.i18n('scriptFailed',{'script':url})));},scriptLoaded:function(url){for(var i=0;i<this.aLoadingScripts.length;i++){if(this.aLoadingScripts[i].id==url){this.aLoadingScripts.splice(i,1);}}
if(this.aLoadingScripts.length==0){window.clearInterval(this.checkLoadInterval);if(this.aScripts.length>0){this.loadQueuedScripts();}else{this.setLoadState(this.LOAD_COMPLETE);}}},checkLoadingScripts:function(){var agt=navigator.userAgent.toLowerCase();for(var i=this.aLoadingScripts.length-1;i>=0;i--){var s=this.aLoadingScripts[i];if(agt.indexOf('safari')!=-1){var widgetName=s.id.substring(s.id.lastIndexOf('/')+1,s.id.indexOf('.js'));var b;eval('b = typeof Fusion.Widget.'+widgetName+' == "function";');if(b){this.scriptLoaded(s.id);}}else if(s.readyState=='loaded'||s.readyState=='complete'){this.scriptLoaded(s.id);}}},loadConfig:function(){var mapAgentUrl=this.getConfigurationItem('mapguide','mapAgentUrl');if(mapAgentUrl){this.oBroker=new Fusion.Lib.MGBroker();var url=mapAgentUrl;if(this.sRedirectScript){url=this.sRedirectScript+'?s='+url;this.oBroker.method='post';}else{this.oBroker.method='get';}
this.oBroker.setSiteURL(url,"Anonymous","");}
this.applicationDefinition=new Fusion.Lib.ApplicationDefinition(this.sessionId);if(Fusion.appDefJson){Fusion.setLoadState(Fusion.LOAD_WIDGETS);}},getConfigCB:function(r){if(r.responseText){eval("this.configuration="+r.responseText);this.serverSet();}else{alert(OpenLayers.i18n('configParseError'));}},serverSet:function(){var s=this.configuration.mapguide.webTierUrl;if(s){var nLength=s.length;var slastChar=s.charAt((nLength-1));if(slastChar!='/'){s=s+"/";}}else{var idx=this.fusionURL.lastIndexOf('fusion');if(idx==-1){s=this.fusionURL+"../";}else{s=this.fusionURL.substring(0,idx);}}
this.configuration.mapguide.webTierUrl=s;this.configuration.mapguide.mapAgentUrl=s+'mapagent/mapagent.fcgi';this.setLoadState(this.LOAD_CONFIG);},serverFailed:function(r){alert(OpenLayers.i18n('configLoadError'));},ajaxRequest:function(scriptURL,options){var r=this.getRedirectScript();if(r!=''){r=r+'?s=';}
var url=r+this.getFusionURL()+scriptURL;if(!options.onException){options.onException=OpenLayers.Function.bind(this.ajaxException,this);}
if(!options.contentType){options.contentType='application/x-www-form-urlencoded';}
if(options.parameters&&typeof options.parameters=='string'){if(options.parameters.indexOf('?')<0){options.parameters='?'+options.parameters;}}
var temp=new OpenLayers.Ajax.Request(url,options);},ajaxException:function(r,e){this.reportError(new Fusion.Error(Fusion.Error.WARNING,OpenLayers.i18n('ajaxError',{'exception':e.message,'filename':e.fileName,'line':e.lineNumber,'response':r.transport.responseText})));},getXmlAsJson:function(url,callback){var options={method:'get',onSuccess:OpenLayers.Function.bind(this.xml2json,this,callback),onFailure:OpenLayers.Function.bind(this.ajaxException,this)};var temp=new OpenLayers.Ajax.Request(url,options);},xml2json:function(callback,r,json){if(json){var o;eval("o="+r.responseText);callback(o);}else{if(r.status>=400){Fusion.reportError(new Fusion.Error(Fusion.Error.FATAL,'xml2json: invalid XML document: '+r.transport.responseText+" : "+r.request.url));return;}
var options={onSuccess:callback,method:'post',parameters:{'xml':encodeURIComponent(r.responseText)}};var sl=Fusion.getScriptLanguage();Fusion.ajaxRequest('common/'+sl+'/Xml2JSON.'+sl,options);}},getMapByName:function(name){var map=null;if(this.applicationDefinition){map=this.applicationDefinition.getMapByName(name);}
return map;},getMapById:function(id){var map=null;if(this.applicationDefinition){map=this.applicationDefinition.getMapById(id);}
return map;},getMapByIndice:function(indice){var map=null;if(this.applicationDefinition){map=this.applicationDefinition.getMapByIndice(indice);}
return map;},getWidgetById:function(id){var d=$(id);if(d&&d.widget){return d.widget;}else{return null;}},getWidgetsByType:function(type){var widgets=[];if(this.applicationDefinition){widgets=this.applicationDefinition.getWidgetsByType(type);}
return widgets;},getSearchDefinitions:function(){if(this.applicationDefinition){return this.applicationDefinition.searchDefinitions;}else{return{};}},getSearchCategories:function(){if(this.applicationDefinition){return this.applicationDefinition.searchCategories;}else{return{};}},getApplicationDefinitionURL:function(){return this.applicationDefinitionURL;},getApplicationURL:function(){var path=window.location.pathname;var idx=path.lastIndexOf('/');if(idx>=0){path=path.substr(0,idx+1);}
return window.location.protocol+"//"+window.location.host+path;},getFusionURL:function(){return this.fusionURL;},getConfigurationItem:function(arch,key){if(this.configuration[arch]&&(this.configuration[arch][key]!='undefined')){return this.configuration[arch][key];}
return null;},getScriptLanguage:function(){return this.configuration.general.scriptLanguage;},getRedirectScript:function(){return this.sRedirectScript;},getBroker:function(){return this.oBroker;},require:function(url){this.queueScript(url);},reportError:function(o){this.triggerEvent(Fusion.Event.FUSION_ERROR,o);},unitFromName:function(unit){switch(unit.toLowerCase()){case'unknown':return Fusion.UNKNOWN;case'inches':case'inch':case'in':return Fusion.INCHES;case'feet':case'ft':return Fusion.FEET;case'yards':case'yard':case'yd':return Fusion.YARDS;case'miles':case'mile':case'mi':return Fusion.MILES;case'nautical miles':case'nautical mile':case'nm':return Fusion.NAUTICALMILES;case'millimeters':case'millimeter':case'mm':return Fusion.MILLIMETERS;case'centimeters':case'centimeter':case'cm':return Fusion.CENTIMETERS;case'meters':case'meter':case'm':return Fusion.METERS;case'kilometers':case'kilometer':case'km':return Fusion.KILOMETERS;case'degrees':case'degree':case'deg':return Fusion.DEGREES;case'decimal degrees':case'dd':return Fusion.DECIMALDEGREES;case'degrees minutes seconds':case'dms':return Fusion.DMS;case'pixels':case'pixel':case'px':return Fusion.PIXELS;default:return Fusion.UNKNOWN;}},unitSystem:function(unit){switch(unit){case Fusion.INCHES:case Fusion.FEET:case Fusion.YARDS:case Fusion.MILES:case Fusion.NAUTICALMILES:return'imperial';case Fusion.MILLIMETERS:case Fusion.CENTIMETERS:case Fusion.METERS:case Fusion.KILOMETERS:return'metric';case Fusion.DEGREES:case Fusion.DECIMALDEGREES:case Fusion.DMS:return'deg';case Fusion.UNKNOWN:case Fusion.PIXELS:default:return'device';}},unitName:function(unit){if(unit>=Fusion.UNKNOWN&&unit<=Fusion.PIXELS){return(Fusion.aUnitNames[unit]);}
return'Unknown';},unitAbbr:function(unit){if(unit>=Fusion.UNKNOWN&&unit<=Fusion.PIXELS){return(Fusion.aUnitAbbr[unit]);}
return'Unk';},toMeter:function(unit,value){if(unit==Fusion.UNKNOWN){return value;}
if(unit>Fusion.UNKNOWN&&unit<Fusion.PIXELS){return(Fusion.aMeterPerUnit[unit]*value);}
return false;},fromMeter:function(unit,value){if(unit==Fusion.UNKNOWN){return value;}
if(unit>Fusion.UNKNOWN&&unit<Fusion.PIXELS){return(Fusion.aUnitPerMeter[unit]*value);}
return false;},convert:function(unitsIn,unitsOut,value){if(unitsIn>=Fusion.UNKNOWN&&unitsIn<Fusion.PIXELS&&unitsOut>=Fusion.UNKNOWN&&unitsOut<Fusion.PIXELS){return Fusion.fromMeter(unitsOut,Fusion.toMeter(unitsIn,value));}
return false;},initUnits:function(metersPerUnit){var eps=1000;if(Math.abs(metersPerUnit-Fusion.aMeterPerUnit[Fusion.DEGREES])<eps){Fusion.aMeterPerUnit[Fusion.DEGREES]=metersPerUnit;Fusion.aMeterPerUnit[Fusion.DECIMALDEGREES]=metersPerUnit;Fusion.aMeterPerUnit[Fusion.DMX]=metersPerUnit;var inverse=1.0/metersPerUnit;Fusion.aUnitPerMeter[Fusion.DEGREES]=inverse;Fusion.aUnitPerMeter[Fusion.DECIMALDEGREES]=inverse;Fusion.aUnitPerMeter[Fusion.DMX]=inverse;var inPerUnit=OpenLayers.INCHES_PER_UNIT.m*metersPerUnit;OpenLayers.INCHES_PER_UNIT["dd"]=inPerUnit;OpenLayers.INCHES_PER_UNIT["degrees"]=inPerUnit;}},getClosestUnits:function(metersPerUnit){var units="degrees";var minDiff=100000000;for(var key in OpenLayers.INCHES_PER_UNIT){var newDiff=Math.abs((metersPerUnit*39.3701)-OpenLayers.INCHES_PER_UNIT[key]);if(newDiff<minDiff)
{minDiff=newDiff;units=key;}}
return units;},addWidgetStyleSheet:function(url){var lnk=document.createElement('link');var hd=document.getElementsByTagName('HEAD')[0];hd.insertBefore(lnk,Fusion._scriptObject);lnk.type='text/css';lnk.rel='stylesheet';lnk.href=Fusion.getFusionURL()+url;},parseQueryString:function(){this.queryParams=[];var s=window.location.search;if(s!=''){s=s.substring(1);var p=s.split('&');for(var i=0;i<p.length;i++){var q=p[i].split('=');this.queryParams[q[0].toLowerCase()]=decodeURIComponent(q[1]);}}
return this.queryParams;},getQueryParam:function(p){if(!this.queryParams){this.parseQueryString();}
p=p.toLowerCase();if(this.queryParams[p]&&typeof this.queryParams[p]=='string'){return this.queryParams[p];}else{return'';}},_scriptName:"lib/fusionSF",_getScriptLocation:function(){Fusion.fusionURL=null;var scriptName=Fusion._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(scriptName);if(index>-1){Fusion._scriptObject=scripts[i];var img=document.createElement('img');img.src=src.slice(0,index)+'lib/a_pixel.png';var s=img.src;var n=s.lastIndexOf('lib/a_pixel.png');Fusion.fusionURL=s.slice(0,n);Fusion.aPixel=img;break;}}}
if(!this.fusionURL){alert('failed to determine fusionURL using script name '+Fusion._scriptName+'.  Initialization aborted');return;}
return Fusion.fusionURL;}};Fusion._singleFile=singleFile;var host=Fusion._getScriptLocation();Jx.aPixel=Fusion.aPixel;locale=sneMunicipalityConfig.defaultLanguage;var s=window.location.search.toLowerCase();var idx=s.indexOf('locale=');if(idx>0){locale=s.substring(idx+7,idx+9);}
window._FusionLocale=locale;if(!Fusion._singleFile){var coreScripts=['lib/OpenLayers/OpenLayers.js','lib/jxlib.uncompressed.js','lib/proj4js-compressed.js','lib/EventMgr.js','lib/Error.js','lib/ApplicationDefinition.js','lib/MGBroker.js','lib/Widget.js','lib/Map.js','layers/Layers.js','lib/Search.js','text/en/strings.json'];if(locale!='en'){coreScripts.push('lib/OpenLayers/Lang/'+locale+'.js');coreScripts.push('text/'+locale+'/strings.json');}
var agent=navigator.userAgent;var docWrite=(agent.match("MSIE")||agent.match("Safari"));if(docWrite){var allScriptTags=new Array(coreScripts.length);}
for(var i=0;i<coreScripts.length;i++){if(docWrite){allScriptTags[i]="<script src='"+host+coreScripts[i]+"'></script>";}else{var s=document.createElement("script");s.src=host+coreScripts[i];var h=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;h.appendChild(s);}}
if(docWrite){document.write(allScriptTags.join(""));}}
else
{var coreScripts=[];var locales=['en','is','sw','sp','po','ge'];for(var j=0;j<locales.length;j++){coreScripts.push('lib/OpenLayers/Lang/'+locales[j]+'.js');coreScripts.push('text/'+locales[j]+'/strings.json');}
var agent=navigator.userAgent;var docWrite=(agent.match("MSIE")||agent.match("Safari"));if(docWrite){var allScriptTags2=new Array(coreScripts.length);}
for(var i=0;i<coreScripts.length;i++){if(docWrite){allScriptTags2[i]="<script src='"+host+coreScripts[i]+"'></script>";}else{var s=document.createElement("script");s.src=host+coreScripts[i];var h=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;h.appendChild(s);}}
if(docWrite){document.write(allScriptTags2.join(""));}}
var getAgentUrl=function(){var fusionURL=Fusion._getScriptLocation();var testUrl=window.location.protocol+'//'+window.location.host;var configUrl='config.json';if(((Fusion.fusionURL.indexOf("http://")<0)||(Fusion.fusionURL.indexOf(testUrl,0)==0))&&!(Fusion.bForceRedirect)){Fusion.sRedirectScript='';}
else{Fusion.sRedirectScript='redirect.php';configUrl+='&method=get';}
var r=Fusion.getRedirectScript();if(r!=''){r=r+'?s=';}
var fusionURL=r+Fusion.getFusionURL()+configUrl;var xhr=new XMLHttpRequest();xhr.open("GET",fusionURL,false);xhr.send(null);eval("Fusion.configuration="+xhr.responseText);var s=Fusion.configuration.mapguide.webTierUrl;if(s){var nLength=s.length;var slastChar=s.charAt((nLength-1));if(slastChar!='/'){s=s+"/";}}
else{var idx=Fusion.fusionURL.lastIndexOf('fusion');if(idx==-1){s=Fusion.fusionURL+"../";}
else{s=Fusion.fusionURL.substring(0,idx);}}
Fusion.configuration.mapguide.mapAgentUrl=s+'mapagent/mapagent.fcgi';return Fusion.configuration.mapguide.mapAgentUrl;}
var addElement=function(element){if(!element){return;}
var src=element.textContent;if(!src){src=element.text;}
document.writeln('<script src="'+src+'"><\/script>');}
var appDefUrl=Fusion.getQueryParam('ApplicationDefinition');if(appDefUrl){var xhr=new XMLHttpRequest();var mapAgentUrl=getAgentUrl();xhr.open("GET",mapAgentUrl+"?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID="+appDefUrl+"&FORMAT=text%2Fxml",false);xhr.send(null);var appDefXML=xhr.responseXML.documentElement;if(appDefXML){var googleElement=appDefXML.getElementsByTagName("GoogleScript")[0];var yahooElement=appDefXML.getElementsByTagName("YahooScript")[0];var veElement=appDefXML.getElementsByTagName("VirtualEarthScript")[0];addElement(googleElement);addElement(yahooElement);addElement(veElement);}}})();var OpenLayers={singleFile:true};(function(){var singleFile=(typeof OpenLayers=="object"&&OpenLayers.singleFile);window.OpenLayers={_scriptName:(!singleFile)?"lib/OpenLayers.js":"OpenLayers.js",_getScriptLocation:function(){var scriptLocation="";var isOL=new RegExp("(^|(.*?\\/))("+OpenLayers._scriptName+")(\\?|$)");var scripts=document.getElementsByTagName('script');for(var i=0,len=scripts.length;i<len;i++){var src=scripts[i].getAttribute('src');if(src){var match=src.match(isOL);if(match){scriptLocation=match[1];break;}}}
return scriptLocation;}};if(!singleFile){var jsfiles=new Array("OpenLayers/Util.js","OpenLayers/BaseTypes.js","OpenLayers/BaseTypes/Class.js","OpenLayers/BaseTypes/Bounds.js","OpenLayers/BaseTypes/Element.js","OpenLayers/BaseTypes/LonLat.js","OpenLayers/BaseTypes/Pixel.js","OpenLayers/BaseTypes/Size.js","OpenLayers/Console.js","OpenLayers/Tween.js","Rico/Corner.js","Rico/Color.js","OpenLayers/Ajax.js","OpenLayers/Events.js","OpenLayers/Request.js","OpenLayers/Request/XMLHttpRequest.js","OpenLayers/Projection.js","OpenLayers/Map.js","OpenLayers/Layer.js","OpenLayers/Icon.js","OpenLayers/Marker.js","OpenLayers/Marker/Box.js","OpenLayers/Popup.js","OpenLayers/Tile.js","OpenLayers/Tile/Image.js","OpenLayers/Tile/WFS.js","OpenLayers/Layer/Image.js","OpenLayers/Layer/SphericalMercator.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/MapGuide.js","OpenLayers/Layer/MapServer.js","OpenLayers/Layer/MapServer/Untiled.js","OpenLayers/Layer/KaMap.js","OpenLayers/Layer/KaMapCache.js","OpenLayers/Layer/MultiMap.js","OpenLayers/Layer/Markers.js","OpenLayers/Layer/Text.js","OpenLayers/Layer/WorldWind.js","OpenLayers/Layer/ArcGIS93Rest.js","OpenLayers/Layer/WMS.js","OpenLayers/Layer/WMS/Untiled.js","OpenLayers/Layer/ArcIMS.js","OpenLayers/Layer/GeoRSS.js","OpenLayers/Layer/Boxes.js","OpenLayers/Layer/XYZ.js","OpenLayers/Layer/TMS.js","OpenLayers/Layer/TileCache.js","OpenLayers/Popup/Anchored.js","OpenLayers/Popup/AnchoredBubble.js","OpenLayers/Popup/Framed.js","OpenLayers/Popup/FramedCloud.js","OpenLayers/Feature.js","OpenLayers/Feature/Vector.js","OpenLayers/Feature/WFS.js","OpenLayers/Handler.js","OpenLayers/Handler/Click.js","OpenLayers/Handler/Hover.js","OpenLayers/Handler/Point.js","OpenLayers/Handler/Path.js","OpenLayers/Handler/Polygon.js","OpenLayers/Handler/Feature.js","OpenLayers/Handler/Drag.js","OpenLayers/Handler/RegularPolygon.js","OpenLayers/Handler/Box.js","OpenLayers/Handler/MouseWheel.js","OpenLayers/Handler/Keyboard.js","OpenLayers/Control.js","OpenLayers/Control/Attribution.js","OpenLayers/Control/Button.js","OpenLayers/Control/ZoomBox.js","OpenLayers/Control/ZoomToMaxExtent.js","OpenLayers/Control/DragPan.js","OpenLayers/Control/Navigation.js","OpenLayers/Control/MouseDefaults.js","OpenLayers/Control/MousePosition.js","OpenLayers/Control/OverviewMap.js","OpenLayers/Control/KeyboardDefaults.js","OpenLayers/Control/PanZoom.js","OpenLayers/Control/PanZoomBar.js","OpenLayers/Control/ArgParser.js","OpenLayers/Control/Permalink.js","OpenLayers/Control/Scale.js","OpenLayers/Control/ScaleLine.js","OpenLayers/Control/Snapping.js","OpenLayers/Control/Split.js","OpenLayers/Control/LayerSwitcher.js","OpenLayers/Control/DrawFeature.js","OpenLayers/Control/DragFeature.js","OpenLayers/Control/ModifyFeature.js","OpenLayers/Control/Panel.js","OpenLayers/Control/SelectFeature.js","OpenLayers/Control/NavigationHistory.js","OpenLayers/Control/Measure.js","OpenLayers/Control/WMSGetFeatureInfo.js","OpenLayers/Geometry.js","OpenLayers/Geometry/Rectangle.js","OpenLayers/Geometry/Collection.js","OpenLayers/Geometry/Point.js","OpenLayers/Geometry/MultiPoint.js","OpenLayers/Geometry/Curve.js","OpenLayers/Geometry/LineString.js","OpenLayers/Geometry/LinearRing.js","OpenLayers/Geometry/Polygon.js","OpenLayers/Geometry/MultiLineString.js","OpenLayers/Geometry/MultiPolygon.js","OpenLayers/Geometry/Surface.js","OpenLayers/Renderer.js","OpenLayers/Renderer/Elements.js","OpenLayers/Renderer/SVG.js","OpenLayers/Renderer/Canvas.js","OpenLayers/Renderer/VML.js","OpenLayers/Layer/Vector.js","OpenLayers/Layer/Vector/RootContainer.js","OpenLayers/Strategy.js","OpenLayers/Strategy/Fixed.js","OpenLayers/Strategy/Cluster.js","OpenLayers/Strategy/Paging.js","OpenLayers/Strategy/BBOX.js","OpenLayers/Strategy/Save.js","OpenLayers/Protocol.js","OpenLayers/Protocol/HTTP.js","OpenLayers/Protocol/SQL.js","OpenLayers/Protocol/SQL/Gears.js","OpenLayers/Protocol/WFS.js","OpenLayers/Protocol/WFS/v1.js","OpenLayers/Protocol/WFS/v1_0_0.js","OpenLayers/Protocol/WFS/v1_1_0.js","OpenLayers/Layer/PointTrack.js","OpenLayers/Layer/GML.js","OpenLayers/Style.js","OpenLayers/StyleMap.js","OpenLayers/Rule.js","OpenLayers/Filter.js","OpenLayers/Filter/FeatureId.js","OpenLayers/Filter/Logical.js","OpenLayers/Filter/Comparison.js","OpenLayers/Filter/Spatial.js","OpenLayers/Format.js","OpenLayers/Format/XML.js","OpenLayers/Format/ArcXML.js","OpenLayers/Format/ArcXML/Features.js","OpenLayers/Format/GML.js","OpenLayers/Format/GML/Base.js","OpenLayers/Format/GML/v2.js","OpenLayers/Format/GML/v3.js","OpenLayers/Format/KML.js","OpenLayers/Format/GeoRSS.js","OpenLayers/Format/WFS.js","OpenLayers/Format/WFSCapabilities.js","OpenLayers/Format/WFSCapabilities/v1.js","OpenLayers/Format/WFSCapabilities/v1_0_0.js","OpenLayers/Format/WFSCapabilities/v1_1_0.js","OpenLayers/Format/WFSDescribeFeatureType.js","OpenLayers/Format/WMSDescribeLayer.js","OpenLayers/Format/WMSDescribeLayer/v1_1.js","OpenLayers/Format/WKT.js","OpenLayers/Format/OSM.js","OpenLayers/Format/GPX.js","OpenLayers/Format/Filter.js","OpenLayers/Format/Filter/v1.js","OpenLayers/Format/Filter/v1_0_0.js","OpenLayers/Format/Filter/v1_1_0.js","OpenLayers/Format/SLD.js","OpenLayers/Format/SLD/v1.js","OpenLayers/Format/SLD/v1_0_0.js","OpenLayers/Format/SLD/v1.js","OpenLayers/Format/WFST.js","OpenLayers/Format/WFST/v1.js","OpenLayers/Format/WFST/v1_0_0.js","OpenLayers/Format/WFST/v1_1_0.js","OpenLayers/Format/Text.js","OpenLayers/Format/JSON.js","OpenLayers/Format/GeoJSON.js","OpenLayers/Format/WMC.js","OpenLayers/Format/WMC/v1.js","OpenLayers/Format/WMC/v1_0_0.js","OpenLayers/Format/WMC/v1_1_0.js","OpenLayers/Format/WMSCapabilities.js","OpenLayers/Format/WMSCapabilities/v1_1.js","OpenLayers/Format/WMSCapabilities/v1_1_0.js","OpenLayers/Format/WMSCapabilities/v1_1_1.js","OpenLayers/Format/WMSGetFeatureInfo.js","OpenLayers/Layer/WFS.js","OpenLayers/Control/GetFeature.js","OpenLayers/Control/MouseToolbar.js","OpenLayers/Control/NavToolbar.js","OpenLayers/Control/PanPanel.js","OpenLayers/Control/Pan.js","OpenLayers/Control/ZoomIn.js","OpenLayers/Control/ZoomOut.js","OpenLayers/Control/ZoomPanel.js","OpenLayers/Control/EditingToolbar.js","OpenLayers/Lang.js","OpenLayers/Lang/en.js");var agent=navigator.userAgent;var docWrite=(agent.match("MSIE")||agent.match("Safari"));if(docWrite){var allScriptTags=new Array(jsfiles.length);}
var host=OpenLayers._getScriptLocation()+"lib/";for(var i=0,len=jsfiles.length;i<len;i++){if(docWrite){allScriptTags[i]="<script src='"+host+jsfiles[i]+"'></script>";}else{var s=document.createElement("script");s.src=host+jsfiles[i];var h=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;h.appendChild(s);}}
if(docWrite){document.write(allScriptTags.join(""));}}})();OpenLayers.VERSION_NUMBER="OpenLayers 2.8 -- $Revision: 1885 $";OpenLayers.Util={};OpenLayers.Util.getElement=function(){var elements=[];for(var i=0,len=arguments.length;i<len;i++){var element=arguments[i];if(typeof element=='string'){element=document.getElementById(element);}
if(arguments.length==1){return element;}
elements.push(element);}
return elements;};if(typeof window.$==="undefined"){window.$=OpenLayers.Util.getElement;}
OpenLayers.Util.extend=function(destination,source){destination=destination||{};if(source){for(var property in source){var value=source[property];if(value!==undefined){destination[property]=value;}}
var sourceIsEvt=typeof window.Event=="function"&&source instanceof window.Event;if(!sourceIsEvt&&source.hasOwnProperty&&source.hasOwnProperty('toString')){destination.toString=source.toString;}}
return destination;};OpenLayers.Util.removeItem=function(array,item){for(var i=array.length-1;i>=0;i--){if(array[i]==item){array.splice(i,1);}}
return array;};OpenLayers.Util.clearArray=function(array){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'array = []'}));array.length=0;};OpenLayers.Util.indexOf=function(array,obj){for(var i=0,len=array.length;i<len;i++){if(array[i]==obj){return i;}}
return-1;};OpenLayers.Util.modifyDOMElement=function(element,id,px,sz,position,border,overflow,opacity){if(id){element.id=id;}
if(px){element.style.left=px.x+"px";element.style.top=px.y+"px";}
if(sz){element.style.width=sz.w+"px";element.style.height=sz.h+"px";}
if(position){element.style.position=position;}
if(border){element.style.border=border;}
if(overflow){element.style.overflow=overflow;}
if(parseFloat(opacity)>=0.0&&parseFloat(opacity)<1.0){element.style.filter='alpha(opacity='+(opacity*100)+')';element.style.opacity=opacity;}else if(parseFloat(opacity)==1.0){element.style.filter='';element.style.opacity='';}};OpenLayers.Util.createDiv=function(id,px,sz,imgURL,position,border,overflow,opacity){var dom=document.createElement('div');if(imgURL){dom.style.backgroundImage='url('+imgURL+')';}
if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv");}
if(!position){position="absolute";}
OpenLayers.Util.modifyDOMElement(dom,id,px,sz,position,border,overflow,opacity);return dom;};OpenLayers.Util.createImage=function(id,px,sz,imgURL,position,border,opacity,delayDisplay){var image=document.createElement("img");if(!id){id=OpenLayers.Util.createUniqueID("OpenLayersDiv");}
if(!position){position="relative";}
OpenLayers.Util.modifyDOMElement(image,id,px,sz,position,border,null,opacity);if(delayDisplay){image.style.display="none";OpenLayers.Event.observe(image,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,image));OpenLayers.Event.observe(image,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,image));}
image.style.alt=id;image.galleryImg="no";if(imgURL){image.src=imgURL;}
return image;};OpenLayers.Util.setOpacity=function(element,opacity){OpenLayers.Util.modifyDOMElement(element,null,null,null,null,null,null,opacity);};OpenLayers.Util.onImageLoad=function(){if(!this.viewRequestID||(this.map&&this.viewRequestID==this.map.viewRequestID)){this.style.backgroundColor="transparent";this.style.display="";}};OpenLayers.Util.onImageLoadErrorColor="pink";OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;OpenLayers.Util.onImageLoadError=function(){this._attempts=(this._attempts)?(this._attempts+1):1;if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){var urls=this.urls;if(urls&&urls instanceof Array&&urls.length>1){var src=this.src.toString();var current_url,k;for(k=0;current_url=urls[k];k++){if(src.indexOf(current_url)!=-1){break;}}
var guess=Math.floor(urls.length*Math.random());var new_url=urls[guess];k=0;while(new_url==current_url&&k++<4){guess=Math.floor(urls.length*Math.random());new_url=urls[guess];}
this.src=src.replace(current_url,new_url);}else{this.src=this.src;}}else{this.style.backgroundColor=OpenLayers.Util.onImageLoadErrorColor;}
this.style.display="";};OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);var filter=false;try{filter=!!(document.body.filters);}catch(e){}
OpenLayers.Util.alphaHackNeeded=(filter&&(version>=5.5)&&(version<7));}
return OpenLayers.Util.alphaHackNeeded;};OpenLayers.Util.modifyAlphaImageDiv=function(div,id,px,sz,imgURL,position,border,sizing,opacity){OpenLayers.Util.modifyDOMElement(div,id,px,sz,position,null,null,opacity);var img=div.childNodes[0];if(imgURL){img.src=imgURL;}
OpenLayers.Util.modifyDOMElement(img,div.id+"_innerImage",null,sz,"relative",border);if(OpenLayers.Util.alphaHack()){if(div.style.display!="none"){div.style.display="inline-block";}
if(sizing==null){sizing="scale";}
div.style.filter="progid:DXImageTransform.Microsoft"+".AlphaImageLoader(src='"+img.src+"', "+"sizingMethod='"+sizing+"')";if(parseFloat(div.style.opacity)>=0.0&&parseFloat(div.style.opacity)<1.0){div.style.filter+=" alpha(opacity="+div.style.opacity*100+")";}
img.style.filter="alpha(opacity=0)";}};OpenLayers.Util.createAlphaImageDiv=function(id,px,sz,imgURL,position,border,sizing,opacity,delayDisplay){var div=OpenLayers.Util.createDiv();var img=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);div.appendChild(img);if(delayDisplay){img.style.display="none";OpenLayers.Event.observe(img,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,div));OpenLayers.Event.observe(img,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,div));}
OpenLayers.Util.modifyAlphaImageDiv(div,id,px,sz,imgURL,position,border,sizing,opacity);return div;};OpenLayers.Util.upperCaseObject=function(object){var uObject={};for(var key in object){uObject[key.toUpperCase()]=object[key];}
return uObject;};OpenLayers.Util.applyDefaults=function(to,from){to=to||{};var fromIsEvt=typeof window.Event=="function"&&from instanceof window.Event;for(var key in from){if(to[key]===undefined||(!fromIsEvt&&from.hasOwnProperty&&from.hasOwnProperty(key)&&!to.hasOwnProperty(key))){to[key]=from[key];}}
if(!fromIsEvt&&from&&from.hasOwnProperty&&from.hasOwnProperty('toString')&&!to.hasOwnProperty('toString')){to.toString=from.toString;}
return to;};OpenLayers.Util.getParameterString=function(params){var paramsArray=[];for(var key in params){var value=params[key];if((value!=null)&&(typeof value!='function')){var encodedValue;if(typeof value=='object'&&value.constructor==Array){var encodedItemArray=[];for(var itemIndex=0,len=value.length;itemIndex<len;itemIndex++){encodedItemArray.push(encodeURIComponent(value[itemIndex]));}
encodedValue=encodedItemArray.join(",");}
else{encodedValue=encodeURIComponent(value);}
paramsArray.push(encodeURIComponent(key)+"="+encodedValue);}}
return paramsArray.join("&");};OpenLayers.ImgPath='';OpenLayers.Util.getImagesLocation=function(){return OpenLayers.ImgPath||(OpenLayers._getScriptLocation()+"img/");};OpenLayers.Util.Try=function(){var returnValue=null;for(var i=0,len=arguments.length;i<len;i++){var lambda=arguments[i];try{returnValue=lambda();break;}catch(e){}}
return returnValue;};OpenLayers.Util.getNodes=function(p,tagName){var nodes=OpenLayers.Util.Try(function(){return OpenLayers.Util._getNodes(p.documentElement.childNodes,tagName);},function(){return OpenLayers.Util._getNodes(p.childNodes,tagName);});return nodes;};OpenLayers.Util._getNodes=function(nodes,tagName){var retArray=[];for(var i=0,len=nodes.length;i<len;i++){if(nodes[i].nodeName==tagName){retArray.push(nodes[i]);}}
return retArray;};OpenLayers.Util.getTagText=function(parent,item,index){var result=OpenLayers.Util.getNodes(parent,item);if(result&&(result.length>0))
{if(!index){index=0;}
if(result[index].childNodes.length>1){return result.childNodes[1].nodeValue;}
else if(result[index].childNodes.length==1){return result[index].firstChild.nodeValue;}}else{return"";}};OpenLayers.Util.getXmlNodeValue=function(node){var val=null;OpenLayers.Util.Try(function(){val=node.text;if(!val){val=node.textContent;}
if(!val){val=node.firstChild.nodeValue;}},function(){val=node.textContent;});return val;};OpenLayers.Util.mouseLeft=function(evt,div){var target=(evt.relatedTarget)?evt.relatedTarget:evt.toElement;while(target!=div&&target!=null){target=target.parentNode;}
return(target!=div);};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(number,precision){if(precision==null){precision=OpenLayers.Util.DEFAULT_PRECISION;}
var number;if(precision==0){number=parseFloat(number);}else{number=parseFloat(parseFloat(number).toPrecision(precision));}
return number;};OpenLayers.Util.rad=function(x){return x*Math.PI/180;};OpenLayers.Util.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)+
(cosU1*sinU2-sinU1*cosU2*cosLambda)*(cosU1*sinU2-sinU1*cosU2*cosLambda));if(sinSigma==0){return 0;}
var cosSigma=sinU1*sinU2+cosU1*cosU2*cosLambda;var sigma=Math.atan2(sinSigma,cosSigma);var alpha=Math.asin(cosU1*cosU2*sinLambda/sinSigma);var cosSqAlpha=Math.cos(alpha)*Math.cos(alpha);var cos2SigmaM=cosSigma-2*sinU1*sinU2/cosSqAlpha;var C=f/16*cosSqAlpha*(4+f*(4-3*cosSqAlpha));lambdaP=lambda;lambda=L+(1-C)*f*Math.sin(alpha)*(sigma+C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)));}
if(iterLimit==0){return NaN;}
var uSq=cosSqAlpha*(a*a-b*b)/(b*b);var A=1+uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq)));var B=uSq/1024*(256+uSq*(-128+uSq*(74-47*uSq)));var deltaSigma=B*sinSigma*(cos2SigmaM+B/4*(cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)-
B/6*cos2SigmaM*(-3+4*sinSigma*sinSigma)*(-3+4*cos2SigmaM*cos2SigmaM)));var s=b*A*(sigma-deltaSigma);var d=s.toFixed(3)/1000;return d;};OpenLayers.Util.getParameters=function(url){url=url||window.location.href;var paramsString="";if(OpenLayers.String.contains(url,'?')){var start=url.indexOf('?')+1;var end=OpenLayers.String.contains(url,"#")?url.indexOf('#'):url.length;paramsString=url.substring(start,end);}
var parameters={};var pairs=paramsString.split(/[&;]/);for(var i=0,len=pairs.length;i<len;++i){var keyValue=pairs[i].split('=');if(keyValue[0]){var key=decodeURIComponent(keyValue[0]);var value=keyValue[1]||'';value=value.split(",");for(var j=0,jlen=value.length;j<jlen;j++){value[j]=decodeURIComponent(value[j]);}
if(value.length==1){value=value[0];}
parameters[key]=value;}}
return parameters;};OpenLayers.Util.getArgs=function(url){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.Util.getParameters'}));return OpenLayers.Util.getParameters(url);};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(prefix){if(prefix==null){prefix="id_";}
OpenLayers.Util.lastSeqID+=1;return prefix+OpenLayers.Util.lastSeqID;};OpenLayers.INCHES_PER_UNIT={'inches':1.0,'ft':12.0,'mi':63360.0,'m':39.3701,'km':39370.1,'dd':4374754,'yd':36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT["degrees"]=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT["nmi"]=1852*OpenLayers.INCHES_PER_UNIT.m;OpenLayers.METERS_PER_INCH=0.02540005080010160020;OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{"Inch":OpenLayers.INCHES_PER_UNIT.inches,"Meter":1.0/OpenLayers.METERS_PER_INCH,"Foot":0.30480060960121920243/OpenLayers.METERS_PER_INCH,"IFoot":0.30480000000000000000/OpenLayers.METERS_PER_INCH,"ClarkeFoot":0.3047972651151/OpenLayers.METERS_PER_INCH,"SearsFoot":0.30479947153867624624/OpenLayers.METERS_PER_INCH,"GoldCoastFoot":0.30479971018150881758/OpenLayers.METERS_PER_INCH,"IInch":0.02540000000000000000/OpenLayers.METERS_PER_INCH,"MicroInch":0.00002540000000000000/OpenLayers.METERS_PER_INCH,"Mil":0.00000002540000000000/OpenLayers.METERS_PER_INCH,"Centimeter":0.01000000000000000000/OpenLayers.METERS_PER_INCH,"Kilometer":1000.00000000000000000000/OpenLayers.METERS_PER_INCH,"Yard":0.91440182880365760731/OpenLayers.METERS_PER_INCH,"SearsYard":0.914398414616029/OpenLayers.METERS_PER_INCH,"IndianYard":0.91439853074444079983/OpenLayers.METERS_PER_INCH,"IndianYd37":0.91439523/OpenLayers.METERS_PER_INCH,"IndianYd62":0.9143988/OpenLayers.METERS_PER_INCH,"IndianYd75":0.9143985/OpenLayers.METERS_PER_INCH,"IndianFoot":0.30479951/OpenLayers.METERS_PER_INCH,"IndianFt37":0.30479841/OpenLayers.METERS_PER_INCH,"IndianFt62":0.3047996/OpenLayers.METERS_PER_INCH,"IndianFt75":0.3047995/OpenLayers.METERS_PER_INCH,"Mile":1609.34721869443738887477/OpenLayers.METERS_PER_INCH,"IYard":0.91440000000000000000/OpenLayers.METERS_PER_INCH,"IMile":1609.34400000000000000000/OpenLayers.METERS_PER_INCH,"NautM":1852.00000000000000000000/OpenLayers.METERS_PER_INCH,"Lat-66":110943.316488932731/OpenLayers.METERS_PER_INCH,"Lat-83":110946.25736872234125/OpenLayers.METERS_PER_INCH,"Decimeter":0.10000000000000000000/OpenLayers.METERS_PER_INCH,"Millimeter":0.00100000000000000000/OpenLayers.METERS_PER_INCH,"Dekameter":10.00000000000000000000/OpenLayers.METERS_PER_INCH,"Decameter":10.00000000000000000000/OpenLayers.METERS_PER_INCH,"Hectometer":100.00000000000000000000/OpenLayers.METERS_PER_INCH,"GermanMeter":1.0000135965/OpenLayers.METERS_PER_INCH,"CaGrid":0.999738/OpenLayers.METERS_PER_INCH,"ClarkeChain":20.1166194976/OpenLayers.METERS_PER_INCH,"GunterChain":20.11684023368047/OpenLayers.METERS_PER_INCH,"BenoitChain":20.116782494375872/OpenLayers.METERS_PER_INCH,"SearsChain":20.11676512155/OpenLayers.METERS_PER_INCH,"ClarkeLink":0.201166194976/OpenLayers.METERS_PER_INCH,"GunterLink":0.2011684023368047/OpenLayers.METERS_PER_INCH,"BenoitLink":0.20116782494375872/OpenLayers.METERS_PER_INCH,"SearsLink":0.2011676512155/OpenLayers.METERS_PER_INCH,"Rod":5.02921005842012/OpenLayers.METERS_PER_INCH,"IntnlChain":20.1168/OpenLayers.METERS_PER_INCH,"IntnlLink":0.201168/OpenLayers.METERS_PER_INCH,"Perch":5.02921005842012/OpenLayers.METERS_PER_INCH,"Pole":5.02921005842012/OpenLayers.METERS_PER_INCH,"Furlong":201.1684023368046/OpenLayers.METERS_PER_INCH,"Rood":3.778266898/OpenLayers.METERS_PER_INCH,"CapeFoot":0.3047972615/OpenLayers.METERS_PER_INCH,"Brealey":375.00000000000000000000/OpenLayers.METERS_PER_INCH,"ModAmFt":0.304812252984505969011938/OpenLayers.METERS_PER_INCH,"Fathom":1.8288/OpenLayers.METERS_PER_INCH,"NautM-UK":1853.184/OpenLayers.METERS_PER_INCH,"50kilometers":50000.0/OpenLayers.METERS_PER_INCH,"150kilometers":150000.0/OpenLayers.METERS_PER_INCH});OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{"mm":OpenLayers.INCHES_PER_UNIT["Meter"]/1000.0,"cm":OpenLayers.INCHES_PER_UNIT["Meter"]/100.0,"dm":OpenLayers.INCHES_PER_UNIT["Meter"]*100.0,"km":OpenLayers.INCHES_PER_UNIT["Meter"]*1000.0,"kmi":OpenLayers.INCHES_PER_UNIT["nmi"],"fath":OpenLayers.INCHES_PER_UNIT["Fathom"],"ch":OpenLayers.INCHES_PER_UNIT["IntnlChain"],"link":OpenLayers.INCHES_PER_UNIT["IntnlLink"],"us-in":OpenLayers.INCHES_PER_UNIT["inches"],"us-ft":OpenLayers.INCHES_PER_UNIT["Foot"],"us-yd":OpenLayers.INCHES_PER_UNIT["Yard"],"us-ch":OpenLayers.INCHES_PER_UNIT["GunterChain"],"us-mi":OpenLayers.INCHES_PER_UNIT["Mile"],"ind-yd":OpenLayers.INCHES_PER_UNIT["IndianYd37"],"ind-ft":OpenLayers.INCHES_PER_UNIT["IndianFt37"],"ind-ch":20.11669506/OpenLayers.METERS_PER_INCH});OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(scale){var normScale=(scale>1.0)?(1.0/scale):scale;return normScale;};OpenLayers.Util.getResolutionFromScale=function(scale,units){if(units==null){units="degrees";}
var normScale=OpenLayers.Util.normalizeScale(scale);var resolution=1/(normScale*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH);return resolution;};OpenLayers.Util.getScaleFromResolution=function(resolution,units){if(units==null){units="degrees";}
var scale=resolution*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH;return scale;};OpenLayers.Util.safeStopPropagation=function(evt){OpenLayers.Event.stop(evt,true);};OpenLayers.Util.pagePosition=function(forElement){var valueT=0,valueL=0;var element=forElement;var child=forElement;while(element){if(element==document.body){if(OpenLayers.Element.getStyle(child,'position')=='absolute'){break;}}
valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;child=element;try{element=element.offsetParent;}catch(e){OpenLayers.Console.error(OpenLayers.i18n("pagePositionFailed",{'elemId':element.id}));break;}}
element=forElement;while(element){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;element=element.parentNode;}
return[valueL,valueT];};OpenLayers.Util.isEquivalentUrl=function(url1,url2,options){options=options||{};OpenLayers.Util.applyDefaults(options,{ignoreCase:true,ignorePort80:true,ignoreHash:true});var urlObj1=OpenLayers.Util.createUrlObject(url1,options);var urlObj2=OpenLayers.Util.createUrlObject(url2,options);for(var key in urlObj1){if(key!=="args"){if(urlObj1[key]!=urlObj2[key]){return false;}}}
for(var key in urlObj1.args){if(urlObj1.args[key]!=urlObj2.args[key]){return false;}
delete urlObj2.args[key];}
for(var key in urlObj2.args){return false;}
return true;};OpenLayers.Util.createUrlObject=function(url,options){options=options||{};if(!(/^\w+:\/\//).test(url)){var loc=window.location;var port=loc.port?":"+loc.port:"";var fullUrl=loc.protocol+"//"+loc.host.split(":").shift()+port;if(url.indexOf("/")===0){url=fullUrl+url;}else{var parts=loc.pathname.split("/");parts.pop();url=fullUrl+parts.join("/")+"/"+url;}}
if(options.ignoreCase){url=url.toLowerCase();}
var a=document.createElement('a');a.href=url;var urlObject={};urlObject.host=a.host.split(":").shift();urlObject.protocol=a.protocol;if(options.ignorePort80){urlObject.port=(a.port=="80"||a.port=="0")?"":a.port;}else{urlObject.port=(a.port==""||a.port=="0")?"80":a.port;}
urlObject.hash=(options.ignoreHash||a.hash==="#")?"":a.hash;var queryString=a.search;if(!queryString){var qMark=url.indexOf("?");queryString=(qMark!=-1)?url.substr(qMark):"";}
urlObject.args=OpenLayers.Util.getParameters(queryString);urlObject.pathname=(a.pathname.charAt(0)=="/")?a.pathname:"/"+a.pathname;return urlObject;};OpenLayers.Util.removeTail=function(url){var head=null;var qMark=url.indexOf("?");var hashMark=url.indexOf("#");if(qMark==-1){head=(hashMark!=-1)?url.substr(0,hashMark):url;}else{head=(hashMark!=-1)?url.substr(0,Math.min(qMark,hashMark)):url.substr(0,qMark);}
return head;};OpenLayers.Util.getBrowserName=function(){var browserName="";var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("opera")!=-1){browserName="opera";}else if(ua.indexOf("msie")!=-1){browserName="msie";}else if(ua.indexOf("safari")!=-1){browserName="safari";}else if(ua.indexOf("mozilla")!=-1){if(ua.indexOf("firefox")!=-1){browserName="firefox";}else{browserName="mozilla";}}
return browserName;};OpenLayers.Util.getRenderedDimensions=function(contentHTML,size,options){var w,h;var container=document.createElement("div");container.style.visibility="hidden";var containerElement=(options&&options.containerElement)?options.containerElement:document.body;if(size){if(size.w){w=size.w;container.style.width=w+"px";}else if(size.h){h=size.h;container.style.height=h+"px";}}
if(options&&options.displayClass){container.className=options.displayClass;}
var content=document.createElement("div");content.innerHTML=contentHTML;content.style.overflow="visible";if(content.childNodes){for(var i=0,l=content.childNodes.length;i<l;i++){if(!content.childNodes[i].style)continue;content.childNodes[i].style.overflow="visible";}}
container.appendChild(content);containerElement.appendChild(container);var parentHasPositionAbsolute=false;var parent=container.parentNode;while(parent&&parent.tagName.toLowerCase()!="body"){var parentPosition=OpenLayers.Element.getStyle(parent,"position");if(parentPosition=="absolute"){parentHasPositionAbsolute=true;break;}else if(parentPosition&&parentPosition!="static"){break;}
parent=parent.parentNode;}
if(!parentHasPositionAbsolute){container.style.position="absolute";}
if(!w){w=parseInt(content.scrollWidth);container.style.width=w+"px";}
if(!h){h=parseInt(content.scrollHeight);}
container.removeChild(content);containerElement.removeChild(container);return new OpenLayers.Size(w,h);};OpenLayers.Util.getScrollbarWidth=function(){var scrollbarWidth=OpenLayers.Util._scrollbarWidth;if(scrollbarWidth==null){var scr=null;var inn=null;var wNoScroll=0;var wScroll=0;scr=document.createElement('div');scr.style.position='absolute';scr.style.top='-1000px';scr.style.left='-1000px';scr.style.width='100px';scr.style.height='50px';scr.style.overflow='hidden';inn=document.createElement('div');inn.style.width='100%';inn.style.height='200px';scr.appendChild(inn);document.body.appendChild(scr);wNoScroll=inn.offsetWidth;scr.style.overflow='scroll';wScroll=inn.offsetWidth;document.body.removeChild(document.body.lastChild);OpenLayers.Util._scrollbarWidth=(wNoScroll-wScroll);scrollbarWidth=OpenLayers.Util._scrollbarWidth;}
return scrollbarWidth;};OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(error){alert(error);},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"};(function(){var scripts=document.getElementsByTagName("script");for(var i=0,len=scripts.length;i<len;++i){if(scripts[i].src.indexOf("firebug.js")!=-1){if(console){OpenLayers.Util.extend(OpenLayers.Console,console);break;}}}})();OpenLayers.String={startsWith:function(str,sub){return(str.indexOf(sub)==0);},contains:function(str,sub){return(str.indexOf(sub)!=-1);},trim:function(str){return str.replace(/^\s\s*/,'').replace(/\s\s*$/,'');},camelize:function(str){var oStringList=str.split('-');var camelizedString=oStringList[0];for(var i=1,len=oStringList.length;i<len;i++){var s=oStringList[i];camelizedString+=s.charAt(0).toUpperCase()+s.substring(1);}
return camelizedString;},format:function(template,context,args){if(!context){context=window;}
var replacer=function(str,match){var replacement;var subs=match.split(/\.+/);for(var i=0;i<subs.length;i++){if(i==0){replacement=context;}
replacement=replacement[subs[i]];}
if(typeof replacement=="function"){replacement=args?replacement.apply(null,args):replacement();}
if(typeof replacement=='undefined'){return'undefined';}else{return replacement;}};return template.replace(OpenLayers.String.tokenRegEx,replacer);},tokenRegEx:/\$\{([\w.]+?)\}/g,numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(value){return OpenLayers.String.numberRegEx.test(value);},numericIf:function(value){return OpenLayers.String.isNumeric(value)?parseFloat(value):value;}};if(!String.prototype.startsWith){String.prototype.startsWith=function(sStart){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.String.startsWith'}));return OpenLayers.String.startsWith(this,sStart);};}
if(!String.prototype.contains){String.prototype.contains=function(str){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.String.contains'}));return OpenLayers.String.contains(this,str);};}
if(!String.prototype.trim){String.prototype.trim=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.String.trim'}));return OpenLayers.String.trim(this);};}
if(!String.prototype.camelize){String.prototype.camelize=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.String.camelize'}));return OpenLayers.String.camelize(this);};}
OpenLayers.Number={decimalSeparator:".",thousandsSeparator:",",limitSigDigs:function(num,sig){var fig=0;if(sig>0){fig=parseFloat(num.toPrecision(sig));}
return fig;},format:function(num,dec,tsep,dsep){dec=(typeof dec!="undefined")?dec:0;tsep=(typeof tsep!="undefined")?tsep:OpenLayers.Number.thousandsSeparator;dsep=(typeof dsep!="undefined")?dsep:OpenLayers.Number.decimalSeparator;if(dec!=null){num=parseFloat(num.toFixed(dec));}
var parts=num.toString().split(".");if(parts.length==1&&dec==null){dec=0;}
var integer=parts[0];if(tsep){var thousands=/(-?[0-9]+)([0-9]{3})/;while(thousands.test(integer)){integer=integer.replace(thousands,"$1"+tsep+"$2");}}
var str;if(dec==0){str=integer;}else{var rem=parts.length>1?parts[1]:"0";if(dec!=null){rem=rem+new Array(dec-rem.length+1).join("0");}
str=integer+dsep+rem;}
return str;}};if(!Number.prototype.limitSigDigs){Number.prototype.limitSigDigs=function(sig){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.Number.limitSigDigs'}));return OpenLayers.Number.limitSigDigs(this,sig);};}
OpenLayers.Function={bind:function(func,object){var args=Array.prototype.slice.apply(arguments,[2]);return function(){var newArgs=args.concat(Array.prototype.slice.apply(arguments,[0]));return func.apply(object,newArgs);};},bindAsEventListener:function(func,object){return function(event){return func.call(object,event||window.event);};}};if(!Function.prototype.bind){Function.prototype.bind=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.Function.bind'}));Array.prototype.unshift.apply(arguments,[this]);return OpenLayers.Function.bind.apply(null,arguments);};}
if(!Function.prototype.bindAsEventListener){Function.prototype.bindAsEventListener=function(object){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.Function.bindAsEventListener'}));return OpenLayers.Function.bindAsEventListener(this,object);};}
OpenLayers.Array={filter:function(array,callback,caller){var selected=[];if(Array.prototype.filter){selected=array.filter(callback,caller);}else{var len=array.length;if(typeof callback!="function"){throw new TypeError();}
for(var i=0;i<len;i++){if(i in array){var val=array[i];if(callback.call(caller,val,i,array)){selected.push(val);}}}}
return selected;}};OpenLayers.Class=function(){var Class=function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments);}};var extended={};var parent,initialize;for(var i=0,len=arguments.length;i<len;++i){if(typeof arguments[i]=="function"){if(i==0&&len>1){initialize=arguments[i].prototype.initialize;arguments[i].prototype.initialize=function(){};extended=new arguments[i];if(initialize===undefined){delete arguments[i].prototype.initialize;}else{arguments[i].prototype.initialize=initialize;}}
parent=arguments[i].prototype;}else{parent=arguments[i];}
OpenLayers.Util.extend(extended,parent);}
Class.prototype=extended;return Class;};OpenLayers.Class.isPrototype=function(){};OpenLayers.Class.create=function(){return function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments);}};};OpenLayers.Class.inherit=function(){var superClass=arguments[0];var proto=new superClass(OpenLayers.Class.isPrototype);for(var i=1,len=arguments.length;i<len;i++){if(typeof arguments[i]=="function"){var mixin=arguments[i];arguments[i]=new mixin(OpenLayers.Class.isPrototype);}
OpenLayers.Util.extend(proto,arguments[i]);}
return proto;};OpenLayers.Size=OpenLayers.Class({w:0.0,h:0.0,initialize:function(w,h){this.w=parseFloat(w);this.h=parseFloat(h);},toString:function(){return("w="+this.w+",h="+this.h);},clone:function(){return new OpenLayers.Size(this.w,this.h);},equals:function(sz){var equals=false;if(sz!=null){equals=((this.w==sz.w&&this.h==sz.h)||(isNaN(this.w)&&isNaN(this.h)&&isNaN(sz.w)&&isNaN(sz.h)));}
return equals;},CLASS_NAME:"OpenLayers.Size"});OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(left,bottom,right,top){if(left!=null){this.left=OpenLayers.Util.toFloat(left);}
if(bottom!=null){this.bottom=OpenLayers.Util.toFloat(bottom);}
if(right!=null){this.right=OpenLayers.Util.toFloat(right);}
if(top!=null){this.top=OpenLayers.Util.toFloat(top);}},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top);},equals:function(bounds){var equals=false;if(bounds!=null){equals=((this.left==bounds.left)&&(this.right==bounds.right)&&(this.top==bounds.top)&&(this.bottom==bounds.bottom));}
return equals;},toString:function(){return("left-bottom=("+this.left+","+this.bottom+")"
+" right-top=("+this.right+","+this.top+")");},toArray:function(){return[this.left,this.bottom,this.right,this.top];},toBBOX:function(decimal){if(decimal==null){decimal=6;}
var mult=Math.pow(10,decimal);var bbox=Math.round(this.left*mult)/mult+","+
Math.round(this.bottom*mult)/mult+","+
Math.round(this.right*mult)/mult+","+
Math.round(this.top*mult)/mult;return bbox;},toGeometry:function(){return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(this.left,this.bottom),new OpenLayers.Geometry.Point(this.right,this.bottom),new OpenLayers.Geometry.Point(this.right,this.top),new OpenLayers.Geometry.Point(this.left,this.top)])]);},getWidth:function(){return(this.right-this.left);},getHeight:function(){return(this.top-this.bottom);},getSize:function(){return new OpenLayers.Size(this.getWidth(),this.getHeight());},getCenterPixel:function(){return new OpenLayers.Pixel((this.left+this.right)/2,(this.bottom+this.top)/2);},getCenterLonLat:function(){if(!this.centerLonLat){this.centerLonLat=new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2);}
return this.centerLonLat;},scale:function(ratio,origin){if(origin==null){origin=this.getCenterLonLat();}
var bounds=[];var origx,origy;if(origin.CLASS_NAME=="OpenLayers.LonLat"){origx=origin.lon;origy=origin.lat;}else{origx=origin.x;origy=origin.y;}
var left=(this.left-origx)*ratio+origx;var bottom=(this.bottom-origy)*ratio+origy;var right=(this.right-origx)*ratio+origx;var top=(this.top-origy)*ratio+origy;return new OpenLayers.Bounds(left,bottom,right,top);},add:function(x,y){if((x==null)||(y==null)){var msg=OpenLayers.i18n("boundsAddError");OpenLayers.Console.error(msg);return null;}
return new OpenLayers.Bounds(this.left+x,this.bottom+y,this.right+x,this.top+y);},extend:function(object){var bounds=null;if(object){switch(object.CLASS_NAME){case"OpenLayers.LonLat":bounds=new OpenLayers.Bounds(object.lon,object.lat,object.lon,object.lat);break;case"OpenLayers.Geometry.Point":bounds=new OpenLayers.Bounds(object.x,object.y,object.x,object.y);break;case"OpenLayers.Bounds":bounds=object;break;}
if(bounds){this.centerLonLat=null;if((this.left==null)||(bounds.left<this.left)){this.left=bounds.left;}
if((this.bottom==null)||(bounds.bottom<this.bottom)){this.bottom=bounds.bottom;}
if((this.right==null)||(bounds.right>this.right)){this.right=bounds.right;}
if((this.top==null)||(bounds.top>this.top)){this.top=bounds.top;}}}},containsLonLat:function(ll,inclusive){return this.contains(ll.lon,ll.lat,inclusive);},containsPixel:function(px,inclusive){return this.contains(px.x,px.y,inclusive);},contains:function(x,y,inclusive){if(inclusive==null){inclusive=true;}
if(x==null||y==null){return false;}
x=OpenLayers.Util.toFloat(x);y=OpenLayers.Util.toFloat(y);var contains=false;if(inclusive){contains=((x>=this.left)&&(x<=this.right)&&(y>=this.bottom)&&(y<=this.top));}else{contains=((x>this.left)&&(x<this.right)&&(y>this.bottom)&&(y<this.top));}
return contains;},intersectsBounds:function(bounds,inclusive){if(inclusive==null){inclusive=true;}
var intersects=false;var mightTouch=(this.left==bounds.right||this.right==bounds.left||this.top==bounds.bottom||this.bottom==bounds.top);if(inclusive||!mightTouch){var inBottom=(((bounds.bottom>=this.bottom)&&(bounds.bottom<=this.top))||((this.bottom>=bounds.bottom)&&(this.bottom<=bounds.top)));var inTop=(((bounds.top>=this.bottom)&&(bounds.top<=this.top))||((this.top>bounds.bottom)&&(this.top<bounds.top)));var inLeft=(((bounds.left>=this.left)&&(bounds.left<=this.right))||((this.left>=bounds.left)&&(this.left<=bounds.right)));var inRight=(((bounds.right>=this.left)&&(bounds.right<=this.right))||((this.right>=bounds.left)&&(this.right<=bounds.right)));intersects=((inBottom||inTop)&&(inLeft||inRight));}
return intersects;},containsBounds:function(bounds,partial,inclusive){if(partial==null){partial=false;}
if(inclusive==null){inclusive=true;}
var bottomLeft=this.contains(bounds.left,bounds.bottom,inclusive);var bottomRight=this.contains(bounds.right,bounds.bottom,inclusive);var topLeft=this.contains(bounds.left,bounds.top,inclusive);var topRight=this.contains(bounds.right,bounds.top,inclusive);return(partial)?(bottomLeft||bottomRight||topLeft||topRight):(bottomLeft&&bottomRight&&topLeft&&topRight);},determineQuadrant:function(lonlat){var quadrant="";var center=this.getCenterLonLat();quadrant+=(lonlat.lat<center.lat)?"b":"t";quadrant+=(lonlat.lon<center.lon)?"l":"r";return quadrant;},transform:function(source,dest){this.centerLonLat=null;var ll=OpenLayers.Projection.transform({'x':this.left,'y':this.bottom},source,dest);var lr=OpenLayers.Projection.transform({'x':this.right,'y':this.bottom},source,dest);var ul=OpenLayers.Projection.transform({'x':this.left,'y':this.top},source,dest);var ur=OpenLayers.Projection.transform({'x':this.right,'y':this.top},source,dest);this.left=Math.min(ll.x,ul.x);this.bottom=Math.min(ll.y,lr.y);this.right=Math.max(lr.x,ur.x);this.top=Math.max(ul.y,ur.y);return this;},wrapDateLine:function(maxExtent,options){options=options||{};var leftTolerance=options.leftTolerance||0;var rightTolerance=options.rightTolerance||0;var newBounds=this.clone();if(maxExtent){while(newBounds.left<maxExtent.left&&(newBounds.right-rightTolerance)<=maxExtent.left){newBounds=newBounds.add(maxExtent.getWidth(),0);}
while((newBounds.left+leftTolerance)>=maxExtent.right&&newBounds.right>maxExtent.right){newBounds=newBounds.add(-maxExtent.getWidth(),0);}}
return newBounds;},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(str){var bounds=str.split(",");return OpenLayers.Bounds.fromArray(bounds);};OpenLayers.Bounds.fromArray=function(bbox){return new OpenLayers.Bounds(parseFloat(bbox[0]),parseFloat(bbox[1]),parseFloat(bbox[2]),parseFloat(bbox[3]));};OpenLayers.Bounds.fromSize=function(size){return new OpenLayers.Bounds(0,size.h,size.w,0);};OpenLayers.Bounds.oppositeQuadrant=function(quadrant){var opp="";opp+=(quadrant.charAt(0)=='t')?'b':'t';opp+=(quadrant.charAt(1)=='l')?'r':'l';return opp;};OpenLayers.Element={visible:function(element){return OpenLayers.Util.getElement(element).style.display!='none';},toggle:function(){for(var i=0,len=arguments.length;i<len;i++){var element=OpenLayers.Util.getElement(arguments[i]);var display=OpenLayers.Element.visible(element)?'hide':'show';OpenLayers.Element[display](element);}},hide:function(){for(var i=0,len=arguments.length;i<len;i++){var element=OpenLayers.Util.getElement(arguments[i]);element.style.display='none';}},show:function(){for(var i=0,len=arguments.length;i<len;i++){var element=OpenLayers.Util.getElement(arguments[i]);element.style.display='';}},remove:function(element){element=OpenLayers.Util.getElement(element);element.parentNode.removeChild(element);},getHeight:function(element){element=OpenLayers.Util.getElement(element);return element.offsetHeight;},getDimensions:function(element){element=OpenLayers.Util.getElement(element);if(OpenLayers.Element.getStyle(element,'display')!='none'){return{width:element.offsetWidth,height:element.offsetHeight};}
var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;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};},hasClass:function(element,name){var names=element.className;return(!!names&&new RegExp("(^|\\s)"+name+"(\\s|$)").test(names));},addClass:function(element,name){if(!OpenLayers.Element.hasClass(element,name)){element.className+=(element.className?" ":"")+name;}
return element;},removeClass:function(element,name){var names=element.className;if(names){element.className=OpenLayers.String.trim(names.replace(new RegExp("(^|\\s+)"+name+"(\\s+|$)")," "));}
return element;},toggleClass:function(element,name){if(OpenLayers.Element.hasClass(element,name)){OpenLayers.Element.removeClass(element,name);}else{OpenLayers.Element.addClass(element,name);}
return element;},getStyle:function(element,style){element=OpenLayers.Util.getElement(element);var value=null;if(element&&element.style){value=element.style[OpenLayers.String.camelize(style)];if(!value){if(document.defaultView&&document.defaultView.getComputedStyle){var css=document.defaultView.getComputedStyle(element,null);value=css?css.getPropertyValue(style):null;}else if(element.currentStyle){value=element.currentStyle[OpenLayers.String.camelize(style)];}}
var positions=['left','top','right','bottom'];if(window.opera&&(OpenLayers.Util.indexOf(positions,style)!=-1)&&(OpenLayers.Element.getStyle(element,'position')=='static')){value='auto';}}
return value=='auto'?null:value;}};OpenLayers.LonLat=OpenLayers.Class({lon:0.0,lat:0.0,initialize:function(lon,lat){this.lon=OpenLayers.Util.toFloat(lon);this.lat=OpenLayers.Util.toFloat(lat);},toString:function(){return("lon="+this.lon+",lat="+this.lat);},toShortString:function(){return(this.lon+", "+this.lat);},clone:function(){return new OpenLayers.LonLat(this.lon,this.lat);},add:function(lon,lat){if((lon==null)||(lat==null)){var msg=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(msg);return null;}
return new OpenLayers.LonLat(this.lon+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)));}
return equals;},transform:function(source,dest){var point=OpenLayers.Projection.transform({'x':this.lon,'y':this.lat},source,dest);this.lon=point.x;this.lat=point.y;return this;},wrapDateLine:function(maxExtent){var newLonLat=this.clone();if(maxExtent){while(newLonLat.lon<maxExtent.left){newLonLat.lon+=maxExtent.getWidth();}
while(newLonLat.lon>maxExtent.right){newLonLat.lon-=maxExtent.getWidth();}}
return newLonLat;},CLASS_NAME:"OpenLayers.LonLat"});OpenLayers.LonLat.fromString=function(str){var pair=str.split(",");return new OpenLayers.LonLat(parseFloat(pair[0]),parseFloat(pair[1]));};OpenLayers.Pixel=OpenLayers.Class({x:0.0,y:0.0,initialize:function(x,y){this.x=parseFloat(x);this.y=parseFloat(y);},toString:function(){return("x="+this.x+",y="+this.y);},clone:function(){return new OpenLayers.Pixel(this.x,this.y);},equals:function(px){var equals=false;if(px!=null){equals=((this.x==px.x&&this.y==px.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(px.x)&&isNaN(px.y)));}
return equals;},add:function(x,y){if((x==null)||(y==null)){var msg=OpenLayers.i18n("pixelAddError");OpenLayers.Console.error(msg);return null;}
return new OpenLayers.Pixel(this.x+x,this.y+y);},offset:function(px){var newPx=this.clone();if(px){newPx=this.add(px.x,px.y);}
return newPx;},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Icon=OpenLayers.Class({url:null,size:null,offset:null,calculateOffset:null,imageDiv:null,px:null,initialize:function(url,size,offset,calculateOffset){this.url=url;this.size=(size)?size:new OpenLayers.Size(20,20);this.offset=offset?offset:new OpenLayers.Pixel(-(this.size.w/2),-(this.size.h/2));this.calculateOffset=calculateOffset;var id=OpenLayers.Util.createUniqueID("OL_Icon_");this.imageDiv=OpenLayers.Util.createAlphaImageDiv(id);},destroy:function(){this.erase();OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);this.imageDiv.innerHTML="";this.imageDiv=null;},clone:function(){return new OpenLayers.Icon(this.url,this.size,this.offset,this.calculateOffset);},setSize:function(size){if(size!=null){this.size=size;}
this.draw();},setUrl:function(url){if(url!=null){this.url=url;}
this.draw();},draw:function(px){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,this.size,this.url,"absolute");this.moveTo(px);return this.imageDiv;},erase:function(){if(this.imageDiv!=null&&this.imageDiv.parentNode!=null){OpenLayers.Element.remove(this.imageDiv);}},setOpacity:function(opacity){OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,null,null,null,null,null,null,opacity);},moveTo:function(px){if(px!=null){this.px=px;}
if(this.imageDiv!=null){if(this.px==null){this.display(false);}else{if(this.calculateOffset){this.offset=this.calculateOffset(this.size);}
var offsetPx=this.px.offset(this.offset);OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,null,offsetPx);}}},display:function(display){this.imageDiv.style.display=(display)?"":"none";},isDrawn:function(){var isDrawn=(this.imageDiv&&this.imageDiv.parentNode&&(this.imageDiv.parentNode.nodeType!=11));return isDrawn;},CLASS_NAME:"OpenLayers.Icon"});OpenLayers.Popup=OpenLayers.Class({events:null,id:"",lonlat:null,div:null,contentSize:null,size:null,contentHTML:null,backgroundColor:"",opacity:"",border:"",contentDiv:null,groupDiv:null,closeDiv:null,autoSize:false,minSize:null,maxSize:null,displayClass:"olPopup",contentDisplayClass:"olPopupContent",padding:0,disableFirefoxOverflowHack:false,fixPadding:function(){if(typeof this.padding=="number"){this.padding=new OpenLayers.Bounds(this.padding,this.padding,this.padding,this.padding);}},panMapIfOutOfView:false,keepInMap:false,closeOnMove:false,map:null,initialize:function(id,lonlat,contentSize,contentHTML,closeBox,closeBoxCallback){if(id==null){id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");}
this.id=id;this.lonlat=lonlat;this.contentSize=(contentSize!=null)?contentSize:new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT);if(contentHTML!=null){this.contentHTML=contentHTML;}
this.backgroundColor=OpenLayers.Popup.COLOR;this.opacity=OpenLayers.Popup.OPACITY;this.border=OpenLayers.Popup.BORDER;this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"hidden");this.div.className=this.displayClass;var groupDivId=this.id+"_GroupDiv";this.groupDiv=OpenLayers.Util.createDiv(groupDivId,null,null,null,"relative",null,"hidden");var id=this.div.id+"_contentDiv";this.contentDiv=OpenLayers.Util.createDiv(id,null,this.contentSize.clone(),null,"relative");this.contentDiv.className=this.contentDisplayClass;this.groupDiv.appendChild(this.contentDiv);this.div.appendChild(this.groupDiv);if(closeBox){this.addCloseBox(closeBoxCallback);}
this.registerEvents();},destroy:function(){this.id=null;this.lonlat=null;this.size=null;this.contentHTML=null;this.backgroundColor=null;this.opacity=null;this.border=null;if(this.closeOnMove&&this.map){this.map.events.unregister("movestart",this,this.hide);}
this.events.destroy();this.events=null;if(this.closeDiv){OpenLayers.Event.stopObservingElement(this.closeDiv);this.groupDiv.removeChild(this.closeDiv);}
this.closeDiv=null;this.div.removeChild(this.groupDiv);this.groupDiv=null;if(this.map!=null){this.map.removePopup(this);}
this.map=null;this.div=null;this.autoSize=null;this.minSize=null;this.maxSize=null;this.padding=null;this.panMapIfOutOfView=null;},draw:function(px){if(px==null){if((this.lonlat!=null)&&(this.map!=null)){px=this.map.getLayerPxFromLonLat(this.lonlat);}}
if(this.closeOnMove){this.map.events.register("movestart",this,this.hide);}
if(!this.disableFirefoxOverflowHack&&OpenLayers.Util.getBrowserName()=='firefox'){this.map.events.register("movestart",this,function(){var style=document.defaultView.getComputedStyle(this.contentDiv,null);var currentOverflow=style.getPropertyValue("overflow");if(currentOverflow!="hidden"){this.contentDiv._oldOverflow=currentOverflow;this.contentDiv.style.overflow="hidden";}});this.map.events.register("moveend",this,function(){var oldOverflow=this.contentDiv._oldOverflow;if(oldOverflow){this.contentDiv.style.overflow=oldOverflow;this.contentDiv._oldOverflow=null;}});}
this.moveTo(px);if(!this.autoSize&&!this.size){this.setSize(this.contentSize);}
this.setBackgroundColor();this.setOpacity();this.setBorder();this.setContentHTML();if(this.panMapIfOutOfView){this.panIntoView();}
return this.div;},updatePosition:function(){if((this.lonlat)&&(this.map)){var px=this.map.getLayerPxFromLonLat(this.lonlat);if(px){this.moveTo(px);}}},moveTo:function(px){if((px!=null)&&(this.div!=null)){this.div.style.left=px.x+"px";this.div.style.top=px.y+"px";}},visible:function(){return OpenLayers.Element.visible(this.div);},toggle:function(){if(this.visible()){this.hide();}else{this.show();}},show:function(){OpenLayers.Element.show(this.div);if(this.panMapIfOutOfView){this.panIntoView();}},hide:function(){OpenLayers.Element.hide(this.div);},setSize:function(contentSize){this.size=contentSize.clone();var contentDivPadding=this.getContentDivPadding();var wPadding=contentDivPadding.left+contentDivPadding.right;var hPadding=contentDivPadding.top+contentDivPadding.bottom;this.fixPadding();wPadding+=this.padding.left+this.padding.right;hPadding+=this.padding.top+this.padding.bottom;if(this.closeDiv){var closeDivWidth=parseInt(this.closeDiv.style.width);wPadding+=closeDivWidth+contentDivPadding.right;}
this.size.w+=wPadding;this.size.h+=hPadding;if(OpenLayers.Util.getBrowserName()=="msie"){this.contentSize.w+=contentDivPadding.left+contentDivPadding.right;this.contentSize.h+=contentDivPadding.bottom+contentDivPadding.top;}
if(this.div!=null){this.div.style.width=this.size.w+"px";this.div.style.height=this.size.h+"px";}
if(this.contentDiv!=null){this.contentDiv.style.width=contentSize.w+"px";this.contentDiv.style.height=contentSize.h+"px";}},updateSize:function(){var preparedHTML="<div class='"+this.contentDisplayClass+"'>"+
this.contentDiv.innerHTML+"</div>";var containerElement=(this.map)?this.map.layerContainerDiv:document.body;var realSize=OpenLayers.Util.getRenderedDimensions(preparedHTML,null,{displayClass:this.displayClass,containerElement:containerElement});var safeSize=this.getSafeContentSize(realSize);var newSize=null;if(safeSize.equals(realSize)){newSize=realSize;}else{var fixedSize=new OpenLayers.Size();fixedSize.w=(safeSize.w<realSize.w)?safeSize.w:null;fixedSize.h=(safeSize.h<realSize.h)?safeSize.h:null;if(fixedSize.w&&fixedSize.h){newSize=safeSize;}else{var clippedSize=OpenLayers.Util.getRenderedDimensions(preparedHTML,fixedSize,{displayClass:this.contentDisplayClass,containerElement:containerElement});var currentOverflow=OpenLayers.Element.getStyle(this.contentDiv,"overflow");if((currentOverflow!="hidden")&&(clippedSize.equals(safeSize))){var scrollBar=OpenLayers.Util.getScrollbarWidth();if(fixedSize.w){clippedSize.h+=scrollBar;}else{clippedSize.w+=scrollBar;}}
newSize=this.getSafeContentSize(clippedSize);}}
this.setSize(newSize);},setBackgroundColor:function(color){if(color!=undefined){this.backgroundColor=color;}
if(this.div!=null){this.div.style.backgroundColor=this.backgroundColor;}},setOpacity:function(opacity){if(opacity!=undefined){this.opacity=opacity;}
if(this.div!=null){this.div.style.opacity=this.opacity;this.div.style.filter='alpha(opacity='+this.opacity*100+')';}},setBorder:function(border){if(border!=undefined){this.border=border;}
if(this.div!=null){this.div.style.border=this.border;}},setContentHTML:function(contentHTML){if(contentHTML!=null){this.contentHTML=contentHTML;}
if((this.contentDiv!=null)&&(this.contentHTML!=null)&&(this.contentHTML!=this.contentDiv.innerHTML)){this.contentDiv.innerHTML=this.contentHTML;if(this.autoSize){this.registerImageListeners();this.updateSize();}}},registerImageListeners:function(){var onImgLoad=function(){this.popup.updateSize();if(this.popup.visible()&&this.popup.panMapIfOutOfView){this.popup.panIntoView();}
OpenLayers.Event.stopObserving(this.img,"load",this.img._onImageLoad);};var images=this.contentDiv.getElementsByTagName("img");for(var i=0,len=images.length;i<len;i++){var img=images[i];if(img.width==0||img.height==0){var context={'popup':this,'img':img};img._onImgLoad=OpenLayers.Function.bind(onImgLoad,context);OpenLayers.Event.observe(img,'load',img._onImgLoad);}}},getSafeContentSize:function(size){var safeContentSize=size.clone();var contentDivPadding=this.getContentDivPadding();var wPadding=contentDivPadding.left+contentDivPadding.right;var hPadding=contentDivPadding.top+contentDivPadding.bottom;this.fixPadding();wPadding+=this.padding.left+this.padding.right;hPadding+=this.padding.top+this.padding.bottom;if(this.closeDiv){var closeDivWidth=parseInt(this.closeDiv.style.width);wPadding+=closeDivWidth+contentDivPadding.right;}
if(this.minSize){safeContentSize.w=Math.max(safeContentSize.w,(this.minSize.w-wPadding));safeContentSize.h=Math.max(safeContentSize.h,(this.minSize.h-hPadding));}
if(this.maxSize){safeContentSize.w=Math.min(safeContentSize.w,(this.maxSize.w-wPadding));safeContentSize.h=Math.min(safeContentSize.h,(this.maxSize.h-hPadding));}
if(this.map&&this.map.size){var extraX=0,extraY=0;if(this.keepInMap&&!this.panMapIfOutOfView){var px=this.map.getPixelFromLonLat(this.lonlat);switch(this.relativePosition){case"tr":extraX=px.x;extraY=this.map.size.h-px.y;break;case"tl":extraX=this.map.size.w-px.x;extraY=this.map.size.h-px.y;break;case"bl":extraX=this.map.size.w-px.x;extraY=px.y;break;case"br":extraX=px.x;extraY=px.y;break;default:extraX=px.x;extraY=this.map.size.h-px.y;break;}}
var maxY=this.map.size.h-
this.map.paddingForPopups.top-
this.map.paddingForPopups.bottom-
hPadding-extraY;var maxX=this.map.size.w-
this.map.paddingForPopups.left-
this.map.paddingForPopups.right-
wPadding-extraX;safeContentSize.w=Math.min(safeContentSize.w,maxX);safeContentSize.h=Math.min(safeContentSize.h,maxY);}
return safeContentSize;},getContentDivPadding:function(){var contentDivPadding=this._contentDivPadding;if(!contentDivPadding){if(this.div.parentNode==null){this.div.style.display="none";document.body.appendChild(this.div);}
contentDivPadding=new OpenLayers.Bounds(OpenLayers.Element.getStyle(this.contentDiv,"padding-left"),OpenLayers.Element.getStyle(this.contentDiv,"padding-bottom"),OpenLayers.Element.getStyle(this.contentDiv,"padding-right"),OpenLayers.Element.getStyle(this.contentDiv,"padding-top"));this._contentDivPadding=contentDivPadding;if(this.div.parentNode==document.body){document.body.removeChild(this.div);this.div.style.display="";}}
return contentDivPadding;},addCloseBox:function(callback){this.closeDiv=OpenLayers.Util.createDiv(this.id+"_close",null,new OpenLayers.Size(17,17));this.closeDiv.className="olPopupCloseBox";var contentDivPadding=this.getContentDivPadding();this.closeDiv.style.right=contentDivPadding.right+"px";this.closeDiv.style.top=contentDivPadding.top+"px";this.groupDiv.appendChild(this.closeDiv);var closePopup=callback||function(e){this.hide();OpenLayers.Event.stop(e);};OpenLayers.Event.observe(this.closeDiv,"click",OpenLayers.Function.bindAsEventListener(closePopup,this));},panIntoView:function(){var mapSize=this.map.getSize();var origTL=this.map.getViewPortPxFromLayerPx(new OpenLayers.Pixel(parseInt(this.div.style.left),parseInt(this.div.style.top)));var newTL=origTL.clone();if(origTL.x<this.map.paddingForPopups.left){newTL.x=this.map.paddingForPopups.left;}else
if((origTL.x+this.size.w)>(mapSize.w-this.map.paddingForPopups.right)){newTL.x=mapSize.w-this.map.paddingForPopups.right-this.size.w;}
if(origTL.y<this.map.paddingForPopups.top){newTL.y=this.map.paddingForPopups.top;}else
if((origTL.y+this.size.h)>(mapSize.h-this.map.paddingForPopups.bottom)){newTL.y=mapSize.h-this.map.paddingForPopups.bottom-this.size.h;}
var dx=origTL.x-newTL.x;var dy=origTL.y-newTL.y;this.map.pan(dx,dy);},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,true);this.events.on({"mousedown":this.onmousedown,"mousemove":this.onmousemove,"mouseup":this.onmouseup,"click":this.onclick,"mouseout":this.onmouseout,"dblclick":this.ondblclick,scope:this});},onmousedown:function(evt){this.mousedown=true;OpenLayers.Event.stop(evt,true);},onmousemove:function(evt){if(this.mousedown){OpenLayers.Event.stop(evt,true);}},onmouseup:function(evt){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(evt,true);}},onclick:function(evt){OpenLayers.Event.stop(evt,true);},onmouseout:function(evt){this.mousedown=false;},ondblclick:function(evt){OpenLayers.Event.stop(evt,true);},CLASS_NAME:"OpenLayers.Popup"});OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;OpenLayers.Popup.COLOR="white";OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";OpenLayers.Protocol=OpenLayers.Class({format:null,options:null,autoDestroy:true,initialize:function(options){options=options||{};OpenLayers.Util.extend(this,options);this.options=options;},destroy:function(){this.options=null;this.format=null;},read:function(){},create:function(){},update:function(){},"delete":function(){},commit:function(){},abort:function(response){},CLASS_NAME:"OpenLayers.Protocol"});OpenLayers.Protocol.Response=OpenLayers.Class({code:null,requestType:null,last:true,features:null,reqFeatures:null,priv:null,initialize:function(options){OpenLayers.Util.extend(this,options);},success:function(){return this.code>0;},CLASS_NAME:"OpenLayers.Protocol.Response"});OpenLayers.Protocol.Response.SUCCESS=1;OpenLayers.Protocol.Response.FAILURE=0;OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:false,size:null,resolution:null,map:null,initialize:function(containerID,options){this.container=OpenLayers.Util.getElement(containerID);},destroy:function(){this.container=null;this.extent=null;this.size=null;this.resolution=null;this.map=null;},supported:function(){return false;},setExtent:function(extent,resolutionChanged){this.extent=extent.clone();if(resolutionChanged){this.resolution=null;}},setSize:function(size){this.size=size.clone();this.resolution=null;},getResolution:function(){this.resolution=this.resolution||this.map.getResolution();return this.resolution;},drawFeature:function(feature,style){if(style==null){style=feature.style;}
if(feature.geometry){var bounds=feature.geometry.getBounds();if(bounds){if(!bounds.intersectsBounds(this.extent)){style={display:"none"};}
var rendered=this.drawGeometry(feature.geometry,style,feature.id);if(style.display!="none"&&style.label&&rendered!==false){this.drawText(feature.id,style,feature.geometry.getCentroid());}else{this.removeText(feature.id);}
return rendered;}}},drawGeometry:function(geometry,style,featureId){},drawText:function(featureId,style,location){},removeText:function(featureId){},clear:function(){},getFeatureIdFromEvent:function(evt){},eraseFeatures:function(features){if(!(features instanceof Array)){features=[features];}
for(var i=0,len=features.length;i<len;++i){this.eraseGeometry(features[i].geometry);this.removeText(features[i].id);}},eraseGeometry:function(geometry){},moveRoot:function(renderer){},getRenderLayerId:function(){return this.container.id;},CLASS_NAME:"OpenLayers.Renderer"});OpenLayers.Strategy=OpenLayers.Class({layer:null,options:null,active:null,autoActivate:true,autoDestroy:true,initialize:function(options){OpenLayers.Util.extend(this,options);this.options=options;this.active=false;},destroy:function(){this.deactivate();this.layer=null;this.options=null;},setLayer:function(layer){this.layer=layer;},activate:function(){if(!this.active){this.active=true;return true;}
return false;},deactivate:function(){if(this.active){this.active=false;return true;}
return false;},CLASS_NAME:"OpenLayers.Strategy"});OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:false,displayClass:"",title:"",active:null,handler:null,eventListeners:null,events:null,EVENT_TYPES:["activate","deactivate"],initialize:function(options){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,options);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners);}
if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");}},destroy:function(){if(this.events){if(this.eventListeners){this.events.un(this.eventListeners);}
this.events.destroy();this.events=null;}
this.eventListeners=null;if(this.handler){this.handler.destroy();this.handler=null;}
if(this.handlers){for(var key in this.handlers){if(this.handlers.hasOwnProperty(key)&&typeof this.handlers[key].destroy=="function"){this.handlers[key].destroy();}}
this.handlers=null;}
if(this.map){this.map.removeControl(this);this.map=null;}},setMap:function(map){this.map=map;if(this.handler){this.handler.setMap(map);}},draw:function(px){if(this.div==null){this.div=OpenLayers.Util.createDiv(this.id);this.div.className=this.displayClass;if(!this.allowSelection){this.div.className+=" olControlNoSelect";this.div.setAttribute("unselectable","on",0);this.div.onselectstart=function(){return(false);};}
if(this.title!=""){this.div.title=this.title;}}
if(px!=null){this.position=px.clone();}
this.moveTo(this.position);return this.div;},moveTo:function(px){if((px!=null)&&(this.div!=null)){this.div.style.left=px.x+"px";this.div.style.top=px.y+"px";}},activate:function(){if(this.active){return false;}
if(this.handler){this.handler.activate();}
this.active=true;if(this.map){OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");}
this.events.triggerEvent("activate");return true;},deactivate:function(){if(this.active){if(this.handler){this.handler.deactivate();}
this.active=false;if(this.map){OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active");}
this.events.triggerEvent("deactivate");return true;}
return false;},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){if(!OpenLayers.Lang.code){OpenLayers.Lang.setCode();}
return OpenLayers.Lang.code;},setCode:function(code){var lang;if(!code){code=(OpenLayers.Util.getBrowserName()=="msie")?navigator.userLanguage:navigator.language;}
var parts=code.split('-');parts[0]=parts[0].toLowerCase();if(typeof OpenLayers.Lang[parts[0]]=="object"){lang=parts[0];}
if(parts[1]){var testLang=parts[0]+'-'+parts[1].toUpperCase();if(typeof OpenLayers.Lang[testLang]=="object"){lang=testLang;}}
if(!lang){OpenLayers.Console.warn('Failed to find OpenLayers.Lang.'+parts.join("-")+' dictionary, falling back to default language');lang=OpenLayers.Lang.defaultCode;}
OpenLayers.Lang.code=lang;},translate:function(key,context){var dictionary=OpenLayers.Lang[OpenLayers.Lang.getCode()];var message=dictionary[key];if(!message){message=key;}
if(context){message=OpenLayers.String.format(message,context);}
return message;}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:true,anchor:null,initialize:function(id,lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback){var newArguments=[id,lonlat,contentSize,contentHTML,closeBox,closeBoxCallback];OpenLayers.Popup.prototype.initialize.apply(this,newArguments);this.anchor=(anchor!=null)?anchor:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)};},destroy:function(){this.anchor=null;this.relativePosition=null;OpenLayers.Popup.prototype.destroy.apply(this,arguments);},show:function(){this.updatePosition();OpenLayers.Popup.prototype.show.apply(this,arguments);},moveTo:function(px){var oldRelativePosition=this.relativePosition;this.relativePosition=this.calculateRelativePosition(px);var newPx=this.calculateNewPx(px);var newArguments=new Array(newPx);OpenLayers.Popup.prototype.moveTo.apply(this,newArguments);if(this.relativePosition!=oldRelativePosition){this.updateRelativePosition();}},setSize:function(contentSize){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if((this.lonlat)&&(this.map)){var px=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(px);}},calculateRelativePosition:function(px){var lonlat=this.map.getLonLatFromLayerPx(px);var extent=this.map.getExtent();var quadrant=extent.determineQuadrant(lonlat);return OpenLayers.Bounds.oppositeQuadrant(quadrant);},updateRelativePosition:function(){},calculateNewPx:function(px){var newPx=px.offset(this.anchor.offset);var size=this.size||this.contentSize;var top=(this.relativePosition.charAt(0)=='t');newPx.y+=(top)?-size.h:this.anchor.size.h;var left=(this.relativePosition.charAt(1)=='l');newPx.x+=(left)?-size.w:this.anchor.size.w;return newPx;},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{canvas:null,features:null,geometryMap:null,initialize:function(containerID){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this.features={};this.geometryMap={};},eraseGeometry:function(geometry){this.eraseFeatures(this.features[this.geometryMap[geometry.id]][0]);},supported:function(){var canvas=document.createElement("canvas");return!!canvas.getContext;},setExtent:function(extent){this.extent=extent.clone();this.resolution=null;this.redraw();},setSize:function(size){this.size=size.clone();this.root.style.width=size.w+"px";this.root.style.height=size.h+"px";this.root.width=size.w;this.root.height=size.h;this.resolution=null;},drawFeature:function(feature,style){if(style==null){style=feature.style;}
style=OpenLayers.Util.extend({'fillColor':'#000000','strokeColor':'#000000','strokeWidth':2,'fillOpacity':1,'strokeOpacity':1},style);this.features[feature.id]=[feature,style];if(feature.geometry){this.geometryMap[feature.geometry.id]=feature.id;}
this.redraw();},drawGeometry:function(geometry,style){var className=geometry.CLASS_NAME;if((className=="OpenLayers.Geometry.Collection")||(className=="OpenLayers.Geometry.MultiPoint")||(className=="OpenLayers.Geometry.MultiLineString")||(className=="OpenLayers.Geometry.MultiPolygon")){for(var i=0;i<geometry.components.length;i++){this.drawGeometry(geometry.components[i],style);}
return;};switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":this.drawPoint(geometry,style);break;case"OpenLayers.Geometry.LineString":this.drawLineString(geometry,style);break;case"OpenLayers.Geometry.LinearRing":this.drawLinearRing(geometry,style);break;case"OpenLayers.Geometry.Polygon":this.drawPolygon(geometry,style);break;default:break;}},drawExternalGraphic:function(pt,style){var img=new Image();img.src=style.externalGraphic;if(style.graphicTitle){img.title=style.graphicTitle;}
var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var xOffset=(style.graphicXOffset!=undefined)?style.graphicXOffset:-(0.5*width);var yOffset=(style.graphicYOffset!=undefined)?style.graphicYOffset:-(0.5*height);var opacity=style.graphicOpacity||style.fillOpacity;var context={img:img,x:(pt[0]+xOffset),y:(pt[1]+yOffset),width:width,height:height,canvas:this.canvas};img.onload=OpenLayers.Function.bind(function(){this.canvas.drawImage(this.img,this.x,this.y,this.width,this.height);},context);},setCanvasStyle:function(type,style){if(type=="fill"){this.canvas.globalAlpha=style['fillOpacity'];this.canvas.fillStyle=style['fillColor'];}else if(type=="stroke"){this.canvas.globalAlpha=style['strokeOpacity'];this.canvas.strokeStyle=style['strokeColor'];this.canvas.lineWidth=style['strokeWidth'];}else{this.canvas.globalAlpha=0;this.canvas.lineWidth=1;}},drawPoint:function(geometry,style){if(style.graphic!==false){var pt=this.getLocalXY(geometry);if(style.externalGraphic){this.drawExternalGraphic(pt,style);}else{if(style.fill!==false){this.setCanvasStyle("fill",style);this.canvas.beginPath();this.canvas.arc(pt[0],pt[1],6,0,Math.PI*2,true);this.canvas.fill();}
if(style.stroke!==false){this.setCanvasStyle("stroke",style);this.canvas.beginPath();this.canvas.arc(pt[0],pt[1],6,0,Math.PI*2,true);this.canvas.stroke();this.setCanvasStyle("reset");}}}},drawLineString:function(geometry,style){if(style.stroke!==false){this.setCanvasStyle("stroke",style);this.canvas.beginPath();var start=this.getLocalXY(geometry.components[0]);this.canvas.moveTo(start[0],start[1]);for(var i=1;i<geometry.components.length;i++){var pt=this.getLocalXY(geometry.components[i]);this.canvas.lineTo(pt[0],pt[1]);}
this.canvas.stroke();}
this.setCanvasStyle("reset");},drawLinearRing:function(geometry,style){if(style.fill!==false){this.setCanvasStyle("fill",style);this.canvas.beginPath();var start=this.getLocalXY(geometry.components[0]);this.canvas.moveTo(start[0],start[1]);for(var i=1;i<geometry.components.length-1;i++){var pt=this.getLocalXY(geometry.components[i]);this.canvas.lineTo(pt[0],pt[1]);}
this.canvas.fill();}
if(style.stroke!==false){var oldWidth=this.canvas.lineWidth;this.setCanvasStyle("stroke",style);this.canvas.beginPath();var start=this.getLocalXY(geometry.components[0]);this.canvas.moveTo(start[0],start[1]);for(var i=1;i<geometry.components.length;i++){var pt=this.getLocalXY(geometry.components[i]);this.canvas.lineTo(pt[0],pt[1]);}
this.canvas.stroke();}
this.setCanvasStyle("reset");},drawPolygon:function(geometry,style){this.drawLinearRing(geometry.components[0],style);for(var i=1;i<geometry.components.length;i++){this.drawLinearRing(geometry.components[i],{fillOpacity:0,strokeWidth:0,strokeOpacity:0,strokeColor:'#000000',fillColor:'#000000'});}},drawText:function(location,style){style=OpenLayers.Util.extend({fontColor:"#000000",labelAlign:"cm"},style);var pt=this.getLocalXY(location);this.setCanvasStyle("reset");this.canvas.fillStyle=style.fontColor;this.canvas.globalAlpha=1;var fontStyle=style.fontWeight+" "+style.fontSize+" "+style.fontFamily;if(this.canvas.fillText){var labelAlign=OpenLayers.Renderer.Canvas.LABEL_ALIGN[style.labelAlign[0]]||"middle";this.canvas.font=fontStyle;this.canvas.textAlign=labelAlign;this.canvas.fillText(style.label,pt[0],pt[1]);}else if(this.canvas.mozDrawText){this.canvas.mozTextStyle=fontStyle;var len=this.canvas.mozMeasureText(style.label);switch(style.labelAlign[0]){case"l":break;case"r":pt[0]-=len;break;case"c":default:pt[0]-=len/2;}
this.canvas.translate(pt[0],pt[1]);this.canvas.mozDrawText(style.label);this.canvas.translate(-1*pt[0],-1*pt[1]);}
this.setCanvasStyle("reset");},getLocalXY:function(point){var resolution=this.getResolution();var extent=this.extent;var x=(point.x/resolution+(-extent.left/resolution));var y=((extent.top/resolution)-point.y/resolution);return[x,y];},clear:function(){this.canvas.clearRect(0,0,this.root.width,this.root.height);},getFeatureIdFromEvent:function(evt){var loc=this.map.getLonLatFromPixel(evt.xy);var resolution=this.getResolution();var bounds=new OpenLayers.Bounds(loc.lon-resolution*5,loc.lat-resolution*5,loc.lon+resolution*5,loc.lat+resolution*5);var geom=bounds.toGeometry();for(var feat in this.features){if(!this.features.hasOwnProperty(feat)){continue;}
if(this.features[feat][0].geometry.intersects(geom)){return feat;}}
return null;},eraseFeatures:function(features){if(!(features instanceof Array)){features=[features];}
for(var i=0;i<features.length;++i){delete this.features[features[i].id];}
this.redraw();},redraw:function(){if(!this.locked){this.clear();var labelMap=[];var feature,style;for(var id in this.features){if(!this.features.hasOwnProperty(id)){continue;}
feature=this.features[id][0];style=this.features[id][1];if(!feature.geometry){continue;}
this.drawGeometry(feature.geometry,style);if(style.label){labelMap.push([feature,style]);}}
var item;for(var i=0;len=labelMap.length,i<len;++i){item=labelMap[i];this.drawText(item[0].geometry.getCentroid(),item[1]);}}},CLASS_NAME:"OpenLayers.Renderer.Canvas"});OpenLayers.Renderer.Canvas.LABEL_ALIGN={"l":"left","r":"right"};OpenLayers.ElementsIndexer=OpenLayers.Class({maxZIndex:null,order:null,indices:null,compare:null,initialize:function(yOrdering){this.compare=yOrdering?OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER:OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;this.order=[];this.indices={};this.maxZIndex=0;},insert:function(newNode){if(this.exists(newNode)){this.remove(newNode);}
var nodeId=newNode.id;this.determineZIndex(newNode);var leftIndex=-1;var rightIndex=this.order.length;var middle;while(rightIndex-leftIndex>1){middle=parseInt((leftIndex+rightIndex)/2);var placement=this.compare(this,newNode,OpenLayers.Util.getElement(this.order[middle]));if(placement>0){leftIndex=middle;}else{rightIndex=middle;}}
this.order.splice(rightIndex,0,nodeId);this.indices[nodeId]=this.getZIndex(newNode);return this.getNextElement(rightIndex);},remove:function(node){var nodeId=node.id;var arrayIndex=OpenLayers.Util.indexOf(this.order,nodeId);if(arrayIndex>=0){this.order.splice(arrayIndex,1);delete this.indices[nodeId];if(this.order.length>0){var lastId=this.order[this.order.length-1];this.maxZIndex=this.indices[lastId];}else{this.maxZIndex=0;}}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0;},exists:function(node){return(this.indices[node.id]!=null);},getZIndex:function(node){return node._style.graphicZIndex;},determineZIndex:function(node){var zIndex=node._style.graphicZIndex;if(zIndex==null){zIndex=this.maxZIndex;node._style.graphicZIndex=zIndex;}else if(zIndex>this.maxZIndex){this.maxZIndex=zIndex;}},getNextElement:function(index){var nextIndex=index+1;if(nextIndex<this.order.length){var nextElement=OpenLayers.Util.getElement(this.order[nextIndex]);if(nextElement==undefined){nextElement=this.getNextElement(nextIndex);}
return nextElement;}else{return null;}},CLASS_NAME:"OpenLayers.ElementsIndexer"});OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(indexer,newNode,nextNode){var newZIndex=indexer.getZIndex(newNode);var returnVal=0;if(nextNode){var nextZIndex=indexer.getZIndex(nextNode);returnVal=newZIndex-nextZIndex;}
return returnVal;},Z_ORDER_DRAWING_ORDER:function(indexer,newNode,nextNode){var returnVal=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(indexer,newNode,nextNode);if(nextNode&&returnVal==0){returnVal=1;}
return returnVal;},Z_ORDER_Y_ORDER:function(indexer,newNode,nextNode){var returnVal=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(indexer,newNode,nextNode);if(nextNode&&returnVal==0){var newLat=newNode._geometry.getBounds().bottom;var nextLat=nextNode._geometry.getBounds().bottom;var result=nextLat-newLat;returnVal=(result==0)?1:result;}
return returnVal;}};OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,vectorRoot:null,textRoot:null,xmlns:null,indexer:null,BACKGROUND_ID_SUFFIX:"_background",LABEL_ID_SUFFIX:"_label",minimumSymbolizer:{strokeLinecap:"round",strokeOpacity:1,strokeDashstyle:"solid",fillOpacity:1,pointRadius:0},initialize:function(containerID,options){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.rendererRoot=this.createRenderRoot();this.root=this.createRoot("_root");this.vectorRoot=this.createRoot("_vroot");this.textRoot=this.createRoot("_troot");this.root.appendChild(this.vectorRoot);this.root.appendChild(this.textRoot);this.rendererRoot.appendChild(this.root);this.container.appendChild(this.rendererRoot);if(options&&(options.zIndexing||options.yOrdering)){this.indexer=new OpenLayers.ElementsIndexer(options.yOrdering);}},destroy:function(){this.clear();this.rendererRoot=null;this.root=null;this.xmlns=null;OpenLayers.Renderer.prototype.destroy.apply(this,arguments);},clear:function(){if(this.vectorRoot){while(this.vectorRoot.childNodes.length>0){this.vectorRoot.removeChild(this.vectorRoot.firstChild);}}
if(this.textRoot){while(this.textRoot.childNodes.length>0){this.textRoot.removeChild(this.textRoot.firstChild);}}
if(this.indexer){this.indexer.clear();}},getNodeType:function(geometry,style){},drawGeometry:function(geometry,style,featureId){var className=geometry.CLASS_NAME;var rendered=true;if((className=="OpenLayers.Geometry.Collection")||(className=="OpenLayers.Geometry.MultiPoint")||(className=="OpenLayers.Geometry.MultiLineString")||(className=="OpenLayers.Geometry.MultiPolygon")){for(var i=0,len=geometry.components.length;i<len;i++){rendered=this.drawGeometry(geometry.components[i],style,featureId)&&rendered;}
return rendered;};rendered=false;if(style.display!="none"){if(style.backgroundGraphic){this.redrawBackgroundNode(geometry.id,geometry,style,featureId);}
rendered=this.redrawNode(geometry.id,geometry,style,featureId);}
if(rendered==false){var node=document.getElementById(geometry.id);if(node){if(node._style.backgroundGraphic){node.parentNode.removeChild(document.getElementById(geometry.id+this.BACKGROUND_ID_SUFFIX));}
node.parentNode.removeChild(node);}}
return rendered;},redrawNode:function(id,geometry,style,featureId){var node=this.nodeFactory(id,this.getNodeType(geometry,style));node._featureId=featureId;node._geometry=geometry;node._geometryClass=geometry.CLASS_NAME;node._style=style;var drawResult=this.drawGeometryNode(node,geometry,style);if(drawResult===false){return false;}
node=drawResult.node;if(this.indexer){var insert=this.indexer.insert(node);if(insert){this.vectorRoot.insertBefore(node,insert);}else{this.vectorRoot.appendChild(node);}}else{if(node.parentNode!==this.vectorRoot){this.vectorRoot.appendChild(node);}}
this.postDraw(node);return drawResult.complete;},redrawBackgroundNode:function(id,geometry,style,featureId){var backgroundStyle=OpenLayers.Util.extend({},style);backgroundStyle.externalGraphic=backgroundStyle.backgroundGraphic;backgroundStyle.graphicXOffset=backgroundStyle.backgroundXOffset;backgroundStyle.graphicYOffset=backgroundStyle.backgroundYOffset;backgroundStyle.graphicZIndex=backgroundStyle.backgroundGraphicZIndex;backgroundStyle.graphicWidth=backgroundStyle.backgroundWidth||backgroundStyle.graphicWidth;backgroundStyle.graphicHeight=backgroundStyle.backgroundHeight||backgroundStyle.graphicHeight;backgroundStyle.backgroundGraphic=null;backgroundStyle.backgroundXOffset=null;backgroundStyle.backgroundYOffset=null;backgroundStyle.backgroundGraphicZIndex=null;return this.redrawNode(id+this.BACKGROUND_ID_SUFFIX,geometry,backgroundStyle,null);},drawGeometryNode:function(node,geometry,style){style=style||node._style;OpenLayers.Util.applyDefaults(style,this.minimumSymbolizer);var options={'isFilled':style.fill===undefined?true:style.fill,'isStroked':style.stroke===undefined?!!style.strokeWidth:style.stroke};var drawn;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.graphic===false){options.isFilled=false;options.isStroked=false;}
drawn=this.drawPoint(node,geometry);break;case"OpenLayers.Geometry.LineString":options.isFilled=false;drawn=this.drawLineString(node,geometry);break;case"OpenLayers.Geometry.LinearRing":drawn=this.drawLinearRing(node,geometry);break;case"OpenLayers.Geometry.Polygon":drawn=this.drawPolygon(node,geometry);break;case"OpenLayers.Geometry.Surface":drawn=this.drawSurface(node,geometry);break;case"OpenLayers.Geometry.Rectangle":drawn=this.drawRectangle(node,geometry);break;default:break;}
node._style=style;node._options=options;if(drawn!=false){return{node:this.setStyle(node,style,options,geometry),complete:drawn};}else{return false;}},postDraw:function(node){},drawPoint:function(node,geometry){},drawLineString:function(node,geometry){},drawLinearRing:function(node,geometry){},drawPolygon:function(node,geometry){},drawRectangle:function(node,geometry){},drawCircle:function(node,geometry){},drawSurface:function(node,geometry){},removeText:function(featureId){var label=document.getElementById(featureId+this.LABEL_ID_SUFFIX);if(label){this.textRoot.removeChild(label);}},getFeatureIdFromEvent:function(evt){var target=evt.target;var useElement=target&&target.correspondingUseElement;var node=useElement?useElement:(target||evt.srcElement);var featureId=node._featureId;return featureId;},eraseGeometry:function(geometry){if((geometry.CLASS_NAME=="OpenLayers.Geometry.MultiPoint")||(geometry.CLASS_NAME=="OpenLayers.Geometry.MultiLineString")||(geometry.CLASS_NAME=="OpenLayers.Geometry.MultiPolygon")||(geometry.CLASS_NAME=="OpenLayers.Geometry.Collection")){for(var i=0,len=geometry.components.length;i<len;i++){this.eraseGeometry(geometry.components[i]);}}else{var element=OpenLayers.Util.getElement(geometry.id);if(element&&element.parentNode){if(element.geometry){element.geometry.destroy();element.geometry=null;}
element.parentNode.removeChild(element);if(this.indexer){this.indexer.remove(element);}
if(element._style.backgroundGraphic){var backgroundId=geometry.id+this.BACKGROUND_ID_SUFFIX;var bElem=OpenLayers.Util.getElement(backgroundId);if(bElem&&bElem.parentNode){bElem.parentNode.removeChild(bElem);}}}}},nodeFactory:function(id,type){var node=OpenLayers.Util.getElement(id);if(node){if(!this.nodeTypeCompare(node,type)){node.parentNode.removeChild(node);node=this.nodeFactory(id,type);}}else{node=this.createNode(type,id);}
return node;},nodeTypeCompare:function(node,type){},createNode:function(type,id){},moveRoot:function(renderer){var root=this.root;if(renderer.root.parentNode==this.rendererRoot){root=renderer.root;}
root.parentNode.removeChild(root);renderer.rendererRoot.appendChild(root);},getRenderLayerId:function(){return this.root.parentNode.parentNode.id;},isComplexSymbol:function(graphicName){return(graphicName!="circle")&&!!graphicName;},CLASS_NAME:"OpenLayers.Renderer.Elements"});OpenLayers.Renderer.symbol={"star":[350,75,379,161,469,161,397,215,423,301,350,250,277,301,303,215,231,161,321,161,350,75],"cross":[4,0,6,0,6,4,10,4,10,6,6,6,6,10,4,10,4,6,0,6,0,4,4,4,4,0],"x":[0,0,25,0,50,35,75,0,100,0,65,50,100,100,75,100,50,65,25,100,0,100,35,50,0,0],"square":[0,0,0,1,1,1,1,0,0,0],"triangle":[0,10,10,10,5,0,0,10]};OpenLayers.Strategy.Fixed=OpenLayers.Class(OpenLayers.Strategy,{preload:false,initialize:function(options){OpenLayers.Strategy.prototype.initialize.apply(this,[options]);},destroy:function(){OpenLayers.Strategy.prototype.destroy.apply(this,arguments);},activate:function(){if(OpenLayers.Strategy.prototype.activate.apply(this,arguments)){this.layer.events.on({"refresh":this.load,scope:this});if(this.layer.visibility==true||this.preload){this.load();}else{this.layer.events.on({"visibilitychanged":this.load,scope:this});}
return true;}
return false;},deactivate:function(){var deactivated=OpenLayers.Strategy.prototype.deactivate.call(this);if(deactivated){this.layer.events.un({"refresh":this.load,"visibilitychanged":this.load,scope:this});}
return deactivated;},load:function(options){this.layer.events.triggerEvent("loadstart");this.layer.protocol.read(OpenLayers.Util.applyDefaults({callback:this.merge,scope:this},options));this.layer.events.un({"visibilitychanged":this.load,scope:this});},merge:function(resp){this.layer.destroyFeatures();var features=resp.features;if(features&&features.length>0){var remote=this.layer.projection;var local=this.layer.map.getProjectionObject();if(!local.equals(remote)){var geom;for(var i=0,len=features.length;i<len;++i){geom=features[i].geometry;if(geom){geom.transform(remote,local);}}}
this.layer.addFeatures(features);}
this.layer.events.triggerEvent("loadend");},CLASS_NAME:"OpenLayers.Strategy.Fixed"});OpenLayers.Tween=OpenLayers.Class({INTERVAL:10,easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,interval:null,playing:false,initialize:function(easing){this.easing=(easing)?easing:OpenLayers.Easing.Expo.easeOut;},start:function(begin,finish,duration,options){this.playing=true;this.begin=begin;this.finish=finish;this.duration=duration;this.callbacks=options.callbacks;this.time=0;if(this.interval){window.clearInterval(this.interval);this.interval=null;}
if(this.callbacks&&this.callbacks.start){this.callbacks.start.call(this,this.begin);}
this.interval=window.setInterval(OpenLayers.Function.bind(this.play,this),this.INTERVAL);},stop:function(){if(!this.playing){return;}
if(this.callbacks&&this.callbacks.done){this.callbacks.done.call(this,this.finish);}
window.clearInterval(this.interval);this.interval=null;this.playing=false;},play:function(){var value={};for(var i in this.begin){var b=this.begin[i];var f=this.finish[i];if(b==null||f==null||isNaN(b)||isNaN(f)){OpenLayers.Console.error('invalid value for Tween');}
var c=f-b;value[i]=this.easing.apply(this,[this.time,b,c,this.duration]);}
this.time++;if(this.callbacks&&this.callbacks.eachStep){this.callbacks.eachStep.call(this,value);}
if(this.time>this.duration){if(this.callbacks&&this.callbacks.done){this.callbacks.done.call(this,this.finish);this.playing=false;}
window.clearInterval(this.interval);this.interval=null;}},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};OpenLayers.Easing.Linear={easeIn:function(t,b,c,d){return c*t/d+b;},easeOut:function(t,b,c,d){return c*t/d+b;},easeInOut:function(t,b,c,d){return c*t/d+b;},CLASS_NAME:"OpenLayers.Easing.Linear"};OpenLayers.Easing.Expo={easeIn:function(t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOut:function(t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOut:function(t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;},CLASS_NAME:"OpenLayers.Easing.Expo"};OpenLayers.Easing.Quad={easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOut:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Control.ArgParser=OpenLayers.Class(OpenLayers.Control,{center:null,zoom:null,layers:null,displayProjection:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,arguments);},setMap:function(map){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var i=0,len=this.map.controls.length;i<len;i++){var control=this.map.controls[i];if((control!=this)&&(control.CLASS_NAME=="OpenLayers.Control.ArgParser")){if(control.displayProjection!=this.displayProjection){this.displayProjection=control.displayProjection;}
break;}}
if(i==this.map.controls.length){var args=OpenLayers.Util.getParameters();if(args.layers){this.layers=args.layers;this.map.events.register('addlayer',this,this.configureLayers);this.configureLayers();}
if(args.lat&&args.lon){this.center=new OpenLayers.LonLat(parseFloat(args.lon),parseFloat(args.lat));if(args.zoom){this.zoom=parseInt(args.zoom);}
this.map.events.register('changebaselayer',this,this.setCenter);this.setCenter();}}},setCenter:function(){if(this.map.baseLayer){this.map.events.unregister('changebaselayer',this,this.setCenter);if(this.displayProjection){this.center.transform(this.displayProjection,this.map.getProjectionObject());}
this.map.setCenter(this.center,this.zoom);}},configureLayers:function(){if(this.layers.length==this.map.layers.length){this.map.events.unregister('addlayer',this,this.configureLayers);for(var i=0,len=this.layers.length;i<len;i++){var layer=this.map.layers[i];var c=this.layers.charAt(i);if(c=="B"){this.map.setBaseLayer(layer);}else if((c=="T")||(c=="F")){layer.setVisibility(c=="T");}}}},CLASS_NAME:"OpenLayers.Control.ArgParser"});OpenLayers.Control.PanZoom=OpenLayers.Class(OpenLayers.Control,{slideFactor:50,slideRatio:null,buttons:null,position:null,initialize:function(options){this.position=new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,OpenLayers.Control.PanZoom.Y);OpenLayers.Control.prototype.initialize.apply(this,arguments);},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);this.removeButtons();this.buttons=null;this.position=null;},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);px=this.position;this.buttons=[];var sz=new OpenLayers.Size(18,18);var centered=new OpenLayers.Pixel(px.x+sz.w/2,px.y);this._addButton("panup","north-mini.png",centered,sz);px.y=centered.y+sz.h;this._addButton("panleft","west-mini.png",px,sz);this._addButton("panright","east-mini.png",px.add(sz.w,0),sz);this._addButton("pandown","south-mini.png",centered.add(0,sz.h*2),sz);this._addButton("zoomin","zoom-plus-mini.png",centered.add(0,sz.h*3+5),sz);this._addButton("zoomworld","zoom-world-mini.png",centered.add(0,sz.h*4+5),sz);this._addButton("zoomout","zoom-minus-mini.png",centered.add(0,sz.h*5+5),sz);return this.div;},_addButton:function(id,img,xy,sz){var imgLocation=OpenLayers.Util.getImagesLocation()+img;var btn=OpenLayers.Util.createAlphaImageDiv(this.id+"_"+id,xy,sz,imgLocation,"absolute");this.div.appendChild(btn);OpenLayers.Event.observe(btn,"mousedown",OpenLayers.Function.bindAsEventListener(this.buttonDown,btn));OpenLayers.Event.observe(btn,"dblclick",OpenLayers.Function.bindAsEventListener(this.doubleClick,btn));OpenLayers.Event.observe(btn,"click",OpenLayers.Function.bindAsEventListener(this.doubleClick,btn));btn.action=id;btn.map=this.map;if(!this.slideRatio){var slideFactorPixels=this.slideFactor;var getSlideFactor=function(){return slideFactorPixels;};}else{var slideRatio=this.slideRatio;var getSlideFactor=function(dim){return this.map.getSize()[dim]*slideRatio;};}
btn.getSlideFactor=getSlideFactor;this.buttons.push(btn);return btn;},_removeButton:function(btn){OpenLayers.Event.stopObservingElement(btn);btn.map=null;this.div.removeChild(btn);OpenLayers.Util.removeItem(this.buttons,btn);},removeButtons:function(){for(var i=this.buttons.length-1;i>=0;--i){this._removeButton(this.buttons[i]);}},doubleClick:function(evt){OpenLayers.Event.stop(evt);return false;},buttonDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}
switch(this.action){case"panup":this.map.pan(0,-this.getSlideFactor("h"));break;case"pandown":this.map.pan(0,this.getSlideFactor("h"));break;case"panleft":this.map.pan(-this.getSlideFactor("w"),0);break;case"panright":this.map.pan(this.getSlideFactor("w"),0);break;case"zoomin":this.map.zoomIn();break;case"zoomout":this.map.zoomOut();break;case"zoomworld":this.map.zoomToMaxExtent();break;}
OpenLayers.Event.stop(evt);},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Control.ScaleLine=OpenLayers.Class(OpenLayers.Control,{maxWidth:100,topOutUnits:"km",topInUnits:"m",bottomOutUnits:"mi",bottomInUnits:"ft",eTop:null,eBottom:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.eTop){this.div.style.display="block";this.div.style.position="absolute";this.eTop=document.createElement("div");this.eTop.className=this.displayClass+"Top";var theLen=this.topInUnits.length;this.div.appendChild(this.eTop);if((this.topOutUnits=="")||(this.topInUnits=="")){this.eTop.style.visibility="hidden";}else{this.eTop.style.visibility="visible";}
this.eBottom=document.createElement("div");this.eBottom.className=this.displayClass+"Bottom";this.div.appendChild(this.eBottom);if((this.bottomOutUnits=="")||(this.bottomInUnits=="")){this.eBottom.style.visibility="hidden";}else{this.eBottom.style.visibility="visible";}}
this.map.events.register('moveend',this,this.update);this.update();return this.div;},getBarLen:function(maxLen){var digits=parseInt(Math.log(maxLen)/Math.log(10));var pow10=Math.pow(10,digits);var firstChar=parseInt(maxLen/pow10);var barLen;if(firstChar>5){barLen=5;}else if(firstChar>2){barLen=2;}else{barLen=1;}
return barLen*pow10;},update:function(){var res=this.map.getResolution();if(!res){return;}
var curMapUnits=this.map.getUnits();var inches=OpenLayers.INCHES_PER_UNIT;var maxSizeData=this.maxWidth*res*inches[curMapUnits];var topUnits;var bottomUnits;if(maxSizeData>100000){topUnits=this.topOutUnits;bottomUnits=this.bottomOutUnits;}else{topUnits=this.topInUnits;bottomUnits=this.bottomInUnits;}
var topMax=maxSizeData/inches[topUnits];var bottomMax=maxSizeData/inches[bottomUnits];var topRounded=this.getBarLen(topMax);var bottomRounded=this.getBarLen(bottomMax);topMax=topRounded/inches[curMapUnits]*inches[topUnits];bottomMax=bottomRounded/inches[curMapUnits]*inches[bottomUnits];var topPx=topMax/res;var bottomPx=bottomMax/res;if(this.eBottom.style.visibility=="visible"){this.eBottom.style.width=Math.round(bottomPx)+"px";this.eBottom.innerHTML=bottomRounded+" "+bottomUnits;}
if(this.eTop.style.visibility=="visible"){this.eTop.style.width=Math.round(topPx)+"px";this.eTop.innerHTML=topRounded+" "+topUnits;}},CLASS_NAME:"OpenLayers.Control.ScaleLine"});OpenLayers.Event={observers:false,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(event){return event.target||event.srcElement;},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},isRightClick:function(event){return(((event.which)&&(event.which==3))||((event.button)&&(event.button==2)));},stop:function(event,allowDefault){if(!allowDefault){if(event.preventDefault){event.preventDefault();}else{event.returnValue=false;}}
if(event.stopPropagation){event.stopPropagation();}else{event.cancelBubble=true;}},findElement:function(event,tagName){var element=OpenLayers.Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase()))){element=element.parentNode;}
return element;},observe:function(elementParam,name,observer,useCapture){var element=OpenLayers.Util.getElement(elementParam);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent)){name='keydown';}
if(!this.observers){this.observers={};}
if(!element._eventCacheID){var idPrefix="eventCacheID_";if(element.id){idPrefix=element.id+"_"+idPrefix;}
element._eventCacheID=OpenLayers.Util.createUniqueID(idPrefix);}
var cacheID=element._eventCacheID;if(!this.observers[cacheID]){this.observers[cacheID]=[];}
this.observers[cacheID].push({'element':element,'name':name,'observer':observer,'useCapture':useCapture});if(element.addEventListener){element.addEventListener(name,observer,useCapture);}else if(element.attachEvent){element.attachEvent('on'+name,observer);}},stopObservingElement:function(elementParam){var element=OpenLayers.Util.getElement(elementParam);var cacheID=element._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[cacheID]);},_removeElementObservers:function(elementObservers){if(elementObservers){for(var i=elementObservers.length-1;i>=0;i--){var entry=elementObservers[i];var args=new Array(entry.element,entry.name,entry.observer,entry.useCapture);var removed=OpenLayers.Event.stopObserving.apply(this,args);}}},stopObserving:function(elementParam,name,observer,useCapture){useCapture=useCapture||false;var element=OpenLayers.Util.getElement(elementParam);var cacheID=element._eventCacheID;if(name=='keypress'){if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent){name='keydown';}}
var foundEntry=false;var elementObservers=OpenLayers.Event.observers[cacheID];if(elementObservers){var i=0;while(!foundEntry&&i<elementObservers.length){var cacheEntry=elementObservers[i];if((cacheEntry.name==name)&&(cacheEntry.observer==observer)&&(cacheEntry.useCapture==useCapture)){elementObservers.splice(i,1);if(elementObservers.length==0){delete OpenLayers.Event.observers[cacheID];}
foundEntry=true;break;}
i++;}}
if(foundEntry){if(element.removeEventListener){element.removeEventListener(name,observer,useCapture);}else if(element&&element.detachEvent){element.detachEvent('on'+name,observer);}}
return foundEntry;},unloadCache:function(){if(OpenLayers.Event&&OpenLayers.Event.observers){for(var cacheID in OpenLayers.Event.observers){var elementObservers=OpenLayers.Event.observers[cacheID];OpenLayers.Event._removeElementObservers.apply(this,[elementObservers]);}
OpenLayers.Event.observers=false;}},CLASS_NAME:"OpenLayers.Event"};OpenLayers.Event.observe(window,'unload',OpenLayers.Event.unloadCache,false);if(window.Event){OpenLayers.Util.applyDefaults(window.Event,OpenLayers.Event);}else{var Event=OpenLayers.Event;}
OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:["mouseover","mouseout","mousedown","mouseup","mousemove","click","dblclick","rightclick","dblrightclick","resize","focus","blur"],listeners:null,object:null,element:null,eventTypes:null,eventHandler:null,fallThrough:null,includeXY:false,clearMouseListener:null,initialize:function(object,element,eventTypes,fallThrough,options){OpenLayers.Util.extend(this,options);this.object=object;this.fallThrough=fallThrough;this.listeners={};this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,this);this.clearMouseListener=OpenLayers.Function.bind(this.clearMouseCache,this);this.eventTypes=[];if(eventTypes!=null){for(var i=0,len=eventTypes.length;i<len;i++){this.addEventType(eventTypes[i]);}}
if(element!=null){this.attachToElement(element);}},destroy:function(){if(this.element){OpenLayers.Event.stopObservingElement(this.element);if(this.element.hasScrollEvent){OpenLayers.Event.stopObserving(window,"scroll",this.clearMouseListener);}}
this.element=null;this.listeners=null;this.object=null;this.eventTypes=null;this.fallThrough=null;this.eventHandler=null;},addEventType:function(eventName){if(!this.listeners[eventName]){this.eventTypes.push(eventName);this.listeners[eventName]=[];}},attachToElement:function(element){if(this.element){OpenLayers.Event.stopObservingElement(this.element);}
this.element=element;for(var i=0,len=this.BROWSER_EVENTS.length;i<len;i++){var eventType=this.BROWSER_EVENTS[i];this.addEventType(eventType);OpenLayers.Event.observe(element,eventType,this.eventHandler);}
OpenLayers.Event.observe(element,"dragstart",OpenLayers.Event.stop);},on:function(object){for(var type in object){if(type!="scope"){this.register(type,object.scope,object[type]);}}},register:function(type,obj,func){if((func!=null)&&(OpenLayers.Util.indexOf(this.eventTypes,type)!=-1)){if(obj==null){obj=this.object;}
var listeners=this.listeners[type];listeners.push({obj:obj,func:func});}},registerPriority:function(type,obj,func){if(func!=null){if(obj==null){obj=this.object;}
var listeners=this.listeners[type];if(listeners!=null){listeners.unshift({obj:obj,func:func});}}},un:function(object){for(var type in object){if(type!="scope"){this.unregister(type,object.scope,object[type]);}}},unregister:function(type,obj,func){if(obj==null){obj=this.object;}
var listeners=this.listeners[type];if(listeners!=null){for(var i=0,len=listeners.length;i<len;i++){if(listeners[i].obj==obj&&listeners[i].func==func){listeners.splice(i,1);break;}}}},remove:function(type){if(this.listeners[type]!=null){this.listeners[type]=[];}},triggerEvent:function(type,evt){var listeners=this.listeners[type];if(!listeners||listeners.length==0){return;}
if(evt==null){evt={};}
evt.object=this.object;evt.element=this.element;if(!evt.type){evt.type=type;}
var listeners=listeners.slice(),continueChain;for(var i=0,len=listeners.length;i<len;i++){var callback=listeners[i];continueChain=callback.func.apply(callback.obj,[evt]);if((continueChain!=undefined)&&(continueChain==false)){break;}}
if(!this.fallThrough){OpenLayers.Event.stop(evt,true);}
return continueChain;},handleBrowserEvent:function(evt){if(this.includeXY){evt.xy=this.getMousePosition(evt);}
this.triggerEvent(evt.type,evt);},clearMouseCache:function(){this.element.scrolls=null;this.element.lefttop=null;this.element.offsets=null;},getMousePosition:function(evt){if(!this.includeXY){this.clearMouseCache();}else if(!this.element.hasScrollEvent){OpenLayers.Event.observe(window,"scroll",this.clearMouseListener);this.element.hasScrollEvent=true;}
if(!this.element.scrolls){this.element.scrolls=[(document.documentElement.scrollLeft||document.body.scrollLeft),(document.documentElement.scrollTop||document.body.scrollTop)];}
if(!this.element.lefttop){this.element.lefttop=[(document.documentElement.clientLeft||0),(document.documentElement.clientTop||0)];}
if(!this.element.offsets){this.element.offsets=OpenLayers.Util.pagePosition(this.element);this.element.offsets[0]+=this.element.scrolls[0];this.element.offsets[1]+=this.element.scrolls[1];}
return new OpenLayers.Pixel((evt.clientX+this.element.scrolls[0])-this.element.offsets[0]
-this.element.lefttop[0],(evt.clientY+this.element.scrolls[1])-this.element.offsets[1]
-this.element.lefttop[1]);},CLASS_NAME:"OpenLayers.Events"});OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:false,initialize:function(options){OpenLayers.Util.extend(this,options);this.options=options;},destroy:function(){},read:function(data){OpenLayers.Console.userError(OpenLayers.i18n("readNotImplemented"));},write:function(object){OpenLayers.Console.userError(OpenLayers.i18n("writeNotImplemented"));},CLASS_NAME:"OpenLayers.Format"});OpenLayers.Lang.en={'unhandledRequest':"Unhandled request return ${statusText}",'permalink':"Permalink",'overlays':"Overlays",'baseLayer':"Base Layer",'sameProjection':"The overview map only works when it is in the same projection as the main map",'readNotImplemented':"Read not implemented.",'writeNotImplemented':"Write not implemented.",'noFID':"Can't update a feature for which there is no FID.",'errorLoadingGML':"Error in loading GML file ${url}",'browserNotSupported':"Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",'componentShouldBe':"addFeatures : component should be an ${geomType}",'getFeatureError':"getFeatureFromEvent called on layer with no renderer. This usually means you "+"destroyed a layer, but not some handler which is associated with it.",'minZoomLevelError':"The minZoomLevel property is only intended for use "+"with the FixedZoomLevels-descendent layers. That this "+"wfs layer checks for minZoomLevel is a relic of the"+"past. We cannot, however, remove it without possibly "+"breaking OL based applications that may depend on it."+" Therefore we are deprecating it -- the minZoomLevel "+"check below will be removed at 3.0. Please instead "+"use min/max resolution setting as described here: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS Transaction: SUCCESS ${response}",'commitFailed':"WFS Transaction: FAILED ${response}",'googleWarning':"The Google Layer was unable to load correctly.<br><br>"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.<br><br>"+"Most likely, this is because the Google Maps library "+"script was either not included, or does not contain the "+"correct API key for your site.<br><br>"+"Developers: For help getting this working correctly, "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>click here</a>",'getLayerWarning':"The ${layerType} Layer was unable to load correctly.<br><br>"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.<br><br>"+"Most likely, this is because the ${layerLib} library "+"script was not correctly included.<br><br>"+"Developers: For help getting this working correctly, "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>click here</a>",'scale':"Scale = 1 : ${scaleDenom}",'layerAlreadyAdded':"You tried to add the layer: ${layerName} to the map, but it has already been added",'reprojectDeprecated':"You are using the 'reproject' option "+"on the ${layerName} layer. This option is deprecated: "+"its use was designed to support displaying data over commercial "+"basemaps, but that functionality should now be achieved by using "+"Spherical Mercator support. More information is available from "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"This method has been deprecated and will be removed in 3.0. "+"Please use ${newMethod} instead.",'boundsAddError':"You must pass both x and y values to the add function.",'lonlatAddError':"You must pass both lon and lat values to the add function.",'pixelAddError':"You must pass both x and y values to the add function.",'unsupportedGeometryType':"Unsupported geometry type: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.",'end':'','filterEvaluateNotImplemented':"evaluate is not implemented for this filter type."};OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:false,initialize:function(id,lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback){this.padding=new OpenLayers.Bounds(0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE,0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);},draw:function(px){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);this.setContentHTML();this.setBackgroundColor();this.setOpacity();return this.div;},updateRelativePosition:function(){this.setRicoCorners();},setSize:function(contentSize){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.setRicoCorners();},setBackgroundColor:function(color){if(color!=undefined){this.backgroundColor=color;}
if(this.div!=null){if(this.contentDiv!=null){this.div.style.background="transparent";OpenLayers.Rico.Corner.changeColor(this.groupDiv,this.backgroundColor);}}},setOpacity:function(opacity){OpenLayers.Popup.Anchored.prototype.setOpacity.call(this,opacity);if(this.div!=null){if(this.groupDiv!=null){OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,this.opacity);}}},setBorder:function(border){this.border=0;},setRicoCorners:function(){var corners=this.getCornersToRound(this.relativePosition);var options={corners:corners,color:this.backgroundColor,bgColor:"transparent",blend:false};if(!this.rounded){OpenLayers.Rico.Corner.round(this.div,options);this.rounded=true;}else{OpenLayers.Rico.Corner.reRound(this.groupDiv,options);this.setBackgroundColor();this.setOpacity();}},getCornersToRound:function(){var corners=['tl','tr','bl','br'];var corner=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(corners,corner);return corners.join(" ");},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,initialize:function(projCode,options){OpenLayers.Util.extend(this,options);this.projCode=projCode;if(window.Proj4js){this.proj=new Proj4js.Proj(projCode);}},getCode:function(){return this.proj?this.proj.srsCode:this.projCode;},getUnits:function(){return this.proj?this.proj.units:null;},toString:function(){return this.getCode();},equals:function(projection){if(projection&&projection.getCode){return this.getCode()==projection.getCode();}else{return false;}},destroy:function(){delete this.proj;delete this.projCode;},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};OpenLayers.Projection.addTransform=function(from,to,method){if(!OpenLayers.Projection.transforms[from]){OpenLayers.Projection.transforms[from]={};}
OpenLayers.Projection.transforms[from][to]=method;};OpenLayers.Projection.transform=function(point,source,dest){if(source.proj&&dest.proj){point=Proj4js.transform(source.proj,dest.proj,point);}else if(source&&dest&&OpenLayers.Projection.transforms[source.getCode()]&&OpenLayers.Projection.transforms[source.getCode()][dest.getCode()]){OpenLayers.Projection.transforms[source.getCode()][dest.getCode()](point);}
return point;};OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15000,translationParameters:null,symbolSize:{},isGecko:null,initialize:function(containerID){if(!this.supported()){return;}
OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.translationParameters={x:0,y:0};this.isGecko=(navigator.userAgent.toLowerCase().indexOf("gecko/")!=-1);},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments);},supported:function(){var svgFeature="http://www.w3.org/TR/SVG11/feature#";return(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(svgFeature+"SVG","1.1")||document.implementation.hasFeature(svgFeature+"BasicStructure","1.1")));},inValidRange:function(x,y,xyOnly){var left=x+(xyOnly?0:this.translationParameters.x);var top=y+(xyOnly?0:this.translationParameters.y);return(left>=-this.MAX_PIXEL&&left<=this.MAX_PIXEL&&top>=-this.MAX_PIXEL&&top<=this.MAX_PIXEL);},setExtent:function(extent,resolutionChanged){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var resolution=this.getResolution();var left=-extent.left/resolution;var top=extent.top/resolution;if(resolutionChanged){this.left=left;this.top=top;var extentString="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",extentString);this.translate(0,0);return true;}else{var inRange=this.translate(left-this.left,top-this.top);if(!inRange){this.setExtent(extent,true);}
return inRange;}},translate:function(x,y){if(!this.inValidRange(x,y,true)){return false;}else{var transformString="";if(x||y){transformString="translate("+x+","+y+")";}
this.root.setAttributeNS(null,"transform",transformString);this.translationParameters={x:x,y:y};return true;}},setSize:function(size){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h);},getNodeType:function(geometry,style){var nodeType=null;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.externalGraphic){nodeType="image";}else if(this.isComplexSymbol(style.graphicName)){nodeType="use";}else{nodeType="circle";}
break;case"OpenLayers.Geometry.Rectangle":nodeType="rect";break;case"OpenLayers.Geometry.LineString":nodeType="polyline";break;case"OpenLayers.Geometry.LinearRing":nodeType="polygon";break;case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":nodeType="path";break;default:break;}
return nodeType;},setStyle:function(node,style,options){style=style||node._style;options=options||node._options;var r=parseFloat(node.getAttributeNS(null,"r"));var widthFactor=1;var pos;if(node._geometryClass=="OpenLayers.Geometry.Point"&&r){node.style.visibility="";if(style.graphic===false){node.style.visibility="hidden";}else if(style.externalGraphic){pos=this.getPosition(node);if(style.graphicTitle){node.setAttributeNS(null,"title",style.graphicTitle);}
if(style.graphicWidth&&style.graphicHeight){node.setAttributeNS(null,"preserveAspectRatio","none");}
var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var xOffset=(style.graphicXOffset!=undefined)?style.graphicXOffset:-(0.5*width);var yOffset=(style.graphicYOffset!=undefined)?style.graphicYOffset:-(0.5*height);var opacity=style.graphicOpacity||style.fillOpacity;node.setAttributeNS(null,"x",(pos.x+xOffset).toFixed());node.setAttributeNS(null,"y",(pos.y+yOffset).toFixed());node.setAttributeNS(null,"width",width);node.setAttributeNS(null,"height",height);node.setAttributeNS(this.xlinkns,"href",style.externalGraphic);node.setAttributeNS(null,"style","opacity: "+opacity);}else if(this.isComplexSymbol(style.graphicName)){var offset=style.pointRadius*3;var size=offset*2;var id=this.importSymbol(style.graphicName);var href="#"+id;pos=this.getPosition(node);widthFactor=this.symbolSize[id]/size;var parent=node.parentNode;var nextSibling=node.nextSibling;if(parent){parent.removeChild(node);}
node.setAttributeNS(this.xlinkns,"href",href);node.setAttributeNS(null,"width",size);node.setAttributeNS(null,"height",size);node.setAttributeNS(null,"x",pos.x-offset);node.setAttributeNS(null,"y",pos.y-offset);if(nextSibling){parent.insertBefore(node,nextSibling);}else if(parent){parent.appendChild(node);}}else{node.setAttributeNS(null,"r",style.pointRadius);}
if(typeof style.rotation!="undefined"&&pos){var rotation=OpenLayers.String.format("rotate(${0} ${1} ${2})",[style.rotation,pos.x,pos.y]);node.setAttributeNS(null,"transform",rotation);}}
if(options.isFilled){node.setAttributeNS(null,"fill",style.fillColor);node.setAttributeNS(null,"fill-opacity",style.fillOpacity);}else{node.setAttributeNS(null,"fill","none");}
if(options.isStroked){node.setAttributeNS(null,"stroke",style.strokeColor);node.setAttributeNS(null,"stroke-opacity",style.strokeOpacity);node.setAttributeNS(null,"stroke-width",style.strokeWidth*widthFactor);node.setAttributeNS(null,"stroke-linecap",style.strokeLinecap);node.setAttributeNS(null,"stroke-linejoin","round");node.setAttributeNS(null,"stroke-dasharray",this.dashStyle(style,widthFactor));}else{node.setAttributeNS(null,"stroke","none");}
if(style.pointerEvents){node.setAttributeNS(null,"pointer-events",style.pointerEvents);}
if(style.cursor!=null){node.setAttributeNS(null,"cursor",style.cursor);}
return node;},dashStyle:function(style,widthFactor){var w=style.strokeWidth*widthFactor;switch(style.strokeDashstyle){case'solid':return'none';case'dot':return[1,4*w].join();case'dash':return[4*w,4*w].join();case'dashdot':return[4*w,4*w,1,4*w].join();case'longdash':return[8*w,4*w].join();case'longdashdot':return[8*w,4*w,1,4*w].join();default:return style.strokeDashstyle.replace(/ /g,",");}},createNode:function(type,id){var node=document.createElementNS(this.xmlns,type);if(id){node.setAttributeNS(null,"id",id);}
return node;},nodeTypeCompare:function(node,type){return(type==node.nodeName);},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_svgRoot","svg");},createRoot:function(suffix){return this.nodeFactory(this.container.id+suffix,"g");},createDefs:function(){var defs=this.nodeFactory(this.container.id+"_defs","defs");this.rendererRoot.appendChild(defs);return defs;},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1);},drawCircle:function(node,geometry,radius){var resolution=this.getResolution();var x=(geometry.x/resolution+this.left);var y=(this.top-geometry.y/resolution);if(this.inValidRange(x,y)){node.setAttributeNS(null,"cx",x);node.setAttributeNS(null,"cy",y);node.setAttributeNS(null,"r",radius);return node;}else{return false;}},drawLineString:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return(componentsResult.complete?node:null);}else{return false;}},drawLinearRing:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return(componentsResult.complete?node:null);}else{return false;}},drawPolygon:function(node,geometry){var d="";var draw=true;var complete=true;var linearRingResult,path;for(var j=0,len=geometry.components.length;j<len;j++){d+=" M";linearRingResult=this.getComponentsString(geometry.components[j].components," ");path=linearRingResult.path;if(path){d+=" "+path;complete=linearRingResult.complete&&complete;}else{draw=false;}}
d+=" z";if(draw){node.setAttributeNS(null,"d",d);node.setAttributeNS(null,"fill-rule","evenodd");return complete?node:null;}else{return false;}},drawRectangle:function(node,geometry){var resolution=this.getResolution();var x=(geometry.x/resolution+this.left);var y=(this.top-geometry.y/resolution);if(this.inValidRange(x,y)){node.setAttributeNS(null,"x",x);node.setAttributeNS(null,"y",y);node.setAttributeNS(null,"width",geometry.width/resolution);node.setAttributeNS(null,"height",geometry.height/resolution);return node;}else{return false;}},drawSurface:function(node,geometry){var d=null;var draw=true;for(var i=0,len=geometry.components.length;i<len;i++){if((i%3)==0&&(i/3)==0){var component=this.getShortString(geometry.components[i]);if(!component){draw=false;}
d="M "+component;}else if((i%3)==1){var component=this.getShortString(geometry.components[i]);if(!component){draw=false;}
d+=" C "+component;}else{var component=this.getShortString(geometry.components[i]);if(!component){draw=false;}
d+=" "+component;}}
d+=" Z";if(draw){node.setAttributeNS(null,"d",d);return node;}else{return false;}},drawText:function(featureId,style,location){var resolution=this.getResolution();var x=(location.x/resolution+this.left);var y=(location.y/resolution-this.top);var label=this.nodeFactory(featureId+this.LABEL_ID_SUFFIX,"text");var tspan=this.nodeFactory(featureId+this.LABEL_ID_SUFFIX+"_tspan","tspan");label.setAttributeNS(null,"x",x);label.setAttributeNS(null,"y",-y);label.setAttributeNS(null,"pointer-events","none");if(style.fontColor){label.setAttributeNS(null,"fill",style.fontColor);}
if(style.fontFamily){label.setAttributeNS(null,"font-family",style.fontFamily);}
if(style.fontSize){label.setAttributeNS(null,"font-size",style.fontSize);}
if(style.fontWeight){label.setAttributeNS(null,"font-weight",style.fontWeight);}
var align=style.labelAlign||"cm";label.setAttributeNS(null,"text-anchor",OpenLayers.Renderer.SVG.LABEL_ALIGN[align[0]]||"middle");if(this.isGecko){label.setAttributeNS(null,"dominant-baseline",OpenLayers.Renderer.SVG.LABEL_ALIGN[align[1]]||"central");}else{tspan.setAttributeNS(null,"baseline-shift",OpenLayers.Renderer.SVG.LABEL_VSHIFT[align[1]]||"-35%");}
tspan.textContent=style.label;if(!label.parentNode){label.appendChild(tspan);this.textRoot.appendChild(label);}},getComponentsString:function(components,separator){var renderCmp=[];var complete=true;var len=components.length;var strings=[];var str,component,j;for(var i=0;i<len;i++){component=components[i];renderCmp.push(component);str=this.getShortString(component);if(str){strings.push(str);}else{if(i>0){if(this.getShortString(components[i-1])){strings.push(this.clipLine(components[i],components[i-1]));}}
if(i<len-1){if(this.getShortString(components[i+1])){strings.push(this.clipLine(components[i],components[i+1]));}}
complete=false;}}
return{path:strings.join(separator||","),complete:complete};},clipLine:function(badComponent,goodComponent){if(goodComponent.equals(badComponent)){return"";}
var resolution=this.getResolution();var maxX=this.MAX_PIXEL-this.translationParameters.x;var maxY=this.MAX_PIXEL-this.translationParameters.y;var x1=goodComponent.x/resolution+this.left;var y1=this.top-goodComponent.y/resolution;var x2=badComponent.x/resolution+this.left;var y2=this.top-badComponent.y/resolution;var k;if(x2<-maxX||x2>maxX){k=(y2-y1)/(x2-x1);x2=x2<0?-maxX:maxX;y2=y1+(x2-x1)*k;}
if(y2<-maxY||y2>maxY){k=(x2-x1)/(y2-y1);y2=y2<0?-maxY:maxY;x2=x1+(y2-y1)*k;}
return x2+","+y2;},getShortString:function(point){var resolution=this.getResolution();var x=(point.x/resolution+this.left);var y=(this.top-point.y/resolution);if(this.inValidRange(x,y)){return x+","+y;}else{return false;}},getPosition:function(node){return({x:parseFloat(node.getAttributeNS(null,"cx")),y:parseFloat(node.getAttributeNS(null,"cy"))});},importSymbol:function(graphicName){if(!this.defs){this.defs=this.createDefs();}
var id=this.container.id+"-"+graphicName;if(document.getElementById(id)!=null){return id;}
var symbol=OpenLayers.Renderer.symbol[graphicName];if(!symbol){throw new Error(graphicName+' is not a valid symbol name');return;}
var symbolNode=this.nodeFactory(id,"symbol");var node=this.nodeFactory(null,"polygon");symbolNode.appendChild(node);var symbolExtent=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var points="";var x,y;for(var i=0;i<symbol.length;i=i+2){x=symbol[i];y=symbol[i+1];symbolExtent.left=Math.min(symbolExtent.left,x);symbolExtent.bottom=Math.min(symbolExtent.bottom,y);symbolExtent.right=Math.max(symbolExtent.right,x);symbolExtent.top=Math.max(symbolExtent.top,y);points+=" "+x+","+y;}
node.setAttributeNS(null,"points",points);var width=symbolExtent.getWidth();var height=symbolExtent.getHeight();var viewBox=[symbolExtent.left-width,symbolExtent.bottom-height,width*3,height*3];symbolNode.setAttributeNS(null,"viewBox",viewBox.join(" "));this.symbolSize[id]=Math.max(width,height)*3;this.defs.appendChild(symbolNode);return symbolNode.id;},CLASS_NAME:"OpenLayers.Renderer.SVG"});OpenLayers.Renderer.SVG.LABEL_ALIGN={"l":"start","r":"end","b":"bottom","t":"hanging"};OpenLayers.Renderer.SVG.LABEL_VSHIFT={"t":"-70%","b":"0"};OpenLayers.Renderer.VML=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"urn:schemas-microsoft-com:vml",symbolCache:{},offset:null,initialize:function(containerID){if(!this.supported()){return;}
if(!document.namespaces.olv){document.namespaces.add("olv",this.xmlns);var style=document.createStyleSheet();var shapes=['shape','rect','oval','fill','stroke','imagedata','group','textbox'];for(var i=0,len=shapes.length;i<len;i++){style.addRule('olv\\:'+shapes[i],"behavior: url(#default#VML); "+"position: absolute; display: inline-block;");}
var shapes=['shape','rect','oval','fill','stroke','imagedata','group','textbox'];for(var i=0,len=shapes.length;i<len;i++){style.addRule('olv\\:'+shapes[i],"behavior: url(#default#VML); "+"position: absolute; display: inline-block;");}}
OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.offset={x:0,y:0};},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments);},supported:function(){return!!(document.namespaces);},setExtent:function(extent,resolutionChanged){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var resolution=this.getResolution();var left=extent.left/resolution;var top=extent.top/resolution-this.size.h;if(resolutionChanged){this.offset={x:left,y:top};left=0;top=0;}else{left=left-this.offset.x;top=top-this.offset.y;}
var org=left+" "+top;this.root.coordorigin=org;var roots=[this.root,this.vectorRoot,this.textRoot];var root;for(var i=0,len=roots.length;i<len;++i){root=roots[i];var size=this.size.w+" "+this.size.h;root.coordsize=size;}
this.root.style.flip="y";return true;},setSize:function(size){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);var roots=[this.rendererRoot,this.root,this.vectorRoot,this.textRoot];var w=this.size.w+"px";var h=this.size.h+"px";var root;for(var i=0,len=roots.length;i<len;++i){root=roots[i];root.style.width=w;root.style.height=h;}},getNodeType:function(geometry,style){var nodeType=null;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.externalGraphic){nodeType="olv:rect";}else if(this.isComplexSymbol(style.graphicName)){nodeType="olv:shape";}else{nodeType="olv:oval";}
break;case"OpenLayers.Geometry.Rectangle":nodeType="olv:rect";break;case"OpenLayers.Geometry.LineString":case"OpenLayers.Geometry.LinearRing":case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":nodeType="olv:shape";break;default:break;}
return nodeType;},setStyle:function(node,style,options,geometry){style=style||node._style;options=options||node._options;var widthFactor=1;if(node._geometryClass=="OpenLayers.Geometry.Point"){if(style.externalGraphic){if(style.graphicTitle){node.title=style.graphicTitle;}
var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var resolution=this.getResolution();var xOffset=(style.graphicXOffset!=undefined)?style.graphicXOffset:-(0.5*width);var yOffset=(style.graphicYOffset!=undefined)?style.graphicYOffset:-(0.5*height);node.style.left=((geometry.x/resolution-this.offset.x)+xOffset).toFixed();node.style.top=((geometry.y/resolution-this.offset.y)-(yOffset+height)).toFixed();node.style.width=width+"px";node.style.height=height+"px";node.style.flip="y";style.fillColor="none";options.isStroked=false;}else if(this.isComplexSymbol(style.graphicName)){var cache=this.importSymbol(style.graphicName);node.path=cache.path;node.coordorigin=cache.left+","+cache.bottom;var size=cache.size;node.coordsize=size+","+size;this.drawCircle(node,geometry,style.pointRadius);node.style.flip="y";}else{this.drawCircle(node,geometry,style.pointRadius);}}
if(options.isFilled){node.fillcolor=style.fillColor;}else{node.filled="false";}
var fills=node.getElementsByTagName("fill");var fill=(fills.length==0)?null:fills[0];if(!options.isFilled){if(fill){node.removeChild(fill);}}else{if(!fill){fill=this.createNode('olv:fill',node.id+"_fill");}
fill.opacity=style.fillOpacity;if(node._geometryClass=="OpenLayers.Geometry.Point"&&style.externalGraphic){if(style.graphicOpacity){fill.opacity=style.graphicOpacity;}
fill.src=style.externalGraphic;fill.type="frame";if(!(style.graphicWidth&&style.graphicHeight)){fill.aspect="atmost";}}
if(fill.parentNode!=node){node.appendChild(fill);}}
if(typeof style.rotation!="undefined"){if(style.externalGraphic){this.graphicRotate(node,xOffset,yOffset);fill.opacity=0;}else{node.style.rotation=style.rotation;}}
if(options.isStroked){node.strokecolor=style.strokeColor;node.strokeweight=style.strokeWidth+"px";}else{node.stroked=false;}
var strokes=node.getElementsByTagName("stroke");var stroke=(strokes.length==0)?null:strokes[0];if(!options.isStroked){if(stroke){node.removeChild(stroke);}}else{if(!stroke){stroke=this.createNode('olv:stroke',node.id+"_stroke");node.appendChild(stroke);}
stroke.opacity=style.strokeOpacity;stroke.endcap=!style.strokeLinecap||style.strokeLinecap=='butt'?'flat':style.strokeLinecap;stroke.dashstyle=this.dashStyle(style);}
if(style.cursor!="inherit"&&style.cursor!=null){node.style.cursor=style.cursor;}
return node;},graphicRotate:function(node,xOffset,yOffset){var style=style||node._style;var options=node._options;var aspectRatio,size;if(!(style.graphicWidth&&style.graphicHeight)){var img=new Image();img.onreadystatechange=OpenLayers.Function.bind(function(){if(img.readyState=="complete"||img.readyState=="interactive"){aspectRatio=img.width/img.height;size=Math.max(style.pointRadius*2,style.graphicWidth||0,style.graphicHeight||0);xOffset=xOffset*aspectRatio;style.graphicWidth=size*aspectRatio;style.graphicHeight=size;this.graphicRotate(node,xOffset,yOffset);}},this);img.src=style.externalGraphic;return;}else{size=Math.max(style.graphicWidth,style.graphicHeight);aspectRatio=style.graphicWidth/style.graphicHeight;}
var width=Math.round(style.graphicWidth||size*aspectRatio);var height=Math.round(style.graphicHeight||size);node.style.width=width+"px";node.style.height=height+"px";var image=document.getElementById(node.id+"_image");if(!image){image=this.createNode("olv:imagedata",node.id+"_image");node.appendChild(image);}
image.style.width=width+"px";image.style.height=height+"px";image.src=style.externalGraphic;image.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader("+"src='', sizingMethod='scale')";var rotation=style.rotation*Math.PI/180;var sintheta=Math.sin(rotation);var costheta=Math.cos(rotation);var filter="progid:DXImageTransform.Microsoft.Matrix(M11="+costheta+",M12="+(-sintheta)+",M21="+sintheta+",M22="+costheta+",SizingMethod='auto expand')\n";var opacity=style.graphicOpacity||style.fillOpacity;if(opacity&&opacity!=1){filter+="progid:DXImageTransform.Microsoft.BasicImage(opacity="+
opacity+")\n";}
node.style.filter=filter;var centerPoint=new OpenLayers.Geometry.Point(-xOffset,-yOffset);var imgBox=new OpenLayers.Bounds(0,0,width,height).toGeometry();imgBox.rotate(style.rotation,centerPoint);var imgBounds=imgBox.getBounds();node.style.left=Math.round(parseInt(node.style.left)+imgBounds.left)+"px";node.style.top=Math.round(parseInt(node.style.top)-imgBounds.bottom)+"px";},postDraw:function(node){var fillColor=node._style.fillColor;var strokeColor=node._style.strokeColor;if(fillColor=="none"&&node.fillcolor!=fillColor){node.fillcolor=fillColor;}
if(strokeColor=="none"&&node.strokecolor!=strokeColor){node.strokecolor=strokeColor;}},setNodeDimension:function(node,geometry){var bbox=geometry.getBounds();if(bbox){var resolution=this.getResolution();var scaledBox=new OpenLayers.Bounds((bbox.left/resolution-this.offset.x).toFixed(),(bbox.bottom/resolution-this.offset.y).toFixed(),(bbox.right/resolution-this.offset.x).toFixed(),(bbox.top/resolution-this.offset.y).toFixed());node.style.left=scaledBox.left+"px";node.style.top=scaledBox.top+"px";node.style.width=scaledBox.getWidth()+"px";node.style.height=scaledBox.getHeight()+"px";node.coordorigin=scaledBox.left+" "+scaledBox.top;node.coordsize=scaledBox.getWidth()+" "+scaledBox.getHeight();}},dashStyle:function(style){var dash=style.strokeDashstyle;switch(dash){case'solid':case'dot':case'dash':case'dashdot':case'longdash':case'longdashdot':return dash;default:var parts=dash.split(/[ ,]/);if(parts.length==2){if(1*parts[0]>=2*parts[1]){return"longdash";}
return(parts[0]==1||parts[1]==1)?"dot":"dash";}else if(parts.length==4){return(1*parts[0]>=2*parts[1])?"longdashdot":"dashdot";}
return"solid";}},createNode:function(type,id){var node=document.createElement(type);if(id){node.id=id;}
node.unselectable='on';node.onselectstart=function(){return(false);};return node;},nodeTypeCompare:function(node,type){var subType=type;var splitIndex=subType.indexOf(":");if(splitIndex!=-1){subType=subType.substr(splitIndex+1);}
var nodeName=node.nodeName;splitIndex=nodeName.indexOf(":");if(splitIndex!=-1){nodeName=nodeName.substr(splitIndex+1);}
return(subType==nodeName);},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div");},createRoot:function(suffix){return this.nodeFactory(this.container.id+suffix,"olv:group");},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1);},drawCircle:function(node,geometry,radius){if(!isNaN(geometry.x)&&!isNaN(geometry.y)){var resolution=this.getResolution();node.style.left=((geometry.x/resolution-this.offset.x).toFixed()-radius)+"px";node.style.top=((geometry.y/resolution-this.offset.y).toFixed()-radius)+"px";var diameter=radius*2;node.style.width=diameter+"px";node.style.height=diameter+"px";return node;}
return false;},drawLineString:function(node,geometry){return this.drawLine(node,geometry,false);},drawLinearRing:function(node,geometry){return this.drawLine(node,geometry,true);},drawLine:function(node,geometry,closeLine){this.setNodeDimension(node,geometry);var resolution=this.getResolution();var numComponents=geometry.components.length;var parts=new Array(numComponents);var comp,x,y;for(var i=0;i<numComponents;i++){comp=geometry.components[i];x=(comp.x/resolution-this.offset.x);y=(comp.y/resolution-this.offset.y);parts[i]=" "+x.toFixed()+","+y.toFixed()+" l ";}
var end=(closeLine)?" x e":" e";node.path="m"+parts.join("")+end;return node;},drawPolygon:function(node,geometry){this.setNodeDimension(node,geometry);var resolution=this.getResolution();var path=[];var linearRing,i,j,len,ilen,comp,x,y;for(j=0,len=geometry.components.length;j<len;j++){linearRing=geometry.components[j];path.push("m");for(i=0,ilen=linearRing.components.length;i<ilen;i++){comp=linearRing.components[i];x=comp.x/resolution-this.offset.x;y=comp.y/resolution-this.offset.y;path.push(" "+x.toFixed()+","+y.toFixed());if(i==0){path.push(" l");}}
path.push(" x ");}
path.push("e");node.path=path.join("");return node;},drawRectangle:function(node,geometry){var resolution=this.getResolution();node.style.left=(geometry.x/resolution-this.offset.x)+"px";node.style.top=(geometry.y/resolution-this.offset.y)+"px";node.style.width=geometry.width/resolution+"px";node.style.height=geometry.height/resolution+"px";return node;},drawText:function(featureId,style,location){var label=this.nodeFactory(featureId+this.LABEL_ID_SUFFIX,"olv:rect");var textbox=this.nodeFactory(featureId+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox");var resolution=this.getResolution();label.style.left=(location.x/resolution-this.offset.x).toFixed()+"px";label.style.top=(location.y/resolution-this.offset.y).toFixed()+"px";label.style.flip="y";textbox.innerText=style.label;if(style.fillColor){textbox.style.color=style.fontColor;}
if(style.fontFamily){textbox.style.fontFamily=style.fontFamily;}
if(style.fontSize){textbox.style.fontSize=style.fontSize;}
if(style.fontWeight){textbox.style.fontWeight=style.fontWeight;}
textbox.style.whiteSpace="nowrap";textbox.inset="1px,0px,0px,0px";if(!label.parentNode){label.appendChild(textbox);this.textRoot.appendChild(label);}
var align=style.labelAlign||"cm";var xshift=textbox.clientWidth*(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(0,1)]);var yshift=textbox.clientHeight*(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(1,1)]);label.style.left=parseInt(label.style.left)-xshift-1+"px";label.style.top=parseInt(label.style.top)+yshift+"px";},drawSurface:function(node,geometry){this.setNodeDimension(node,geometry);var resolution=this.getResolution();var path=[];var comp,x,y;for(var i=0,len=geometry.components.length;i<len;i++){comp=geometry.components[i];x=comp.x/resolution-this.offset.x;y=comp.y/resolution-this.offset.y;if((i%3)==0&&(i/3)==0){path.push("m");}else if((i%3)==1){path.push(" c");}
path.push(" "+x+","+y);}
path.push(" x e");node.path=path.join("");return node;},moveRoot:function(renderer){var layer=this.map.getLayer(renderer.container.id);if(layer instanceof OpenLayers.Layer.Vector.RootContainer){layer=this.map.getLayer(this.container.id);}
layer&&layer.renderer.clear();OpenLayers.Renderer.Elements.prototype.moveRoot.apply(this,arguments);layer&&layer.redraw();},importSymbol:function(graphicName){var id=this.container.id+"-"+graphicName;var cache=this.symbolCache[id];if(cache){return cache;}
var symbol=OpenLayers.Renderer.symbol[graphicName];if(!symbol){throw new Error(graphicName+' is not a valid symbol name');return;}
var symbolExtent=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var pathitems=["m"];for(var i=0;i<symbol.length;i=i+2){x=symbol[i];y=symbol[i+1];symbolExtent.left=Math.min(symbolExtent.left,x);symbolExtent.bottom=Math.min(symbolExtent.bottom,y);symbolExtent.right=Math.max(symbolExtent.right,x);symbolExtent.top=Math.max(symbolExtent.top,y);pathitems.push(x);pathitems.push(y);if(i==0){pathitems.push("l");}}
pathitems.push("x e");var path=pathitems.join(" ");var diff=(symbolExtent.getWidth()-symbolExtent.getHeight())/2;if(diff>0){symbolExtent.bottom=symbolExtent.bottom-diff;symbolExtent.top=symbolExtent.top+diff;}else{symbolExtent.left=symbolExtent.left-diff;symbolExtent.right=symbolExtent.right+diff;}
cache={path:path,size:symbolExtent.getWidth(),left:symbolExtent.left,bottom:symbolExtent.bottom};this.symbolCache[id]=cache;return cache;},CLASS_NAME:"OpenLayers.Renderer.VML"});OpenLayers.Renderer.VML.LABEL_SHIFT={"l":0,"c":.5,"r":1,"t":0,"m":.5,"b":1};OpenLayers.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:false,initialize:function(layer,position,bounds,url,size){this.layer=layer;this.position=position.clone();this.bounds=bounds.clone();this.url=url;this.size=size.clone();this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload");}},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;this.events.destroy();this.events=null;},clone:function(obj){if(obj==null){obj=new OpenLayers.Tile(this.layer,this.position,this.bounds,this.url,this.size);}
OpenLayers.Util.applyDefaults(obj,this);return obj;},draw:function(){var maxExtent=this.layer.maxExtent;var withinMaxExtent=(maxExtent&&this.bounds.intersectsBounds(maxExtent,false));this.shouldDraw=(withinMaxExtent||this.layer.displayOutsideMaxExtent);this.clear();return this.shouldDraw;},moveTo:function(bounds,position,redraw){if(redraw==null){redraw=true;}
this.bounds=bounds.clone();this.position=position.clone();if(redraw){this.draw();}},clear:function(){},getBoundsFromBaseLayer:function(position){var msg=OpenLayers.i18n('reprojectDeprecated',{'layerName':this.layer.name});OpenLayers.Console.warn(msg);var topLeft=this.layer.map.getLonLatFromLayerPx(position);var bottomRightPx=position.clone();bottomRightPx.x+=this.size.w;bottomRightPx.y+=this.size.h;var bottomRight=this.layer.map.getLonLatFromLayerPx(bottomRightPx);if(topLeft.lon>bottomRight.lon){if(topLeft.lon<0){topLeft.lon=-180-(topLeft.lon+180);}else{bottomRight.lon=180+bottomRight.lon+180;}}
var bounds=new OpenLayers.Bounds(topLeft.lon,bottomRight.lat,bottomRight.lon,topLeft.lat);return bounds;},showTile:function(){if(this.shouldDraw){this.show();}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Format.XML=OpenLayers.Class(OpenLayers.Format,{namespaces:null,namespaceAlias:null,defaultPrefix:null,readers:{},writers:{},xmldom:null,initialize:function(options){if(window.ActiveXObject){this.xmldom=new ActiveXObject("Microsoft.XMLDOM");}
OpenLayers.Format.prototype.initialize.apply(this,[options]);this.namespaces=OpenLayers.Util.extend({},this.namespaces);this.namespaceAlias={};for(var alias in this.namespaces){this.namespaceAlias[this.namespaces[alias]]=alias;}},destroy:function(){this.xmldom=null;OpenLayers.Format.prototype.destroy.apply(this,arguments);},setNamespace:function(alias,uri){this.namespaces[alias]=uri;this.namespaceAlias[uri]=alias;},read:function(text){var index=text.indexOf('<');if(index>0){text=text.substring(index);}
var node=OpenLayers.Util.Try(OpenLayers.Function.bind((function(){var xmldom;if(window.ActiveXObject&&!this.xmldom){xmldom=new ActiveXObject("Microsoft.XMLDOM");}else{xmldom=this.xmldom;}
xmldom.loadXML(text);return xmldom;}),this),function(){return new DOMParser().parseFromString(text,'text/xml');},function(){var req=new XMLHttpRequest();req.open("GET","data:"+"text/xml"+";charset=utf-8,"+encodeURIComponent(text),false);if(req.overrideMimeType){req.overrideMimeType("text/xml");}
req.send(null);return req.responseXML;});if(this.keepData){this.data=node;}
return node;},write:function(node){var data;if(this.xmldom){data=node.xml;}else{var serializer=new XMLSerializer();if(node.nodeType==1){var doc=document.implementation.createDocument("","",null);if(doc.importNode){node=doc.importNode(node,true);}
doc.appendChild(node);data=serializer.serializeToString(doc);}else{data=serializer.serializeToString(node);}}
return data;},createElementNS:function(uri,name){var element;if(this.xmldom){if(typeof uri=="string"){element=this.xmldom.createNode(1,name,uri);}else{element=this.xmldom.createNode(1,name,"");}}else{element=document.createElementNS(uri,name);}
return element;},createTextNode:function(text){var node;if(this.xmldom){node=this.xmldom.createTextNode(text);}else{node=document.createTextNode(text);}
return node;},getElementsByTagNameNS:function(node,uri,name){var elements=[];if(node.getElementsByTagNameNS){elements=node.getElementsByTagNameNS(uri,name);}else{var allNodes=node.getElementsByTagName("*");var potentialNode,fullName;for(var i=0,len=allNodes.length;i<len;++i){potentialNode=allNodes[i];fullName=(potentialNode.prefix)?(potentialNode.prefix+":"+name):name;if((name=="*")||(fullName==potentialNode.nodeName)){if((uri=="*")||(uri==potentialNode.namespaceURI)){elements.push(potentialNode);}}}}
return elements;},getAttributeNodeNS:function(node,uri,name){var attributeNode=null;if(node.getAttributeNodeNS){attributeNode=node.getAttributeNodeNS(uri,name);}else{var attributes=node.attributes;var potentialNode,fullName;for(var i=0,len=attributes.length;i<len;++i){potentialNode=attributes[i];if(potentialNode.namespaceURI==uri){fullName=(potentialNode.prefix)?(potentialNode.prefix+":"+name):name;if(fullName==potentialNode.nodeName){attributeNode=potentialNode;break;}}}}
return attributeNode;},getAttributeNS:function(node,uri,name){var attributeValue="";if(node.getAttributeNS){attributeValue=node.getAttributeNS(uri,name)||"";}else{var attributeNode=this.getAttributeNodeNS(node,uri,name);if(attributeNode){attributeValue=attributeNode.nodeValue;}}
return attributeValue;},getChildValue:function(node,def){var value=def||"";if(node){for(var child=node.firstChild;child;child=child.nextSibling){switch(child.nodeType){case 3:case 4:value+=child.nodeValue;}}}
return value;},concatChildValues:function(node,def){var value="";var child=node.firstChild;var childValue;while(child){childValue=child.nodeValue;if(childValue){value+=childValue;}
child=child.nextSibling;}
if(value==""&&def!=undefined){value=def;}
return value;},isSimpleContent:function(node){var simple=true;for(var child=node.firstChild;child;child=child.nextSibling){if(child.nodeType===1){simple=false;break;}}
return simple;},contentType:function(node){var simple=false,complex=false;var type=OpenLayers.Format.XML.CONTENT_TYPE.EMPTY;for(var child=node.firstChild;child;child=child.nextSibling){switch(child.nodeType){case 1:complex=true;break;case 8:break;default:simple=true;}
if(complex&&simple){break;}}
if(complex&&simple){type=OpenLayers.Format.XML.CONTENT_TYPE.MIXED;}else if(complex){return OpenLayers.Format.XML.CONTENT_TYPE.COMPLEX;}else if(simple){return OpenLayers.Format.XML.CONTENT_TYPE.SIMPLE;}
return type;},hasAttributeNS:function(node,uri,name){var found=false;if(node.hasAttributeNS){found=node.hasAttributeNS(uri,name);}else{found=!!this.getAttributeNodeNS(node,uri,name);}
return found;},setAttributeNS:function(node,uri,name,value){if(node.setAttributeNS){node.setAttributeNS(uri,name,value);}else{if(this.xmldom){if(uri){var attribute=node.ownerDocument.createNode(2,name,uri);attribute.nodeValue=value;node.setAttributeNode(attribute);}else{node.setAttribute(name,value);}}else{throw"setAttributeNS not implemented";}}},createElementNSPlus:function(name,options){options=options||{};var uri=options.uri||this.namespaces[options.prefix];if(!uri){var loc=name.indexOf(":");uri=this.namespaces[name.substring(0,loc)];}
if(!uri){uri=this.namespaces[this.defaultPrefix];}
var node=this.createElementNS(uri,name);if(options.attributes){this.setAttributes(node,options.attributes);}
var value=options.value;if(value!=null){if(typeof value=="boolean"){value=String(value);}
node.appendChild(this.createTextNode(value));}
return node;},setAttributes:function(node,obj){var value,uri;for(var name in obj){if(obj[name]!=null&&obj[name].toString){value=obj[name].toString();uri=this.namespaces[name.substring(0,name.indexOf(":"))]||null;this.setAttributeNS(node,uri,name,value);}}},readNode:function(node,obj){if(!obj){obj={};}
var group=this.readers[this.namespaceAlias[node.namespaceURI]];if(group){var local=node.localName||node.nodeName.split(":").pop();var reader=group[local]||group["*"];if(reader){reader.apply(this,[node,obj]);}}
return obj;},readChildNodes:function(node,obj){if(!obj){obj={};}
var children=node.childNodes;var child;for(var i=0,len=children.length;i<len;++i){child=children[i];if(child.nodeType==1){this.readNode(child,obj);}}
return obj;},writeNode:function(name,obj,parent){var prefix,local;var split=name.indexOf(":");if(split>0){prefix=name.substring(0,split);local=name.substring(split+1);}else{if(parent){prefix=this.namespaceAlias[parent.namespaceURI];}else{prefix=this.defaultPrefix;}
local=name;}
var child=this.writers[prefix][local].apply(this,[obj]);if(parent){parent.appendChild(child);}
return child;},getChildEl:function(node,name,uri){return node&&this.getThisOrNextEl(node.firstChild,name,uri);},getNextEl:function(node,name,uri){return node&&this.getThisOrNextEl(node.nextSibling,name,uri);},getThisOrNextEl:function(node,name,uri){outer:for(var sibling=node;sibling;sibling=sibling.nextSibling){switch(sibling.nodeType){case 1:if((!name||name===(sibling.localName||sibling.nodeName.split(":").pop()))&&(!uri||uri===sibling.namespaceURI)){break outer;}
sibling=null;break outer;case 3:if(/^\s*$/.test(sibling.nodeValue)){break;}
case 4:case 6:case 12:case 10:case 11:sibling=null;break outer;}}
return sibling||null;},lookupNamespaceURI:function(node,prefix){var uri=null;if(node){if(node.lookupNamespaceURI){uri=node.lookupNamespaceURI(prefix);}else{outer:switch(node.nodeType){case 1:if(node.namespaceURI!==null&&node.prefix===prefix){uri=node.namespaceURI;break outer;}
var len=node.attributes.length;if(len){var attr;for(var i=0;i<len;++i){attr=node.attributes[i];if(attr.prefix==="xmlns"&&attr.name==="xmlns:"+prefix){uri=attr.value||null;break outer;}else if(attr.name==="xmlns"&&prefix===null){uri=attr.value||null;break outer;}}}
uri=this.lookupNamespaceURI(node.parentNode,prefix);break outer;case 2:uri=this.lookupNamespaceURI(node.ownerElement,prefix);break outer;case 9:uri=this.lookupNamespaceURI(node.documentElement,prefix);break outer;case 6:case 12:case 10:case 11:break outer;default:uri=this.lookupNamespaceURI(node.parentNode,prefix);break outer;}}}
return uri;},CLASS_NAME:"OpenLayers.Format.XML"});OpenLayers.Format.XML.CONTENT_TYPE={EMPTY:0,SIMPLE:1,COMPLEX:2,MIXED:3};OpenLayers.Format.XML.lookupNamespaceURI=OpenLayers.Function.bind(OpenLayers.Format.XML.prototype.lookupNamespaceURI,OpenLayers.Format.XML.prototype);OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:false,evt:null,initialize:function(control,callbacks,options){OpenLayers.Util.extend(this,options);this.control=control;this.callbacks=callbacks;if(control.map){this.setMap(control.map);}
OpenLayers.Util.extend(this,options);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},setMap:function(map){this.map=map;},checkModifiers:function(evt){if(this.keyMask==null){return true;}
var keyModifiers=(evt.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(evt.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(evt.altKey?OpenLayers.Handler.MOD_ALT:0);return(keyModifiers==this.keyMask);},activate:function(){if(this.active){return false;}
var events=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var i=0,len=events.length;i<len;i++){if(this[events[i]]){this.register(events[i],this[events[i]]);}}
this.active=true;return true;},deactivate:function(){if(!this.active){return false;}
var events=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var i=0,len=events.length;i<len;i++){if(this[events[i]]){this.unregister(events[i],this[events[i]]);}}
this.active=false;return true;},callback:function(name,args){if(name&&this.callbacks[name]){this.callbacks[name].apply(this.control,args);}},register:function(name,method){this.map.events.registerPriority(name,this,method);this.map.events.registerPriority(name,this,this.setEvent);},unregister:function(name,method){this.map.events.unregister(name,this,method);this.map.events.unregister(name,this,this.setEvent);},setEvent:function(evt){this.evt=evt;return true;},destroy:function(){this.deactivate();this.control=this.map=null;},CLASS_NAME:"OpenLayers.Handler"});OpenLayers.Handler.MOD_NONE=0;OpenLayers.Handler.MOD_SHIFT=1;OpenLayers.Handler.MOD_CTRL=2;OpenLayers.Handler.MOD_ALT=4;OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1000},EVENT_TYPES:["preaddlayer","addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer"],id:null,fractionalZoom:false,events:null,allOverlays:false,div:null,dragging:false,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,viewRequestID:0,tileSize:null,projection:"EPSG:4326",units:'degrees',resolutions:null,maxResolution:1.40625,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:true,panTween:null,eventListeners:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,paddingForPopups:null,initialize:function(div,options){if(arguments.length===1&&typeof div==="object"){options=div;div=options&&options.div;}
this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+'theme/default/style.css';OpenLayers.Util.extend(this,options);this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(div);if(!this.div){this.div=document.createElement("div");this.div.style.height="1px";this.div.style.width="1px";}
OpenLayers.Element.addClass(this.div,'olMap');var id=this.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.viewPortDiv.className="olMapViewport";this.div.appendChild(this.viewPortDiv);id=this.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,this.div,this.EVENT_TYPES,this.fallThrough,{includeXY:true});this.updateSize();if(this.eventListeners instanceof Object){this.events.on(this.eventListeners);}
this.events.register("movestart",this,this.updateSize);if(OpenLayers.String.contains(navigator.appName,"Microsoft")){this.events.register("resize",this,this.updateSize);}else{this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,this);OpenLayers.Event.observe(window,'resize',this.updateSizeDestroy);}
if(this.theme){var addNode=true;var nodes=document.getElementsByTagName('link');for(var i=0,len=nodes.length;i<len;++i){if(OpenLayers.Util.isEquivalentUrl(nodes.item(i).href,this.theme)){addNode=false;break;}}
if(addNode){var cssNode=document.createElement('link');cssNode.setAttribute('rel','stylesheet');cssNode.setAttribute('type','text/css');cssNode.setAttribute('href',this.theme);document.getElementsByTagName('head')[0].appendChild(cssNode);}}
this.layers=[];if(this.controls==null){if(OpenLayers.Control!=null){this.controls=[new OpenLayers.Control.Navigation(),new OpenLayers.Control.PanZoom(),new OpenLayers.Control.ArgParser(),new OpenLayers.Control.Attribution()];}else{this.controls=[];}}
for(var i=0,len=this.controls.length;i<len;i++){this.addControlToMap(this.controls[i]);}
this.popups=[];this.unloadDestroy=OpenLayers.Function.bind(this.destroy,this);OpenLayers.Event.observe(window,'unload',this.unloadDestroy);},render:function(div){this.div=OpenLayers.Util.getElement(div);OpenLayers.Element.addClass(this.div,'olMap');this.events.attachToElement(this.div);this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);this.div.appendChild(this.viewPortDiv);this.updateSize();},unloadDestroy:null,updateSizeDestroy:null,destroy:function(){if(!this.unloadDestroy){return false;}
OpenLayers.Event.stopObserving(window,'unload',this.unloadDestroy);this.unloadDestroy=null;if(this.updateSizeDestroy){OpenLayers.Event.stopObserving(window,'resize',this.updateSizeDestroy);}else{this.events.unregister("resize",this,this.updateSize);}
this.paddingForPopups=null;if(this.controls!=null){for(var i=this.controls.length-1;i>=0;--i){this.controls[i].destroy();}
this.controls=null;}
if(this.layers!=null){for(var i=this.layers.length-1;i>=0;--i){this.layers[i].destroy(false);}
this.layers=null;}
if(this.viewPortDiv){this.div.removeChild(this.viewPortDiv);}
this.viewPortDiv=null;if(this.eventListeners){this.events.un(this.eventListeners);this.eventListeners=null;}
this.events.destroy();this.events=null;},setOptions:function(options){OpenLayers.Util.extend(this,options);},getTileSize:function(){return this.tileSize;},getBy:function(array,property,match){var test=(typeof match.test=="function");var found=OpenLayers.Array.filter(this[array],function(item){return item[property]==match||(test&&match.test(item[property]));});return found;},getLayersBy:function(property,match){return this.getBy("layers",property,match);},getLayersByName:function(match){return this.getLayersBy("name",match);},getLayersByClass:function(match){return this.getLayersBy("CLASS_NAME",match);},getControlsBy:function(property,match){return this.getBy("controls",property,match);},getControlsByClass:function(match){return this.getControlsBy("CLASS_NAME",match);},getLayer:function(id){var foundLayer=null;for(var i=0,len=this.layers.length;i<len;i++){var layer=this.layers[i];if(layer.id==id){foundLayer=layer;break;}}
return foundLayer;},setLayerZIndex:function(layer,zIdx){layer.setZIndex(this.Z_INDEX_BASE[layer.isBaseLayer?'BaseLayer':'Overlay']
+zIdx*5);},resetLayersZIndex:function(){for(var i=0,len=this.layers.length;i<len;i++){var layer=this.layers[i];this.setLayerZIndex(layer,i);}},addLayer:function(layer){for(var i=0,len=this.layers.length;i<len;i++){if(this.layers[i]==layer){var msg=OpenLayers.i18n('layerAlreadyAdded',{'layerName':layer.name});OpenLayers.Console.warn(msg);return false;}}
if(this.allOverlays){layer.isBaseLayer=false;}
this.events.triggerEvent("preaddlayer",{layer:layer});layer.div.className="olLayerDiv";layer.div.style.overflow="";this.setLayerZIndex(layer,this.layers.length);if(layer.isFixed){this.viewPortDiv.appendChild(layer.div);}else{this.layerContainerDiv.appendChild(layer.div);}
this.layers.push(layer);layer.setMap(this);if(layer.isBaseLayer||(this.allOverlays&&!this.baseLayer)){if(this.baseLayer==null){this.setBaseLayer(layer);}else{layer.setVisibility(false);}}else{layer.redraw();}
this.events.triggerEvent("addlayer",{layer:layer});layer.afterAdd();},addLayers:function(layers){for(var i=0,len=layers.length;i<len;i++){this.addLayer(layers[i]);}},removeLayer:function(layer,setNewBaseLayer){if(setNewBaseLayer==null){setNewBaseLayer=true;}
if(layer.isFixed){this.viewPortDiv.removeChild(layer.div);}else{this.layerContainerDiv.removeChild(layer.div);}
OpenLayers.Util.removeItem(this.layers,layer);layer.removeMap(this);layer.map=null;if(this.baseLayer==layer){this.baseLayer=null;if(setNewBaseLayer){for(var i=0,len=this.layers.length;i<len;i++){var iLayer=this.layers[i];if(iLayer.isBaseLayer||this.allOverlays){this.setBaseLayer(iLayer);break;}}}}
this.resetLayersZIndex();this.events.triggerEvent("removelayer",{layer:layer});},getNumLayers:function(){return this.layers.length;},getLayerIndex:function(layer){return OpenLayers.Util.indexOf(this.layers,layer);},setLayerIndex:function(layer,idx){var base=this.getLayerIndex(layer);if(idx<0){idx=0;}else if(idx>this.layers.length){idx=this.layers.length;}
if(base!=idx){this.layers.splice(base,1);this.layers.splice(idx,0,layer);for(var i=0,len=this.layers.length;i<len;i++){this.setLayerZIndex(this.layers[i],i);}
this.events.triggerEvent("changelayer",{layer:layer,property:"order"});if(this.allOverlays){if(idx===0){this.setBaseLayer(layer);}else if(this.baseLayer!==this.layers[0]){this.setBaseLayer(this.layers[0]);}}}},raiseLayer:function(layer,delta){var idx=this.getLayerIndex(layer)+delta;this.setLayerIndex(layer,idx);},setBaseLayer:function(newBaseLayer){var oldExtent=null;if(this.baseLayer){oldExtent=this.baseLayer.getExtent();}
if(newBaseLayer!=this.baseLayer){if(OpenLayers.Util.indexOf(this.layers,newBaseLayer)!=-1){if(this.baseLayer!=null&&!this.allOverlays){this.baseLayer.setVisibility(false);}
this.baseLayer=newBaseLayer;this.viewRequestID++;if(!this.allOverlays){this.baseLayer.visibility=true;}
var center=this.getCenter();if(center!=null){var newCenter=(oldExtent)?oldExtent.getCenterLonLat():center;var newZoom=(oldExtent)?this.getZoomForExtent(oldExtent,true):this.getZoomForResolution(this.resolution,true);this.setCenter(newCenter,newZoom,false,true);}
this.events.triggerEvent("changebaselayer",{layer:this.baseLayer});}}},addControl:function(control,px){this.controls.push(control);this.addControlToMap(control,px);},addControlToMap:function(control,px){control.outsideViewport=(control.div!=null);if(this.displayProjection&&!control.displayProjection){control.displayProjection=this.displayProjection;}
control.setMap(this);var div=control.draw(px);if(div){if(!control.outsideViewport){div.style.zIndex=this.Z_INDEX_BASE['Control']+
this.controls.length;this.viewPortDiv.appendChild(div);}}},getControl:function(id){var returnControl=null;for(var i=0,len=this.controls.length;i<len;i++){var control=this.controls[i];if(control.id==id){returnControl=control;break;}}
return returnControl;},removeControl:function(control){if((control)&&(control==this.getControl(control.id))){if(control.div&&(control.div.parentNode==this.viewPortDiv)){this.viewPortDiv.removeChild(control.div);}
OpenLayers.Util.removeItem(this.controls,control);}},addPopup:function(popup,exclusive){if(exclusive){for(var i=this.popups.length-1;i>=0;--i){this.removePopup(this.popups[i]);}}
popup.map=this;this.popups.push(popup);var popupDiv=popup.draw();if(popupDiv){popupDiv.style.zIndex=this.Z_INDEX_BASE['Popup']+
this.popups.length;this.layerContainerDiv.appendChild(popupDiv);}},removePopup:function(popup){OpenLayers.Util.removeItem(this.popups,popup);if(popup.div){try{this.layerContainerDiv.removeChild(popup.div);}
catch(e){}}
popup.map=null;},getSize:function(){var size=null;if(this.size!=null){size=this.size.clone();}
return size;},updateSize:function(){this.events.clearMouseCache();var newSize=this.getCurrentSize();var oldSize=this.getSize();if(oldSize==null){this.size=oldSize=newSize;}
if(!newSize.equals(oldSize)){this.size=newSize;for(var i=0,len=this.layers.length;i<len;i++){this.layers[i].onMapResize();}
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||isNaN(size.w)&&isNaN(size.h)){var dim=OpenLayers.Element.getDimensions(this.div);size.w=dim.width;size.h=dim.height;}
if(size.w==0&&size.h==0||isNaN(size.w)&&isNaN(size.h)){size.w=parseInt(this.div.style.width);size.h=parseInt(this.div.style.height);}
return size;},calculateBounds:function(center,resolution){var extent=null;if(center==null){center=this.getCenter();}
if(resolution==null){resolution=this.getResolution();}
if((center!=null)&&(resolution!=null)){var size=this.getSize();var w_deg=size.w*resolution;var h_deg=size.h*resolution;extent=new OpenLayers.Bounds(center.lon-w_deg/2,center.lat-h_deg/2,center.lon+w_deg/2,center.lat+h_deg/2);}
return extent;},getCenter:function(){var center=null;if(this.center){center=this.center.clone();}
return center;},getZoom:function(){return this.zoom;},pan:function(dx,dy,options){options=OpenLayers.Util.applyDefaults(options,{animate:true,dragging:false});var centerPx=this.getViewPortPxFromLonLat(this.getCenter());var newCenterPx=centerPx.add(dx,dy);if(!options.dragging||!newCenterPx.equals(centerPx)){var newCenterLonLat=this.getLonLatFromViewPortPx(newCenterPx);if(options.animate){this.panTo(newCenterLonLat);}else{this.setCenter(newCenterLonLat,null,options.dragging);}}},panTo:function(lonlat){if(this.panMethod&&this.getExtent().scale(this.panRatio).containsLonLat(lonlat)){if(!this.panTween){this.panTween=new OpenLayers.Tween(this.panMethod);}
var center=this.getCenter();if(lonlat.lon==center.lon&&lonlat.lat==center.lat){return;}
var from={lon:center.lon,lat:center.lat};var to={lon:lonlat.lon,lat:lonlat.lat};this.panTween.start(from,to,this.panDuration,{callbacks:{start:OpenLayers.Function.bind(function(lonlat){this.events.triggerEvent("movestart");},this),eachStep:OpenLayers.Function.bind(function(lonlat){lonlat=new OpenLayers.LonLat(lonlat.lon,lonlat.lat);this.moveTo(lonlat,this.zoom,{'dragging':true,'noEvent':true});},this),done:OpenLayers.Function.bind(function(lonlat){lonlat=new OpenLayers.LonLat(lonlat.lon,lonlat.lat);this.moveTo(lonlat,this.zoom,{'noEvent':true});this.events.triggerEvent("moveend");},this)}});}else{this.setCenter(lonlat);}},setCenter:function(lonlat,zoom,dragging,forceZoomChange){this.moveTo(lonlat,zoom,{'dragging':dragging,'forceZoomChange':forceZoomChange,'caller':'setCenter'});},moveTo:function(lonlat,zoom,options){if(!options){options={};}
var dragging=options.dragging;var forceZoomChange=options.forceZoomChange;var noEvent=options.noEvent;if(this.panTween&&options.caller=="setCenter"){this.panTween.stop();}
if(!this.center&&!this.isValidLonLat(lonlat)){lonlat=this.maxExtent.getCenterLonLat();}
if(this.restrictedExtent!=null){if(lonlat==null){lonlat=this.getCenter();}
if(zoom==null){zoom=this.getZoom();}
var resolution=this.getResolutionForZoom(zoom);var extent=this.calculateBounds(lonlat,resolution);if(!this.restrictedExtent.containsBounds(extent)){var maxCenter=this.restrictedExtent.getCenterLonLat();if(extent.getWidth()>this.restrictedExtent.getWidth()){lonlat=new OpenLayers.LonLat(maxCenter.lon,lonlat.lat);}else if(extent.left<this.restrictedExtent.left){lonlat=lonlat.add(this.restrictedExtent.left-
extent.left,0);}else if(extent.right>this.restrictedExtent.right){lonlat=lonlat.add(this.restrictedExtent.right-
extent.right,0);}
if(extent.getHeight()>this.restrictedExtent.getHeight()){lonlat=new OpenLayers.LonLat(lonlat.lon,maxCenter.lat);}else if(extent.bottom<this.restrictedExtent.bottom){lonlat=lonlat.add(0,this.restrictedExtent.bottom-
extent.bottom);}
else if(extent.top>this.restrictedExtent.top){lonlat=lonlat.add(0,this.restrictedExtent.top-
extent.top);}}}
var zoomChanged=forceZoomChange||((this.isValidZoomLevel(zoom))&&(zoom!=this.getZoom()));var centerChanged=(this.isValidLonLat(lonlat))&&(!lonlat.equals(this.center));if(zoomChanged||centerChanged||!dragging){if(!this.dragging&&!noEvent){this.events.triggerEvent("movestart");}
if(centerChanged){if((!zoomChanged)&&(this.center)){this.centerLayerContainer(lonlat);}
this.center=lonlat.clone();}
if((zoomChanged)||(this.layerContainerOrigin==null)){this.layerContainerOrigin=this.center.clone();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px";}
if(zoomChanged){this.zoom=zoom;this.resolution=this.getResolutionForZoom(zoom);this.viewRequestID++;}
var bounds=this.getExtent();if(this.baseLayer.visibility){this.baseLayer.moveTo(bounds,zoomChanged,dragging);if(dragging){this.baseLayer.events.triggerEvent("move");}else{this.baseLayer.events.triggerEvent("moveend",{"zoomChanged":zoomChanged});}}
bounds=this.baseLayer.getExtent();for(var i=0,len=this.layers.length;i<len;i++){var layer=this.layers[i];if(layer!==this.baseLayer&&!layer.isBaseLayer){var inRange=layer.calculateInRange();if(layer.inRange!=inRange){layer.inRange=inRange;if(!inRange){layer.display(false);}
this.events.triggerEvent("changelayer",{layer:layer,property:"visibility"});}
if(inRange&&layer.visibility){layer.moveTo(bounds,zoomChanged,dragging);if(dragging){layer.events.triggerEvent("move");}else{layer.events.triggerEvent("moveend",{"zoomChanged":zoomChanged});}}}}
if(zoomChanged){for(var i=0,len=this.popups.length;i<len;i++){this.popups[i].updatePosition();}}
this.events.triggerEvent("move");if(zoomChanged){this.events.triggerEvent("zoomend");}}
if(!dragging&&!noEvent){this.events.triggerEvent("moveend");}
this.dragging=!!dragging;},centerLayerContainer:function(lonlat){var originPx=this.getViewPortPxFromLonLat(this.layerContainerOrigin);var newPx=this.getViewPortPxFromLonLat(lonlat);if((originPx!=null)&&(newPx!=null)){this.layerContainerDiv.style.left=Math.round(originPx.x-newPx.x)+"px";this.layerContainerDiv.style.top=Math.round(originPx.y-newPx.y)+"px";}},isValidZoomLevel:function(zoomLevel){return((zoomLevel!=null)&&(zoomLevel>=0)&&(zoomLevel<this.getNumZoomLevels()));},isValidLonLat:function(lonlat){var valid=false;if(lonlat!=null){var maxExtent=this.getMaxExtent();valid=maxExtent.containsLonLat(lonlat);}
return valid;},getProjection:function(){var projection=this.getProjectionObject();return projection?projection.getCode():null;},getProjectionObject:function(){var projection=null;if(this.baseLayer!=null){projection=this.baseLayer.projection;}
return projection;},getMaxResolution:function(){var maxResolution=null;if(this.baseLayer!=null){maxResolution=this.baseLayer.maxResolution;}
return maxResolution;},getMaxExtent:function(options){var maxExtent=null;if(options&&options.restricted&&this.restrictedExtent){maxExtent=this.restrictedExtent;}else if(this.baseLayer!=null){maxExtent=this.baseLayer.maxExtent;}
return maxExtent;},getNumZoomLevels:function(){var numZoomLevels=null;if(this.baseLayer!=null){numZoomLevels=this.baseLayer.numZoomLevels;}
return numZoomLevels;},getExtent:function(){var extent=null;if(this.baseLayer!=null){extent=this.baseLayer.getExtent();}
return extent;},getResolution:function(){var resolution=null;if(this.baseLayer!=null){resolution=this.baseLayer.getResolution();}
return resolution;},getUnits:function(){var units=null;if(this.baseLayer!=null){units=this.baseLayer.units;}
return units;},getScale:function(){var scale=null;if(this.baseLayer!=null){var res=this.getResolution();var units=this.baseLayer.units;scale=OpenLayers.Util.getScaleFromResolution(res,units);}
return scale;},getZoomForExtent:function(bounds,closest){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForExtent(bounds,closest);}
return zoom;},getResolutionForZoom:function(zoom){var resolution=null;if(this.baseLayer){resolution=this.baseLayer.getResolutionForZoom(zoom);}
return resolution;},getZoomForResolution:function(resolution,closest){var zoom=null;if(this.baseLayer!=null){zoom=this.baseLayer.getZoomForResolution(resolution,closest);}
return zoom;},zoomTo:function(zoom){if(this.isValidZoomLevel(zoom)){this.setCenter(null,zoom);}},zoomIn:function(){this.zoomTo(this.getZoom()+1);},zoomOut:function(){this.zoomTo(this.getZoom()-1);},zoomToExtent:function(bounds,closest){var center=bounds.getCenterLonLat();if(this.baseLayer.wrapDateLine){var maxExtent=this.getMaxExtent();bounds=bounds.clone();while(bounds.right<bounds.left){bounds.right+=maxExtent.getWidth();}
center=bounds.getCenterLonLat().wrapDateLine(maxExtent);}
this.setCenter(center,this.getZoomForExtent(bounds,closest));},zoomToMaxExtent:function(options){var restricted=(options)?options.restricted:true;var maxExtent=this.getMaxExtent({'restricted':restricted});this.zoomToExtent(maxExtent);},zoomToScale:function(scale,closest){var res=OpenLayers.Util.getResolutionFromScale(scale,this.baseLayer.units);var size=this.getSize();var w_deg=size.w*res;var h_deg=size.h*res;var center=this.getCenter();var extent=new OpenLayers.Bounds(center.lon-w_deg/2,center.lat-h_deg/2,center.lon+w_deg/2,center.lat+h_deg/2);this.zoomToExtent(extent,closest);},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if(this.baseLayer!=null){lonlat=this.baseLayer.getLonLatFromViewPortPx(viewPortPx);}
return lonlat;},getViewPortPxFromLonLat:function(lonlat){var px=null;if(this.baseLayer!=null){px=this.baseLayer.getViewPortPxFromLonLat(lonlat);}
return px;},getLonLatFromPixel:function(px){return this.getLonLatFromViewPortPx(px);},getPixelFromLonLat:function(lonlat){var px=this.getViewPortPxFromLonLat(lonlat);px.x=Math.round(px.x);px.y=Math.round(px.y);return px;},getViewPortPxFromLayerPx:function(layerPx){var viewPortPx=null;if(layerPx!=null){var dX=parseInt(this.layerContainerDiv.style.left);var dY=parseInt(this.layerContainerDiv.style.top);viewPortPx=layerPx.add(dX,dY);}
return viewPortPx;},getLayerPxFromViewPortPx:function(viewPortPx){var layerPx=null;if(viewPortPx!=null){var dX=-parseInt(this.layerContainerDiv.style.left);var dY=-parseInt(this.layerContainerDiv.style.top);layerPx=viewPortPx.add(dX,dY);if(isNaN(layerPx.x)||isNaN(layerPx.y)){layerPx=null;}}
return layerPx;},getLonLatFromLayerPx:function(px){px=this.getViewPortPxFromLayerPx(px);return this.getLonLatFromViewPortPx(px);},getLayerPxFromLonLat:function(lonlat){var px=this.getPixelFromLonLat(lonlat);return this.getLayerPxFromViewPortPx(px);},CLASS_NAME:"OpenLayers.Map"});OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;OpenLayers.Marker=OpenLayers.Class({icon:null,lonlat:null,events:null,map:null,initialize:function(lonlat,icon){this.lonlat=lonlat;var newIcon=(icon)?icon:OpenLayers.Marker.defaultIcon();if(this.icon==null){this.icon=newIcon;}else{this.icon.url=newIcon.url;this.icon.size=newIcon.size;this.icon.offset=newIcon.offset;this.icon.calculateOffset=newIcon.calculateOffset;}
this.events=new OpenLayers.Events(this,this.icon.imageDiv,null);},destroy:function(){this.erase();this.map=null;this.events.destroy();this.events=null;if(this.icon!=null){this.icon.destroy();this.icon=null;}},draw:function(px){return this.icon.draw(px);},erase:function(){if(this.icon!=null){this.icon.erase();}},moveTo:function(px){if((px!=null)&&(this.icon!=null)){this.icon.moveTo(px);}
this.lonlat=this.map.getLonLatFromLayerPx(px);},isDrawn:function(){var isDrawn=(this.icon&&this.icon.isDrawn());return isDrawn;},onScreen:function(){var onScreen=false;if(this.map){var screenBounds=this.map.getExtent();onScreen=screenBounds.containsLonLat(this.lonlat);}
return onScreen;},inflate:function(inflate){if(this.icon){var newSize=new OpenLayers.Size(this.icon.size.w*inflate,this.icon.size.h*inflate);this.icon.setSize(newSize);}},setOpacity:function(opacity){this.icon.setOpacity(opacity);},setUrl:function(url){this.icon.setUrl(url);},display:function(display){this.icon.display(display);},CLASS_NAME:"OpenLayers.Marker"});OpenLayers.Marker.defaultIcon=function(){var url=OpenLayers.Util.getImagesLocation()+"marker.png";var size=new OpenLayers.Size(21,25);var calculateOffset=function(size){return new OpenLayers.Pixel(-(size.w/2),-size.h);};return new OpenLayers.Icon(url,size,null,calculateOffset);};OpenLayers.Request={DEFAULT_CONFIG:{method:"GET",url:window.location.href,async:true,user:undefined,password:undefined,params:null,proxy:OpenLayers.ProxyHost,headers:{},data:null,callback:function(){},success:null,failure:null,scope:null},events:new OpenLayers.Events(this,null,["complete","success","failure"]),issue:function(config){var defaultConfig=OpenLayers.Util.extend(this.DEFAULT_CONFIG,{proxy:OpenLayers.ProxyHost});config=OpenLayers.Util.applyDefaults(config,defaultConfig);var request=new OpenLayers.Request.XMLHttpRequest();var url=config.url;if(config.params){var paramString=OpenLayers.Util.getParameterString(config.params);if(paramString.length>0){var separator=(url.indexOf('?')>-1)?'&':'?';url+=separator+paramString;}}
if(config.proxy&&(url.indexOf("http")==0)){url=config.proxy+encodeURIComponent(url);}
request.open(config.method,url,config.async,config.user,config.password);for(var header in config.headers){request.setRequestHeader(header,config.headers[header]);}
var complete=(config.scope)?OpenLayers.Function.bind(config.callback,config.scope):config.callback;var success;if(config.success){success=(config.scope)?OpenLayers.Function.bind(config.success,config.scope):config.success;}
var failure;if(config.failure){failure=(config.scope)?OpenLayers.Function.bind(config.failure,config.scope):config.failure;}
var events=this.events;request.onreadystatechange=function(){if(request.readyState==OpenLayers.Request.XMLHttpRequest.DONE){var proceed=events.triggerEvent("complete",{request:request,config:config,requestUrl:url});if(proceed!==false){complete(request);if(!request.status||(request.status>=200&&request.status<300)){events.triggerEvent("success",{request:request,config:config,requestUrl:url});if(success){success(request);}}
if(request.status&&(request.status<200||request.status>=300)){events.triggerEvent("failure",{request:request,config:config,requestUrl:url});if(failure){failure(request);}}}}};if(config.async===false){request.send(config.data);}else{window.setTimeout(function(){request.send(config.data);},0);}
return request;},GET:function(config){config=OpenLayers.Util.extend(config,{method:"GET"});return OpenLayers.Request.issue(config);},POST:function(config){config=OpenLayers.Util.extend(config,{method:"POST"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml";}
return OpenLayers.Request.issue(config);},PUT:function(config){config=OpenLayers.Util.extend(config,{method:"PUT"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml";}
return OpenLayers.Request.issue(config);},DELETE:function(config){config=OpenLayers.Util.extend(config,{method:"DELETE"});return OpenLayers.Request.issue(config);},HEAD:function(config){config=OpenLayers.Util.extend(config,{method:"HEAD"});return OpenLayers.Request.issue(config);},OPTIONS:function(config){config=OpenLayers.Util.extend(config,{method:"OPTIONS"});return OpenLayers.Request.issue(config);}};OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:false,lastRatio:1,isFirstDraw:true,backBufferTile:null,initialize:function(layer,position,bounds,url,size){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=url;this.frame=document.createElement('div');this.frame.style.overflow='hidden';this.frame.style.position='absolute';this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack();},destroy:function(){if(this.imgDiv!=null){if(this.layerAlphaHack){OpenLayers.Event.stopObservingElement(this.imgDiv.childNodes[0].id);}
OpenLayers.Event.stopObservingElement(this.imgDiv.id);if(this.imgDiv.parentNode==this.frame){this.frame.removeChild(this.imgDiv);this.imgDiv.map=null;}
this.imgDiv.urls=null;this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif";}
this.imgDiv=null;if((this.frame!=null)&&(this.frame.parentNode==this.layer.div)){this.layer.div.removeChild(this.frame);}
this.frame=null;if(this.backBufferTile){this.backBufferTile.destroy();this.backBufferTile=null;}
this.layer.events.unregister("loadend",this,this.resetBackBuffer);OpenLayers.Tile.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Tile.Image(this.layer,this.position,this.bounds,this.url,this.size);}
obj=OpenLayers.Tile.prototype.clone.apply(this,[obj]);obj.imgDiv=null;return obj;},draw:function(){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject){this.bounds=this.getBoundsFromBaseLayer(this.position);}
var drawTile=OpenLayers.Tile.prototype.draw.apply(this,arguments);if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(drawTile){if(!this.backBufferTile){this.backBufferTile=this.clone();this.backBufferTile.hide();this.backBufferTile.isBackBuffer=true;this.events.register('loadend',this,this.resetBackBuffer);this.layer.events.register("loadend",this,this.resetBackBuffer);}
this.startTransition();}else{if(this.backBufferTile){this.backBufferTile.clear();}}}else{if(drawTile&&this.isFirstDraw){this.events.register('loadend',this,this.showTile);this.isFirstDraw=false;}}
if(!drawTile){return false;}
if(this.isLoading){this.events.triggerEvent("reload");}else{this.isLoading=true;this.events.triggerEvent("loadstart");}
return this.renderTile();},resetBackBuffer:function(){this.showTile();if(this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles)){this.isFirstDraw=false;var maxExtent=this.layer.maxExtent;var withinMaxExtent=(maxExtent&&this.bounds.intersectsBounds(maxExtent,false));if(withinMaxExtent){this.backBufferTile.position=this.position;this.backBufferTile.bounds=this.bounds;this.backBufferTile.size=this.size;this.backBufferTile.imageSize=this.layer.imageSize||this.size;this.backBufferTile.imageOffset=this.layer.imageOffset;this.backBufferTile.resolution=this.layer.getResolution();this.backBufferTile.renderTile();}
this.backBufferTile.hide();}},renderTile:function(){if(this.imgDiv==null){this.initImgDiv();}
this.imgDiv.viewRequestID=this.layer.map.viewRequestID;if(this.layer.async){this.layer.getURLasync(this.bounds,this,"url",this.positionImage);}else{if(this.layer.url instanceof Array){this.imgDiv.urls=this.layer.url.slice();}
this.url=this.layer.getURL(this.bounds);this.positionImage();}
return true;},positionImage:function(){if(this.layer==null)
return;OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var imageSize=this.layer.getImageSize();if(this.layerAlphaHack){OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,imageSize,this.url);}else{OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,imageSize);this.imgDiv.src=this.url;}},clear:function(){if(this.imgDiv){this.hide();if(OpenLayers.Tile.Image.useBlankTile){this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif";}}},initImgDiv:function(){var offset=this.layer.imageOffset;var size=this.layer.getImageSize();if(this.layerAlphaHack){this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,offset,size,null,"relative",null,null,null,true);}else{this.imgDiv=OpenLayers.Util.createImage(null,offset,size,null,"relative",null,null,true);}
this.imgDiv.className='olTileImage';this.frame.style.zIndex=this.isBackBuffer?0:1;this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);if(this.layer.opacity!=null){OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity);}
this.imgDiv.map=this.layer.map;var onload=function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("loadend");}};if(this.layerAlphaHack){OpenLayers.Event.observe(this.imgDiv.childNodes[0],'load',OpenLayers.Function.bind(onload,this));}else{OpenLayers.Event.observe(this.imgDiv,'load',OpenLayers.Function.bind(onload,this));}
var onerror=function(){if(this.imgDiv._attempts>OpenLayers.IMAGE_RELOAD_ATTEMPTS){onload.call(this);}};OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(onerror,this));},checkImgURL:function(){if(this.layer){var loaded=this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src;if(!OpenLayers.Util.isEquivalentUrl(loaded,this.url)){this.hide();}}},startTransition:function(){if(!this.backBufferTile||!this.backBufferTile.imgDiv){return;}
var ratio=1;if(this.backBufferTile.resolution){ratio=this.backBufferTile.resolution/this.layer.getResolution();}
if(ratio!=this.lastRatio){if(this.layer.transitionEffect=='resize'){var upperLeft=new OpenLayers.LonLat(this.backBufferTile.bounds.left,this.backBufferTile.bounds.top);var size=new OpenLayers.Size(this.backBufferTile.size.w*ratio,this.backBufferTile.size.h*ratio);var px=this.layer.map.getLayerPxFromLonLat(upperLeft);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,px,size);var imageSize=this.backBufferTile.imageSize;imageSize=new OpenLayers.Size(imageSize.w*ratio,imageSize.h*ratio);var imageOffset=this.backBufferTile.imageOffset;if(imageOffset){imageOffset=new OpenLayers.Pixel(imageOffset.x*ratio,imageOffset.y*ratio);}
OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,imageOffset,imageSize);this.backBufferTile.show();}}else{if(this.layer.singleTile){this.backBufferTile.show();}else{this.backBufferTile.hide();}}
this.lastRatio=ratio;},show:function(){this.frame.style.display='';if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1){this.frame.scrollLeft=this.frame.scrollLeft;}}},hide:function(){this.frame.style.display='none';},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.useBlankTile=(OpenLayers.Util.getBrowserName()=="safari"||OpenLayers.Util.getBrowserName()=="opera");OpenLayers.Control.OverviewMap=OpenLayers.Class(OpenLayers.Control,{element:null,ovmap:null,size:new OpenLayers.Size(180,90),layers:null,minRectSize:15,minRectDisplayClass:"RectReplacement",minRatio:8,maxRatio:32,mapOptions:null,autoPan:false,handlers:null,resolutionFactor:1,initialize:function(options){this.layers=[];this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,[options]);},destroy:function(){if(!this.mapDiv){return;}
this.handlers.click.destroy();this.mapDiv.removeChild(this.extentRectangle);this.extentRectangle=null;this.rectEvents.destroy();this.rectEvents=null;this.ovmap.destroy();this.ovmap=null;this.element.removeChild(this.mapDiv);this.mapDiv=null;this.div.removeChild(this.element);this.element=null;if(this.maximizeDiv){OpenLayers.Event.stopObservingElement(this.maximizeDiv);this.div.removeChild(this.maximizeDiv);this.maximizeDiv=null;}
if(this.minimizeDiv){OpenLayers.Event.stopObservingElement(this.minimizeDiv);this.div.removeChild(this.minimizeDiv);this.minimizeDiv=null;}
this.map.events.un({"moveend":this.update,"changebaselayer":this.baseLayerDraw,scope:this});OpenLayers.Control.prototype.destroy.apply(this,arguments);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!(this.layers.length>0)){if(this.map.baseLayer){var layer=this.map.baseLayer.clone();this.layers=[layer];}else{this.map.events.register("changebaselayer",this,this.baseLayerDraw);return this.div;}}
this.element=document.createElement('div');this.element.className=this.displayClass+'Element';this.element.style.display='none';this.mapDiv=document.createElement('div');this.mapDiv.style.width=this.size.w+'px';this.mapDiv.style.height=this.size.h+'px';this.mapDiv.style.position='relative';this.mapDiv.style.overflow='hidden';this.mapDiv.id=OpenLayers.Util.createUniqueID('overviewMap');this.extentRectangle=document.createElement('div');this.extentRectangle.style.position='absolute';this.extentRectangle.style.zIndex=1000;this.extentRectangle.className=this.displayClass+'ExtentRectangle';this.mapDiv.appendChild(this.extentRectangle);this.element.appendChild(this.mapDiv);this.div.appendChild(this.element);if(!this.outsideViewport){this.div.className+=" "+this.displayClass+'Container';var imgLocation=OpenLayers.Util.getImagesLocation();var img=imgLocation+'layer-switcher-maximize.png';this.maximizeDiv=OpenLayers.Util.createAlphaImageDiv(this.displayClass+'MaximizeButton',null,new OpenLayers.Size(18,18),img,'absolute');this.maximizeDiv.style.display='none';this.maximizeDiv.className=this.displayClass+'MaximizeButton';OpenLayers.Event.observe(this.maximizeDiv,'click',OpenLayers.Function.bindAsEventListener(this.maximizeControl,this));this.div.appendChild(this.maximizeDiv);var img=imgLocation+'layer-switcher-minimize.png';this.minimizeDiv=OpenLayers.Util.createAlphaImageDiv('OpenLayers_Control_minimizeDiv',null,new OpenLayers.Size(18,18),img,'absolute');this.minimizeDiv.style.display='none';this.minimizeDiv.className=this.displayClass+'MinimizeButton';OpenLayers.Event.observe(this.minimizeDiv,'click',OpenLayers.Function.bindAsEventListener(this.minimizeControl,this));this.div.appendChild(this.minimizeDiv);var eventsToStop=['dblclick','mousedown'];for(var i=0,len=eventsToStop.length;i<len;i++){OpenLayers.Event.observe(this.maximizeDiv,eventsToStop[i],OpenLayers.Event.stop);OpenLayers.Event.observe(this.minimizeDiv,eventsToStop[i],OpenLayers.Event.stop);}
this.minimizeControl();}else{this.element.style.display='';}
if(this.map.getExtent()){this.update();}
this.map.events.register('moveend',this,this.update);return this.div;},baseLayerDraw:function(){this.draw();this.map.events.unregister("changebaselayer",this,this.baseLayerDraw);},rectDrag:function(px){var deltaX=this.handlers.drag.last.x-px.x;var deltaY=this.handlers.drag.last.y-px.y;if(deltaX!=0||deltaY!=0){var rectTop=this.rectPxBounds.top;var rectLeft=this.rectPxBounds.left;var rectHeight=Math.abs(this.rectPxBounds.getHeight());var rectWidth=this.rectPxBounds.getWidth();var newTop=Math.max(0,(rectTop-deltaY));newTop=Math.min(newTop,this.ovmap.size.h-this.hComp-rectHeight);var newLeft=Math.max(0,(rectLeft-deltaX));newLeft=Math.min(newLeft,this.ovmap.size.w-this.wComp-rectWidth);this.setRectPxBounds(new OpenLayers.Bounds(newLeft,newTop+rectHeight,newLeft+rectWidth,newTop));}},mapDivClick:function(evt){var pxCenter=this.rectPxBounds.getCenterPixel();var deltaX=evt.xy.x-pxCenter.x;var deltaY=evt.xy.y-pxCenter.y;var top=this.rectPxBounds.top;var left=this.rectPxBounds.left;var height=Math.abs(this.rectPxBounds.getHeight());var width=this.rectPxBounds.getWidth();var newTop=Math.max(0,(top+deltaY));newTop=Math.min(newTop,this.ovmap.size.h-height);var newLeft=Math.max(0,(left+deltaX));newLeft=Math.min(newLeft,this.ovmap.size.w-width);this.setRectPxBounds(new OpenLayers.Bounds(newLeft,newTop+height,newLeft+width,newTop));this.updateMapToRect();},maximizeControl:function(e){this.element.style.display='';this.showToggle(false);if(e!=null){OpenLayers.Event.stop(e);}},minimizeControl:function(e){this.element.style.display='none';this.showToggle(true);if(e!=null){OpenLayers.Event.stop(e);}},showToggle:function(minimize){this.maximizeDiv.style.display=minimize?'':'none';this.minimizeDiv.style.display=minimize?'none':'';},update:function(){if(this.ovmap==null){this.createMap();}
if(this.autoPan||!this.isSuitableOverview()){this.updateOverview();}
this.updateRectToMap();},isSuitableOverview:function(){var mapExtent=this.map.getExtent();var maxExtent=this.map.maxExtent;var testExtent=new OpenLayers.Bounds(Math.max(mapExtent.left,maxExtent.left),Math.max(mapExtent.bottom,maxExtent.bottom),Math.min(mapExtent.right,maxExtent.right),Math.min(mapExtent.top,maxExtent.top));if(this.ovmap.getProjection()!=this.map.getProjection()){testExtent=testExtent.transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject());}
var resRatio=this.ovmap.getResolution()/this.map.getResolution();return((resRatio>this.minRatio)&&(resRatio<=this.maxRatio)&&(this.ovmap.getExtent().containsBounds(testExtent)));},updateOverview:function(){var mapRes=this.map.getResolution();var targetRes=this.ovmap.getResolution();var resRatio=targetRes/mapRes;if(resRatio>this.maxRatio){targetRes=this.minRatio*mapRes;}else if(resRatio<=this.minRatio){targetRes=this.maxRatio*mapRes;}
var center;if(this.ovmap.getProjection()!=this.map.getProjection()){center=this.map.center.clone();center.transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject());}else{center=this.map.center;}
this.ovmap.setCenter(center,this.ovmap.getZoomForResolution(targetRes*this.resolutionFactor));this.updateRectToMap();},createMap:function(){var options=OpenLayers.Util.extend({controls:[],maxResolution:'auto',fallThrough:false},this.mapOptions);this.ovmap=new OpenLayers.Map(this.mapDiv,options);OpenLayers.Event.stopObserving(window,'unload',this.ovmap.unloadDestroy);this.ovmap.addLayers(this.layers);this.ovmap.zoomToMaxExtent();this.wComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-left-width'))+
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-right-width'));this.wComp=(this.wComp)?this.wComp:2;this.hComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-top-width'))+
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,'border-bottom-width'));this.hComp=(this.hComp)?this.hComp:2;this.handlers.drag=new OpenLayers.Handler.Drag(this,{move:this.rectDrag,done:this.updateMapToRect},{map:this.ovmap});this.handlers.click=new OpenLayers.Handler.Click(this,{"click":this.mapDivClick},{"single":true,"double":false,"stopSingle":true,"stopDouble":true,"pixelTolerance":1,map:this.ovmap});this.handlers.click.activate();this.rectEvents=new OpenLayers.Events(this,this.extentRectangle,null,true);this.rectEvents.register("mouseover",this,function(e){if(!this.handlers.drag.active&&!this.map.dragging){this.handlers.drag.activate();}});this.rectEvents.register("mouseout",this,function(e){if(!this.handlers.drag.dragging){this.handlers.drag.deactivate();}});if(this.ovmap.getProjection()!=this.map.getProjection()){var sourceUnits=this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units;var targetUnits=this.ovmap.getProjectionObject().getUnits()||this.ovmap.units||this.ovmap.baseLayer.units;this.resolutionFactor=sourceUnits&&targetUnits?OpenLayers.INCHES_PER_UNIT[sourceUnits]/OpenLayers.INCHES_PER_UNIT[targetUnits]:1;}},updateRectToMap:function(){var bounds;if(this.ovmap.getProjection()!=this.map.getProjection()){bounds=this.map.getExtent().transform(this.map.getProjectionObject(),this.ovmap.getProjectionObject());}else{bounds=this.map.getExtent();}
var pxBounds=this.getRectBoundsFromMapBounds(bounds);if(pxBounds){this.setRectPxBounds(pxBounds);}},updateMapToRect:function(){var lonLatBounds=this.getMapBoundsFromRectBounds(this.rectPxBounds);if(this.ovmap.getProjection()!=this.map.getProjection()){lonLatBounds=lonLatBounds.transform(this.ovmap.getProjectionObject(),this.map.getProjectionObject());}
this.map.panTo(lonLatBounds.getCenterLonLat());},setRectPxBounds:function(pxBounds){var top=Math.max(pxBounds.top,0);var left=Math.max(pxBounds.left,0);var bottom=Math.min(pxBounds.top+Math.abs(pxBounds.getHeight()),this.ovmap.size.h-this.hComp);var right=Math.min(pxBounds.left+pxBounds.getWidth(),this.ovmap.size.w-this.wComp);var width=Math.max(right-left,0);var height=Math.max(bottom-top,0);if(width<this.minRectSize||height<this.minRectSize){this.extentRectangle.className=this.displayClass+
this.minRectDisplayClass;var rLeft=left+(width/2)-(this.minRectSize/2);var rTop=top+(height/2)-(this.minRectSize/2);this.extentRectangle.style.top=Math.round(rTop)+'px';this.extentRectangle.style.left=Math.round(rLeft)+'px';this.extentRectangle.style.height=this.minRectSize+'px';this.extentRectangle.style.width=this.minRectSize+'px';}else{this.extentRectangle.className=this.displayClass+'ExtentRectangle';this.extentRectangle.style.top=Math.round(top)+'px';this.extentRectangle.style.left=Math.round(left)+'px';this.extentRectangle.style.height=Math.round(height)+'px';this.extentRectangle.style.width=Math.round(width)+'px';}
this.rectPxBounds=new OpenLayers.Bounds(Math.round(left),Math.round(bottom),Math.round(right),Math.round(top));},getRectBoundsFromMapBounds:function(lonLatBounds){var leftBottomLonLat=new OpenLayers.LonLat(lonLatBounds.left,lonLatBounds.bottom);var rightTopLonLat=new OpenLayers.LonLat(lonLatBounds.right,lonLatBounds.top);var leftBottomPx=this.getOverviewPxFromLonLat(leftBottomLonLat);var rightTopPx=this.getOverviewPxFromLonLat(rightTopLonLat);var bounds=null;if(leftBottomPx&&rightTopPx){bounds=new OpenLayers.Bounds(leftBottomPx.x,leftBottomPx.y,rightTopPx.x,rightTopPx.y);}
return bounds;},getMapBoundsFromRectBounds:function(pxBounds){var leftBottomPx=new OpenLayers.Pixel(pxBounds.left,pxBounds.bottom);var rightTopPx=new OpenLayers.Pixel(pxBounds.right,pxBounds.top);var leftBottomLonLat=this.getLonLatFromOverviewPx(leftBottomPx);var rightTopLonLat=this.getLonLatFromOverviewPx(rightTopPx);return new OpenLayers.Bounds(leftBottomLonLat.lon,leftBottomLonLat.lat,rightTopLonLat.lon,rightTopLonLat.lat);},getLonLatFromOverviewPx:function(overviewMapPx){var size=this.ovmap.size;var res=this.ovmap.getResolution();var center=this.ovmap.getExtent().getCenterLonLat();var delta_x=overviewMapPx.x-(size.w/2);var delta_y=overviewMapPx.y-(size.h/2);return new OpenLayers.LonLat(center.lon+delta_x*res,center.lat-delta_y*res);},getOverviewPxFromLonLat:function(lonlat){var res=this.ovmap.getResolution();var extent=this.ovmap.getExtent();var px=null;if(extent){px=new OpenLayers.Pixel(Math.round(1/res*(lonlat.lon-extent.left)),Math.round(1/res*(extent.top-lonlat.lat)));}
return px;},CLASS_NAME:'OpenLayers.Control.OverviewMap'});OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:OpenLayers.Popup.AnchoredBubble,popup:null,initialize:function(layer,lonlat,data){this.layer=layer;this.lonlat=lonlat;this.data=(data!=null)?data:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){if((this.layer!=null)&&(this.layer.map!=null)){if(this.popup!=null){this.layer.map.removePopup(this.popup);}}
this.layer=null;this.id=null;this.lonlat=null;this.data=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null;}
if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null;}},onScreen:function(){var onScreen=false;if((this.layer!=null)&&(this.layer.map!=null)){var screenBounds=this.layer.map.getExtent();onScreen=screenBounds.containsLonLat(this.lonlat);}
return onScreen;},createMarker:function(){if(this.lonlat!=null){this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon);}
return this.marker;},destroyMarker:function(){this.marker.destroy();},createPopup:function(closeBox){if(this.lonlat!=null){var id=this.id+"_popup";var anchor=(this.marker)?this.marker.icon:null;if(!this.popup){this.popup=new this.popupClass(id,this.lonlat,this.data.popupSize,this.data.popupContentHTML,anchor,closeBox);}
if(this.data.overflow!=null){this.popup.contentDiv.style.overflow=this.data.overflow;}
this.popup.feature=this;}
return this.popup;},destroyPopup:function(){if(this.popup){this.popup.feature=null;this.popup.destroy();this.popup=null;}},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:true,'double':false,pixelTolerance:0,stopSingle:false,stopDouble:false,timerId:null,down:null,rightclickTimerId:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.pixelTolerance!=null){this.mousedown=function(evt){this.down=evt.xy;return true;};}},mousedown:null,mouseup:function(evt){var propagate=true;if(this.checkModifiers(evt)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(evt)){propagate=this.rightclick(evt);}
return propagate;},rightclick:function(evt){if(this.passesTolerance(evt)){if(this.rightclickTimerId!=null){this.clearTimer();this.callback('dblrightclick',[evt]);return!this.stopDouble;}else{var clickEvent=this['double']?OpenLayers.Util.extend({},evt):this.callback('rightclick',[evt]);var delayedRightCall=OpenLayers.Function.bind(this.delayedRightCall,this,clickEvent);this.rightclickTimerId=window.setTimeout(delayedRightCall,this.delay);}}
return!this.stopSingle;},delayedRightCall:function(evt){this.rightclickTimerId=null;if(evt){this.callback('rightclick',[evt]);}
return!this.stopSingle;},dblclick:function(evt){if(this.passesTolerance(evt)){if(this["double"]){this.callback('dblclick',[evt]);}
this.clearTimer();}
return!this.stopDouble;},click:function(evt){if(this.passesTolerance(evt)){if(this.timerId!=null){this.clearTimer();}else{var clickEvent=this.single?OpenLayers.Util.extend({},evt):null;this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,clickEvent),this.delay);}}
return!this.stopSingle;},passesTolerance:function(evt){var passes=true;if(this.pixelTolerance!=null&&this.down){var dpx=Math.sqrt(Math.pow(this.down.x-evt.xy.x,2)+
Math.pow(this.down.y-evt.xy.y,2));if(dpx>this.pixelTolerance){passes=false;}}
return passes;},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null;}
if(this.rightclickTimerId!=null){window.clearTimeout(this.rightclickTimerId);this.rightclickTimerId=null;}},delayedCall:function(evt){this.timerId=null;if(evt){this.callback('click',[evt]);}},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();this.down=null;deactivated=true;}
return deactivated;},CLASS_NAME:"OpenLayers.Handler.Click"});OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,last:null,start:null,oldOnselectstart:null,interval:0,timeoutId:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);},down:function(evt){},move:function(evt){},up:function(evt){},out:function(evt){},mousedown:function(evt){var propagate=true;this.dragging=false;if(this.checkModifiers(evt)&&OpenLayers.Event.isLeftClick(evt)){this.started=true;this.start=evt.xy;this.last=evt.xy;OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown");this.down(evt);this.callback("down",[evt.xy]);OpenLayers.Event.stop(evt);if(!this.oldOnselectstart){this.oldOnselectstart=(document.onselectstart)?document.onselectstart:function(){return true;};document.onselectstart=function(){return false;};}
propagate=!this.stopDown;}else{this.started=false;this.start=null;this.last=null;}
return propagate;},mousemove:function(evt){if(this.started&&!this.timeoutId&&(evt.xy.x!=this.last.x||evt.xy.y!=this.last.y)){if(this.interval>0){this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval);}
this.dragging=true;this.move(evt);this.callback("move",[evt.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=function(){return false;};}
this.last=this.evt.xy;}
return true;},removeTimeout:function(){this.timeoutId=null;},mouseup:function(evt){if(this.started){var dragged=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(evt);this.callback("up",[evt.xy]);if(dragged){this.callback("done",[evt.xy]);}
document.onselectstart=this.oldOnselectstart;}
return true;},mouseout:function(evt){if(this.started&&OpenLayers.Util.mouseLeft(evt,this.map.div)){var dragged=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(evt);this.callback("out",[]);if(dragged){this.callback("done",[evt.xy]);}
if(document.onselectstart){document.onselectstart=this.oldOnselectstart;}}
return true;},click:function(evt){return(this.start==this.last);},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;activated=true;}
return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.started=false;this.dragging=false;this.start=null;this.last=null;deactivated=true;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");}
return deactivated;},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{'click':{'in':'click','out':'clickout'},'mousemove':{'in':'over','out':'out'},'dblclick':{'in':'dblclick','out':null},'mousedown':{'in':null,'out':null},'mouseup':{'in':null,'out':null}},feature:null,lastFeature:null,down:null,up:null,clickTolerance:4,geometryTypes:null,stopClick:true,stopDown:true,stopUp:false,initialize:function(control,layer,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,[control,callbacks,options]);this.layer=layer;},mousedown:function(evt){this.down=evt.xy;return this.handle(evt)?!this.stopDown:true;},mouseup:function(evt){this.up=evt.xy;return this.handle(evt)?!this.stopUp:true;},click:function(evt){return this.handle(evt)?!this.stopClick:true;},mousemove:function(evt){if(!this.callbacks['over']&&!this.callbacks['out']){return true;}
this.handle(evt);return true;},dblclick:function(evt){return!this.handle(evt);},geometryTypeMatches:function(feature){return this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)>-1;},handle:function(evt){if(this.feature&&!this.feature.layer){this.feature=null;}
var type=evt.type;var handled=false;var previouslyIn=!!(this.feature);var click=(type=="click"||type=="dblclick");this.feature=this.layer.getFeatureFromEvent(evt);if(this.feature&&!this.feature.layer){this.feature=null;}
if(this.lastFeature&&!this.lastFeature.layer){this.lastFeature=null;}
if(this.feature){var inNew=(this.feature!=this.lastFeature);if(this.geometryTypeMatches(this.feature)){if(previouslyIn&&inNew){if(this.lastFeature){this.triggerCallback(type,'out',[this.lastFeature]);}
this.triggerCallback(type,'in',[this.feature]);}else if(!previouslyIn||click){this.triggerCallback(type,'in',[this.feature]);}
this.lastFeature=this.feature;handled=true;}else{if(this.lastFeature&&(previouslyIn&&inNew||click)){this.triggerCallback(type,'out',[this.lastFeature]);}
this.feature=null;}}else{if(this.lastFeature&&(previouslyIn||click)){this.triggerCallback(type,'out',[this.lastFeature]);}}
return handled;},triggerCallback:function(type,mode,args){var key=this.EVENTMAP[type][mode];if(key){if(type=='click'&&this.up&&this.down){var dpx=Math.sqrt(Math.pow(this.up.x-this.down.x,2)+
Math.pow(this.up.y-this.down.y,2));if(dpx<=this.clickTolerance){this.callback(key,args);}}else{this.callback(key,args);}}},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.moveLayerToTop();this.map.events.on({"removelayer":this.handleMapEvents,"changelayer":this.handleMapEvents,scope:this});activated=true;}
return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.moveLayerBack();this.feature=null;this.lastFeature=null;this.down=null;this.up=null;this.map.events.un({"removelayer":this.handleMapEvents,"changelayer":this.handleMapEvents,scope:this});deactivated=true;}
return deactivated;},handleMapEvents:function(evt){if(!evt.property||evt.property=="order"){this.moveLayerToTop();}},moveLayerToTop:function(){var index=Math.max(this.map.Z_INDEX_BASE['Feature']-1,this.layer.getZIndex())+1;this.layer.setZIndex(index);},moveLayerBack:function(){var index=this.layer.getZIndex()-1;if(index>=this.map.Z_INDEX_BASE['Feature']){this.layer.setZIndex(index);}else{this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer));}},CLASS_NAME:"OpenLayers.Handler.Feature"});OpenLayers.Handler.Hover=OpenLayers.Class(OpenLayers.Handler,{delay:500,pixelTolerance:null,stopMove:false,px:null,timerId:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);},mousemove:function(evt){if(this.passesTolerance(evt.xy)){this.clearTimer();this.callback('move',[evt]);this.px=evt.xy;evt=OpenLayers.Util.extend({},evt);this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,evt),this.delay);}
return!this.stopMove;},mouseout:function(evt){if(OpenLayers.Util.mouseLeft(evt,this.map.div)){this.clearTimer();this.callback('move',[evt]);}
return true;},passesTolerance:function(px){var passes=true;if(this.pixelTolerance&&this.px){var dpx=Math.sqrt(Math.pow(this.px.x-px.x,2)+
Math.pow(this.px.y-px.y,2));if(dpx<this.pixelTolerance){passes=false;}}
return passes;},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null;}},delayedCall:function(evt){this.callback('pause',[evt]);},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();deactivated=true;}
return deactivated;},CLASS_NAME:"OpenLayers.Handler.Hover"});OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.wheelListener=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this);},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.wheelListener=null;},onWheelEvent:function(e){if(!this.map||!this.checkModifiers(e)){return;}
var overScrollableDiv=false;var overLayerDiv=false;var overMapDiv=false;var elem=OpenLayers.Event.element(e);while((elem!=null)&&!overMapDiv&&!overScrollableDiv){if(!overScrollableDiv){try{if(elem.currentStyle){overflow=elem.currentStyle["overflow"];}else{var style=document.defaultView.getComputedStyle(elem,null);var overflow=style.getPropertyValue("overflow");}
overScrollableDiv=(overflow&&(overflow=="auto")||(overflow=="scroll"));}catch(err){}}
if(!overLayerDiv){for(var i=0,len=this.map.layers.length;i<len;i++){if(elem==this.map.layers[i].div||elem==this.map.layers[i].pane){overLayerDiv=true;break;}}}
overMapDiv=(elem==this.map.div);elem=elem.parentNode;}
if(!overScrollableDiv&&overMapDiv){if(overLayerDiv){this.wheelZoom(e);}
OpenLayers.Event.stop(e);}},wheelZoom:function(e){var delta=0;if(!e){e=window.event;}
if(e.wheelDelta){delta=e.wheelDelta/120;if(window.opera&&window.opera.version()<9.2){delta=-delta;}}else if(e.detail){delta=-e.detail/3;}
if(delta){if(this.mousePosition){e.xy=this.mousePosition;}
if(!e.xy){e.xy=this.map.getPixelFromLonLat(this.map.getCenter());}
if(delta<0){this.callback("down",[e,delta]);}else{this.callback("up",[e,delta]);}}},mousemove:function(evt){this.mousePosition=evt.xy;},activate:function(evt){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var wheelListener=this.wheelListener;OpenLayers.Event.observe(window,"DOMMouseScroll",wheelListener);OpenLayers.Event.observe(window,"mousewheel",wheelListener);OpenLayers.Event.observe(document,"mousewheel",wheelListener);return true;}else{return false;}},deactivate:function(evt){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){var wheelListener=this.wheelListener;OpenLayers.Event.stopObserving(window,"DOMMouseScroll",wheelListener);OpenLayers.Event.stopObserving(window,"mousewheel",wheelListener);OpenLayers.Event.stopObserving(document,"mousewheel",wheelListener);return true;}else{return false;}},CLASS_NAME:"OpenLayers.Handler.MouseWheel"});OpenLayers.Layer=OpenLayers.Class({id:null,name:null,div:null,opacity:null,alwaysInRange:null,EVENT_TYPES:["loadstart","loadend","loadcancel","visibilitychanged","move","moveend"],events:null,map:null,isBaseLayer:false,alpha:false,displayInLayerSwitcher:true,visibility:true,attribution:null,inRange:false,imageSize:null,imageOffset:null,options:null,eventListeners:null,gutter:0,projection:null,units:null,scales:null,resolutions:null,maxExtent:null,minExtent:null,maxResolution:null,minResolution:null,numZoomLevels:null,minScale:null,maxScale:null,displayOutsideMaxExtent:false,wrapDateLine:false,transitionEffect:null,SUPPORTED_TRANSITIONS:['resize'],initialize:function(name,options){this.addOptions(options);this.name=name;if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.div=OpenLayers.Util.createDiv(this.id);this.div.style.width="100%";this.div.style.height="100%";this.div.dir="ltr";this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners);}}
if(this.wrapDateLine){this.displayOutsideMaxExtent=true;}},destroy:function(setNewBaseLayer){if(setNewBaseLayer==null){setNewBaseLayer=true;}
if(this.map!=null){this.map.removeLayer(this,setNewBaseLayer);}
this.projection=null;this.map=null;this.name=null;this.div=null;this.options=null;if(this.events){if(this.eventListeners){this.events.un(this.eventListeners);}
this.events.destroy();}
this.eventListeners=null;this.events=null;},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer(this.name,this.options);}
OpenLayers.Util.applyDefaults(obj,this);obj.map=null;return obj;},setName:function(newName){if(newName!=this.name){this.name=newName;if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"name"});}}},addOptions:function(newOptions){if(this.options==null){this.options={};}
OpenLayers.Util.extend(this.options,newOptions);OpenLayers.Util.extend(this,newOptions);},onMapResize:function(){},redraw:function(){var redrawn=false;if(this.map){this.inRange=this.calculateInRange();var extent=this.getExtent();if(extent&&this.inRange&&this.visibility){var zoomChanged=true;this.moveTo(extent,zoomChanged,false);this.events.triggerEvent("moveend",{"zoomChanged":zoomChanged});redrawn=true;}}
return redrawn;},moveTo:function(bounds,zoomChanged,dragging){var display=this.visibility;if(!this.isBaseLayer){display=display&&this.inRange;}
this.display(display);},setMap:function(map){if(this.map==null){this.map=map;this.maxExtent=this.maxExtent||this.map.maxExtent;this.projection=this.projection||this.map.projection;if(this.projection&&typeof this.projection=="string"){this.projection=new OpenLayers.Projection(this.projection);}
this.units=this.projection.getUnits()||this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer){this.inRange=this.calculateInRange();var show=((this.visibility)&&(this.inRange));this.div.style.display=show?"":"none";}
this.setTileSize();}},afterAdd:function(){},removeMap:function(map){},getImageSize:function(){return(this.imageSize||this.tileSize);},setTileSize:function(size){var tileSize=(size)?size:((this.tileSize)?this.tileSize:this.map.getTileSize());this.tileSize=tileSize;if(this.gutter){this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter);this.imageSize=new OpenLayers.Size(tileSize.w+(2*this.gutter),tileSize.h+(2*this.gutter));}},getVisibility:function(){return this.visibility;},setVisibility:function(visibility){if(visibility!=this.visibility){this.visibility=visibility;this.display(visibility);this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"});}
this.events.triggerEvent("visibilitychanged");}},display:function(display){var inRange=this.calculateInRange();if(display!=(this.div.style.display!="none")){this.div.style.display=(display&&inRange)?"block":"none";}},calculateInRange:function(){var inRange=false;if(this.alwaysInRange){inRange=true;}else{if(this.map){var resolution=this.map.getResolution();inRange=((resolution>=this.minResolution)&&(resolution<=this.maxResolution));}}
return inRange;},setIsBaseLayer:function(isBaseLayer){if(isBaseLayer!=this.isBaseLayer){this.isBaseLayer=isBaseLayer;if(this.map!=null){this.map.events.triggerEvent("changebaselayer",{layer:this});}}},initResolutions:function(){var props=new Array('projection','units','scales','resolutions','maxScale','minScale','maxResolution','minResolution','minExtent','maxExtent','numZoomLevels','maxZoomLevel');var notScaleProps=['projection','units'];var useInRange=false;var confProps={};for(var i=0,len=props.length;i<len;i++){var property=props[i];if(this.options[property]&&OpenLayers.Util.indexOf(notScaleProps,property)==-1){useInRange=true;}
confProps[property]=this.options[property]||this.map[property];}
if(this.alwaysInRange==null){this.alwaysInRange=!useInRange;}
if((this.options.minScale!=null||this.options.maxScale!=null)&&this.options.scales==null){confProps.scales=null;}
if((this.options.minResolution!=null||this.options.maxResolution!=null)&&this.options.resolutions==null){confProps.resolutions=null;}
if((!confProps.numZoomLevels)&&(confProps.maxZoomLevel)){confProps.numZoomLevels=confProps.maxZoomLevel+1;}
if((confProps.scales!=null)||(confProps.resolutions!=null)){if(confProps.scales!=null){confProps.resolutions=[];for(var i=0,len=confProps.scales.length;i<len;i++){var scale=confProps.scales[i];confProps.resolutions[i]=OpenLayers.Util.getResolutionFromScale(scale,confProps.units);}}
confProps.numZoomLevels=confProps.resolutions.length;}else{if(confProps.minScale){confProps.maxResolution=OpenLayers.Util.getResolutionFromScale(confProps.minScale,confProps.units);}else if(confProps.maxResolution=="auto"){var viewSize=this.map.getSize();var wRes=confProps.maxExtent.getWidth()/viewSize.w;var hRes=confProps.maxExtent.getHeight()/viewSize.h;confProps.maxResolution=Math.max(wRes,hRes);}
if(confProps.maxScale!=null){confProps.minResolution=OpenLayers.Util.getResolutionFromScale(confProps.maxScale,confProps.units);}else if((confProps.minResolution=="auto")&&(confProps.minExtent!=null)){var viewSize=this.map.getSize();var wRes=confProps.minExtent.getWidth()/viewSize.w;var hRes=confProps.minExtent.getHeight()/viewSize.h;confProps.minResolution=Math.max(wRes,hRes);}
if(confProps.minResolution!=null&&this.options.numZoomLevels==undefined){var ratio=confProps.maxResolution/confProps.minResolution;confProps.numZoomLevels=Math.floor(Math.log(ratio)/Math.log(2))+1;}
confProps.resolutions=new Array(confProps.numZoomLevels);var base=2;if(typeof confProps.minResolution=="number"&&confProps.numZoomLevels>1){base=Math.pow((confProps.maxResolution/confProps.minResolution),(1/(confProps.numZoomLevels-1)));}
for(var i=0;i<confProps.numZoomLevels;i++){var res=confProps.maxResolution/Math.pow(base,i);confProps.resolutions[i]=res;}}
confProps.resolutions.sort(function(a,b){return(b-a);});this.resolutions=confProps.resolutions;this.maxResolution=confProps.resolutions[0];var lastIndex=confProps.resolutions.length-1;this.minResolution=confProps.resolutions[lastIndex];this.scales=[];for(var i=0,len=confProps.resolutions.length;i<len;i++){this.scales[i]=OpenLayers.Util.getScaleFromResolution(confProps.resolutions[i],confProps.units);}
this.minScale=this.scales[0];this.maxScale=this.scales[this.scales.length-1];this.numZoomLevels=confProps.numZoomLevels;},getResolution:function(){var zoom=this.map.getZoom();return this.getResolutionForZoom(zoom);},getExtent:function(){return this.map.calculateBounds();},getZoomForExtent:function(extent,closest){var viewSize=this.map.getSize();var idealResolution=Math.max(extent.getWidth()/viewSize.w,extent.getHeight()/viewSize.h);return this.getZoomForResolution(idealResolution,closest);},getDataExtent:function(){},getResolutionForZoom:function(zoom){zoom=Math.max(0,Math.min(zoom,this.resolutions.length-1));var resolution;if(this.map.fractionalZoom){var low=Math.floor(zoom);var high=Math.ceil(zoom);resolution=this.resolutions[low]-
((zoom-low)*(this.resolutions[low]-this.resolutions[high]));}else{resolution=this.resolutions[Math.round(zoom)];}
return resolution;},getZoomForResolution:function(resolution,closest){var zoom;if(this.map.fractionalZoom){var lowZoom=0;var highZoom=this.resolutions.length-1;var highRes=this.resolutions[lowZoom];var lowRes=this.resolutions[highZoom];var res;for(var i=0,len=this.resolutions.length;i<len;++i){res=this.resolutions[i];if(res>=resolution){highRes=res;lowZoom=i;}
if(res<=resolution){lowRes=res;highZoom=i;break;}}
var dRes=highRes-lowRes;if(dRes>0){zoom=lowZoom+((highRes-resolution)/dRes);}else{zoom=lowZoom;}}else{var diff;var minDiff=Number.POSITIVE_INFINITY;for(var i=0,len=this.resolutions.length;i<len;i++){if(closest){diff=Math.abs(this.resolutions[i]-resolution);if(diff>minDiff){break;}
minDiff=diff;}else{if(this.resolutions[i]<resolution){break;}}}
zoom=Math.max(0,i-1);}
return zoom;},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if(viewPortPx!=null){var size=this.map.getSize();var center=this.map.getCenter();if(center){var res=this.map.getResolution();var delta_x=viewPortPx.x-(size.w/2);var delta_y=viewPortPx.y-(size.h/2);lonlat=new OpenLayers.LonLat(center.lon+delta_x*res,center.lat-delta_y*res);if(this.wrapDateLine){lonlat=lonlat.wrapDateLine(this.maxExtent);}}}
return lonlat;},getViewPortPxFromLonLat:function(lonlat){var px=null;if(lonlat!=null){var resolution=this.map.getResolution();var extent=this.map.getExtent();px=new OpenLayers.Pixel((1/resolution*(lonlat.lon-extent.left)),(1/resolution*(extent.top-lonlat.lat)));}
return px;},setOpacity:function(opacity){if(opacity!=this.opacity){this.opacity=opacity;for(var i=0,len=this.div.childNodes.length;i<len;++i){var element=this.div.childNodes[i].firstChild;OpenLayers.Util.modifyDOMElement(element,null,null,null,null,null,null,opacity);}}},getZIndex:function(){return this.div.style.zIndex;},setZIndex:function(zIndex){this.div.style.zIndex=zIndex;},adjustBounds:function(bounds){if(this.gutter){var mapGutter=this.gutter*this.map.getResolution();bounds=new OpenLayers.Bounds(bounds.left-mapGutter,bounds.bottom-mapGutter,bounds.right+mapGutter,bounds.top+mapGutter);}
if(this.wrapDateLine){var wrappingOptions={'rightTolerance':this.getResolution()};bounds=bounds.wrapDateLine(this.maxExtent,wrappingOptions);}
return bounds;},CLASS_NAME:"OpenLayers.Layer"});OpenLayers.Marker.Box=OpenLayers.Class(OpenLayers.Marker,{bounds:null,div:null,initialize:function(bounds,borderColor,borderWidth){this.bounds=bounds;this.div=OpenLayers.Util.createDiv();this.div.style.overflow='hidden';this.events=new OpenLayers.Events(this,this.div,null);this.setBorder(borderColor,borderWidth);},destroy:function(){this.bounds=null;this.div=null;OpenLayers.Marker.prototype.destroy.apply(this,arguments);},setBorder:function(color,width){if(!color){color="red";}
if(!width){width=2;}
this.div.style.border=width+"px solid "+color;},draw:function(px,sz){OpenLayers.Util.modifyDOMElement(this.div,null,px,sz);return this.div;},onScreen:function(){var onScreen=false;if(this.map){var screenBounds=this.map.getExtent();onScreen=screenBounds.containsBounds(this.bounds,true,true);}
return onScreen;},display:function(display){this.div.style.display=(display)?"":"none";},CLASS_NAME:"OpenLayers.Marker.Box"});(function(){var oXMLHttpRequest=window.XMLHttpRequest;var bGecko=!!window.controllers,bIE=window.document.all&&!window.opera;function cXMLHttpRequest(){this._object=oXMLHttpRequest?new oXMLHttpRequest:new window.ActiveXObject('Microsoft.XMLHTTP');};if(bGecko&&oXMLHttpRequest.wrapped)
cXMLHttpRequest.wrapped=oXMLHttpRequest.wrapped;cXMLHttpRequest.UNSENT=0;cXMLHttpRequest.OPENED=1;cXMLHttpRequest.HEADERS_RECEIVED=2;cXMLHttpRequest.LOADING=3;cXMLHttpRequest.DONE=4;cXMLHttpRequest.prototype.readyState=cXMLHttpRequest.UNSENT;cXMLHttpRequest.prototype.responseText="";cXMLHttpRequest.prototype.responseXML=null;cXMLHttpRequest.prototype.status=0;cXMLHttpRequest.prototype.statusText="";cXMLHttpRequest.prototype.onreadystatechange=null;cXMLHttpRequest.onreadystatechange=null;cXMLHttpRequest.onopen=null;cXMLHttpRequest.onsend=null;cXMLHttpRequest.onabort=null;cXMLHttpRequest.prototype.open=function(sMethod,sUrl,bAsync,sUser,sPassword){this._async=bAsync;var oRequest=this,nState=this.readyState;if(bIE){var fOnUnload=function(){if(oRequest._object.readyState!=cXMLHttpRequest.DONE)
fCleanTransport(oRequest);};if(bAsync)
window.attachEvent("onunload",fOnUnload);}
this._object.onreadystatechange=function(){if(bGecko&&!bAsync)
return;oRequest.readyState=oRequest._object.readyState;fSynchronizeValues(oRequest);if(oRequest._aborted){oRequest.readyState=cXMLHttpRequest.UNSENT;return;}
if(oRequest.readyState==cXMLHttpRequest.DONE){fCleanTransport(oRequest);if(bIE&&bAsync)
window.detachEvent("onunload",fOnUnload);}
if(nState!=oRequest.readyState)
fReadyStateChange(oRequest);nState=oRequest.readyState;};if(cXMLHttpRequest.onopen)
cXMLHttpRequest.onopen.apply(this,arguments);this._object.open(sMethod,sUrl,bAsync,sUser,sPassword);if(!bAsync&&bGecko){this.readyState=cXMLHttpRequest.OPENED;fReadyStateChange(this);}};cXMLHttpRequest.prototype.send=function(vData){if(cXMLHttpRequest.onsend)
cXMLHttpRequest.onsend.apply(this,arguments);if(vData&&vData.nodeType){vData=window.XMLSerializer?new window.XMLSerializer().serializeToString(vData):vData.xml;if(!this._headers["Content-Type"])
this._object.setRequestHeader("Content-Type","application/xml");}
this._object.send(vData);if(bGecko&&!this._async){this.readyState=cXMLHttpRequest.OPENED;fSynchronizeValues(this);while(this.readyState<cXMLHttpRequest.DONE){this.readyState++;fReadyStateChange(this);if(this._aborted)
return;}}};cXMLHttpRequest.prototype.abort=function(){if(cXMLHttpRequest.onabort)
cXMLHttpRequest.onabort.apply(this,arguments);if(this.readyState>cXMLHttpRequest.UNSENT)
this._aborted=true;this._object.abort();fCleanTransport(this);};cXMLHttpRequest.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders();};cXMLHttpRequest.prototype.getResponseHeader=function(sName){return this._object.getResponseHeader(sName);};cXMLHttpRequest.prototype.setRequestHeader=function(sName,sValue){if(!this._headers)
this._headers={};this._headers[sName]=sValue;return this._object.setRequestHeader(sName,sValue);};cXMLHttpRequest.prototype.toString=function(){return'['+"object"+' '+"XMLHttpRequest"+']';};cXMLHttpRequest.toString=function(){return'['+"XMLHttpRequest"+']';};function fReadyStateChange(oRequest){if(oRequest.onreadystatechange)
oRequest.onreadystatechange.apply(oRequest);if(cXMLHttpRequest.onreadystatechange)
cXMLHttpRequest.onreadystatechange.apply(oRequest);};function fGetDocument(oRequest){var oDocument=oRequest.responseXML;if(bIE&&oDocument&&!oDocument.documentElement&&oRequest.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)){oDocument=new ActiveXObject('Microsoft.XMLDOM');oDocument.loadXML(oRequest.responseText);}
if(oDocument)
if((bIE&&oDocument.parseError!=0)||(oDocument.documentElement&&oDocument.documentElement.tagName=="parsererror"))
return null;return oDocument;};function fSynchronizeValues(oRequest){try{oRequest.responseText=oRequest._object.responseText;}catch(e){}
try{oRequest.responseXML=fGetDocument(oRequest._object);}catch(e){}
try{oRequest.status=oRequest._object.status;}catch(e){}
try{oRequest.statusText=oRequest._object.statusText;}catch(e){}};function fCleanTransport(oRequest){oRequest._object.onreadystatechange=new window.Function;delete oRequest._headers;};if(!window.Function.prototype.apply){window.Function.prototype.apply=function(oRequest,oArguments){if(!oArguments)
oArguments=[];oRequest.__func=this;oRequest.__func(oArguments[0],oArguments[1],oArguments[2],oArguments[3],oArguments[4]);delete oRequest.__func;};};OpenLayers.Request.XMLHttpRequest=cXMLHttpRequest;})();OpenLayers.ProxyHost="";OpenLayers.nullHandler=function(request){OpenLayers.Console.userError(OpenLayers.i18n("unhandledRequest",{'statusText':request.statusText}));};OpenLayers.loadURL=function(uri,params,caller,onComplete,onFailure){if(typeof params=='string'){params=OpenLayers.Util.getParameters(params);}
var success=(onComplete)?onComplete:OpenLayers.nullHandler;var failure=(onFailure)?onFailure:OpenLayers.nullHandler;return OpenLayers.Request.GET({url:uri,params:params,success:success,failure:failure,scope:caller});};OpenLayers.parseXMLString=function(text){var index=text.indexOf('<');if(index>0){text=text.substring(index);}
var ajaxResponse=OpenLayers.Util.Try(function(){var xmldom=new ActiveXObject('Microsoft.XMLDOM');xmldom.loadXML(text);return xmldom;},function(){return new DOMParser().parseFromString(text,'text/xml');},function(){var req=new XMLHttpRequest();req.open("GET","data:"+"text/xml"+";charset=utf-8,"+encodeURIComponent(text),false);if(req.overrideMimeType){req.overrideMimeType("text/xml");}
req.send(null);return req.responseXML;});return ajaxResponse;};OpenLayers.Ajax={emptyFunction:function(){},getTransport:function(){return OpenLayers.Util.Try(function(){return new XMLHttpRequest();},function(){return new ActiveXObject('Msxml2.XMLHTTP');},function(){return new ActiveXObject('Microsoft.XMLHTTP');})||false;},activeRequestCount:0};OpenLayers.Ajax.Responders={responders:[],register:function(responderToAdd){for(var i=0;i<this.responders.length;i++){if(responderToAdd==this.responders[i]){return;}}
this.responders.push(responderToAdd);},unregister:function(responderToRemove){OpenLayers.Util.removeItem(this.reponders,responderToRemove);},dispatch:function(callback,request,transport){var responder;for(var i=0;i<this.responders.length;i++){responder=this.responders[i];if(responder[callback]&&typeof responder[callback]=='function'){try{responder[callback].apply(responder,[request,transport]);}catch(e){}}}}};OpenLayers.Ajax.Responders.register({onCreate:function(){OpenLayers.Ajax.activeRequestCount++;},onComplete:function(){OpenLayers.Ajax.activeRequestCount--;}});OpenLayers.Ajax.Base=OpenLayers.Class({initialize:function(options){this.options={method:'post',asynchronous:true,contentType:'application/xml',parameters:''};OpenLayers.Util.extend(this.options,options||{});this.options.method=this.options.method.toLowerCase();if(typeof this.options.parameters=='string'){this.options.parameters=OpenLayers.Util.getParameters(this.options.parameters);}}});OpenLayers.Ajax.Request=OpenLayers.Class(OpenLayers.Ajax.Base,{_complete:false,initialize:function(url,options){OpenLayers.Ajax.Base.prototype.initialize.apply(this,[options]);if(OpenLayers.ProxyHost&&OpenLayers.String.startsWith(url,"http")){url=OpenLayers.ProxyHost+encodeURIComponent(url);}
this.transport=OpenLayers.Ajax.getTransport();this.request(url);},request:function(url){this.url=url;this.method=this.options.method;var params=OpenLayers.Util.extend({},this.options.parameters);if(this.method!='get'&&this.method!='post'){params['_method']=this.method;this.method='post';}
this.parameters=params;if(params=OpenLayers.Util.getParameterString(params)){if(this.method=='get'){this.url+=((this.url.indexOf('?')>-1)?'&':'?')+params;}else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){params+='&_=';}}
try{var response=new OpenLayers.Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(response);}
OpenLayers.Ajax.Responders.dispatch('onCreate',this,response);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){window.setTimeout(OpenLayers.Function.bind(this.respondToReadyState,this,1),10);}
this.transport.onreadystatechange=OpenLayers.Function.bind(this.onStateChange,this);this.setRequestHeaders();this.body=this.method=='post'?(this.options.postBody||params):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange();}}catch(e){this.dispatchException(e);}},onStateChange:function(){var readyState=this.transport.readyState;if(readyState>1&&!((readyState==4)&&this._complete)){this.respondToReadyState(this.transport.readyState);}},setRequestHeaders:function(){var headers={'X-Requested-With':'XMLHttpRequest','Accept':'text/javascript, text/html, application/xml, text/xml, */*','OpenLayers':true};if(this.method=='post'){headers['Content-type']=this.options.contentType+
(this.options.encoding?'; charset='+this.options.encoding:'');if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){headers['Connection']='close';}}
if(typeof this.options.requestHeaders=='object'){var extras=this.options.requestHeaders;if(typeof extras.push=='function'){for(var i=0,length=extras.length;i<length;i+=2){headers[extras[i]]=extras[i+1];}}else{for(var i in extras){headers[i]=extras[i];}}}
for(var name in headers){this.transport.setRequestHeader(name,headers[name]);}},success:function(){var status=this.getStatus();return!status||(status>=200&&status<300);},getStatus:function(){try{return this.transport.status||0;}catch(e){return 0;}},respondToReadyState:function(readyState){var state=OpenLayers.Ajax.Request.Events[readyState];var response=new OpenLayers.Ajax.Response(this);if(state=='Complete'){try{this._complete=true;(this.options['on'+response.status]||this.options['on'+(this.success()?'Success':'Failure')]||OpenLayers.Ajax.emptyFunction)(response);}catch(e){this.dispatchException(e);}
var contentType=response.getHeader('Content-type');}
try{(this.options['on'+state]||OpenLayers.Ajax.emptyFunction)(response);OpenLayers.Ajax.Responders.dispatch('on'+state,this,response);}catch(e){this.dispatchException(e);}
if(state=='Complete'){this.transport.onreadystatechange=OpenLayers.Ajax.emptyFunction;}},getHeader:function(name){try{return this.transport.getResponseHeader(name);}catch(e){return null;}},dispatchException:function(exception){var handler=this.options.onException;if(handler){handler(this,exception);OpenLayers.Ajax.Responders.dispatch('onException',this,exception);}else{var listener=false;var responders=OpenLayers.Ajax.Responders.responders;for(var i=0;i<responders.length;i++){if(responders[i].onException){listener=true;break;}}
if(listener){OpenLayers.Ajax.Responders.dispatch('onException',this,exception);}else{throw exception;}}}});OpenLayers.Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];OpenLayers.Ajax.Response=OpenLayers.Class({status:0,statusText:'',initialize:function(request){this.request=request;var transport=this.transport=request.transport,readyState=this.readyState=transport.readyState;if((readyState>2&&!(!!(window.attachEvent&&!window.opera)))||readyState==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=transport.responseText==null?'':String(transport.responseText);}
if(readyState==4){var xml=transport.responseXML;this.responseXML=xml===undefined?null:xml;}},getStatus:OpenLayers.Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||'';}catch(e){return'';}},getHeader:OpenLayers.Ajax.Request.prototype.getHeader,getResponseHeader:function(name){return this.transport.getResponseHeader(name);}});OpenLayers.Ajax.getElementsByTagNameNS=function(parentnode,nsuri,nsprefix,tagname){var elem=null;if(parentnode.getElementsByTagNameNS){elem=parentnode.getElementsByTagNameNS(nsuri,tagname);}else{elem=parentnode.getElementsByTagName(nsprefix+':'+tagname);}
return elem;};OpenLayers.Ajax.serializeXMLToString=function(xmldom){var serializer=new XMLSerializer();var data=serializer.serializeToString(xmldom);return data;};OpenLayers.Control.DragPan=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:false,interval:25,draw:function(){this.handler=new OpenLayers.Handler.Drag(this,{"move":this.panMap,"done":this.panMapDone},{interval:this.interval});},panMap:function(xy){this.panned=true;this.map.pan(this.handler.last.x-xy.x,this.handler.last.y-xy.y,{dragging:this.handler.dragging,animate:false});},panMapDone:function(xy){if(this.panned){this.panMap(xy);this.panned=false;}},CLASS_NAME:"OpenLayers.Control.DragPan"});OpenLayers.State={UNKNOWN:'Unknown',INSERT:'Insert',UPDATE:'Update',DELETE:'Delete'};OpenLayers.Feature.Vector=OpenLayers.Class(OpenLayers.Feature,{fid:null,geometry:null,attributes:null,bounds:null,state:null,style:null,renderIntent:"default",initialize:function(geometry,attributes,style){OpenLayers.Feature.prototype.initialize.apply(this,[null,null,attributes]);this.lonlat=null;this.geometry=geometry?geometry:null;this.state=null;this.attributes={};if(attributes){this.attributes=OpenLayers.Util.extend(this.attributes,attributes);}
this.style=style?style:null;},destroy:function(){if(this.layer){this.layer.removeFeatures(this);this.layer=null;}
this.geometry=null;OpenLayers.Feature.prototype.destroy.apply(this,arguments);},clone:function(){return new OpenLayers.Feature.Vector(this.geometry?this.geometry.clone():null,this.attributes,this.style);},onScreen:function(boundsOnly){var onScreen=false;if(this.layer&&this.layer.map){var screenBounds=this.layer.map.getExtent();if(boundsOnly){var featureBounds=this.geometry.getBounds();onScreen=screenBounds.intersectsBounds(featureBounds);}else{var screenPoly=screenBounds.toGeometry();onScreen=screenPoly.intersects(this.geometry);}}
return onScreen;},createMarker:function(){return null;},destroyMarker:function(){},createPopup:function(){return null;},atPoint:function(lonlat,toleranceLon,toleranceLat){var atPoint=false;if(this.geometry){atPoint=this.geometry.atPoint(lonlat,toleranceLon,toleranceLat);}
return atPoint;},destroyPopup:function(){},move:function(location){if(!this.layer||!this.geometry.move){return;}
var pixel;if(location.CLASS_NAME=="OpenLayers.LonLat"){pixel=this.layer.getViewPortPxFromLonLat(location);}else{pixel=location;}
var lastPixel=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());var res=this.layer.map.getResolution();this.geometry.move(res*(pixel.x-lastPixel.x),res*(lastPixel.y-pixel.y));this.layer.drawFeature(this);return lastPixel;},toState:function(state){if(state==OpenLayers.State.UPDATE){switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=state;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break;}}else if(state==OpenLayers.State.INSERT){switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=state;break;}}else if(state==OpenLayers.State.DELETE){switch(this.state){case OpenLayers.State.INSERT:break;case OpenLayers.State.DELETE:break;case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=state;break;}}else if(state==OpenLayers.State.UNKNOWN){this.state=state;}},CLASS_NAME:"OpenLayers.Feature.Vector"});OpenLayers.Feature.Vector.style={'default':{fillColor:"#ee9900",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},'select':{fillColor:"blue",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"},'temporary':{fillColor:"#66cccc",fillOpacity:0.2,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#66cccc",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},'delete':{display:"none"}};OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:'olHandlerBoxZoomBox',boxCharacteristics:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);var callbacks={"down":this.startBox,"move":this.moveBox,"out":this.removeBox,"up":this.endBox};this.dragHandler=new OpenLayers.Handler.Drag(this,callbacks,{keyMask:this.keyMask});},setMap:function(map){OpenLayers.Handler.prototype.setMap.apply(this,arguments);if(this.dragHandler){this.dragHandler.setMap(map);}},startBox:function(xy){this.zoomBox=OpenLayers.Util.createDiv('zoomBox',this.dragHandler.start);this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE["Popup"]-1;this.map.viewPortDiv.appendChild(this.zoomBox);OpenLayers.Element.addClass(this.map.viewPortDiv,"olDrawBox");},moveBox:function(xy){var startX=this.dragHandler.start.x;var startY=this.dragHandler.start.y;var deltaX=Math.abs(startX-xy.x);var deltaY=Math.abs(startY-xy.y);this.zoomBox.style.width=Math.max(1,deltaX)+"px";this.zoomBox.style.height=Math.max(1,deltaY)+"px";this.zoomBox.style.left=xy.x<startX?xy.x+"px":startX+"px";this.zoomBox.style.top=xy.y<startY?xy.y+"px":startY+"px";var box=this.getBoxCharacteristics();if(box.newBoxModel){if(xy.x>startX){this.zoomBox.style.width=Math.max(1,deltaX-box.xOffset)+"px";}
if(xy.y>startY){this.zoomBox.style.height=Math.max(1,deltaY-box.yOffset)+"px";}}},endBox:function(end){var result;if(Math.abs(this.dragHandler.start.x-end.x)>5||Math.abs(this.dragHandler.start.y-end.y)>5){var start=this.dragHandler.start;var top=Math.min(start.y,end.y);var bottom=Math.max(start.y,end.y);var left=Math.min(start.x,end.x);var right=Math.max(start.x,end.x);result=new OpenLayers.Bounds(left,bottom,right,top);}else{result=this.dragHandler.start.clone();}
this.removeBox();this.callback("done",[result]);},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null;this.boxCharacteristics=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox");},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragHandler.activate();return true;}else{return false;}},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.dragHandler.deactivate();return true;}else{return false;}},getBoxCharacteristics:function(){if(!this.boxCharacteristics){var xOffset=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width"))+1;var yOffset=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"))+1;var newBoxModel=OpenLayers.Util.getBrowserName()=="msie"?document.compatMode!="BackCompat":true;this.boxCharacteristics={xOffset:xOffset,yOffset:yOffset,newBoxModel:newBoxModel};}
return this.boxCharacteristics;},CLASS_NAME:"OpenLayers.Handler.Box"});OpenLayers.Handler.RegularPolygon=OpenLayers.Class(OpenLayers.Handler.Drag,{sides:4,radius:null,snapAngle:null,snapToggle:'shiftKey',persist:false,irregular:false,angle:null,fixedRadius:false,feature:null,layer:null,origin:null,initialize:function(control,callbacks,options){this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style['default'],{});OpenLayers.Handler.prototype.initialize.apply(this,[control,callbacks,options]);this.options=(options)?options:new Object();},setOptions:function(newOptions){OpenLayers.Util.extend(this.options,newOptions);OpenLayers.Util.extend(this,newOptions);},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var options={displayInLayerSwitcher:false,calculateInRange:function(){return true;}};this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,options);this.map.addLayer(this.layer);activated=true;}
return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.Drag.prototype.deactivate.apply(this,arguments)){if(this.dragging){this.cancel();}
if(this.layer.map!=null){this.layer.destroy(false);if(this.feature){this.feature.destroy();}}
this.layer=null;this.feature=null;deactivated=true;}
return deactivated;},down:function(evt){this.fixedRadius=!!(this.radius);var maploc=this.map.getLonLatFromPixel(evt.xy);this.origin=new OpenLayers.Geometry.Point(maploc.lon,maploc.lat);if(!this.fixedRadius||this.irregular){this.radius=this.map.getResolution();}
if(this.persist){this.clear();}
this.feature=new OpenLayers.Feature.Vector();this.createGeometry();this.callback("create",[this.origin,this.feature]);this.layer.addFeatures([this.feature],{silent:true});this.layer.drawFeature(this.feature,this.style);},move:function(evt){var maploc=this.map.getLonLatFromPixel(evt.xy);var point=new OpenLayers.Geometry.Point(maploc.lon,maploc.lat);if(this.irregular){var ry=Math.sqrt(2)*Math.abs(point.y-this.origin.y)/2;this.radius=Math.max(this.map.getResolution()/2,ry);}else if(this.fixedRadius){this.origin=point;}else{this.calculateAngle(point,evt);this.radius=Math.max(this.map.getResolution()/2,point.distanceTo(this.origin));}
this.modifyGeometry();if(this.irregular){var dx=point.x-this.origin.x;var dy=point.y-this.origin.y;var ratio;if(dy==0){ratio=dx/(this.radius*Math.sqrt(2));}else{ratio=dx/dy;}
this.feature.geometry.resize(1,this.origin,ratio);this.feature.geometry.move(dx/2,dy/2);}
this.layer.drawFeature(this.feature,this.style);},up:function(evt){this.finalize();if(this.start==this.last){this.callback("done",[evt.xy]);}},out:function(evt){this.finalize();},createGeometry:function(){this.angle=Math.PI*((1/this.sides)-(1/2));if(this.snapAngle){this.angle+=this.snapAngle*(Math.PI/180);}
this.feature.geometry=OpenLayers.Geometry.Polygon.createRegularPolygon(this.origin,this.radius,this.sides,this.snapAngle);},modifyGeometry:function(){var angle,dx,dy,point;var ring=this.feature.geometry.components[0];if(ring.components.length!=(this.sides+1)){this.createGeometry();ring=this.feature.geometry.components[0];}
for(var i=0;i<this.sides;++i){point=ring.components[i];angle=this.angle+(i*2*Math.PI/this.sides);point.x=this.origin.x+(this.radius*Math.cos(angle));point.y=this.origin.y+(this.radius*Math.sin(angle));point.clearBounds();}},calculateAngle:function(point,evt){var alpha=Math.atan2(point.y-this.origin.y,point.x-this.origin.x);if(this.snapAngle&&(this.snapToggle&&!evt[this.snapToggle])){var snapAngleRad=(Math.PI/180)*this.snapAngle;this.angle=Math.round(alpha/snapAngleRad)*snapAngleRad;}else{this.angle=alpha;}},cancel:function(){this.callback("cancel",null);this.finalize();},finalize:function(){this.origin=null;this.radius=this.options.radius;},clear:function(){this.layer.renderer.clear();this.layer.destroyFeatures();},callback:function(name,args){if(this.callbacks[name]){this.callbacks[name].apply(this.control,[this.feature.geometry.clone()]);}
if(!this.persist&&(name=="done"||name=="cancel")){this.clear();}},CLASS_NAME:"OpenLayers.Handler.RegularPolygon"});OpenLayers.Layer.EventPane=OpenLayers.Class(OpenLayers.Layer,{smoothDragPan:true,isBaseLayer:true,isFixed:true,pane:null,mapObject:null,initialize:function(name,options){OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(this.pane==null){this.pane=OpenLayers.Util.createDiv(this.div.id+"_EventPane");}},destroy:function(){this.mapObject=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Layer.prototype.setMap.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1;this.pane.style.display=this.div.style.display;this.pane.style.width="100%";this.pane.style.height="100%";if(OpenLayers.Util.getBrowserName()=="msie"){this.pane.style.background="url("+OpenLayers.Util.getImagesLocation()+"blank.gif)";}
if(this.isFixed){this.map.viewPortDiv.appendChild(this.pane);}else{this.map.layerContainerDiv.appendChild(this.pane);}
this.loadMapObject();if(this.mapObject==null){this.loadWarningMessage();}},removeMap:function(map){if(this.pane&&this.pane.parentNode){this.pane.parentNode.removeChild(this.pane);this.pane=null;}
OpenLayers.Layer.prototype.removeMap.apply(this,arguments);},loadWarningMessage:function(){this.div.style.backgroundColor="darkblue";var viewSize=this.map.getSize();var msgW=Math.min(viewSize.w,300);var msgH=Math.min(viewSize.h,200);var size=new OpenLayers.Size(msgW,msgH);var centerPx=new OpenLayers.Pixel(viewSize.w/2,viewSize.h/2);var topLeft=centerPx.add(-size.w/2,-size.h/2);var div=OpenLayers.Util.createDiv(this.name+"_warning",topLeft,size,null,null,null,"auto");div.style.padding="7px";div.style.backgroundColor="yellow";div.innerHTML=this.getWarningHTML();this.div.appendChild(div);},getWarningHTML:function(){return"";},display:function(display){OpenLayers.Layer.prototype.display.apply(this,arguments);this.pane.style.display=this.div.style.display;},setZIndex:function(zIndex){OpenLayers.Layer.prototype.setZIndex.apply(this,arguments);this.pane.style.zIndex=parseInt(this.div.style.zIndex)+1;},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(this.mapObject!=null){var newCenter=this.map.getCenter();var newZoom=this.map.getZoom();if(newCenter!=null){var moOldCenter=this.getMapObjectCenter();var oldCenter=this.getOLLonLatFromMapObjectLonLat(moOldCenter);var moOldZoom=this.getMapObjectZoom();var oldZoom=this.getOLZoomFromMapObjectZoom(moOldZoom);if(!(newCenter.equals(oldCenter))||!(newZoom==oldZoom)){if(dragging&&this.dragPanMapObject&&this.smoothDragPan){var oldPx=this.map.getViewPortPxFromLonLat(oldCenter);var newPx=this.map.getViewPortPxFromLonLat(newCenter);this.dragPanMapObject(newPx.x-oldPx.x,oldPx.y-newPx.y);}else{var center=this.getMapObjectLonLatFromOLLonLat(newCenter);var zoom=this.getMapObjectZoomFromOLZoom(newZoom);this.setMapObjectCenter(center,zoom,dragging);}}}}},getLonLatFromViewPortPx:function(viewPortPx){var lonlat=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var moPixel=this.getMapObjectPixelFromOLPixel(viewPortPx);var moLonLat=this.getMapObjectLonLatFromMapObjectPixel(moPixel);lonlat=this.getOLLonLatFromMapObjectLonLat(moLonLat);}
return lonlat;},getViewPortPxFromLonLat:function(lonlat){var viewPortPx=null;if((this.mapObject!=null)&&(this.getMapObjectCenter()!=null)){var moLonLat=this.getMapObjectLonLatFromOLLonLat(lonlat);var moPixel=this.getMapObjectPixelFromMapObjectLonLat(moLonLat);viewPortPx=this.getOLPixelFromMapObjectPixel(moPixel);}
return viewPortPx;},getOLLonLatFromMapObjectLonLat:function(moLonLat){var olLonLat=null;if(moLonLat!=null){var lon=this.getLongitudeFromMapObjectLonLat(moLonLat);var lat=this.getLatitudeFromMapObjectLonLat(moLonLat);olLonLat=new OpenLayers.LonLat(lon,lat);}
return olLonLat;},getMapObjectLonLatFromOLLonLat:function(olLonLat){var moLatLng=null;if(olLonLat!=null){moLatLng=this.getMapObjectLonLatFromLonLat(olLonLat.lon,olLonLat.lat);}
return moLatLng;},getOLPixelFromMapObjectPixel:function(moPixel){var olPixel=null;if(moPixel!=null){var x=this.getXFromMapObjectPixel(moPixel);var y=this.getYFromMapObjectPixel(moPixel);olPixel=new OpenLayers.Pixel(x,y);}
return olPixel;},getMapObjectPixelFromOLPixel:function(olPixel){var moPixel=null;if(olPixel!=null){moPixel=this.getMapObjectPixelFromXY(olPixel.x,olPixel.y);}
return moPixel;},CLASS_NAME:"OpenLayers.Layer.EventPane"});OpenLayers.Layer.FixedZoomLevels=OpenLayers.Class({initialize:function(){},initResolutions:function(){var props=new Array('minZoomLevel','maxZoomLevel','numZoomLevels');for(var i=0,len=props.length;i<len;i++){var property=props[i];this[property]=(this.options[property]!=null)?this.options[property]:this.map[property];}
if((this.minZoomLevel==null)||(this.minZoomLevel<this.MIN_ZOOM_LEVEL)){this.minZoomLevel=this.MIN_ZOOM_LEVEL;}
var desiredZoomLevels;var limitZoomLevels=this.MAX_ZOOM_LEVEL-this.minZoomLevel+1;if(((this.options.numZoomLevels==null)&&(this.options.maxZoomLevel!=null))||((this.numZoomLevels==null)&&(this.maxZoomLevel!=null))){desiredZoomLevels=this.maxZoomLevel-this.minZoomLevel+1;}else{desiredZoomLevels=this.numZoomLevels;}
if(desiredZoomLevels!=null){this.numZoomLevels=Math.min(desiredZoomLevels,limitZoomLevels);}else{this.numZoomLevels=limitZoomLevels;}
this.maxZoomLevel=this.minZoomLevel+this.numZoomLevels-1;if(this.RESOLUTIONS!=null){var resolutionsIndex=0;this.resolutions=[];for(var i=this.minZoomLevel;i<=this.maxZoomLevel;i++){this.resolutions[resolutionsIndex++]=this.RESOLUTIONS[i];}
this.maxResolution=this.resolutions[0];this.minResolution=this.resolutions[this.resolutions.length-1];}},getResolution:function(){if(this.resolutions!=null){return OpenLayers.Layer.prototype.getResolution.apply(this,arguments);}else{var resolution=null;var viewSize=this.map.getSize();var extent=this.getExtent();if((viewSize!=null)&&(extent!=null)){resolution=Math.max(extent.getWidth()/viewSize.w,extent.getHeight()/viewSize.h);}
return resolution;}},getExtent:function(){var extent=null;var size=this.map.getSize();var tlPx=new OpenLayers.Pixel(0,0);var tlLL=this.getLonLatFromViewPortPx(tlPx);var brPx=new OpenLayers.Pixel(size.w,size.h);var brLL=this.getLonLatFromViewPortPx(brPx);if((tlLL!=null)&&(brLL!=null)){extent=new OpenLayers.Bounds(tlLL.lon,brLL.lat,brLL.lon,tlLL.lat);}
return extent;},getZoomForResolution:function(resolution){if(this.resolutions!=null){return OpenLayers.Layer.prototype.getZoomForResolution.apply(this,arguments);}else{var extent=OpenLayers.Layer.prototype.getExtent.apply(this,[]);return this.getZoomForExtent(extent);}},getOLZoomFromMapObjectZoom:function(moZoom){var zoom=null;if(moZoom!=null){zoom=moZoom-this.minZoomLevel;}
return zoom;},getMapObjectZoomFromOLZoom:function(olZoom){var zoom=null;if(olZoom!=null){zoom=olZoom+this.minZoomLevel;}
return zoom;},CLASS_NAME:"OpenLayers.Layer.FixedZoomLevels"});OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:false,initialize:function(name,url,params,options){var newArguments=arguments;newArguments=[name,options];OpenLayers.Layer.prototype.initialize.apply(this,newArguments);this.url=url;this.params=OpenLayers.Util.extend({},params);},destroy:function(){this.url=null;this.params=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.options);}
obj=OpenLayers.Layer.prototype.clone.apply(this,[obj]);return obj;},setUrl:function(newUrl){this.url=newUrl;},mergeNewParams:function(newParams){this.params=OpenLayers.Util.extend(this.params,newParams);return this.redraw();},redraw:function(force){if(force){return this.mergeNewParams({"_olSalt":Math.random()});}else{return OpenLayers.Layer.prototype.redraw.apply(this,[]);}},selectUrl:function(paramString,urls){var product=1;for(var i=0,len=paramString.length;i<len;i++){product*=paramString.charCodeAt(i)*this.URL_HASH_FACTOR;product-=Math.floor(product);}
return urls[Math.floor(product*urls.length)];},getFullRequestString:function(newParams,altUrl){var url=altUrl||this.url;var allParams=OpenLayers.Util.extend({},this.params);allParams=OpenLayers.Util.extend(allParams,newParams);var paramsString=OpenLayers.Util.getParameterString(allParams);if(url instanceof Array){url=this.selectUrl(paramsString,url);}
var urlParams=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(url));for(var key in allParams){if(key.toUpperCase()in urlParams){delete allParams[key];}}
paramsString=OpenLayers.Util.getParameterString(allParams);var requestString=url;if(paramsString!=""){var lastServerChar=url.charAt(url.length-1);if((lastServerChar=="&")||(lastServerChar=="?")){requestString+=paramsString;}else{if(url.indexOf('?')==-1){requestString+='?'+paramsString;}else{requestString+='&'+paramsString;}}}
return requestString;},CLASS_NAME:"OpenLayers.Layer.HTTPRequest"});OpenLayers.Layer.Markers=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:false,markers:null,drawn:false,initialize:function(name,options){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.markers=[];},destroy:function(){this.clearMarkers();this.markers=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},setOpacity:function(opacity){if(opacity!=this.opacity){this.opacity=opacity;for(var i=0,len=this.markers.length;i<len;i++){this.markers[i].setOpacity(this.opacity);}}},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(zoomChanged||!this.drawn){for(var i=0,len=this.markers.length;i<len;i++){this.drawMarker(this.markers[i]);}
this.drawn=true;}},addMarker:function(marker){this.markers.push(marker);if(this.opacity!=null){marker.setOpacity(this.opacity);}
if(this.map&&this.map.getExtent()){marker.map=this.map;this.drawMarker(marker);}},removeMarker:function(marker){if(this.markers&&this.markers.length){OpenLayers.Util.removeItem(this.markers,marker);marker.erase();}},clearMarkers:function(){if(this.markers!=null){while(this.markers.length>0){this.removeMarker(this.markers[0]);}}},drawMarker:function(marker){var px=this.map.getLayerPxFromLonLat(marker.lonlat);if(px==null){marker.display(false);}else{if(!marker.isDrawn()){var markerImg=marker.draw(px);this.div.appendChild(markerImg);}else if(marker.icon){marker.icon.moveTo(px);}}},getDataExtent:function(){var maxExtent=null;if(this.markers&&(this.markers.length>0)){var maxExtent=new OpenLayers.Bounds();for(var i=0,len=this.markers.length;i<len;i++){var marker=this.markers[i];maxExtent.extend(marker.lonlat);}}
return maxExtent;},CLASS_NAME:"OpenLayers.Layer.Markers"});OpenLayers.Layer.SphericalMercator={getExtent:function(){var extent=null;if(this.sphericalMercator){extent=this.map.calculateBounds();}else{extent=OpenLayers.Layer.FixedZoomLevels.prototype.getExtent.apply(this);}
return extent;},initMercatorParameters:function(){this.RESOLUTIONS=[];var maxResolution=156543.0339;for(var zoom=0;zoom<=this.MAX_ZOOM_LEVEL;++zoom){this.RESOLUTIONS[zoom]=maxResolution/Math.pow(2,zoom);}
this.units="m";this.projection="EPSG:900913";},forwardMercator:function(lon,lat){var x=lon*20037508.34/180;var y=Math.log(Math.tan((90+lat)*Math.PI/360))/(Math.PI/180);y=y*20037508.34/180;return new OpenLayers.LonLat(x,y);},inverseMercator:function(x,y){var lon=(x/20037508.34)*180;var lat=(y/20037508.34)*180;lat=180/Math.PI*(2*Math.atan(Math.exp(lat*Math.PI/180))-Math.PI/2);return new OpenLayers.LonLat(lon,lat);},projectForward:function(point){var lonlat=OpenLayers.Layer.SphericalMercator.forwardMercator(point.x,point.y);point.x=lonlat.lon;point.y=lonlat.lat;return point;},projectInverse:function(point){var lonlat=OpenLayers.Layer.SphericalMercator.inverseMercator(point.x,point.y);point.x=lonlat.lon;point.y=lonlat.lat;return point;}};OpenLayers.Projection.addTransform("EPSG:4326","EPSG:900913",OpenLayers.Layer.SphericalMercator.projectForward);OpenLayers.Projection.addTransform("EPSG:900913","EPSG:4326",OpenLayers.Layer.SphericalMercator.projectInverse);OpenLayers.Control.DrawFeature=OpenLayers.Class(OpenLayers.Control,{layer:null,callbacks:null,EVENT_TYPES:["featureadded"],featureAdded:function(){},handlerOptions:null,initialize:function(layer,handler,options){this.EVENT_TYPES=OpenLayers.Control.DrawFeature.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[options]);this.callbacks=OpenLayers.Util.extend({done:this.drawFeature,modify:function(vertex,feature){this.layer.events.triggerEvent("sketchmodified",{vertex:vertex,feature:feature});},create:function(vertex,feature){this.layer.events.triggerEvent("sketchstarted",{vertex:vertex,feature:feature});}},this.callbacks);this.layer=layer;var sketchStyle=this.layer.styleMap&&this.layer.styleMap.styles.temporary;if(sketchStyle){this.handlerOptions=this.handlerOptions||{};this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{styleMap:new OpenLayers.StyleMap({"default":sketchStyle})});}
this.handler=new handler(this,this.callbacks,this.handlerOptions);},drawFeature:function(geometry){var feature=new OpenLayers.Feature.Vector(geometry);var proceed=this.layer.events.triggerEvent("sketchcomplete",{feature:feature});if(proceed!==false){feature.state=OpenLayers.State.INSERT;this.layer.addFeatures([feature]);this.featureAdded(feature);this.events.triggerEvent("featureadded",{feature:feature});}},CLASS_NAME:"OpenLayers.Control.DrawFeature"});OpenLayers.Control.Measure=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:['measure','measurepartial'],handlerOptions:null,callbacks:null,displaySystem:'metric',geodesic:false,displaySystemUnits:{geographic:['dd'],english:['mi','ft','in'],metric:['km','m']},partialDelay:300,delayedTrigger:null,persist:false,initialize:function(handler,options){this.EVENT_TYPES=OpenLayers.Control.Measure.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[options]);this.callbacks=OpenLayers.Util.extend({done:this.measureComplete,point:this.measurePartial},this.callbacks);this.handlerOptions=OpenLayers.Util.extend({persist:this.persist},this.handlerOptions);this.handler=new handler(this,this.callbacks,this.handlerOptions);},cancel:function(){this.handler.cancel();},updateHandler:function(handler,options){var active=this.active;if(active){this.deactivate();}
this.handler=new handler(this,this.callbacks,options);if(active){this.activate();}},measureComplete:function(geometry){if(this.delayedTrigger){window.clearTimeout(this.delayedTrigger);}
this.measure(geometry,"measure");},measurePartial:function(point,geometry){this.delayedTrigger=window.setTimeout(OpenLayers.Function.bind(function(){this.measure(geometry,"measurepartial");},this),this.partialDelay);},measure:function(geometry,eventType){var stat,order;if(geometry.CLASS_NAME.indexOf('LineString')>-1){stat=this.getBestLength(geometry);order=1;}else{stat=this.getBestArea(geometry);order=2;}
this.events.triggerEvent(eventType,{measure:stat[0],units:stat[1],order:order,geometry:geometry});},getBestArea:function(geometry){var units=this.displaySystemUnits[this.displaySystem];var unit,area;for(var i=0,len=units.length;i<len;++i){unit=units[i];area=this.getArea(geometry,unit);if(area>1){break;}}
return[area,unit];},getArea:function(geometry,units){var area,geomUnits;if(this.geodesic){area=geometry.getGeodesicArea(this.map.getProjectionObject());geomUnits="m";}else{area=geometry.getArea();geomUnits=this.map.getUnits();}
var inPerDisplayUnit=OpenLayers.INCHES_PER_UNIT[units];if(inPerDisplayUnit){var inPerMapUnit=OpenLayers.INCHES_PER_UNIT[geomUnits];area*=Math.pow((inPerMapUnit/inPerDisplayUnit),2);}
return area;},getBestLength:function(geometry){var units=this.displaySystemUnits[this.displaySystem];var unit,length;for(var i=0,len=units.length;i<len;++i){unit=units[i];length=this.getLength(geometry,unit);if(length>1){break;}}
return[length,unit];},getLength:function(geometry,units){var length,geomUnits;if(this.geodesic){length=geometry.getGeodesicLength(this.map.getProjectionObject());geomUnits="m";}else{length=geometry.getLength();geomUnits=this.map.getUnits();}
var inPerDisplayUnit=OpenLayers.INCHES_PER_UNIT[units];if(inPerDisplayUnit){var inPerMapUnit=OpenLayers.INCHES_PER_UNIT[geomUnits];length*=(inPerMapUnit/inPerDisplayUnit);}
return length;},CLASS_NAME:"OpenLayers.Control.Measure"});OpenLayers.Control.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,out:false,alwaysZoom:false,draw:function(){this.handler=new OpenLayers.Handler.Box(this,{done:this.zoomBox},{keyMask:this.keyMask});},zoomBox:function(position){if(position instanceof OpenLayers.Bounds){if(!this.out){var minXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.left,position.bottom));var maxXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.right,position.top));var bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);}else{var pixWidth=Math.abs(position.right-position.left);var pixHeight=Math.abs(position.top-position.bottom);var zoomFactor=Math.min((this.map.size.h/pixHeight),(this.map.size.w/pixWidth));var extent=this.map.getExtent();var center=this.map.getLonLatFromPixel(position.getCenterPixel());var xmin=center.lon-(extent.getWidth()/2)*zoomFactor;var xmax=center.lon+(extent.getWidth()/2)*zoomFactor;var ymin=center.lat-(extent.getHeight()/2)*zoomFactor;var ymax=center.lat+(extent.getHeight()/2)*zoomFactor;var bounds=new OpenLayers.Bounds(xmin,ymin,xmax,ymax);}
var lastZoom=this.map.getZoom();this.map.zoomToExtent(bounds);if(lastZoom==this.map.getZoom()&&this.alwaysZoom==true){this.map.zoomTo(lastZoom+(this.out?-1:1));}}else{if(!this.out){this.map.setCenter(this.map.getLonLatFromPixel(position),this.map.getZoom()+1);}else{this.map.setCenter(this.map.getLonLatFromPixel(position),this.map.getZoom()-1);}}},CLASS_NAME:"OpenLayers.Control.ZoomBox"});OpenLayers.Format.WKT=OpenLayers.Class(OpenLayers.Format,{initialize:function(options){this.regExes={'typeStr':/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,'spaces':/\s+/,'parenComma':/\)\s*,\s*\(/,'doubleParenComma':/\)\s*\)\s*,\s*\(\s*\(/,'trimParens':/^\s*\(?(.*?)\)?\s*$/};OpenLayers.Format.prototype.initialize.apply(this,[options]);},read:function(wkt){var features,type,str;var matches=this.regExes.typeStr.exec(wkt);if(matches){type=matches[1].toLowerCase();str=matches[2];if(this.parse[type]){features=this.parse[type].apply(this,[str]);}
if(this.internalProjection&&this.externalProjection){if(features&&features.CLASS_NAME=="OpenLayers.Feature.Vector"){features.geometry.transform(this.externalProjection,this.internalProjection);}else if(features&&type!="geometrycollection"&&typeof features=="object"){for(var i=0,len=features.length;i<len;i++){var component=features[i];component.geometry.transform(this.externalProjection,this.internalProjection);}}}}
return features;},write:function(features){var collection,geometry,type,data,isCollection;if(features.constructor==Array){collection=features;isCollection=true;}else{collection=[features];isCollection=false;}
var pieces=[];if(isCollection){pieces.push('GEOMETRYCOLLECTION(');}
for(var i=0,len=collection.length;i<len;++i){if(isCollection&&i>0){pieces.push(',');}
geometry=collection[i].geometry;type=geometry.CLASS_NAME.split('.')[2].toLowerCase();if(!this.extract[type]){return null;}
if(this.internalProjection&&this.externalProjection){geometry=geometry.clone();geometry.transform(this.internalProjection,this.externalProjection);}
data=this.extract[type].apply(this,[geometry]);pieces.push(type.toUpperCase()+'('+data+')');}
if(isCollection){pieces.push(')');}
return pieces.join('');},extract:{'point':function(point){return point.x+' '+point.y;},'multipoint':function(multipoint){var array=[];for(var i=0,len=multipoint.components.length;i<len;++i){array.push(this.extract.point.apply(this,[multipoint.components[i]]));}
return array.join(',');},'linestring':function(linestring){var array=[];for(var i=0,len=linestring.components.length;i<len;++i){array.push(this.extract.point.apply(this,[linestring.components[i]]));}
return array.join(',');},'multilinestring':function(multilinestring){var array=[];for(var i=0,len=multilinestring.components.length;i<len;++i){array.push('('+
this.extract.linestring.apply(this,[multilinestring.components[i]])+')');}
return array.join(',');},'polygon':function(polygon){var array=[];for(var i=0,len=polygon.components.length;i<len;++i){array.push('('+
this.extract.linestring.apply(this,[polygon.components[i]])+')');}
return array.join(',');},'multipolygon':function(multipolygon){var array=[];for(var i=0,len=multipolygon.components.length;i<len;++i){array.push('('+
this.extract.polygon.apply(this,[multipolygon.components[i]])+')');}
return array.join(',');}},parse:{'point':function(str){var coords=OpenLayers.String.trim(str).split(this.regExes.spaces);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(coords[0],coords[1]));},'multipoint':function(str){var points=OpenLayers.String.trim(str).split(',');var components=[];for(var i=0,len=points.length;i<len;++i){components.push(this.parse.point.apply(this,[points[i]]).geometry);}
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint(components));},'linestring':function(str){var points=OpenLayers.String.trim(str).split(',');var components=[];for(var i=0,len=points.length;i<len;++i){components.push(this.parse.point.apply(this,[points[i]]).geometry);}
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(components));},'multilinestring':function(str){var line;var lines=OpenLayers.String.trim(str).split(this.regExes.parenComma);var components=[];for(var i=0,len=lines.length;i<len;++i){line=lines[i].replace(this.regExes.trimParens,'$1');components.push(this.parse.linestring.apply(this,[line]).geometry);}
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiLineString(components));},'polygon':function(str){var ring,linestring,linearring;var rings=OpenLayers.String.trim(str).split(this.regExes.parenComma);var components=[];for(var i=0,len=rings.length;i<len;++i){ring=rings[i].replace(this.regExes.trimParens,'$1');linestring=this.parse.linestring.apply(this,[ring]).geometry;linearring=new OpenLayers.Geometry.LinearRing(linestring.components);components.push(linearring);}
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon(components));},'multipolygon':function(str){var polygon;var polygons=OpenLayers.String.trim(str).split(this.regExes.doubleParenComma);var components=[];for(var i=0,len=polygons.length;i<len;++i){polygon=polygons[i].replace(this.regExes.trimParens,'$1');components.push(this.parse.polygon.apply(this,[polygon]).geometry);}
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPolygon(components));},'geometrycollection':function(str){str=str.replace(/,\s*([A-Za-z])/g,'|$1');var wktArray=OpenLayers.String.trim(str).split('|');var components=[];for(var i=0,len=wktArray.length;i<len;++i){components.push(OpenLayers.Format.WKT.prototype.read.apply(this,[wktArray[i]]));}
return components;}},CLASS_NAME:"OpenLayers.Format.WKT"});OpenLayers.Layer.Google=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:0,MAX_ZOOM_LEVEL:19,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.00002145767211914062,0.00001072883605957031,0.00000536441802978515,0.00000268220901489257],type:null,sphericalMercator:false,dragObject:null,termsOfUse:null,poweredBy:null,initialize:function(name,options){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);this.addContainerPxFunction();if(this.sphericalMercator){OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator);this.initMercatorParameters();}},loadMapObject:function(){try{this.mapObject=new GMap2(this.div);if(typeof this.mapObject.getDragObject=="function"){this.dragObject=this.mapObject.getDragObject();}else{this.dragPanMapObject=null;}
this.termsOfUse=this.div.lastChild;this.div.removeChild(this.termsOfUse);if(this.isFixed){this.map.viewPortDiv.appendChild(this.termsOfUse);}else{this.map.layerContainerDiv.appendChild(this.termsOfUse);}
this.termsOfUse.style.zIndex="1100";this.termsOfUse.style.display=this.div.style.display;this.termsOfUse.style.right="";this.termsOfUse.style.bottom="";this.termsOfUse.className="olLayerGoogleCopyright";this.poweredBy=this.div.lastChild;this.div.removeChild(this.poweredBy);if(this.isFixed){this.map.viewPortDiv.appendChild(this.poweredBy);}else{this.map.layerContainerDiv.appendChild(this.poweredBy);}
this.poweredBy.style.zIndex="1100";this.poweredBy.style.display=this.div.style.display;this.poweredBy.style.right="";this.poweredBy.style.bottom="";this.poweredBy.className="olLayerGooglePoweredBy gmnoprint";}catch(e){OpenLayers.Console.error(e);}},setMap:function(map){OpenLayers.Layer.EventPane.prototype.setMap.apply(this,arguments);if(this.type!=null){this.map.events.register("moveend",this,this.setMapType);}},setMapType:function(){if(this.mapObject.getCenter()!=null){if(OpenLayers.Util.indexOf(this.mapObject.getMapTypes(),this.type)==-1){this.mapObject.addMapType(this.type);}
this.mapObject.setMapType(this.type);this.map.events.unregister("moveend",this,this.setMapType);}},onMapResize:function(){if(this.visibility&&this.mapObject.isLoaded()){this.mapObject.checkResize();}else{if(!this._resized){var layer=this;var handle=GEvent.addListener(this.mapObject,"load",function(){GEvent.removeListener(handle);delete layer._resized;layer.mapObject.checkResize();layer.moveTo(layer.map.getCenter(),layer.map.getZoom());})}
this._resized=true;}},display:function(display){OpenLayers.Layer.EventPane.prototype.display.apply(this,arguments);this.termsOfUse.style.display=this.div.style.display;this.poweredBy.style.display=this.div.style.display;},removeMap:function(map){if(this.termsOfUse&&this.termsOfUse.parentNode){this.termsOfUse.parentNode.removeChild(this.termsOfUse);this.termsOfUse=null;}
if(this.poweredBy&&this.poweredBy.parentNode){this.poweredBy.parentNode.removeChild(this.poweredBy);this.poweredBy=null;}
OpenLayers.Layer.EventPane.prototype.removeMap.apply(this,arguments);},getOLBoundsFromMapObjectBounds:function(moBounds){var olBounds=null;if(moBounds!=null){var sw=moBounds.getSouthWest();var ne=moBounds.getNorthEast();if(this.sphericalMercator){sw=this.forwardMercator(sw.lng(),sw.lat());ne=this.forwardMercator(ne.lng(),ne.lat());}else{sw=new OpenLayers.LonLat(sw.lng(),sw.lat());ne=new OpenLayers.LonLat(ne.lng(),ne.lat());}
olBounds=new OpenLayers.Bounds(sw.lon,sw.lat,ne.lon,ne.lat);}
return olBounds;},getMapObjectBoundsFromOLBounds:function(olBounds){var moBounds=null;if(olBounds!=null){var sw=this.sphericalMercator?this.inverseMercator(olBounds.bottom,olBounds.left):new OpenLayers.LonLat(olBounds.bottom,olBounds.left);var ne=this.sphericalMercator?this.inverseMercator(olBounds.top,olBounds.right):new OpenLayers.LonLat(olBounds.top,olBounds.right);moBounds=new GLatLngBounds(new GLatLng(sw.lat,sw.lon),new GLatLng(ne.lat,ne.lon));}
return moBounds;},addContainerPxFunction:function(){if((typeof GMap2!="undefined")&&!GMap2.prototype.fromLatLngToContainerPixel){GMap2.prototype.fromLatLngToContainerPixel=function(gLatLng){var gPoint=this.fromLatLngToDivPixel(gLatLng);var div=this.getContainer().firstChild.firstChild;gPoint.x+=div.offsetLeft;gPoint.y+=div.offsetTop;return gPoint;};}},getWarningHTML:function(){return OpenLayers.i18n("googleWarning");},setMapObjectCenter:function(center,zoom){this.mapObject.setCenter(center,zoom);},dragPanMapObject:function(dX,dY){this.dragObject.moveBy(new GSize(-dX,dY));},getMapObjectCenter:function(){return this.mapObject.getCenter();},getMapObjectZoom:function(){return this.mapObject.getZoom();},getMapObjectLonLatFromMapObjectPixel:function(moPixel){return this.mapObject.fromContainerPixelToLatLng(moPixel);},getMapObjectPixelFromMapObjectLonLat:function(moLonLat){return this.mapObject.fromLatLngToContainerPixel(moLonLat);},getMapObjectZoomFromMapObjectBounds:function(moBounds){return this.mapObject.getBoundsZoomLevel(moBounds);},getLongitudeFromMapObjectLonLat:function(moLonLat){return this.sphericalMercator?this.forwardMercator(moLonLat.lng(),moLonLat.lat()).lon:moLonLat.lng();},getLatitudeFromMapObjectLonLat:function(moLonLat){var lat=this.sphericalMercator?this.forwardMercator(moLonLat.lng(),moLonLat.lat()).lat:moLonLat.lat();return lat;},getMapObjectLonLatFromLonLat:function(lon,lat){var gLatLng;if(this.sphericalMercator){var lonlat=this.inverseMercator(lon,lat);gLatLng=new GLatLng(lonlat.lat,lonlat.lon);}else{gLatLng=new GLatLng(lat,lon);}
return gLatLng;},getXFromMapObjectPixel:function(moPixel){return moPixel.x;},getYFromMapObjectPixel:function(moPixel){return moPixel.y;},getMapObjectPixelFromXY:function(x,y){return new GPoint(x,y);},CLASS_NAME:"OpenLayers.Layer.Google"});OpenLayers.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,grid:null,singleTile:false,ratio:1.5,buffer:2,numLoadingTiles:0,initialize:function(name,url,params,options){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.events.addEventType("tileloaded");this.grid=[];},destroy:function(){this.clearGrid();this.grid=null;this.tileSize=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments);},clearGrid:function(){if(this.grid){for(var iRow=0,len=this.grid.length;iRow<len;iRow++){var row=this.grid[iRow];for(var iCol=0,clen=row.length;iCol<clen;iCol++){var tile=row[iCol];this.removeTileMonitoringHooks(tile);tile.destroy();}}
this.grid=[];}},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.Grid(this.name,this.url,this.params,this.options);}
obj=OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this,[obj]);if(this.tileSize!=null){obj.tileSize=this.tileSize.clone();}
obj.grid=[];return obj;},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);bounds=bounds||this.map.getExtent();if(bounds!=null){var forceReTile=!this.grid.length||zoomChanged;var tilesBounds=this.getTilesBounds();if(this.singleTile){if(forceReTile||(!dragging&&!tilesBounds.containsBounds(bounds))){this.initSingleTile(bounds);}}else{if(forceReTile||!tilesBounds.containsBounds(bounds,true)){this.initGriddedTiles(bounds);}else{this.moveGriddedTiles(bounds);}}}},setTileSize:function(size){if(this.singleTile){size=this.map.getSize().clone();size.h=parseInt(size.h*this.ratio);size.w=parseInt(size.w*this.ratio);}
OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this,[size]);},getGridBounds:function(){var msg="The getGridBounds() function is deprecated. It will be "+"removed in 3.0. Please use getTilesBounds() instead.";OpenLayers.Console.warn(msg);return this.getTilesBounds();},getTilesBounds:function(){var bounds=null;if(this.grid.length){var bottom=this.grid.length-1;var bottomLeftTile=this.grid[bottom][0];var right=this.grid[0].length-1;var topRightTile=this.grid[0][right];bounds=new OpenLayers.Bounds(bottomLeftTile.bounds.left,bottomLeftTile.bounds.bottom,topRightTile.bounds.right,topRightTile.bounds.top);}
return bounds;},initSingleTile:function(bounds){var center=bounds.getCenterLonLat();var tileWidth=bounds.getWidth()*this.ratio;var tileHeight=bounds.getHeight()*this.ratio;var tileBounds=new OpenLayers.Bounds(center.lon-(tileWidth/2),center.lat-(tileHeight/2),center.lon+(tileWidth/2),center.lat+(tileHeight/2));var ul=new OpenLayers.LonLat(tileBounds.left,tileBounds.top);var px=this.map.getLayerPxFromLonLat(ul);if(!this.grid.length){this.grid[0]=[];}
var tile=this.grid[0][0];if(!tile){tile=this.addTile(tileBounds,px);this.addTileMonitoringHooks(tile);tile.draw();this.grid[0][0]=tile;}else{tile.moveTo(tileBounds,px);}
this.removeExcessTiles(1,1);},calculateGridLayout:function(bounds,extent,resolution){var tilelon=resolution*this.tileSize.w;var tilelat=resolution*this.tileSize.h;var offsetlon=bounds.left-extent.left;var tilecol=Math.floor(offsetlon/tilelon)-this.buffer;var tilecolremain=offsetlon/tilelon-tilecol;var tileoffsetx=-tilecolremain*this.tileSize.w;var tileoffsetlon=extent.left+tilecol*tilelon;var offsetlat=bounds.top-(extent.bottom+tilelat);var tilerow=Math.ceil(offsetlat/tilelat)+this.buffer;var tilerowremain=tilerow-offsetlat/tilelat;var tileoffsety=-tilerowremain*this.tileSize.h;var tileoffsetlat=extent.bottom+tilerow*tilelat;return{tilelon:tilelon,tilelat:tilelat,tileoffsetlon:tileoffsetlon,tileoffsetlat:tileoffsetlat,tileoffsetx:tileoffsetx,tileoffsety:tileoffsety};},initGriddedTiles:function(bounds){var viewSize=this.map.getSize();var minRows=Math.ceil(viewSize.h/this.tileSize.h)+
Math.max(1,2*this.buffer);var minCols=Math.ceil(viewSize.w/this.tileSize.w)+
Math.max(1,2*this.buffer);var extent=this.maxExtent;var resolution=this.map.getResolution();var tileLayout=this.calculateGridLayout(bounds,extent,resolution);var tileoffsetx=Math.round(tileLayout.tileoffsetx);var tileoffsety=Math.round(tileLayout.tileoffsety);var tileoffsetlon=tileLayout.tileoffsetlon;var tileoffsetlat=tileLayout.tileoffsetlat;var tilelon=tileLayout.tilelon;var tilelat=tileLayout.tilelat;this.origin=new OpenLayers.Pixel(tileoffsetx,tileoffsety);var startX=tileoffsetx;var startLon=tileoffsetlon;var rowidx=0;var layerContainerDivLeft=parseInt(this.map.layerContainerDiv.style.left);var layerContainerDivTop=parseInt(this.map.layerContainerDiv.style.top);do{var row=this.grid[rowidx++];if(!row){row=[];this.grid.push(row);}
tileoffsetlon=startLon;tileoffsetx=startX;var colidx=0;do{var tileBounds=new OpenLayers.Bounds(tileoffsetlon,tileoffsetlat,tileoffsetlon+tilelon,tileoffsetlat+tilelat);var x=tileoffsetx;x-=layerContainerDivLeft;var y=tileoffsety;y-=layerContainerDivTop;var px=new OpenLayers.Pixel(x,y);var tile=row[colidx++];if(!tile){tile=this.addTile(tileBounds,px);this.addTileMonitoringHooks(tile);row.push(tile);}else{tile.moveTo(tileBounds,px,false);}
tileoffsetlon+=tilelon;tileoffsetx+=this.tileSize.w;}while((tileoffsetlon<=bounds.right+tilelon*this.buffer)||colidx<minCols);tileoffsetlat-=tilelat;tileoffsety+=this.tileSize.h;}while((tileoffsetlat>=bounds.bottom-tilelat*this.buffer)||rowidx<minRows);this.removeExcessTiles(rowidx,colidx);this.spiralTileLoad();},spiralTileLoad:function(){var tileQueue=[];var directions=["right","down","left","up"];var iRow=0;var iCell=-1;var direction=OpenLayers.Util.indexOf(directions,"right");var directionsTried=0;while(directionsTried<directions.length){var testRow=iRow;var testCell=iCell;switch(directions[direction]){case"right":testCell++;break;case"down":testRow++;break;case"left":testCell--;break;case"up":testRow--;break;}
var tile=null;if((testRow<this.grid.length)&&(testRow>=0)&&(testCell<this.grid[0].length)&&(testCell>=0)){tile=this.grid[testRow][testCell];}
if((tile!=null)&&(!tile.queued)){tileQueue.unshift(tile);tile.queued=true;directionsTried=0;iRow=testRow;iCell=testCell;}else{direction=(direction+1)%4;directionsTried++;}}
for(var i=0,len=tileQueue.length;i<len;i++){var tile=tileQueue[i];tile.draw();tile.queued=false;}},addTile:function(bounds,position){},addTileMonitoringHooks:function(tile){tile.onLoadStart=function(){if(this.numLoadingTiles==0){this.events.triggerEvent("loadstart");}
this.numLoadingTiles++;};tile.events.register("loadstart",this,tile.onLoadStart);tile.onLoadEnd=function(){this.numLoadingTiles--;this.events.triggerEvent("tileloaded");if(this.numLoadingTiles==0){this.events.triggerEvent("loadend");}};tile.events.register("loadend",this,tile.onLoadEnd);tile.events.register("unload",this,tile.onLoadEnd);},removeTileMonitoringHooks:function(tile){tile.unload();tile.events.un({"loadstart":tile.onLoadStart,"loadend":tile.onLoadEnd,"unload":tile.onLoadEnd,scope:this});},moveGriddedTiles:function(bounds){var buffer=this.buffer||1;while(true){var tlLayer=this.grid[0][0].position;var tlViewPort=this.map.getViewPortPxFromLayerPx(tlLayer);if(tlViewPort.x>-this.tileSize.w*(buffer-1)){this.shiftColumn(true);}else if(tlViewPort.x<-this.tileSize.w*buffer){this.shiftColumn(false);}else if(tlViewPort.y>-this.tileSize.h*(buffer-1)){this.shiftRow(true);}else if(tlViewPort.y<-this.tileSize.h*buffer){this.shiftRow(false);}else{break;}};},shiftRow:function(prepend){var modelRowIndex=(prepend)?0:(this.grid.length-1);var grid=this.grid;var modelRow=grid[modelRowIndex];var resolution=this.map.getResolution();var deltaY=(prepend)?-this.tileSize.h:this.tileSize.h;var deltaLat=resolution*-deltaY;var row=(prepend)?grid.pop():grid.shift();for(var i=0,len=modelRow.length;i<len;i++){var modelTile=modelRow[i];var bounds=modelTile.bounds.clone();var position=modelTile.position.clone();bounds.bottom=bounds.bottom+deltaLat;bounds.top=bounds.top+deltaLat;position.y=position.y+deltaY;row[i].moveTo(bounds,position);}
if(prepend){grid.unshift(row);}else{grid.push(row);}},shiftColumn:function(prepend){var deltaX=(prepend)?-this.tileSize.w:this.tileSize.w;var resolution=this.map.getResolution();var deltaLon=resolution*deltaX;for(var i=0,len=this.grid.length;i<len;i++){var row=this.grid[i];var modelTileIndex=(prepend)?0:(row.length-1);var modelTile=row[modelTileIndex];var bounds=modelTile.bounds.clone();var position=modelTile.position.clone();bounds.left=bounds.left+deltaLon;bounds.right=bounds.right+deltaLon;position.x=position.x+deltaX;var tile=prepend?this.grid[i].pop():this.grid[i].shift();tile.moveTo(bounds,position);if(prepend){row.unshift(tile);}else{row.push(tile);}}},removeExcessTiles:function(rows,columns){while(this.grid.length>rows){var row=this.grid.pop();for(var i=0,l=row.length;i<l;i++){var tile=row[i];this.removeTileMonitoringHooks(tile);tile.destroy();}}
while(this.grid[0].length>columns){for(var i=0,l=this.grid.length;i<l;i++){var row=this.grid[i];var tile=row.pop();this.removeTileMonitoringHooks(tile);tile.destroy();}}},onMapResize:function(){if(this.singleTile){this.clearGrid();this.setTileSize();}},getTileBounds:function(viewPortPx){var maxExtent=this.maxExtent;var resolution=this.getResolution();var tileMapWidth=resolution*this.tileSize.w;var tileMapHeight=resolution*this.tileSize.h;var mapPoint=this.getLonLatFromViewPortPx(viewPortPx);var tileLeft=maxExtent.left+(tileMapWidth*Math.floor((mapPoint.lon-
maxExtent.left)/tileMapWidth));var tileBottom=maxExtent.bottom+(tileMapHeight*Math.floor((mapPoint.lat-
maxExtent.bottom)/tileMapHeight));return new OpenLayers.Bounds(tileLeft,tileBottom,tileLeft+tileMapWidth,tileBottom+tileMapHeight);},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Layer.VirtualEarth=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:1,MAX_ZOOM_LEVEL:17,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.00002145767211914062],type:null,sphericalMercator:false,initialize:function(name,options){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);if(this.sphericalMercator){OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator);this.initMercatorParameters();}},loadMapObject:function(){var veDiv=OpenLayers.Util.createDiv(this.name);var sz=this.map.getSize();veDiv.style.width=sz.w+"px";veDiv.style.height=sz.h+"px";this.div.appendChild(veDiv);try{this.mapObject=new VEMap(this.name);}catch(e){}
if(this.mapObject!=null){try{this.mapObject.LoadMap(null,null,this.type,true);this.mapObject.AttachEvent("onmousedown",function(){return true;});}catch(e){}
this.mapObject.HideDashboard();}
if(!this.mapObject||!this.mapObject.vemapcontrol||!this.mapObject.vemapcontrol.PanMap||(typeof this.mapObject.vemapcontrol.PanMap!="function")){this.dragPanMapObject=null;}},getWarningHTML:function(){return OpenLayers.i18n("getLayerWarning",{'layerType':'VE','layerLib':'VirtualEarth'});},setMapObjectCenter:function(center,zoom){this.mapObject.SetCenterAndZoom(center,zoom);},getMapObjectCenter:function(){return this.mapObject.GetCenter();},dragPanMapObject:function(dX,dY){this.mapObject.vemapcontrol.PanMap(dX,-dY);},getMapObjectZoom:function(){return this.mapObject.GetZoomLevel();},getMapObjectLonLatFromMapObjectPixel:function(moPixel){return(typeof VEPixel!='undefined')?this.mapObject.PixelToLatLong(moPixel):this.mapObject.PixelToLatLong(moPixel.x,moPixel.y);},getMapObjectPixelFromMapObjectLonLat:function(moLonLat){return this.mapObject.LatLongToPixel(moLonLat);},getLongitudeFromMapObjectLonLat:function(moLonLat){return this.sphericalMercator?this.forwardMercator(moLonLat.Longitude,moLonLat.Latitude).lon:moLonLat.Longitude;},getLatitudeFromMapObjectLonLat:function(moLonLat){return this.sphericalMercator?this.forwardMercator(moLonLat.Longitude,moLonLat.Latitude).lat:moLonLat.Latitude;},getMapObjectLonLatFromLonLat:function(lon,lat){var veLatLong;if(this.sphericalMercator){var lonlat=this.inverseMercator(lon,lat);veLatLong=new VELatLong(lonlat.lat,lonlat.lon);}else{veLatLong=new VELatLong(lat,lon);}
return veLatLong;},getXFromMapObjectPixel:function(moPixel){return moPixel.x;},getYFromMapObjectPixel:function(moPixel){return moPixel.y;},getMapObjectPixelFromXY:function(x,y){return(typeof VEPixel!='undefined')?new VEPixel(x,y):new Msn.VE.Pixel(x,y);},CLASS_NAME:"OpenLayers.Layer.VirtualEarth"});OpenLayers.Layer.Yahoo=OpenLayers.Class(OpenLayers.Layer.EventPane,OpenLayers.Layer.FixedZoomLevels,{MIN_ZOOM_LEVEL:0,MAX_ZOOM_LEVEL:17,RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.00002145767211914062,0.00001072883605957031],type:null,sphericalMercator:false,initialize:function(name,options){OpenLayers.Layer.EventPane.prototype.initialize.apply(this,arguments);OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,arguments);if(this.sphericalMercator){OpenLayers.Util.extend(this,OpenLayers.Layer.SphericalMercator);this.initMercatorParameters();}},loadMapObject:function(){try{var size=this.getMapObjectSizeFromOLSize(this.map.getSize());this.mapObject=new YMap(this.div,this.type,size);this.mapObject.disableKeyControls();this.mapObject.disableDragMap();if(!this.mapObject.moveByXY||(typeof this.mapObject.moveByXY!="function")){this.dragPanMapObject=null;}}catch(e){}},onMapResize:function(){try{var size=this.getMapObjectSizeFromOLSize(this.map.getSize());this.mapObject.resizeTo(size);}catch(e){}},setMap:function(map){OpenLayers.Layer.EventPane.prototype.setMap.apply(this,arguments);this.map.events.register("moveend",this,this.fixYahooEventPane);},fixYahooEventPane:function(){var yahooEventPane=OpenLayers.Util.getElement("ygddfdiv");if(yahooEventPane!=null){if(yahooEventPane.parentNode!=null){yahooEventPane.parentNode.removeChild(yahooEventPane);}
this.map.events.unregister("moveend",this,this.fixYahooEventPane);}},getWarningHTML:function(){return OpenLayers.i18n("getLayerWarning",{'layerType':'Yahoo','layerLib':'Yahoo'});},getOLZoomFromMapObjectZoom:function(moZoom){var zoom=null;if(moZoom!=null){zoom=OpenLayers.Layer.FixedZoomLevels.prototype.getOLZoomFromMapObjectZoom.apply(this,[moZoom]);zoom=18-zoom;}
return zoom;},getMapObjectZoomFromOLZoom:function(olZoom){var zoom=null;if(olZoom!=null){zoom=OpenLayers.Layer.FixedZoomLevels.prototype.getMapObjectZoomFromOLZoom.apply(this,[olZoom]);zoom=18-zoom;}
return zoom;},setMapObjectCenter:function(center,zoom){this.mapObject.drawZoomAndCenter(center,zoom);},getMapObjectCenter:function(){return this.mapObject.getCenterLatLon();},dragPanMapObject:function(dX,dY){this.mapObject.moveByXY({'x':-dX,'y':dY});},getMapObjectZoom:function(){return this.mapObject.getZoomLevel();},getMapObjectLonLatFromMapObjectPixel:function(moPixel){return this.mapObject.convertXYLatLon(moPixel);},getMapObjectPixelFromMapObjectLonLat:function(moLonLat){return this.mapObject.convertLatLonXY(moLonLat);},getLongitudeFromMapObjectLonLat:function(moLonLat){return this.sphericalMercator?this.forwardMercator(moLonLat.Lon,moLonLat.Lat).lon:moLonLat.Lon;},getLatitudeFromMapObjectLonLat:function(moLonLat){return this.sphericalMercator?this.forwardMercator(moLonLat.Lon,moLonLat.Lat).lat:moLonLat.Lat;},getMapObjectLonLatFromLonLat:function(lon,lat){var yLatLong;if(this.sphericalMercator){var lonlat=this.inverseMercator(lon,lat);yLatLong=new YGeoPoint(lonlat.lat,lonlat.lon);}else{yLatLong=new YGeoPoint(lat,lon);}
return yLatLong;},getXFromMapObjectPixel:function(moPixel){return moPixel.x;},getYFromMapObjectPixel:function(moPixel){return moPixel.y;},getMapObjectPixelFromXY:function(x,y){return new YCoordPoint(x,y);},getMapObjectSizeFromOLSize:function(olSize){return new YSize(olSize.w,olSize.h);},CLASS_NAME:"OpenLayers.Layer.Yahoo"});OpenLayers.Protocol.HTTP=OpenLayers.Class(OpenLayers.Protocol,{url:null,headers:null,params:null,callback:null,scope:null,readWithPOST:false,initialize:function(options){this.params={};this.headers={};OpenLayers.Protocol.prototype.initialize.apply(this,arguments);},destroy:function(){this.params=null;this.headers=null;OpenLayers.Protocol.prototype.destroy.apply(this);},createCallback:function(method,response,options){return OpenLayers.Function.bind(function(){method.apply(this,[response,options]);},this);},read:function(options){options=OpenLayers.Util.applyDefaults(options,this.options);var readWithPOST=(options.readWithPOST!==undefined)?options.readWithPOST:this.readWithPOST;var resp=new OpenLayers.Protocol.Response({requestType:"read"});if(options.filter&&options.filter instanceof OpenLayers.Filter.Spatial){if(options.filter.type==OpenLayers.Filter.Spatial.BBOX){options.params=OpenLayers.Util.extend(options.params,{bbox:options.filter.value.toArray()});}}
if(readWithPOST){resp.priv=OpenLayers.Request.POST({url:options.url,callback:this.createCallback(this.handleRead,resp,options),data:OpenLayers.Util.getParameterString(options.params),headers:{"Content-Type":"application/x-www-form-urlencoded"}});}else{resp.priv=OpenLayers.Request.GET({url:options.url,callback:this.createCallback(this.handleRead,resp,options),params:options.params,headers:options.headers});}
return resp;},handleRead:function(resp,options){this.handleResponse(resp,options);},create:function(features,options){options=OpenLayers.Util.applyDefaults(options,this.options);var resp=new OpenLayers.Protocol.Response({reqFeatures:features,requestType:"create"});resp.priv=OpenLayers.Request.POST({url:options.url,callback:this.createCallback(this.handleCreate,resp,options),headers:options.headers,data:this.format.write(features)});return resp;},handleCreate:function(resp,options){this.handleResponse(resp,options);},update:function(feature,options){var url=options.url||feature.url||this.options.url;options=OpenLayers.Util.applyDefaults(options,this.options);var resp=new OpenLayers.Protocol.Response({reqFeatures:feature,requestType:"update"});resp.priv=OpenLayers.Request.PUT({url:url,callback:this.createCallback(this.handleUpdate,resp,options),headers:options.headers,data:this.format.write(feature)});return resp;},handleUpdate:function(resp,options){this.handleResponse(resp,options);},"delete":function(feature,options){var url=options.url||feature.url||this.options.url;options=OpenLayers.Util.applyDefaults(options,this.options);var resp=new OpenLayers.Protocol.Response({reqFeatures:feature,requestType:"delete"});resp.priv=OpenLayers.Request.DELETE({url:url,callback:this.createCallback(this.handleDelete,resp,options),headers:options.headers});return resp;},handleDelete:function(resp,options){this.handleResponse(resp,options);},handleResponse:function(resp,options){var request=resp.priv;if(options.callback){if(request.status>=200&&request.status<300){if(resp.requestType!="delete"){resp.features=this.parseFeatures(request);}
resp.code=OpenLayers.Protocol.Response.SUCCESS;}else{resp.code=OpenLayers.Protocol.Response.FAILURE;}
options.callback.call(options.scope,resp);}},parseFeatures:function(request){var doc=request.responseXML;if(!doc||!doc.documentElement){doc=request.responseText;}
if(!doc||doc.length<=0){return null;}
return this.format.read(doc);},commit:function(features,options){options=OpenLayers.Util.applyDefaults(options,this.options);var resp=[],nResponses=0;var types={};types[OpenLayers.State.INSERT]=[];types[OpenLayers.State.UPDATE]=[];types[OpenLayers.State.DELETE]=[];var feature,list,requestFeatures=[];for(var i=0,len=features.length;i<len;++i){feature=features[i];list=types[feature.state];if(list){list.push(feature);requestFeatures.push(feature);}}
var nRequests=(types[OpenLayers.State.INSERT].length>0?1:0)+
types[OpenLayers.State.UPDATE].length+
types[OpenLayers.State.DELETE].length;var success=true;var finalResponse=new OpenLayers.Protocol.Response({reqFeatures:requestFeatures});function insertCallback(response){var len=response.features?response.features.length:0;var fids=new Array(len);for(var i=0;i<len;++i){fids[i]=response.features[i].fid;}
finalResponse.insertIds=fids;callback.apply(this,[response]);}
function callback(response){this.callUserCallback(response,options);success=success&&response.success();nResponses++;if(nResponses>=nRequests){if(options.callback){finalResponse.code=success?OpenLayers.Protocol.Response.SUCCESS:OpenLayers.Protocol.Response.FAILURE;options.callback.apply(options.scope,[finalResponse]);}}}
var queue=types[OpenLayers.State.INSERT];if(queue.length>0){resp.push(this.create(queue,OpenLayers.Util.applyDefaults({callback:insertCallback,scope:this},options.create)));}
queue=types[OpenLayers.State.UPDATE];for(var i=queue.length-1;i>=0;--i){resp.push(this.update(queue[i],OpenLayers.Util.applyDefaults({callback:callback,scope:this},options.update)));}
queue=types[OpenLayers.State.DELETE];for(var i=queue.length-1;i>=0;--i){resp.push(this["delete"](queue[i],OpenLayers.Util.applyDefaults({callback:callback,scope:this},options["delete"])));}
return resp;},abort:function(response){if(response){response.priv.abort();}},callUserCallback:function(resp,options){var opt=options[resp.requestType];if(opt&&opt.callback){opt.callback.call(opt.scope,resp);}},CLASS_NAME:"OpenLayers.Protocol.HTTP"});OpenLayers.Style=OpenLayers.Class({name:null,title:null,description:null,layerName:null,isDefault:false,rules:null,context:null,defaultStyle:null,defaultsPerSymbolizer:false,propertyStyles:null,initialize:function(style,options){OpenLayers.Util.extend(this,options);this.rules=[];if(options&&options.rules){this.addRules(options.rules);}
this.setDefaultStyle(style||OpenLayers.Feature.Vector.style["default"]);},destroy:function(){for(var i=0,len=this.rules.length;i<len;i++){this.rules[i].destroy();this.rules[i]=null;}
this.rules=null;this.defaultStyle=null;},createSymbolizer:function(feature){var style=this.defaultsPerSymbolizer?{}:this.createLiterals(OpenLayers.Util.extend({},this.defaultStyle),feature);var rules=this.rules;var rule,context;var elseRules=[];var appliedRules=false;for(var i=0,len=rules.length;i<len;i++){rule=rules[i];var applies=rule.evaluate(feature);if(applies){if(rule instanceof OpenLayers.Rule&&rule.elseFilter){elseRules.push(rule);}else{appliedRules=true;this.applySymbolizer(rule,style,feature);}}}
if(appliedRules==false&&elseRules.length>0){appliedRules=true;for(var i=0,len=elseRules.length;i<len;i++){this.applySymbolizer(elseRules[i],style,feature);}}
if(rules.length>0&&appliedRules==false){style.display="none";}
return style;},applySymbolizer:function(rule,style,feature){var symbolizerPrefix=feature.geometry?this.getSymbolizerPrefix(feature.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0];var symbolizer=rule.symbolizer[symbolizerPrefix]||rule.symbolizer;if(this.defaultsPerSymbolizer===true){var defaults=this.defaultStyle;OpenLayers.Util.applyDefaults(symbolizer,{pointRadius:defaults.pointRadius});if(symbolizer.stroke===true||symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{strokeWidth:defaults.strokeWidth,strokeColor:defaults.strokeColor,strokeOpacity:defaults.strokeOpacity,strokeDashstyle:defaults.strokeDashstyle,strokeLinecap:defaults.strokeLinecap});}
if(symbolizer.fill===true||symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{fillColor:defaults.fillColor,fillOpacity:defaults.fillOpacity});}
if(symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{pointRadius:this.defaultStyle.pointRadius,externalGraphic:this.defaultStyle.externalGraphic,graphicName:this.defaultStyle.graphicName,graphicOpacity:this.defaultStyle.graphicOpacity,graphicWidth:this.defaultStyle.graphicWidth,graphicHeight:this.defaultStyle.graphicHeight,graphicXOffset:this.defaultStyle.graphicXOffset,graphicYOffset:this.defaultStyle.graphicYOffset});}}
return this.createLiterals(OpenLayers.Util.extend(style,symbolizer),feature);},createLiterals:function(style,feature){var context=OpenLayers.Util.extend({},feature.data);OpenLayers.Util.extend(context,feature.attributes);OpenLayers.Util.extend(context,this.context);for(var i in this.propertyStyles){style[i]=OpenLayers.Style.createLiteral(style[i],context,feature);}
return style;},findPropertyStyles:function(){var propertyStyles={};var style=this.defaultStyle;this.addPropertyStyles(propertyStyles,style);var rules=this.rules;var symbolizer,value;for(var i=0,len=rules.length;i<len;i++){symbolizer=rules[i].symbolizer;for(var key in symbolizer){value=symbolizer[key];if(typeof value=="object"){this.addPropertyStyles(propertyStyles,value);}else{this.addPropertyStyles(propertyStyles,symbolizer);break;}}}
return propertyStyles;},addPropertyStyles:function(propertyStyles,symbolizer){var property;for(var key in symbolizer){property=symbolizer[key];if(typeof property=="string"&&property.match(/\$\{\w+\}/)){propertyStyles[key]=true;}}
return propertyStyles;},addRules:function(rules){this.rules=this.rules.concat(rules);this.propertyStyles=this.findPropertyStyles();},setDefaultStyle:function(style){this.defaultStyle=style;this.propertyStyles=this.findPropertyStyles();},getSymbolizerPrefix:function(geometry){var prefixes=OpenLayers.Style.SYMBOLIZER_PREFIXES;for(var i=0,len=prefixes.length;i<len;i++){if(geometry.CLASS_NAME.indexOf(prefixes[i])!=-1){return prefixes[i];}}},CLASS_NAME:"OpenLayers.Style"});OpenLayers.Style.createLiteral=function(value,context,feature){if(typeof value=="string"&&value.indexOf("${")!=-1){value=OpenLayers.String.format(value,context,[feature]);value=(isNaN(value)||!value)?value:parseFloat(value);}
return value;};OpenLayers.Style.SYMBOLIZER_PREFIXES=['Point','Line','Polygon','Text'];OpenLayers.Control.Navigation=OpenLayers.Class(OpenLayers.Control,{dragPan:null,dragPanOptions:null,zoomBox:null,zoomWheelEnabled:true,handleRightClicks:false,zoomBoxKeyMask:OpenLayers.Handler.MOD_SHIFT,initialize:function(options){this.handlers={};OpenLayers.Control.prototype.initialize.apply(this,arguments);},destroy:function(){this.deactivate();if(this.dragPan){this.dragPan.destroy();}
this.dragPan=null;if(this.zoomBox){this.zoomBox.destroy();}
this.zoomBox=null;OpenLayers.Control.prototype.destroy.apply(this,arguments);},activate:function(){this.dragPan.activate();if(this.zoomWheelEnabled){this.handlers.wheel.activate();}
this.handlers.click.activate();this.zoomBox.activate();return OpenLayers.Control.prototype.activate.apply(this,arguments);},deactivate:function(){this.zoomBox.deactivate();this.dragPan.deactivate();this.handlers.click.deactivate();this.handlers.wheel.deactivate();return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},draw:function(){if(this.handleRightClicks){this.map.viewPortDiv.oncontextmenu=function(){return false;};}
var clickCallbacks={'dblclick':this.defaultDblClick,'dblrightclick':this.defaultDblRightClick};var clickOptions={'double':true,'stopDouble':true};this.handlers.click=new OpenLayers.Handler.Click(this,clickCallbacks,clickOptions);this.dragPan=new OpenLayers.Control.DragPan(OpenLayers.Util.extend({map:this.map},this.dragPanOptions));this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:this.zoomBoxKeyMask});this.dragPan.draw();this.zoomBox.draw();this.handlers.wheel=new OpenLayers.Handler.MouseWheel(this,{"up":this.wheelUp,"down":this.wheelDown});this.activate();},defaultDblClick:function(evt){var newCenter=this.map.getLonLatFromViewPortPx(evt.xy);this.map.setCenter(newCenter,this.map.zoom+1);},defaultDblRightClick:function(evt){var newCenter=this.map.getLonLatFromViewPortPx(evt.xy);this.map.setCenter(newCenter,this.map.zoom-1);},wheelChange:function(evt,deltaZ){var newZoom=this.map.getZoom()+deltaZ;if(!this.map.isValidZoomLevel(newZoom)){return;}
var size=this.map.getSize();var deltaX=size.w/2-evt.xy.x;var deltaY=evt.xy.y-size.h/2;var newRes=this.map.baseLayer.getResolutionForZoom(newZoom);var zoomPoint=this.map.getLonLatFromPixel(evt.xy);var newCenter=new OpenLayers.LonLat(zoomPoint.lon+deltaX*newRes,zoomPoint.lat+deltaY*newRes);this.map.setCenter(newCenter,newZoom);},wheelUp:function(evt){this.wheelChange(evt,1);},wheelDown:function(evt){this.wheelChange(evt,-1);},disableZoomWheel:function(){this.zoomWheelEnabled=false;this.handlers.wheel.deactivate();},enableZoomWheel:function(){this.zoomWheelEnabled=true;if(this.active){this.handlers.wheel.activate();}},CLASS_NAME:"OpenLayers.Control.Navigation"});OpenLayers.Geometry=OpenLayers.Class({id:null,parent:null,bounds:null,initialize:function(){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){this.id=null;this.bounds=null;},clone:function(){return new OpenLayers.Geometry();},setBounds:function(bounds){if(bounds){this.bounds=bounds.clone();}},clearBounds:function(){this.bounds=null;if(this.parent){this.parent.clearBounds();}},extendBounds:function(newBounds){var bounds=this.getBounds();if(!bounds){this.setBounds(newBounds);}else{this.bounds.extend(newBounds);}},getBounds:function(){if(this.bounds==null){this.calculateBounds();}
return this.bounds;},calculateBounds:function(){},distanceTo:function(geometry,options){},getVertices:function(nodes){},atPoint:function(lonlat,toleranceLon,toleranceLat){var atPoint=false;var bounds=this.getBounds();if((bounds!=null)&&(lonlat!=null)){var dX=(toleranceLon!=null)?toleranceLon:0;var dY=(toleranceLat!=null)?toleranceLat:0;var toleranceBounds=new OpenLayers.Bounds(this.bounds.left-dX,this.bounds.bottom-dY,this.bounds.right+dX,this.bounds.top+dY);atPoint=toleranceBounds.containsLonLat(lonlat);}
return atPoint;},getLength:function(){return 0.0;},getArea:function(){return 0.0;},getCentroid:function(){return null;},toString:function(){return OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this));},CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(wkt){var format=arguments.callee.format;if(!format){format=new OpenLayers.Format.WKT();arguments.callee.format=format;}
var geom;var result=format.read(wkt);if(result instanceof OpenLayers.Feature.Vector){geom=result.geometry;}else if(result instanceof Array){var len=result.length;var components=new Array(len);for(var i=0;i<len;++i){components[i]=result[i].geometry;}
geom=new OpenLayers.Geometry.Collection(components);}
return geom;};OpenLayers.Geometry.segmentsIntersect=function(seg1,seg2,options){var point=options&&options.point;var tolerance=options&&options.tolerance;var intersection=false;var x11_21=seg1.x1-seg2.x1;var y11_21=seg1.y1-seg2.y1;var x12_11=seg1.x2-seg1.x1;var y12_11=seg1.y2-seg1.y1;var y22_21=seg2.y2-seg2.y1;var x22_21=seg2.x2-seg2.x1;var d=(y22_21*x12_11)-(x22_21*y12_11);var n1=(x22_21*y11_21)-(y22_21*x11_21);var n2=(x12_11*y11_21)-(y12_11*x11_21);if(d==0){if(n1==0&&n2==0){intersection=true;}}else{var along1=n1/d;var along2=n2/d;if(along1>=0&&along1<=1&&along2>=0&&along2<=1){if(!point){intersection=true;}else{var x=seg1.x1+(along1*x12_11);var y=seg1.y1+(along1*y12_11);intersection=new OpenLayers.Geometry.Point(x,y);}}}
if(tolerance){var dist;if(intersection){if(point){var segs=[seg1,seg2];var seg,x,y;outer:for(var i=0;i<2;++i){seg=segs[i];for(var j=1;j<3;++j){x=seg["x"+j];y=seg["y"+j];dist=Math.sqrt(Math.pow(x-intersection.x,2)+
Math.pow(y-intersection.y,2));if(dist<tolerance){intersection.x=x;intersection.y=y;break outer;}}}}}else{var segs=[seg1,seg2];var source,target,x,y,p,result;outer:for(var i=0;i<2;++i){source=segs[i];target=segs[(i+1)%2];for(var j=1;j<3;++j){p={x:source["x"+j],y:source["y"+j]};result=OpenLayers.Geometry.distanceToSegment(p,target);if(result.distance<tolerance){if(point){intersection=new OpenLayers.Geometry.Point(p.x,p.y);}else{intersection=true;}
break outer;}}}}}
return intersection;};OpenLayers.Geometry.distanceToSegment=function(point,segment){var x0=point.x;var y0=point.y;var x1=segment.x1;var y1=segment.y1;var x2=segment.x2;var y2=segment.y2;var dx=x2-x1;var dy=y2-y1;var along=((dx*(x0-x1))+(dy*(y0-y1)))/(Math.pow(dx,2)+Math.pow(dy,2));var x,y;if(along<=0.0){x=x1;y=y1;}else if(along>=1.0){x=x2;y=y2;}else{x=x1+along*dx;y=y1+along*dy;}
return{distance:Math.sqrt(Math.pow(x-x0,2)+Math.pow(y-y0,2)),x:x,y:y};};OpenLayers.Layer.MapGuide=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,useHttpTile:false,singleTile:false,useOverlay:false,useAsyncOverlay:true,TILE_PARAMS:{operation:'GETTILEIMAGE',version:'1.2.0'},SINGLE_TILE_PARAMS:{operation:'GETMAPIMAGE',format:'PNG',locale:'en',clip:'1',version:'1.0.0'},OVERLAY_PARAMS:{operation:'GETDYNAMICMAPOVERLAYIMAGE',format:'PNG',locale:'en',clip:'1',version:'2.0.0'},FOLDER_PARAMS:{tileColumnsPerFolder:30,tileRowsPerFolder:30,format:'png',querystring:null},defaultSize:new OpenLayers.Size(300,300),initialize:function(name,url,params,options){OpenLayers.Layer.Grid.prototype.initialize.apply(this,arguments);if(options==null||options.isBaseLayer==null){this.isBaseLayer=((this.transparent!="true")&&(this.transparent!=true));}
if(options&&options.useOverlay!=null){this.useOverlay=options.useOverlay;}
if(this.singleTile){if(this.useOverlay){OpenLayers.Util.applyDefaults(this.params,this.OVERLAY_PARAMS);if(!this.useAsyncOverlay){this.params.version="1.0.0";}}else{OpenLayers.Util.applyDefaults(this.params,this.SINGLE_TILE_PARAMS);}}else{if(this.useHttpTile){OpenLayers.Util.applyDefaults(this.params,this.FOLDER_PARAMS);}else{OpenLayers.Util.applyDefaults(this.params,this.TILE_PARAMS);}
this.setTileSize(this.defaultSize);}},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.MapGuide(this.name,this.url,this.params,this.options);}
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},getURL:function(bounds){var url;var center=bounds.getCenterLonLat();var mapSize=this.map.getCurrentSize();if(this.singleTile){var params={setdisplaydpi:OpenLayers.DOTS_PER_INCH,setdisplayheight:mapSize.h*this.ratio,setdisplaywidth:mapSize.w*this.ratio,setviewcenterx:center.lon,setviewcentery:center.lat,setviewscale:this.map.getScale()};if(this.useOverlay&&!this.useAsyncOverlay){var getVisParams={};getVisParams=OpenLayers.Util.extend(getVisParams,params);getVisParams.operation="GETVISIBLEMAPEXTENT";getVisParams.version="1.0.0";getVisParams.session=this.params.session;getVisParams.mapName=this.params.mapName;getVisParams.format='text/xml';url=this.getFullRequestString(getVisParams);OpenLayers.Request.GET({url:url,async:false});}
url=this.getFullRequestString(params);}else{var currentRes=this.map.getResolution();var colidx=Math.floor((bounds.left-this.maxExtent.left)/currentRes);colidx=Math.round(colidx/this.tileSize.w);var rowidx=Math.floor((this.maxExtent.top-bounds.top)/currentRes);rowidx=Math.round(rowidx/this.tileSize.h);if(this.useHttpTile){url=this.getImageFilePath({tilecol:colidx,tilerow:rowidx,scaleindex:this.resolutions.length-this.map.zoom-1});}else{url=this.getFullRequestString({tilecol:colidx,tilerow:rowidx,scaleindex:this.resolutions.length-this.map.zoom-1});}}
return url;},getFullRequestString:function(newParams,altUrl){var url=(altUrl==null)?this.url:altUrl;if(typeof url=="object"){url=url[Math.floor(Math.random()*url.length)];}
var requestString=url;var allParams=OpenLayers.Util.extend({},this.params);allParams=OpenLayers.Util.extend(allParams,newParams);var urlParams=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getArgs(url));for(var key in allParams){if(key.toUpperCase()in urlParams){delete allParams[key];}}
var paramsString=OpenLayers.Util.getParameterString(allParams);paramsString=paramsString.replace(/,/g,"+");if(paramsString!=""){var lastServerChar=url.charAt(url.length-1);if((lastServerChar=="&")||(lastServerChar=="?")){requestString+=paramsString;}else{if(url.indexOf('?')==-1){requestString+='?'+paramsString;}else{requestString+='&'+paramsString;}}}
return requestString;},getImageFilePath:function(newParams,altUrl){var url=(altUrl==null)?this.url:altUrl;if(typeof url=="object"){url=url[Math.floor(Math.random()*url.length)];}
var requestString=url;var tileRowGroup="";var tileColGroup="";if(newParams.tilerow<0){tileRowGroup='-';}
if(newParams.tilerow==0){tileRowGroup+='0';}else{tileRowGroup+=Math.floor(Math.abs(newParams.tilerow/this.params.tileRowsPerFolder))*this.params.tileRowsPerFolder;}
if(newParams.tilecol<0){tileColGroup='-';}
if(newParams.tilecol==0){tileColGroup+='0';}else{tileColGroup+=Math.floor(Math.abs(newParams.tilecol/this.params.tileColumnsPerFolder))*this.params.tileColumnsPerFolder;}
var tilePath='/S'+Math.floor(newParams.scaleindex)
+'/'+this.params.basemaplayergroupname
+'/R'+tileRowGroup
+'/C'+tileColGroup
+'/'+(newParams.tilerow%this.params.tileRowsPerFolder)
+'_'+(newParams.tilecol%this.params.tileColumnsPerFolder)
+'.'+this.params.format;if(this.params.querystring){tilePath+="?"+this.params.querystring;}
requestString+=tilePath;return requestString;},calculateGridLayout:function(bounds,extent,resolution){var tilelon=resolution*this.tileSize.w;var tilelat=resolution*this.tileSize.h;var offsetlon=bounds.left-extent.left;var tilecol=Math.floor(offsetlon/tilelon)-this.buffer;var tilecolremain=offsetlon/tilelon-tilecol;var tileoffsetx=-tilecolremain*this.tileSize.w;var tileoffsetlon=extent.left+tilecol*tilelon;var offsetlat=extent.top-bounds.top+tilelat;var tilerow=Math.floor(offsetlat/tilelat)-this.buffer;var tilerowremain=tilerow-offsetlat/tilelat;var tileoffsety=tilerowremain*this.tileSize.h;var tileoffsetlat=extent.top-tilelat*tilerow;return{tilelon:tilelon,tilelat:tilelat,tileoffsetlon:tileoffsetlon,tileoffsetlat:tileoffsetlat,tileoffsetx:tileoffsetx,tileoffsety:tileoffsety};},CLASS_NAME:"OpenLayers.Layer.MapGuide"});OpenLayers.Layer.MapServer=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{mode:"map",map_imagetype:"png"},initialize:function(name,url,params,options){var newArguments=[];newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);this.params=OpenLayers.Util.applyDefaults(this.params,this.DEFAULT_PARAMS);if(options==null||options.isBaseLayer==null){this.isBaseLayer=((this.params.transparent!="true")&&(this.params.transparent!=true));}},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.MapServer(this.name,this.url,this.params,this.options);}
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},getURL:function(bounds){bounds=this.adjustBounds(bounds);var extent=[bounds.left,bounds.bottom,bounds.right,bounds.top];var imageSize=this.getImageSize();var url=this.getFullRequestString({mapext:extent,imgext:extent,map_size:[imageSize.w,imageSize.h],imgx:imageSize.w/2,imgy:imageSize.h/2,imgxy:[imageSize.w,imageSize.h]});return url;},getFullRequestString:function(newParams,altUrl){var url=(altUrl==null)?this.url:altUrl;var allParams=OpenLayers.Util.extend({},this.params);allParams=OpenLayers.Util.extend(allParams,newParams);var paramsString=OpenLayers.Util.getParameterString(allParams);if(url instanceof Array){url=this.selectUrl(paramsString,url);}
var urlParams=OpenLayers.Util.upperCaseObject(OpenLayers.Util.getParameters(url));for(var key in allParams){if(key.toUpperCase()in urlParams){delete allParams[key];}}
paramsString=OpenLayers.Util.getParameterString(allParams);var requestString=url;paramsString=paramsString.replace(/,/g,"+");if(paramsString!=""){var lastServerChar=url.charAt(url.length-1);if((lastServerChar=="&")||(lastServerChar=="?")){requestString+=paramsString;}else{if(url.indexOf('?')==-1){requestString+='?'+paramsString;}else{requestString+='&'+paramsString;}}}
return requestString;},CLASS_NAME:"OpenLayers.Layer.MapServer"});OpenLayers.Layer.WMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",exceptions:"application/vnd.ogc.se_inimage",format:"image/jpeg"},reproject:false,isBaseLayer:true,encodeBBOX:false,noMagic:false,initialize:function(name,url,params,options){var newArguments=[];params=OpenLayers.Util.upperCaseObject(params);newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if(!this.noMagic&&this.params.TRANSPARENT&&this.params.TRANSPARENT.toString().toLowerCase()=="true"){if((options==null)||(!options.isBaseLayer)){this.isBaseLayer=false;}
if(this.params.FORMAT=="image/jpeg"){this.params.FORMAT=OpenLayers.Util.alphaHack()?"image/gif":"image/png";}}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.options);}
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){bounds=this.adjustBounds(bounds);var imageSize=this.getImageSize();var newParams={'BBOX':this.encodeBBOX?bounds.toBBOX():bounds.toArray(),'WIDTH':imageSize.w,'HEIGHT':imageSize.h};var requestString=this.getFullRequestString(newParams);return requestString;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},mergeNewParams:function(newParams){var upperParams=OpenLayers.Util.upperCaseObject(newParams);var newArguments=[upperParams];return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,newArguments);},getFullRequestString:function(newParams,altUrl){var projectionCode=this.map.getProjection();this.params.SRS=(projectionCode=="none")?null:projectionCode;return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments);},CLASS_NAME:"OpenLayers.Layer.WMS"});OpenLayers.Rule=OpenLayers.Class({id:null,name:'default',title:null,description:null,context:null,filter:null,elseFilter:false,symbolizer:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(options){this.symbolizer={};OpenLayers.Util.extend(this,options);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){for(var i in this.symbolizer){this.symbolizer[i]=null;}
this.symbolizer=null;},evaluate:function(feature){var context=this.getContext(feature);var applies=true;if(this.minScaleDenominator||this.maxScaleDenominator){var scale=feature.layer.map.getScale();}
if(this.minScaleDenominator){applies=scale>=OpenLayers.Style.createLiteral(this.minScaleDenominator,context);}
if(applies&&this.maxScaleDenominator){applies=scale<OpenLayers.Style.createLiteral(this.maxScaleDenominator,context);}
if(applies&&this.filter){if(this.filter.CLASS_NAME=="OpenLayers.Filter.FeatureId"){applies=this.filter.evaluate(feature);}else{applies=this.filter.evaluate(context);}}
return applies;},getContext:function(feature){var context=this.context;if(!context){context=feature.attributes||feature.data;}
if(typeof this.context=="function"){context=this.context(feature);}
return context;},clone:function(){var options=OpenLayers.Util.extend({},this);options.symbolizer={};for(var key in this.symbolizer){value=this.symbolizer[key];type=typeof value;if(type==="object"){options.symbolizer[key]=OpenLayers.Util.extend({},value);}else if(type==="string"){options.symbolizer[key]=value;}}
options.filter=this.filter&&this.filter.clone();options.context=this.context&&OpenLayers.Util.extend({},this.context);return new OpenLayers.Rule(options);},CLASS_NAME:"OpenLayers.Rule"});OpenLayers.StyleMap=OpenLayers.Class({styles:null,extendDefault:true,initialize:function(style,options){this.styles={"default":new OpenLayers.Style(OpenLayers.Feature.Vector.style["default"]),"select":new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"]),"temporary":new OpenLayers.Style(OpenLayers.Feature.Vector.style["temporary"]),"delete":new OpenLayers.Style(OpenLayers.Feature.Vector.style["delete"])};if(style instanceof OpenLayers.Style){this.styles["default"]=style;this.styles["select"]=style;this.styles["temporary"]=style;this.styles["delete"]=style;}else if(typeof style=="object"){for(var key in style){if(style[key]instanceof OpenLayers.Style){this.styles[key]=style[key];}else if(typeof style[key]=="object"){this.styles[key]=new OpenLayers.Style(style[key]);}else{this.styles["default"]=new OpenLayers.Style(style);this.styles["select"]=new OpenLayers.Style(style);this.styles["temporary"]=new OpenLayers.Style(style);this.styles["delete"]=new OpenLayers.Style(style);break;}}}
OpenLayers.Util.extend(this,options);},destroy:function(){for(var key in this.styles){this.styles[key].destroy();}
this.styles=null;},createSymbolizer:function(feature,intent){if(!feature){feature=new OpenLayers.Feature.Vector();}
if(!this.styles[intent]){intent="default";}
feature.renderIntent=intent;var defaultSymbolizer={};if(this.extendDefault&&intent!="default"){defaultSymbolizer=this.styles["default"].createSymbolizer(feature);}
return OpenLayers.Util.extend(defaultSymbolizer,this.styles[intent].createSymbolizer(feature));},addUniqueValueRules:function(renderIntent,property,symbolizers,context){var rules=[];for(var value in symbolizers){rules.push(new OpenLayers.Rule({symbolizer:symbolizers[value],context:context,filter:new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:property,value:value})}));}
this.styles[renderIntent].addRules(rules);},CLASS_NAME:"OpenLayers.StyleMap"});OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(components){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];if(components!=null){this.addComponents(components);}},destroy:function(){this.components.length=0;this.components=null;},clone:function(){var geometry=eval("new "+this.CLASS_NAME+"()");for(var i=0,len=this.components.length;i<len;i++){geometry.addComponent(this.components[i].clone());}
OpenLayers.Util.applyDefaults(geometry,this);return geometry;},getComponentsString:function(){var strings=[];for(var i=0,len=this.components.length;i<len;i++){strings.push(this.components[i].toShortString());}
return strings.join(",");},calculateBounds:function(){this.bounds=null;if(this.components&&this.components.length>0){this.setBounds(this.components[0].getBounds());for(var i=1,len=this.components.length;i<len;i++){this.extendBounds(this.components[i].getBounds());}}},addComponents:function(components){if(!(components instanceof Array)){components=[components];}
for(var i=0,len=components.length;i<len;i++){this.addComponent(components[i]);}},addComponent:function(component,index){var added=false;if(component){if(this.componentTypes==null||(OpenLayers.Util.indexOf(this.componentTypes,component.CLASS_NAME)>-1)){if(index!=null&&(index<this.components.length)){var components1=this.components.slice(0,index);var components2=this.components.slice(index,this.components.length);components1.push(component);this.components=components1.concat(components2);}else{this.components.push(component);}
component.parent=this;this.clearBounds();added=true;}}
return added;},removeComponents:function(components){if(!(components instanceof Array)){components=[components];}
for(var i=components.length-1;i>=0;--i){this.removeComponent(components[i]);}},removeComponent:function(component){OpenLayers.Util.removeItem(this.components,component);this.clearBounds();},getLength:function(){var length=0.0;for(var i=0,len=this.components.length;i<len;i++){length+=this.components[i].getLength();}
return length;},getArea:function(){var area=0.0;for(var i=0,len=this.components.length;i<len;i++){area+=this.components[i].getArea();}
return area;},getGeodesicArea:function(projection){var area=0.0;for(var i=0,len=this.components.length;i<len;i++){area+=this.components[i].getGeodesicArea(projection);}
return area;},getCentroid:function(){return this.components.length&&this.components[0].getCentroid();},getGeodesicLength:function(projection){var length=0.0;for(var i=0,len=this.components.length;i<len;i++){length+=this.components[i].getGeodesicLength(projection);}
return length;},move:function(x,y){for(var i=0,len=this.components.length;i<len;i++){this.components[i].move(x,y);}},rotate:function(angle,origin){for(var i=0,len=this.components.length;i<len;++i){this.components[i].rotate(angle,origin);}},resize:function(scale,origin,ratio){for(var i=0;i<this.components.length;++i){this.components[i].resize(scale,origin,ratio);}
return this;},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var result,best;var min=Number.POSITIVE_INFINITY;for(var i=0,len=this.components.length;i<len;++i){result=this.components[i].distanceTo(geometry,options);distance=details?result.distance:result;if(distance<min){min=distance;best=result;if(min==0){break;}}}
return best;},equals:function(geometry){var equivalent=true;if(!geometry||!geometry.CLASS_NAME||(this.CLASS_NAME!=geometry.CLASS_NAME)){equivalent=false;}else if(!(geometry.components instanceof Array)||(geometry.components.length!=this.components.length)){equivalent=false;}else{for(var i=0,len=this.components.length;i<len;++i){if(!this.components[i].equals(geometry.components[i])){equivalent=false;break;}}}
return equivalent;},transform:function(source,dest){if(source&&dest){for(var i=0,len=this.components.length;i<len;i++){var component=this.components[i];component.transform(source,dest);}
this.bounds=null;}
return this;},intersects:function(geometry){var intersect=false;for(var i=0,len=this.components.length;i<len;++i){intersect=geometry.intersects(this.components[i]);if(intersect){break;}}
return intersect;},getVertices:function(nodes){var vertices=[];for(var i=0,len=this.components.length;i<len;++i){Array.prototype.push.apply(vertices,this.components[i].getVertices(nodes));}
return vertices;},CLASS_NAME:"OpenLayers.Geometry.Collection"});OpenLayers.Geometry.Point=OpenLayers.Class(OpenLayers.Geometry,{x:null,y:null,initialize:function(x,y){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.x=parseFloat(x);this.y=parseFloat(y);},clone:function(obj){if(obj==null){obj=new OpenLayers.Geometry.Point(this.x,this.y);}
OpenLayers.Util.applyDefaults(obj,this);return obj;},calculateBounds:function(){this.bounds=new OpenLayers.Bounds(this.x,this.y,this.x,this.y);},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var distance,x0,y0,x1,y1,result;if(geometry instanceof OpenLayers.Geometry.Point){x0=this.x;y0=this.y;x1=geometry.x;y1=geometry.y;distance=Math.sqrt(Math.pow(x0-x1,2)+Math.pow(y0-y1,2));result=!details?distance:{x0:x0,y0:y0,x1:x1,y1:y1,distance:distance};}else{result=geometry.distanceTo(this,options);if(details){result={x0:result.x1,y0:result.y1,x1:result.x0,y1:result.y0,distance:result.distance};}}
return result;},equals:function(geom){var equals=false;if(geom!=null){equals=((this.x==geom.x&&this.y==geom.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(geom.x)&&isNaN(geom.y)));}
return equals;},toShortString:function(){return(this.x+", "+this.y);},move:function(x,y){this.x=this.x+x;this.y=this.y+y;this.clearBounds();},rotate:function(angle,origin){angle*=Math.PI/180;var radius=this.distanceTo(origin);var theta=angle+Math.atan2(this.y-origin.y,this.x-origin.x);this.x=origin.x+(radius*Math.cos(theta));this.y=origin.y+(radius*Math.sin(theta));this.clearBounds();},getCentroid:function(){return new OpenLayers.Geometry.Point(this.x,this.y);},resize:function(scale,origin,ratio){ratio=(ratio==undefined)?1:ratio;this.x=origin.x+(scale*ratio*(this.x-origin.x));this.y=origin.y+(scale*(this.y-origin.y));this.clearBounds();return this;},intersects:function(geometry){var intersect=false;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.equals(geometry);}else{intersect=geometry.intersects(this);}
return intersect;},transform:function(source,dest){if((source&&dest)){OpenLayers.Projection.transform(this,source,dest);this.bounds=null;}
return this;},getVertices:function(nodes){return[this];},CLASS_NAME:"OpenLayers.Geometry.Point"});OpenLayers.Layer.Vector=OpenLayers.Class(OpenLayers.Layer,{EVENT_TYPES:["beforefeatureadded","beforefeaturesadded","featureadded","featuresadded","beforefeatureremoved","featureremoved","featuresremoved","beforefeatureselected","featureselected","featureunselected","beforefeaturemodified","featuremodified","afterfeaturemodified","vertexmodified","sketchstarted","sketchmodified","sketchcomplete","refresh"],isBaseLayer:false,isFixed:false,isVector:true,features:null,selectedFeatures:null,unrenderedFeatures:null,reportError:true,style:null,styleMap:null,strategies:null,protocol:null,renderers:['SVG','VML','Canvas'],renderer:null,rendererOptions:null,geometryType:null,drawn:false,initialize:function(name,options){this.EVENT_TYPES=OpenLayers.Layer.Vector.prototype.EVENT_TYPES.concat(OpenLayers.Layer.prototype.EVENT_TYPES);OpenLayers.Layer.prototype.initialize.apply(this,arguments);if(!this.renderer||!this.renderer.supported()){this.assignRenderer();}
if(!this.renderer||!this.renderer.supported()){this.renderer=null;this.displayError();}
if(!this.styleMap){this.styleMap=new OpenLayers.StyleMap();}
this.features=[];this.selectedFeatures=[];this.unrenderedFeatures={};if(this.strategies){for(var i=0,len=this.strategies.length;i<len;i++){this.strategies[i].setLayer(this);}}},destroy:function(){if(this.strategies){var strategy,i,len;for(i=0,len=this.strategies.length;i<len;i++){strategy=this.strategies[i];if(strategy.autoDestroy){strategy.destroy();}}
this.strategies=null;}
if(this.protocol){if(this.protocol.autoDestroy){this.protocol.destroy();}
this.protocol=null;}
this.destroyFeatures();this.features=null;this.selectedFeatures=null;this.unrenderedFeatures=null;if(this.renderer){this.renderer.destroy();}
this.renderer=null;this.geometryType=null;this.drawn=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments);},refresh:function(obj){if(this.calculateInRange()&&this.visibility){this.events.triggerEvent("refresh",obj);}},assignRenderer:function(){for(var i=0,len=this.renderers.length;i<len;i++){var rendererClass=OpenLayers.Renderer[this.renderers[i]];if(rendererClass&&rendererClass.prototype.supported()){this.renderer=new rendererClass(this.div,this.rendererOptions);break;}}},displayError:function(){if(this.reportError){OpenLayers.Console.userError(OpenLayers.i18n("browserNotSupported",{'renderers':this.renderers.join("\n")}));}},setMap:function(map){OpenLayers.Layer.prototype.setMap.apply(this,arguments);if(!this.renderer){this.map.removeLayer(this);}else{this.renderer.map=this.map;this.renderer.setSize(this.map.getSize());}},afterAdd:function(){if(this.strategies){var strategy,i,len;for(i=0,len=this.strategies.length;i<len;i++){strategy=this.strategies[i];if(strategy.autoActivate){strategy.activate();}}}},removeMap:function(map){if(this.strategies){var strategy,i,len;for(i=0,len=this.strategies.length;i<len;i++){strategy=this.strategies[i];if(strategy.autoActivate){strategy.deactivate();}}}},onMapResize:function(){OpenLayers.Layer.prototype.onMapResize.apply(this,arguments);this.renderer.setSize(this.map.getSize());},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);var coordSysUnchanged=true;if(!dragging){this.renderer.root.style.visibility="hidden";this.div.style.left=-parseInt(this.map.layerContainerDiv.style.left)+"px";this.div.style.top=-parseInt(this.map.layerContainerDiv.style.top)+"px";var extent=this.map.getExtent();coordSysUnchanged=this.renderer.setExtent(extent,zoomChanged);this.renderer.root.style.visibility="visible";if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1){this.div.scrollLeft=this.div.scrollLeft;}
if(!zoomChanged&&coordSysUnchanged){for(var i in this.unrenderedFeatures){var feature=this.unrenderedFeatures[i];this.drawFeature(feature);}}}
if(!this.drawn||zoomChanged||!coordSysUnchanged){this.drawn=true;var feature;for(var i=0,len=this.features.length;i<len;i++){this.renderer.locked=(i!==(len-1));feature=this.features[i];this.drawFeature(feature);}}},display:function(display){OpenLayers.Layer.prototype.display.apply(this,arguments);var currentDisplay=this.div.style.display;if(currentDisplay!=this.renderer.root.style.display){this.renderer.root.style.display=currentDisplay;}},addFeatures:function(features,options){if(!(features instanceof Array)){features=[features];}
var notify=!options||!options.silent;if(notify){var event={features:features};var ret=this.events.triggerEvent("beforefeaturesadded",event);if(ret===false){return;}
features=event.features;}
for(var i=0,len=features.length;i<len;i++){if(i!=(features.length-1)){this.renderer.locked=true;}else{this.renderer.locked=false;}
var feature=features[i];if(this.geometryType&&!(feature.geometry instanceof this.geometryType)){var throwStr=OpenLayers.i18n('componentShouldBe',{'geomType':this.geometryType.prototype.CLASS_NAME});throw throwStr;}
this.features.push(feature);feature.layer=this;if(!feature.style&&this.style){feature.style=OpenLayers.Util.extend({},this.style);}
if(notify){if(this.events.triggerEvent("beforefeatureadded",{feature:feature})===false){continue;};this.preFeatureInsert(feature);}
this.drawFeature(feature);if(notify){this.events.triggerEvent("featureadded",{feature:feature});this.onFeatureInsert(feature);}}
if(notify){this.events.triggerEvent("featuresadded",{features:features});}},removeFeatures:function(features,options){if(!features||features.length===0){return;}
if(!(features instanceof Array)){features=[features];}
if(features===this.features){features=features.slice();}
var notify=!options||!options.silent;for(var i=features.length-1;i>=0;i--){if(i!=0&&features[i-1].geometry){this.renderer.locked=true;}else{this.renderer.locked=false;}
var feature=features[i];delete this.unrenderedFeatures[feature.id];if(notify){this.events.triggerEvent("beforefeatureremoved",{feature:feature});}
this.features=OpenLayers.Util.removeItem(this.features,feature);feature.layer=null;if(feature.geometry){this.renderer.eraseFeatures(feature);}
if(OpenLayers.Util.indexOf(this.selectedFeatures,feature)!=-1){OpenLayers.Util.removeItem(this.selectedFeatures,feature);}
if(notify){this.events.triggerEvent("featureremoved",{feature:feature});}}
if(notify){this.events.triggerEvent("featuresremoved",{features:features});}},destroyFeatures:function(features,options){var all=(features==undefined);if(all){features=this.features;}
if(features){this.removeFeatures(features,options);for(var i=features.length-1;i>=0;i--){features[i].destroy();}}},drawFeature:function(feature,style){if(!this.drawn){return}
if(typeof style!="object"){if(!style&&feature.state===OpenLayers.State.DELETE){style="delete";}
var renderIntent=style||feature.renderIntent;style=feature.style||this.style;if(!style){style=this.styleMap.createSymbolizer(feature,renderIntent);}}
if(!this.renderer.drawFeature(feature,style)){this.unrenderedFeatures[feature.id]=feature;}else{delete this.unrenderedFeatures[feature.id];};},eraseFeatures:function(features){this.renderer.eraseFeatures(features);},getFeatureFromEvent:function(evt){if(!this.renderer){OpenLayers.Console.error(OpenLayers.i18n("getFeatureError"));return null;}
var featureId=this.renderer.getFeatureIdFromEvent(evt);return this.getFeatureById(featureId);},getFeatureById:function(featureId){var feature=null;for(var i=0,len=this.features.length;i<len;++i){if(this.features[i].id==featureId){feature=this.features[i];break;}}
return feature;},onFeatureInsert:function(feature){},preFeatureInsert:function(feature){},getDataExtent:function(){var maxExtent=null;if(this.features&&(this.features.length>0)){maxExtent=new OpenLayers.Bounds();for(var i=0,len=this.features.length;i<len;i++){maxExtent.extend(this.features[i].geometry.getBounds());}}
return maxExtent;},CLASS_NAME:"OpenLayers.Layer.Vector"});OpenLayers.Geometry.MultiPoint=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(components){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments);},addPoint:function(point,index){this.addComponent(point,index);},removePoint:function(point){this.removeComponent(point);},CLASS_NAME:"OpenLayers.Geometry.MultiPoint"});OpenLayers.Handler.Point=OpenLayers.Class(OpenLayers.Handler,{point:null,layer:null,multi:false,drawing:false,mouseDown:false,lastDown:null,lastUp:null,persist:false,layerOptions:null,initialize:function(control,callbacks,options){if(!(options&&options.layerOptions&&options.layerOptions.styleMap)){this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style['default'],{});}
OpenLayers.Handler.prototype.initialize.apply(this,arguments);},activate:function(){if(!OpenLayers.Handler.prototype.activate.apply(this,arguments)){return false;}
var options=OpenLayers.Util.extend({displayInLayerSwitcher:false,calculateInRange:function(){return true;}},this.layerOptions);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,options);this.map.addLayer(this.layer);return true;},createFeature:function(pixel){var lonlat=this.map.getLonLatFromPixel(pixel);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat));this.callback("create",[this.point.geometry,this.point]);this.point.geometry.clearBounds();this.layer.addFeatures([this.point],{silent:true});},deactivate:function(){if(!OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){return false;}
if(this.drawing){this.cancel();}
this.destroyFeature();if(this.layer.map!=null){this.layer.destroy(false);}
this.layer=null;return true;},destroyFeature:function(){if(this.layer){this.layer.destroyFeatures();}
this.point=null;},finalize:function(cancel){var key=cancel?"cancel":"done";this.drawing=false;this.mouseDown=false;this.lastDown=null;this.lastUp=null;this.callback(key,[this.geometryClone()]);if(cancel||!this.persist){this.destroyFeature();}},cancel:function(){this.finalize(true);},click:function(evt){OpenLayers.Event.stop(evt);return false;},dblclick:function(evt){OpenLayers.Event.stop(evt);return false;},modifyFeature:function(pixel){var lonlat=this.map.getLonLatFromPixel(pixel);this.point.geometry.x=lonlat.lon;this.point.geometry.y=lonlat.lat;this.callback("modify",[this.point.geometry,this.point]);this.point.geometry.clearBounds();this.drawFeature();},drawFeature:function(){this.layer.drawFeature(this.point,this.style);},getGeometry:function(){var geometry=this.point&&this.point.geometry;if(geometry&&this.multi){geometry=new OpenLayers.Geometry.MultiPoint([geometry]);}
return geometry;},geometryClone:function(){var geom=this.getGeometry();return geom&&geom.clone();},mousedown:function(evt){if(!this.checkModifiers(evt)){return true;}
if(this.lastDown&&this.lastDown.equals(evt.xy)){return true;}
this.drawing=true;if(this.lastDown==null){if(this.persist){this.destroyFeature();}
this.createFeature(evt.xy);}else{this.modifyFeature(evt.xy);}
this.lastDown=evt.xy;return false;},mousemove:function(evt){if(this.drawing){this.modifyFeature(evt.xy);}
return true;},mouseup:function(evt){if(this.drawing){this.finalize();return false;}else{return true;}},CLASS_NAME:"OpenLayers.Handler.Point"});OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(points){OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this,arguments);},getLength:function(){var length=0.0;if(this.components&&(this.components.length>1)){for(var i=1,len=this.components.length;i<len;i++){length+=this.components[i-1].distanceTo(this.components[i]);}}
return length;},getGeodesicLength:function(projection){var geom=this;if(projection){var gg=new OpenLayers.Projection("EPSG:4326");if(!gg.equals(projection)){geom=this.clone().transform(projection,gg);}}
var length=0.0;if(geom.components&&(geom.components.length>1)){var p1,p2;for(var i=1,len=geom.components.length;i<len;i++){p1=geom.components[i-1];p2=geom.components[i];length+=OpenLayers.Util.distVincenty({lon:p1.x,lat:p1.y},{lon:p2.x,lat:p2.y});}}
return length*1000;},CLASS_NAME:"OpenLayers.Geometry.Curve"});OpenLayers.Geometry.LineString=OpenLayers.Class(OpenLayers.Geometry.Curve,{initialize:function(points){OpenLayers.Geometry.Curve.prototype.initialize.apply(this,arguments);},removeComponent:function(point){if(this.components&&(this.components.length>2)){OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);}},intersects:function(geometry){var intersect=false;var type=geometry.CLASS_NAME;if(type=="OpenLayers.Geometry.LineString"||type=="OpenLayers.Geometry.LinearRing"||type=="OpenLayers.Geometry.Point"){var segs1=this.getSortedSegments();var segs2;if(type=="OpenLayers.Geometry.Point"){segs2=[{x1:geometry.x,y1:geometry.y,x2:geometry.x,y2:geometry.y}];}else{segs2=geometry.getSortedSegments();}
var seg1,seg1x1,seg1x2,seg1y1,seg1y2,seg2,seg2y1,seg2y2;outer:for(var i=0,len=segs1.length;i<len;++i){seg1=segs1[i];seg1x1=seg1.x1;seg1x2=seg1.x2;seg1y1=seg1.y1;seg1y2=seg1.y2;inner:for(var j=0,jlen=segs2.length;j<jlen;++j){seg2=segs2[j];if(seg2.x1>seg1x2){break;}
if(seg2.x2<seg1x1){continue;}
seg2y1=seg2.y1;seg2y2=seg2.y2;if(Math.min(seg2y1,seg2y2)>Math.max(seg1y1,seg1y2)){continue;}
if(Math.max(seg2y1,seg2y2)<Math.min(seg1y1,seg1y2)){continue;}
if(OpenLayers.Geometry.segmentsIntersect(seg1,seg2)){intersect=true;break outer;}}}}else{intersect=geometry.intersects(this);}
return intersect;},getSortedSegments:function(){var numSeg=this.components.length-1;var segments=new Array(numSeg);for(var i=0;i<numSeg;++i){point1=this.components[i];point2=this.components[i+1];if(point1.x<point2.x){segments[i]={x1:point1.x,y1:point1.y,x2:point2.x,y2:point2.y};}else{segments[i]={x1:point2.x,y1:point2.y,x2:point1.x,y2:point1.y};}}
function byX1(seg1,seg2){return seg1.x1-seg2.x1;}
return segments.sort(byX1);},splitWithSegment:function(seg,options){var edge=!(options&&options.edge===false);var tolerance=options&&options.tolerance;var lines=[];var verts=this.getVertices();var points=[];var intersections=[];var split=false;var vert1,vert2,point;var node,vertex,target;var interOptions={point:true,tolerance:tolerance};var result=null;for(var i=0,stop=verts.length-2;i<=stop;++i){vert1=verts[i];points.push(vert1.clone());vert2=verts[i+1];target={x1:vert1.x,y1:vert1.y,x2:vert2.x,y2:vert2.y};point=OpenLayers.Geometry.segmentsIntersect(seg,target,interOptions);if(point instanceof OpenLayers.Geometry.Point){if((point.x===seg.x1&&point.y===seg.y1)||(point.x===seg.x2&&point.y===seg.y2)||point.equals(vert1)||point.equals(vert2)){vertex=true;}else{vertex=false;}
if(vertex||edge){if(!point.equals(intersections[intersections.length-1])){intersections.push(point.clone());}
if(i===0){if(point.equals(vert1)){continue;}}
if(point.equals(vert2)){continue;}
split=true;if(!point.equals(vert1)){points.push(point);}
lines.push(new OpenLayers.Geometry.LineString(points));points=[point.clone()];}}}
if(split){points.push(vert2.clone());lines.push(new OpenLayers.Geometry.LineString(points));}
if(intersections.length>0){var xDir=seg.x1<seg.x2?1:-1;var yDir=seg.y1<seg.y2?1:-1;result={lines:lines,points:intersections.sort(function(p1,p2){return(xDir*p1.x-xDir*p2.x)||(yDir*p1.y-yDir*p2.y);})};}
return result;},split:function(target,options){var results=null;var mutual=options&&options.mutual;var sourceSplit,targetSplit,sourceParts,targetParts;if(target instanceof OpenLayers.Geometry.LineString){var verts=this.getVertices();var vert1,vert2,seg,splits,lines,point;var points=[];sourceParts=[];for(var i=0,stop=verts.length-2;i<=stop;++i){vert1=verts[i];vert2=verts[i+1];seg={x1:vert1.x,y1:vert1.y,x2:vert2.x,y2:vert2.y};targetParts=targetParts||[target];if(mutual){points.push(vert1.clone());}
for(var j=0;j<targetParts.length;++j){splits=targetParts[j].splitWithSegment(seg,options);if(splits){lines=splits.lines;if(lines.length>0){lines.unshift(j,1);Array.prototype.splice.apply(targetParts,lines);j+=lines.length-2;}
if(mutual){for(var k=0,len=splits.points.length;k<len;++k){point=splits.points[k];if(!point.equals(vert1)){points.push(point);sourceParts.push(new OpenLayers.Geometry.LineString(points));if(point.equals(vert2)){points=[];}else{points=[point.clone()];}}}}}}}
if(mutual&&sourceParts.length>0&&points.length>0){points.push(vert2.clone());sourceParts.push(new OpenLayers.Geometry.LineString(points));}}else{results=target.splitWith(this,options);}
if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];}
if(sourceParts&&sourceParts.length>1){sourceSplit=true;}else{sourceParts=[];}
if(targetSplit||sourceSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}}
return results;},splitWith:function(geometry,options){return geometry.split(this,options);},getVertices:function(nodes){var vertices;if(nodes===true){vertices=[this.components[0],this.components[this.components.length-1]];}else if(nodes===false){vertices=this.components.slice(1,this.components.length-1);}else{vertices=this.components.slice();}
return vertices;},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var result,best={};var min=Number.POSITIVE_INFINITY;if(geometry instanceof OpenLayers.Geometry.Point){var segs=this.getSortedSegments();var x=geometry.x;var y=geometry.y;var seg;for(var i=0,len=segs.length;i<len;++i){seg=segs[i];result=OpenLayers.Geometry.distanceToSegment(geometry,seg);if(result.distance<min){min=result.distance;best=result;if(min===0){break;}}else{if(seg.x2>x&&((y>seg.y1&&y<seg.y2)||(y<seg.y1&&y>seg.y2))){break;}}}
if(details){best={distance:best.distance,x0:best.x,y0:best.y,x1:x,y1:y};}else{best=best.distance;}}else if(geometry instanceof OpenLayers.Geometry.LineString){var segs0=this.getSortedSegments();var segs1=geometry.getSortedSegments();var seg0,seg1,intersection,x0,y0;var len1=segs1.length;var interOptions={point:true};outer:for(var i=0,len=segs0.length;i<len;++i){seg0=segs0[i];x0=seg0.x1;y0=seg0.y1;for(var j=0;j<len1;++j){seg1=segs1[j];intersection=OpenLayers.Geometry.segmentsIntersect(seg0,seg1,interOptions);if(intersection){min=0;best={distance:0,x0:intersection.x,y0:intersection.y,x1:intersection.x,y1:intersection.y};break outer;}else{result=OpenLayers.Geometry.distanceToSegment({x:x0,y:y0},seg1);if(result.distance<min){min=result.distance;best={distance:min,x0:x0,y0:y0,x1:result.x,y1:result.y};}}}}
if(!details){best=best.distance;}
if(min!==0){if(seg0){result=geometry.distanceTo(new OpenLayers.Geometry.Point(seg0.x2,seg0.y2),options);var dist=details?result.distance:result;if(dist<min){if(details){best={distance:min,x0:result.x1,y0:result.y1,x1:result.x0,y1:result.y0};}else{best=dist;}}}}}else{best=geometry.distanceTo(this,options);if(details){best={distance:best.distance,x0:best.x1,y0:best.y1,x1:best.x0,y1:best.y0};}}
return best;},CLASS_NAME:"OpenLayers.Geometry.LineString"});OpenLayers.Geometry.LinearRing=OpenLayers.Class(OpenLayers.Geometry.LineString,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(points){OpenLayers.Geometry.LineString.prototype.initialize.apply(this,arguments);},addComponent:function(point,index){var added=false;var lastPoint=this.components.pop();if(index!=null||!point.equals(lastPoint)){added=OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,arguments);}
var firstPoint=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[firstPoint]);return added;},removeComponent:function(point){if(this.components.length>4){this.components.pop();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);var firstPoint=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[firstPoint]);}},move:function(x,y){for(var i=0,len=this.components.length;i<len-1;i++){this.components[i].move(x,y);}},rotate:function(angle,origin){for(var i=0,len=this.components.length;i<len-1;++i){this.components[i].rotate(angle,origin);}},resize:function(scale,origin,ratio){for(var i=0,len=this.components.length;i<len-1;++i){this.components[i].resize(scale,origin,ratio);}
return this;},transform:function(source,dest){if(source&&dest){for(var i=0,len=this.components.length;i<len-1;i++){var component=this.components[i];component.transform(source,dest);}
this.bounds=null;}
return this;},getCentroid:function(){if(this.components&&(this.components.length>2)){var sumX=0.0;var sumY=0.0;for(var i=0;i<this.components.length-1;i++){var b=this.components[i];var c=this.components[i+1];sumX+=(b.x+c.x)*(b.x*c.y-c.x*b.y);sumY+=(b.y+c.y)*(b.x*c.y-c.x*b.y);}
var area=-1*this.getArea();var x=sumX/(6*area);var y=sumY/(6*area);}
return new OpenLayers.Geometry.Point(x,y);},getArea:function(){var area=0.0;if(this.components&&(this.components.length>2)){var sum=0.0;for(var i=0,len=this.components.length;i<len-1;i++){var b=this.components[i];var c=this.components[i+1];sum+=(b.x+c.x)*(c.y-b.y);}
area=-sum/2.0;}
return area;},getGeodesicArea:function(projection){var ring=this;if(projection){var gg=new OpenLayers.Projection("EPSG:4326");if(!gg.equals(projection)){ring=this.clone().transform(projection,gg);}}
var area=0.0;var len=ring.components&&ring.components.length;if(len>2){var p1,p2;for(var i=0;i<len-1;i++){p1=ring.components[i];p2=ring.components[i+1];area+=OpenLayers.Util.rad(p2.x-p1.x)*(2+Math.sin(OpenLayers.Util.rad(p1.y))+
Math.sin(OpenLayers.Util.rad(p2.y)));}
area=area*6378137.0*6378137.0/2.0;}
return area;},containsPoint:function(point){var approx=OpenLayers.Number.limitSigDigs;var digs=14;var px=approx(point.x,digs);var py=approx(point.y,digs);function getX(y,x1,y1,x2,y2){return(((x1-x2)*y)+((x2*y1)-(x1*y2)))/(y1-y2);}
var numSeg=this.components.length-1;var start,end,x1,y1,x2,y2,cx,cy;var crosses=0;for(var i=0;i<numSeg;++i){start=this.components[i];x1=approx(start.x,digs);y1=approx(start.y,digs);end=this.components[i+1];x2=approx(end.x,digs);y2=approx(end.y,digs);if(y1==y2){if(py==y1){if(x1<=x2&&(px>=x1&&px<=x2)||x1>=x2&&(px<=x1&&px>=x2)){crosses=-1;break;}}
continue;}
cx=approx(getX(py,x1,y1,x2,y2),digs);if(cx==px){if(y1<y2&&(py>=y1&&py<=y2)||y1>y2&&(py<=y1&&py>=y2)){crosses=-1;break;}}
if(cx<=px){continue;}
if(x1!=x2&&(cx<Math.min(x1,x2)||cx>Math.max(x1,x2))){continue;}
if(y1<y2&&(py>=y1&&py<y2)||y1>y2&&(py<y1&&py>=y2)){++crosses;}}
var contained=(crosses==-1)?1:!!(crosses&1);return contained;},intersects:function(geometry){var intersect=false;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.containsPoint(geometry);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"){intersect=geometry.intersects(this);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){intersect=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[geometry]);}else{for(var i=0,len=geometry.components.length;i<len;++i){intersect=geometry.components[i].intersects(this);if(intersect){break;}}}
return intersect;},getVertices:function(nodes){return(nodes===true)?[]:this.components.slice(0,this.components.length-1);},CLASS_NAME:"OpenLayers.Geometry.LinearRing"});OpenLayers.Geometry.MultiLineString=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LineString"],initialize:function(components){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments);},split:function(geometry,options){var results=null;var mutual=options&&options.mutual;var splits,sourceLine,sourceLines,sourceSplit,targetSplit;var sourceParts=[];var targetParts=[geometry];for(var i=0,len=this.components.length;i<len;++i){sourceLine=this.components[i];sourceSplit=false;for(var j=0;j<targetParts.length;++j){splits=sourceLine.split(targetParts[j],options);if(splits){if(mutual){sourceLines=splits[0];for(var k=0,klen=sourceLines.length;k<klen;++k){if(k===0&&sourceParts.length){sourceParts[sourceParts.length-1].addComponent(sourceLines[k]);}else{sourceParts.push(new OpenLayers.Geometry.MultiLineString([sourceLines[k]]));}}
sourceSplit=true;splits=splits[1];}
if(splits.length){splits.unshift(j,1);Array.prototype.splice.apply(targetParts,splits);break;}}}
if(!sourceSplit){if(sourceParts.length){sourceParts[sourceParts.length-1].addComponent(sourceLine.clone());}else{sourceParts=[new OpenLayers.Geometry.MultiLineString(sourceLine.clone())];}}}
if(sourceParts&&sourceParts.length>1){sourceSplit=true;}else{sourceParts=[];}
if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];}
if(sourceSplit||targetSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}}
return results;},splitWith:function(geometry,options){var results=null;var mutual=options&&options.mutual;var splits,targetLine,sourceLines,sourceSplit,targetSplit,sourceParts,targetParts;if(geometry instanceof OpenLayers.Geometry.LineString){targetParts=[];sourceParts=[geometry];for(var i=0,len=this.components.length;i<len;++i){targetSplit=false;targetLine=this.components[i];for(var j=0;j<sourceParts.length;++j){splits=sourceParts[j].split(targetLine,options);if(splits){if(mutual){sourceLines=splits[0];if(sourceLines.length){sourceLines.unshift(j,1);Array.prototype.splice.apply(sourceParts,sourceLines);j+=sourceLines.length-2;}
splits=splits[1];if(splits.length===0){splits=[targetLine.clone()];}}
for(var k=0,klen=splits.length;k<klen;++k){if(k===0&&targetParts.length){targetParts[targetParts.length-1].addComponent(splits[k]);}else{targetParts.push(new OpenLayers.Geometry.MultiLineString([splits[k]]));}}
targetSplit=true;}}
if(!targetSplit){if(targetParts.length){targetParts[targetParts.length-1].addComponent(targetLine.clone());}else{targetParts=[new OpenLayers.Geometry.MultiLineString([targetLine.clone()])];}}}}else{results=geometry.split(this);}
if(sourceParts&&sourceParts.length>1){sourceSplit=true;}else{sourceParts=[];}
if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];}
if(sourceSplit||targetSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}}
return results;},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});OpenLayers.Handler.Path=OpenLayers.Class(OpenLayers.Handler.Point,{line:null,freehand:false,freehandToggle:'shiftKey',initialize:function(control,callbacks,options){OpenLayers.Handler.Point.prototype.initialize.apply(this,arguments);},createFeature:function(pixel){var lonlat=this.control.map.getLonLatFromPixel(pixel);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat));this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([this.point.geometry]));this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.line,this.point],{silent:true});},destroyFeature:function(){OpenLayers.Handler.Point.prototype.destroyFeature.apply(this);this.line=null;},removePoint:function(){if(this.point){this.layer.removeFeatures([this.point]);}},addPoint:function(pixel){this.layer.removeFeatures([this.point]);var lonlat=this.control.map.getLonLatFromPixel(pixel);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat));this.line.geometry.addComponent(this.point.geometry,this.line.geometry.components.length);this.callback("point",[this.point.geometry,this.getGeometry()]);this.callback("modify",[this.point.geometry,this.getSketch()]);this.drawFeature();},freehandMode:function(evt){return(this.freehandToggle&&evt[this.freehandToggle])?!this.freehand:this.freehand;},modifyFeature:function(pixel){var lonlat=this.control.map.getLonLatFromPixel(pixel);this.point.geometry.x=lonlat.lon;this.point.geometry.y=lonlat.lat;this.callback("modify",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.drawFeature();},drawFeature:function(){this.layer.drawFeature(this.line,this.style);this.layer.drawFeature(this.point,this.style);},getSketch:function(){return this.line;},getGeometry:function(){var geometry=this.line&&this.line.geometry;if(geometry&&this.multi){geometry=new OpenLayers.Geometry.MultiLineString([geometry]);}
return geometry;},mousedown:function(evt){if(this.lastDown&&this.lastDown.equals(evt.xy)){return false;}
if(this.lastDown==null){if(this.persist){this.destroyFeature();}
this.createFeature(evt.xy);}else if((this.lastUp==null)||!this.lastUp.equals(evt.xy)){this.addPoint(evt.xy);}
this.mouseDown=true;this.lastDown=evt.xy;this.drawing=true;return false;},mousemove:function(evt){if(this.drawing){if(this.mouseDown&&this.freehandMode(evt)){this.addPoint(evt.xy);}else{this.modifyFeature(evt.xy);}}
return true;},mouseup:function(evt){this.mouseDown=false;if(this.drawing){if(this.freehandMode(evt)){this.removePoint();this.finalize();}else{if(this.lastUp==null){this.addPoint(evt.xy);}
this.lastUp=evt.xy;}
return false;}
return true;},dblclick:function(evt){if(!this.freehandMode(evt)){var index=this.line.geometry.components.length-1;this.line.geometry.removeComponent(this.line.geometry.components[index]);this.removePoint();this.finalize();}
return false;},CLASS_NAME:"OpenLayers.Handler.Path"});OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],initialize:function(components){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments);},getArea:function(){var area=0.0;if(this.components&&(this.components.length>0)){area+=Math.abs(this.components[0].getArea());for(var i=1,len=this.components.length;i<len;i++){area-=Math.abs(this.components[i].getArea());}}
return area;},getGeodesicArea:function(projection){var area=0.0;if(this.components&&(this.components.length>0)){area+=Math.abs(this.components[0].getGeodesicArea(projection));for(var i=1,len=this.components.length;i<len;i++){area-=Math.abs(this.components[i].getGeodesicArea(projection));}}
return area;},containsPoint:function(point){var numRings=this.components.length;var contained=false;if(numRings>0){contained=this.components[0].containsPoint(point);if(contained!==1){if(contained&&numRings>1){var hole;for(var i=1;i<numRings;++i){hole=this.components[i].containsPoint(point);if(hole){if(hole===1){contained=1;}else{contained=false;}
break;}}}}}
return contained;},intersects:function(geometry){var intersect=false;var i,len;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.containsPoint(geometry);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"||geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){for(i=0,len=this.components.length;i<len;++i){intersect=geometry.intersects(this.components[i]);if(intersect){break;}}
if(!intersect){for(i=0,len=geometry.components.length;i<len;++i){intersect=this.containsPoint(geometry.components[i]);if(intersect){break;}}}}else{for(i=0,len=geometry.components.length;i<len;++i){intersect=this.intersects(geometry.components[i]);if(intersect){break;}}}
if(!intersect&&geometry.CLASS_NAME=="OpenLayers.Geometry.Polygon"){var ring=this.components[0];for(i=0,len=ring.components.length;i<len;++i){intersect=geometry.containsPoint(ring.components[i]);if(intersect){break;}}}
return intersect;},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var result;if(!edge&&this.intersects(geometry)){result=0;}else{result=OpenLayers.Geometry.Collection.prototype.distanceTo.apply(this,[geometry,options]);}
return result;},CLASS_NAME:"OpenLayers.Geometry.Polygon"});OpenLayers.Geometry.Polygon.createRegularPolygon=function(origin,radius,sides,rotation){var angle=Math.PI*((1/sides)-(1/2));if(rotation){angle+=(rotation/180)*Math.PI;}
var rotatedAngle,x,y;var points=[];for(var i=0;i<sides;++i){rotatedAngle=angle+(i*2*Math.PI/sides);x=origin.x+(radius*Math.cos(rotatedAngle));y=origin.y+(radius*Math.sin(rotatedAngle));points.push(new OpenLayers.Geometry.Point(x,y));}
var ring=new OpenLayers.Geometry.LinearRing(points);return new OpenLayers.Geometry.Polygon([ring]);};OpenLayers.Geometry.MultiPolygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.Polygon"],initialize:function(components){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments);},CLASS_NAME:"OpenLayers.Geometry.MultiPolygon"});OpenLayers.Handler.Polygon=OpenLayers.Class(OpenLayers.Handler.Path,{polygon:null,initialize:function(control,callbacks,options){OpenLayers.Handler.Path.prototype.initialize.apply(this,arguments);},createFeature:function(pixel){var lonlat=this.control.map.getLonLatFromPixel(pixel);this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat));this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LinearRing([this.point.geometry]));this.polygon=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([this.line.geometry]));this.callback("create",[this.point.geometry,this.getSketch()]);this.point.geometry.clearBounds();this.layer.addFeatures([this.polygon,this.point],{silent:true});},destroyFeature:function(){OpenLayers.Handler.Path.prototype.destroyFeature.apply(this);this.polygon=null;},drawFeature:function(){this.layer.drawFeature(this.polygon,this.style);this.layer.drawFeature(this.point,this.style);},getSketch:function(){return this.polygon;},getGeometry:function(){var geometry=this.polygon&&this.polygon.geometry;if(geometry&&this.multi){geometry=new OpenLayers.Geometry.MultiPolygon([geometry]);}
return geometry;},dblclick:function(evt){if(!this.freehandMode(evt)){var index=this.line.geometry.components.length-2;this.line.geometry.removeComponent(this.line.geometry.components[index]);this.removePoint();this.finalize();}
return false;},CLASS_NAME:"OpenLayers.Handler.Polygon"});OpenLayers.Format.GML=OpenLayers.Class(OpenLayers.Format.XML,{featureNS:"http://mapserver.gis.umn.edu/mapserver",featurePrefix:"feature",featureName:"featureMember",layerName:"features",geometryName:"geometry",collectionName:"FeatureCollection",gmlns:"http://www.opengis.net/gml",extractAttributes:true,xy:true,initialize:function(options){this.regExes={trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)};OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}
var featureNodes=this.getElementsByTagNameNS(data.documentElement,this.gmlns,this.featureName);var features=[];for(var i=0;i<featureNodes.length;i++){var feature=this.parseFeature(featureNodes[i]);if(feature){features.push(feature);}}
return features;},parseFeature:function(node){var order=["MultiPolygon","Polygon","MultiLineString","LineString","MultiPoint","Point","Envelope","Box"];var type,nodeList,geometry,parser;for(var i=0;i<order.length;++i){type=order[i];nodeList=this.getElementsByTagNameNS(node,this.gmlns,type);if(nodeList.length>0){var parser=this.parseGeometry[type.toLowerCase()];if(parser){geometry=parser.apply(this,[nodeList[0]]);if(this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection);}}else{OpenLayers.Console.error(OpenLayers.i18n("unsupportedGeometryType",{'geomType':type}));}
break;}}
var attributes;if(this.extractAttributes){attributes=this.parseAttributes(node);}
var feature=new OpenLayers.Feature.Vector(geometry,attributes);feature.gml={featureType:node.firstChild.nodeName.split(":")[1],featureNS:node.firstChild.namespaceURI,featureNSPrefix:node.firstChild.prefix};var childNode=node.firstChild;var fid;while(childNode){if(childNode.nodeType==1){fid=childNode.getAttribute("fid")||childNode.getAttribute("id");if(fid){break;}}
childNode=childNode.nextSibling;}
feature.fid=fid;return feature;},parseGeometry:{point:function(node){var nodeList,coordString;var coords=[];var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"pos");if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);}
if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coordinates");if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.removeSpace,"");coords=coordString.split(",");}}
if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coord");if(nodeList.length>0){var xList=this.getElementsByTagNameNS(nodeList[0],this.gmlns,"X");var yList=this.getElementsByTagNameNS(nodeList[0],this.gmlns,"Y");if(xList.length>0&&yList.length>0){coords=[xList[0].firstChild.nodeValue,yList[0].firstChild.nodeValue];}}}
if(coords.length==2){coords[2]=null;}
if(this.xy){return new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}
else{return new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}},multipoint:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"Point");var components=[];if(nodeList.length>0){var point;for(var i=0;i<nodeList.length;++i){point=this.parseGeometry.point.apply(this,[nodeList[i]]);if(point){components.push(point);}}}
return new OpenLayers.Geometry.MultiPoint(components);},linestring:function(node,ring){var nodeList,coordString;var coords=[];var points=[];nodeList=this.getElementsByTagNameNS(node,this.gmlns,"posList");if(nodeList.length>0){coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);var dim=parseInt(nodeList[0].getAttribute("dimension"));var j,x,y,z;for(var i=0;i<coords.length/dim;++i){j=i*dim;x=coords[j];y=coords[j+1];z=(dim==2)?null:coords[j+2];if(this.xy){points.push(new OpenLayers.Geometry.Point(x,y,z));}else{points.push(new OpenLayers.Geometry.Point(y,x,z));}}}
if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coordinates");if(nodeList.length>0){coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coordString=coordString.replace(this.regExes.trimComma,",");var pointList=coordString.split(this.regExes.splitSpace);for(var i=0;i<pointList.length;++i){coords=pointList[i].split(",");if(coords.length==2){coords[2]=null;}
if(this.xy){points.push(new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]));}else{points.push(new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]));}}}}
var line=null;if(points.length!=0){if(ring){line=new OpenLayers.Geometry.LinearRing(points);}else{line=new OpenLayers.Geometry.LineString(points);}}
return line;},multilinestring:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"LineString");var components=[];if(nodeList.length>0){var line;for(var i=0;i<nodeList.length;++i){line=this.parseGeometry.linestring.apply(this,[nodeList[i]]);if(line){components.push(line);}}}
return new OpenLayers.Geometry.MultiLineString(components);},polygon:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"LinearRing");var components=[];if(nodeList.length>0){var ring;for(var i=0;i<nodeList.length;++i){ring=this.parseGeometry.linestring.apply(this,[nodeList[i],true]);if(ring){components.push(ring);}}}
return new OpenLayers.Geometry.Polygon(components);},multipolygon:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"Polygon");var components=[];if(nodeList.length>0){var polygon;for(var i=0;i<nodeList.length;++i){polygon=this.parseGeometry.polygon.apply(this,[nodeList[i]]);if(polygon){components.push(polygon);}}}
return new OpenLayers.Geometry.MultiPolygon(components);},envelope:function(node){var components=[];var coordString;var envelope;var lpoint=this.getElementsByTagNameNS(node,this.gmlns,"lowerCorner");if(lpoint.length>0){var coords=[];if(lpoint.length>0){coordString=lpoint[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);}
if(coords.length==2){coords[2]=null;}
if(this.xy){var lowerPoint=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{var lowerPoint=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}}
var upoint=this.getElementsByTagNameNS(node,this.gmlns,"upperCorner");if(upoint.length>0){var coords=[];if(upoint.length>0){coordString=upoint[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);}
if(coords.length==2){coords[2]=null;}
if(this.xy){var upperPoint=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{var upperPoint=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}}
if(lowerPoint&&upperPoint){components.push(new OpenLayers.Geometry.Point(lowerPoint.x,lowerPoint.y));components.push(new OpenLayers.Geometry.Point(upperPoint.x,lowerPoint.y));components.push(new OpenLayers.Geometry.Point(upperPoint.x,upperPoint.y));components.push(new OpenLayers.Geometry.Point(lowerPoint.x,upperPoint.y));components.push(new OpenLayers.Geometry.Point(lowerPoint.x,lowerPoint.y));var ring=new OpenLayers.Geometry.LinearRing(components);envelope=new OpenLayers.Geometry.Polygon([ring]);}
return envelope;}},parseAttributes:function(node){var attributes={};var childNode=node.firstChild;var children,i,child,grandchildren,grandchild,name,value;while(childNode){if(childNode.nodeType==1){children=childNode.childNodes;for(i=0;i<children.length;++i){child=children[i];if(child.nodeType==1){grandchildren=child.childNodes;if(grandchildren.length==1){grandchild=grandchildren[0];if(grandchild.nodeType==3||grandchild.nodeType==4){name=(child.prefix)?child.nodeName.split(":")[1]:child.nodeName;value=grandchild.nodeValue.replace(this.regExes.trimSpace,"");attributes[name]=value;}}else{attributes[child.nodeName.split(":").pop()]=null;}}}
break;}
childNode=childNode.nextSibling;}
return attributes;},write:function(features){if(!(features instanceof Array)){features=[features];}
var gml=this.createElementNS("http://www.opengis.net/wfs","wfs:"+this.collectionName);for(var i=0;i<features.length;i++){gml.appendChild(this.createFeatureXML(features[i]));}
return OpenLayers.Format.XML.prototype.write.apply(this,[gml]);},createFeatureXML:function(feature){var geometry=feature.geometry;var geometryNode=this.buildGeometryNode(geometry);var geomContainer=this.createElementNS(this.featureNS,this.featurePrefix+":"+
this.geometryName);geomContainer.appendChild(geometryNode);var featureNode=this.createElementNS(this.gmlns,"gml:"+this.featureName);var featureContainer=this.createElementNS(this.featureNS,this.featurePrefix+":"+
this.layerName);var fid=feature.fid||feature.id;featureContainer.setAttribute("fid",fid);featureContainer.appendChild(geomContainer);for(var attr in feature.attributes){var attrText=this.createTextNode(feature.attributes[attr]);var nodename=attr.substring(attr.lastIndexOf(":")+1);var attrContainer=this.createElementNS(this.featureNS,this.featurePrefix+":"+
nodename);attrContainer.appendChild(attrText);featureContainer.appendChild(attrContainer);}
featureNode.appendChild(featureContainer);return featureNode;},buildGeometryNode:function(geometry){if(this.externalProjection&&this.internalProjection){geometry=geometry.clone();geometry.transform(this.internalProjection,this.externalProjection);}
var className=geometry.CLASS_NAME;var type=className.substring(className.lastIndexOf(".")+1);var builder=this.buildGeometry[type.toLowerCase()];return builder.apply(this,[geometry]);},buildGeometry:{point:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:Point");gml.appendChild(this.buildCoordinatesNode(geometry));return gml;},multipoint:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:MultiPoint");var points=geometry.components;var pointMember,pointGeom;for(var i=0;i<points.length;i++){pointMember=this.createElementNS(this.gmlns,"gml:pointMember");pointGeom=this.buildGeometry.point.apply(this,[points[i]]);pointMember.appendChild(pointGeom);gml.appendChild(pointMember);}
return gml;},linestring:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:LineString");gml.appendChild(this.buildCoordinatesNode(geometry));return gml;},multilinestring:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:MultiLineString");var lines=geometry.components;var lineMember,lineGeom;for(var i=0;i<lines.length;++i){lineMember=this.createElementNS(this.gmlns,"gml:lineStringMember");lineGeom=this.buildGeometry.linestring.apply(this,[lines[i]]);lineMember.appendChild(lineGeom);gml.appendChild(lineMember);}
return gml;},linearring:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:LinearRing");gml.appendChild(this.buildCoordinatesNode(geometry));return gml;},polygon:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:Polygon");var rings=geometry.components;var ringMember,ringGeom,type;for(var i=0;i<rings.length;++i){type=(i==0)?"outerBoundaryIs":"innerBoundaryIs";ringMember=this.createElementNS(this.gmlns,"gml:"+type);ringGeom=this.buildGeometry.linearring.apply(this,[rings[i]]);ringMember.appendChild(ringGeom);gml.appendChild(ringMember);}
return gml;},multipolygon:function(geometry){var gml=this.createElementNS(this.gmlns,"gml:MultiPolygon");var polys=geometry.components;var polyMember,polyGeom;for(var i=0;i<polys.length;++i){polyMember=this.createElementNS(this.gmlns,"gml:polygonMember");polyGeom=this.buildGeometry.polygon.apply(this,[polys[i]]);polyMember.appendChild(polyGeom);gml.appendChild(polyMember);}
return gml;},bounds:function(bounds){var gml=this.createElementNS(this.gmlns,"gml:Box");gml.appendChild(this.buildCoordinatesNode(bounds));return gml;}},buildCoordinatesNode:function(geometry){var coordinatesNode=this.createElementNS(this.gmlns,"gml:coordinates");coordinatesNode.setAttribute("decimal",".");coordinatesNode.setAttribute("cs",",");coordinatesNode.setAttribute("ts"," ");var parts=[];if(geometry instanceof OpenLayers.Bounds){parts.push(geometry.left+","+geometry.bottom);parts.push(geometry.right+","+geometry.top);}else{var points=(geometry.components)?geometry.components:[geometry];for(var i=0;i<points.length;i++){parts.push(points[i].x+","+points[i].y);}}
var txtNode=this.createTextNode(parts.join(" "));coordinatesNode.appendChild(txtNode);return coordinatesNode;},CLASS_NAME:"OpenLayers.Format.GML"});if(!OpenLayers.Format.GML){OpenLayers.Format.GML={};}
OpenLayers.Format.GML.Base=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{gml:"http://www.opengis.net/gml",xlink:"http://www.w3.org/1999/xlink",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs"},defaultPrefix:"gml",schemaLocation:null,featureType:null,featureNS:null,geometryName:"geometry",extractAttributes:true,srsName:null,xy:true,geometryTypes:null,singleFeatureType:null,regExes:{trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)},initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);this.setGeometryTypes();if(options&&options.featureNS){this.setNamespace("feature",options.featureNS);}
this.singleFeatureType=!options||(typeof options.featureType==="string");},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}
if(data&&data.nodeType==9){data=data.documentElement;}
var features=[];this.readNode(data,{features:features});if(features.length==0){var elements=this.getElementsByTagNameNS(data,this.namespaces.gml,"featureMember");if(elements.length){for(var i=0,len=elements.length;i<len;++i){this.readNode(elements[i],{features:features});}}else{var elements=this.getElementsByTagNameNS(data,this.namespaces.gml,"featureMembers");if(elements.length){this.readNode(elements[0],{features:features});}}}
return features;},readers:{"gml":{"featureMember":function(node,obj){this.readChildNodes(node,obj);},"featureMembers":function(node,obj){this.readChildNodes(node,obj);},"name":function(node,obj){obj.name=this.getChildValue(node);},"boundedBy":function(node,obj){var container={};this.readChildNodes(node,container);if(container.components&&container.components.length>0){obj.bounds=container.components[0];}},"Point":function(node,container){var obj={points:[]};this.readChildNodes(node,obj);if(!container.components){container.components=[];}
container.components.push(obj.points[0]);},"coordinates":function(node,obj){var str=this.getChildValue(node).replace(this.regExes.trimSpace,"");str=str.replace(this.regExes.trimComma,",");var pointList=str.split(this.regExes.splitSpace);var coords;var numPoints=pointList.length;var points=new Array(numPoints);for(var i=0;i<numPoints;++i){coords=pointList[i].split(",");if(this.xy){points[i]=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{points[i]=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}}
obj.points=points;},"coord":function(node,obj){var coord={};this.readChildNodes(node,coord);if(!obj.points){obj.points=[];}
obj.points.push(new OpenLayers.Geometry.Point(coord.x,coord.y,coord.z));},"X":function(node,coord){coord.x=this.getChildValue(node);},"Y":function(node,coord){coord.y=this.getChildValue(node);},"Z":function(node,coord){coord.z=this.getChildValue(node);},"MultiPoint":function(node,container){var obj={components:[]};this.readChildNodes(node,obj);container.components=[new OpenLayers.Geometry.MultiPoint(obj.components)];},"pointMember":function(node,obj){this.readChildNodes(node,obj);},"LineString":function(node,container){var obj={};this.readChildNodes(node,obj);if(!container.components){container.components=[];}
container.components.push(new OpenLayers.Geometry.LineString(obj.points));},"MultiLineString":function(node,container){var obj={components:[]};this.readChildNodes(node,obj);container.components=[new OpenLayers.Geometry.MultiLineString(obj.components)];},"lineStringMember":function(node,obj){this.readChildNodes(node,obj);},"Polygon":function(node,container){var obj={outer:null,inner:[]};this.readChildNodes(node,obj);obj.inner.unshift(obj.outer);if(!container.components){container.components=[];}
container.components.push(new OpenLayers.Geometry.Polygon(obj.inner));},"LinearRing":function(node,obj){var container={};this.readChildNodes(node,container);obj.components=[new OpenLayers.Geometry.LinearRing(container.points)];},"MultiPolygon":function(node,container){var obj={components:[]};this.readChildNodes(node,obj);container.components=[new OpenLayers.Geometry.MultiPolygon(obj.components)];},"polygonMember":function(node,obj){this.readChildNodes(node,obj);},"GeometryCollection":function(node,container){var obj={components:[]};this.readChildNodes(node,obj);container.components=[new OpenLayers.Geometry.Collection(obj.components)];},"geometryMember":function(node,obj){this.readChildNodes(node,obj);}},"feature":{"*":function(node,obj){var name;var local=node.localName||node.nodeName.split(":").pop();if(!this.singleFeatureType&&(OpenLayers.Util.indexOf(this.featureType,local)!=-1)){name="_typeName";}
else if(local==this.featureType){name="_typeName";}else{if(node.childNodes.length==0||(node.childNodes.length==1&&node.firstChild.nodeType==3)){if(this.extractAttributes){name="_attribute";}}else{name="_geometry";}}
if(name){this.readers.feature[name].apply(this,[node,obj]);}},"_typeName":function(node,obj){var container={components:[],attributes:{}};this.readChildNodes(node,container);if(container.name){container.attributes.name=container.name;}
var feature=new OpenLayers.Feature.Vector(container.components[0],container.attributes);if(!this.singleFeatureType){feature.type=node.nodeName.split(":").pop();feature.namespace=node.namespaceURI;}
var fid=node.getAttribute("fid")||this.getAttributeNS(node,this.namespaces["gml"],"id");if(fid){feature.fid=fid;}
if(this.internalProjection&&this.externalProjection&&feature.geometry){feature.geometry.transform(this.externalProjection,this.internalProjection);}
if(container.bounds){feature.geometry.bounds=container.bounds;}
obj.features.push(feature);},"_geometry":function(node,obj){this.readChildNodes(node,obj);},"_attribute":function(node,obj){var local=node.localName||node.nodeName.split(":").pop();var value=this.getChildValue(node);obj.attributes[local]=value;}},"wfs":{"FeatureCollection":function(node,obj){this.readChildNodes(node,obj);}}},write:function(features){var name;if(features instanceof Array){name="featureMembers";}else{name="featureMember";}
var root=this.writeNode("gml:"+name,features);this.setAttributeNS(root,this.namespaces["xsi"],"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[root]);},writers:{"gml":{"featureMember":function(feature){var node=this.createElementNSPlus("gml:featureMember");this.writeNode("feature:_typeName",feature,node);return node;},"MultiPoint":function(geometry){var node=this.createElementNSPlus("gml:MultiPoint");for(var i=0;i<geometry.components.length;++i){this.writeNode("pointMember",geometry.components[i],node);}
return node;},"pointMember":function(geometry){var node=this.createElementNSPlus("gml:pointMember");this.writeNode("Point",geometry,node);return node;},"MultiLineString":function(geometry){var node=this.createElementNSPlus("gml:MultiLineString");for(var i=0;i<geometry.components.length;++i){this.writeNode("lineStringMember",geometry.components[i],node);}
return node;},"lineStringMember":function(geometry){var node=this.createElementNSPlus("gml:lineStringMember");this.writeNode("LineString",geometry,node);return node;},"MultiPolygon":function(geometry){var node=this.createElementNSPlus("gml:MultiPolygon");for(var i=0;i<geometry.components.length;++i){this.writeNode("polygonMember",geometry.components[i],node);}
return node;},"polygonMember":function(geometry){var node=this.createElementNSPlus("gml:polygonMember");this.writeNode("Polygon",geometry,node);return node;},"GeometryCollection":function(geometry){var node=this.createElementNSPlus("gml:GeometryCollection");for(var i=0,len=geometry.components.length;i<len;++i){this.writeNode("geometryMember",geometry.components[i],node);}
return node;},"geometryMember":function(geometry){var node=this.createElementNSPlus("gml:geometryMember");var child=this.writeNode("feature:_geometry",geometry);node.appendChild(child.firstChild);return node;}},"feature":{"_typeName":function(feature){var node=this.createElementNSPlus("feature:"+this.featureType,{attributes:{fid:feature.fid}});if(feature.geometry){this.writeNode("feature:_geometry",feature.geometry,node);}
for(var name in feature.attributes){var value=feature.attributes[name];if(value!=null){this.writeNode("feature:_attribute",{name:name,value:value},node);}}
return node;},"_geometry":function(geometry){if(this.externalProjection&&this.internalProjection){geometry=geometry.clone().transform(this.internalProjection,this.externalProjection);}
var node=this.createElementNSPlus("feature:"+this.geometryName);var type=this.geometryTypes[geometry.CLASS_NAME];var child=this.writeNode("gml:"+type,geometry,node);if(this.srsName){child.setAttribute("srsName",this.srsName);}
return node;},"_attribute":function(obj){return this.createElementNSPlus("feature:"+obj.name,{value:obj.value});}},"wfs":{"FeatureCollection":function(features){var node=this.createElementNSPlus("wfs:FeatureCollection");for(var i=0,len=features.length;i<len;++i){this.writeNode("gml:featureMember",features[i],node);}
return node;}}},setGeometryTypes:function(){this.geometryTypes={"OpenLayers.Geometry.Point":"Point","OpenLayers.Geometry.MultiPoint":"MultiPoint","OpenLayers.Geometry.LineString":"LineString","OpenLayers.Geometry.MultiLineString":"MultiLineString","OpenLayers.Geometry.Polygon":"Polygon","OpenLayers.Geometry.MultiPolygon":"MultiPolygon","OpenLayers.Geometry.Collection":"GeometryCollection"};},CLASS_NAME:"OpenLayers.Format.GML.Base"});OpenLayers.Format.GML.v2=OpenLayers.Class(OpenLayers.Format.GML.Base,{schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd",initialize:function(options){OpenLayers.Format.GML.Base.prototype.initialize.apply(this,[options]);},readers:{"gml":OpenLayers.Util.applyDefaults({"outerBoundaryIs":function(node,container){var obj={};this.readChildNodes(node,obj);container.outer=obj.components[0];},"innerBoundaryIs":function(node,container){var obj={};this.readChildNodes(node,obj);container.inner.push(obj.components[0]);},"Box":function(node,container){var obj={};this.readChildNodes(node,obj);if(!container.components){container.components=[];}
var min=obj.points[0];var max=obj.points[1];container.components.push(new OpenLayers.Bounds(min.x,min.y,max.x,max.y));}},OpenLayers.Format.GML.Base.prototype.readers["gml"]),"feature":OpenLayers.Format.GML.Base.prototype.readers["feature"],"wfs":OpenLayers.Format.GML.Base.prototype.readers["wfs"]},write:function(features){var name;if(features instanceof Array){name="wfs:FeatureCollection";}else{name="gml:featureMember";}
var root=this.writeNode(name,features);this.setAttributeNS(root,this.namespaces["xsi"],"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[root]);},writers:{"gml":OpenLayers.Util.applyDefaults({"Point":function(geometry){var node=this.createElementNSPlus("gml:Point");this.writeNode("coordinates",[geometry],node);return node;},"coordinates":function(points){var numPoints=points.length;var parts=new Array(numPoints);var point;for(var i=0;i<numPoints;++i){point=points[i];if(this.xy){parts[i]=point.x+","+point.y;}else{parts[i]=point.y+","+point.x;}
if(point.z!=undefined){parts[i]+=","+point.z;}}
return this.createElementNSPlus("gml:coordinates",{attributes:{decimal:".",cs:",",ts:" "},value:(numPoints==1)?parts[0]:parts.join(" ")});},"LineString":function(geometry){var node=this.createElementNSPlus("gml:LineString");this.writeNode("coordinates",geometry.components,node);return node;},"Polygon":function(geometry){var node=this.createElementNSPlus("gml:Polygon");this.writeNode("outerBoundaryIs",geometry.components[0],node);for(var i=1;i<geometry.components.length;++i){this.writeNode("innerBoundaryIs",geometry.components[i],node);}
return node;},"outerBoundaryIs":function(ring){var node=this.createElementNSPlus("gml:outerBoundaryIs");this.writeNode("LinearRing",ring,node);return node;},"innerBoundaryIs":function(ring){var node=this.createElementNSPlus("gml:innerBoundaryIs");this.writeNode("LinearRing",ring,node);return node;},"LinearRing":function(ring){var node=this.createElementNSPlus("gml:LinearRing");this.writeNode("coordinates",ring.components,node);return node;},"Box":function(bounds){var node=this.createElementNSPlus("gml:Box");this.writeNode("coordinates",[{x:bounds.left,y:bounds.bottom},{x:bounds.right,y:bounds.top}],node);if(this.srsName){node.setAttribute("srsName",this.srsName);}
return node;}},OpenLayers.Format.GML.Base.prototype.writers["gml"]),"feature":OpenLayers.Format.GML.Base.prototype.writers["feature"],"wfs":OpenLayers.Format.GML.Base.prototype.writers["wfs"]},CLASS_NAME:"OpenLayers.Format.GML.v2"});OpenLayers.Format.GML.v3=OpenLayers.Class(OpenLayers.Format.GML.Base,{schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",curve:false,multiCurve:true,surface:false,multiSurface:true,initialize:function(options){OpenLayers.Format.GML.Base.prototype.initialize.apply(this,[options]);},readers:{"gml":OpenLayers.Util.applyDefaults({"featureMembers":function(node,obj){this.readChildNodes(node,obj);},"Curve":function(node,container){var obj={points:[]};this.readChildNodes(node,obj);if(!container.components){container.components=[];}
container.components.push(new OpenLayers.Geometry.LineString(obj.points));},"segments":function(node,obj){this.readChildNodes(node,obj);},"LineStringSegment":function(node,container){var obj={};this.readChildNodes(node,obj);if(obj.points){Array.prototype.push.apply(container.points,obj.points);}},"pos":function(node,obj){var str=this.getChildValue(node).replace(this.regExes.trimSpace,"");var coords=str.split(this.regExes.splitSpace);var point;if(this.xy){point=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{point=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}
obj.points=[point];},"posList":function(node,obj){var str=this.getChildValue(node).replace(this.regExes.trimSpace,"");var coords=str.split(this.regExes.splitSpace);var dim=parseInt(node.getAttribute("dimension"))||2;var j,x,y,z;var numPoints=coords.length/dim;var points=new Array(numPoints);for(var i=0,len=coords.length;i<len;i+=dim){x=coords[i];y=coords[i+1];z=(dim==2)?undefined:coords[i+2];if(this.xy){points[i/dim]=new OpenLayers.Geometry.Point(x,y,z);}else{points[i/dim]=new OpenLayers.Geometry.Point(y,x,z);}}
obj.points=points;},"Surface":function(node,obj){this.readChildNodes(node,obj);},"patches":function(node,obj){this.readChildNodes(node,obj);},"PolygonPatch":function(node,obj){this.readers.gml.Polygon.apply(this,[node,obj]);},"exterior":function(node,container){var obj={};this.readChildNodes(node,obj);container.outer=obj.components[0];},"interior":function(node,container){var obj={};this.readChildNodes(node,obj);container.inner.push(obj.components[0]);},"MultiCurve":function(node,container){var obj={components:[]};this.readChildNodes(node,obj);if(obj.components.length>0){container.components=[new OpenLayers.Geometry.MultiLineString(obj.components)];}},"curveMember":function(node,obj){this.readChildNodes(node,obj);},"MultiSurface":function(node,container){var obj={components:[]};this.readChildNodes(node,obj);if(obj.components.length>0){container.components=[new OpenLayers.Geometry.MultiPolygon(obj.components)];}},"surfaceMember":function(node,obj){this.readChildNodes(node,obj);},"surfaceMembers":function(node,obj){this.readChildNodes(node,obj);},"pointMembers":function(node,obj){this.readChildNodes(node,obj);},"lineStringMembers":function(node,obj){this.readChildNodes(node,obj);},"polygonMembers":function(node,obj){this.readChildNodes(node,obj);},"geometryMembers":function(node,obj){this.readChildNodes(node,obj);},"Envelope":function(node,container){var obj={points:new Array(2)};this.readChildNodes(node,obj);if(!container.components){container.components=[];}
var min=obj.points[0];var max=obj.points[1];container.components.push(new OpenLayers.Bounds(min.x,min.y,max.x,max.y));},"lowerCorner":function(node,container){var obj={};this.readers.gml.pos.apply(this,[node,obj]);container.points[0]=obj.points[0];},"upperCorner":function(node,container){var obj={};this.readers.gml.pos.apply(this,[node,obj]);container.points[1]=obj.points[0];}},OpenLayers.Format.GML.Base.prototype.readers["gml"]),"feature":OpenLayers.Format.GML.Base.prototype.readers["feature"],"wfs":OpenLayers.Format.GML.Base.prototype.readers["wfs"]},write:function(features){var name;if(features instanceof Array){name="featureMembers";}else{name="featureMember";}
var root=this.writeNode("gml:"+name,features);this.setAttributeNS(root,this.namespaces["xsi"],"xsi:schemaLocation",this.schemaLocation);return OpenLayers.Format.XML.prototype.write.apply(this,[root]);},writers:{"gml":OpenLayers.Util.applyDefaults({"featureMembers":function(features){var node=this.createElementNSPlus("gml:featureMembers");for(var i=0,len=features.length;i<len;++i){this.writeNode("feature:_typeName",features[i],node);}
return node;},"Point":function(geometry){var node=this.createElementNSPlus("gml:Point");this.writeNode("pos",geometry,node);return node;},"pos":function(point){var pos=(this.xy)?(point.x+" "+point.y):(point.y+" "+point.x);return this.createElementNSPlus("gml:pos",{value:pos});},"LineString":function(geometry){var node=this.createElementNSPlus("gml:LineString");this.writeNode("posList",geometry.components,node);return node;},"Curve":function(geometry){var node=this.createElementNSPlus("gml:Curve");this.writeNode("segments",geometry,node);return node;},"segments":function(geometry){var node=this.createElementNSPlus("gml:segments");this.writeNode("LineStringSegment",geometry,node);return node;},"LineStringSegment":function(geometry){var node=this.createElementNSPlus("gml:LineStringSegment");this.writeNode("posList",geometry.components,node);return node;},"posList":function(points){var len=points.length;var parts=new Array(len);var point;for(var i=0;i<len;++i){point=points[i];if(this.xy){parts[i]=point.x+" "+point.y;}else{parts[i]=point.y+" "+point.x;}}
return this.createElementNSPlus("gml:posList",{value:parts.join(" ")});},"Surface":function(geometry){var node=this.createElementNSPlus("gml:Surface");this.writeNode("patches",geometry,node);return node;},"patches":function(geometry){var node=this.createElementNSPlus("gml:patches");this.writeNode("PolygonPatch",geometry,node);return node;},"PolygonPatch":function(geometry){var node=this.createElementNSPlus("gml:PolygonPatch",{attributes:{interpolation:"planar"}});this.writeNode("exterior",geometry.components[0],node);for(var i=1,len=geometry.components.length;i<len;++i){this.writeNode("interior",geometry.components[i],node);}
return node;},"Polygon":function(geometry){var node=this.createElementNSPlus("gml:Polygon");this.writeNode("exterior",geometry.components[0],node);for(var i=1,len=geometry.components.length;i<len;++i){this.writeNode("interior",geometry.components[i],node);}
return node;},"exterior":function(ring){var node=this.createElementNSPlus("gml:exterior");this.writeNode("LinearRing",ring,node);return node;},"interior":function(ring){var node=this.createElementNSPlus("gml:interior");this.writeNode("LinearRing",ring,node);return node;},"LinearRing":function(ring){var node=this.createElementNSPlus("gml:LinearRing");this.writeNode("posList",ring.components,node);return node;},"MultiCurve":function(geometry){var node=this.createElementNSPlus("gml:MultiCurve");for(var i=0,len=geometry.components.length;i<len;++i){this.writeNode("curveMember",geometry.components[i],node);}
return node;},"curveMember":function(geometry){var node=this.createElementNSPlus("gml:curveMember");if(this.curve){this.writeNode("Curve",geometry,node);}else{this.writeNode("LineString",geometry,node);}
return node;},"MultiSurface":function(geometry){var node=this.createElementNSPlus("gml:MultiSurface");for(var i=0,len=geometry.components.length;i<len;++i){this.writeNode("surfaceMember",geometry.components[i],node);}
return node;},"surfaceMember":function(polygon){var node=this.createElementNSPlus("gml:surfaceMember");if(this.surface){this.writeNode("Surface",polygon,node);}else{this.writeNode("Polygon",polygon,node);}
return node;},"Envelope":function(bounds){var node=this.createElementNSPlus("gml:Envelope");this.writeNode("lowerCorner",bounds,node);this.writeNode("upperCorner",bounds,node);if(this.srsName){node.setAttribute("srsName",this.srsName);}
return node;},"lowerCorner":function(bounds){var pos=(this.xy)?(bounds.left+" "+bounds.bottom):(bounds.bottom+" "+bounds.left);return this.createElementNSPlus("gml:lowerCorner",{value:pos});},"upperCorner":function(bounds){var pos=(this.xy)?(bounds.right+" "+bounds.top):(bounds.top+" "+bounds.right);return this.createElementNSPlus("gml:upperCorner",{value:pos});}},OpenLayers.Format.GML.Base.prototype.writers["gml"]),"feature":OpenLayers.Format.GML.Base.prototype.writers["feature"],"wfs":OpenLayers.Format.GML.Base.prototype.writers["wfs"]},setGeometryTypes:function(){this.geometryTypes={"OpenLayers.Geometry.Point":"Point","OpenLayers.Geometry.MultiPoint":"MultiPoint","OpenLayers.Geometry.LineString":(this.curve===true)?"Curve":"LineString","OpenLayers.Geometry.MultiLineString":(this.multiCurve===false)?"MultiLineString":"MultiCurve","OpenLayers.Geometry.Polygon":(this.surface===true)?"Surface":"Polygon","OpenLayers.Geometry.MultiPolygon":(this.multiSurface===false)?"MultiPolygon":"MultiSurface","OpenLayers.Geometry.Collection":"GeometryCollection"};},CLASS_NAME:"OpenLayers.Format.GML.v3"});var MooTools={'version':'1.2.2','build':'f0491d62fbb7e906789aa3733d6a67d43e5af7c9'};var Native=function(options){options=options||{};var name=options.name;var legacy=options.legacy;var protect=options.protect;var methods=options.implement;var generics=options.generics;var initialize=options.initialize;var afterImplement=options.afterImplement||function(){};var object=initialize||legacy;generics=generics!==false;object.constructor=Native;object.$family={name:'native'};if(legacy&&initialize)object.prototype=legacy.prototype;object.prototype.constructor=object;if(name){var family=name.toLowerCase();object.prototype.$family={name:family};Native.typize(object,family);}
var add=function(obj,name,method,force){if(!protect||force||!obj.prototype[name])obj.prototype[name]=method;if(generics)Native.genericize(obj,name,protect);afterImplement.call(obj,name,method);return obj;};object.alias=function(a1,a2,a3){if(typeof a1=='string'){if((a1=this.prototype[a1]))return add(this,a2,a1,a3);}
for(var a in a1)this.alias(a,a1[a],a2);return this;};object.implement=function(a1,a2,a3){if(typeof a1=='string')return add(this,a1,a2,a3);for(var p in a1)add(this,p,a1[p],a2);return this;};if(methods)object.implement(methods);return object;};Native.genericize=function(object,property,check){if((!check||!object[property])&&typeof object.prototype[property]=='function')object[property]=function(){var args=Array.prototype.slice.call(arguments);return object.prototype[property].apply(args.shift(),args);};};Native.implement=function(objects,properties){for(var i=0,l=objects.length;i<l;i++)objects[i].implement(properties);};Native.typize=function(object,family){if(!object.type)object.type=function(item){return($type(item)===family);};};(function(){var natives={'Array':Array,'Date':Date,'Function':Function,'Number':Number,'RegExp':RegExp,'String':String};for(var n in natives)new Native({name:n,initialize:natives[n],protect:true});var types={'boolean':Boolean,'native':Native,'object':Object};for(var t in types)Native.typize(types[t],t);var generics={'Array':["concat","indexOf","join","lastIndexOf","pop","push","reverse","shift","slice","sort","splice","toString","unshift","valueOf"],'String':["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","valueOf"]};for(var g in generics){for(var i=generics[g].length;i--;)Native.genericize(window[g],generics[g][i],true);}})();var Hash=new Native({name:'Hash',initialize:function(object){if($type(object)=='hash')object=$unlink(object.getClean());for(var key in object)this[key]=object[key];return this;}});Hash.implement({forEach:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key))fn.call(bind,this[key],key,this);}},getClean:function(){var clean={};for(var key in this){if(this.hasOwnProperty(key))clean[key]=this[key];}
return clean;},getLength:function(){var length=0;for(var key in this){if(this.hasOwnProperty(key))length++;}
return length;}});Hash.alias('forEach','each');Array.implement({forEach:function(fn,bind){for(var i=0,l=this.length;i<l;i++)fn.call(bind,this[i],i,this);}});Array.alias('forEach','each');function $A(iterable){if(iterable.item){var l=iterable.length,array=new Array(l);while(l--)array[l]=iterable[l];return array;}
return Array.prototype.slice.call(iterable);};function $arguments(i){return function(){return arguments[i];};};function $chk(obj){return!!(obj||obj===0);};function $clear(timer){clearTimeout(timer);clearInterval(timer);return null;};function $defined(obj){return(obj!=undefined);};function $each(iterable,fn,bind){var type=$type(iterable);((type=='arguments'||type=='collection'||type=='array')?Array:Hash).each(iterable,fn,bind);};function $empty(){};function $extend(original,extended){for(var key in(extended||{}))original[key]=extended[key];return original;};function $H(object){return new Hash(object);};function $lambda(value){return(typeof value=='function')?value:function(){return value;};};function $merge(){var args=Array.slice(arguments);args.unshift({});return $mixin.apply(null,args);};function $mixin(mix){for(var i=1,l=arguments.length;i<l;i++){var object=arguments[i];if($type(object)!='object')continue;for(var key in object){var op=object[key],mp=mix[key];mix[key]=(mp&&$type(op)=='object'&&$type(mp)=='object')?$mixin(mp,op):$unlink(op);}}
return mix;};function $pick(){for(var i=0,l=arguments.length;i<l;i++){if(arguments[i]!=undefined)return arguments[i];}
return null;};function $random(min,max){return Math.floor(Math.random()*(max-min+1)+min);};function $splat(obj){var type=$type(obj);return(type)?((type!='array'&&type!='arguments')?[obj]:obj):[];};var $time=Date.now||function(){return+new Date;};function $try(){for(var i=0,l=arguments.length;i<l;i++){try{return arguments[i]();}catch(e){}}
return null;};function $type(obj){if(obj==undefined)return false;if(obj.$family)return(obj.$family.name=='number'&&!isFinite(obj))?false:obj.$family.name;if(obj.nodeName){switch(obj.nodeType){case 1:return'element';case 3:return(/\S/).test(obj.nodeValue)?'textnode':'whitespace';}}else if(typeof obj.length=='number'){if(obj.callee)return'arguments';else if(obj.item)return'collection';}
return typeof obj;};function $unlink(object){var unlinked;switch($type(object)){case'object':unlinked={};for(var p in object)unlinked[p]=$unlink(object[p]);break;case'hash':unlinked=new Hash(object);break;case'array':unlinked=[];for(var i=0,l=object.length;i<l;i++)unlinked[i]=$unlink(object[i]);break;default:return object;}
return unlinked;};var Browser=$merge({Engine:{name:'unknown',version:0},Platform:{name:(window.orientation!=undefined)?'ipod':(navigator.platform.match(/mac|win|linux/i)||['other'])[0].toLowerCase()},Features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.querySelector)},Plugins:{},Engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getElementsByClassName)?950:925));},trident:function(){return(!window.ActiveXObject)?false:((window.XMLHttpRequest)?5:4);},webkit:function(){return(navigator.taintEnabled)?false:((Browser.Features.xpath)?((Browser.Features.query)?525:420):419);},gecko:function(){return(document.getBoxObjectFor==undefined)?false:((document.getElementsByClassName)?19:18);}}},Browser||{});Browser.Platform[Browser.Platform.name]=true;Browser.detect=function(){for(var engine in this.Engines){var version=this.Engines[engine]();if(version){this.Engine={name:engine,version:version};this.Engine[engine]=this.Engine[engine+version]=true;break;}}
return{name:engine,version:version};};Browser.detect();Browser.Request=function(){return $try(function(){return new XMLHttpRequest();},function(){return new ActiveXObject('MSXML2.XMLHTTP');});};Browser.Features.xhr=!!(Browser.Request());Browser.Plugins.Flash=(function(){var version=($try(function(){return navigator.plugins['Shockwave Flash'].description;},function(){return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');})||'0 r0').match(/\d+/g);return{version:parseInt(version[0]||0+'.'+version[1],10)||0,build:parseInt(version[2],10)||0};})();function $exec(text){if(!text)return text;if(window.execScript){window.execScript(text);}else{var script=document.createElement('script');script.setAttribute('type','text/javascript');script[(Browser.Engine.webkit&&Browser.Engine.version<420)?'innerText':'text']=text;document.head.appendChild(script);document.head.removeChild(script);}
return text;};Native.UID=1;var $uid=(Browser.Engine.trident)?function(item){return(item.uid||(item.uid=[Native.UID++]))[0];}:function(item){return item.uid||(item.uid=Native.UID++);};var Window=new Native({name:'Window',legacy:(Browser.Engine.trident)?null:window.Window,initialize:function(win){$uid(win);if(!win.Element){win.Element=$empty;if(Browser.Engine.webkit)win.document.createElement("iframe");win.Element.prototype=(Browser.Engine.webkit)?window["[[DOMElement.prototype]]"]:{};}
win.document.window=win;return $extend(win,Window.Prototype);},afterImplement:function(property,value){window[property]=Window.Prototype[property]=value;}});Window.Prototype={$family:{name:'window'}};new Window(window);var Document=new Native({name:'Document',legacy:(Browser.Engine.trident)?null:window.Document,initialize:function(doc){$uid(doc);doc.head=doc.getElementsByTagName('head')[0];doc.html=doc.getElementsByTagName('html')[0];if(Browser.Engine.trident&&Browser.Engine.version<=4)$try(function(){doc.execCommand("BackgroundImageCache",false,true);});if(Browser.Engine.trident)doc.window.attachEvent('onunload',function(){doc.window.detachEvent('onunload',arguments.callee);doc.head=doc.html=doc.window=null;});return $extend(doc,Document.Prototype);},afterImplement:function(property,value){document[property]=Document.Prototype[property]=value;}});Document.Prototype={$family:{name:'document'}};new Document(document);Array.implement({every:function(fn,bind){for(var i=0,l=this.length;i<l;i++){if(!fn.call(bind,this[i],i,this))return false;}
return true;},filter:function(fn,bind){var results=[];for(var i=0,l=this.length;i<l;i++){if(fn.call(bind,this[i],i,this))results.push(this[i]);}
return results;},clean:function(){return this.filter($defined);},indexOf:function(item,from){var len=this.length;for(var i=(from<0)?Math.max(0,len+from):from||0;i<len;i++){if(this[i]===item)return i;}
return-1;},map:function(fn,bind){var results=[];for(var i=0,l=this.length;i<l;i++)results[i]=fn.call(bind,this[i],i,this);return results;},some:function(fn,bind){for(var i=0,l=this.length;i<l;i++){if(fn.call(bind,this[i],i,this))return true;}
return false;},associate:function(keys){var obj={},length=Math.min(this.length,keys.length);for(var i=0;i<length;i++)obj[keys[i]]=this[i];return obj;},link:function(object){var result={};for(var i=0,l=this.length;i<l;i++){for(var key in object){if(object[key](this[i])){result[key]=this[i];delete object[key];break;}}}
return result;},contains:function(item,from){return this.indexOf(item,from)!=-1;},extend:function(array){for(var i=0,j=array.length;i<j;i++)this.push(array[i]);return this;},getLast:function(){return(this.length)?this[this.length-1]:null;},getRandom:function(){return(this.length)?this[$random(0,this.length-1)]:null;},include:function(item){if(!this.contains(item))this.push(item);return this;},combine:function(array){for(var i=0,l=array.length;i<l;i++)this.include(array[i]);return this;},erase:function(item){for(var i=this.length;i--;i){if(this[i]===item)this.splice(i,1);}
return this;},empty:function(){this.length=0;return this;},flatten:function(){var array=[];for(var i=0,l=this.length;i<l;i++){var type=$type(this[i]);if(!type)continue;array=array.concat((type=='array'||type=='collection'||type=='arguments')?Array.flatten(this[i]):this[i]);}
return array;},hexToRgb:function(array){if(this.length!=3)return null;var rgb=this.map(function(value){if(value.length==1)value+=value;return value.toInt(16);});return(array)?rgb:'rgb('+rgb+')';},rgbToHex:function(array){if(this.length<3)return null;if(this.length==4&&this[3]==0&&!array)return'transparent';var hex=[];for(var i=0;i<3;i++){var bit=(this[i]-0).toString(16);hex.push((bit.length==1)?'0'+bit:bit);}
return(array)?hex:'#'+hex.join('');}});Function.implement({extend:function(properties){for(var property in properties)this[property]=properties[property];return this;},create:function(options){var self=this;options=options||{};return function(event){var args=options.arguments;args=(args!=undefined)?$splat(args):Array.slice(arguments,(options.event)?1:0);if(options.event)args=[event||window.event].extend(args);var returns=function(){return self.apply(options.bind||null,args);};if(options.delay)return setTimeout(returns,options.delay);if(options.periodical)return setInterval(returns,options.periodical);if(options.attempt)return $try(returns);return returns();};},run:function(args,bind){return this.apply(bind,$splat(args));},pass:function(args,bind){return this.create({bind:bind,arguments:args});},bind:function(bind,args){return this.create({bind:bind,arguments:args});},bindWithEvent:function(bind,args){return this.create({bind:bind,arguments:args,event:true});},attempt:function(args,bind){return this.create({bind:bind,arguments:args,attempt:true})();},delay:function(delay,bind,args){return this.create({bind:bind,arguments:args,delay:delay})();},periodical:function(periodical,bind,args){return this.create({bind:bind,arguments:args,periodical:periodical})();}});Number.implement({limit:function(min,max){return Math.min(max,Math.max(min,this));},round:function(precision){precision=Math.pow(10,precision||0);return Math.round(this*precision)/precision;},times:function(fn,bind){for(var i=0;i<this;i++)fn.call(bind,i,this);},toFloat:function(){return parseFloat(this);},toInt:function(base){return parseInt(this,base||10);}});Number.alias('times','each');(function(math){var methods={};math.each(function(name){if(!Number[name])methods[name]=function(){return Math[name].apply(null,[this].concat($A(arguments)));};});Number.implement(methods);})(['abs','acos','asin','atan','atan2','ceil','cos','exp','floor','log','max','min','pow','sin','sqrt','tan']);String.implement({test:function(regex,params){return((typeof regex=='string')?new RegExp(regex,params):regex).test(this);},contains:function(string,separator){return(separator)?(separator+this+separator).indexOf(separator+string+separator)>-1:this.indexOf(string)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,'');},clean:function(){return this.replace(/\s+/g,' ').trim();},camelCase:function(){return this.replace(/-\D/g,function(match){return match.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/[A-Z]/g,function(match){return('-'+match.charAt(0).toLowerCase());});},capitalize:function(){return this.replace(/\b[a-z]/g,function(match){return match.toUpperCase();});},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,'\\$1');},toInt:function(base){return parseInt(this,base||10);},toFloat:function(){return parseFloat(this);},hexToRgb:function(array){var hex=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(hex)?hex.slice(1).hexToRgb(array):null;},rgbToHex:function(array){var rgb=this.match(/\d{1,3}/g);return(rgb)?rgb.rgbToHex(array):null;},stripScripts:function(option){var scripts='';var text=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){scripts+=arguments[1]+'\n';return'';});if(option===true)$exec(scripts);else if($type(option)=='function')option(scripts,text);return text;},substitute:function(object,regexp){return this.replace(regexp||(/\\?\{([^{}]+)\}/g),function(match,name){if(match.charAt(0)=='\\')return match.slice(1);return(object[name]!=undefined)?object[name]:'';});}});Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(value){for(var key in this){if(this.hasOwnProperty(key)&&this[key]===value)return key;}
return null;},hasValue:function(value){return(Hash.keyOf(this,value)!==null);},extend:function(properties){Hash.each(properties,function(value,key){Hash.set(this,key,value);},this);return this;},combine:function(properties){Hash.each(properties,function(value,key){Hash.include(this,key,value);},this);return this;},erase:function(key){if(this.hasOwnProperty(key))delete this[key];return this;},get:function(key){return(this.hasOwnProperty(key))?this[key]:null;},set:function(key,value){if(!this[key]||this.hasOwnProperty(key))this[key]=value;return this;},empty:function(){Hash.each(this,function(value,key){delete this[key];},this);return this;},include:function(key,value){if(this[key]==undefined)this[key]=value;return this;},map:function(fn,bind){var results=new Hash;Hash.each(this,function(value,key){results.set(key,fn.call(bind,value,key,this));},this);return results;},filter:function(fn,bind){var results=new Hash;Hash.each(this,function(value,key){if(fn.call(bind,value,key,this))results.set(key,value);},this);return results;},every:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key)&&!fn.call(bind,this[key],key))return false;}
return true;},some:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key)&&fn.call(bind,this[key],key))return true;}
return false;},getKeys:function(){var keys=[];Hash.each(this,function(value,key){keys.push(key);});return keys;},getValues:function(){var values=[];Hash.each(this,function(value){values.push(value);});return values;},toQueryString:function(base){var queryString=[];Hash.each(this,function(value,key){if(base)key=base+'['+key+']';var result;switch($type(value)){case'object':result=Hash.toQueryString(value,key);break;case'array':var qs={};value.each(function(val,i){qs[i]=val;});result=Hash.toQueryString(qs,key);break;default:result=key+'='+encodeURIComponent(value);}
if(value!=undefined)queryString.push(result);});return queryString.join('&');}});Hash.alias({keyOf:'indexOf',hasValue:'contains'});var Event=new Native({name:'Event',initialize:function(event,win){win=win||window;var doc=win.document;event=event||win.event;if(event.$extended)return event;this.$extended=true;var type=event.type;var target=event.target||event.srcElement;while(target&&target.nodeType==3)target=target.parentNode;if(type.test(/key/)){var code=event.which||event.keyCode;var key=Event.Keys.keyOf(code);if(type=='keydown'){var fKey=code-111;if(fKey>0&&fKey<13)key='f'+fKey;}
key=key||String.fromCharCode(code).toLowerCase();}else if(type.match(/(click|mouse|menu)/i)){doc=(!doc.compatMode||doc.compatMode=='CSS1Compat')?doc.html:doc.body;var page={x:event.pageX||event.clientX+doc.scrollLeft,y:event.pageY||event.clientY+doc.scrollTop};var client={x:(event.pageX)?event.pageX-win.pageXOffset:event.clientX,y:(event.pageY)?event.pageY-win.pageYOffset:event.clientY};if(type.match(/DOMMouseScroll|mousewheel/)){var wheel=(event.wheelDelta)?event.wheelDelta/120:-(event.detail||0)/3;}
var rightClick=(event.which==3)||(event.button==2);var related=null;if(type.match(/over|out/)){switch(type){case'mouseover':related=event.relatedTarget||event.fromElement;break;case'mouseout':related=event.relatedTarget||event.toElement;}
if(!(function(){while(related&&related.nodeType==3)related=related.parentNode;return true;}).create({attempt:Browser.Engine.gecko})())related=false;}}
return $extend(this,{event:event,type:type,page:page,client:client,rightClick:rightClick,wheel:wheel,relatedTarget:related,target:target,code:code,key:key,shift:event.shiftKey,control:event.ctrlKey,alt:event.altKey,meta:event.metaKey});}});Event.Keys=new Hash({'enter':13,'up':38,'down':40,'left':37,'right':39,'esc':27,'space':32,'backspace':8,'tab':9,'delete':46});Event.implement({stop:function(){return this.stopPropagation().preventDefault();},stopPropagation:function(){if(this.event.stopPropagation)this.event.stopPropagation();else this.event.cancelBubble=true;return this;},preventDefault:function(){if(this.event.preventDefault)this.event.preventDefault();else this.event.returnValue=false;return this;}});function Class(params){if(params instanceof Function)params={initialize:params};var newClass=function(){Object.reset(this);if(newClass._prototyping)return this;this._current=$empty;var value=(this.initialize)?this.initialize.apply(this,arguments):this;delete this._current;delete this.caller;return value;}.extend(this);newClass.implement(params);newClass.constructor=Class;newClass.prototype.constructor=newClass;return newClass;};Function.prototype.protect=function(){this._protected=true;return this;};Object.reset=function(object,key){if(key==null){for(var p in object)Object.reset(object,p);return object;}
delete object[key];switch($type(object[key])){case'object':var F=function(){};F.prototype=object[key];var i=new F;object[key]=Object.reset(i);break;case'array':object[key]=$unlink(object[key]);break;}
return object;};new Native({name:'Class',initialize:Class}).extend({instantiate:function(F){F._prototyping=true;var proto=new F;delete F._prototyping;return proto;},wrap:function(self,key,method){if(method._origin)method=method._origin;return function(){if(method._protected&&this._current==null)throw new Error('The method "'+key+'" cannot be called.');var caller=this.caller,current=this._current;this.caller=current;this._current=arguments.callee;var result=method.apply(this,arguments);this._current=current;this.caller=caller;return result;}.extend({_owner:self,_origin:method,_name:key});}});Class.implement({implement:function(key,value){if($type(key)=='object'){for(var p in key)this.implement(p,key[p]);return this;}
var mutator=Class.Mutators[key];if(mutator){value=mutator.call(this,value);if(value==null)return this;}
var proto=this.prototype;switch($type(value)){case'function':if(value._hidden)return this;proto[key]=Class.wrap(this,key,value);break;case'object':var previous=proto[key];if($type(previous)=='object')$mixin(previous,value);else proto[key]=$unlink(value);break;case'array':proto[key]=$unlink(value);break;default:proto[key]=value;}
return this;}});Class.Mutators={Extends:function(parent){this.parent=parent;this.prototype=Class.instantiate(parent);this.implement('parent',function(){var name=this.caller._name,previous=this.caller._owner.parent.prototype[name];if(!previous)throw new Error('The method "'+name+'" has no parent.');return previous.apply(this,arguments);}.protect());},Implements:function(items){$splat(items).each(function(item){if(item instanceof Function)item=Class.instantiate(item);this.implement(item);},this);}};var Chain=new Class({$chain:[],chain:function(){this.$chain.extend(Array.flatten(arguments));return this;},callChain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false;},clearChain:function(){this.$chain.empty();return this;}});var Events=new Class({$events:{},addEvent:function(type,fn,internal){type=Events.removeOn(type);if(fn!=$empty){this.$events[type]=this.$events[type]||[];this.$events[type].include(fn);if(internal)fn.internal=true;}
return this;},addEvents:function(events){for(var type in events)this.addEvent(type,events[type]);return this;},fireEvent:function(type,args,delay){type=Events.removeOn(type);if(!this.$events||!this.$events[type])return this;this.$events[type].each(function(fn){fn.create({'bind':this,'delay':delay,'arguments':args})();},this);return this;},removeEvent:function(type,fn){type=Events.removeOn(type);if(!this.$events[type])return this;if(!fn.internal)this.$events[type].erase(fn);return this;},removeEvents:function(events){if($type(events)=='object'){for(var type in events)this.removeEvent(type,events[type]);return this;}
if(events)events=Events.removeOn(events);for(var type in this.$events){if(events&&events!=type)continue;var fns=this.$events[type];for(var i=fns.length;i--;i)this.removeEvent(type,fns[i]);}
return this;}});Events.removeOn=function(string){return string.replace(/^on([A-Z])/,function(full,first){return first.toLowerCase();});};var Options=new Class({setOptions:function(){this.options=$merge.run([this.options].extend(arguments));if(!this.addEvent)return this;for(var option in this.options){if($type(this.options[option])!='function'||!(/^on[A-Z]/).test(option))continue;this.addEvent(option,this.options[option]);delete this.options[option];}
return this;}});var Element=new Native({name:'Element',legacy:window.Element,initialize:function(tag,props){var konstructor=Element.Constructors.get(tag);if(konstructor)return konstructor(props);if(typeof tag=='string')return document.newElement(tag,props);return $(tag).set(props);},afterImplement:function(key,value){Element.Prototype[key]=value;if(Array[key])return;Elements.implement(key,function(){var items=[],elements=true;for(var i=0,j=this.length;i<j;i++){var returns=this[i][key].apply(this[i],arguments);items.push(returns);if(elements)elements=($type(returns)=='element');}
return(elements)?new Elements(items):items;});}});Element.Prototype={$family:{name:'element'}};Element.Constructors=new Hash;var IFrame=new Native({name:'IFrame',generics:false,initialize:function(){var params=Array.link(arguments,{properties:Object.type,iframe:$defined});var props=params.properties||{};var iframe=$(params.iframe)||false;var onload=props.onload||$empty;delete props.onload;props.id=props.name=$pick(props.id,props.name,iframe.id,iframe.name,'IFrame_'+$time());iframe=new Element(iframe||'iframe',props);var onFrameLoad=function(){var host=$try(function(){return iframe.contentWindow.location.host;});if(host&&host==window.location.host){var win=new Window(iframe.contentWindow);new Document(iframe.contentWindow.document);$extend(win.Element.prototype,Element.Prototype);}
onload.call(iframe.contentWindow,iframe.contentWindow.document);};(window.frames[props.id])?onFrameLoad():iframe.addListener('load',onFrameLoad);return iframe;}});var Elements=new Native({initialize:function(elements,options){options=$extend({ddup:true,cash:true},options);elements=elements||[];if(options.ddup||options.cash){var uniques={},returned=[];for(var i=0,l=elements.length;i<l;i++){var el=$.element(elements[i],!options.cash);if(options.ddup){if(uniques[el.uid])continue;uniques[el.uid]=true;}
returned.push(el);}
elements=returned;}
return(options.cash)?$extend(elements,this):elements;}});Elements.implement({filter:function(filter,bind){if(!filter)return this;return new Elements(Array.filter(this,(typeof filter=='string')?function(item){return item.match(filter);}:filter,bind));}});Document.implement({newElement:function(tag,props){if(Browser.Engine.trident&&props){['name','type','checked'].each(function(attribute){if(!props[attribute])return;tag+=' '+attribute+'="'+props[attribute]+'"';if(attribute!='checked')delete props[attribute];});tag='<'+tag+'>';}
return $.element(this.createElement(tag)).set(props);},newTextNode:function(text){return this.createTextNode(text);},getDocument:function(){return this;},getWindow:function(){return this.window;}});Window.implement({$:function(el,nocash){if(el&&el.$family&&el.uid)return el;var type=$type(el);return($[type])?$[type](el,nocash,this.document):null;},$$:function(selector){if(arguments.length==1&&typeof selector=='string')return this.document.getElements(selector);var elements=[];var args=Array.flatten(arguments);for(var i=0,l=args.length;i<l;i++){var item=args[i];switch($type(item)){case'element':elements.push(item);break;case'string':elements.extend(this.document.getElements(item,true));}}
return new Elements(elements);},getDocument:function(){return this.document;},getWindow:function(){return this;}});$.string=function(id,nocash,doc){id=doc.getElementById(id);return(id)?$.element(id,nocash):null;};$.element=function(el,nocash){$uid(el);if(!nocash&&!el.$family&&!(/^object|embed$/i).test(el.tagName)){var proto=Element.Prototype;for(var p in proto)el[p]=proto[p];};return el;};$.object=function(obj,nocash,doc){if(obj.toElement)return $.element(obj.toElement(doc),nocash);return null;};$.textnode=$.whitespace=$.window=$.document=$arguments(0);Native.implement([Element,Document],{getElement:function(selector,nocash){return $(this.getElements(selector,true)[0]||null,nocash);},getElements:function(tags,nocash){tags=tags.split(',');var elements=[];var ddup=(tags.length>1);tags.each(function(tag){var partial=this.getElementsByTagName(tag.trim());(ddup)?elements.extend(partial):elements=partial;},this);return new Elements(elements,{ddup:ddup,cash:!nocash});}});(function(){var collected={},storage={};var props={input:'checked',option:'selected',textarea:(Browser.Engine.webkit&&Browser.Engine.version<420)?'innerHTML':'value'};var get=function(uid){return(storage[uid]||(storage[uid]={}));};var clean=function(item,retain){if(!item)return;var uid=item.uid;if(Browser.Engine.trident){if(item.clearAttributes){var clone=retain&&item.cloneNode(false);item.clearAttributes();if(clone)item.mergeAttributes(clone);}else if(item.removeEvents){item.removeEvents();}
if((/object/i).test(item.tagName)){for(var p in item){if(typeof item[p]=='function')item[p]=$empty;}
Element.dispose(item);}}
if(!uid)return;collected[uid]=storage[uid]=null;};var purge=function(){Hash.each(collected,clean);if(Browser.Engine.trident)$A(document.getElementsByTagName('object')).each(clean);if(window.CollectGarbage)CollectGarbage();collected={};storage={};};var walk=function(element,walk,start,match,all,nocash){var el=element[start||walk];var elements=[];while(el){if(el.nodeType==1&&(!match||Element.match(el,match))){if(!all)return $(el,nocash);elements.push(el);}
el=el[walk];}
return(all)?new Elements(elements,{ddup:false,cash:!nocash}):null;};var attributes={'html':'innerHTML','class':'className','for':'htmlFor','text':(Browser.Engine.trident||(Browser.Engine.webkit&&Browser.Engine.version<420))?'innerText':'textContent'};var bools=['compact','nowrap','ismap','declare','noshade','checked','disabled','readonly','multiple','selected','noresize','defer'];var camels=['value','accessKey','cellPadding','cellSpacing','colSpan','frameBorder','maxLength','readOnly','rowSpan','tabIndex','useMap'];bools=bools.associate(bools);Hash.extend(attributes,bools);Hash.extend(attributes,camels.associate(camels.map(String.toLowerCase)));var inserters={before:function(context,element){if(element.parentNode)element.parentNode.insertBefore(context,element);},after:function(context,element){if(!element.parentNode)return;var next=element.nextSibling;(next)?element.parentNode.insertBefore(context,next):element.parentNode.appendChild(context);},bottom:function(context,element){element.appendChild(context);},top:function(context,element){var first=element.firstChild;(first)?element.insertBefore(context,first):element.appendChild(context);}};inserters.inside=inserters.bottom;Hash.each(inserters,function(inserter,where){where=where.capitalize();Element.implement('inject'+where,function(el){inserter(this,$(el,true));return this;});Element.implement('grab'+where,function(el){inserter($(el,true),this);return this;});});Element.implement({set:function(prop,value){switch($type(prop)){case'object':for(var p in prop)this.set(p,prop[p]);break;case'string':var property=Element.Properties.get(prop);(property&&property.set)?property.set.apply(this,Array.slice(arguments,1)):this.setProperty(prop,value);}
return this;},get:function(prop){var property=Element.Properties.get(prop);return(property&&property.get)?property.get.apply(this,Array.slice(arguments,1)):this.getProperty(prop);},erase:function(prop){var property=Element.Properties.get(prop);(property&&property.erase)?property.erase.apply(this):this.removeProperty(prop);return this;},setProperty:function(attribute,value){var key=attributes[attribute];if(value==undefined)return this.removeProperty(attribute);if(key&&bools[attribute])value=!!value;(key)?this[key]=value:this.setAttribute(attribute,''+value);return this;},setProperties:function(attributes){for(var attribute in attributes)this.setProperty(attribute,attributes[attribute]);return this;},getProperty:function(attribute){var key=attributes[attribute];var value=(key)?this[key]:this.getAttribute(attribute,2);return(bools[attribute])?!!value:(key)?value:value||null;},getProperties:function(){var args=$A(arguments);return args.map(this.getProperty,this).associate(args);},removeProperty:function(attribute){var key=attributes[attribute];(key)?this[key]=(key&&bools[attribute])?false:'':this.removeAttribute(attribute);return this;},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this;},hasClass:function(className){return this.className.contains(className,' ');},addClass:function(className){if(!this.hasClass(className))this.className=(this.className+' '+className).clean();return this;},removeClass:function(className){this.className=this.className.replace(new RegExp('(^|\\s)'+className+'(?:\\s|$)'),'$1');return this;},toggleClass:function(className){return this.hasClass(className)?this.removeClass(className):this.addClass(className);},adopt:function(){Array.flatten(arguments).each(function(element){element=$(element,true);if(element)this.appendChild(element);},this);return this;},appendText:function(text,where){return this.grab(this.getDocument().newTextNode(text),where);},grab:function(el,where){inserters[where||'bottom']($(el,true),this);return this;},inject:function(el,where){inserters[where||'bottom'](this,$(el,true));return this;},replaces:function(el){el=$(el,true);el.parentNode.replaceChild(this,el);return this;},wraps:function(el,where){el=$(el,true);return this.replaces(el).grab(el,where);},getPrevious:function(match,nocash){return walk(this,'previousSibling',null,match,false,nocash);},getAllPrevious:function(match,nocash){return walk(this,'previousSibling',null,match,true,nocash);},getNext:function(match,nocash){return walk(this,'nextSibling',null,match,false,nocash);},getAllNext:function(match,nocash){return walk(this,'nextSibling',null,match,true,nocash);},getFirst:function(match,nocash){return walk(this,'nextSibling','firstChild',match,false,nocash);},getLast:function(match,nocash){return walk(this,'previousSibling','lastChild',match,false,nocash);},getParent:function(match,nocash){return walk(this,'parentNode',null,match,false,nocash);},getParents:function(match,nocash){return walk(this,'parentNode',null,match,true,nocash);},getSiblings:function(match,nocash){return this.getParent().getChildren(match,nocash).erase(this);},getChildren:function(match,nocash){return walk(this,'nextSibling','firstChild',match,true,nocash);},getWindow:function(){return this.ownerDocument.window;},getDocument:function(){return this.ownerDocument;},getElementById:function(id,nocash){var el=this.ownerDocument.getElementById(id);if(!el)return null;for(var parent=el.parentNode;parent!=this;parent=parent.parentNode){if(!parent)return null;}
return $.element(el,nocash);},getSelected:function(){return new Elements($A(this.options).filter(function(option){return option.selected;}));},getComputedStyle:function(property){if(this.currentStyle)return this.currentStyle[property.camelCase()];var computed=this.getDocument().defaultView.getComputedStyle(this,null);return(computed)?computed.getPropertyValue([property.hyphenate()]):null;},toQueryString:function(){var queryString=[];this.getElements('input, select, textarea',true).each(function(el){if(!el.name||el.disabled)return;var value=(el.tagName.toLowerCase()=='select')?Element.getSelected(el).map(function(opt){return opt.value;}):((el.type=='radio'||el.type=='checkbox')&&!el.checked)?null:el.value;$splat(value).each(function(val){if(typeof val!='undefined')queryString.push(el.name+'='+encodeURIComponent(val));});});return queryString.join('&');},clone:function(contents,keepid){contents=contents!==false;var clone=this.cloneNode(contents);var clean=function(node,element){if(!keepid)node.removeAttribute('id');if(Browser.Engine.trident){node.clearAttributes();node.mergeAttributes(element);node.removeAttribute('uid');if(node.options){var no=node.options,eo=element.options;for(var j=no.length;j--;)no[j].selected=eo[j].selected;}}
var prop=props[element.tagName.toLowerCase()];if(prop&&element[prop])node[prop]=element[prop];};if(contents){var ce=clone.getElementsByTagName('*'),te=this.getElementsByTagName('*');for(var i=ce.length;i--;)clean(ce[i],te[i]);}
clean(clone,this);return $(clone);},destroy:function(){Element.empty(this);Element.dispose(this);clean(this,true);return null;},empty:function(){$A(this.childNodes).each(function(node){Element.destroy(node);});return this;},dispose:function(){return(this.parentNode)?this.parentNode.removeChild(this):this;},hasChild:function(el){el=$(el,true);if(!el)return false;if(Browser.Engine.webkit&&Browser.Engine.version<420)return $A(this.getElementsByTagName(el.tagName)).contains(el);return(this.contains)?(this!=el&&this.contains(el)):!!(this.compareDocumentPosition(el)&16);},match:function(tag){return(!tag||(tag==this)||(Element.get(this,'tag')==tag));}});Native.implement([Element,Window,Document],{addListener:function(type,fn){if(type=='unload'){var old=fn,self=this;fn=function(){self.removeListener('unload',fn);old();};}else{collected[this.uid]=this;}
if(this.addEventListener)this.addEventListener(type,fn,false);else this.attachEvent('on'+type,fn);return this;},removeListener:function(type,fn){if(this.removeEventListener)this.removeEventListener(type,fn,false);else this.detachEvent('on'+type,fn);return this;},retrieve:function(property,dflt){var storage=get(this.uid),prop=storage[property];if(dflt!=undefined&&prop==undefined)prop=storage[property]=dflt;return $pick(prop);},store:function(property,value){var storage=get(this.uid);storage[property]=value;return this;},eliminate:function(property){var storage=get(this.uid);delete storage[property];return this;}});window.addListener('unload',purge);})();Element.Properties=new Hash;Element.Properties.style={set:function(style){this.style.cssText=style;},get:function(){return this.style.cssText;},erase:function(){this.style.cssText='';}};Element.Properties.tag={get:function(){return this.tagName.toLowerCase();}};Element.Properties.html=(function(){var wrapper=document.createElement('div');var translations={table:[1,'<table>','</table>'],select:[1,'<select>','</select>'],tbody:[2,'<table><tbody>','</tbody></table>'],tr:[3,'<table><tbody><tr>','</tr></tbody></table>']};translations.thead=translations.tfoot=translations.tbody;var html={set:function(){var html=Array.flatten(arguments).join('');var wrap=Browser.Engine.trident&&translations[this.get('tag')];if(wrap){var first=wrapper;first.innerHTML=wrap[1]+html+wrap[2];for(var i=wrap[0];i--;)first=first.firstChild;this.empty().adopt(first.childNodes);}else{this.innerHTML=html;}}};html.erase=html.set;return html;})();if(Browser.Engine.webkit&&Browser.Engine.version<420)Element.Properties.text={get:function(){if(this.innerText)return this.innerText;var temp=this.ownerDocument.newElement('div',{html:this.innerHTML}).inject(this.ownerDocument.body);var text=temp.innerText;temp.destroy();return text;}};Element.Properties.events={set:function(events){this.addEvents(events);}};Native.implement([Element,Window,Document],{addEvent:function(type,fn){var events=this.retrieve('events',{});events[type]=events[type]||{'keys':[],'values':[]};if(events[type].keys.contains(fn))return this;events[type].keys.push(fn);var realType=type,custom=Element.Events.get(type),condition=fn,self=this;if(custom){if(custom.onAdd)custom.onAdd.call(this,fn);if(custom.condition){condition=function(event){if(custom.condition.call(this,event))return fn.call(this,event);return true;};}
realType=custom.base||realType;}
var defn=function(){return fn.call(self);};var nativeEvent=Element.NativeEvents[realType];if(nativeEvent){if(nativeEvent==2){defn=function(event){event=new Event(event,self.getWindow());if(condition.call(self,event)===false)event.stop();};}
this.addListener(realType,defn);}
events[type].values.push(defn);return this;},removeEvent:function(type,fn){var events=this.retrieve('events');if(!events||!events[type])return this;var pos=events[type].keys.indexOf(fn);if(pos==-1)return this;events[type].keys.splice(pos,1);var value=events[type].values.splice(pos,1)[0];var custom=Element.Events.get(type);if(custom){if(custom.onRemove)custom.onRemove.call(this,fn);type=custom.base||type;}
return(Element.NativeEvents[type])?this.removeListener(type,value):this;},addEvents:function(events){for(var event in events)this.addEvent(event,events[event]);return this;},removeEvents:function(events){if($type(events)=='object'){for(var type in events)this.removeEvent(type,events[type]);return this;}
var attached=this.retrieve('events');if(!attached)return this;if(!events){for(var type in attached)this.removeEvents(type);this.eliminate('events');}else if(attached[events]){while(attached[events].keys[0])this.removeEvent(events,attached[events].keys[0]);attached[events]=null;}
return this;},fireEvent:function(type,args,delay){var events=this.retrieve('events');if(!events||!events[type])return this;events[type].keys.each(function(fn){fn.create({'bind':this,'delay':delay,'arguments':args})();},this);return this;},cloneEvents:function(from,type){from=$(from);var fevents=from.retrieve('events');if(!fevents)return this;if(!type){for(var evType in fevents)this.cloneEvents(from,evType);}else if(fevents[type]){fevents[type].keys.each(function(fn){this.addEvent(type,fn);},this);}
return this;}});Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,load:1,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1};(function(){var $check=function(event){var related=event.relatedTarget;if(related==undefined)return true;if(related===false)return false;return($type(this)!='document'&&related!=this&&related.prefix!='xul'&&!this.hasChild(related));};Element.Events=new Hash({mouseenter:{base:'mouseover',condition:$check},mouseleave:{base:'mouseout',condition:$check},mousewheel:{base:(Browser.Engine.gecko)?'DOMMouseScroll':'mousewheel'}});})();Element.Properties.styles={set:function(styles){this.setStyles(styles);}};Element.Properties.opacity={set:function(opacity,novisibility){if(!novisibility){if(opacity==0){if(this.style.visibility!='hidden')this.style.visibility='hidden';}else{if(this.style.visibility!='visible')this.style.visibility='visible';}}
if(!this.currentStyle||!this.currentStyle.hasLayout)this.style.zoom=1;if(Browser.Engine.trident)this.style.filter=(opacity==1)?'':'alpha(opacity='+opacity*100+')';this.style.opacity=opacity;this.store('opacity',opacity);},get:function(){return this.retrieve('opacity',1);}};Element.implement({setOpacity:function(value){return this.set('opacity',value,true);},getOpacity:function(){return this.get('opacity');},setStyle:function(property,value){switch(property){case'opacity':return this.set('opacity',parseFloat(value));case'float':property=(Browser.Engine.trident)?'styleFloat':'cssFloat';}
property=property.camelCase();if($type(value)!='string'){var map=(Element.Styles.get(property)||'@').split(' ');value=$splat(value).map(function(val,i){if(!map[i])return'';return($type(val)=='number')?map[i].replace('@',Math.round(val)):val;}).join(' ');}else if(value==String(Number(value))){value=Math.round(value);}
this.style[property]=value;return this;},getStyle:function(property){switch(property){case'opacity':return this.get('opacity');case'float':property=(Browser.Engine.trident)?'styleFloat':'cssFloat';}
property=property.camelCase();var result=this.style[property];if(!$chk(result)){result=[];for(var style in Element.ShortStyles){if(property!=style)continue;for(var s in Element.ShortStyles[style])result.push(this.getStyle(s));return result.join(' ');}
result=this.getComputedStyle(property);}
if(result){result=String(result);var color=result.match(/rgba?\([\d\s,]+\)/);if(color)result=result.replace(color[0],color[0].rgbToHex());}
if(Browser.Engine.presto||(Browser.Engine.trident&&!$chk(parseInt(result,10)))){if(property.test(/^(height|width)$/)){var values=(property=='width')?['left','right']:['top','bottom'],size=0;values.each(function(value){size+=this.getStyle('border-'+value+'-width').toInt()+this.getStyle('padding-'+value).toInt();},this);return this['offset'+property.capitalize()]-size+'px';}
if((Browser.Engine.presto)&&String(result).test('px'))return result;if(property.test(/(border(.+)Width|margin|padding)/))return'0px';}
return result;},setStyles:function(styles){for(var style in styles)this.setStyle(style,styles[style]);return this;},getStyles:function(){var result={};Array.each(arguments,function(key){result[key]=this.getStyle(key);},this);return result;}});Element.Styles=new Hash({left:'@px',top:'@px',bottom:'@px',right:'@px',width:'@px',height:'@px',maxWidth:'@px',maxHeight:'@px',minWidth:'@px',minHeight:'@px',backgroundColor:'rgb(@, @, @)',backgroundPosition:'@px @px',color:'rgb(@, @, @)',fontSize:'@px',letterSpacing:'@px',lineHeight:'@px',clip:'rect(@px @px @px @px)',margin:'@px @px @px @px',padding:'@px @px @px @px',border:'@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)',borderWidth:'@px @px @px @px',borderStyle:'@ @ @ @',borderColor:'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)',zIndex:'@','zoom':'@',fontWeight:'@',textIndent:'@px',opacity:'@'});Element.ShortStyles={margin:{},padding:{},border:{},borderWidth:{},borderStyle:{},borderColor:{}};['Top','Right','Bottom','Left'].each(function(direction){var Short=Element.ShortStyles;var All=Element.Styles;['margin','padding'].each(function(style){var sd=style+direction;Short[style][sd]=All[sd]='@px';});var bd='border'+direction;Short.border[bd]=All[bd]='@px @ rgb(@, @, @)';var bdw=bd+'Width',bds=bd+'Style',bdc=bd+'Color';Short[bd]={};Short.borderWidth[bdw]=Short[bd][bdw]=All[bdw]='@px';Short.borderStyle[bds]=Short[bd][bds]=All[bds]='@';Short.borderColor[bdc]=Short[bd][bdc]=All[bdc]='rgb(@, @, @)';});(function(){Element.implement({scrollTo:function(x,y){if(isBody(this)){this.getWindow().scrollTo(x,y);}else{this.scrollLeft=x;this.scrollTop=y;}
return this;},getSize:function(){if(isBody(this))return this.getWindow().getSize();return{x:this.offsetWidth,y:this.offsetHeight};},getScrollSize:function(){if(isBody(this))return this.getWindow().getScrollSize();return{x:this.scrollWidth,y:this.scrollHeight};},getScroll:function(){if(isBody(this))return this.getWindow().getScroll();return{x:this.scrollLeft,y:this.scrollTop};},getScrolls:function(){var element=this,position={x:0,y:0};while(element&&!isBody(element)){position.x+=element.scrollLeft;position.y+=element.scrollTop;element=element.parentNode;}
return position;},getOffsetParent:function(){var element=this;if(isBody(element))return null;if(!Browser.Engine.trident)return element.offsetParent;while((element=element.parentNode)&&!isBody(element)){if(styleString(element,'position')!='static')return element;}
return null;},getOffsets:function(){if(Browser.Engine.trident){var bound=this.getBoundingClientRect(),html=this.getDocument().documentElement;var isFixed=styleString(this,'position')=='fixed';return{x:bound.left+((isFixed)?0:html.scrollLeft)-html.clientLeft,y:bound.top+((isFixed)?0:html.scrollTop)-html.clientTop};}
var element=this,position={x:0,y:0};if(isBody(this))return position;while(element&&!isBody(element)){position.x+=element.offsetLeft;position.y+=element.offsetTop;if(Browser.Engine.gecko){if(!borderBox(element)){position.x+=leftBorder(element);position.y+=topBorder(element);}
var parent=element.parentNode;if(parent&&styleString(parent,'overflow')!='visible'){position.x+=leftBorder(parent);position.y+=topBorder(parent);}}else if(element!=this&&Browser.Engine.webkit){position.x+=leftBorder(element);position.y+=topBorder(element);}
element=element.offsetParent;}
if(Browser.Engine.gecko&&!borderBox(this)){position.x-=leftBorder(this);position.y-=topBorder(this);}
return position;},getPosition:function(relative){if(isBody(this))return{x:0,y:0};var offset=this.getOffsets(),scroll=this.getScrolls();var position={x:offset.x-scroll.x,y:offset.y-scroll.y};var relativePosition=(relative&&(relative=$(relative)))?relative.getPosition():{x:0,y:0};return{x:position.x-relativePosition.x,y:position.y-relativePosition.y};},getCoordinates:function(element){if(isBody(this))return this.getWindow().getCoordinates();var position=this.getPosition(element),size=this.getSize();var obj={left:position.x,top:position.y,width:size.x,height:size.y};obj.right=obj.left+obj.width;obj.bottom=obj.top+obj.height;return obj;},computePosition:function(obj){return{left:obj.x-styleNumber(this,'margin-left'),top:obj.y-styleNumber(this,'margin-top')};},position:function(obj){return this.setStyles(this.computePosition(obj));}});Native.implement([Document,Window],{getSize:function(){if(Browser.Engine.presto||Browser.Engine.webkit){var win=this.getWindow();return{x:win.innerWidth,y:win.innerHeight};}
var doc=getCompatElement(this);return{x:doc.clientWidth,y:doc.clientHeight};},getScroll:function(){var win=this.getWindow(),doc=getCompatElement(this);return{x:win.pageXOffset||doc.scrollLeft,y:win.pageYOffset||doc.scrollTop};},getScrollSize:function(){var doc=getCompatElement(this),min=this.getSize();return{x:Math.max(doc.scrollWidth,min.x),y:Math.max(doc.scrollHeight,min.y)};},getPosition:function(){return{x:0,y:0};},getCoordinates:function(){var size=this.getSize();return{top:0,left:0,bottom:size.y,right:size.x,height:size.y,width:size.x};}});var styleString=Element.getComputedStyle;function styleNumber(element,style){return styleString(element,style).toInt()||0;};function borderBox(element){return styleString(element,'-moz-box-sizing')=='border-box';};function topBorder(element){return styleNumber(element,'border-top-width');};function leftBorder(element){return styleNumber(element,'border-left-width');};function isBody(element){return(/^(?:body|html)$/i).test(element.tagName);};function getCompatElement(element){var doc=element.getDocument();return(!doc.compatMode||doc.compatMode=='CSS1Compat')?doc.html:doc.body;};})();Native.implement([Window,Document,Element],{getHeight:function(){return this.getSize().y;},getWidth:function(){return this.getSize().x;},getScrollTop:function(){return this.getScroll().y;},getScrollLeft:function(){return this.getScroll().x;},getScrollHeight:function(){return this.getScrollSize().y;},getScrollWidth:function(){return this.getScrollSize().x;},getTop:function(){return this.getPosition().y;},getLeft:function(){return this.getPosition().x;}});Native.implement([Document,Element],{getElements:function(expression,nocash){expression=expression.split(',');var items,local={};for(var i=0,l=expression.length;i<l;i++){var selector=expression[i],elements=Selectors.Utils.search(this,selector,local);if(i!=0&&elements.item)elements=$A(elements);items=(i==0)?elements:(items.item)?$A(items).concat(elements):items.concat(elements);}
return new Elements(items,{ddup:(expression.length>1),cash:!nocash});}});Element.implement({match:function(selector){if(!selector||(selector==this))return true;var tagid=Selectors.Utils.parseTagAndID(selector);var tag=tagid[0],id=tagid[1];if(!Selectors.Filters.byID(this,id)||!Selectors.Filters.byTag(this,tag))return false;var parsed=Selectors.Utils.parseSelector(selector);return(parsed)?Selectors.Utils.filter(this,parsed,{}):true;}});var Selectors={Cache:{nth:{},parsed:{}}};Selectors.RegExps={id:(/#([\w-]+)/),tag:(/^(\w+|\*)/),quick:(/^(\w+|\*)$/),splitter:(/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g),combined:(/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)(["']?)([^\4]*?)\4)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g)};Selectors.Utils={chk:function(item,uniques){if(!uniques)return true;var uid=$uid(item);if(!uniques[uid])return uniques[uid]=true;return false;},parseNthArgument:function(argument){if(Selectors.Cache.nth[argument])return Selectors.Cache.nth[argument];var parsed=argument.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);if(!parsed)return false;var inta=parseInt(parsed[1],10);var a=(inta||inta===0)?inta:1;var special=parsed[2]||false;var b=parseInt(parsed[3],10)||0;if(a!=0){b--;while(b<1)b+=a;while(b>=a)b-=a;}else{a=b;special='index';}
switch(special){case'n':parsed={a:a,b:b,special:'n'};break;case'odd':parsed={a:2,b:0,special:'n'};break;case'even':parsed={a:2,b:1,special:'n'};break;case'first':parsed={a:0,special:'index'};break;case'last':parsed={special:'last-child'};break;case'only':parsed={special:'only-child'};break;default:parsed={a:(a-1),special:'index'};}
return Selectors.Cache.nth[argument]=parsed;},parseSelector:function(selector){if(Selectors.Cache.parsed[selector])return Selectors.Cache.parsed[selector];var m,parsed={classes:[],pseudos:[],attributes:[]};while((m=Selectors.RegExps.combined.exec(selector))){var cn=m[1],an=m[2],ao=m[3],av=m[5],pn=m[6],pa=m[7];if(cn){parsed.classes.push(cn);}else if(pn){var parser=Selectors.Pseudo.get(pn);if(parser)parsed.pseudos.push({parser:parser,argument:pa});else parsed.attributes.push({name:pn,operator:'=',value:pa});}else if(an){parsed.attributes.push({name:an,operator:ao,value:av});}}
if(!parsed.classes.length)delete parsed.classes;if(!parsed.attributes.length)delete parsed.attributes;if(!parsed.pseudos.length)delete parsed.pseudos;if(!parsed.classes&&!parsed.attributes&&!parsed.pseudos)parsed=null;return Selectors.Cache.parsed[selector]=parsed;},parseTagAndID:function(selector){var tag=selector.match(Selectors.RegExps.tag);var id=selector.match(Selectors.RegExps.id);return[(tag)?tag[1]:'*',(id)?id[1]:false];},filter:function(item,parsed,local){var i;if(parsed.classes){for(i=parsed.classes.length;i--;i){var cn=parsed.classes[i];if(!Selectors.Filters.byClass(item,cn))return false;}}
if(parsed.attributes){for(i=parsed.attributes.length;i--;i){var att=parsed.attributes[i];if(!Selectors.Filters.byAttribute(item,att.name,att.operator,att.value))return false;}}
if(parsed.pseudos){for(i=parsed.pseudos.length;i--;i){var psd=parsed.pseudos[i];if(!Selectors.Filters.byPseudo(item,psd.parser,psd.argument,local))return false;}}
return true;},getByTagAndID:function(ctx,tag,id){if(id){var item=(ctx.getElementById)?ctx.getElementById(id,true):Element.getElementById(ctx,id,true);return(item&&Selectors.Filters.byTag(item,tag))?[item]:[];}else{return ctx.getElementsByTagName(tag);}},search:function(self,expression,local){var splitters=[];var selectors=expression.trim().replace(Selectors.RegExps.splitter,function(m0,m1,m2){splitters.push(m1);return':)'+m2;}).split(':)');var items,filtered,item;for(var i=0,l=selectors.length;i<l;i++){var selector=selectors[i];if(i==0&&Selectors.RegExps.quick.test(selector)){items=self.getElementsByTagName(selector);continue;}
var splitter=splitters[i-1];var tagid=Selectors.Utils.parseTagAndID(selector);var tag=tagid[0],id=tagid[1];if(i==0){items=Selectors.Utils.getByTagAndID(self,tag,id);}else{var uniques={},found=[];for(var j=0,k=items.length;j<k;j++)found=Selectors.Getters[splitter](found,items[j],tag,id,uniques);items=found;}
var parsed=Selectors.Utils.parseSelector(selector);if(parsed){filtered=[];for(var m=0,n=items.length;m<n;m++){item=items[m];if(Selectors.Utils.filter(item,parsed,local))filtered.push(item);}
items=filtered;}}
return items;}};Selectors.Getters={' ':function(found,self,tag,id,uniques){var items=Selectors.Utils.getByTagAndID(self,tag,id);for(var i=0,l=items.length;i<l;i++){var item=items[i];if(Selectors.Utils.chk(item,uniques))found.push(item);}
return found;},'>':function(found,self,tag,id,uniques){var children=Selectors.Utils.getByTagAndID(self,tag,id);for(var i=0,l=children.length;i<l;i++){var child=children[i];if(child.parentNode==self&&Selectors.Utils.chk(child,uniques))found.push(child);}
return found;},'+':function(found,self,tag,id,uniques){while((self=self.nextSibling)){if(self.nodeType==1){if(Selectors.Utils.chk(self,uniques)&&Selectors.Filters.byTag(self,tag)&&Selectors.Filters.byID(self,id))found.push(self);break;}}
return found;},'~':function(found,self,tag,id,uniques){while((self=self.nextSibling)){if(self.nodeType==1){if(!Selectors.Utils.chk(self,uniques))break;if(Selectors.Filters.byTag(self,tag)&&Selectors.Filters.byID(self,id))found.push(self);}}
return found;}};Selectors.Filters={byTag:function(self,tag){return(tag=='*'||(self.tagName&&self.tagName.toLowerCase()==tag));},byID:function(self,id){return(!id||(self.id&&self.id==id));},byClass:function(self,klass){return(self.className&&self.className.contains(klass,' '));},byPseudo:function(self,parser,argument,local){return parser.call(self,argument,local);},byAttribute:function(self,name,operator,value){var result=Element.prototype.getProperty.call(self,name);if(!result)return(operator=='!=');if(!operator||value==undefined)return true;switch(operator){case'=':return(result==value);case'*=':return(result.contains(value));case'^=':return(result.substr(0,value.length)==value);case'$=':return(result.substr(result.length-value.length)==value);case'!=':return(result!=value);case'~=':return result.contains(value,' ');case'|=':return result.contains(value,'-');}
return false;}};Selectors.Pseudo=new Hash({checked:function(){return this.checked;},empty:function(){return!(this.innerText||this.textContent||'').length;},not:function(selector){return!Element.match(this,selector);},contains:function(text){return(this.innerText||this.textContent||'').contains(text);},'first-child':function(){return Selectors.Pseudo.index.call(this,0);},'last-child':function(){var element=this;while((element=element.nextSibling)){if(element.nodeType==1)return false;}
return true;},'only-child':function(){var prev=this;while((prev=prev.previousSibling)){if(prev.nodeType==1)return false;}
var next=this;while((next=next.nextSibling)){if(next.nodeType==1)return false;}
return true;},'nth-child':function(argument,local){argument=(argument==undefined)?'n':argument;var parsed=Selectors.Utils.parseNthArgument(argument);if(parsed.special!='n')return Selectors.Pseudo[parsed.special].call(this,parsed.a,local);var count=0;local.positions=local.positions||{};var uid=$uid(this);if(!local.positions[uid]){var self=this;while((self=self.previousSibling)){if(self.nodeType!=1)continue;count++;var position=local.positions[$uid(self)];if(position!=undefined){count=position+count;break;}}
local.positions[uid]=count;}
return(local.positions[uid]%parsed.a==parsed.b);},index:function(index){var element=this,count=0;while((element=element.previousSibling)){if(element.nodeType==1&&++count>index)return false;}
return(count==index);},even:function(argument,local){return Selectors.Pseudo['nth-child'].call(this,'2n+1',local);},odd:function(argument,local){return Selectors.Pseudo['nth-child'].call(this,'2n',local);},selected:function(){return this.selected;}});Element.Events.domready={onAdd:function(fn){if(Browser.loaded)fn.call(this);}};(function(){var domready=function(){if(Browser.loaded)return;Browser.loaded=true;window.fireEvent('domready');document.fireEvent('domready');};if(Browser.Engine.trident){var temp=document.createElement('div');(function(){($try(function(){temp.doScroll('left');return $(temp).inject(document.body).set('html','temp').dispose();}))?domready():arguments.callee.delay(50);})();}else if(Browser.Engine.webkit&&Browser.Engine.version<525){(function(){(['loaded','complete'].contains(document.readyState))?domready():arguments.callee.delay(50);})();}else{window.addEvent('load',domready);document.addEvent('DOMContentLoaded',domready);}})();var JSON=new Hash({$specialChars:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},$replaceChars:function(chr){return JSON.$specialChars[chr]||'\\u00'+Math.floor(chr.charCodeAt()/16).toString(16)+(chr.charCodeAt()%16).toString(16);},encode:function(obj){switch($type(obj)){case'string':return'"'+obj.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';case'array':return'['+String(obj.map(JSON.encode).filter($defined))+']';case'object':case'hash':var string=[];Hash.each(obj,function(value,key){var json=JSON.encode(value);if(json)string.push(JSON.encode(key)+':'+json);});return'{'+string+'}';case'number':case'boolean':return String(obj);case false:return'null';}
return null;},decode:function(string,secure){if($type(string)!='string'||!string.length)return null;if(secure&&!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'')))return null;return eval('('+string+')');}});Native.implement([Hash,Array,String,Number],{toJSON:function(){return JSON.encode(this);}});var Cookie=new Class({Implements:Options,options:{path:false,domain:false,duration:false,secure:false,document:document},initialize:function(key,options){this.key=key;this.setOptions(options);},write:function(value){value=encodeURIComponent(value);if(this.options.domain)value+='; domain='+this.options.domain;if(this.options.path)value+='; path='+this.options.path;if(this.options.duration){var date=new Date();date.setTime(date.getTime()+this.options.duration*24*60*60*1000);value+='; expires='+date.toGMTString();}
if(this.options.secure)value+='; secure';this.options.document.cookie=this.key+'='+value;return this;},read:function(){var value=this.options.document.cookie.match('(?:^|;)\\s*'+this.key.escapeRegExp()+'=([^;]*)');return(value)?decodeURIComponent(value[1]):null;},dispose:function(){new Cookie(this.key,$merge(this.options,{duration:-1})).write('');return this;}});Cookie.write=function(key,value,options){return new Cookie(key,options).write(value);};Cookie.read=function(key){return new Cookie(key).read();};Cookie.dispose=function(key,options){return new Cookie(key,options).dispose();};var Swiff=new Class({Implements:[Options],options:{id:null,height:1,width:1,container:null,properties:{},params:{quality:'high',allowScriptAccess:'always',wMode:'transparent',swLiveConnect:true},callBacks:{},vars:{}},toElement:function(){return this.object;},initialize:function(path,options){this.instance='Swiff_'+$time();this.setOptions(options);options=this.options;var id=this.id=options.id||this.instance;var container=$(options.container);Swiff.CallBacks[this.instance]={};var params=options.params,vars=options.vars,callBacks=options.callBacks;var properties=$extend({height:options.height,width:options.width},options.properties);var self=this;for(var callBack in callBacks){Swiff.CallBacks[this.instance][callBack]=(function(option){return function(){return option.apply(self.object,arguments);};})(callBacks[callBack]);vars[callBack]='Swiff.CallBacks.'+this.instance+'.'+callBack;}
params.flashVars=Hash.toQueryString(vars);if(Browser.Engine.trident){properties.classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';params.movie=path;}else{properties.type='application/x-shockwave-flash';properties.data=path;}
var build='<object id="'+id+'"';for(var property in properties)build+=' '+property+'="'+properties[property]+'"';build+='>';for(var param in params){if(params[param])build+='<param name="'+param+'" value="'+params[param]+'" />';}
build+='</object>';this.object=((container)?container.empty():new Element('div')).set('html',build).firstChild;},replaces:function(element){element=$(element,true);element.parentNode.replaceChild(this.toElement(),element);return this;},inject:function(element){$(element,true).appendChild(this.toElement());return this;},remote:function(){return Swiff.remote.apply(Swiff,[this.toElement()].extend(arguments));}});Swiff.CallBacks={};Swiff.remote=function(obj,fn){var rs=obj.CallFunction('<invoke name="'+fn+'" returntype="javascript">'+__flash__argumentsToXML(arguments,2)+'</invoke>');return eval(rs);};var Fx=new Class({Implements:[Chain,Events,Options],options:{fps:50,unit:false,duration:500,link:'ignore'},initialize:function(options){this.subject=this.subject||this;this.setOptions(options);this.options.duration=Fx.Durations[this.options.duration]||this.options.duration.toInt();var wait=this.options.wait;if(wait===false)this.options.link='cancel';},getTransition:function(){return function(p){return-(Math.cos(Math.PI*p)-1)/2;};},step:function(){var time=$time();if(time<this.time+this.options.duration){var delta=this.transition((time-this.time)/this.options.duration);this.set(this.compute(this.from,this.to,delta));}else{this.set(this.compute(this.from,this.to,1));this.complete();}},set:function(now){return now;},compute:function(from,to,delta){return Fx.compute(from,to,delta);},check:function(){if(!this.timer)return true;switch(this.options.link){case'cancel':this.cancel();return true;case'chain':this.chain(this.caller.bind(this,arguments));return false;}
return false;},start:function(from,to){if(!this.check(from,to))return this;this.from=from;this.to=to;this.time=0;this.transition=this.getTransition();this.startTimer();this.onStart();return this;},complete:function(){if(this.stopTimer())this.onComplete();return this;},cancel:function(){if(this.stopTimer())this.onCancel();return this;},onStart:function(){this.fireEvent('start',this.subject);},onComplete:function(){this.fireEvent('complete',this.subject);if(!this.callChain())this.fireEvent('chainComplete',this.subject);},onCancel:function(){this.fireEvent('cancel',this.subject).clearChain();},pause:function(){this.stopTimer();return this;},resume:function(){this.startTimer();return this;},stopTimer:function(){if(!this.timer)return false;this.time=$time()-this.time;this.timer=$clear(this.timer);return true;},startTimer:function(){if(this.timer)return false;this.time=$time()-this.time;this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);return true;}});Fx.compute=function(from,to,delta){return(to-from)*delta+from;};Fx.Durations={'short':250,'normal':500,'long':1000};Fx.CSS=new Class({Extends:Fx,prepare:function(element,property,values){values=$splat(values);var values1=values[1];if(!$chk(values1)){values[1]=values[0];values[0]=element.getStyle(property);}
var parsed=values.map(this.parse);return{from:parsed[0],to:parsed[1]};},parse:function(value){value=$lambda(value)();value=(typeof value=='string')?value.split(' '):$splat(value);return value.map(function(val){val=String(val);var found=false;Fx.CSS.Parsers.each(function(parser,key){if(found)return;var parsed=parser.parse(val);if($chk(parsed))found={value:parsed,parser:parser};});found=found||{value:val,parser:Fx.CSS.Parsers.String};return found;});},compute:function(from,to,delta){var computed=[];(Math.min(from.length,to.length)).times(function(i){computed.push({value:from[i].parser.compute(from[i].value,to[i].value,delta),parser:from[i].parser});});computed.$family={name:'fx:css:value'};return computed;},serve:function(value,unit){if($type(value)!='fx:css:value')value=this.parse(value);var returned=[];value.each(function(bit){returned=returned.concat(bit.parser.serve(bit.value,unit));});return returned;},render:function(element,property,value,unit){element.setStyle(property,this.serve(value,unit));},search:function(selector){if(Fx.CSS.Cache[selector])return Fx.CSS.Cache[selector];var to={};Array.each(document.styleSheets,function(sheet,j){var href=sheet.href;if(href&&href.contains('://')&&!href.contains(document.domain))return;var rules=sheet.rules||sheet.cssRules;Array.each(rules,function(rule,i){if(!rule.style)return;var selectorText=(rule.selectorText)?rule.selectorText.replace(/^\w+/,function(m){return m.toLowerCase();}):null;if(!selectorText||!selectorText.test('^'+selector+'$'))return;Element.Styles.each(function(value,style){if(!rule.style[style]||Element.ShortStyles[style])return;value=String(rule.style[style]);to[style]=(value.test(/^rgb/))?value.rgbToHex():value;});});});return Fx.CSS.Cache[selector]=to;}});Fx.CSS.Cache={};Fx.CSS.Parsers=new Hash({Color:{parse:function(value){if(value.match(/^#[0-9a-f]{3,6}$/i))return value.hexToRgb(true);return((value=value.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[value[1],value[2],value[3]]:false;},compute:function(from,to,delta){return from.map(function(value,i){return Math.round(Fx.compute(from[i],to[i],delta));});},serve:function(value){return value.map(Number);}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(value,unit){return(unit)?value+unit:value;}},String:{parse:$lambda(false),compute:$arguments(1),serve:$arguments(0)}});Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(element,options){this.element=this.subject=$(element);this.parent(options);},set:function(property,now){if(arguments.length==1){now=property;property=this.property||this.options.property;}
this.render(this.element,property,now,this.options.unit);return this;},start:function(property,from,to){if(!this.check(property,from,to))return this;var args=Array.flatten(arguments);this.property=this.options.property||args.shift();var parsed=this.prepare(this.element,this.property,args);return this.parent(parsed.from,parsed.to);}});Element.Properties.tween={set:function(options){var tween=this.retrieve('tween');if(tween)tween.cancel();return this.eliminate('tween').store('tween:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('tween')){if(options||!this.retrieve('tween:options'))this.set('tween',options);this.store('tween',new Fx.Tween(this,this.retrieve('tween:options')));}
return this.retrieve('tween');}};Element.implement({tween:function(property,from,to){this.get('tween').start(arguments);return this;},fade:function(how){var fade=this.get('tween'),o='opacity',toggle;how=$pick(how,'toggle');switch(how){case'in':fade.start(o,1);break;case'out':fade.start(o,0);break;case'show':fade.set(o,1);break;case'hide':fade.set(o,0);break;case'toggle':var flag=this.retrieve('fade:flag',this.get('opacity')==1);fade.start(o,(flag)?0:1);this.store('fade:flag',!flag);toggle=true;break;default:fade.start(o,arguments);}
if(!toggle)this.eliminate('fade:flag');return this;},highlight:function(start,end){if(!end){end=this.retrieve('highlight:original',this.getStyle('background-color'));end=(end=='transparent')?'#fff':end;}
var tween=this.get('tween');tween.start('background-color',start||'#ffff88',end).chain(function(){this.setStyle('background-color',this.retrieve('highlight:original'));tween.callChain();}.bind(this));return this;}});Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(element,options){this.element=this.subject=$(element);this.parent(options);},set:function(now){if(typeof now=='string')now=this.search(now);for(var p in now)this.render(this.element,p,now[p],this.options.unit);return this;},compute:function(from,to,delta){var now={};for(var p in from)now[p]=this.parent(from[p],to[p],delta);return now;},start:function(properties){if(!this.check(properties))return this;if(typeof properties=='string')properties=this.search(properties);var from={},to={};for(var p in properties){var parsed=this.prepare(this.element,p,properties[p]);from[p]=parsed.from;to[p]=parsed.to;}
return this.parent(from,to);}});Element.Properties.morph={set:function(options){var morph=this.retrieve('morph');if(morph)morph.cancel();return this.eliminate('morph').store('morph:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('morph')){if(options||!this.retrieve('morph:options'))this.set('morph',options);this.store('morph',new Fx.Morph(this,this.retrieve('morph:options')));}
return this.retrieve('morph');}};Element.implement({morph:function(props){this.get('morph').start(props);return this;}});Fx.implement({getTransition:function(){var trans=this.options.transition||Fx.Transitions.Sine.easeInOut;if(typeof trans=='string'){var data=trans.split(':');trans=Fx.Transitions;trans=trans[data[0]]||trans[data[0].capitalize()];if(data[1])trans=trans['ease'+data[1].capitalize()+(data[2]?data[2].capitalize():'')];}
return trans;}});Fx.Transition=function(transition,params){params=$splat(params);return $extend(transition,{easeIn:function(pos){return transition(pos,params);},easeOut:function(pos){return 1-transition(1-pos,params);},easeInOut:function(pos){return(pos<=0.5)?transition(2*pos,params)/2:(2-transition(2*(1-pos),params))/2;}});};Fx.Transitions=new Hash({linear:$arguments(0)});Fx.Transitions.extend=function(transitions){for(var transition in transitions)Fx.Transitions[transition]=new Fx.Transition(transitions[transition]);};Fx.Transitions.extend({Pow:function(p,x){return Math.pow(p,x[0]||6);},Expo:function(p){return Math.pow(2,8*(p-1));},Circ:function(p){return 1-Math.sin(Math.acos(p));},Sine:function(p){return 1-Math.sin((1-p)*Math.PI/2);},Back:function(p,x){x=x[0]||1.618;return Math.pow(p,2)*((x+1)*p-x);},Bounce:function(p){var value;for(var a=0,b=1;1;a+=b,b/=2){if(p>=(7-4*a)/11){value=b*b-Math.pow((11-6*a-11*p)/4,2);break;}}
return value;},Elastic:function(p,x){return Math.pow(2,10*--p)*Math.cos(20*p*Math.PI*(x[0]||1)/3);}});['Quad','Cubic','Quart','Quint'].each(function(transition,i){Fx.Transitions[transition]=new Fx.Transition(function(p){return Math.pow(p,[i+2]);});});var Request=new Class({Implements:[Chain,Events,Options],options:{url:'',data:'',headers:{'X-Requested-With':'XMLHttpRequest','Accept':'text/javascript, text/html, application/xml, text/xml, */*'},async:true,format:false,method:'post',link:'ignore',isSuccess:null,emulation:true,urlEncoded:true,encoding:'utf-8',evalScripts:false,evalResponse:false,noCache:false},initialize:function(options){this.xhr=new Browser.Request();this.setOptions(options);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers=new Hash(this.options.headers);},onStateChange:function(){if(this.xhr.readyState!=4||!this.running)return;this.running=false;this.status=0;$try(function(){this.status=this.xhr.status;}.bind(this));if(this.options.isSuccess.call(this,this.status)){this.response={text:this.xhr.responseText,xml:this.xhr.responseXML};this.success(this.response.text,this.response.xml);}else{this.response={text:null,xml:null};this.failure();}
this.xhr.onreadystatechange=$empty;},isSuccess:function(){return((this.status>=200)&&(this.status<300));},processScripts:function(text){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader('Content-type')))return $exec(text);return text.stripScripts(this.options.evalScripts);},success:function(text,xml){this.onSuccess(this.processScripts(text),xml);},onSuccess:function(){this.fireEvent('complete',arguments).fireEvent('success',arguments).callChain();},failure:function(){this.onFailure();},onFailure:function(){this.fireEvent('complete').fireEvent('failure',this.xhr);},setHeader:function(name,value){this.headers.set(name,value);return this;},getHeader:function(name){return $try(function(){return this.xhr.getResponseHeader(name);}.bind(this));},check:function(){if(!this.running)return true;switch(this.options.link){case'cancel':this.cancel();return true;case'chain':this.chain(this.caller.bind(this,arguments));return false;}
return false;},send:function(options){if(!this.check(options))return this;this.running=true;var type=$type(options);if(type=='string'||type=='element')options={data:options};var old=this.options;options=$extend({data:old.data,url:old.url,method:old.method},options);var data=options.data,url=options.url,method=options.method;switch($type(data)){case'element':data=$(data).toQueryString();break;case'object':case'hash':data=Hash.toQueryString(data);}
if(this.options.format){var format='format='+this.options.format;data=(data)?format+'&'+data:format;}
if(this.options.emulation&&['put','delete'].contains(method)){var _method='_method='+method;data=(data)?_method+'&'+data:_method;method='post';}
if(this.options.urlEncoded&&method=='post'){var encoding=(this.options.encoding)?'; charset='+this.options.encoding:'';this.headers.set('Content-type','application/x-www-form-urlencoded'+encoding);}
if(this.options.noCache){var noCache="noCache="+new Date().getTime();data=(data)?noCache+'&'+data:noCache;}
if(data&&method=='get'){url=url+(url.contains('?')?'&':'?')+data;data=null;}
this.xhr.open(method.toUpperCase(),url,this.options.async);this.xhr.onreadystatechange=this.onStateChange.bind(this);this.headers.each(function(value,key){try{this.xhr.setRequestHeader(key,value);}catch(e){this.fireEvent('exception',[key,value]);}},this);this.fireEvent('request');this.xhr.send(data);if(!this.options.async)this.onStateChange();return this;},cancel:function(){if(!this.running)return this;this.running=false;this.xhr.abort();this.xhr.onreadystatechange=$empty;this.xhr=new Browser.Request();this.fireEvent('cancel');return this;}});(function(){var methods={};['get','post','put','delete','GET','POST','PUT','DELETE'].each(function(method){methods[method]=function(){var params=Array.link(arguments,{url:String.type,data:$defined});return this.send($extend(params,{method:method.toLowerCase()}));};});Request.implement(methods);})();Request.HTML=new Class({Extends:Request,options:{update:false,append:false,evalScripts:true,filter:false},processHTML:function(text){var match=text.match(/<body[^>]*>([\s\S]*?)<\/body>/i);text=(match)?match[1]:text;var container=new Element('div');return $try(function(){var root='<root>'+text+'</root>',doc;if(Browser.Engine.trident){doc=new ActiveXObject('Microsoft.XMLDOM');doc.async=false;doc.loadXML(root);}else{doc=new DOMParser().parseFromString(root,'text/xml');}
root=doc.getElementsByTagName('root')[0];if(!root)return;for(var i=0,k=root.childNodes.length;i<k;i++){var child=Element.clone(root.childNodes[i],true,true);if(child)container.grab(child);}
return container;})||container.set('html',text);},success:function(text){var options=this.options,response=this.response;response.html=text.stripScripts(function(script){response.javascript=script;});var temp=this.processHTML(response.html);response.tree=temp.childNodes;response.elements=temp.getElements('*');if(options.filter)response.tree=response.elements.filter(options.filter);if(options.update)$(options.update).empty().set('html',response.html);else if(options.append)$(options.append).adopt(temp.getChildren());if(options.evalScripts)$exec(response.javascript);this.onSuccess(response.tree,response.elements,response.html,response.javascript);}});Element.Properties.send={set:function(options){var send=this.retrieve('send');if(send)send.cancel();return this.eliminate('send').store('send:options',$extend({data:this,link:'cancel',method:this.get('method')||'post',url:this.get('action')},options));},get:function(options){if(options||!this.retrieve('send')){if(options||!this.retrieve('send:options'))this.set('send',options);this.store('send',new Request(this.retrieve('send:options')));}
return this.retrieve('send');}};Element.Properties.load={set:function(options){var load=this.retrieve('load');if(load)load.cancel();return this.eliminate('load').store('load:options',$extend({data:this,link:'cancel',update:this,method:'get'},options));},get:function(options){if(options||!this.retrieve('load')){if(options||!this.retrieve('load:options'))this.set('load',options);this.store('load',new Request.HTML(this.retrieve('load:options')));}
return this.retrieve('load');}};Element.implement({send:function(url){var sender=this.get('send');sender.send({data:this,url:url||sender.options.url});return this;},load:function(){this.get('load').send(Array.link(arguments,{data:Object.type,url:String.type}));return this;}});Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(options){this.parent(options);this.headers.extend({'Accept':'application/json','X-Request':'JSON'});},success:function(text){this.response.json=JSON.decode(text,this.options.secure);this.onSuccess(this.response.json,text);}});MooTools.More={'version':'1.2.2.1'};(function(){var data={language:'en-US',languages:{'en-US':{}},cascades:['en-US']};var cascaded;MooTools.lang=new Events();$extend(MooTools.lang,{setLanguage:function(lang){if(!data.languages[lang])return this;data.language=lang;this.load();this.fireEvent('langChange',lang);return this;},load:function(){var langs=this.cascade(this.getCurrentLanguage());cascaded={};$each(langs,function(set,setName){cascaded[setName]=this.lambda(set);},this);},getCurrentLanguage:function(){return data.language;},addLanguage:function(lang){data.languages[lang]=data.languages[lang]||{};return this;},cascade:function(lang){var cascades=(data.languages[lang]||{}).cascades||[];cascades.combine(data.cascades);cascades.erase(lang).push(lang);var langs=cascades.map(function(lng){return data.languages[lng];},this);return $merge.apply(this,langs);},lambda:function(set){(set||{}).get=function(key,args){return $lambda(set[key]).apply(this,$splat(args));};return set;},get:function(set,key,args){if(cascaded&&cascaded[set])return(key?cascaded[set].get(key,args):cascaded[set]);},set:function(lang,set,members){this.addLanguage(lang);langData=data.languages[lang];if(!langData[set])langData[set]={};$extend(langData[set],members);if(lang==this.getCurrentLanguage()){this.load();this.fireEvent('langChange',lang);}
return this;},list:function(){return Hash.getKeys(data.languages);}});})();var Log=new Class({log:function(){Log.logger.call(this,arguments);}});Log.logged=[];Log.logger=function(){if(window.console&&console.log)console.log.apply(console,arguments);else Log.logged.push(arguments);};Class.refactor=function(original,refactors){$each(refactors,function(item,name){var origin=original.prototype[name];if(origin&&(origin=origin._origin)&&typeof item=='function')original.implement(name,function(){var old=this.previous;this.previous=origin;var value=item.apply(this,arguments);this.previous=old;return value;});else original.implement(name,item);});return original;};Class.Mutators.Binds=function(binds){return binds;};Class.Mutators.initialize=function(initialize){return function(){$splat(this.Binds).each(function(name){var original=this[name];if(original)this[name]=original.bind(this);},this);return initialize.apply(this,arguments);};};Class.Occlude=new Class({occlude:function(property,element){element=$(element||this.element);var instance=element.retrieve(property||this.property);if(instance&&!$defined(this.occluded)){this.occluded=instance;}else{this.occluded=false;element.store(property||this.property,this);}
return this.occluded;}});(function(){var wait={wait:function(duration){return this.chain(function(){this.callChain.delay($pick(duration,500),this);}.bind(this));}};Chain.implement(wait);if(window.Fx){Fx.implement(wait);['Css','Tween','Elements'].each(function(cls){if(Fx[cls])Fx[cls].implement(wait);});}
try{Element.implement({chains:function(effects){$splat($pick(effects,['tween','morph','reveal'])).each(function(effect){effect=this.get(effect);if(!effect)return;effect.setOptions({link:'chain'});},this);return this;},pauseFx:function(duration,effect){this.chains(effect).get($pick(effect,'tween')).wait(duration);return this;}});}catch(e){}})();Array.implement({min:function(){return Math.min.apply(null,this);},max:function(){return Math.max.apply(null,this);},average:function(){return this.length?this.sum()/this.length:0;},sum:function(){var result=0,l=this.length;if(l){do{result+=this[--l];}while(l);}
return result;},unique:function(){return[].combine(this);}});(function(){new Native({name:'Date',initialize:Date,protect:true});['now','parse','UTC'].each(function(method){Native.genericize(Date,method,true);});Date.Methods={};['Date','Day','FullYear','Hours','Milliseconds','Minutes','Month','Seconds','Time','TimezoneOffset','Week','Timezone','GMTOffset','DayOfYear','LastMonth','UTCDate','UTCDay','UTCFullYear','AMPM','UTCHours','UTCMilliseconds','UTCMinutes','UTCMonth','UTCSeconds'].each(function(method){Date.Methods[method.toLowerCase()]=method;});$each({ms:'Milliseconds',year:'FullYear',min:'Minutes',mo:'Month',sec:'Seconds',hr:'Hours'},function(value,key){Date.Methods[key]=value;});var zeroize=function(what,length){return'0'.repeat(length-what.toString().length)+what;};Date.implement({set:function(prop,value){switch($type(prop)){case'object':for(var p in prop)this.set(p,prop[p]);break;case'string':prop=prop.toLowerCase();var m=Date.Methods;if(m[prop])this['set'+m[prop]](value);}
return this;},get:function(key){key=key.toLowerCase();var m=Date.Methods;if(m[key])return this['get'+m[key]]();return null;},clone:function(){return new Date(this.get('time'));},increment:function(interval,times){return this.multiply(interval,times);},decrement:function(interval,times){return this.multiply(interval,times,false);},multiply:function(interval,times,increment){interval=interval||'day';times=$pick(times,1);increment=$pick(increment,true);var multiplier=increment?1:-1;var month=this.format('%m').toInt()-1;var year=this.format('%Y').toInt();var time=this.get('time');var offset=0;switch(interval){case'year':times.times(function(val){if(Date.isLeapYear(year+val)&&month>1&&multiplier>0)val++;if(Date.isLeapYear(year+val)&&month<=1&&multiplier<0)val--;offset+=Date.units.year(year+val);});break;case'month':times.times(function(val){if(multiplier<0)val++;var mo=month+(val*multiplier);var year=year;if(mo<0){year--;mo=12+mo;}
if(mo>11||mo<0){year+=(mo/12).toInt()*multiplier;mo=mo%12;}
offset+=Date.units.month(mo,year);});break;case'day':return this.set('date',this.get('date')+(multiplier*times));default:offset=Date.units[interval]()*times;break;}
this.set('time',time+(offset*multiplier));return this;},isLeapYear:function(){return Date.isLeapYear(this.get('year'));},clearTime:function(){['hr','min','sec','ms'].each(function(t){this.set(t,0);},this);return this;},diff:function(d,resolution){resolution=resolution||'day';if($type(d)=='string')d=Date.parse(d);switch(resolution){case'year':return d.format('%Y').toInt()-this.format('%Y').toInt();break;case'month':var months=(d.format('%Y').toInt()-this.format('%Y').toInt())*12;return months+d.format('%m').toInt()-this.format('%m').toInt();break;default:var diff=d.get('time')-this.get('time');if(diff<0&&Date.units[resolution]()>(-1*(diff)))return 0;else if(diff>=0&&diff<Date.units[resolution]())return 0;return((d.get('time')-this.get('time'))/Date.units[resolution]()).round();}
return null;},getWeek:function(){var day=(new Date(this.get('year'),0,1)).get('date');return Math.round((this.get('dayofyear')+(day>3?day-4:day+3))/7);},getTimezone:function(){return this.toString().replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/,'$1').replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,'$1$2$3');},getGMTOffset:function(){var off=this.get('timezoneOffset');return((off>0)?'-':' + ')
+zeroize(Math.floor(Math.abs(off)/60),2)
+zeroize(off%60,2);},parse:function(str){this.set('time',Date.parse(str));return this;},isValid:function(date){return!!(date||this).valueOf();},format:function(f){if(!this.isValid())return'invalid date';f=f||'%x %X';f=({db:'%Y-%m-%d %H:%M:%S',compact:'%Y%m%dT%H%M%S',iso8601:'%Y-%m-%dT%H:%M:%S%T',rfc822:'%a, %d %b %Y %H:%M:%S %Z','short':'%d %b %H:%M','long':'%B %d, %Y %H:%M'})[f.toLowerCase()]||f;var d=this;return f.replace(/\%([aAbBcdHIjmMpSUWwxXyYTZ\%])/g,function($1,$2){switch($2){case'a':return Date.getMsg('days')[d.get('day')].substr(0,3);case'A':return Date.getMsg('days')[d.get('day')];case'b':return Date.getMsg('months')[d.get('month')].substr(0,3);case'B':return Date.getMsg('months')[d.get('month')];case'c':return d.toString();case'd':return zeroize(d.get('date'),2);case'H':return zeroize(d.get('hr'),2);case'I':return((d.get('hr')%12)||12);case'j':return zeroize(d.get('dayofyear'),3);case'm':return zeroize((d.get('mo')+1),2);case'M':return zeroize(d.get('min'),2);case'p':return Date.getMsg(d.get('hr')<12?'AM':'PM');case'S':return zeroize(d.get('seconds'),2);case'U':return zeroize(d.get('week'),2);case'W':throw new Error('%W is not supported yet');case'w':return d.get('day');case'x':return d.format(Date.getMsg('shortDate'));case'X':return d.format(Date.getMsg('shortTime'));case'y':return d.get('year').toString().substr(2);case'Y':return d.get('year');case'T':return d.get('GMTOffset');case'Z':return d.get('Timezone');case'%':return'%';}
return $2;});},setAMPM:function(ampm){ampm=ampm.toUpperCase();if(this.format('%H').toInt()>11&&ampm=='AM')
return this.decrement('hour',12);else if(this.format('%H').toInt()<12&&ampm=='PM')
return this.increment('hour',12);return this;}});Date.alias('diff','compare');Date.alias('format','strftime');var nativeParse=Date.parse;var daysInMonth=function(monthIndex,year){if(Date.isLeapYear(year.toInt())&&monthIndex===1)return 29;return[31,28,31,30,31,30,31,31,30,31,30,31][monthIndex];};$extend(Date,{getMsg:function(key,args){return MooTools.lang.get('Date',key,args);},units:{ms:$lambda(1),second:$lambda(1000),minute:$lambda(60000),hour:$lambda(3600000),day:$lambda(86400000),week:$lambda(608400000),month:function(monthIndex,year){var d=new Date();return daysInMonth($pick(monthIndex,d.format('%m').toInt()),$pick(year,d.format('%Y').toInt()))*86400000;},year:function(year){year=year||new Date().format('%Y').toInt();return Date.isLeapYear(year.toInt())?31622400000:31536000000;}},isLeapYear:function(yr){return new Date(yr,1,29).getDate()==29;},fixY2K:function(d){if(!isNaN(d)){var newDate=new Date(d);if(newDate.get('year')<2000&&d.toString().indexOf(newDate.get('year'))<0)newDate.increment('year',100);return newDate;}else{return d;}},parse:function(from){var t=$type(from);if(t=='number')return new Date(from);if(t!='string')return from;if(!from.length)return null;var parsed;Date.parsePatterns.each(function(pattern,i){if(parsed)return;var r=pattern.re.exec(from);if(r)parsed=pattern.handler(r);});return parsed||new Date(nativeParse(from));},parseDay:function(day,num){var ret=-1;switch($type(day)){case'number':ret=Date.getMsg('days')[day-1]||false;if(!ret)throw new Error('Invalid day index value must be between 1 and 7');break;case'string':var match=Date.getMsg('days').filter(function(name){return this.test(name);},new RegExp('^'+day,'i'));if(!match.length)throw new Error('Invalid day string');if(match.length>1)throw new Error('Ambiguous day');ret=match[0];}
return(num)?Date.getMsg('days').indexOf(ret):ret;},parseMonth:function(month,num){var ret=-1;switch($type(month)){case'object':ret=Date.getMsg('months')[month.get('mo')];break;case'number':ret=Date.getMsg('months')[month-1]||false;if(!ret)throw new Error('Invalid month index value must be between 1 and 12:'+index);break;case'string':var match=Date.getMsg('months').filter(function(name){return this.test(name);},new RegExp('^'+month,'i'));if(!match.length)throw new Error('Invalid month string');if(match.length>1)throw new Error('Ambiguous month');ret=match[0];}
return(num)?Date.getMsg('months').indexOf(ret):ret;},parseUTC:function(value){var localDate=new Date(value);var utcSeconds=Date.UTC(localDate.get('year'),localDate.get('mo'),localDate.get('date'),localDate.get('hr'),localDate.get('min'),localDate.get('sec'));return new Date(utcSeconds);},orderIndex:function(unit){return Date.getMsg('dateOrder').indexOf(unit)+1;},parsePatterns:[{re:/^(\d{4})[\.\-\/](\d{1,2})[\.\-\/](\d{1,2})$/,handler:function(bits){return new Date(bits[1],bits[2]-1,bits[3]);}},{re:/^(\d{4})[\.\-\/](\d{1,2})[\.\-\/](\d{1,2})\s(\d{1,2}):(\d{1,2})(?:\:(\d{1,2}))?(\w{2})?$/,handler:function(bits){var d=new Date(bits[1],bits[2]-1,bits[3]);d.set('hr',bits[4]);d.set('min',bits[5]);d.set('sec',bits[6]||0);if(bits[7])d.set('ampm',bits[7]);return d;}},{re:/^(\d{1,2})[\.\-\/](\d{1,2})[\.\-\/](\d{2,4})$/,handler:function(bits){var d=new Date(bits[Date.orderIndex('year')],bits[Date.orderIndex('month')]-1,bits[Date.orderIndex('date')]);return Date.fixY2K(d);}},{re:/^(\d{1,2})[\.\-\/](\d{1,2})[\.\-\/](\d{2,4})\s(\d{1,2})[:\.](\d{1,2})(?:[\:\.](\d{1,2}))?(\w{2})?$/,handler:function(bits){var d=new Date(bits[Date.orderIndex('year')],bits[Date.orderIndex('month')]-1,bits[Date.orderIndex('date')]);d.set('hr',bits[4]);d.set('min',bits[5]);d.set('sec',bits[6]||0);if(bits[7])d.set('ampm',bits[7]);return Date.fixY2K(d);}}]});})();['LastDayOfMonth','Ordinal'].each(function(method){Date.Methods[method.toLowerCase()]=method;});Date.implement({timeDiffInWords:function(relative_to){return Date.distanceOfTimeInWords(this,relative_to||new Date);},getOrdinal:function(dayOfMonth){return Date.getMsg('ordinal',dayOfMonth||this.get('date'));},getDayOfYear:function(){return((Date.UTC(this.getFullYear(),this.getMonth(),this.getDate()+1,0,0,0)
-Date.UTC(this.getFullYear(),0,1,0,0,0))/Date.units.day());},getLastDayOfMonth:function(){var ret=this.clone();ret.setMonth(ret.getMonth()+1,0);return ret.getDate();}});Date.alias('timeDiffInWords','timeAgoInWords');$extend(Date,{distanceOfTimeInWords:function(fromTime,toTime){return this.getTimePhrase(((toTime.getTime()-fromTime.getTime())/1000).toInt(),fromTime,toTime);},getTimePhrase:function(delta,fromTime,toTime){var getPhrase=function(){var suffix;if(delta>=0){suffix='Ago';}else{delta=delta*-1;suffix='Until';}
if(delta<60){return Date.getMsg('lessThanMinute'+suffix,delta);}else if(delta<120){return Date.getMsg('minute'+suffix,delta);}else if(delta<(45*60)){delta=(delta/60).round();return Date.getMsg('minutes'+suffix,delta);}else if(delta<(90*60)){return Date.getMsg('hour'+suffix,delta);}else if(delta<(24*60*60)){delta=(delta/3600).round();return Date.getMsg('hours'+suffix,delta);}else if(delta<(48*60*60)){return Date.getMsg('day'+suffix,delta);}else{delta=(delta/86400).round();return Date.getMsg('days'+suffix,delta);}};return getPhrase().substitute({delta:delta});}});Date.parsePatterns.extend([{re:/^(\d{4})(?:-?(\d{2})(?:-?(\d{2})(?:[T ](\d{2})(?::?(\d{2})(?::?(\d{2})(?:\.(\d+))?)?)?(?:Z|(?:([-+])(\d{2})(?::?(\d{2}))?)?)?)?)?)?$/,handler:function(bits){var offset=0;var d=new Date(bits[1],0,1);if(bits[3])d.set('date',bits[3]);if(bits[2])d.set('mo',bits[2]-1);if(bits[4])d.set('hr',bits[4]);if(bits[5])d.set('min',bits[5]);if(bits[6])d.set('sec',bits[6]);if(bits[7])d.set('ms',('0.'+bits[7]).toInt()*1000);if(bits[9]){offset=(bits[9].toInt()*60)+bits[10].toInt();offset*=((bits[8]=='-')?1:-1);}
d.setTime((d*1)+(offset*60*1000).toInt());return d;}},{re:/^tod/i,handler:function(){return new Date();}},{re:/^tom/i,handler:function(){return new Date().increment();}},{re:/^yes/i,handler:function(){return new Date().decrement();}},{re:/^(\d{1,2})(st|nd|rd|th)?$/i,handler:function(bits){var d=new Date();d.set('date',bits[1].toInt());return d;}},{re:/^(\d{1,2})(?:st|nd|rd|th)? (\w+)$/i,handler:function(bits){var d=new Date();d.set('mo',Date.parseMonth(bits[2],true),bits[1].toInt());return d;}},{re:/^(\d{1,2})(?:st|nd|rd|th)? (\w+),? (\d{4})$/i,handler:function(bits){var d=new Date();d.set('mo',Date.parseMonth(bits[2],true),bits[1].toInt());d.setYear(bits[3]);return d;}},{re:/^(\w+) (\d{1,2})(?:st|nd|rd|th)?,? (\d{4})$/i,handler:function(bits){var d=new Date();d.set('mo',Date.parseMonth(bits[1],true),bits[2].toInt());d.setYear(bits[3]);return d;}},{re:/^next (\w+)$/i,handler:function(bits){var d=new Date();var day=d.getDay();var newDay=Date.parseDay(bits[1],true);var addDays=newDay-day;if(newDay<=day){addDays+=7;}
d.set('date',d.getDate()+addDays);return d;}},{re:/^\d+\s[a-zA-z]..\s\d.\:\d.$/,handler:function(bits){var d=new Date();bits=bits[0].split(' ');d.set('date',bits[0]);var m;Date.getMsg('months').each(function(mo,i){if(new RegExp('^'+bits[1]).test(mo))m=i;});d.set('mo',m);d.set('hr',bits[2].split(':')[0]);d.set('min',bits[2].split(':')[1]);d.set('ms',0);return d;}},{re:/^last (\w+)$/i,handler:function(bits){return Date.parse('next '+bits[0]).decrement('day',7);}}]);Hash.implement({getFromPath:function(notation){var source=this.getClean();notation.replace(/\[([^\]]+)\]|\.([^.[]+)|[^[.]+/g,function(match){if(!source)return null;var prop=arguments[2]||arguments[1]||arguments[0];source=(prop in source)?source[prop]:null;return match;});return source;},cleanValues:function(method){method=method||$defined;this.each(function(v,k){if(!method(v))this.erase(k);},this);return this;},run:function(){var args=arguments;this.each(function(v,k){if($type(v)=='function')v.run(args);});}});(function(){var special=['À','à','Á','á','Â','â','Ã','ã','Ä','ä','Å','å','Ă','ă','Ą','ą','Ć','ć','Č','č','Ç','ç','Ď','ď','Đ','đ','È','è','É','é','Ê','ê','Ë','ë','Ě','ě','Ę','ę','Ğ','ğ','Ì','ì','Í','í','Î','î','Ï','ï','Ĺ','ĺ','Ľ','ľ','Ł','ł','Ñ','ñ','Ň','ň','Ń','ń','Ò','ò','Ó','ó','Ô','ô','Õ','õ','Ö','ö','Ø','ø','ő','Ř','ř','Ŕ','ŕ','Š','š','Ş','ş','Ś','ś','Ť','ť','Ť','ť','Ţ','ţ','Ù','ù','Ú','ú','Û','û','Ü','ü','Ů','ů','Ÿ','ÿ','ý','Ý','Ž','ž','Ź','ź','Ż','ż','Þ','þ','Ð','ð','ß','Œ','œ','Æ','æ','µ'];var standard=['A','a','A','a','A','a','A','a','Ae','ae','A','a','A','a','A','a','C','c','C','c','C','c','D','d','D','d','E','e','E','e','E','e','E','e','E','e','E','e','G','g','I','i','I','i','I','i','I','i','L','l','L','l','L','l','N','n','N','n','N','n','O','o','O','o','O','o','O','o','Oe','oe','O','o','o','R','r','R','r','S','s','S','s','S','s','T','t','T','t','T','t','U','u','U','u','U','u','Ue','ue','U','u','Y','y','Y','y','Z','z','Z','z','Z','z','TH','th','DH','dh','ss','OE','oe','AE','ae','u'];var tidymap={"[\xa0\u2002\u2003\u2009]":" ","\xb7":"*","[\u2018\u2019]":"'","[\u201c\u201d]":'"',"\u2026":"...","\u2013":"-","\u2014":"--","\uFFFD":"&raquo;"};String.implement({standardize:function(){var text=this;special.each(function(ch,i){text=text.replace(new RegExp(ch,'g'),standard[i]);});return text;},repeat:function(times){return new Array(times+1).join(this);},pad:function(length,str,dir){if(this.length>=length)return this;str=str||' ';var pad=str.repeat(length-this.length).substr(0,length-this.length);if(!dir||dir=='right')return this+pad;if(dir=='left')return pad+this;return pad.substr(0,(pad.length/2).floor())+this+pad.substr(0,(pad.length/2).ceil());},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,'');},tidy:function(){var txt=this.toString();$each(tidymap,function(value,key){txt=txt.replace(new RegExp(key,'g'),value);});return txt;}});})();String.implement({parseQueryString:function(){var vars=this.split(/[&;]/),res={};if(vars.length)vars.each(function(val){var index=val.indexOf('='),keys=index<0?['']:val.substr(0,index).match(/[^\]\[]+/g),value=decodeURIComponent(val.substr(index+1)),obj=res;keys.each(function(key,i){var current=obj[key];if(i<keys.length-1)
obj=obj[key]=current||{};else if($type(current)=='array')
current.push(value);else
obj[key]=$defined(current)?[current,value]:value;});});return res;},cleanQueryString:function(method){return this.split('&').filter(function(val){var index=val.indexOf('='),key=index<0?'':val.substr(0,index),value=val.substr(index+1);return method?method.run([key,value]):$chk(value);}).join('&');}});var URI=new Class({Implements:Options,regex:/^(?:(\w+):)?(?:\/\/(?:(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,parts:['scheme','user','password','host','port','directory','file','query','fragment'],schemes:{http:80,https:443,ftp:21,rtsp:554,mms:1755,file:0},initialize:function(uri,options){this.setOptions(options);var base=this.options.base||URI.base;uri=uri||base;if(uri&&uri.parsed)
this.parsed=$unlink(uri.parsed);else
this.set('value',uri.href||uri.toString(),base?new URI(base):false);},parse:function(value,base){var bits=value.match(this.regex);if(!bits)return false;bits.shift();return this.merge(bits.associate(this.parts),base);},merge:function(bits,base){if(!bits.scheme&&!base.scheme)return false;if(base){this.parts.every(function(part){if(bits[part])return false;bits[part]=base[part]||'';return true;});}
bits.port=bits.port||this.schemes[bits.scheme.toLowerCase()];bits.directory=bits.directory?this.parseDirectory(bits.directory,base?base.directory:''):'/';return bits;},parseDirectory:function(directory,baseDirectory){directory=(directory.substr(0,1)=='/'?'':(baseDirectory||'/'))+directory;if(!directory.test(URI.regs.directoryDot))return directory;var result=[];directory.replace(URI.regs.endSlash,'').split('/').each(function(dir){if(dir=='..'&&result.length>0)result.pop();else if(dir!='.')result.push(dir);});return result.join('/')+'/';},combine:function(bits){return bits.value||bits.scheme+'://'+
(bits.user?bits.user+(bits.password?':'+bits.password:'')+'@':'')+
(bits.host||'')+(bits.port&&bits.port!=this.schemes[bits.scheme]?':'+bits.port:'')+
(bits.directory||'/')+(bits.file||'')+
(bits.query?'?'+bits.query:'')+
(bits.fragment?'#'+bits.fragment:'');},set:function(part,value,base){if(part=='value'){var scheme=value.match(URI.regs.scheme);if(scheme)scheme=scheme[1];if(scheme&&!$defined(this.schemes[scheme.toLowerCase()]))this.parsed={scheme:scheme,value:value};else this.parsed=this.parse(value,(base||this).parsed)||(scheme?{scheme:scheme,value:value}:{value:value});}else{this.parsed[part]=value;}
return this;},get:function(part,base){switch(part){case'value':return this.combine(this.parsed,base?base.parsed:false);case'data':return this.getData();}
return this.parsed[part]||undefined;},go:function(){document.location.href=this.toString();},toURI:function(){return this;},getData:function(key,part){var qs=this.get(part||'query');if(!$chk(qs))return key?null:{};var obj=qs.parseQueryString();return key?obj[key]:obj;},setData:function(values,merge,part){if($type(arguments[0])=='string'){values=this.getData();values[arguments[0]]=arguments[1];}else if(merge){values=$merge(this.getData(),values);}
return this.set(part||'query',Hash.toQueryString(values));},clearData:function(part){return this.set(part||'query','');}});['toString','valueOf'].each(function(method){URI.prototype[method]=function(){return this.get('value');};});URI.regs={endSlash:/\/$/,scheme:/^(\w+):/,directoryDot:/\.\/|\.$/};URI.base=new URI($$('base[href]').getLast(),{base:document.location});String.implement({toURI:function(options){return new URI(this,options);}});URI=Class.refactor(URI,{combine:function(bits,base){if(!base||bits.scheme!=base.scheme||bits.host!=base.host||bits.port!=base.port)
return this.previous.apply(this,arguments);var end=bits.file+(bits.query?'?'+bits.query:'')+(bits.fragment?'#'+bits.fragment:'');if(!base.directory)return(bits.directory||(bits.file?'':'./'))+end;var baseDir=base.directory.split('/'),relDir=bits.directory.split('/'),path='',offset;var i=0;for(offset=0;offset<baseDir.length&&offset<relDir.length&&baseDir[offset]==relDir[offset];offset++);for(i=0;i<baseDir.length-offset-1;i++)path+='../';for(i=offset;i<relDir.length-1;i++)path+=relDir[i]+'/';return(path||(bits.file?'':'./'))+end;},toAbsolute:function(base){base=new URI(base);if(base)base.set('directory','').set('file','');return this.toRelative(base);},toRelative:function(base){return this.get('value',new URI(base));}});Element.implement({tidy:function(){this.set('value',this.get('value').tidy());},getTextInRange:function(start,end){return this.get('value').substring(start,end);},getSelectedText:function(){if(document.selection&&document.selection.createRange)return document.selection.createRange().text;return this.getTextInRange(this.getSelectionStart(),this.getSelectionEnd());},getSelectedRange:function(){if($defined(this.selectionStart))return{start:this.selectionStart,end:this.selectionEnd};var pos={start:0,end:0};var range=this.getDocument().selection.createRange();if(!range||range.parentElement()!=this)return pos;var dup=range.duplicate();if(this.type=='text'){pos.start=0-dup.moveStart('character',-100000);pos.end=pos.start+range.text.length;}else{var value=this.get('value');var offset=value.length-value.match(/[\n\r]*$/)[0].length;dup.moveToElementText(this);dup.setEndPoint('StartToEnd',range);pos.end=offset-dup.text.length;dup.setEndPoint('StartToStart',range);pos.start=offset-dup.text.length;}
return pos;},getSelectionStart:function(){return this.getSelectedRange().start;},getSelectionEnd:function(){return this.getSelectedRange().end;},setCaretPosition:function(pos){if(pos=='end')pos=this.get('value').length;this.selectRange(pos,pos);return this;},getCaretPosition:function(){return this.getSelectedRange().start;},selectRange:function(start,end){if(this.createTextRange){var value=this.get('value');var diff=value.substr(start,end-start).replace(/\r/g,'').length;start=value.substr(0,start).replace(/\r/g,'').length;var range=this.createTextRange();range.collapse(true);range.moveEnd('character',start+diff);range.moveStart('character',start);range.select();}else{this.focus();this.setSelectionRange(start,end);}
return this;},insertAtCursor:function(value,select){var pos=this.getSelectedRange();var text=this.get('value');this.set('value',text.substring(0,pos.start)+value+text.substring(pos.end,text.length));if($pick(select,true))this.selectRange(pos.start,pos.start+value.length);else this.setCaretPosition(pos.start+value.length);return this;},insertAroundCursor:function(options,select){options=$extend({before:'',defaultMiddle:'',after:''},options);var value=this.getSelectedText()||options.defaultMiddle;var pos=this.getSelectedRange();var text=this.get('value');if(pos.start==pos.end){this.set('value',text.substring(0,pos.start)+options.before+value+options.after+text.substring(pos.end,text.length));this.selectRange(pos.start+options.before.length,pos.end+options.before.length+value.length);}else{var current=text.substring(pos.start,pos.end);this.set('value',text.substring(0,pos.start)+options.before+current+options.after+text.substring(pos.end,text.length));var selStart=pos.start+options.before.length;if($pick(select,true))this.selectRange(selStart,selStart+current.length);else this.setCaretPosition(selStart+text.length);}
return this;}});Element.implement({measure:function(fn){var vis=function(el){return!!(!el||el.offsetHeight||el.offsetWidth);};if(vis(this))return fn.apply(this);var parent=this.getParent(),toMeasure=[],restorers=[];while(!vis(parent)&&parent!=document.body){toMeasure.push(parent.expose());parent=parent.getParent();}
var restore=this.expose();var result=fn.apply(this);restore();toMeasure.each(function(restore){restore();});return result;},expose:function(){if(this.getStyle('display')!='none')return $empty;var before=this.getStyles('display','position','visibility');return this.setStyles({display:'block',position:'absolute',visibility:'hidden'}).setStyles.pass(before,this);},getDimensions:function(options){options=$merge({computeSize:false},options);var dim={};var getSize=function(el,options){return(options.computeSize)?el.getComputedSize(options):el.getSize();};if(this.getStyle('display')=='none'){dim=this.measure(function(){return getSize(this,options);});}else{try{dim=getSize(this,options);}catch(e){}}
return $chk(dim.x)?$extend(dim,{width:dim.x,height:dim.y}):$extend(dim,{x:dim.width,y:dim.height});},getComputedSize:function(options){options=$merge({styles:['padding','border'],plains:{height:['top','bottom'],width:['left','right']},mode:'both'},options);var size={width:0,height:0};switch(options.mode){case'vertical':delete size.width;delete options.plains.width;break;case'horizontal':delete size.height;delete options.plains.height;break;}
var getStyles=[];$each(options.plains,function(plain,key){plain.each(function(edge){options.styles.each(function(style){getStyles.push((style=='border')?style+'-'+edge+'-'+'width':style+'-'+edge);});});});var styles={};getStyles.each(function(style){styles[style]=this.getComputedStyle(style);},this);var subtracted=[];$each(options.plains,function(plain,key){var capitalized=key.capitalize();size['total'+capitalized]=0;size['computed'+capitalized]=0;plain.each(function(edge){size['computed'+edge.capitalize()]=0;getStyles.each(function(style,i){if(style.test(edge)){styles[style]=styles[style].toInt()||0;size['total'+capitalized]=size['total'+capitalized]+styles[style];size['computed'+edge.capitalize()]=size['computed'+edge.capitalize()]+styles[style];}
if(style.test(edge)&&key!=style&&(style.test('border')||style.test('padding'))&&!subtracted.contains(style)){subtracted.push(style);size['computed'+capitalized]=size['computed'+capitalized]-styles[style];}});});});['Width','Height'].each(function(value){var lower=value.toLowerCase();if(!$chk(size[lower]))return;size[lower]=size[lower]+this['offset'+value]+size['computed'+value];size['total'+value]=size[lower]+size['total'+value];delete size['computed'+value];},this);return $extend(styles,size);}});(function(){var supportsPositionFixed=false;window.addEvent('domready',function(){var test=new Element('div').setStyles({position:'fixed',top:0,right:0}).inject(document.body);supportsPositionFixed=(test.offsetTop===0);test.dispose();});Element.implement({pin:function(enable){if(this.getStyle('display')=='none')return null;var p;if(enable!==false){p=this.getPosition();if(!this.retrieve('pinned')){var pos={top:p.y-window.getScroll().y,left:p.x-window.getScroll().x};if(supportsPositionFixed){this.setStyle('position','fixed').setStyles(pos);}else{this.store('pinnedByJS',true);this.setStyles({position:'absolute',top:p.y,left:p.x});this.store('scrollFixer',(function(){if(this.retrieve('pinned'))
this.setStyles({top:pos.top.toInt()+window.getScroll().y,left:pos.left.toInt()+window.getScroll().x});}).bind(this));window.addEvent('scroll',this.retrieve('scrollFixer'));}
this.store('pinned',true);}}else{var op;if(!Browser.Engine.trident){if(this.getParent().getComputedStyle('position')!='static')op=this.getParent();else op=this.getParent().getOffsetParent();}
p=this.getPosition(op);this.store('pinned',false);var reposition;if(supportsPositionFixed&&!this.retrieve('pinnedByJS')){reposition={top:p.y+window.getScroll().y,left:p.x+window.getScroll().x};}else{this.store('pinnedByJS',false);window.removeEvent('scroll',this.retrieve('scrollFixer'));reposition={top:p.y,left:p.x};}
this.setStyles($merge(reposition,{position:'absolute'}));}
return this.addClass('isPinned');},unpin:function(){return this.pin(false).removeClass('isPinned');},togglepin:function(){this.pin(!this.retrieve('pinned'));}});})();(function(){var original=Element.prototype.position;Element.implement({position:function(options){if(options&&($defined(options.x)||$defined(options.y)))return original?original.apply(this,arguments):this;$each(options||{},function(v,k){if(!$defined(v))delete options[k];});options=$merge({relativeTo:document.body,position:{x:'center',y:'center'},edge:false,offset:{x:0,y:0},returnPos:false,relFixedPosition:false,ignoreMargins:false,allowNegative:false},options);var parentOffset={x:0,y:0};var parentPositioned=false;var offsetParent=this.measure(function(){return $(this.getOffsetParent());});if(offsetParent&&offsetParent!=this.getDocument().body){parentOffset=offsetParent.measure(function(){return this.getPosition();});parentPositioned=true;options.offset.x=options.offset.x-parentOffset.x;options.offset.y=options.offset.y-parentOffset.y;}
var fixValue=function(option){if($type(option)!='string')return option;option=option.toLowerCase();var val={};if(option.test('left'))val.x='left';else if(option.test('right'))val.x='right';else val.x='center';if(option.test('upper')||option.test('top'))val.y='top';else if(option.test('bottom'))val.y='bottom';else val.y='center';return val;};options.edge=fixValue(options.edge);options.position=fixValue(options.position);if(!options.edge){if(options.position.x=='center'&&options.position.y=='center')options.edge={x:'center',y:'center'};else options.edge={x:'left',y:'top'};}
this.setStyle('position','absolute');var rel=$(options.relativeTo)||document.body;var calc=rel==document.body?window.getScroll():rel.getPosition();var top=calc.y;var left=calc.x;if(Browser.Engine.trident){var scrolls=rel.getScrolls();top+=scrolls.y;left+=scrolls.x;}
var dim=this.getDimensions({computeSize:true,styles:['padding','border','margin']});if(options.ignoreMargins){options.offset.x=options.offset.x-dim['margin-left'];options.offset.y=options.offset.y-dim['margin-top'];}
var pos={};var prefY=options.offset.y;var prefX=options.offset.x;var winSize=window.getSize();switch(options.position.x){case'left':pos.x=left+prefX;break;case'right':pos.x=left+prefX+rel.offsetWidth;break;default:pos.x=left+((rel==document.body?winSize.x:rel.offsetWidth)/2)+prefX;break;}
switch(options.position.y){case'top':pos.y=top+prefY;break;case'bottom':pos.y=top+prefY+rel.offsetHeight;break;default:pos.y=top+((rel==document.body?winSize.y:rel.offsetHeight)/2)+prefY;break;}
if(options.edge){var edgeOffset={};switch(options.edge.x){case'left':edgeOffset.x=0;break;case'right':edgeOffset.x=-dim.x-dim.computedRight-dim.computedLeft;break;default:edgeOffset.x=-(dim.x/2);break;}
switch(options.edge.y){case'top':edgeOffset.y=0;break;case'bottom':edgeOffset.y=-dim.y-dim.computedTop-dim.computedBottom;break;default:edgeOffset.y=-(dim.y/2);break;}
pos.x=pos.x+edgeOffset.x;pos.y=pos.y+edgeOffset.y;}
pos={left:((pos.x>=0||parentPositioned||options.allowNegative)?pos.x:0).toInt(),top:((pos.y>=0||parentPositioned||options.allowNegative)?pos.y:0).toInt()};if(rel.getStyle('position')=='fixed'||options.relFixedPosition){var winScroll=window.getScroll();pos.top=pos.top.toInt()+winScroll.y;pos.left=pos.left.toInt()+winScroll.x;}
if(options.returnPos)return pos;else this.setStyles(pos);return this;}});})();Element.implement({isDisplayed:function(){return this.getStyle('display')!='none';},toggle:function(){return this[this.isDisplayed()?'hide':'show']();},hide:function(){var d;try{if('none'!=this.getStyle('display'))d=this.getStyle('display');}catch(e){}
return this.store('originalDisplay',d||'block').setStyle('display','none');},show:function(display){return this.setStyle('display',display||this.retrieve('originalDisplay')||'block');},swapClass:function(remove,add){return this.removeClass(remove).addClass(add);}});var InputValidator=new Class({Implements:[Options],options:{errorMsg:'Validation failed.',test:function(field){return true;}},initialize:function(className,options){this.setOptions(options);this.className=className;},test:function(field,props){if($(field))return this.options.test($(field),props||this.getProps(field));else return false;},getError:function(field,props){var err=this.options.errorMsg;if($type(err)=='function')err=err($(field),props||this.getProps(field));return err;},getProps:function(field){if(!$(field))return{};return field.get('validatorProps');}});Element.Properties.validatorProps={set:function(props){return this.eliminate('validatorProps').store('validatorProps',props);},get:function(props){if(props)this.set(props);if(this.retrieve('validatorProps'))return this.retrieve('validatorProps');if(this.getProperty('validatorProps')){try{this.store('validatorProps',JSON.decode(this.getProperty('validatorProps')));}catch(e){return{};}}else{var vals=this.get('class').split(' ').filter(function(cls){return cls.test(':');});if(!vals.length){this.store('validatorProps',{});}else{props={};vals.each(function(cls){var split=cls.split(':');if(split[1]){try{props[split[0]]=JSON.decode(split[1]);}catch(e){}}});this.store('validatorProps',props);}}
return this.retrieve('validatorProps');}};var FormValidator=new Class({Implements:[Options,Events],Binds:['onSubmit'],options:{fieldSelectors:'input, select, textarea',ignoreHidden:true,useTitles:false,evaluateOnSubmit:true,evaluateFieldsOnBlur:true,evaluateFieldsOnChange:true,serial:true,stopOnFailure:true,warningPrefix:function(){return FormValidator.getMsg('warningPrefix')||'Warning: ';},errorPrefix:function(){return FormValidator.getMsg('errorPrefix')||'Error: ';}},initialize:function(form,options){this.setOptions(options);this.element=$(form);this.element.store('validator',this);this.warningPrefix=$lambda(this.options.warningPrefix)();this.errorPrefix=$lambda(this.options.errorPrefix)();if(this.options.evaluateOnSubmit)this.element.addEvent('submit',this.onSubmit);if(this.options.evaluateFieldsOnBlur)this.watchFields(this.getFields());},toElement:function(){return this.element;},getFields:function(){return(this.fields=this.element.getElements(this.options.fieldSelectors));},watchFields:function(fields){fields.each(function(el){el.addEvent('blur',this.validateField.pass([el,false],this));if(this.options.evaluateFieldsOnChange)
el.addEvent('change',this.validateField.pass([el,true],this));},this);},onSubmit:function(event){if(!this.validate(event)&&event)event.preventDefault();else this.reset();},reset:function(){this.getFields().each(this.resetField,this);return this;},validate:function(event){var result=this.getFields().map(function(field){return this.validateField(field,true);},this).every(function(v){return v;});this.fireEvent('formValidate',[result,this.element,event]);if(this.options.stopOnFailure&&!result&&event)event.preventDefault();return result;},validateField:function(field,force){if(this.paused)return true;field=$(field);var passed=!field.hasClass('validation-failed');var failed,warned;if(this.options.serial&&!force){failed=this.element.getElement('.validation-failed');warned=this.element.getElement('.warning');}
if(field&&(!failed||force||field.hasClass('validation-failed')||(failed&&!this.options.serial))){var validators=field.className.split(' ').some(function(cn){return this.getValidator(cn);},this);var validatorsFailed=[];field.className.split(' ').each(function(className){if(className&&!this.test(className,field))validatorsFailed.include(className);},this);passed=validatorsFailed.length===0;if(validators&&!field.hasClass('warnOnly')){if(passed){field.addClass('validation-passed').removeClass('validation-failed');this.fireEvent('elementPass',field);}else{field.addClass('validation-failed').removeClass('validation-passed');this.fireEvent('elementFail',[field,validatorsFailed]);}}
if(!warned){var warnings=field.className.split(' ').some(function(cn){if(cn.test('^warn-')||field.hasClass('warnOnly'))
return this.getValidator(cn.replace(/^warn-/,''));else return null;},this);field.removeClass('warning');var warnResult=field.className.split(' ').map(function(cn){if(cn.test('^warn-')||field.hasClass('warnOnly'))
return this.test(cn.replace(/^warn-/,''),field,true);else return null;},this);}}
return passed;},test:function(className,field,warn){var validator=this.getValidator(className);field=$(field);if(field.hasClass('ignoreValidation'))return true;warn=$pick(warn,false);if(field.hasClass('warnOnly'))warn=true;var isValid=validator?validator.test(field):true;if(validator&&this.isVisible(field))this.fireEvent('elementValidate',[isValid,field,className,warn]);if(warn)return true;return isValid;},isVisible:function(field){if(!this.options.ignoreHidden)return true;while(field!=document.body){if($(field).getStyle('display')=='none')return false;field=field.getParent();}
return true;},resetField:function(field){field=$(field);if(field){field.className.split(' ').each(function(className){if(className.test('^warn-'))className=className.replace(/^warn-/,'');field.removeClass('validation-failed');field.removeClass('warning');field.removeClass('validation-passed');},this);}
return this;},stop:function(){this.paused=true;return this;},start:function(){this.paused=false;return this;},ignoreField:function(field,warn){field=$(field);if(field){this.enforceField(field);if(warn)field.addClass('warnOnly');else field.addClass('ignoreValidation');}
return this;},enforceField:function(field){field=$(field);if(field)field.removeClass('warnOnly').removeClass('ignoreValidation');return this;}});FormValidator.getMsg=function(key){return MooTools.lang.get('FormValidator',key);};FormValidator.adders={validators:{},add:function(className,options){this.validators[className]=new InputValidator(className,options);if(!this.initialize){this.implement({validators:this.validators});}},addAllThese:function(validators){$A(validators).each(function(validator){this.add(validator[0],validator[1]);},this);},getValidator:function(className){return this.validators[className.split(':')[0]];}};$extend(FormValidator,FormValidator.adders);FormValidator.implement(FormValidator.adders);FormValidator.add('IsEmpty',{errorMsg:false,test:function(element){if(element.type=='select-one'||element.type=='select')
return!(element.selectedIndex>=0&&element.options[element.selectedIndex].value!='');else
return((element.get('value')==null)||(element.get('value').length==0));}});FormValidator.addAllThese([['required',{errorMsg:function(){return FormValidator.getMsg('required');},test:function(element){return!FormValidator.getValidator('IsEmpty').test(element);}}],['minLength',{errorMsg:function(element,props){if($type(props.minLength))
return FormValidator.getMsg('minLength').substitute({minLength:props.minLength,length:element.get('value').length});else return'';},test:function(element,props){if($type(props.minLength))return(element.get('value').length>=$pick(props.minLength,0));else return true;}}],['maxLength',{errorMsg:function(element,props){if($type(props.maxLength))
return FormValidator.getMsg('maxLength').substitute({maxLength:props.maxLength,length:element.get('value').length});else return'';},test:function(element,props){return(element.get('value').length<=$pick(props.maxLength,10000));}}],['validate-integer',{errorMsg:FormValidator.getMsg.pass('integer'),test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||(/^-?[1-9]\d*$/).test(element.get('value'));}}],['validate-numeric',{errorMsg:FormValidator.getMsg.pass('numeric'),test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||(/^-?(?:0$0(?=\d*\.)|[1-9]|0)\d*(\.\d+)?$/).test(element.get('value'));}}],['validate-digits',{errorMsg:FormValidator.getMsg.pass('digits'),test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||(/^[\d() .:\-\+#]+$/.test(element.get('value')));}}],['validate-alpha',{errorMsg:FormValidator.getMsg.pass('alpha'),test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||(/^[a-zA-Z]+$/).test(element.get('value'));}}],['validate-alphanum',{errorMsg:FormValidator.getMsg.pass('alphanum'),test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||!(/\W/).test(element.get('value'));}}],['validate-date',{errorMsg:function(element,props){if(Date.parse){var format=props.dateFormat||'%x';return FormValidator.getMsg('dateSuchAs').substitute({date:new Date().format(format)});}else{return FormValidator.getMsg('dateInFormatMDY');}},test:function(element,props){if(FormValidator.getValidator('IsEmpty').test(element))return true;var d;if(Date.parse){var format=props.dateFormat||'%x';d=Date.parse(element.get('value'));var formatted=d.format(format);if(formatted!='invalid date')element.set('value',formatted);return!isNaN(d);}else{var regex=/^(\d{2})\/(\d{2})\/(\d{4})$/;if(!regex.test(element.get('value')))return false;d=new Date(element.get('value').replace(regex,'$1/$2/$3'));return(parseInt(RegExp.$1,10)==(1+d.getMonth()))&&(parseInt(RegExp.$2,10)==d.getDate())&&(parseInt(RegExp.$3,10)==d.getFullYear());}}}],['validate-email',{errorMsg:FormValidator.getMsg.pass('email'),test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||(/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i).test(element.get('value'));}}],['validate-url',{errorMsg:FormValidator.getMsg.pass('url'),test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||(/^(https?|ftp|rmtp|mms):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i).test(element.get('value'));}}],['validate-currency-dollar',{errorMsg:FormValidator.getMsg.pass('currencyDollar'),test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||(/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/).test(element.get('value'));}}],['validate-one-required',{errorMsg:FormValidator.getMsg.pass('oneRequired'),test:function(element,props){var p=$(props['validate-one-required'])||element.parentNode;return p.getElements('input').some(function(el){if(['checkbox','radio'].contains(el.get('type')))return el.get('checked');return el.get('value');});}}]]);Element.Properties.validator={set:function(options){var validator=this.retrieve('validator');if(validator)validator.setOptions(options);return this.store('validator:options');},get:function(options){if(options||!this.retrieve('validator')){if(options||!this.retrieve('validator:options'))this.set('validator',options);this.store('validator',new FormValidator(this,this.retrieve('validator:options')));}
return this.retrieve('validator');}};Element.implement({validate:function(options){this.set('validator',options);return this.get('validator',options).validate();}});FormValidator.Inline=new Class({Extends:FormValidator,options:{scrollToErrorsOnSubmit:true,scrollFxOptions:{offset:{y:-20}}},initialize:function(form,options){this.parent(form,options);this.addEvent('onElementValidate',function(isValid,field,className,warn){var validator=this.getValidator(className);if(!isValid&&validator.getError(field)){if(warn)field.addClass('warning');var advice=this.makeAdvice(className,field,validator.getError(field),warn);this.insertAdvice(advice,field);this.showAdvice(className,field);}else{this.hideAdvice(className,field);}});},makeAdvice:function(className,field,error,warn){var errorMsg=(warn)?this.warningPrefix:this.errorPrefix;errorMsg+=(this.options.useTitles)?field.title||error:error;var cssClass=(warn)?'warning-advice':'validation-advice';var advice=this.getAdvice(className,field);if(advice){advice=advice.clone(true).set('html',errorMsg).replaces(advice);}else{advice=new Element('div',{html:errorMsg,styles:{display:'none'},id:'advice-'+className+'-'+this.getFieldId(field)}).addClass(cssClass);}
field.store('advice-'+className,advice);return advice;},getFieldId:function(field){return field.id?field.id:field.id='input_'+field.name;},showAdvice:function(className,field){var advice=this.getAdvice(className,field);if(advice&&!field.retrieve(this.getPropName(className))&&(advice.getStyle('display')=='none'||advice.getStyle('visiblity')=='hidden'||advice.getStyle('opacity')==0)){field.store(this.getPropName(className),true);if(advice.reveal)advice.reveal();else advice.setStyle('display','block');}},hideAdvice:function(className,field){var advice=this.getAdvice(className,field);if(advice&&field.retrieve(this.getPropName(className))){field.store(this.getPropName(className),false);if(advice.dissolve)advice.dissolve();else advice.setStyle('display','none');}},getPropName:function(className){return'advice'+className;},resetField:function(field){field=$(field);if(!field)return this;this.parent(field);field.className.split(' ').each(function(className){this.hideAdvice(className,field);},this);return this;},getAllAdviceMessages:function(field,force){var advice=[];if(field.hasClass('ignoreValidation')&&!force)return advice;var validators=field.className.split(' ').some(function(cn){var warner=cn.test('^warn-')||field.hasClass('warnOnly');if(warner)cn=cn.replace(/^warn-/,'');var validator=this.getValidator(cn);if(!validator)return;advice.push({message:validator.getError(field),warnOnly:warner,passed:validator.test(),validator:validator});},this);return advice;},getAdvice:function(className,field){return field.retrieve('advice-'+className);},insertAdvice:function(advice,field){var props=field.get('validatorProps');if(!props.msgPos||!$(props.msgPos)){if(field.type.toLowerCase()=='radio')field.getParent().adopt(advice);else advice.inject($(field),'after');}else{$(props.msgPos).grab(advice);}},validate:function(field,force){var result=this.parent(field,force);if(this.options.scrollToErrorsOnSubmit&&!result){var failed=$(this).getElement('.validation-failed');var par=$(this).getParent();var isScrolled=function(p){return p.getScrollSize().y!=p.getSize().y;};var scrolls;while(par!=document.body&&!isScrolled(par)){par=par.getParent();}
var fx=par.retrieve('fvScroller');if(!fx&&window.Fx&&Fx.Scroll){fx=new Fx.Scroll(par,{transition:'quad:out',offset:{y:-20}});par.store('fvScroller',fx);}
if(failed){if(fx)fx.toElement(failed);else par.scrollTo(par.getScroll().x,failed.getPosition(par).y-20);}}}});FormValidator.addAllThese([['validate-enforce-oncheck',{test:function(element,props){if(element.checked){var fv=element.getParent('form').retrieve('validator');if(!fv)return true;(props.toEnforce||$(props.enforceChildrenOf).getElements('input, select, textarea')).map(function(item){fv.enforceField(item);});}
return true;}}],['validate-ignore-oncheck',{test:function(element,props){if(element.checked){var fv=element.getParent('form').retrieve('validator');if(!fv)return true;(props.toIgnore||$(props.ignoreChildrenOf).getElements('input, select, textarea')).each(function(item){fv.ignoreField(item);fv.resetField(item);});}
return true;}}],['validate-nospace',{errorMsg:function(){return FormValidator.getMsg('noSpace');},test:function(element,props){return!element.get('value').test(/\s/);}}],['validate-toggle-oncheck',{test:function(element,props){var fv=element.getParent('form').retrieve('validator');if(!fv)return true;var eleArr=props.toToggle||$(props.toToggleChildrenOf).getElements('input, select, textarea');if(!element.checked){eleArr.each(function(item){fv.ignoreField(item);fv.resetField(item);});}else{eleArr.each(function(item){fv.enforceField(item);});}
return true;}}],['validate-reqchk-bynode',{errorMsg:function(){return FormValidator.getMsg('reqChkByNode');},test:function(element,props){return($(props.nodeId).getElements(props.selector||'input[type=checkbox], input[type=radio]')).some(function(item){return item.checked;});}}],['validate-required-check',{errorMsg:function(element,props){return props.useTitle?element.get('title'):FormValidator.getMsg('requiredChk');},test:function(element,props){return!!element.checked;}}],['validate-reqchk-byname',{errorMsg:function(element,props){return FormValidator.getMsg('reqChkByName').substitute({label:props.label||element.get('type')});},test:function(element,props){var grpName=props.groupName||element.get('name');var oneCheckedItem=$$(document.getElementsByName(grpName)).some(function(item,index){return item.checked;});var fv=element.getParent('form').retrieve('validator');if(oneCheckedItem&&fv)fv.resetField(element);return oneCheckedItem;}}],['validate-match',{errorMsg:function(element,props){return FormValidator.getMsg('match').substitute({matchName:props.matchName||$(props.matchInput).get('name')});},test:function(element,props){var eleVal=element.get('value');var matchVal=$(props.matchInput)&&$(props.matchInput).get('value');return eleVal&&matchVal?eleVal==matchVal:true;}}],['validate-after-date',{errorMsg:function(element,props){return FormValidator.getMsg('afterDate').substitute({label:props.afterLabel||(props.afterElement?FormValidator.getMsg('startDate'):FormValidator.getMsg('currentDate'))});},test:function(element,props){var start=$(props.afterElement)?Date.parse($(props.afterElement).get('value')):new Date();var end=Date.parse(element.get('value'));return end&&start?end>=start:true;}}],['validate-before-date',{errorMsg:function(element,props){return FormValidator.getMsg('beforeDate').substitute({label:props.beforeLabel||(props.beforeElement?FormValidator.getMsg('endDate'):FormValidator.getMsg('currentDate'))});},test:function(element,props){var start=Date.parse(element.get('value'));var end=$(props.beforeElement)?Date.parse($(props.beforeElement).get('value')):new Date();return end&&start?end>=start:true;}}],['validate-custom-required',{errorMsg:function(){return FormValidator.getMsg('required');},test:function(element,props){return element.get('value')!=props.emptyValue;}}],['validate-same-month',{errorMsg:function(element,props){var startMo=$(props.sameMonthAs)&&$(props.sameMonthAs).get('value');var eleVal=element.get('value');if(eleVal!='')return FormValidator.getMsg(startMo?'sameMonth':'startMonth');},test:function(element,props){var d1=Date.parse(element.get('value'));var d2=Date.parse($(props.sameMonthAs)&&$(props.sameMonthAs).get('value'));return d1&&d2?d1.format('%B')==d2.format('%B'):true;}}]]);var OverText=new Class({Implements:[Options,Events,Class.Occlude],Binds:['reposition','assert','focus'],options:{positionOptions:{position:'upperLeft',edge:'upperLeft',offset:{x:4,y:2}},poll:false,pollInterval:250},property:'OverText',initialize:function(element,options){this.element=$(element);if(this.occlude())return this.occluded;this.setOptions(options);this.attach(this.element);OverText.instances.push(this);if(this.options.poll)this.poll();return this;},toElement:function(){return this.element;},attach:function(){var val=this.options.textOverride||this.element.get('alt')||this.element.get('title');if(!val)return;this.text=new Element('div',{'class':'overTxtDiv',styles:{lineHeight:'normal',position:'absolute'},html:val,events:{click:this.hide.pass(true,this)}}).inject(this.element,'after');this.element.addEvents({focus:this.focus,blur:this.assert,change:this.assert}).store('OverTextDiv',this.text);window.addEvent('resize',this.reposition.bind(this));this.assert();this.reposition();},startPolling:function(){this.pollingPaused=false;return this.poll();},poll:function(stop){if(this.poller&&!stop)return this;var test=function(){if(!this.pollingPaused)this.assert();}.bind(this);if(stop)$clear(this.poller);else this.poller=test.periodical(this.options.pollInterval,this);return this;},stopPolling:function(){this.pollingPaused=true;return this.poll(true);},focus:function(){if(!this.text.isDisplayed()||this.element.get('disabled'))return;this.hide();},hide:function(){if(this.text.isDisplayed()&&!this.element.get('disabled')){this.text.hide();this.fireEvent('textHide',[this.text,this.element]);this.pollingPaused=true;try{this.element.fireEvent('focus').focus();}catch(e){}}
return this;},show:function(){if(!this.text.isDisplayed()){this.text.show();this.reposition();this.fireEvent('textShow',[this.text,this.element]);this.pollingPaused=false;}
return this;},assert:function(){this[this.test()?'show':'hide']();},test:function(){var v=this.element.get('value');return!v;},reposition:function(){try{this.assert();if(!this.element.getParent()||!this.element.offsetHeight)return this.hide();if(this.test())this.text.position($merge(this.options.positionOptions,{relativeTo:this.element}));}catch(e){}
return this;}});OverText.instances=[];OverText.update=function(){return OverText.instances.map(function(ot){if(ot.element&&ot.text)return ot.reposition();return null;});};if(window.Fx&&Fx.Reveal){Fx.Reveal.implement({hideInputs:Browser.Engine.trident?'select, input, textarea, object, embed, .overTxtDiv':false});}
Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(elements,options){this.elements=this.subject=$$(elements);this.parent(options);},compute:function(from,to,delta){var now={};for(var i in from){var iFrom=from[i],iTo=to[i],iNow=now[i]={};for(var p in iFrom)iNow[p]=this.parent(iFrom[p],iTo[p],delta);}
return now;},set:function(now){for(var i in now){var iNow=now[i];for(var p in iNow)this.render(this.elements[i],p,iNow[p],this.options.unit);}
return this;},start:function(obj){if(!this.check(obj))return this;var from={},to={};for(var i in obj){var iProps=obj[i],iFrom=from[i]={},iTo=to[i]={};for(var p in iProps){var parsed=this.prepare(this.elements[i],p,iProps[p]);iFrom[p]=parsed.from;iTo[p]=parsed.to;}}
return this.parent(from,to);}});var Accordion=Fx.Accordion=new Class({Extends:Fx.Elements,options:{display:0,show:false,height:true,width:false,opacity:true,fixedHeight:false,fixedWidth:false,wait:false,alwaysHide:false,trigger:'click',initialDisplayFx:true},initialize:function(){var params=Array.link(arguments,{'container':Element.type,'options':Object.type,'togglers':$defined,'elements':$defined});this.parent(params.elements,params.options);this.togglers=$$(params.togglers);this.container=$(params.container);this.previous=-1;if(this.options.alwaysHide)this.options.wait=true;if($chk(this.options.show)){this.options.display=false;this.previous=this.options.show;}
if(this.options.start){this.options.display=false;this.options.show=false;}
this.effects={};if(this.options.opacity)this.effects.opacity='fullOpacity';if(this.options.width)this.effects.width=this.options.fixedWidth?'fullWidth':'offsetWidth';if(this.options.height)this.effects.height=this.options.fixedHeight?'fullHeight':'scrollHeight';for(var i=0,l=this.togglers.length;i<l;i++)this.addSection(this.togglers[i],this.elements[i]);this.elements.each(function(el,i){if(this.options.show===i){this.fireEvent('active',[this.togglers[i],el]);}else{for(var fx in this.effects)el.setStyle(fx,0);}},this);if($chk(this.options.display))this.display(this.options.display,this.options.initialDisplayFx);},addSection:function(toggler,element){toggler=$(toggler);element=$(element);var test=this.togglers.contains(toggler);this.togglers.include(toggler);this.elements.include(element);var idx=this.togglers.indexOf(toggler);toggler.addEvent(this.options.trigger,this.display.bind(this,idx));if(this.options.height)element.setStyles({'padding-top':0,'border-top':'none','padding-bottom':0,'border-bottom':'none'});if(this.options.width)element.setStyles({'padding-left':0,'border-left':'none','padding-right':0,'border-right':'none'});element.fullOpacity=1;if(this.options.fixedWidth)element.fullWidth=this.options.fixedWidth;if(this.options.fixedHeight)element.fullHeight=this.options.fixedHeight;element.setStyle('overflow','hidden');if(!test){for(var fx in this.effects)element.setStyle(fx,0);}
return this;},display:function(index,useFx){useFx=$pick(useFx,true);index=($type(index)=='element')?this.elements.indexOf(index):index;if((this.timer&&this.options.wait)||(index===this.previous&&!this.options.alwaysHide))return this;this.previous=index;var obj={};this.elements.each(function(el,i){obj[i]={};var hide=(i!=index)||(this.options.alwaysHide&&(el.offsetHeight>0));this.fireEvent(hide?'background':'active',[this.togglers[i],el]);for(var fx in this.effects)obj[i][fx]=hide?0:el[this.effects[fx]];},this);return useFx?this.start(obj):this.set(obj);}});Fx.Move=new Class({Extends:Fx.Morph,options:{relativeTo:document.body,position:'center',edge:false,offset:{x:0,y:0}},start:function(destination){return this.parent(this.element.position($merge(this.options,destination,{returnPos:true})));}});Element.Properties.move={set:function(options){var morph=this.retrieve('move');if(morph)morph.cancel();return this.eliminate('move').store('move:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('move')){if(options||!this.retrieve('move:options'))this.set('move',options);this.store('move',new Fx.Move(this,this.retrieve('move:options')));}
return this.retrieve('move');}};Element.implement({move:function(options){this.get('move').start(options);return this;}});Fx.Reveal=new Class({Extends:Fx.Morph,options:{styles:['padding','border','margin'],transitionOpacity:!Browser.Engine.trident4,mode:'vertical',display:'block',hideInputs:Browser.Engine.trident?'select, input, textarea, object, embed':false},dissolve:function(){try{if(!this.hiding&&!this.showing){if(this.element.getStyle('display')!='none'){this.hiding=true;this.showing=false;this.hidden=true;var startStyles=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});var setToAuto=(this.element.style.height===''||this.element.style.height=='auto');this.element.setStyle('display','block');if(this.options.transitionOpacity)startStyles.opacity=1;var zero={};$each(startStyles,function(style,name){zero[name]=[style,0];},this);var overflowBefore=this.element.getStyle('overflow');this.element.setStyle('overflow','hidden');var hideThese=this.options.hideInputs?this.element.getElements(this.options.hideInputs):null;this.$chain.unshift(function(){if(this.hidden){this.hiding=false;$each(startStyles,function(style,name){startStyles[name]=style;},this);this.element.setStyles($merge({display:'none',overflow:overflowBefore},startStyles));if(setToAuto){if(['vertical','both'].contains(this.options.mode))this.element.style.height='';if(['width','both'].contains(this.options.mode))this.element.style.width='';}
if(hideThese)hideThese.setStyle('visibility','visible');}
this.fireEvent('hide',this.element);this.callChain();}.bind(this));if(hideThese)hideThese.setStyle('visibility','hidden');this.start(zero);}else{this.callChain.delay(10,this);this.fireEvent('complete',this.element);this.fireEvent('hide',this.element);}}else if(this.options.link=='chain'){this.chain(this.dissolve.bind(this));}else if(this.options.link=='cancel'&&!this.hiding){this.cancel();this.dissolve();}}catch(e){this.hiding=false;this.element.setStyle('display','none');this.callChain.delay(10,this);this.fireEvent('complete',this.element);this.fireEvent('hide',this.element);}
return this;},reveal:function(){try{if(!this.showing&&!this.hiding){if(this.element.getStyle('display')=='none'||this.element.getStyle('visiblity')=='hidden'||this.element.getStyle('opacity')==0){this.showing=true;this.hiding=false;this.hidden=false;var setToAuto,startStyles;this.element.measure(function(){setToAuto=(this.element.style.height===''||this.element.style.height=='auto');startStyles=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});}.bind(this));$each(startStyles,function(style,name){startStyles[name]=style;});if($chk(this.options.heightOverride))startStyles.height=this.options.heightOverride.toInt();if($chk(this.options.widthOverride))startStyles.width=this.options.widthOverride.toInt();if(this.options.transitionOpacity){this.element.setStyle('opacity',0);startStyles.opacity=1;}
var zero={height:0,display:this.options.display};$each(startStyles,function(style,name){zero[name]=0;});var overflowBefore=this.element.getStyle('overflow');this.element.setStyles($merge(zero,{overflow:'hidden'}));var hideThese=this.options.hideInputs?this.element.getElements(this.options.hideInputs):null;if(hideThese)hideThese.setStyle('visibility','hidden');this.start(startStyles);this.$chain.unshift(function(){this.element.setStyle('overflow',overflowBefore);if(!this.options.heightOverride&&setToAuto){if(['vertical','both'].contains(this.options.mode))this.element.style.height='';if(['width','both'].contains(this.options.mode))this.element.style.width='';}
if(!this.hidden)this.showing=false;if(hideThese)hideThese.setStyle('visibility','visible');this.callChain();this.fireEvent('show',this.element);}.bind(this));}else{this.callChain();this.fireEvent('complete',this.element);this.fireEvent('show',this.element);}}else if(this.options.link=='chain'){this.chain(this.reveal.bind(this));}else if(this.options.link=='cancel'&&!this.showing){this.cancel();this.reveal();}}catch(e){this.element.setStyles({display:this.options.display,visiblity:'visible',opacity:1});this.showing=false;this.callChain.delay(10,this);this.fireEvent('complete',this.element);this.fireEvent('show',this.element);}
return this;},toggle:function(){if(this.element.getStyle('display')=='none'||this.element.getStyle('visiblity')=='hidden'||this.element.getStyle('opacity')==0){this.reveal();}else{this.dissolve();}
return this;}});Element.Properties.reveal={set:function(options){var reveal=this.retrieve('reveal');if(reveal)reveal.cancel();return this.eliminate('reveal').store('reveal:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('reveal')){if(options||!this.retrieve('reveal:options'))this.set('reveal',options);this.store('reveal',new Fx.Reveal(this,this.retrieve('reveal:options')));}
return this.retrieve('reveal');}};Element.Properties.dissolve=Element.Properties.reveal;Element.implement({reveal:function(options){this.get('reveal',options).reveal();return this;},dissolve:function(options){this.get('reveal',options).dissolve();return this;},nix:function(){var params=Array.link(arguments,{destroy:Boolean.type,options:Object.type});this.get('reveal',params.options).dissolve().chain(function(){this[params.destroy?'destroy':'dispose']();}.bind(this));return this;},wink:function(){var params=Array.link(arguments,{duration:Number.type,options:Object.type});var reveal=this.get('reveal',params.options);reveal.reveal().chain(function(){(function(){reveal.dissolve();}).delay(params.duration||2000);});}});Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(element,options){this.element=this.subject=$(element);this.parent(options);var cancel=this.cancel.bind(this,false);if($type(this.element)!='element')this.element=$(this.element.getDocument().body);var stopper=this.element;if(this.options.wheelStops){this.addEvent('start',function(){stopper.addEvent('mousewheel',cancel);},true);this.addEvent('complete',function(){stopper.removeEvent('mousewheel',cancel);},true);}},set:function(){var now=Array.flatten(arguments);this.element.scrollTo(now[0],now[1]);},compute:function(from,to,delta){return[0,1].map(function(i){return Fx.compute(from[i],to[i],delta);});},start:function(x,y){if(!this.check(x,y))return this;var offsetSize=this.element.getSize(),scrollSize=this.element.getScrollSize();var scroll=this.element.getScroll(),values={x:x,y:y};for(var z in values){var max=scrollSize[z]-offsetSize[z];if($chk(values[z]))values[z]=($type(values[z])=='number')?values[z].limit(0,max):max;else values[z]=scroll[z];values[z]+=this.options.offset[z];}
return this.parent([scroll.x,scroll.y],[values.x,values.y]);},toTop:function(){return this.start(false,0);},toLeft:function(){return this.start(0,false);},toRight:function(){return this.start('right',false);},toBottom:function(){return this.start(false,'bottom');},toElement:function(el){var position=$(el).getPosition(this.element);return this.start(position.x,position.y);}});Fx.Slide=new Class({Extends:Fx,options:{mode:'vertical'},initialize:function(element,options){this.addEvent('complete',function(){this.open=(this.wrapper['offset'+this.layout.capitalize()]!=0);if(this.open&&Browser.Engine.webkit419)this.element.dispose().inject(this.wrapper);},true);this.element=this.subject=$(element);this.parent(options);var wrapper=this.element.retrieve('wrapper');this.wrapper=wrapper||new Element('div',{styles:$extend(this.element.getStyles('margin','position'),{overflow:'hidden'})}).wraps(this.element);this.element.store('wrapper',this.wrapper).setStyle('margin',0);this.now=[];this.open=true;},vertical:function(){this.margin='margin-top';this.layout='height';this.offset=this.element.offsetHeight;},horizontal:function(){this.margin='margin-left';this.layout='width';this.offset=this.element.offsetWidth;},set:function(now){this.element.setStyle(this.margin,now[0]);this.wrapper.setStyle(this.layout,now[1]);return this;},compute:function(from,to,delta){return[0,1].map(function(i){return Fx.compute(from[i],to[i],delta);});},start:function(how,mode){if(!this.check(how,mode))return this;this[mode||this.options.mode]();var margin=this.element.getStyle(this.margin).toInt();var layout=this.wrapper.getStyle(this.layout).toInt();var caseIn=[[margin,layout],[0,this.offset]];var caseOut=[[margin,layout],[-this.offset,0]];var start;switch(how){case'in':start=caseIn;break;case'out':start=caseOut;break;case'toggle':start=(layout==0)?caseIn:caseOut;}
return this.parent(start[0],start[1]);},slideIn:function(mode){return this.start('in',mode);},slideOut:function(mode){return this.start('out',mode);},hide:function(mode){this[mode||this.options.mode]();this.open=false;return this.set([-this.offset,0]);},show:function(mode){this[mode||this.options.mode]();this.open=true;return this.set([0,this.offset]);},toggle:function(mode){return this.start('toggle',mode);}});Element.Properties.slide={set:function(options){var slide=this.retrieve('slide');if(slide)slide.cancel();return this.eliminate('slide').store('slide:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('slide')){if(options||!this.retrieve('slide:options'))this.set('slide',options);this.store('slide',new Fx.Slide(this,this.retrieve('slide:options')));}
return this.retrieve('slide');}};Element.implement({slide:function(how,mode){how=how||'toggle';var slide=this.get('slide'),toggle;switch(how){case'hide':slide.hide(mode);break;case'show':slide.show(mode);break;case'toggle':var flag=this.retrieve('slide:flag',slide.open);slide[flag?'slideOut':'slideIn'](mode);this.store('slide:flag',!flag);toggle=true;break;default:slide.start(how,mode);}
if(!toggle)this.eliminate('slide:flag');return this;}});var SmoothScroll=Fx.SmoothScroll=new Class({Extends:Fx.Scroll,initialize:function(options,context){context=context||document;this.doc=context.getDocument();var win=context.getWindow();this.parent(this.doc,options);this.links=this.options.links?$$(this.options.links):$$(this.doc.links);var location=win.location.href.match(/^[^#]*/)[0]+'#';this.links.each(function(link){if(link.href.indexOf(location)!=0){return;}
var anchor=link.href.substr(location.length);if(anchor)this.useLink(link,anchor);},this);if(!Browser.Engine.webkit419){this.addEvent('complete',function(){win.location.hash=this.anchor;},true);}},useLink:function(link,anchor){var el;link.addEvent('click',function(event){if(el!==false&&!el)el=$(anchor)||this.doc.getElement('a[name='+anchor+']');if(el){event.preventDefault();this.anchor=anchor;this.toElement(el);link.blur();}}.bind(this));}});Fx.Sort=new Class({Extends:Fx.Elements,options:{mode:'vertical'},initialize:function(elements,options){this.parent(elements,options);this.elements.each(function(el){if(el.getStyle('position')=='static')el.setStyle('position','relative');});this.setDefaultOrder();},setDefaultOrder:function(){this.currentOrder=this.elements.map(function(el,index){return index;});},sort:function(newOrder){if($type(newOrder)!='array')return false;var top=0;var left=0;var zero={};var vert=this.options.mode=='vertical';var current=this.elements.map(function(el,index){var size=el.getComputedSize({styles:['border','padding','margin']});var val;if(vert){val={top:top,margin:size['margin-top'],height:size.totalHeight};top+=val.height-size['margin-top'];}else{val={left:left,margin:size['margin-left'],width:size.totalWidth};left+=val.width;}
var plain=vert?'top':'left';zero[index]={};var start=el.getStyle(plain).toInt();zero[index][plain]=start||0;return val;},this);this.set(zero);newOrder=newOrder.map(function(i){return i.toInt();});if(newOrder.length!=this.elements.length){this.currentOrder.each(function(index){if(!newOrder.contains(index))newOrder.push(index);});if(newOrder.length>this.elements.length)
newOrder.splice(this.elements.length-1,newOrder.length-this.elements.length);}
top=0;left=0;var margin=0;var next={};newOrder.each(function(item,index){var newPos={};if(vert){newPos.top=top-current[item].top-margin;top+=current[item].height;}else{newPos.left=left-current[item].left;left+=current[item].width;}
margin=margin+current[item].margin;next[item]=newPos;},this);var mapped={};$A(newOrder).sort().each(function(index){mapped[index]=next[index];});this.start(mapped);this.currentOrder=newOrder;return this;},rearrangeDOM:function(newOrder){newOrder=newOrder||this.currentOrder;var parent=this.elements[0].getParent();var rearranged=[];this.elements.setStyle('opacity',0);newOrder.each(function(index){rearranged.push(this.elements[index].inject(parent).setStyles({top:0,left:0}));},this);this.elements.setStyle('opacity',1);this.elements=$$(rearranged);this.setDefaultOrder();return this;},getDefaultOrder:function(){return this.elements.map(function(el,index){return index;});},forward:function(){return this.sort(this.getDefaultOrder());},backward:function(){return this.sort(this.getDefaultOrder().reverse());},reverse:function(){return this.sort(this.currentOrder.reverse());},sortByElements:function(elements){return this.sort(elements.map(function(el){return this.elements.indexOf(el);},this));},swap:function(one,two){if($type(one)=='element')one=this.elements.indexOf(one);if($type(two)=='element')two=this.elements.indexOf(two);var newOrder=$A(this.currentOrder);newOrder[this.currentOrder.indexOf(one)]=two;newOrder[this.currentOrder.indexOf(two)]=one;this.sort(newOrder);}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:'px',grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,modifiers:{x:'left',y:'top'}},initialize:function(){var params=Array.link(arguments,{'options':Object.type,'element':$defined});this.element=$(params.element);this.document=this.element.getDocument();this.setOptions(params.options||{});var htype=$type(this.options.handle);this.handles=((htype=='array'||htype=='collection')?$$(this.options.handle):$(this.options.handle))||this.element;this.mouse={'now':{},'pos':{}};this.value={'start':{},'now':{}};this.selection=(Browser.Engine.trident)?'selectstart':'mousedown';this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:$lambda(false)};this.attach();},attach:function(){this.handles.addEvent('mousedown',this.bound.start);return this;},detach:function(){this.handles.removeEvent('mousedown',this.bound.start);return this;},start:function(event){if(this.options.preventDefault)event.preventDefault();this.mouse.start=event.page;this.fireEvent('beforeStart',this.element);var limit=this.options.limit;this.limit={x:[],y:[]};for(var z in this.options.modifiers){if(!this.options.modifiers[z])continue;if(this.options.style)this.value.now[z]=this.element.getStyle(this.options.modifiers[z]).toInt();else this.value.now[z]=this.element[this.options.modifiers[z]];if(this.options.invert)this.value.now[z]*=-1;this.mouse.pos[z]=event.page[z]-this.value.now[z];if(limit&&limit[z]){for(var i=2;i--;i){if($chk(limit[z][i]))this.limit[z][i]=$lambda(limit[z][i])();}}}
if($type(this.options.grid)=='number')this.options.grid={x:this.options.grid,y:this.options.grid};this.document.addEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});this.document.addEvent(this.selection,this.bound.eventStop);},check:function(event){if(this.options.preventDefault)event.preventDefault();var distance=Math.round(Math.sqrt(Math.pow(event.page.x-this.mouse.start.x,2)+Math.pow(event.page.y-this.mouse.start.y,2)));if(distance>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent('start',[this.element,event]).fireEvent('snap',this.element);}},drag:function(event){if(this.options.preventDefault)event.preventDefault();this.mouse.now=event.page;for(var z in this.options.modifiers){if(!this.options.modifiers[z])continue;this.value.now[z]=this.mouse.now[z]-this.mouse.pos[z];if(this.options.invert)this.value.now[z]*=-1;if(this.options.limit&&this.limit[z]){if($chk(this.limit[z][1])&&(this.value.now[z]>this.limit[z][1])){this.value.now[z]=this.limit[z][1];}else if($chk(this.limit[z][0])&&(this.value.now[z]<this.limit[z][0])){this.value.now[z]=this.limit[z][0];}}
if(this.options.grid[z])this.value.now[z]-=((this.value.now[z]-this.limit[z][0])%this.options.grid[z]);if(this.options.style)this.element.setStyle(this.options.modifiers[z],this.value.now[z]+this.options.unit);else this.element[this.options.modifiers[z]]=this.value.now[z];}
this.fireEvent('drag',[this.element,event]);},cancel:function(event){this.document.removeEvent('mousemove',this.bound.check);this.document.removeEvent('mouseup',this.bound.cancel);if(event){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent('cancel',this.element);}},stop:function(event){this.document.removeEvent(this.selection,this.bound.eventStop);this.document.removeEvent('mousemove',this.bound.drag);this.document.removeEvent('mouseup',this.bound.stop);if(event)this.fireEvent('complete',[this.element,event]);}});Element.implement({makeResizable:function(options){var drag=new Drag(this,$merge({modifiers:{x:'width',y:'height'}},options));this.store('resizer',drag);return drag.addEvent('drag',function(){this.fireEvent('resize',drag);}.bind(this));}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false,precalculate:false,includeMargins:true,checkDroppables:true},initialize:function(element,options){this.parent(element,options);this.droppables=$$(this.options.droppables);this.container=$(this.options.container);if(this.container&&$type(this.container)!='element')this.container=$(this.container.getDocument().body);var position=this.element.getStyle('position');if(position=='static')position='absolute';if([this.element.getStyle('left'),this.element.getStyle('top')].contains('auto'))this.element.position(this.element.getPosition(this.element.offsetParent));this.element.setStyle('position',position);this.addEvent('start',this.checkDroppables,true);this.overed=null;},start:function(event){if(this.container){var ccoo=this.container.getCoordinates(this.element.getOffsetParent()),cbs={},ems={};['top','right','bottom','left'].each(function(pad){cbs[pad]=this.container.getStyle('border-'+pad).toInt();ems[pad]=this.element.getStyle('margin-'+pad).toInt();},this);var width=this.element.offsetWidth+ems.left+ems.right;var height=this.element.offsetHeight+ems.top+ems.bottom;if(this.options.includeMargins){$each(ems,function(value,key){ems[key]=0;});}
if(this.container==this.element.getOffsetParent()){this.options.limit={x:[0-ems.left,ccoo.right-cbs.left-cbs.right-width+ems.right],y:[0-ems.top,ccoo.bottom-cbs.top-cbs.bottom-height+ems.bottom]};}else{this.options.limit={x:[ccoo.left+cbs.left-ems.left,ccoo.right-cbs.right-width+ems.right],y:[ccoo.top+cbs.top-ems.top,ccoo.bottom-cbs.bottom-height+ems.bottom]};}}
if(this.options.precalculate){this.positions=this.droppables.map(function(el){return el.getCoordinates();});}
this.parent(event);},checkAgainst:function(el,i){el=(this.positions)?this.positions[i]:el.getCoordinates();var now=this.mouse.now;return(now.x>el.left&&now.x<el.right&&now.y<el.bottom&&now.y>el.top);},checkDroppables:function(){var overed=this.droppables.filter(this.checkAgainst,this).getLast();if(this.overed!=overed){if(this.overed)this.fireEvent('leave',[this.element,this.overed]);if(overed)this.fireEvent('enter',[this.element,overed]);this.overed=overed;}},drag:function(event){this.parent(event);if(this.options.checkDroppables&&this.droppables.length)this.checkDroppables();},stop:function(event){this.checkDroppables();this.fireEvent('drop',[this.element,this.overed,event]);this.overed=null;return this.parent(event);}});Element.implement({makeDraggable:function(options){var drag=new Drag.Move(this,options);this.store('dragger',drag);return drag;}});var Slider=new Class({Implements:[Events,Options],Binds:['clickedElement','draggedKnob','scrolledElement'],options:{onTick:function(position){if(this.options.snap)position=this.toPosition(this.step);this.knob.setStyle(this.property,position);},snap:false,offset:0,range:false,wheel:false,steps:100,mode:'horizontal'},initialize:function(element,knob,options){this.setOptions(options);this.element=$(element);this.knob=$(knob);this.previousChange=this.previousEnd=this.step=-1;var offset,limit={},modifiers={'x':false,'y':false};switch(this.options.mode){case'vertical':this.axis='y';this.property='top';offset='offsetHeight';break;case'horizontal':this.axis='x';this.property='left';offset='offsetWidth';}
this.half=this.knob[offset]/2;this.full=this.element[offset]-this.knob[offset]+(this.options.offset*2);this.min=$chk(this.options.range[0])?this.options.range[0]:0;this.max=$chk(this.options.range[1])?this.options.range[1]:this.options.steps;this.range=this.max-this.min;this.steps=this.options.steps||this.full;this.stepSize=Math.abs(this.range)/this.steps;this.stepWidth=this.stepSize*this.full/Math.abs(this.range);this.knob.setStyle('position','relative').setStyle(this.property,-this.options.offset);modifiers[this.axis]=this.property;limit[this.axis]=[-this.options.offset,this.full-this.options.offset];this.bound={clickedElement:this.clickedElement.bind(this),scrolledElement:this.scrolledElement.bindWithEvent(this),draggedKnob:this.draggedKnob.bind(this)};var dragOptions={snap:0,limit:limit,modifiers:modifiers,onDrag:this.bound.draggedKnob,onStart:this.bound.draggedKnob,onBeforeStart:(function(){this.isDragging=true;}).bind(this),onComplete:function(){this.isDragging=false;this.draggedKnob();this.end();}.bind(this)};if(this.options.snap){dragOptions.grid=Math.ceil(this.stepWidth);dragOptions.limit[this.axis][1]=this.full;}
this.drag=new Drag(this.knob,dragOptions);this.attach();},attach:function(){this.element.addEvent('mousedown',this.bound.clickedElement);if(this.options.wheel)this.element.addEvent('mousewheel',this.bound.scrolledElement);this.drag.attach();return this;},detach:function(){this.element.removeEvent('mousedown',this.bound.clickedElement);this.element.removeEvent('mousewheel',this.bound.scrolledElement);this.drag.detach();return this;},set:function(step){if(!((this.range>0)^(step<this.min)))step=this.min;if(!((this.range>0)^(step>this.max)))step=this.max;this.step=Math.round(step);this.checkStep();this.fireEvent('tick',this.toPosition(this.step));this.end();return this;},clickedElement:function(event){if(this.isDragging||event.target==this.knob)return;var dir=this.range<0?-1:1;var position=event.page[this.axis]-this.element.getPosition()[this.axis]-this.half;position=position.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+dir*this.toStep(position));this.checkStep();this.fireEvent('tick',position);this.end();},scrolledElement:function(event){var mode=(this.options.mode=='horizontal')?(event.wheel<0):(event.wheel>0);this.set(mode?this.step-this.stepSize:this.step+this.stepSize);event.stop();},draggedKnob:function(){var dir=this.range<0?-1:1;var position=this.drag.value.now[this.axis];position=position.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+dir*this.toStep(position));this.checkStep();},checkStep:function(){if(this.previousChange!=this.step){this.previousChange=this.step;this.fireEvent('change',this.step);}},end:function(){if(this.previousEnd!==this.step){this.previousEnd=this.step;this.fireEvent('complete',this.step+'');}},toStep:function(position){var step=(position+this.options.offset)*this.stepSize/this.full*this.steps;return this.options.steps?Math.round(step-=step%this.stepSize):step;},toPosition:function(step){return(this.full*Math.abs(this.min-step))/(this.steps*this.stepSize)-this.options.offset;}});var Sortables=new Class({Implements:[Events,Options],options:{snap:4,opacity:1,clone:false,revert:false,handle:false,constrain:false},initialize:function(lists,options){this.setOptions(options);this.elements=[];this.lists=[];this.idle=true;this.addLists($$($(lists)||lists));if(!this.options.clone)this.options.revert=false;if(this.options.revert)this.effect=new Fx.Morph(null,$merge({duration:250,link:'cancel'},this.options.revert));},attach:function(){this.addLists(this.lists);return this;},detach:function(){this.lists=this.removeLists(this.lists);return this;},addItems:function(){Array.flatten(arguments).each(function(element){this.elements.push(element);var start=element.retrieve('sortables:start',this.start.bindWithEvent(this,element));(this.options.handle?element.getElement(this.options.handle)||element:element).addEvent('mousedown',start);},this);return this;},addLists:function(){Array.flatten(arguments).each(function(list){this.lists.push(list);this.addItems(list.getChildren());},this);return this;},removeItems:function(){return $$(Array.flatten(arguments).map(function(element){this.elements.erase(element);var start=element.retrieve('sortables:start');(this.options.handle?element.getElement(this.options.handle)||element:element).removeEvent('mousedown',start);return element;},this));},removeLists:function(){return $$(Array.flatten(arguments).map(function(list){this.lists.erase(list);this.removeItems(list.getChildren());return list;},this));},getClone:function(event,element){if(!this.options.clone)return new Element('div').inject(document.body);if($type(this.options.clone)=='function')return this.options.clone.call(this,event,element,this.list);return element.clone(true).setStyles({margin:'0px',position:'absolute',visibility:'hidden','width':element.getStyle('width')}).inject(this.list).position(element.getPosition(element.getOffsetParent()));},getDroppables:function(){var droppables=this.list.getChildren();if(!this.options.constrain)droppables=this.lists.concat(droppables).erase(this.list);return droppables.erase(this.clone).erase(this.element);},insert:function(dragging,element){var where='inside';if(this.lists.contains(element)){this.list=element;this.drag.droppables=this.getDroppables();}else{where=this.element.getAllPrevious().contains(element)?'before':'after';}
this.element.inject(element,where);this.fireEvent('sort',[this.element,this.clone]);},start:function(event,element){if(!this.idle)return;this.idle=false;this.element=element;this.opacity=element.get('opacity');this.list=element.getParent();this.clone=this.getClone(event,element);this.drag=new Drag.Move(this.clone,{snap:this.options.snap,container:this.options.constrain&&this.element.getParent(),droppables:this.getDroppables(),onSnap:function(){event.stop();this.clone.setStyle('visibility','visible');this.element.set('opacity',this.options.opacity||0);this.fireEvent('start',[this.element,this.clone]);}.bind(this),onEnter:this.insert.bind(this),onCancel:this.reset.bind(this),onComplete:this.end.bind(this)});this.clone.inject(this.element,'before');this.drag.start(event);},end:function(){this.drag.detach();this.element.set('opacity',this.opacity);if(this.effect){var dim=this.element.getStyles('width','height');var pos=this.clone.computePosition(this.element.getPosition(this.clone.offsetParent));this.effect.element=this.clone;this.effect.start({top:pos.top,left:pos.left,width:dim.width,height:dim.height,opacity:0.25}).chain(this.reset.bind(this));}else{this.reset();}},reset:function(){this.idle=true;this.clone.destroy();this.fireEvent('complete',this.element);},serialize:function(){var params=Array.link(arguments,{modifier:Function.type,index:$defined});var serial=this.lists.map(function(list){return list.getChildren().map(params.modifier||function(element){return element.get('id');},this);},this);var index=params.index;if(this.lists.length==1)index=0;return $chk(index)&&index>=0&&index<this.lists.length?serial[index]:serial;}});Request.JSONP=new Class({Implements:[Chain,Events,Options,Log],options:{url:'',data:{},retries:0,timeout:0,link:'ignore',callbackKey:'callback',injectScript:document.head},initialize:function(options){this.setOptions(options);this.running=false;this.requests=0;this.triesRemaining=[];},check:function(){if(!this.running)return true;switch(this.options.link){case'cancel':this.cancel();return true;case'chain':this.chain(this.caller.bind(this,arguments));return false;}
return false;},send:function(options){if(!$chk(arguments[1])&&!this.check(options))return this;var type=$type(options),old=this.options,index=$chk(arguments[1])?arguments[1]:this.requests++;if(type=='string'||type=='element')options={data:options};options=$extend({data:old.data,url:old.url},options);if(!$chk(this.triesRemaining[index]))this.triesRemaining[index]=this.options.retries;var remaining=this.triesRemaining[index];(function(){var script=this.getScript(options);this.log('JSONP retrieving script with url: '+script.get('src'));this.fireEvent('request',script);this.running=true;(function(){if(remaining){this.triesRemaining[index]=remaining-1;if(script){script.destroy();this.request(options,index);this.fireEvent('retry',this.triesRemaining[index]);}}else if(script&&this.options.timeout){script.destroy();this.cancel();this.fireEvent('failure');}}).delay(this.options.timeout,this);}).delay(Browser.Engine.trident?50:0,this);return this;},cancel:function(){if(!this.running)return this;this.running=false;this.fireEvent('cancel');return this;},getScript:function(options){var index=Request.JSONP.counter,data;Request.JSONP.counter++;switch($type(options.data)){case'element':data=$(options.data).toQueryString();break;case'object':case'hash':data=Hash.toQueryString(options.data);}
var src=options.url+
(options.url.test('\\?')?'&':'?')+
(options.callbackKey||this.options.callbackKey)+'=Request.JSONP.request_map.request_'+index+
(data?'&'+data:'');if(src.length>2083)this.log('JSONP '+src+' will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs');var script=new Element('script',{type:'text/javascript',src:src});Request.JSONP.request_map['request_'+index]=function(data){this.success(data,script);}.bind(this);return script.inject(this.options.injectScript);},success:function(data,script){if(script)script.destroy();this.running=false;this.log('JSONP successfully retrieved: ',data);this.fireEvent('complete',[data]).fireEvent('success',[data]).callChain();}});Request.JSONP.counter=0;Request.JSONP.request_map={};Request.Queue=new Class({Implements:[Options,Events],Binds:['attach','request','complete','cancel','success','failure','exception'],options:{stopOnFailure:true,autoAdvance:true,concurrent:1,requests:{}},initialize:function(options){this.setOptions(options);this.requests=new Hash;this.addRequests(this.options.requests);this.queue=[];this.reqBinders={};},addRequest:function(name,request){this.requests.set(name,request);this.attach(name,request);return this;},addRequests:function(obj){$each(obj,this.addRequest,this);return this;},getName:function(req){return this.requests.keyOf(req);},attach:function(name,req){if(req._groupSend)return this;['request','complete','cancel','success','failure','exception'].each(function(evt){if(!this.reqBinders[name])this.reqBinders[name]={};this.reqBinders[name][evt]=function(){this['on'+evt.capitalize()].apply(this,[name,req].extend(arguments));}.bind(this);req.addEvent(evt,this.reqBinders[name][evt]);},this);req._groupSend=req.send;req.send=function(options){this.send(name,options);return req;}.bind(this);return this;},removeRequest:function(req){var name=$type(req)=='object'?this.getName(req):req;if(!name&&$type(name)!='string')return this;req=this.requests.get(name);if(!req)return this;['request','complete','cancel','success','failure','exception'].each(function(evt){req.removeEvent(evt,this.reqBinders[name][evt]);},this);req.send=req._groupSend;delete req._groupSend;return this;},getRunning:function(){return this.requests.filter(function(r){return r.running;});},isRunning:function(){return!!this.getRunning().getKeys().length;},send:function(name,options){var q=function(){this.requests.get(name)._groupSend(options);this.queue.erase(q);}.bind(this);q.name=name;if(this.getRunning().getKeys().length>=this.options.concurrent||(this.error&&this.options.stopOnFailure))this.queue.push(q);else q();return this;},hasNext:function(name){return(!name)?!!this.queue.length:!!this.queue.filter(function(q){return q.name==name;}).length;},resume:function(){this.error=false;(this.options.concurrent-this.getRunning().getKeys().length).times(this.runNext,this);return this;},runNext:function(name){if(!this.queue.length)return this;if(!name){this.queue[0]();}else{var found;this.queue.each(function(q){if(!found&&q.name==name){found=true;q();}});}
return this;},runAll:function(){this.queue.each(function(q){q();});return this;},clear:function(name){if(!name){this.queue.empty();}else{this.queue=this.queue.map(function(q){if(q.name!=name)return q;else return false;}).filter(function(q){return q;});}
return this;},cancel:function(name){this.requests.get(name).cancel();return this;},onRequest:function(){this.fireEvent('request',arguments);},onComplete:function(){this.fireEvent('complete',arguments);},onCancel:function(){if(this.options.autoAdvance&&!this.error)this.runNext();this.fireEvent('cancel',arguments);},onSuccess:function(){if(this.options.autoAdvance&&!this.error)this.runNext();this.fireEvent('success',arguments);},onFailure:function(){this.error=true;if(!this.options.stopOnFailure&&this.options.autoAdvance)this.runNext();this.fireEvent('failure',arguments);},onException:function(){this.error=true;if(!this.options.stopOnFailure&&this.options.autoAdvance)this.runNext();this.fireEvent('exception',arguments);}});Request.implement({options:{initialDelay:5000,delay:5000,limit:60000},startTimer:function(data){var fn=(function(){if(!this.running)this.send({data:data});});this.timer=fn.delay(this.options.initialDelay,this);this.lastDelay=this.options.initialDelay;this.completeCheck=function(j){$clear(this.timer);if(j)this.lastDelay=this.options.delay;else this.lastDelay=(this.lastDelay+this.options.delay).min(this.options.limit);this.timer=fn.delay(this.lastDelay,this);};this.addEvent('complete',this.completeCheck);return this;},stopTimer:function(){$clear(this.timer);this.removeEvent('complete',this.completeCheck);return this;}});var Asset={javascript:function(source,properties){properties=$extend({onload:$empty,document:document,check:$lambda(true)},properties);var script=new Element('script',{src:source,type:'text/javascript'});var load=properties.onload.bind(script),check=properties.check,doc=properties.document;delete properties.onload;delete properties.check;delete properties.document;script.addEvents({load:load,readystatechange:function(){if(['loaded','complete'].contains(this.readyState))load();}}).set(properties);if(Browser.Engine.webkit419)var checker=(function(){if(!$try(check))return;$clear(checker);load();}).periodical(50);return script.inject(doc.head);},css:function(source,properties){return new Element('link',$merge({rel:'stylesheet',media:'screen',type:'text/css',href:source},properties)).inject(document.head);},image:function(source,properties){properties=$merge({onload:$empty,onabort:$empty,onerror:$empty},properties);var image=new Image();var element=$(image)||new Element('img');['load','abort','error'].each(function(name){var type='on'+name;var event=properties[type];delete properties[type];image[type]=function(){if(!image)return;if(!element.parentNode){element.width=image.width;element.height=image.height;}
image=image.onload=image.onabort=image.onerror=null;event.delay(1,element,element);element.fireEvent(name,element,1);};});image.src=element.src=source;if(image&&image.complete)image.onload.delay(1);return element.set(properties);},images:function(sources,options){options=$merge({onComplete:$empty,onProgress:$empty},options);sources=$splat(sources);var images=[];var counter=0;return new Elements(sources.map(function(source){return Asset.image(source,{onload:function(){options.onProgress.call(this,counter,sources.indexOf(source));counter++;if(counter==sources.length)options.onComplete();}});}));}};var Color=new Native({initialize:function(color,type){if(arguments.length>=3){type='rgb';color=Array.slice(arguments,0,3);}else if(typeof color=='string'){if(color.match(/rgb/))color=color.rgbToHex().hexToRgb(true);else if(color.match(/hsb/))color=color.hsbToRgb();else color=color.hexToRgb(true);}
type=type||'rgb';switch(type){case'hsb':var old=color;color=color.hsbToRgb();color.hsb=old;break;case'hex':color=color.hexToRgb(true);break;}
color.rgb=color.slice(0,3);color.hsb=color.hsb||color.rgbToHsb();color.hex=color.rgbToHex();return $extend(color,this);}});Color.implement({mix:function(){var colors=Array.slice(arguments);var alpha=($type(colors.getLast())=='number')?colors.pop():50;var rgb=this.slice();colors.each(function(color){color=new Color(color);for(var i=0;i<3;i++)rgb[i]=Math.round((rgb[i]/100*(100-alpha))+(color[i]/100*alpha));});return new Color(rgb,'rgb');},invert:function(){return new Color(this.map(function(value){return 255-value;}));},setHue:function(value){return new Color([value,this.hsb[1],this.hsb[2]],'hsb');},setSaturation:function(percent){return new Color([this.hsb[0],percent,this.hsb[2]],'hsb');},setBrightness:function(percent){return new Color([this.hsb[0],this.hsb[1],percent],'hsb');}});var $RGB=function(r,g,b){return new Color([r,g,b],'rgb');};var $HSB=function(h,s,b){return new Color([h,s,b],'hsb');};var $HEX=function(hex){return new Color(hex,'hex');};Array.implement({rgbToHsb:function(){var red=this[0],green=this[1],blue=this[2];var hue,saturation,brightness;var max=Math.max(red,green,blue),min=Math.min(red,green,blue);var delta=max-min;brightness=max/255;saturation=(max!=0)?delta/max:0;if(saturation==0){hue=0;}else{var rr=(max-red)/delta;var gr=(max-green)/delta;var br=(max-blue)/delta;if(red==max)hue=br-gr;else if(green==max)hue=2+rr-br;else hue=4+gr-rr;hue/=6;if(hue<0)hue++;}
return[Math.round(hue*360),Math.round(saturation*100),Math.round(brightness*100)];},hsbToRgb:function(){var br=Math.round(this[2]/100*255);if(this[1]==0){return[br,br,br];}else{var hue=this[0]%360;var f=hue%60;var p=Math.round((this[2]*(100-this[1]))/10000*255);var q=Math.round((this[2]*(6000-this[1]*f))/600000*255);var t=Math.round((this[2]*(6000-this[1]*(60-f)))/600000*255);switch(Math.floor(hue/60)){case 0:return[br,t,p];case 1:return[q,br,p];case 2:return[p,br,t];case 3:return[p,q,br];case 4:return[t,p,br];case 5:return[br,p,q];}}
return false;}});String.implement({rgbToHsb:function(){var rgb=this.match(/\d{1,3}/g);return(rgb)?rgb.rgbToHsb():null;},hsbToRgb:function(){var hsb=this.match(/\d{1,3}/g);return(hsb)?hsb.hsbToRgb():null;}});var Group=new Class({initialize:function(){this.instances=Array.flatten(arguments);this.events={};this.checker={};},addEvent:function(type,fn){this.checker[type]=this.checker[type]||{};this.events[type]=this.events[type]||[];if(this.events[type].contains(fn))return false;else this.events[type].push(fn);this.instances.each(function(instance,i){instance.addEvent(type,this.check.bind(this,[type,instance,i]));},this);return this;},check:function(type,instance,i){this.checker[type][i]=true;var every=this.instances.every(function(current,j){return this.checker[type][j]||false;},this);if(!every)return;this.checker[type]={};this.events[type].each(function(event){event.call(this,this.instances,instance);},this);}});Hash.Cookie=new Class({Extends:Cookie,options:{autoSave:true},initialize:function(name,options){this.parent(name,options);this.load();},save:function(){var value=JSON.encode(this.hash);if(!value||value.length>4096)return false;if(value=='{}')this.dispose();else this.write(value);return true;},load:function(){this.hash=new Hash(JSON.decode(this.read(),true));return this;}});Hash.each(Hash.prototype,function(method,name){if(typeof method=='function')Hash.Cookie.implement(name,function(){var value=method.apply(this.hash,arguments);if(this.options.autoSave)this.save();return value;});});var IframeShim=new Class({Implements:[Options,Events,Class.Occlude],options:{className:'iframeShim',display:false,zIndex:null,margin:0,offset:{x:0,y:0},browsers:true||(Browser.Engine.trident4||(Browser.Engine.gecko&&!Browser.Engine.gecko19&&Browser.Platform.mac))},property:'IframeShim',initialize:function(element,options){this.element=$(element);if(this.occlude())return this.occluded;this.setOptions(options);this.makeShim();return this;},makeShim:function(){if(this.options.browsers){var zIndex=this.element.getStyle('zIndex').toInt();if(!zIndex){var pos=this.element.getStyle('position');if(pos=='static'||!pos)this.element.setStyle('position','relative');this.element.setStyle('zIndex',zIndex||1);}
zIndex=($chk(this.options.zIndex)&&zIndex>this.options.zIndex)?this.options.zIndex:zIndex-1;if(zIndex<0)zIndex=1;this.shim=new Element('iframe',{src:(window.location.protocol=='https')?'://0':'javascript:void(0)',scrolling:'no',frameborder:0,styles:{zIndex:zIndex,position:'absolute',border:'none',filter:'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'},'class':this.options.className}).store('IframeShim',this);var inject=(function(){this.shim.inject(this.element,'after');this[this.options.display?'show':'hide']();this.fireEvent('inject');}).bind(this);if(Browser.Engine.trident&&!IframeShim.ready)window.addEvent('load',inject);else inject();}else{this.position=this.hide=this.show=this.dispose=$lambda(this);}},position:function(){if(!IframeShim.ready)return this;var size=this.element.measure(function(){return this.getSize();});if($type(this.options.margin)){size.x=size.x-(this.options.margin*2);size.y=size.y-(this.options.margin*2);this.options.offset.x+=this.options.margin;this.options.offset.y+=this.options.margin;}
if(this.shim){this.shim.set({width:size.x,height:size.y}).position({relativeTo:this.element,offset:this.options.offset});}
return this;},hide:function(){if(this.shim)this.shim.setStyle('display','none');return this;},show:function(){if(this.shim)this.shim.setStyle('display','block');return this.position();},dispose:function(){if(this.shim)this.shim.dispose();return this;},destroy:function(){if(this.shim)this.shim.destroy();return this;}});window.addEvent('load',function(){IframeShim.ready=true;});var Scroller=new Class({Implements:[Events,Options],options:{area:20,velocity:1,onChange:function(x,y){this.element.scrollTo(x,y);},fps:50},initialize:function(element,options){this.setOptions(options);this.element=$(element);this.listener=($type(this.element)!='element')?$(this.element.getDocument().body):this.element;this.timer=null;this.bound={attach:this.attach.bind(this),detach:this.detach.bind(this),getCoords:this.getCoords.bind(this)};},start:function(){this.listener.addEvents({mouseenter:this.bound.attach,mouseleave:this.bound.detach});},stop:function(){this.listener.removeEvents({mouseenter:this.bound.attach,mouseleave:this.bound.detach});this.timer=$clear(this.timer);},attach:function(){this.listener.addEvent('mousemove',this.bound.getCoords);},detach:function(){this.listener.removeEvent('mousemove',this.bound.getCoords);this.timer=$clear(this.timer);},getCoords:function(event){this.page=(this.listener.get('tag')=='body')?event.client:event.page;if(!this.timer)this.timer=this.scroll.periodical(Math.round(1000/this.options.fps),this);},scroll:function(){var size=this.element.getSize(),scroll=this.element.getScroll(),pos=this.element.getOffsets(),scrollSize=this.element.getScrollSize(),change={x:0,y:0};for(var z in this.page){if(this.page[z]<(this.options.area+pos[z])&&scroll[z]!=0)
change[z]=(this.page[z]-this.options.area-pos[z])*this.options.velocity;else if(this.page[z]+this.options.area>(size[z]+pos[z])&&scroll[z]+size[z]!=scrollSize[z])
change[z]=(this.page[z]-size[z]+this.options.area-pos[z])*this.options.velocity;}
if(change.y||change.x)this.fireEvent('change',[scroll.x+change.x,scroll.y+change.y]);}});var Tips=new Class({Implements:[Events,Options],options:{onShow:function(tip){tip.setStyle('visibility','visible');},onHide:function(tip){tip.setStyle('visibility','hidden');},title:'title',text:function(el){return el.get('rel')||el.get('href');},showDelay:100,hideDelay:100,className:null,offset:{x:16,y:16},fixed:false},initialize:function(){var params=Array.link(arguments,{options:Object.type,elements:$defined});if(params.options&&params.options.offsets)params.options.offset=params.options.offsets;this.setOptions(params.options);this.container=new Element('div',{'class':'tip'});this.tip=this.getTip();if(params.elements)this.attach(params.elements);},getTip:function(){return new Element('div',{'class':this.options.className,styles:{visibility:'hidden',display:'none',position:'absolute',top:0,left:0}}).adopt(new Element('div',{'class':'tip-top'}),this.container,new Element('div',{'class':'tip-bottom'})).inject(document.body);},attach:function(elements){var read=function(option,element){if(option==null)return'';return $type(option)=='function'?option(element):element.get(option);};$$(elements).each(function(element){var title=read(this.options.title,element);element.erase('title').store('tip:native',title).retrieve('tip:title',title);element.retrieve('tip:text',read(this.options.text,element));var events=['enter','leave'];if(!this.options.fixed)events.push('move');events.each(function(value){element.addEvent('mouse'+value,element.retrieve('tip:'+value,this['element'+value.capitalize()].bindWithEvent(this,element)));},this);},this);return this;},detach:function(elements){$$(elements).each(function(element){['enter','leave','move'].each(function(value){element.removeEvent('mouse'+value,element.retrieve('tip:'+value)||$empty);});element.eliminate('tip:enter').eliminate('tip:leave').eliminate('tip:move');if($type(this.options.title)=='string'&&this.options.title=='title'){var original=element.retrieve('tip:native');if(original)element.set('title',original);}},this);return this;},elementEnter:function(event,element){$A(this.container.childNodes).each(Element.dispose);['title','text'].each(function(value){var content=element.retrieve('tip:'+value);if(!content)return;this[value+'Element']=new Element('div',{'class':'tip-'+value}).inject(this.container);this.fill(this[value+'Element'],content);},this);this.timer=$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this,element);this.tip.setStyle('display','block');this.position((!this.options.fixed)?event:{page:element.getPosition()});},elementLeave:function(event,element){$clear(this.timer);this.tip.setStyle('display','none');this.timer=this.hide.delay(this.options.hideDelay,this,element);},elementMove:function(event){this.position(event);},position:function(event){var size=window.getSize(),scroll=window.getScroll(),tip={x:this.tip.offsetWidth,y:this.tip.offsetHeight},props={x:'left',y:'top'},obj={};for(var z in props){obj[props[z]]=event.page[z]+this.options.offset[z];if((obj[props[z]]+tip[z]-scroll[z])>size[z])obj[props[z]]=event.page[z]-this.options.offset[z]-tip[z];}
this.tip.setStyles(obj);},fill:function(element,contents){if(typeof contents=='string')element.set('html',contents);else element.adopt(contents);},show:function(el){this.fireEvent('show',[this.tip,el]);},hide:function(el){this.fireEvent('hide',[this.tip,el]);}});MooTools.lang.set('en-US','Date',{months:['January','February','March','April','May','June','July','August','September','October','November','December'],days:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],dateOrder:['month','date','year'],shortDate:'%m/%d/%Y',shortTime:'%I:%M%p',AM:'AM',PM:'PM',ordinal:function(dayOfMonth){return(dayOfMonth>3&&dayOfMonth<21)?'th':['th','st','nd','rd','th'][Math.min(dayOfMonth%10,4)];},lessThanMinuteAgo:'less than a minute ago',minuteAgo:'about a minute ago',minutesAgo:'{delta} minutes ago',hourAgo:'about an hour ago',hoursAgo:'about {delta} hours ago',dayAgo:'1 day ago',daysAgo:'{delta} days ago',lessThanMinuteUntil:'less than a minute from now',minuteUntil:'about a minute from now',minutesUntil:'{delta} minutes from now',hourUntil:'about an hour from now',hoursUntil:'about {delta} hours from now',dayUntil:'1 day from now',daysUntil:'{delta} days from now'});MooTools.lang.set('en-US','FormValidator',{required:'This field is required.',minLength:'Please enter at least {minLength} characters (you entered {length} characters).',maxLength:'Please enter no more than {maxLength} characters (you entered {length} characters).',integer:'Please enter an integer in this field. Numbers with decimals (e.g. 1.25) are not permitted.',numeric:'Please enter only numeric values in this field (i.e. "1" or "1.1" or "-1" or "-1.1").',digits:'Please use numbers and punctuation only in this field (for example, a phone number with dashes or dots is permitted).',alpha:'Please use letters only (a-z) with in this field. No spaces or other characters are allowed.',alphanum:'Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.',dateSuchAs:'Please enter a valid date such as {date}',dateInFormatMDY:'Please enter a valid date such as MM/DD/YYYY (i.e. "12/31/1999")',email:'Please enter a valid email address. For example "fred@domain.com".',url:'Please enter a valid URL such as http://www.google.com.',currencyDollar:'Please enter a valid $ amount. For example $100.00 .',oneRequired:'Please enter something for at least one of these inputs.',errorPrefix:'Error: ',warningPrefix:'Warning: ',noSpace:'There can be no spaces in this input.',reqChkByNode:'No items are selected.',requiredChk:'This field is required.',reqChkByName:'Please select a {label}.',match:'This field needs to match the {matchName} field',startDate:'the start date',endDate:'the end date',currendDate:'the current date',afterDate:'The date should be the same or after {label}.',beforeDate:'The date should be the same or before {label}.',startMonth:'Please select a start month',sameMonth:'These two dates must be in the same month - you must change one or the other.'});window.addEvent('load',function(){if(!("console"in window)||!("firebug"in window.console)){var names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];window.console={};for(var i=0;i<names.length;++i){window.console[names[i]]=function(){};}}});Class.Mutators.Family=function(self,name){if($defined(name)){self.$family={'name':name};$[name]=$.object;return self;}
else{this.implement('$family',{'name':self});}};if(typeof Jx=='undefined'){var Jx={};(function(){var aScripts=document.getElementsByTagName('SCRIPT');for(var i=0;i<aScripts.length;i++){var s=aScripts[i].src;var matches=/(.*[jx|js|lib])\/jxlib(.*)/.exec(s);if(matches&&matches[0]){Jx.aPixel=document.createElement('img',{alt:'',title:''});Jx.aPixel.src=matches[1]+'/a_pixel.png';Jx.baseURL=Jx.aPixel.src.substring(0,Jx.aPixel.src.indexOf('a_pixel.png'));}}
var src=aScripts[0].src;if(src.contains('app:')){Jx.isAir=true;}else{Jx.isAir=false;}})();}
Jx.applyPNGFilter=function(o){var t=Jx.aPixel.src;if(o.src!=t){var s=o.src;o.src=t;o.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+s+"',sizingMethod='scale')";}};Jx.imgQueue=[];Jx.imgLoaded={};Jx.imagesLoading=0;Jx.addToImgQueue=function(obj){if(Jx.imgLoaded[obj.src]){obj.element.src=obj.src;}else{Jx.imgQueue.push(obj);Jx.imgLoaded[obj.src]=true;}
Jx.checkImgQueue();};Jx.checkImgQueue=function(){while(Jx.imagesLoading<2&&Jx.imgQueue.length>0){Jx.loadNextImg();}};Jx.loadNextImg=function(){var obj=Jx.imgQueue.shift();if(obj){++Jx.imagesLoading;obj.element.onload=function(){--Jx.imagesLoading;Jx.checkImgQueue();};obj.element.onerror=function(){--Jx.imagesLoading;Jx.checkImgQueue();};obj.element.src=obj.src;}};Jx.createIframeShim=function(){return new Element('iframe',{'class':'jxIframeShim','scrolling':'no','frameborder':0});};Jx.getNumber=function(n,def){var result=n===null||isNaN(parseInt(n,10))?(def||0):parseInt(n,10);return result;};Jx.getPageDimensions=function(){return{width:window.getWidth(),height:window.getHeight()};};Element.implement({getBoxSizing:function(){var result='content-box';if(Browser.Engine.trident||Browser.Engine.presto){var cm=document["compatMode"];if(cm=="BackCompat"||cm=="QuirksMode"){result='border-box';}else{result='content-box';}}else{if(arguments.length===0){node=document.documentElement;}
var sizing=this.getStyle("-moz-box-sizing");if(!sizing){sizing=this.getStyle("box-sizing");}
result=(sizing?sizing:'content-box');}
return result;},getContentBoxSize:function(){var w=this.offsetWidth;var h=this.offsetHeight;var padding=this.getPaddingSize();var border=this.getBorderSize();w=w-padding.left-padding.right-border.left-border.right;h=h-padding.bottom-padding.top-border.bottom-border.top;return{width:w,height:h};},getBorderBoxSize:function(){var w=this.offsetWidth;var h=this.offsetHeight;return{width:w,height:h};},getMarginBoxSize:function(){var margins=this.getMarginSize();var w=this.offsetWidth+margins.left+margins.right;var h=this.offsetHeight+margins.top+margins.bottom;return{width:w,height:h};},setContentBoxSize:function(size){if(this.getBoxSizing()=='border-box'){var padding=this.getPaddingSize();var border=this.getBorderSize();if(typeof size.width!='undefined'){var width=(size.width+padding.left+padding.right+border.left+border.right);if(width<0){width=0;}
this.style.width=width+'px';}
if(typeof size.height!='undefined'){var height=(size.height+padding.top+padding.bottom+border.top+border.bottom);if(height<0){height=0;}
this.style.height=height+'px';}}else{if(typeof size.width!='undefined'){this.style.width=size.width+'px';}
if(typeof size.height!='undefined'){this.style.height=size.height+'px';}}},setBorderBoxSize:function(size){if(this.getBoxSizing()=='content-box'){var padding=this.getPaddingSize();var border=this.getBorderSize();var margin=this.getMarginSize();if(typeof size.width!='undefined'){var width=(size.width-padding.left-padding.right-border.left-border.right-margin.left-margin.right);if(width<0){width=0;}
this.style.width=width+'px';}
if(typeof size.height!='undefined'){var height=(size.height-padding.top-padding.bottom-border.top-border.bottom-margin.top-margin.bottom);if(height<0){height=0;}
this.style.height=height+'px';}}else{if(typeof size.width!='undefined'&&size.width>=0){this.style.width=size.width+'px';}
if(typeof size.height!='undefined'&&size.height>=0){this.style.height=size.height+'px';}}},getPaddingSize:function(){var l=Jx.getNumber(this.getStyle('padding-left'));var t=Jx.getNumber(this.getStyle('padding-top'));var r=Jx.getNumber(this.getStyle('padding-right'));var b=Jx.getNumber(this.getStyle('padding-bottom'));return{left:l,top:t,right:r,bottom:b};},getBorderSize:function(){var l=Jx.getNumber(this.getStyle('border-left-width'));var t=Jx.getNumber(this.getStyle('border-top-width'));var r=Jx.getNumber(this.getStyle('border-right-width'));var b=Jx.getNumber(this.getStyle('border-bottom-width'));return{left:l,top:t,right:r,bottom:b};},getMarginSize:function(){var l=Jx.getNumber(this.getStyle('margin-left'));var t=Jx.getNumber(this.getStyle('margin-top'));var r=Jx.getNumber(this.getStyle('margin-right'));var b=Jx.getNumber(this.getStyle('margin-bottom'));return{left:l,top:t,right:r,bottom:b};},descendantOf:function(node){var parent=$(this.parentNode);while(parent!=node&&parent&&parent.parentNode&&parent.parentNode!=parent){parent=$(parent.parentNode);}
return parent==node;},findElement:function(type){var o=this;var tagName=o.tagName;while(o.tagName!=type&&o&&o.parentNode&&o.parentNode!=o){o=$(o.parentNode);}
return o.tagName==type?o:false;}});Jx.ContentLoader=new Class({contentIsLoaded:false,loadContent:function(element){element=$(element);if(this.options.content){var c;if(this.options.content.domObj){c=$(this.options.content.domObj);}else{c=$(this.options.content);}
if(c){if(this.options.content.addTo){this.options.content.addTo(element);}else{element.appendChild(c);}
this.contentIsLoaded=true;}else{element.innerHTML=this.options.content;this.contentIsLoaded=true;}}else if(this.options.contentURL){this.contentIsLoaded=false;this.req=new Request({url:this.options.contentURL,method:'get',evalScripts:true,onSuccess:(function(html){element.innerHTML=html;this.contentIsLoaded=true;if(Jx.isAir){$clear(this.reqTimeout);}
this.fireEvent('contentLoaded',this);}).bind(this),onFailure:(function(){this.contentIsLoaded=true;this.fireEvent('contentLoadFailed',this);}).bind(this),headers:{'If-Modified-Since':'Sat, 1 Jan 2000 00:00:00 GMT'}});this.req.send();if(Jx.isAir){var timeout=$defined(this.options.timeout)?this.options.timeout:10000;this.reqTimeout=this.checkRequest.delay(timeout,this);}}else{this.contentIsLoaded=true;}
if(this.options.contentId){element.id=this.options.contentId;}
if(this.contentIsLoaded){this.fireEvent('contentLoaded',this);}},processContent:function(element){$A(element.childNodes).each(function(node){if(node.tagName=='INPUT'||node.tagName=='SELECT'||node.tagName=='TEXTAREA'){if(node.type=='button'){node.addEvent('click',function(){this.fireEvent('click',this,node);});}else{node.addEvent('change',function(){this.fireEvent('change',node);});}}else{if(node.childNodes){this.processContent(node);}}},this);}});if(Jx.isAir){Jx.ContentLoader.implement({checkRequest:function(){if(this.req.xhr.readyState===1){$clear(this.reqTimeout);this.req.cancel();this.contentIsLoaded=true;this.fireEvent('contentLoadFailed',this);}}});}
Jx.AutoPosition=new Class({position:function(element,relative,options){element=$(element);relative=$(relative);var hor=$splat(options.horizontal||['center center']);var ver=$splat(options.vertical||['center center']);var offsets=$merge({top:0,right:0,bottom:0,left:0},options.offsets||{});var coords=relative.getCoordinates();var page;var scroll;if(!$(element.parentNode)||element.parentNode==document.body){page=Jx.getPageDimensions();scroll=$(document.body).getScroll();}else{page=$(element.parentNode).getContentBoxSize();scroll=$(element.parentNode).getScroll();}
if(relative==document.body){coords.left+=scroll.x;coords.top+=scroll.y;}else if(element.parentNode==relative){coords.left=0;coords.top=0;}
var size=element.getMarginBoxSize();var left;var right;var top;var bottom;var n;if(!hor.some(function(opt){var parts=opt.split(' ');if(parts.length!=2){return false;}
if(!isNaN(parseInt(parts[0],10))){n=parseInt(parts[0],10);if(n>=0){left=n;}else{left=coords.left+coords.width+n;}}else{switch(parts[0]){case'right':left=coords.left+coords.width;break;case'center':left=coords.left+Math.round(coords.width/2);break;case'left':default:left=coords.left;break;}}
if(!isNaN(parseInt(parts[1],10))){n=parseInt(parts[1],10);if(n<0){right=left+n;left=right-size.width;}else{left+=n;right=left+size.width;}
right=coords.left+coords.width+parseInt(parts[1],10);left=right-size.width;}else{switch(parts[1]){case'left':left-=offsets.left;right=left+size.width;break;case'right':left+=offsets.right;right=left;left=left-size.width;break;case'center':default:left=left-Math.round(size.width/2);right=left+size.width;break;}}
return(left>=scroll.x&&right<=scroll.x+page.width);})){if(right>page.width){left=scroll.x+page.width-size.width;}
if(left<0){left=0;}}
element.setStyle('left',left);if(!ver.some(function(opt){var parts=opt.split(' ');if(parts.length!=2){return false;}
if(!isNaN(parseInt(parts[0],10))){top=parseInt(parts[0],10);}else{switch(parts[0]){case'bottom':top=coords.top+coords.height;break;case'center':top=coords.top+Math.round(coords.height/2);break;case'top':default:top=coords.top;break;}}
if(!isNaN(parseInt(parts[1],10))){var n=parseInt(parts[1],10);if(n>=0){top+=n;bottom=top+size.height;}else{bottom=top+n;top=bottom-size.height;}}else{switch(parts[1]){case'top':top-=offsets.top;bottom=top+size.height;break;case'bottom':top+=offsets.bottom;bottom=top;top=top-size.height;break;case'center':default:top=top-Math.round(size.height/2);bottom=top+size.height;break;}}
return(top>=scroll.y&&bottom<=scroll.y+page.height);})){if(bottom>page.height){top=scroll.y+page.height-size.height;}
if(top<0){top=0;}}
element.setStyle('top',top);var jxl=element.retrieve('jxLayout');if(jxl){jxl.options.left=left;jxl.options.top=top;}}});Jx.Chrome=new Class({chrome:null,makeChrome:function(element){var c=new Element('div',{'class':'jxChrome',events:{contextmenu:function(e){e.stop();}}});element.adopt(c);this.chromeOffsets=c.getPaddingSize();c.setStyle('padding',0);var src=c.getStyle('backgroundImage');if(!(src.contains('http://')||src.contains('https://')||src.contains('file://')||src.contains('app:/'))){src=null;}else{src=src.slice(4,-1);if(src.charAt(0)=='"'){src=src.slice(1,-1);}
c.setStyle('backgroundImage','none');['TR','TL','BL','BR'].each(function(s){c.adopt(new Element('div',{'class':'jxChrome'+s}).adopt(new Element('img',{'class':'png24',src:src,alt:'',title:''})));},this);}
if(!window.opera){c.adopt(Jx.createIframeShim());}
c.dispose();this.chrome=c;},showChrome:function(element){element=$(element);if(!this.chrome){this.makeChrome(element);}
this.resizeChrome(element);if(element&&this.chrome.parentNode!==element){element.adopt(this.chrome);}},hideChrome:function(){if(this.chrome){this.chrome.dispose();}},resizeChrome:function(o){if(this.chrome&&Browser.Engine.trident){this.chrome.setContentBoxSize($(o).getBorderBoxSize());}}});Jx.Addable=new Class({addable:null,addTo:function(reference,where){$(this.addable||this.domObj).inject(reference,where);this.fireEvent('addTo',this);return this;},toElement:function(){return this.addable||this.domObj;}});Jx.Button=new Class({Family:'Jx.Button',Implements:[Options,Events,Jx.Addable],domObj:null,options:{id:'',type:'Button',image:'',tooltip:'',label:'',toggle:false,toggleClass:'Toggle',halign:'center',valign:'middle',active:false,enabled:true,container:'div'},initialize:function(options){this.setOptions(options);var d=new Element(this.options.container,{'class':'jx'+this.options.type+'Container'});if(this.options.toggle&&this.options.toggleClass){d.addClass('jx'+this.options.type+this.options.toggleClass);}
var hasFocus;var mouseDown;var a=new Element('a',{'class':'jx'+this.options.type,href:'javascript:void(0)',title:this.options.tooltip,alt:this.options.tooltip,events:{click:this.clicked.bindWithEvent(this),drag:(function(e){e.stop();}).bindWithEvent(this),mousedown:(function(e){this.domA.addClass('jx'+this.options.type+'Pressed');hasFocus=true;mouseDown=true;this.focus();}).bindWithEvent(this),mouseup:(function(e){this.domA.removeClass('jx'+this.options.type+'Pressed');mouseDown=false;}).bindWithEvent(this),mouseleave:(function(e){this.domA.removeClass('jx'+this.options.type+'Pressed');}).bindWithEvent(this),mouseenter:(function(e){if(hasFocus&&mouseDown){this.domA.addClass('jx'+this.options.type+'Pressed');}}).bindWithEvent(this),keydown:(function(e){if(e.key=='enter'){this.domA.addClass('jx'+this.options.type+'Pressed');}}).bindWithEvent(this),keyup:(function(e){if(e.key=='enter'){this.domA.removeClass('jx'+this.options.type+'Pressed');}}).bindWithEvent(this),blur:function(){hasFocus=false;}}});d.adopt(a);if(typeof Drag!='undefined'){new Drag(a,{onStart:function(){this.stop();}});}
var s=new Element('span',{'class':'jx'+this.options.type+'Content'});a.adopt(s);if(this.options.image||!this.options.label){var i=new Element('img',{'class':'jx'+this.options.type+'Icon','src':Jx.aPixel.src,title:this.options.tooltip,alt:this.options.tooltip});if(this.options.image&&this.options.image.indexOf('a_pixel.png')==-1){i.setStyle('backgroundImage',"url("+this.options.image+")");}
s.appendChild(i);if(this.options.imageClass){i.addClass(this.options.imageClass);}
this.domImg=i;}
var l=new Element('span',{html:this.options.label});if(this.options.label){l.addClass('jx'+this.options.type+'Label');}
s.appendChild(l);if(this.options.id){d.id=this.options.id;}
if(this.options.halign=='left'){d.addClass('jx'+this.options.type+'ContentLeft');}
if(this.options.valign=='top'){d.addClass('jx'+this.options.type+'ContentTop');}
this.domA=a;this.domLabel=l;this.domObj=d;this.setEnabled(this.options.enabled);if(this.options.active){this.options.active=false;this.setActive(true);}},clicked:function(evt){if(this.options.enabled){if(this.options.toggle){this.setActive(!this.options.active);}else{this.fireEvent('click',{obj:this,event:evt});}}},isEnabled:function(){return this.options.enabled;},setEnabled:function(enabled){this.options.enabled=enabled;if(this.options.enabled){this.domObj.removeClass('jxDisabled');}else{this.domObj.addClass('jxDisabled');}},isActive:function(){return this.options.active;},setActive:function(active){if(this.options.active==active){return;}
this.options.active=active;if(this.options.active){this.domA.addClass('jx'+this.options.type+'Active');this.fireEvent('down',this);}else{this.domA.removeClass('jx'+this.options.type+'Active');this.fireEvent('up',this);}},setImage:function(path){this.options.image=path;if(path){if(!this.domImg){var i=new Element('img',{'class':'jx'+this.options.type+'Icon','src':Jx.aPixel.src,alt:'',title:''});if(this.options.imageClass){i.addClass(this.options.imageClass);}
this.domA.firstChild.grab(i,'top');this.domImg=i;}
this.domImg.setStyle('backgroundImage',"url("+this.options.image+")");}else if(this.domImg){this.domImg.dispose();this.domImg=null;}},setLabel:function(label){this.domLabel.set('html',label);if(!label&&this.domLabel.hasClass('jxButtonLabel')){this.domLabel.removeClass('jxButtonLabel');}else if(label&&!this.domLabel.hasClass('jxButtonLabel')){this.domLabel.addClass('jxButtonLabel');}},getLabel:function(){return this.domLabel?this.domLabel.innerHTML:'';},setTooltip:function(tooltip){if(this.domA){this.domA.set({'title':tooltip,'alt':tooltip});}},focus:function(){this.domA.focus();},blur:function(){this.domA.blur();}});Jx.Button.Flyout=new Class({Family:'Jx.Button.Flyout',Extends:Jx.Button,Implements:[Jx.ContentLoader,Jx.AutoPosition,Jx.Chrome],content:null,initialize:function(options){if(!Jx.Button.Flyout.Stack){Jx.Button.Flyout.Stack=[];}
this.parent(options);this.domA.addClass('jx'+this.options.type+'Flyout');this.contentContainer=new Element('div',{'class':'jxFlyout'});this.content=new Element('div',{'class':'jxFlyoutContent'});if(this.options.contentClass){this.content.addClass(this.options.contentClass);}
this.contentContainer.adopt(this.content);this.content.store('jxFlyout',this);this.loadContent(this.content);this.keypressWatcher=this.keypressHandler.bindWithEvent(this);this.hideWatcher=this.clickHandler.bindWithEvent(this);},clicked:function(e){if(!this.options.enabled){return;}
if(!this.owner){this.owner=document.body;var node=$(this.domObj.parentNode);while(node!=document.body&&this.owner==document.body){var flyout=node.retrieve('jxFlyout');if(flyout){this.owner=flyout;break;}else{node=$(node.parentNode);}}}
if(Jx.Button.Flyout.Stack[Jx.Button.Flyout.Stack.length-1]==this){this.hide();return;}else if(this.owner!=document.body){if(this.owner.currentFlyout==this){this.hide();return;}else if(this.owner.currentFlyout){this.owner.currentFlyout.hide();}
this.owner.currentFlyout=this;}else{while(Jx.Button.Flyout.Stack.length){Jx.Button.Flyout.Stack[Jx.Button.Flyout.Stack.length-1].hide();}}
Jx.Button.Flyout.Stack.push(this);this.options.active=true;this.domA.addClass('jx'+this.options.type+'Active');this.contentContainer.setStyle('visibility','hidden');$(document.body).adopt(this.contentContainer);this.content.getChildren().each(function(child){if(child.resize){child.resize();}});this.showChrome(this.contentContainer);this.position(this.contentContainer,this.domObj,{horizontal:['left left','right right'],vertical:['bottom top','top bottom'],offsets:this.chromeOffsets});this.contentContainer.setContentBoxSize($(this.content).getMarginBoxSize());this.contentContainer.setStyle('visibility','');document.addEvent('keydown',this.keypressWatcher);document.addEvent('click',this.hideWatcher);this.fireEvent('open',this);},hide:function(){if(this.owner!=document.body){this.owner.currentFlyout=null;}
Jx.Button.Flyout.Stack.pop();this.setActive(false);this.contentContainer.dispose();document.removeEvent('keydown',this.keypressWatcher);document.removeEvent('click',this.hideWatcher);this.fireEvent('close',this);},clickHandler:function(e){e=new Event(e);var elm=$(e.target);var flyout=Jx.Button.Flyout.Stack[Jx.Button.Flyout.Stack.length-1];if(!elm.descendantOf(flyout.content)&&!elm.descendantOf(flyout.domObj)){flyout.hide();}},keypressHandler:function(e){e=new Event(e);if(e.key=='esc'){Jx.Button.Flyout.Stack[Jx.Button.Flyout.Stack.length-1].hide();}}});Jx.Layout=new Class({Family:'Jx.Layout',Implements:[Options,Events],options:{propagate:true,position:'absolute',left:0,right:0,top:0,bottom:0,width:null,height:null,minWidth:0,minHeight:0,maxWidth:-1,maxHeight:-1},initialize:function(domObj,options){this.setOptions(options);this.domObj=$(domObj);this.domObj.resize=this.resize.bind(this);this.domObj.setStyle('position',this.options.position);this.domObj.store('jxLayout',this);if(document.body==this.domObj.parentNode){window.addEvent('resize',this.windowResize.bindWithEvent(this));window.addEvent('load',this.windowResize.bind(this));}},windowResize:function(){this.resize();if(this.resizeTimer){$clear(this.resizeTimer);this.resizeTimer=null;}
this.resizeTimer=this.resize.delay(50,this);},resize:function(options){this.resizeTimer=null;var needsResize=false;if(options){for(var i in options){if(i=='forceResize'){continue;}
if(this.options[i]!=options[i]){needsResize=true;this.options[i]=options[i];}}
if(options.forceResize){needsResize=true;}}
if(!$(this.domObj.parentNode)){return;}
var parentSize;if(this.domObj.parentNode.tagName=='BODY'){parentSize=Jx.getPageDimensions();}else{parentSize=$(this.domObj.parentNode).getContentBoxSize();}
if(this.lastParentSize&&!needsResize){needsResize=(this.lastParentSize.width!=parentSize.width||this.lastParentSize.height!=parentSize.height);}else{needsResize=true;}
this.lastParentSize=parentSize;if(!needsResize){return;}
var l,t,w,h;if(this.options.left!=null){l=this.options.left;if(this.options.right==null){if(this.options.width==null){w=parentSize.width-l;if(w<this.options.minWidth){w=this.options.minWidth;}
if(this.options.maxWidth>=0&&w>this.options.maxWidth){w=this.options.maxWidth;}}else{w=this.options.width;}}else{if(this.options.width==null){w=parentSize.width-l-this.options.right;if(w<this.options.minWidth){w=this.options.minWidth;}
if(this.options.maxWidth>=0&&w>this.options.maxWidth){w=this.options.maxWidth;}}else{w=this.options.width;}}}else{if(this.options.right==null){if(this.options.width==null){l=0;w=parentSize.width;if(this.options.maxWidth>=0&&w>this.options.maxWidth){l=l+parseInt(w-this.options.maxWidth)/2;w=this.options.maxWidth;}}else{w=this.options.width;l=parseInt((parentSize.width-w)/2);if(l<0){l=0;}}}else{if(this.options.width!=null){w=this.options.width;l=parentSize.width-w-this.options.right;if(l<0){l=0;}}else{l=0;w=parentSize.width-this.options.right;if(w<this.options.minWidth){w=this.options.minWidth;}
if(this.options.maxWidth>=0&&w>this.options.maxWidth){l=w-this.options.maxWidth-this.options.right;w=this.options.maxWidth;}}}}
if(this.options.top!=null){t=this.options.top;if(this.options.bottom==null){if(this.options.height==null){h=parentSize.height-t;if(h<this.options.minHeight){h=this.options.minHeight;}
if(this.options.maxHeight>=0&&h>this.options.maxHeight){h=this.options.maxHeight;}}else{h=this.options.height;if(this.options.maxHeight>=0&&h>this.options.maxHeight){t=h-this.options.maxHeight;h=this.options.maxHeight;}}}else{if(this.options.height==null){h=parentSize.height-t-this.options.bottom;if(h<this.options.minHeight){h=this.options.minHeight;}
if(this.options.maxHeight>=0&&h>this.options.maxHeight){h=this.options.maxHeight;}}else{h=this.options.height;}}}else{if(this.options.bottom==null){if(this.options.height==null){t=0;h=parentSize.height;if(h<this.options.minHeight){h=this.options.minHeight;}
if(this.options.maxHeight>=0&&h>this.options.maxHeight){t=parseInt((parentSize.height-this.options.maxHeight)/2);h=this.options.maxHeight;}}else{h=this.options.height;t=parseInt((parentSize.height-h)/2);if(t<0){t=0;}}}else{if(this.options.height!=null){h=this.options.height;t=parentSize.height-h-this.options.bottom;if(t<0){t=0;}}else{t=0;h=parentSize.height-this.options.bottom;if(h<this.options.minHeight){h=this.options.minHeight;}
if(this.options.maxHeight>=0&&h>this.options.maxHeight){t=parentSize.height-this.options.maxHeight-this.options.bottom;h=this.options.maxHeight;}}}}
var sizeOpts={width:w};if(this.options.position=='absolute'){var padding=$(this.domObj.parentNode).getPaddingSize();this.domObj.setStyles({position:this.options.position,left:l+padding.left,top:t+padding.top});sizeOpts.height=h;}else{if(this.options.height){sizeOpts.height=this.options.height;}}
this.domObj.setBorderBoxSize(sizeOpts);if(this.options.propagate){var o={forceResize:options?options.forceResize:false};$A(this.domObj.childNodes).each(function(child){if(child.resize&&child.getStyle('display')!='none'){child.resize.delay(0,child,o);}});}
this.fireEvent('sizeChange',this);}});Jx.Button.Tab=new Class({Family:'Jx.Button.Tab',Extends:Jx.Button,Implements:[Jx.ContentLoader],content:null,initialize:function(options){this.parent($merge(options,{type:'Tab',toggle:true}));this.content=new Element('div',{'class':'tabContent'});new Jx.Layout(this.content,options);this.loadContent(this.content);var that=this;this.addEvent('down',function(){that.content.addClass('tabContentActive');});this.addEvent('up',function(){that.content.removeClass('tabContentActive');});if(this.options.close){this.domObj.addClass('jxTabClose');var a=new Element('a',{'class':'jxTabClose',events:{'click':(function(){this.fireEvent('close');}).bind(this)}});a.adopt(new Element('img',{src:Jx.aPixel.src,alt:'',title:''}));this.domObj.adopt(a);}},clicked:function(evt){if(this.options.enabled){this.setActive(true);}}});Jx.ColorPalette=new Class({Family:'Jx.ColorPalette',Implements:[Options,Events,Jx.Addable],domObj:null,options:{parent:null,color:'#000000',alpha:1,hexColors:['00','33','66','99','CC','FF'],alphaLabel:'alpha (%)'},initialize:function(options){this.setOptions(options);this.domObj=new Element('div',{id:this.options.id,'class':'jxColorPalette'});var top=new Element('div',{'class':'jxColorBar'});var d=new Element('div',{'class':'jxColorPreview'});this.selectedSwatch=new Element('div',{'class':'jxColorSelected'});this.previewSwatch=new Element('div',{'class':'jxColorHover'});d.adopt(this.selectedSwatch);d.adopt(this.previewSwatch);top.adopt(d);this.colorInputLabel=new Element('label',{'class':'jxColorLabel',html:'#'});top.adopt(this.colorInputLabel);var cc=this.changed.bind(this);this.colorInput=new Element('input',{'class':'jxHexInput','type':'text','maxLength':6,events:{'keyup':cc,'blur':cc,'change':cc}});top.adopt(this.colorInput);this.alphaLabel=new Element('label',{'class':'jxAlphaLabel','html':this.options.alphaLabel});top.adopt(this.alphaLabel);this.alphaInput=new Element('input',{'class':'jxAlphaInput','type':'text','maxLength':3,events:{'keyup':this.alphaChanged.bind(this)}});top.adopt(this.alphaInput);this.domObj.adopt(top);var swatchClick=this.swatchClick.bindWithEvent(this);var swatchOver=this.swatchOver.bindWithEvent(this);var table=new Element('table',{'class':'jxColorGrid'});var tbody=new Element('tbody');table.adopt(tbody);for(var i=0;i<12;i++){var tr=new Element('tr');for(var j=-3;j<18;j++){var bSkip=false;var r,g,b;if(j<0){if(j==-3||j==-1){r=g=b=0;bSkip=true;}else{if(i<6){r=g=b=i;}else{if(i==6){r=5;g=0;b=0;}else if(i==7){r=0;g=5;b=0;}else if(i==8){r=0;g=0;b=5;}else if(i==9){r=5;g=5;b=0;}else if(i==10){r=0;g=5;b=5;}else if(i==11){r=5;g=0;b=5;}}}}else{r=parseInt(i/6)*3+parseInt(j/6);g=j%6;b=i%6;}
var bgColor='#'+this.options.hexColors[r]+this.options.hexColors[g]+this.options.hexColors[b];var td=new Element('td');if(!bSkip){td.setStyle('backgroundColor',bgColor);var a=new Element('a',{'class':'colorSwatch '+(((r>2&&g>2)||(r>2&&b>2)||(g>2&&b>2))?'borderBlack':'borderWhite'),'href':'javascript:void(0)','title':bgColor,'alt':bgColor,events:{'mouseover':swatchOver,'click':swatchClick}});a.store('swatchColor',bgColor);td.adopt(a);}else{td.addClass('emptyCell');var span=new Element('span');td.adopt(span);}
tr.adopt(td);}
tbody.adopt(tr);}
this.domObj.adopt(table);this.updateSelected();if(this.options.parent){this.addTo(this.options.parent);}},swatchOver:function(e){var a=e.target;this.previewSwatch.setStyle('backgroundColor',a.retrieve('swatchColor'));},swatchClick:function(e){var a=e.target;this.options.color=a.retrieve('swatchColor');this.updateSelected();this.fireEvent('click',this);},changed:function(){var color=this.colorInput.value;if(color.substring(0,1)=='#'){color=color.substring(1);}
if(color.toLowerCase().match(/^[0-9a-f]{6}$/)){this.options.color='#'+color.toUpperCase();this.updateSelected();}},alphaChanged:function(){var alpha=this.alphaInput.value;if(alpha.match(/^[0-9]{1,3}$/)){this.options.alpha=parseFloat(alpha/100);this.updateSelected();}},setColor:function(color){this.colorInput.value=color;this.changed();},setAlpha:function(alpha){this.alphaInput.value=alpha;this.alphaChanged();},updateSelected:function(){var styles={'backgroundColor':this.options.color};this.colorInput.value=this.options.color.substring(1);this.alphaInput.value=parseInt(this.options.alpha*100);if(this.options.alpha<1){styles.opacity=this.options.alpha;styles.filter='Alpha(opacity='+(this.options.alpha*100)+')';}else{styles.opacity='';styles.filter='';}
this.selectedSwatch.setStyles(styles);this.previewSwatch.setStyles(styles);this.fireEvent('change',this);}});Jx.Button.Color=new Class({Family:'Jx.Button.Color',Extends:Jx.Button.Flyout,swatch:null,options:{color:'#000000',alpha:100},initialize:function(options){if(!Jx.Button.Color.ColorPalette){Jx.Button.Color.ColorPalette=new Jx.ColorPalette(this.options);}
var d=new Element('span',{'class':'jxButtonSwatch'});this.selectedSwatch=new Element('span');d.appendChild(this.selectedSwatch);this.colorChangeFn=this.changed.bind(this);this.hideFn=this.hide.bind(this);options.image=Jx.aPixel.src;this.parent(options);d.replaces(this.domImg);this.updateSwatch();},clicked:function(){if(Jx.Button.Color.ColorPalette.currentButton){Jx.Button.Color.ColorPalette.currentButton.hide();}
Jx.Button.Color.ColorPalette.currentButton=this;Jx.Button.Color.ColorPalette.addEvent('change',this.colorChangeFn);Jx.Button.Color.ColorPalette.addEvent('click',this.hideFn);this.content.appendChild(Jx.Button.Color.ColorPalette.domObj);Jx.Button.Color.ColorPalette.domObj.setStyle('display','block');Jx.Button.Flyout.prototype.clicked.apply(this,arguments);Jx.Button.Color.ColorPalette.options.color=this.options.color;Jx.Button.Color.ColorPalette.options.alpha=this.options.alpha/100;Jx.Button.Color.ColorPalette.updateSelected();},hide:function(){this.setActive(false);Jx.Button.Color.ColorPalette.removeEvent('change',this.colorChangeFn);Jx.Button.Color.ColorPalette.removeEvent('click',this.hideFn);Jx.Button.Flyout.prototype.hide.apply(this,arguments);Jx.Button.Color.ColorPalette.currentButton=null;},setColor:function(color){this.options.color=color;this.updateSwatch();},setAlpha:function(alpha){this.options.alpha=alpha;this.updateSwatch();},changed:function(panel){var changed=false;if(this.options.color!=panel.options.color){this.options.color=panel.options.color;changed=true;}
if(this.options.alpha!=panel.options.alpha*100){this.options.alpha=panel.options.alpha*100;changed=true;}
if(changed){this.updateSwatch();this.fireEvent('change',this);}},updateSwatch:function(){var styles={'backgroundColor':this.options.color};if(this.options.alpha<100){styles.filter='Alpha(opacity='+(this.options.alpha)+')';styles.opacity=this.options.alpha/100;}else{styles.opacity='';styles.filter='';}
this.selectedSwatch.setStyles(styles);}});Jx.Menu=new Class({Family:'Jx.Menu',Implements:[Options,Events,Jx.AutoPosition,Jx.Chrome,Jx.Addable],domObj:null,button:null,subDomObj:null,items:null,initialize:function(options){this.setOptions(options);if(!Jx.Menu.Menus){Jx.Menu.Menus=[];}
this.items=[];this.contentContainer=new Element('div',{'class':'jxMenuContainer',events:{contextmenu:function(e){e.stop();}}});this.subDomObj=new Element('ul',{'class':'jxMenu'});this.contentContainer.adopt(this.subDomObj);if(options){this.button=new Jx.Button($merge(options,{onClick:this.show.bind(this)}));this.button.domA.addClass('jxButtonMenu');this.button.domA.addEvent('mouseover',this.onMouseOver.bindWithEvent(this));this.domObj=this.button.domObj;}
this.hideWatcher=this.hide.bindWithEvent(this);this.keypressWatcher=this.keypressHandler.bindWithEvent(this);if(this.options.parent){this.addTo(this.options.parent);}},add:function(){$A(arguments).flatten().each(function(item){this.items.push(item);item.setOwner(this);this.subDomObj.adopt(item.domObj);},this);return this;},deactivate:function(){this.hide();},onMouseOver:function(e){if(Jx.Menu.Menus[0]&&Jx.Menu.Menus[0]!=this){this.show({event:e});}},eventInMenu:function(e){var target=$(e.target);if(!target){return false;}
if(target.descendantOf(this.domObj)||target.descendantOf(this.subDomObj)){return true;}else{var ul=target.findElement('ul');if(ul){var sm=ul.retrieve('jxSubMenu');if(sm){var owner=sm.owner;while(owner){if(owner==this){return true;}
owner=owner.owner;}}}
return false;}},hide:function(e){if(e){if(this.visibleItem&&this.visibleItem.eventInMenu){if(this.visibleItem.eventInMenu(e)){return;}}else if(this.eventInMenu(e)){return;}}
if(Jx.Menu.Menus[0]&&Jx.Menu.Menus[0]==this){Jx.Menu.Menus[0]=null;}
if(this.button&&this.button.domA){this.button.domA.removeClass('jx'+this.button.options.type+'Active');}
this.items.each(function(item){item.hide(e);});document.removeEvent('mousedown',this.hideWatcher);document.removeEvent('keydown',this.keypressWatcher);this.contentContainer.setStyle('display','none');this.fireEvent('hide',this);},show:function(o){var e=o.event;if(Jx.Menu.Menus[0]){if(Jx.Menu.Menus[0]!=this){Jx.Menu.Menus[0].button.blur();Jx.Menu.Menus[0].hide(e);}else{this.hide();return;}}
if(this.items.length===0){return;}
Jx.Menu.Menus[0]=this;this.button.focus();this.contentContainer.setStyle('visibility','hidden');this.contentContainer.setStyle('display','block');$(document.body).adopt(this.contentContainer);this.contentContainer.setContentBoxSize(this.subDomObj.getMarginBoxSize());this.showChrome(this.contentContainer);this.position(this.contentContainer,this.button.domObj,{horizontal:['left left'],vertical:['bottom top','top bottom'],offsets:this.chromeOffsets});this.contentContainer.setStyle('visibility','');if(this.button&&this.button.domA){this.button.domA.addClass('jx'+this.button.options.type+'Active');}
if(e){}
document.addEvent('mousedown',this.hideWatcher);document.addEvent('keydown',this.keypressWatcher);this.fireEvent('show',this);},setVisibleItem:function(obj){if(this.visibleItem!=obj){if(this.visibleItem&&this.visibleItem.hide){this.visibleItem.hide();}
this.visibleItem=obj;this.visibleItem.show();}},keypressHandler:function(e){e=new Event(e);if(e.key=='esc'){this.hide();}}});Jx.ButtonSet=new Class({Family:'Jx.ButtonSet',Implements:[Options,Events],buttons:null,initialize:function(options){this.setOptions(options);this.buttons=[];this.buttonChangedHandler=this.buttonChanged.bind(this);},add:function(){$A(arguments).each(function(button){if(button.domObj.hasClass('jx'+button.options.type+'Toggle')){button.domObj.removeClass('jx'+button.options.type+'Toggle');button.domObj.addClass('jx'+button.options.type+'Set');}
button.addEvent('down',this.buttonChangedHandler);var that=this;button.setActive=function(active){if(this.options.active&&that.activeButton==this){return;}else{Jx.Button.prototype.setActive.apply(this,[active]);}};if(!this.activeButton||button.options.active){button.options.active=false;button.setActive(true);}
this.buttons.push(button);},this);return this;},remove:function(button){this.buttons.erase(button);if(this.activeButton==button){if(this.buttons.length){this.buttons[0].setActive(true);}
button.removeEvent('down',this.buttonChangedHandler);button.setActive=Jx.Button.prototype.setActive;}},setActiveButton:function(button){var b=this.activeButton;this.activeButton=button;if(b&&b!=button){b.setActive(false);}},buttonChanged:function(button){this.setActiveButton(button);this.fireEvent('change',this);}});Jx.Button.Multi=new Class({Family:'Jx.Button.Multi',Extends:Jx.Button,activeButton:null,buttons:null,initialize:function(opts){this.parent(opts);this.buttons=[];this.domA.addClass('jxButtonMulti');this.menu=new Jx.Menu();this.menu.button=this;this.buttonSet=new Jx.ButtonSet();this.clickHandler=this.clicked.bind(this);var a=new Element('a',{'class':'jxButtonDisclose','href':'javascript:void(0)'});var button=this;var hasFocus;a.addEvents({'click':(function(e){if(this.items.length===0){return;}
if(!button.options.enabled){return;}
this.contentContainer.setStyle('visibility','hidden');this.contentContainer.setStyle('display','block');$(document.body).adopt(this.contentContainer);this.contentContainer.setContentBoxSize(this.subDomObj.getMarginBoxSize());this.showChrome(this.contentContainer);this.position(this.contentContainer,this.button.domObj,{horizontal:['right right'],vertical:['bottom top','top bottom'],offsets:this.chromeOffsets});this.contentContainer.setStyle('visibility','');document.addEvent('mousedown',this.hideWatcher);document.addEvent('keyup',this.keypressWatcher);this.fireEvent('show',this);}).bindWithEvent(this.menu),'mouseenter':(function(){$(this.domObj.firstChild).addClass('jxButtonHover');if(hasFocus){a.addClass('jx'+this.options.type+'Pressed');}}).bind(this),'mouseleave':(function(){$(this.domObj.firstChild).removeClass('jxButtonHover');a.removeClass('jx'+this.options.type+'Pressed');}).bind(this),mousedown:(function(e){a.addClass('jx'+this.options.type+'Pressed');hasFocus=true;this.focus();}).bindWithEvent(this),mouseup:(function(e){a.removeClass('jx'+this.options.type+'Pressed');}).bindWithEvent(this),keydown:(function(e){if(e.key=='enter'){a.addClass('jx'+this.options.type+'Pressed');}}).bindWithEvent(this),keyup:(function(e){if(e.key=='enter'){a.removeClass('jx'+this.options.type+'Pressed');}}).bindWithEvent(this),blur:function(){hasFocus=false;}});if(typeof Drag!='undefined'){new Drag(a,{onStart:function(){this.stop();}});}
this.menu.addEvents({'show':(function(){this.domA.addClass('jxButtonActive');}).bind(this),'hide':(function(){if(this.options.active){this.domA.addClass('jxButtonActive');}}).bind(this)});a.adopt(new Element('img',{src:Jx.aPixel.src,alt:'',title:''}));this.domObj.adopt(a);this.discloser=a;if(this.options.items){this.add(this.options.items);}},add:function(){$A(arguments).flatten().each(function(theButton){if(!theButton instanceof Jx.Button){return;}
this.buttons.push(theButton);var f=this.setButton.bind(this,theButton);var opts=$merge(theButton.options,{toggle:true,onClick:f});if(!opts.label){opts.label='&nbsp;';}
if(!opts.image||opts.image.indexOf('a_pixel')!=-1){delete opts.image;}
var button=new Jx.Menu.Item(opts);this.buttonSet.add(button);this.menu.add(button);theButton.multiButton=button;theButton.domA.addClass('jxButtonMulti');if(!this.activeButton){this.domA.dispose();this.setActiveButton(theButton);}},this);},remove:function(button){if(!button||!button.multiButton){return;}
if(this.menu.remove(button.multiButton)){button.multiButton=null;if(this.activeButton==button){if(!this.buttons.some(function(b){if(b!=button){this.setActiveButton(b);return true;}else{return false;}},this)){this.setActiveButton(null);}}
this.buttons.erase(button);}},setActiveButton:function(button){if(this.activeButton){this.activeButton.domA.dispose();this.activeButton.domA.removeEvent(this.clickHandler);}
if(button&&button.domA){this.domObj.grab(button.domA,'top');this.domA=button.domA;this.domA.addEvent('click',this.clickHandler);if(this.options.toggle){this.options.active=false;this.setActive(true);}}
this.activeButton=button;},setButton:function(button){this.setActiveButton(button);button.clicked();}});Jx.Menu.Item=new Class({Family:'Jx.Menu.Item',Extends:Jx.Button,owner:null,options:{enabled:true,image:null,label:'&nbsp;',toggleClass:'Toggle'},initialize:function(options){this.parent($merge({image:Jx.aPixel.src},options,{container:'li',type:'MenuItem',toggleClass:(options.image?null:this.options.toggleClass)}));this.domObj.addEvent('mouseover',this.onMouseOver.bindWithEvent(this));},setOwner:function(obj){this.owner=obj;},hide:function(){this.blur();},show:$empty,clicked:function(obj){if(this.options.enabled){if(this.options.toggle){this.setActive(!this.options.active);}
this.fireEvent('click',this);if(this.owner&&this.owner.deactivate){this.owner.deactivate(obj.event);}}},onMouseOver:function(e){if(this.owner&&this.owner.setVisibleItem){this.owner.setVisibleItem(this);}
this.show(e);}});Jx.Button.Combo=new Class({Family:'Jx.Button.Combo',Extends:Jx.Button.Multi,domObj:null,ul:null,currentSelection:null,options:{editable:false,label:''},initialize:function(options){this.parent();this.setOptions(options);this.domA.removeClass('jxButtonMulti');if(this.options.editable){var s=new Element('span',{'class':'jxButton'});s.adopt(this.domA.firstChild);this.domA=s.replaces(this.domA);this.domA.addClass('jxButtonComboDefault');this.domA.addClass('jxButtonEditCombo');this.domInput=new Element('input',{type:'text',events:{change:this.valueChanged.bindWithEvent(this),keydown:this.onKeyPress.bindWithEvent(this),focus:(function(){if(this.domA.hasClass('jxButtonComboDefault')){this.domInput.value='';this.domA.removeClass('jxButtonComboDefault');}}).bind(this)},value:this.options.label});this.domLabel.empty();this.domLabel.addClass('jxComboInput');this.domLabel.adopt(this.domInput);}else{this.discloser.dispose();this.domA.addClass('jxButtonCombo');this.addEvent('click',(function(e){this.discloser.fireEvent('click',e);}).bindWithEvent(this));}
this.buttonSet=new Jx.ButtonSet({onChange:(function(set){var button=set.activeButton;this.domA.removeClass('jxButtonComboDefault');if(this.options.editable){this.domInput.value=button.options.label;}else{var l=button.options.label;if(l=='&nbsp;'){l='';}
this.setLabel(l);}
var img=button.options.image;if(img.indexOf('a_pixel')!=-1){img='';}
this.setImage(img);if(this.options.imageClass&&this.domImg){this.domImg.removeClass(this.options.imageClass);}
if(button.options.imageClass&&this.domImg){this.options.imageClass=button.options.imageClass;this.domImg.addClass(button.options.imageClass);}
this.fireEvent('change',this);}).bind(this)});if(this.options.items){this.add(this.options.items);}
this.setEnabled(this.options.enabled);},setEnabled:function(enabled){this.options.enabled=enabled;if(this.options.enabled){this.domObj.removeClass('jxDisabled');if(this.domInput){this.domInput.disabled=false;}}else{this.domObj.addClass('jxDisabled');if(this.domInput){this.domInput.disabled=true;}}},valueChanged:function(){this.fireEvent('change',this);},onKeyPress:function(e){if(e.key=='enter'){this.valueChanged();}},add:function(){$A(arguments).flatten().each(function(opt){var button=new Jx.Menu.Item($merge(opt,{toggle:true}));this.menu.add(button);this.buttonSet.add(button);},this);},remove:function(idx){},setValue:function(value){if(this.options.editable){this.domInput.value=value;}else{this.setLabel(value);}},getValue:function(){value='';if(this.options.editable){value=this.domInput.value;}else{value=this.getLabel();}
return value;}});Jx.Panel=new Class({Family:'Jx.Panel',Implements:[Options,Events,Jx.ContentLoader,Jx.Addable],toolbarContainers:{top:null,right:null,bottom:null,left:null},options:{position:'absolute',type:'Panel',id:'',label:'&nbsp;',height:null,collapse:true,collapseTooltip:'Collapse/Expand Panel',collapseLabel:'Collapse',expandLabel:'Expand',maximizeTooltip:'Maximize Panel',maximizeLabel:'Maximize',close:false,closeTooltip:'Close Panel',closeLabel:'Close',closed:false,hideTitle:false,toolbars:[]},initialize:function(options){this.setOptions(options);this.toolbars=options?options.toolbars||[]:[];if($defined(this.options.height)&&!$defined(options.position)){this.options.position='relative';}
this.title=new Element('div',{'class':'jx'+this.options.type+'Title'});var i=new Element('img',{'class':'jx'+this.options.type+'Icon',src:Jx.aPixel.src,alt:'',title:''});if(this.options.image){i.setStyle('backgroundImage','url('+this.options.image+')');}
this.title.adopt(i);this.labelObj=new Element('span',{'class':'jx'+this.options.type+'Label',html:this.options.label});this.title.adopt(this.labelObj);var controls=new Element('div',{'class':'jx'+this.options.type+'Controls'});var tbDiv=new Element('div');controls.adopt(tbDiv);this.toolbar=new Jx.Toolbar({parent:tbDiv});this.title.adopt(controls);var that=this;if(this.options.menu){this.menu=new Jx.Menu({image:Jx.aPixel.src});this.menu.domObj.addClass('jx'+this.options.type+'Menu');this.menu.domObj.addClass('jxButtonContentLeft');this.toolbar.add(this.menu);}
if(this.options.collapse){var b=new Jx.Button({image:Jx.aPixel.src,tooltip:this.options.collapseTooltip,onClick:function(){that.toggleCollapse();}});b.domObj.addClass('jx'+this.options.type+'Collapse');this.toolbar.add(b);if(this.menu){var item=new Jx.Menu.Item({label:this.options.collapseLabel,onClick:function(){that.toggleCollapse();}});this.addEvents({collapse:function(){item.setLabel(this.options.expandLabel);},expand:function(){item.setLabel(this.options.collapseLabel);}});this.menu.add(item);}}
if(this.options.maximize){var b=new Jx.Button({image:Jx.aPixel.src,tooltip:this.options.maximizeTooltip,onClick:function(){that.maximize();}});b.domObj.addClass('jx'+this.options.type+'Maximize');this.toolbar.add(b);if(this.menu){var item=new Jx.Menu.Item({label:this.options.maximizeLabel,onClick:function(){that.maximize();}});this.menu.add(item);}}
if(this.options.close){var b=new Jx.Button({image:Jx.aPixel.src,tooltip:this.options.closeTooltip,onClick:function(){that.close();}});b.domObj.addClass('jx'+this.options.type+'Close');this.toolbar.add(b);if(this.menu){var item=new Jx.Menu.Item({label:this.options.closeLabel,onClick:function(){that.close();}});this.menu.add(item);}}
this.title.addEvent('dblclick',function(){that.toggleCollapse();});this.domObj=new Element('div',{'class':'jx'+this.options.type});if(this.options.id){this.domObj.id=this.options.id;}
var jxl=new Jx.Layout(this.domObj,$merge(this.options,{propagate:false}));var layoutHandler=this.layoutContent.bind(this);jxl.addEvent('sizeChange',layoutHandler);if(!this.options.hideTitle){this.domObj.adopt(this.title);}
this.contentContainer=new Element('div',{'class':'jx'+this.options.type+'ContentContainer'});this.domObj.adopt(this.contentContainer);if($type(this.options.toolbars)=='array'){this.options.toolbars.each(function(tb){var position=tb.options.position;var tbc=this.toolbarContainers[position];if(!tbc){var tbc=new Element('div');new Jx.Layout(tbc);this.contentContainer.adopt(tbc);this.toolbarContainers[position]=tbc;}
tb.addTo(tbc);},this);}
this.content=new Element('div',{'class':'jx'+this.options.type+'Content'});this.contentContainer.adopt(this.content);new Jx.Layout(this.contentContainer);new Jx.Layout(this.content);this.loadContent(this.content);this.toggleCollapse(this.options.closed);this.addEvent('addTo',function(){this.domObj.resize();});if(this.options.parent){this.addTo(this.options.parent);}},layoutContent:function(){var titleHeight=0;var top=0;var bottom=0;var left=0;var right=0;var tbc;var tb;var position;if(!this.options.hideTitle&&this.title.parentNode==this.domObj){titleHeight=this.title.getMarginBoxSize().height;}
var domSize=this.domObj.getContentBoxSize();if(domSize.height>titleHeight){this.contentContainer.setStyle('display','block');this.options.closed=false;this.contentContainer.resize({top:titleHeight,height:null,bottom:0});['left','right'].each(function(position){if(this.toolbarContainers[position]){this.toolbarContainers[position].style.width='auto';}},this);['top','bottom'].each(function(position){if(this.toolbarContainers[position]){this.toolbarContainers[position].style.height='';}},this);if($type(this.options.toolbars)=='array'){this.options.toolbars.each(function(tb){position=tb.options.position;tbc=this.toolbarContainers[position];if(Browser.Engine.trident4){var oldParent=$(tbc.parentNode);tbc.style.visibility='hidden';$(document.body).adopt(tbc);}
var size=tbc.getBorderBoxSize();if(Browser.Engine.trident4){oldParent.adopt(tbc);tbc.style.visibility='';}
switch(position){case'top':top=size.height;break;case'bottom':bottom=size.height;break;case'left':left=size.width;break;case'right':right=size.width;break;}},this);}
tbc=this.toolbarContainers['top'];if(tbc){tbc.resize({top:0,left:left,right:right,bottom:null,height:top,width:null});}
tbc=this.toolbarContainers['bottom'];if(tbc){tbc.resize({top:null,left:left,right:right,bottom:0,height:bottom,width:null});}
tbc=this.toolbarContainers['left'];if(tbc){tbc.resize({top:top,left:0,right:null,bottom:bottom,height:null,width:left});}
tbc=this.toolbarContainers['right'];if(tbc){tbc.resize({top:top,left:null,right:0,bottom:bottom,height:null,width:right});}
this.content.resize({top:top,bottom:bottom,left:left,right:right});}else{this.contentContainer.setStyle('display','none');this.options.closed=true;}
this.fireEvent('sizeChange',this);},setLabel:function(s){this.labelObj.innerHTML=s;},getLabel:function(){return this.labelObj.innerHTML;},finalize:function(){this.domObj=null;this.deregisterIds();},maximize:function(){if(this.manager){this.manager.maximizePanel(this);}},setContent:function(html){this.content.innerHTML=html;this.bContentReady=true;},setContentURL:function(url){this.bContentReady=false;this.setBusy(true);if(arguments[1]){this.onContentReady=arguments[1];}
if(url.indexOf('?')==-1){url=url+'?';}
var a=new Request({url:url,method:'get',evalScripts:true,onSuccess:this.panelContentLoaded.bind(this),requestHeaders:['If-Modified-Since','Sat, 1 Jan 2000 00:00:00 GMT']}).send();},panelContentLoaded:function(html){this.content.innerHTML=html;this.bContentReady=true;this.setBusy(false);if(this.onContentReady){window.setTimeout(this.onContentReady.bind(this),1);}},setBusy:function(isBusy){this.busyCount+=isBusy?1:-1;if(this.loadingObj){this.loadingObj.img.style.visibility=(this.busyCount>0)?'visible':'hidden';}},toggleCollapse:function(state){if($defined(state)){this.options.closed=state;}else{this.options.closed=!this.options.closed;}
if(this.options.closed){if(!this.domObj.hasClass('jx'+this.options.type+'Min')){this.domObj.addClass('jx'+this.options.type+'Min');this.contentContainer.setStyle('display','none');var margin=this.domObj.getMarginSize();var height=margin.top+margin.bottom;if(this.title.parentNode==this.domObj){height+=this.title.getMarginBoxSize().height;}
this.domObj.resize({height:height});this.fireEvent('collapse',this);}}else{if(this.domObj.hasClass('jx'+this.options.type+'Min')){this.domObj.removeClass('jx'+this.options.type+'Min');this.contentContainer.setStyle('display','block');this.domObj.resize({height:this.options.height});this.fireEvent('expand',this);}}},close:function(){this.domObj.dispose();this.fireEvent('close',this);}});Jx.SnePanel=new Class({Family:'Jx.Panel',Implements:[Options,Events,Jx.ContentLoader,Jx.Addable],toolbarContainers:{top:null,right:null,bottom:null,left:null},options:{position:'absolute',type:'Panel',id:'',label:'&nbsp;',height:null,collapse:true,collapseTooltip:'Collapse/Expand Panel',collapseLabel:'Collapse',expandLabel:'Expand',maximizeTooltip:'Maximize Panel',maximizeLabel:'Maximize',close:false,closeTooltip:'Close Panel',closeLabel:'Close',closed:false,hideTitle:false,toolbars:[]},initialize:function(options){this.setOptions(options);this.toolbars=options?options.toolbars||[]:[];if($defined(this.options.height)&&!$defined(options.position)){this.options.position='relative';}
this.title=new Element('div',{'class':'jx'+this.options.type+'Title'});var i=new Element('img',{'class':'jx'+this.options.type+'Icon',src:Jx.aPixel.src,alt:'',title:''});if(this.options.image){i.setStyle('backgroundImage','url('+this.options.image+')');}
this.title.adopt(i);this.labelObj=new Element('span',{'class':'jx'+this.options.type+'Label',html:this.options.label});this.title.adopt(this.labelObj);var controls=new Element('div',{'class':'jx'+this.options.type+'Controls'});var tbDiv=new Element('div');controls.adopt(tbDiv);this.toolbar=new Jx.Toolbar({parent:tbDiv});this.title.adopt(controls);var that=this;if(this.options.menu){this.menu=new Jx.Menu({image:Jx.aPixel.src});this.menu.domObj.addClass('jx'+this.options.type+'Menu');this.menu.domObj.addClass('jxButtonContentLeft');this.toolbar.add(this.menu);}
if(this.options.collapse){var b=new Jx.Button({image:Jx.aPixel.src,tooltip:this.options.collapseTooltip,onClick:function(){that.toggleCollapse();}});b.domObj.addClass('jx'+this.options.type+'Collapse');this.toolbar.add(b);if(this.menu){var item=new Jx.Menu.Item({label:this.options.collapseLabel,onClick:function(){that.toggleCollapse();}});this.addEvents({collapse:function(){item.setLabel(this.options.expandLabel);},expand:function(){item.setLabel(this.options.collapseLabel);}});this.menu.add(item);}}
if(this.options.maximize){var b=new Jx.Button({image:Jx.aPixel.src,tooltip:this.options.maximizeTooltip,onClick:function(){that.maximize();}});b.domObj.addClass('jx'+this.options.type+'Maximize');this.toolbar.add(b);if(this.menu){var item=new Jx.Menu.Item({label:this.options.maximizeLabel,onClick:function(){that.maximize();}});this.menu.add(item);}}
if(this.options.close){var b=new Jx.Button({image:Jx.aPixel.src,tooltip:this.options.closeTooltip,onClick:function(){that.close();}});b.domObj.addClass('jx'+this.options.type+'Close');this.toolbar.add(b);if(this.menu){var item=new Jx.Menu.Item({label:this.options.closeLabel,onClick:function(){that.close();}});this.menu.add(item);}}
this.title.addEvent('click',function(){that.toggleCollapse();});this.domObj=new Element('div',{'class':'jx'+this.options.type});if(this.options.id){this.domObj.id=this.options.id;}
var jxl=new Jx.Layout(this.domObj,$merge(this.options,{propagate:false}));var layoutHandler=this.layoutContent.bind(this);jxl.addEvent('sizeChange',layoutHandler);if(!this.options.hideTitle){this.domObj.adopt(this.title);}
this.contentContainer=new Element('div',{'class':'jx'+this.options.type+'ContentContainer'});this.domObj.adopt(this.contentContainer);if($type(this.options.toolbars)=='array'){this.options.toolbars.each(function(tb){var position=tb.options.position;var tbc=this.toolbarContainers[position];if(!tbc){var tbc=new Element('div');new Jx.Layout(tbc);this.contentContainer.adopt(tbc);this.toolbarContainers[position]=tbc;}
tb.addTo(tbc);},this);}
this.content=new Element('div',{'class':'jx'+this.options.type+'Content'});this.contentContainer.adopt(this.content);new Jx.Layout(this.contentContainer);new Jx.Layout(this.content);this.loadContent(this.content);this.toggleCollapse(this.options.closed);this.addEvent('addTo',function(){this.domObj.resize();});if(this.options.parent){this.addTo(this.options.parent);}},layoutContent:function(){var titleHeight=0;var top=0;var bottom=0;var left=0;var right=0;var tbc;var tb;var position;if(!this.options.hideTitle&&this.title.parentNode==this.domObj){titleHeight=this.title.getMarginBoxSize().height;}
var domSize=this.domObj.getContentBoxSize();if(domSize.height>titleHeight){this.contentContainer.setStyle('display','block');this.options.closed=false;this.contentContainer.resize({top:titleHeight,height:null,bottom:0});['left','right'].each(function(position){if(this.toolbarContainers[position]){this.toolbarContainers[position].style.width='auto';}},this);['top','bottom'].each(function(position){if(this.toolbarContainers[position]){this.toolbarContainers[position].style.height='';}},this);if($type(this.options.toolbars)=='array'){this.options.toolbars.each(function(tb){position=tb.options.position;tbc=this.toolbarContainers[position];if(Browser.Engine.trident4){var oldParent=$(tbc.parentNode);tbc.style.visibility='hidden';$(document.body).adopt(tbc);}
var size=tbc.getBorderBoxSize();if(Browser.Engine.trident4){oldParent.adopt(tbc);tbc.style.visibility='';}
switch(position){case'top':top=size.height;break;case'bottom':bottom=size.height;break;case'left':left=size.width;break;case'right':right=size.width;break;}},this);}
tbc=this.toolbarContainers['top'];if(tbc){tbc.resize({top:0,left:left,right:right,bottom:null,height:top,width:null});}
tbc=this.toolbarContainers['bottom'];if(tbc){tbc.resize({top:null,left:left,right:right,bottom:0,height:bottom,width:null});}
tbc=this.toolbarContainers['left'];if(tbc){tbc.resize({top:top,left:0,right:null,bottom:bottom,height:null,width:left});}
tbc=this.toolbarContainers['right'];if(tbc){tbc.resize({top:top,left:null,right:0,bottom:bottom,height:null,width:right});}
this.content.resize({top:top,bottom:bottom,left:left,right:right});}else{this.contentContainer.setStyle('display','none');this.options.closed=true;}
this.fireEvent('sizeChange',this);},setLabel:function(s){this.labelObj.innerHTML=s;},getLabel:function(){return this.labelObj.innerHTML;},finalize:function(){this.domObj=null;this.deregisterIds();},maximize:function(){if(this.manager){this.manager.maximizePanel(this);}},setContent:function(html){this.content.innerHTML=html;this.bContentReady=true;},setContentURL:function(url){this.bContentReady=false;this.setBusy(true);if(arguments[1]){this.onContentReady=arguments[1];}
if(url.indexOf('?')==-1){url=url+'?';}
var a=new Request({url:url,method:'get',evalScripts:true,onSuccess:this.panelContentLoaded.bind(this),requestHeaders:['If-Modified-Since','Sat, 1 Jan 2000 00:00:00 GMT']}).send();},panelContentLoaded:function(html){this.content.innerHTML=html;this.bContentReady=true;this.setBusy(false);if(this.onContentReady){window.setTimeout(this.onContentReady.bind(this),1);}},setBusy:function(isBusy){this.busyCount+=isBusy?1:-1;if(this.loadingObj){this.loadingObj.img.style.visibility=(this.busyCount>0)?'visible':'hidden';}},toggleCollapse:function(state){if($defined(state)){this.options.closed=state;}else{this.options.closed=!this.options.closed;}
if(this.options.closed){if(!this.domObj.hasClass('jx'+this.options.type+'Min')){this.domObj.addClass('jx'+this.options.type+'Min');this.contentContainer.setStyle('display','none');var margin=this.domObj.getMarginSize();var height=margin.top+margin.bottom;if(this.title.parentNode==this.domObj){height+=this.title.getMarginBoxSize().height;}
this.domObj.resize({height:height});this.fireEvent('collapse',this);}}else{if(this.domObj.hasClass('jx'+this.options.type+'Min')){this.domObj.removeClass('jx'+this.options.type+'Min');this.contentContainer.setStyle('display','block');this.domObj.resize({height:this.options.height});this.fireEvent('expand',this);}}},close:function(){this.domObj.dispose();this.fireEvent('close',this);}});Jx.Dialog=new Class({Family:'Jx.Dialog',Extends:Jx.Panel,Implements:[Jx.AutoPosition,Jx.Chrome],blanket:null,options:{modal:true,position:'absolute',width:250,height:250,horizontal:'center center',vertical:'center center',label:'New Dialog',id:'',parent:null,resize:false,resizeTooltip:'',move:true,close:true},initialize:function(options){this.isOpening=false;this.firstShow=true;this.parent($merge({parent:document.body},options,{type:'Dialog',position:'absolute'}));this.options.parent=$(this.options.parent);if(this.options.modal){this.blanket=new Element('div',{'class':'jxDialogModal',styles:{display:'none',zIndex:-1}});this.blanket.resize=(function(){var ss=$(document.body).getScrollSize();this.setStyles({width:ss.x,height:ss.y});}).bind(this.blanket);this.options.parent.adopt(this.blanket);window.addEvent('resize',this.blanket.resize);}
this.domObj.setStyle('display','none');this.options.parent.adopt(this.domObj);if(this.options.move&&typeof Drag!='undefined'){this.title.addClass('jxDialogMoveable');new Drag(this.domObj,{handle:this.title,onBeforeStart:(function(){Jx.Dialog.orderDialogs(this);}).bind(this),onStart:(function(){this.contentContainer.setStyle('visibility','hidden');this.chrome.addClass('jxChromeDrag');}).bind(this),onComplete:(function(){this.chrome.removeClass('jxChromeDrag');this.contentContainer.setStyle('visibility','');var left=Math.max(this.chromeOffsets.left,parseInt(this.domObj.style.left,10));var top=Math.max(this.chromeOffsets.top,parseInt(this.domObj.style.top,10));this.options.horizontal=left+' left';this.options.vertical=top+' top';this.position(this.domObj,this.options.parent,this.options);this.options.left=parseInt(this.domObj.style.left,10);this.options.top=parseInt(this.domObj.style.top,10);if(!this.options.closed){this.domObj.resize(this.options);}}).bind(this)});}
if(this.options.resize&&typeof Drag!='undefined'){this.resizeHandle=new Element('div',{'class':'jxDialogResize',title:this.options.resizeTooltip,styles:{'display':this.options.closed?'none':'block'}});this.domObj.appendChild(this.resizeHandle);this.resizeHandleSize=this.resizeHandle.getSize();this.resizeHandle.setStyles({bottom:this.resizeHandleSize.height,right:this.resizeHandleSize.width});this.domObj.makeResizable({handle:this.resizeHandle,onStart:(function(){this.contentContainer.setStyle('visibility','hidden');this.chrome.addClass('jxChromeDrag');}).bind(this),onDrag:(function(){this.resizeChrome(this.domObj);}).bind(this),onComplete:(function(){this.chrome.removeClass('jxChromeDrag');var size=this.domObj.getMarginBoxSize();this.options.width=size.width;this.options.height=size.height;this.layoutContent();this.domObj.resize(this.options);this.contentContainer.setStyle('visibility','');this.fireEvent('resize');this.resizeChrome(this.domObj);}).bind(this)});}
this.domObj.addEvent('mousedown',(function(){Jx.Dialog.orderDialogs(this);}).bind(this));},resize:function(width,height,autoPosition){this.options.width=width;this.options.height=height;if(this.domObj.getStyle('display')!='none'){this.layoutContent();this.domObj.resize(this.options);this.fireEvent('resize');this.resizeChrome(this.domObj);if(autoPosition){this.position(this.domObj,this.options.parent,this.options);}}else{this.firstShow=false;}},sizeChanged:function(){if(!this.options.closed){this.layoutContent();}},toggleCollapse:function(state){if($defined(state)){this.options.closed=state;}else{this.options.closed=!this.options.closed;}
if(this.options.closed){if(!this.domObj.hasClass('jx'+this.options.type+'Min')){this.domObj.addClass('jx'+this.options.type+'Min');}
this.contentContainer.setStyle('display','none');if(this.resizeHandle){this.resizeHandle.setStyle('display','none');}}else{if(this.domObj.hasClass('jx'+this.options.type+'Min')){this.domObj.removeClass('jx'+this.options.type+'Min');}
this.contentContainer.setStyle('display','block');if(this.resizeHandle){this.resizeHandle.setStyle('display','block');}}
if(this.options.closed){var margin=this.domObj.getMarginSize();var size=this.title.getMarginBoxSize();this.domObj.resize({height:margin.top+size.height+margin.bottom});this.fireEvent('collapse');}else{this.domObj.resize(this.options);this.fireEvent('expand');}
this.showChrome(this.domObj);},show:function(){this.domObj.setStyles({'display':'block','visibility':'hidden'});if(this.blanket){this.blanket.resize();}
Jx.Dialog.orderDialogs(this);if(this.blanket){this.blanket.setStyles({visibility:'visible',display:'block'});}
if(this.options.closed){var margin=this.domObj.getMarginSize();var size=this.title.getMarginBoxSize();this.domObj.resize({height:margin.top+size.height+margin.bottom});}else{this.domObj.resize(this.options);}
if(this.firstShow){this.contentContainer.resize({forceResize:true});this.layoutContent();this.firstShow=false;if(this.chrome){this.chrome.dispose();this.chrome=null;}}
this.showChrome(this.domObj);this.position(this.domObj,this.options.parent,this.options);this.domObj.setStyle('visibility','');},hide:function(){Jx.Dialog.Stack.erase(this);Jx.Dialog.ZIndex--;this.domObj.setStyle('display','none');if(this.blanket){this.blanket.setStyle('visibility','hidden');Jx.Dialog.ZIndex--;}},openURL:function(url){if(url){this.options.contentURL=url;this.loadContent(this.content);}
this.open();},open:function(){if(!this.isOpening){this.isOpening=true;}
if(this.contentIsLoaded){this.show();this.fireEvent('open',this);this.isOpening=false;}else{this.addEvent('contentLoaded',this.open.bind(this));}},close:function(){this.isOpening=false;this.hide();this.fireEvent('close');}});Jx.Dialog.Stack=[];Jx.Dialog.BaseZIndex=null;Jx.Dialog.orderDialogs=function(d){Jx.Dialog.Stack.erase(d).push(d);if(Jx.Dialog.BaseZIndex===null){Jx.Dialog.BaseZIndex=Math.max(Jx.Dialog.Stack[0].domObj.getStyle('zIndex').toInt(),1);}
Jx.Dialog.Stack.each(function(d,i){var z=Jx.Dialog.BaseZIndex+(i*2);if(d.blanket){d.blanket.setStyle('zIndex',z-1);}
d.domObj.setStyle('zIndex',z);});};Jx.Splitter=new Class({Family:'Jx.Splitter',Implements:[Options],domObj:null,elements:null,bars:null,firstUpdate:true,options:{useChildren:false,splitInto:2,elements:null,containerOptions:[],barOptions:[],layout:'horizontal',snaps:[],barTooltip:'drag this bar to resize',onStart:null,onFinish:null},initialize:function(domObj,options){this.setOptions(options);this.domObj=$(domObj);this.domObj.addClass('jxSplitContainer');var jxLayout=this.domObj.retrieve('jxLayout');if(jxLayout){jxLayout.addEvent('sizeChange',this.sizeChanged.bind(this));}
this.elements=[];this.bars=[];var nSplits=2;if(this.options.useChildren){this.elements=this.domObj.getChildren();nSplits=this.elements.length;}else{nSplits=this.options.elements?this.options.elements.length:this.options.splitInto;for(var i=0;i<nSplits;i++){var el;if(this.options.elements&&this.options.elements[i]){if(options.elements[i].domObj){el=options.elements[i].domObj;}else{el=$(this.options.elements[i]);}
if(!el){el=this.prepareElement();el.id=this.options.elements[i];}}else{el=this.prepareElement();}
this.elements[i]=el;this.domObj.adopt(this.elements[i]);}}
this.elements.each(function(el){el.addClass('jxSplitArea');});for(var i=0;i<nSplits;i++){var jxl=this.elements[i].retrieve('jxLayout');if(!jxl){new Jx.Layout(this.elements[i],this.options.containerOptions[i]);}else{jxl.resize({position:'absolute'});}}
for(var i=1;i<nSplits;i++){var bar;if(this.options.prepareBar){bar=this.options.prepareBar(i-1);}else{bar=this.prepareBar();}
bar.store('splitterObj',this);bar.store('leftSide',this.elements[i-1]);bar.store('rightSide',this.elements[i]);this.elements[i-1].store('rightBar',bar);this.elements[i].store('leftBar',bar);this.domObj.adopt(bar);this.bars[i-1]=bar;}
if($defined(Drag)){this.establishConstraints();}
for(var i=0;i<this.options.barOptions.length;i++){if(!this.bars[i]){continue;}
var opt=this.options.barOptions[i];if(opt&&opt.snap&&(opt.snap=='before'||opt.snap=='after')){var element;if(opt.snap=='before'){element=this.bars[i].retrieve('leftSide');}else if(opt.snap=='after'){element=this.bars[i].retrieve('rightSide');}
var snap;var snapEvents;if(opt.snapElement){snap=opt.snapElement;snapEvents=opt.snapEvents||['click','dblclick'];}else{snap=this.bars[i];snapEvents=opt.snapEvents||['dblclick'];}
if(!snap.parentNode){this.bars[i].adopt(snap);}
new Jx.Splitter.Snap(snap,element,this,snapEvents);}}
for(var i=0;i<this.options.snaps.length;i++){if(this.options.snaps[i]){new Jx.Splitter.Snap(this.options.snaps[i],this.elements[i],this);}}
this.sizeChanged();},prepareElement:function(){var o=new Element('div',{styles:{position:'absolute'}});return o;},prepareBar:function(){var o=new Element('div',{'class':'jxSplitBar'+this.options.layout.capitalize(),'title':this.options.barTitle});return o;},establishConstraints:function(){var modifiers={x:null,y:null};var fn;if(this.options.layout=='horizontal'){modifiers.x="left";fn=this.dragHorizontal;}else{modifiers.y="top";fn=this.dragVertical;}
if(typeof Drag!='undefined'){this.bars.each(function(bar){var mask;new Drag(bar,{modifiers:modifiers,onSnap:function(obj){obj.addClass('jxSplitBarDrag');},onComplete:(function(obj){mask.destroy();obj.removeClass('jxSplitBarDrag');if(obj.retrieve('splitterObj')!=this){return;}
fn.apply(this,[obj]);}).bind(this),onStart:(function(obj){mask=new Element('div',{'class':'jxSplitterMask'}).inject(obj,'after');if(this.options.onStart){this.options.onStart();}}).bind(this),onFinish:(function(){if(this.options.onFinish){this.options.onFinish();}}).bind(this)});},this);}},dragHorizontal:function(obj){var leftEdge=parseInt(obj.style.left);var leftSide=obj.retrieve('leftSide');var rightSide=obj.retrieve('rightSide');var leftJxl=leftSide.retrieve('jxLayout');var rightJxl=rightSide.retrieve('jxLayout');var paddingLeft=this.domObj.getPaddingSize().left;var rsLeft,rsWidth,rsRight;var size=obj.retrieve('size');if(!size){size=obj.getBorderBoxSize();obj.store('size',size);}
rsLeft=leftEdge+size.width-paddingLeft;var parentSize=this.domObj.getContentBoxSize();if(rightJxl.options.width!=null){rsWidth=rightJxl.options.width+rightJxl.options.left-rsLeft;rsRight=parentSize.width-rsLeft-rsWidth;}else{rsWidth=parentSize.width-rightJxl.options.right-rsLeft;rsRight=rightJxl.options.right;}
if(rsWidth<0){rsWidth=0;}
if(rsWidth<rightJxl.options.minWidth){rsWidth=rightJxl.options.minWidth;}
if(rightJxl.options.maxWidth>=0&&rsWidth>rightJxl.options.maxWidth){rsWidth=rightJxl.options.maxWidth;}
rsLeft=parentSize.width-rsRight-rsWidth;leftEdge=rsLeft-size.width;var lsLeft,lsWidth;lsLeft=leftJxl.options.left;lsWidth=leftEdge-lsLeft;if(lsWidth<0){lsWidth=0;}
if(lsWidth<leftJxl.options.minWidth){lsWidth=leftJxl.options.minWidth;}
if(leftJxl.options.maxWidth>=0&&lsWidth>leftJxl.options.maxWidth){lsWidth=leftJxl.options.maxWidth;}
if(lsLeft+lsWidth!=leftEdge){leftEdge=lsLeft+lsWidth;var delta=leftEdge+size.width-rsLeft;rsLeft+=delta;rsWidth-=delta;}
obj.style.left=paddingLeft+leftEdge+'px';if(leftJxl.options.width==null){var parentSize=this.domObj.getContentBoxSize();leftSide.resize({right:parentSize.width-lsLeft-lsWidth});}else{leftSide.resize({width:lsWidth});}
if(rightJxl.options.width==null){rightSide.resize({left:rsLeft});}else{rightSide.resize({left:rsLeft,width:rsWidth});}},dragVertical:function(obj){var topEdge=parseInt(obj.style.top);var topSide=obj.retrieve('leftSide');var bottomSide=obj.retrieve('rightSide');var topJxl=topSide.retrieve('jxLayout');var bottomJxl=bottomSide.retrieve('jxLayout');var paddingTop=this.domObj.getPaddingSize().top;var size=obj.retrieve('size');if(!size){size=obj.getBorderBoxSize();obj.store('size',size);}
var parentSize=this.domObj.getContentBoxSize();var bsTop,bsHeight,bsBottom;bsTop=topEdge+size.height-paddingTop;if(bottomJxl.options.height!=null){bsHeight=bottomJxl.options.height+bottomJxl.options.top-bsTop;bsBottom=parentSize.height-bsTop-bsHeight;}else{bsHeight=parentSize.height-bottomJxl.options.bottom-bsTop;bsBottom=bottomJxl.options.bottom;}
if(bsHeight<0){bsHeight=0;}
if(bsHeight<bottomJxl.options.minHeight){bsHeight=bottomJxl.options.minHeight;}
if(bottomJxl.options.maxHeight>=0&&bsHeight>bottomJxl.options.maxHeight){bsHeight=bottomJxl.options.maxHeight;}
bsTop=parentSize.height-bsBottom-bsHeight;topEdge=bsTop-size.height;var tsTop,tsHeight;tsTop=topJxl.options.top;tsHeight=topEdge-tsTop;if(tsHeight<0){tsHeight=0;}
if(tsHeight<topJxl.options.minHeight){tsHeight=topJxl.options.minHeight;}
if(topJxl.options.maxHeight>=0&&tsHeight>topJxl.options.maxHeight){tsHeight=topJxl.options.maxHeight;}
if(tsTop+tsHeight!=topEdge){topEdge=tsTop+tsHeight;var delta=topEdge+size.height-bsTop;bsTop+=delta;bsHeight-=delta;}
obj.style.top=paddingTop+topEdge+'px';if(topJxl.options.height==null){topSide.resize({bottom:parentSize.height-tsTop-tsHeight});}else{topSide.resize({height:tsHeight});}
if(bottomJxl.options.height==null){bottomSide.resize({top:bsTop});}else{bottomSide.resize({top:bsTop,height:bsHeight});}},sizeChanged:function(){if(this.options.layout=='horizontal'){this.horizontalResize();}else{this.verticalResize();}},horizontalResize:function(){var availableSpace=this.domObj.getContentBoxSize().width;var overallWidth=availableSpace;for(var i=0;i<this.bars.length;i++){var bar=this.bars[i];var size=bar.retrieve('size');if(!size||size.width==0){size=bar.getBorderBoxSize();bar.store('size',size);}
availableSpace-=size.width;}
var nVariable=0;var jxo;for(var i=0;i<this.elements.length;i++){var e=this.elements[i];jxo=e.retrieve('jxLayout').options;if(jxo.width!=null){availableSpace-=parseInt(jxo.width);}else{var w=0;if(jxo.right!=0||jxo.left!=0){w=e.getBorderBoxSize().width;}
availableSpace-=w;nVariable++;}}
if(nVariable==0){availableSpace+=jxo.width;jxo.width=null;nVariable=1;}
var amount=parseInt(availableSpace/nVariable);var remainder=availableSpace%nVariable;var leftPadding=this.domObj.getPaddingSize().left;var currentPosition=0;for(var i=0;i<this.elements.length;i++){var e=this.elements[i];var jxl=e.retrieve('jxLayout');var jxo=jxl.options;if(jxo.width!=null){jxl.resize({left:currentPosition});currentPosition+=jxo.width;}else{var a=amount;if(nVariable==1){a+=remainder;}
nVariable--;var w=0;if(jxo.right!=0||jxo.left!=0){w=e.getBorderBoxSize().width+a;}else{w=a;}
if(w<0){if(nVariable>0){amount=amount+w/nVariable;}
w=0;}
if(w<jxo.minWidth){if(nVariable>0){amount=amount+(w-jxo.minWidth)/nVariable;}
w=jxo.minWidth;}
if(jxo.maxWidth>=0&&w>jxo.maxWidth){if(nVariable>0){amount=amount+(w-jxo.maxWidth)/nVariable;}
w=e.options.maxWidth;}
var r=overallWidth-currentPosition-w;jxl.resize({left:currentPosition,right:r});currentPosition+=w;}
var rightBar=e.retrieve('rightBar');if(rightBar){rightBar.setStyle('left',leftPadding+currentPosition);currentPosition+=rightBar.retrieve('size').width;}}},verticalResize:function(){var availableSpace=this.domObj.getContentBoxSize().height;var overallHeight=availableSpace;for(var i=0;i<this.bars.length;i++){var bar=this.bars[i];var size=bar.retrieve('size');if(!size||size.height==0){size=bar.getBorderBoxSize();bar.store('size',size);}
availableSpace-=size.height;}
var nVariable=0;var jxo;for(var i=0;i<this.elements.length;i++){var e=this.elements[i];jxo=e.retrieve('jxLayout').options;if(jxo.height!=null){availableSpace-=parseInt(jxo.height);}else{var h=0;if(jxo.bottom!=0||jxo.top!=0){h=e.getBorderBoxSize().height;}
availableSpace-=h;nVariable++;}}
if(nVariable==0){availableSpace+=jxo.height;jxo.height=null;nVariable=1;}
var amount=parseInt(availableSpace/nVariable);var remainder=availableSpace%nVariable;var paddingTop=this.domObj.getPaddingSize().top;var currentPosition=0;for(var i=0;i<this.elements.length;i++){var e=this.elements[i];var jxl=e.retrieve('jxLayout');var jxo=jxl.options;if(jxo.height!=null){jxl.resize({top:currentPosition});currentPosition+=jxo.height;}else{var a=amount;if(nVariable==1){a+=remainder;}
nVariable--;var h=0;if(jxo.bottom!=0||jxo.top!=0){h=e.getBorderBoxSize().height+a;}else{h=a;}
if(h<0){if(nVariable>0){amount=amount+h/nVariable;}
h=0;}
if(h<jxo.minHeight){if(nVariable>0){amount=amount+(h-jxo.minHeight)/nVariable;}
h=jxo.minHeight;}
if(jxo.maxHeight>=0&&h>jxo.maxHeight){if(nVariable>0){amount=amount+(h-jxo.maxHeight)/nVariable;}
h=jxo.maxHeight;}
var r=overallHeight-currentPosition-h;jxl.resize({top:currentPosition,bottom:r});currentPosition+=h;}
var rightBar=e.retrieve('rightBar');if(rightBar){rightBar.style.top=paddingTop+currentPosition+'px';currentPosition+=rightBar.retrieve('size').height;}}}});Jx.PanelSet=new Class({Family:'Jx.PanelSet',Implements:[Options,Events,Jx.Addable],options:{parent:null,panels:[],barTooltip:'drag this bar to resize'},panels:null,height:null,firstLayout:true,initialize:function(options){if(options&&options.panels){this.panels=options.panels;options.panels=null;}
this.setOptions(options);this.domObj=new Element('div');new Jx.Layout(this.domObj);var d=new Element('div',{styles:{position:'absolute'}});new Jx.Layout(d,{minHeight:0,maxHeight:0,height:0});var elements=[d];this.panels.each(function(panel){elements.push(panel.domObj);panel.options.hideTitle=true;panel.contentContainer.resize({top:0});panel.toggleCollapse=this.maximizePanel.bind(this,panel);panel.domObj.store('Jx.Panel',panel);panel.manager=this;},this);this.splitter=new Jx.Splitter(this.domObj,{splitInto:this.panels.length+1,layout:'vertical',elements:elements,prepareBar:(function(i){var bar=new Element('div',{'class':'jxPanelBar','title':this.options.barTooltip});var panel=this.panels[i];panel.title.setStyle('visibility','hidden');$(document.body).adopt(panel.title);var size=panel.title.getBorderBoxSize();bar.adopt(panel.title);panel.title.setStyle('visibility','');bar.setStyle('height',size.height);bar.store('size',size);return bar;}).bind(this)});this.addEvent('addTo',function(){$(this.domObj.parentNode).setStyle('overflow','hidden');this.domObj.resize();});if(this.options.parent){this.addTo(this.options.parent);}},maximizePanel:function(panel){var domHeight=this.domObj.getContentBoxSize().height;var space=domHeight;var panelSize=panel.domObj.retrieve('jxLayout').options.maxHeight;var panelIndex;for(var i=1;i<this.splitter.elements.length;i++){var p=this.splitter.elements[i];space-=p.retrieve('leftBar').getBorderBoxSize().height;if(p!==panel.domObj){var thePanel=p.retrieve('Jx.Panel');var o=p.retrieve('jxLayout').options;space-=o.minHeight;}else{panelIndex=i;}}
if(panelSize==-1||panelSize>=space){panelSize=space;space=0;}else{space=space-panelSize;}
var top=0;for(var i=1;i<this.splitter.elements.length;i++){var p=this.splitter.elements[i];top+=p.retrieve('leftBar').getBorderBoxSize().height;if(p!==panel.domObj){var thePanel=p.retrieve('Jx.Panel');var o=p.retrieve('jxLayout').options;var panelHeight=$chk(o.height)?o.height:p.getBorderBoxSize().height;if(space>0){if(space>=panelHeight){space-=panelHeight;p.resize({top:top,height:panelHeight});top+=panelHeight;}else{if(space>o.minHeight){p.resize({top:top,height:space});top+=space;space=0;}else{p.resize({top:top,height:o.minHeight});top+=o.minHeight;}}}else{p.resize({top:top,height:o.minHeight});top+=o.minHeight;}
p.retrieve('rightBar').style.top=top+'px';}else{break;}}
var bottom=domHeight;for(var i=this.splitter.elements.length-1;i>0;i--){p=this.splitter.elements[i];if(p!==panel.domObj){var o=p.retrieve('jxLayout').options;var panelHeight=$chk(o.height)?o.height:p.getBorderBoxSize().height;if(space>0){if(space>=panelHeight){bottom-=panelHeight;space-=panelHeight;p.resize({top:bottom,height:panelHeight});}else{if(space>o.minHeight){bottom-=space;p.resize({top:bottom,height:space});space=0;}else{bottom-=o.minHeight;p.resize({top:bottom,height:o.minHeight});}}}else{bottom-=o.minHeight;p.resize({top:bottom,height:o.minHeight,bottom:null});}
bottom-=p.retrieve('leftBar').getBorderBoxSize().height;p.retrieve('leftBar').style.top=bottom+'px';}else{break;}}
panel.domObj.resize({top:top,height:panelSize,bottom:null});}});Jx.SnePanelSet=new Class({Family:'Jx.PanelSet',Implements:[Options,Events,Jx.Addable],options:{parent:null,panels:[],barTooltip:'drag this bar to resize'},panels:null,height:null,firstLayout:true,activePanel:null,initialize:function(options){if(options&&options.panels){this.panels=options.panels;options.panels=null;}
this.setOptions(options);this.domObj=new Element('div');new Jx.Layout(this.domObj);var d=new Element('div',{styles:{position:'absolute'}});new Jx.Layout(d,{minHeight:0,maxHeight:0,height:0});var elements=[d];this.panels.each(function(panel){elements.push(panel.domObj);panel.options.hideTitle=true;panel.contentContainer.resize({top:0});panel.toggleCollapse=this.maximizePanel.bind(this,panel);panel.domObj.store('Jx.Panel',panel);panel.manager=this;},this);this.splitter=new Jx.Splitter(this.domObj,{splitInto:this.panels.length+1,layout:'vertical',elements:elements,prepareBar:(function(i){var bar=new Element('div',{'class':'jxPanelBar','title':this.options.barTooltip});var panel=this.panels[i];panel.title.setStyle('visibility','hidden');$(document.body).adopt(panel.title);var size=panel.title.getBorderBoxSize();bar.adopt(panel.title);panel.title.setStyle('visibility','');bar.setStyle('height',size.height);bar.store('size',size);return bar;}).bind(this)});this.addEvent('addTo',function(){$(this.domObj.parentNode).setStyle('overflow','hidden');this.domObj.resize();});if(this.options.parent){this.addTo(this.options.parent);}},maximizePanel:function(panel){var domHeight=this.domObj.getContentBoxSize().height;var space=domHeight;var panelSize=panel.domObj.retrieve('jxLayout').options.maxHeight;var panelIndex;for(var i=1;i<this.splitter.elements.length;i++){var p=this.splitter.elements[i];space-=p.retrieve('leftBar').getBorderBoxSize().height;if(p!==panel.domObj){var thePanel=p.retrieve('Jx.Panel');var o=p.retrieve('jxLayout').options;space-=o.minHeight;}else{panelIndex=i;}}
if(panelSize==-1||panelSize>=space){panelSize=space;space=0;}else{space=space-panelSize;}
var top=0;for(var i=1;i<this.splitter.elements.length;i++){var p=this.splitter.elements[i];top+=p.retrieve('leftBar').getBorderBoxSize().height;if(p!==panel.domObj){var thePanel=p.retrieve('Jx.Panel');var o=p.retrieve('jxLayout').options;var panelHeight=$chk(o.height)?o.height:p.getBorderBoxSize().height;if(space>0){if(space>=panelHeight){space-=panelHeight;p.resize({top:top,height:panelHeight});top+=panelHeight;}else{if(space>o.minHeight){p.resize({top:top,height:space});top+=space;space=0;}else{p.resize({top:top,height:o.minHeight});top+=o.minHeight;}}}else{p.resize({top:top,height:o.minHeight});top+=o.minHeight;}
p.retrieve('rightBar').style.top=top+'px';}else{break;}}
var bottom=domHeight;for(var i=this.splitter.elements.length-1;i>0;i--){p=this.splitter.elements[i];if(p!==panel.domObj){var o=p.retrieve('jxLayout').options;var panelHeight=$chk(o.height)?o.height:p.getBorderBoxSize().height;if(space>0){if(space>=panelHeight){bottom-=panelHeight;space-=panelHeight;p.resize({top:bottom,height:panelHeight});}else{if(space>o.minHeight){bottom-=space;p.resize({top:bottom,height:space});space=0;}else{bottom-=o.minHeight;p.resize({top:bottom,height:o.minHeight});}}}else{bottom-=o.minHeight;p.resize({top:bottom,height:o.minHeight,bottom:null});}
bottom-=p.retrieve('leftBar').getBorderBoxSize().height;p.retrieve('leftBar').style.top=bottom+'px';}else{break;}}
panel.domObj.resize({top:top,height:panelSize,bottom:null});this.activePanel=panel;for(var i=0;i<this.panels.length;i++)
{if(this.panels[i]==panel)
{this.panels[i].title.setAttribute('class','jxPanelTitleActive');this.panels[i].title.setAttribute('className','jxPanelTitleActive');}
else
{this.panels[i].title.setAttribute('class','jxPanelTitle');this.panels[i].title.setAttribute('className','jxPanelTitle');}}}});Jx.Grid=new Class({Family:'Jx.Grid',Implements:[Options,Events,Jx.Addable],domObj:null,model:null,options:{parent:null,alternateRowColors:false,rowHeaders:false,columnHeaders:false,rowSelection:false,columnSelection:false,cellPrelight:false,rowPrelight:false,columnPrelight:false,rowHeaderPrelight:false,columnHeaderPrelight:false,cellSelection:false},initialize:function(options){this.setOptions(options);this.domObj=new Element('div');new Jx.Layout(this.domObj,{onSizeChange:this.resize.bind(this)});if(this.options.parent){this.addTo(this.options.parent);}
this.rowColObj=new Element('div',{'class':'jxGridContainer'});this.colObj=new Element('div',{'class':'jxGridContainer'});this.colTable=new Element('table',{'class':'jxGridTable'});this.colTableHead=new Element('thead');this.colTable.appendChild(this.colTableHead);this.colTableBody=new Element('tbody');this.colTable.appendChild(this.colTableBody);this.colObj.appendChild(this.colTable);this.rowObj=new Element('div',{'class':'jxGridContainer'});this.rowTable=new Element('table',{'class':'jxGridTable'});this.rowTableHead=new Element('thead');this.rowTable.appendChild(this.rowTableHead);this.rowObj.appendChild(this.rowTable);this.gridObj=new Element('div',{'class':'jxGridContainer',styles:{overflow:'scroll'}});this.gridTable=new Element('table',{'class':'jxGridTable'});this.gridTableBody=new Element('tbody');this.gridTable.appendChild(this.gridTableBody);this.gridObj.appendChild(this.gridTable);this.domObj.appendChild(this.rowColObj);this.domObj.appendChild(this.rowObj);this.domObj.appendChild(this.colObj);this.domObj.appendChild(this.gridObj);this.gridObj.addEvent('scroll',this.onScroll.bind(this));this.gridObj.addEvent('click',this.onClickGrid.bindWithEvent(this));this.rowObj.addEvent('click',this.onClickRowHeader.bindWithEvent(this));this.colObj.addEvent('click',this.onClickColumnHeader.bindWithEvent(this));this.gridObj.addEvent('mousemove',this.onMouseMoveGrid.bindWithEvent(this));this.rowObj.addEvent('mousemove',this.onMouseMoveRowHeader.bindWithEvent(this));this.colObj.addEvent('mousemove',this.onMouseMoveColumnHeader.bindWithEvent(this));},onScroll:function(){this.colObj.scrollLeft=this.gridObj.scrollLeft;this.rowObj.scrollTop=this.gridObj.scrollTop;},resize:function(){if(!this.model){return;}
var colHeight=this.options.columnHeaders?this.model.getColumnHeaderHeight():1;var rowWidth=this.options.rowHeaders?this.model.getRowHeaderWidth():1;var size=Element.getContentBoxSize(this.domObj);this.rowColObj.setStyles({width:rowWidth-1,height:colHeight-1});this.rowObj.setStyles({top:colHeight,left:0,width:rowWidth-1,height:size.height-colHeight-1});this.colObj.setStyles({top:0,left:rowWidth,width:size.width-rowWidth-1,height:colHeight-1});this.gridObj.setStyles({top:colHeight,left:rowWidth,width:size.width-rowWidth-1,height:size.height-colHeight-1});},setModel:function(model){this.model=model;if(this.model){if(this.domObj.resize){this.domObj.resize();}
this.createGrid();this.resize();}else{this.destroyGrid();}},destroyGrid:function(){var n=this.colTableHead.cloneNode(false);this.colTable.replaceChild(n,this.colTableHead);this.colTableHead=n;n=this.colTableBody.cloneNode(false);this.colTable.replaceChild(n,this.colTableBody);this.colTableBody=n;n=this.rowTableHead.cloneNode(false);this.rowTable.replaceChild(n,this.rowTableHead);this.rowTableHead=n;n=this.gridTableBody.cloneNode(false);this.gridTable.replaceChild(n,this.gridTableBody);this.gridTableBody=n;},createGrid:function(){this.destroyGrid();if(this.model){var model=this.model;var nColumns=model.getColumnCount();var nRows=model.getRowCount();if(this.options.columnHeaders){var colHeight=model.getColumnHeaderHeight();var trHead=new Element('tr');this.colTableHead.appendChild(trHead);var trBody=new Element('tr');this.colTableBody.appendChild(trBody);var th=new Element('th',{styles:{width:0,height:0}});trHead.appendChild(th);th=th.cloneNode(true);th.setStyle('height',colHeight);trBody.appendChild(th);for(var i=0;i<nColumns;i++){var colWidth=model.getColumnWidth(i);th=new Element('th',{'class':'jxGridColHeadHide',styles:{width:colWidth}});var p=new Element('p',{styles:{height:0,width:colWidth}});th.appendChild(p);trHead.appendChild(th);th=new Element('th',{'class':'jxGridColHead',html:model.getColumnHeaderHTML(i)});trBody.appendChild(th);}
var th=new Element('th',{styles:{width:1000,height:0}});trHead.appendChild(th);th=th.cloneNode(true);th.setStyle('height',colHeight-1);th.className='jxGridColHead';trBody.appendChild(th);}
if(this.options.rowHeaders){var rowWidth=model.getRowHeaderWidth();var tr=new Element('tr');var td=new Element('td',{styles:{width:0,height:0}});tr.appendChild(td);var th=new Element('th',{styles:{width:rowWidth,height:0}});tr.appendChild(th);this.rowTableHead.appendChild(tr);for(var i=0;i<nRows;i++){var rowHeight=model.getRowHeight(i);var tr=new Element('tr');var td=new Element('td',{'class':'jxGridRowHeadHide',styles:{width:0,height:rowHeight}});var p=new Element('p',{styles:{width:0,height:rowHeight}});td.appendChild(p);tr.appendChild(td);var th=new Element('th',{'class':'jxGridRowHead',html:model.getRowHeaderHTML(i)});tr.appendChild(th);this.rowTableHead.appendChild(tr);}
var tr=new Element('tr');var td=new Element('td',{styles:{width:0,height:1000}});tr.appendChild(td);var th=new Element('th',{'class':'jxGridRowHead',styles:{width:rowWidth,height:1000}});tr.appendChild(th);this.rowTableHead.appendChild(tr);}
var colHeight=model.getColumnHeaderHeight();var trBody=new Element('tr');this.gridTableBody.appendChild(trBody);var td=new Element('td',{styles:{width:0,height:0}});trBody.appendChild(td);for(var i=0;i<nColumns;i++){var colWidth=model.getColumnWidth(i);td=new Element('td',{'class':'jxGridColHeadHide',styles:{width:colWidth}});var p=new Element('p',{styles:{width:colWidth,height:0}});td.appendChild(p);trBody.appendChild(td);}
for(var j=0;j<nRows;j++){var rowHeight=model.getRowHeight(j);var actualRowHeight=rowHeight;var tr=new Element('tr');this.gridTableBody.appendChild(tr);var td=new Element('td',{'class':'jxGridRowHeadHide',styles:{width:0,height:rowHeight}});var p=new Element('p',{styles:{height:rowHeight}});td.appendChild(p);tr.appendChild(td);for(var i=0;i<nColumns;i++){var colWidth=model.getColumnWidth(i);td=new Element('td',{'class':'jxGridCell'});td.innerHTML=model.getValueAt(j,i);tr.appendChild(td);var tdSize=td.getSize();if(tdSize.height>actualRowHeight){actualRowHeight=tdSize.height;}}
if(document.all){actualRowHeight-=1;}
if(this.options.rowHeaders){this.setRowHeaderHeight(j,actualRowHeight);}
if(this.options.alternateRowColors){tr.className=(j%2)?'jxGridRowOdd':'jxGridRowEven';}else{tr.className='jxGridRowAll';}}}},setRowHeaderHeight:function(row,height){this.rowTableHead.childNodes[row+1].childNodes[0].childNodes[0].style.height=(height)+'px';},gridChanged:function(model,row,col,value){if(this.model==model){this.gridObj.childNodes[row].childNodes[col].innerHTML=value;}},prelightRowHeader:function(row){var cell=(row>=0&&row<this.rowTableHead.rows.length-1)?this.rowTableHead.rows[row+1].cells[1]:null;if(this.prelitRowHeader!=cell){if(this.prelitRowHeader){this.prelitRowHeader.removeClass('jxGridRowHeaderPrelight');}
this.prelitRowHeader=cell;if(this.prelitRowHeader){this.prelitRowHeader.addClass('jxGridRowHeaderPrelight');}}},prelightColumnHeader:function(col){if(this.colTableBody.rows.length==0){return;}
var cell=(col>=0&&col<this.colTableBody.rows[0].cells.length-1)?this.colTableBody.rows[0].cells[col+1]:null;if(this.prelitColumnHeader!=cell){if(this.prelitColumnHeader){this.prelitColumnHeader.removeClass('jxGridColumnHeaderPrelight');}
this.prelitColumnHeader=cell;if(this.prelitColumnHeader){this.prelitColumnHeader.addClass('jxGridColumnHeaderPrelight');}}},prelightRow:function(row){var tr=(row>=0&&row<this.gridTableBody.rows.length-1)?this.gridTableBody.rows[row+1]:null;if(this.prelitRow!=row){if(this.prelitRow){this.prelitRow.removeClass('jxGridRowPrelight');}
this.prelitRow=tr;if(this.prelitRow){this.prelightRowHeader(row);this.prelitRow.addClass('jxGridRowPrelight');}}},prelightColumn:function(col){if(col>=0&&col<this.gridTable.rows[0].cells.length){if($chk(this.prelitColumn)){for(var i=0;i<this.gridTable.rows.length;i++){this.gridTable.rows[i].cells[this.prelitColumn+1].removeClass('jxGridColumnPrelight');}}
this.prelitColumn=col;for(var i=0;i<this.gridTable.rows.length;i++){this.gridTable.rows[i].cells[col+1].addClass('jxGridColumnPrelight');}}
this.prelightColumnHeader(col);},prelightCell:function(row,col){var td=(row>=0&&col>=0&&row<this.gridTableBody.rows.length-1&&col<this.gridTableBody.rows[row+1].cells.length-1)?this.gridTableBody.rows[row+1].cells[col+1]:null;if(this.prelitCell!=td){if(this.prelitCell){this.prelitCell.removeClass('jxGridCellPrelight');}
this.prelitCell=td;if(this.prelitCell){this.prelitCell.addClass('jxGridCellPrelight');}}},selectCell:function(row,col){var td=(row>=0&&col>=0&&row<this.gridTableBody.rows.length-1&&col<this.gridTableBody.rows[row+1].cells.length-1)?this.gridTableBody.rows[row+1].cells[col+1]:null;if(!td){return;}
if(this.selectedCell){this.selectedCell.removeClass('jxGridCellSelected');}
this.selectedCell=td;this.selectedCell.addClass('jxGridCellSelected');},selectRowHeader:function(row,selected){var cell=(row>=0&&row<this.rowTableHead.rows.length-1)?this.rowTableHead.rows[row+1].cells[1]:null;if(!cell){return;}
if(selected){cell.addClass('jxGridRowHeaderSelected');}else{cell.removeClass('jxGridRowHeaderSelected');}},selectRow:function(row,selected){var tr=(row>=0&&row<this.gridTableBody.rows.length-1)?this.gridTableBody.rows[row+1]:null;if(tr){if(selected){tr.addClass('jxGridRowSelected');}else{tr.removeClass('jxGridRowSelected');}
this.selectRowHeader(row,selected);}},selectColumnHeader:function(col,selected){if(this.colTableBody.rows.length==0){return;}
var cell=(col>=0&&col<this.colTableBody.rows[0].cells.length-1)?this.colTableBody.rows[0].cells[col+1]:null;if(cell==null){return;}
if(selected){cell.addClass('jxGridColumnHeaderSelected');}else{cell.removeClass('jxGridColumnHeaderSelected');}},selectColumn:function(col,selected){if(col>=0&&col<this.gridTable.rows[0].cells.length){if(selected){for(var i=0;i<this.gridTable.rows.length;i++){this.gridTable.rows[i].cells[col+1].addClass('jxGridColumnSelected');}}else{for(var i=0;i<this.gridTable.rows.length;i++){this.gridTable.rows[i].cells[col+1].removeClass('jxGridColumnSelected');}}
this.selectColumnHeader(col,selected);}},onMouseMoveGrid:function(e){var rc=this.getRowColumnFromEvent(e);if(this.options.cellPrelight){this.prelightCell(rc.row,rc.column);}
if(this.options.rowPrelight){this.prelightRow(rc.row);}
if(this.options.rowHeaderPrelight){this.prelightRowHeader(rc.row);}
if(this.options.columnPrelight){this.prelightColumn(rc.column);}
if(this.options.columnHeaderPrelight){this.prelightColumnHeader(rc.column);}},onMouseMoveRowHeader:function(e){if(this.options.rowPrelight){var rc=this.getRowColumnFromEvent(e);this.prelightRow(rc.row);}},onMouseMoveColumnHeader:function(e){if(this.options.columnPrelight){var rc=this.getRowColumnFromEvent(e);this.prelightColumn(rc.column);}},onClickGrid:function(e){var rc=this.getRowColumnFromEvent(e);if(this.options.cellSelection&&this.model.cellSelected){this.model.cellSelected(this,rc.row,rc.column);}
if(this.options.rowSelection&&this.model.rowSelected){this.model.rowSelected(this,rc.row);}
if(this.options.columnSelection&&this.model.columnSelected){this.model.columnSelected(this,rc.column);}},onClickRowHeader:function(e){var rc=this.getRowColumnFromEvent(e);if(this.options.rowSelection&&this.model.rowSelected){this.model.rowSelected(this,rc.row);}},onClickColumnHeader:function(e){var rc=this.getRowColumnFromEvent(e);if(this.options.columnSelection&&this.model.columnSelected){this.model.columnSelected(this,rc.column);}},getRowColumnFromEvent:function(e){var td=e.target;if(td.tagName!='TD'&&td.tagName!='TH'){return{row:-1,column:-1};}
var tr=td.parentNode;var col=td.cellIndex-1;var row=tr.rowIndex-1;if(col==-1){for(var i=0;i<tr.childNodes.length;i++){if(tr.childNodes[i]==td){col=i-1;break;}}}
return{row:row,column:col};}});Jx.Grid.Model=new Class({Family:'Jx.Grid.Model',Implements:[Events,Options],options:{colHeaderHeight:28,rowHeaderWidth:28,colWidth:50,rowHeight:20,rowHeaders:null,columnHeaders:null},data:null,initialize:function(data,options){this.data=data||[];this.setOptions(options);},getColumnCount:function(){return(this.data&&this.data[0])?this.data[0].length:0;},getColumnHeaderHTML:function(col){return this.options.columnHeaders?this.options.columnHeaders[col]:col+1;},getColumnHeaderHeight:function(){return this.options.colHeaderHeight;},getColumnWidth:function(col){return this.options.colWidth;},getRowHeaderHTML:function(row){return this.options.rowHeaders?this.options.rowHeaders[row]:row+1;},getRowHeaderWidth:function(){return this.options.rowHeaderWidth;},getRowHeight:function(row){return this.options.rowHeight;},getRowCount:function(){return this.data.length},getValueAt:function(row,col){return(this.data&&$chk(this.data[row]))?this.data[row][col]:'';},setColumnWidth:function(){},isCellEditable:function(){return false},setValueAt:function(row,col,value){},rowSelected:function(grid,row){if(this.selectedRow!=null){grid.selectRow(this.selectedRow,false);}
this.selectedRow=row;grid.selectRow(row,true);this.fireEvent('select-row',row);},columnSelected:function(grid,col){if(this.selectedCol!=null){grid.selectColumn(this.selectedCol,false);}
this.selectedCol=col;grid.selectColumn(col,true);this.fireEvent('select-column',col);},cellSelected:function(grid,row,col){grid.selectCell(row,col);this.fireEvent('select-cell',[row,col]);}});Jx.Menu.Context=new Class({Family:'Jx.Menu.Context',Extends:Jx.Menu,initialize:function(id){this.parent();if($(id)){$(id).addEvent('contextmenu',this.show.bindWithEvent(this));}},show:function(e){if(this.items.length==0){return;}
this.contentContainer.setStyle('visibility','hidden');this.contentContainer.setStyle('display','block');$(document.body).adopt(this.contentContainer);this.contentContainer.setContentBoxSize(this.subDomObj.getMarginBoxSize());this.position(this.contentContainer,document.body,{horizontal:[e.page.x+' left'],vertical:[e.page.y+' top',e.page.y+' bottom'],offsets:this.chromeOffsets});this.contentContainer.setStyle('visibility','');this.showChrome(this.contentContainer);document.addEvent('mousedown',this.hideWatcher);document.addEvent('keyup',this.keypressWatcher);e.stop();}});Jx.Menu.Separator=new Class({Family:'Jx.Menu.Separator',domObj:null,owner:null,initialize:function(){this.domObj=new Element('li',{'class':'jxMenuItem'});var span=new Element('span',{'class':'jxMenuSeparator','html':'&nbsp;'});this.domObj.appendChild(span);},setOwner:function(obj){this.owner=obj;},hide:$empty,show:$empty});Jx.Menu.SubMenu=new Class({Family:'Jx.Menu.SubMenu',Extends:Jx.Menu.Item,Implements:[Jx.AutoPosition,Jx.Chrome],subDomObj:null,owner:null,visibleItem:null,items:null,initialize:function(options){this.open=false;this.items=[];this.parent(options);this.domA.addClass('jxButtonSubMenu');this.contentContainer=new Element('div',{'class':'jxMenuContainer'});this.subDomObj=new Element('ul',{'class':'jxSubMenu'});this.contentContainer.adopt(this.subDomObj);},setOwner:function(obj){this.owner=obj;},show:function(){if(this.open||this.items.length==0){return;}
this.contentContainer.setStyle('visibility','hidden');this.contentContainer.setStyle('display','block');$(document.body).adopt(this.contentContainer);this.contentContainer.setContentBoxSize(this.subDomObj.getMarginBoxSize());this.showChrome(this.contentContainer);this.position(this.contentContainer,this.domObj,{horizontal:['right left','left right'],vertical:['top top'],offsets:this.chromeOffsets});this.open=true;this.contentContainer.setStyle('visibility','');this.setActive(true);},eventInMenu:function(e){if(this.visibleItem&&this.visibleItem.eventInMenu&&this.visibleItem.eventInMenu(e)){return true;}
return $(e.target).descendantOf(this.domObj)||$(e.target).descendantOf(this.subDomObj)||this.items.some(function(item){return item instanceof Jx.Menu.SubMenu&&item.eventInMenu(e);});},hide:function(){if(!this.open){return;}
this.open=false;this.items.each(function(item){item.hide();});this.contentContainer.setStyle('display','none');this.visibleItem=null;},add:function(){var that=this;$A(arguments).each(function(item){that.items.push(item);item.setOwner(that);that.subDomObj.adopt(item.domObj);});return this;},insertBefore:function(newItem,targetItem){var bInserted=false;for(var i=0;i<this.items.length;i++){if(this.items[i]==targetItem){this.items.splice(i,0,newItem);this.subDomObj.insertBefore(newItem.domObj,targetItem.domObj);bInserted=true;break;}}
if(!bInserted){this.add(newItem);}},remove:function(item){for(var i=0;i<this.items.length;i++){if(this.items[i]==item){this.items.splice(i,1);this.subDomObj.removeChild(item.domObj);break;}}},deactivate:function(e){if(this.owner){this.owner.deactivate(e);}},isActive:function(){if(this.owner){return this.owner.isActive();}else{return false;}},setActive:function(isActive){if(this.owner&&this.owner.setActive){this.owner.setActive(isActive);}},setVisibleItem:function(obj){if(this.visibleItem!=obj){if(this.visibleItem&&this.visibleItem.hide){this.visibleItem.hide();}
this.visibleItem=obj;this.visibleItem.show();}}});Jx.Splitter.Snap=new Class({Family:'Jx.Splitter.Snap',snap:null,element:null,splitter:null,layout:'vertical',initialize:function(snap,element,splitter,events){this.snap=snap;this.element=element;var jxl=element.retrieve('jxLayout');jxl.addEvent('sizeChange',this.sizeChange.bind(this));this.splitter=splitter;this.layout=splitter.options.layout;var jxo=jxl.options;var size=this.element.getContentBoxSize();if(this.layout=='vertical'){this.originalSize=size.height;this.minimumSize=jxo.minHeight?jxo.minHeight:0;}else{this.originalSize=size.width;this.minimumSize=jxo.minWidth?jxo.minWidth:0;}
events.each(function(eventName){snap.addEvent(eventName,this.toggleElement.bind(this));},this);},toggleElement:function(){var newSize={};if(this.layout=='vertical'){if(this.element.clientHeight<=this.minimumSize){newSize.height=this.originalSize;}else{this.originalSize=this.element.clientHeight;newSize.height=this.minimumSize;}}else{if(this.element.clientWidth<=this.minimumSize){newSize.width=this.originalSize;}else{this.originalSize=this.element.clientWidth;newSize.width=this.minimumSize;}}
this.element.resize(newSize);this.splitter.sizeChanged();},sizeChange:function(){var size=this.element.getContentBoxSize();if(this.layout=='vertical'){if(this.element.clientHeight==this.minimumSize){this.snap.addClass('jxSnapClosed');this.snap.removeClass('jxSnapOpened');}else{this.snap.addClass('jxSnapOpened');this.snap.removeClass('jxSnapClosed');}}else{if(this.element.clientWidth==this.minimumSize){this.snap.addClass('jxSnapClosed');this.snap.removeClass('jxSnapOpened');}else{this.snap.addClass('jxSnapOpened');this.snap.removeClass('jxSnapClosed');}}}});Jx.Toolbar=new Class({Family:'Jx.Toolbar',Implements:[Options,Events],items:null,domObj:null,isActive:false,options:{type:'Toolbar',position:'top',parent:null,autoSize:false,scroll:true},initialize:function(options){this.setOptions(options);this.items=[];this.domObj=new Element('ul',{id:this.options.id,'class':'jx'+this.options.type});if(this.options.parent){this.addTo(this.options.parent);}
this.deactivateWatcher=this.deactivate.bindWithEvent(this);if(this.options.items){this.add(this.options.items);}},addTo:function(parent){var tbc=$(parent).retrieve('jxBarContainer');if(!tbc){tbc=new Jx.Toolbar.Container({parent:parent,position:this.options.position,autoSize:this.options.autoSize,scroll:this.options.scroll});}
tbc.add(this);return this;},add:function(){$A(arguments).flatten().each(function(thing){if(thing.domObj){thing=thing.domObj;}
if(thing.tagName=='LI'){if(!thing.hasClass('jxToolItem')){thing.addClass('jxToolItem');}
this.domObj.appendChild(thing);}else{var item=new Jx.Toolbar.Item(thing);this.domObj.appendChild(item.domObj);}},this);if(arguments.length>0){this.fireEvent('add',this);}
return this;},remove:function(item){if(item.domObj){item=item.domObj;}
var li=item.findElement('LI');if(li&&li.parentNode==this.domObj){item.dispose();li.dispose();this.fireEvent('remove',this);}else{return null;}},deactivate:function(){this.items.each(function(o){o.hide();});this.setActive(false);},isActive:function(){return this.isActive;},setActive:function(b){this.isActive=b;if(this.isActive){document.addEvent('click',this.deactivateWatcher);}else{document.removeEvent('click',this.deactivateWatcher);}},setVisibleItem:function(obj){if(this.visibleItem&&this.visibleItem.hide&&this.visibleItem!=obj){this.visibleItem.hide();}
this.visibleItem=obj;if(this.isActive()){this.visibleItem.show();}},showItem:function(item){this.fireEvent('show',item);}});Jx.TabSet=new Class({Family:'Jx.TabSet',Implements:[Options,Events],tabs:null,domObj:null,initialize:function(domObj,options){this.setOptions(options);this.tabs=[];this.domObj=$(domObj);if(!this.domObj.hasClass('jxTabSetContainer')){this.domObj.addClass('jxTabSetContainer');}
this.setActiveTabFn=this.setActiveTab.bind(this);},resizeTabBox:function(){if(this.activeTab&&this.activeTab.content.resize){this.activeTab.content.resize({forceResize:true});}},add:function(){$A(arguments).each(function(tab){if(tab instanceof Jx.Button.Tab){tab.addEvent('down',this.setActiveTabFn);tab.tabSet=this;this.domObj.appendChild(tab.content);this.tabs.push(tab);if((!this.activeTab||tab.options.active)&&tab.options.enabled){tab.options.active=false;tab.setActive(true);}}},this);return this;},remove:function(tab){if(tab instanceof Jx.Button.Tab&&this.tabs.indexOf(tab)!=-1){this.tabs.erase(tab);if(this.activeTab==tab){if(this.tabs.length){this.tabs[0].setActive(true);}}
tab.removeEvent('down',this.setActiveTabFn);tab.content.dispose();}},setActiveTab:function(tab){if(this.activeTab&&this.activeTab!=tab){this.activeTab.setActive(false);}
this.activeTab=tab;if(this.activeTab.content.resize){this.activeTab.content.resize({forceResize:true});}
this.fireEvent('tabChange',[this,tab]);}});Jx.TabBox=new Class({Family:'Jx.TabBox',Implements:[Options,Events,Jx.Addable],options:{parent:null,position:'top',height:null,width:null,scroll:true},tabBar:null,tabSet:null,initialize:function(options){this.setOptions(options);this.tabBar=new Jx.Toolbar({type:'TabBar',position:this.options.position,scroll:this.options.scroll});this.panel=new Jx.Panel({toolbars:[this.tabBar],hideTitle:true,height:this.options.height,width:this.options.width});this.panel.domObj.addClass('jxTabBox');this.tabSet=new Jx.TabSet(this.panel.content);this.tabSet.addEvent('tabChange',function(tabSet,tab){this.showItem(tab);}.bind(this.tabBar));this.domObj=this.panel.domObj;this.panel.addEvent('sizeChange',(function(){this.tabSet.resizeTabBox();this.tabBar.domObj.getParent('.jxBarContainer').retrieve('jxBarContainer').update();}).bind(this));this.tabBar.addEvents({add:(function(){this.domObj.resize({forceResize:true});}).bind(this),remove:(function(){this.domObj.resize({forceResize:true});}).bind(this)});this.addEvent('addTo',function(){this.domObj.resize({forceResize:true});});if(this.options.parent){this.addTo(this.options.parent);}},add:function(){this.tabBar.add.apply(this.tabBar,arguments);this.tabSet.add.apply(this.tabSet,arguments);$A(arguments).flatten().each(function(tab){tab.addEvents({close:(function(){this.tabBar.remove(tab);this.tabSet.remove(tab);}).bind(this)});},this);return this;},remove:function(tab){this.tabBar.remove(tab);this.tabSet.remove(tab);}});Jx.Toolbar.Container=new Class({Family:'Jx.Toolbar.Container',Implements:[Options,Events,Jx.Addable],domObj:null,options:{parent:null,position:'top',autoSize:false,scroll:true},initialize:function(options){this.setOptions(options);var d=$(this.options.parent);this.domObj=d||new Element('div');this.domObj.addClass('jxBarContainer');if(this.options.scroll){this.scroller=new Element('div',{'class':'jxBarScroller'});this.domObj.adopt(this.scroller);}
this.domObj.store('jxBarContainer',this);if(['top','right','bottom','left'].contains(this.options.position)){this.domObj.addClass('jxBar'+
this.options.position.capitalize());}else{this.domObj.addClass('jxBarTop');this.options.position='top';}
if(this.options.scroll&&['top','bottom'].contains(this.options.position)){this.addEvent('addTo',this.update.bind(this));if(typeof Fx!='undefined'&&typeof Fx.Tween!='undefined'){this.scrollFx=scrollFx=new Fx.Tween(this.scroller,{link:'chain'});}
this.scrollLeft=new Jx.Button({image:Jx.aPixel.src}).addTo(this.domObj);this.scrollLeft.domObj.addClass('jxBarScrollLeft');this.scrollLeft.addEvents({click:(function(){var from=this.scroller.getStyle('left').toInt();if(isNaN(from)){from=0;}
var to=Math.min(from+100,0);if(to>=0){this.scrollLeft.domObj.setStyle('visibility','hidden');}
this.scrollRight.domObj.setStyle('visibility','');if($defined(this.scrollFx)){this.scrollFx.start('left',from,to);}else{this.scroller.setStyle('left',to);}}).bind(this)});this.scrollRight=new Jx.Button({image:Jx.aPixel.src}).addTo(this.domObj);this.scrollRight.domObj.addClass('jxBarScrollRight');this.scrollRight.addEvents({click:(function(){var from=this.scroller.getStyle('left').toInt();if(isNaN(from)){from=0;}
var to=Math.max(from-100,this.scrollWidth);if(to==this.scrollWidth){this.scrollRight.domObj.setStyle('visibility','hidden');}
this.scrollLeft.domObj.setStyle('visibility','');if($defined(this.scrollFx)){this.scrollFx.start('left',from,to);}else{this.scroller.setStyle('left',to);}}).bind(this)});}else{this.options.scroll=false;}
if(this.options.toolbars){this.add(this.options.toolbars);}},update:function(){if(this.options.autoSize){(function(){var x=0;this.scroller.getChildren().each(function(child){x+=child.getSize().x;});this.domObj.setStyles({width:x});this.measure();}).delay(1,this);}else{this.measure();}},measure:function(){if((!this.scrollLeftSize||!this.scrollLeftSize.x)&&this.domObj.parentNode){this.scrollLeftSize=this.scrollLeft.domObj.getSize();this.scrollRightSize=this.scrollRight.domObj.getSize();}
this.scrollWidth=this.domObj.getSize().x;this.scroller.getChildren().each(function(child){this.scrollWidth-=child.getSize().x;},this);if(this.scrollWidth<0){var l=this.scroller.getStyle('left').toInt();if(l<0){this.scrollLeft.domObj.setStyle('visibility','');}else{this.scrollLeft.domObj.setStyle('visibility','hidden');}
if(l<=this.scrollWidth){this.scrollRight.domObj.setStyle('visibility','hidden');if(l<this.scrollWidth){if($defined(this.scrollFx)){this.scrollFx.start('left',l,this.scrollWidth);}else{this.scroller.setStyle('left',this.scrollWidth);}}}else{this.scrollRight.domObj.setStyle('visibility','');}}else{this.scrollLeft.domObj.setStyle('visibility','hidden');this.scrollRight.domObj.setStyle('visibility','hidden');var from=this.scroller.getStyle('left').toInt();if(!isNaN(from)&&from!==0){if($defined(this.scrollFx)){this.scrollFx.start('left',0);}else{this.scroller.setStyle('left',0);}}}},add:function(){$A(arguments).flatten().each(function(thing){if(this.options.scroll){thing.addEvent('add',this.update.bind(this));thing.addEvent('remove',this.update.bind(this));thing.addEvent('show',this.scrollIntoView.bind(this));}
if(this.scroller){this.scroller.adopt(thing.domObj);}else{this.domObj.adopt(thing.domObj);}
this.domObj.addClass('jx'+thing.options.type+this.options.position.capitalize());},this);if(this.options.scroll){this.update();}
if(arguments.length>0){this.fireEvent('add',this);}
return this;},remove:function(item){},scrollIntoView:function(item){var width=this.domObj.getSize().x;var coords=item.domObj.getCoordinates(this.scroller);var l=this.scroller.getStyle('left');if(l==='auto'||l.length<=0){l=0;}else{l=l.toInt();}
var slSize=this.scrollLeftSize?this.scrollLeftSize.x:0;var srSize=this.scrollRightSize?this.scrollRightSize.x:0;var left=l;if(l<-coords.left+slSize){left=-coords.left+slSize;if(left>=0){left=0;}}else if(width-coords.right-srSize<l){left=width-coords.right-srSize;if(left<this.scrollWidth){left=this.scrollWidth;}}
if(left<0){this.scrollLeft.domObj.setStyle('visibility','');}else{this.scrollLeft.domObj.setStyle('visibility','hidden');}
if(left<=this.scrollWidth){this.scrollRight.domObj.setStyle('visibility','hidden');}else{this.scrollRight.domObj.setStyle('visibility','');}
if(left!=l){if($defined(this.scrollFx)){this.scrollFx.start('left',left);}else{this.scroller.setStyle('left',left);}}}});Jx.Toolbar.Item=new Class({Family:'Jx.Toolbar.Item',Implements:[Options],options:{active:true},domObj:null,initialize:function(jxThing){this.al=[];this.domObj=new Element('li',{'class':'jxToolItem'});if(jxThing){if(jxThing.domObj){this.domObj.appendChild(jxThing.domObj);if(jxThing instanceof Jx.Button.Tab){this.domObj.addClass('jxTabItem');}}else{this.domObj.appendChild(jxThing);if(jxThing.hasClass('jxTab')){this.domObj.addClass('jxTabItem');}}}}});Jx.Toolbar.Separator=new Class({Family:'Jx.Toolbar.Separator',domObj:null,initialize:function(){this.domObj=new Element('li',{'class':'jxToolItem'});this.domSpan=new Element('span',{'class':'jxBarSeparator'});this.domObj.appendChild(this.domSpan);}});Jx.TreeItem=new Class({Family:'Jx.TreeItem',Implements:[Options,Events],domObj:null,owner:null,options:{label:'',data:null,contextMenu:null,enabled:true,type:'Item',image:null,imageClass:''},initialize:function(options){this.setOptions(options);this.domObj=new Element('li',{'class':'jxTree'+this.options.type});if(this.options.id){this.domObj.id=this.options.id;}
this.domNode=new Element('img',{'class':'jxTreeImage',src:Jx.aPixel.src,alt:'',title:''});this.domObj.appendChild(this.domNode);this.domLabel=(this.options.draw)?this.options.draw.apply(this):this.draw();this.domObj.appendChild(this.domLabel);this.domObj.store('jxTreeItem',this);if(!this.options.enabled){this.domObj.addClass('jxDisabled');}},draw:function(){var domImg=new Element('img',{'class':'jxTreeIcon',src:Jx.aPixel.src,alt:'',title:''});if(this.options.image){domImg.setStyle('backgroundImage','url('+this.options.image+')');}
if(this.options.imageClass){domImg.addClass(this.options.imageClass);}
var hasFocus;var mouseDown;var domA=new Element('a',{href:'javascript:void(0)',html:this.options.label});domA.addEvents({click:this.selected.bind(this),dblclick:this.selected.bind(this),drag:function(e){e.stop();},contextmenu:function(e){e.stop();},mousedown:(function(e){domA.addClass('jxTreeItemPressed');hasFocus=true;mouseDown=true;domA.focus();if(e.rightClick&&this.options.contextMenu){this.options.contextMenu.show(e);}}).bind(this),mouseup:function(e){domA.removeClass('jxTreeItemPressed');mouseDown=false;},mouseleave:function(e){domA.removeClass('jxTreeItemPressed');},mouseenter:function(e){if(hasFocus&&mouseDown){domA.addClass('jxTreeItemPressed');}},keydown:function(e){if(e.key=='enter'){domA.addClass('jxTreeItemPressed');}},keyup:function(e){if(e.key=='enter'){domA.removeClass('jxTreeItemPressed');}},blur:function(){hasFocus=false;}});domA.appendChild(domImg);if(typeof Drag!='undefined'){new Drag(domA,{onStart:function(){this.stop();}});}
return domA;},finalize:function(){this.finalizeItem();},finalizeItem:function(){if(!this.domObj){return;}
this.options=null;this.domObj.dispose();this.domObj=null;this.owner=null;},clone:function(){return new Jx.TreeItem(this.options);},update:function(shouldDescend){var isLast=(arguments.length>1)?arguments[1]:(this.owner&&this.owner.isLastNode(this));if(isLast){this.domObj.removeClass('jxTree'+this.options.type);this.domObj.addClass('jxTree'+this.options.type+'Last');}else{this.domObj.removeClass('jxTree'+this.options.type+'Last');this.domObj.addClass('jxTree'+this.options.type);}},selected:function(e){this.fireEvent('click',this);},getName:function(){return this.options.label;},propertyChanged:function(obj){this.options.enabled=obj.isEnabled();if(this.options.enabled){this.domObj.removeClass('jxDisabled');}else{this.domObj.addClass('jxDisabled');}}});Jx.TreeFolder=new Class({Family:'Jx.TreeFolder',Extends:Jx.TreeItem,subDomObj:null,nodes:null,options:{open:false},initialize:function(options){this.parent($merge(options,{type:'Branch'}));$(this.domNode).addEvent('click',this.clicked.bindWithEvent(this));this.addEvent('click',this.clicked.bindWithEvent(this));this.nodes=[];this.subDomObj=new Element('ul',{'class':'jxTree'});this.domObj.appendChild(this.subDomObj);if(this.options.open){this.expand();}else{this.collapse();}},finalize:function(){this.finalizeFolder();this.finalizeItem();this.subDomObj.dispose();this.subDomObj=null;},finalizeFolder:function(){this.domObj.childNodes[0].removeEvents();for(var i=this.nodes.length-1;i>=0;i--){this.nodes[i].finalize();this.nodes.pop();}},clone:function(){var node=new Jx.TreeFolder(this.options);this.nodes.each(function(n){node.append(n.clone());});return node;},isLastNode:function(node){if(this.nodes.length==0){return false;}else{return this.nodes[this.nodes.length-1]==node;}},update:function(shouldDescend){if(!this.parent)return;var isLast=false;if(arguments.length>1){isLast=arguments[1];}else{isLast=(this.owner&&this.owner.isLastNode(this));}
var c='jxTree'+this.options.type;c+=isLast?'Last':'';c+=this.options.open?'Open':'Closed';this.domObj.className=c;if(isLast){this.subDomObj.className='jxTree';}else{this.subDomObj.className='jxTree jxTreeNest';}
if(this.nodes&&shouldDescend){var that=this;this.nodes.each(function(n,i){n.update(false,i==that.nodes.length-1);});}},append:function(node){node.owner=this;this.nodes.push(node);this.subDomObj.appendChild(node.domObj);this.update(true);return this;},insert:function(node,refNode){node.owner=this;if(!refNode){this.nodes.unshift(node);if(this.subDomObj.childNodes.length==0){this.subDomObj.appendChild(node.domObj);}else{this.subDomObj.insertBefore(node.domObj,this.subDomObj.childNodes[0]);}}else{var b=false;for(var i=0;i<this.nodes.length;i++){if(this.nodes[i]==refNode){i=i+1;if(i<this.nodes.length){this.nodes.splice(i,0,node);this.subDomObj.insertBefore(node.domObj,this.subDomObj.childNodes[i]);b=true;break;}}}
if(!b){this.nodes.push(node);this.subDomObj.appendChild(node.domObj);}}
this.update(true);return this;},remove:function(node){node.owner=null;for(var i=0;i<this.nodes.length;i++){if(this.nodes[i]==node){this.nodes.splice(i,1);this.subDomObj.removeChild(this.subDomObj.childNodes[i]);break;}}
this.update(true);return this;},replace:function(newNode,refNode){var b=false;for(var i=0;i<this.nodes.length;i++){if(this.nodes[i]==refNode){if(i<this.nodes.length){newNode.owner=this;this.nodes.splice(i,1,newNode);this.subDomObj.replaceChild(newNode.domObj,refNode.domObj);return true;}}}
return false;},clicked:function(e){if(this.options.open){this.collapse();}else{this.expand();}},expand:function(){this.options.open=true;this.subDomObj.setStyle('display','block');this.update(true);this.fireEvent('disclosed',this);},collapse:function(){this.options.open=false;this.subDomObj.setStyle('display','none');this.update(true);this.fireEvent('disclosed',this);},findChild:function(path){if(path.length==0)
return this;if(path.length==1)
{for(var i=0;i<this.nodes.length;i++)
{if(this.nodes[i].getName()==path[0])
return this.nodes[i];}
return null;}
var childName=path.shift();for(var i=0;i<this.nodes.length;i++)
{if(this.nodes[i].getName()==childName&&this.nodes[i].findChild)
return this.nodes[i].findChild(path);}
return null;}});Jx.Tree=new Class({Extends:Jx.TreeFolder,Implements:[Jx.Addable],Family:'Jx.Tree',initialize:function(options){this.parent(options);this.subDomObj=new Element('ul',{'class':'jxTreeRoot'});this.nodes=[];this.isOpen=true;this.addable=this.subDomObj;if(this.options.parent){this.addTo(this.options.parent);}},finalize:function(){this.clear();this.subDomObj.parentNode.removeChild(this.subDomObj);},clear:function(){for(var i=this.nodes.length-1;i>=0;i--){this.subDomObj.removeChild(this.nodes[i].domObj);this.nodes[i].finalize();this.nodes.pop();}},update:function(shouldDescend){var bLast=true;if(this.subDomObj)
{if(bLast){this.subDomObj.removeClass('jxTreeNest');}else{this.subDomObj.addClass('jxTreeNest');}}
if(this.nodes&&shouldDescend){this.nodes.each(function(n){n.update(false);});}},append:function(node){node.owner=this;this.nodes.push(node);this.subDomObj.appendChild(node.domObj);this.update(true);return this;}});Fusion.Error=OpenLayers.Class({type:null,message:null,initialize:function(type,message){this.type=type;this.message=message;},alert:function(){var type=this.typeToString(this.type);alert(OpenLayers.i18n('fusionError',{'type':type,'message':this.message}));},toString:function(){var type=this.typeToString(this.type);return type+": "+this.message;},typeToString:function(type){switch(type){case Fusion.Error.FATAL:return'FATAL';case Fusion.Error.WARNING:return'WARNING';case Fusion.Error.NOTICE:return'NOTICE';default:return'UNKNOWN ('+type+')';}}});Fusion.Error.FATAL=0;Fusion.Error.WARNING=1;Fusion.Error.NOTICE=2;Fusion.Lib.EventMgr=OpenLayers.Class({events:null,initialize:function(){if(!this.events){this.events=[];}},destroy:function(){this.events=[];},registerEventID:function(eventID){if(!this.events){this.events=[];}
if(!eventID){Fusion.reportError(new Fusion.Error(Fusion.Error.WARNING,OpenLayers.i18n('regsiterEventError')));}
var ev=new String(eventID);if(!this.events[eventID]){this.events[eventID]=[];}},registerForEvent:function(eventID,f){var ev=new String(eventID);this.events[eventID].push(f);},deregisterForEvent:function(eventID,f){var ev=new String(eventID);var bResult=false;if(!this.events[eventID]){return false;}
for(var i=0;i<this.events[eventID].length;i++){if(this.events[eventID][i]==f){this.events[eventID].splice(i,1);bResult=true;}}
return bResult;},triggerEvent:function(eventID){var ev=new String(eventID);if(!this.events||!this.events[eventID]){return false;}
for(var i=0;i<this.events[eventID].length;i++){this.events[eventID][i].apply(null,arguments);}
return true;}});Fusion.events=[];Fusion.registerEventID=Fusion.Lib.EventMgr.prototype.registerEventID;Fusion.registerForEvent=Fusion.Lib.EventMgr.prototype.registerForEvent;Fusion.triggerEvent=Fusion.Lib.EventMgr.prototype.triggerEvent;Fusion.Event.FUSION_INITIALIZED=Fusion.Event.lastEventId++;Fusion.Event.FUSION_ERROR=Fusion.Event.lastEventId++;Fusion.registerEventID(Fusion.Event.FUSION_INITIALIZED);Fusion.registerEventID(Fusion.Event.FUSION_ERROR);Fusion.Lib.ApplicationDefinition=OpenLayers.Class({mapGroups:null,widgetSets:null,oBroker:null,searchDefinitions:null,searchCategories:null,initialize:function(sessionId){this.sessionId=sessionId;this.oBroker=Fusion.getBroker();this.applicationDefinition=Fusion.getApplicationDefinitionURL();this.widgetSets=[];this.mapGroups={};this.searchDefinitions=[];this.searchCategories=[];this.parse();},parse:function(){if(this.applicationDefinition==''){return null;}
if((this.applicationDefinition.match('Library://')==null)&&(this.applicationDefinition.match('Session:')==null)){if(Fusion.appDefJson){this.parseAppDef(Fusion.appDefJson);}else{Fusion.getXmlAsJson(this.applicationDefinition,OpenLayers.Function.bind(this.getAppDefCB,this));}}else{if(!this.sessionId){window.setTimeout(OpenLayers.Function.bind(this.createSessionThenGetAppDef,this),5);}else{window.setTimeout(OpenLayers.Function.bind(this.getAppDef,this),5);}}
return true;},createSessionThenGetAppDef:function(){var r=new Fusion.Lib.MGRequest.MGCreateSession();this.oBroker.dispatchRequest(r,OpenLayers.Function.bind(this.createSessionThenGetAppDefCB,this));},createSessionThenGetAppDefCB:function(xhr){if(xhr&&typeof(xhr)=="object"&&xhr.responseText){this.sessionId=xhr.responseText;Fusion.sessionId=this.sessionId;}
this.getAppDef();},getAppDef:function(){var r=new Fusion.Lib.MGRequest.MGGetResourceContent(this.applicationDefinition);r.parameters.session=this.sessionId;r.parameters.format='application/json';this.oBroker.dispatchRequest(r,OpenLayers.Function.bind(this.getAppDefCB,this));},getAppDefCB:function(xhr){var o;eval("o="+xhr.responseText);this.parseAppDef(o);Fusion.setLoadState(Fusion.LOAD_WIDGETS);},parseAppDef:function(json){var appDef=json.ApplicationDefinition;if(appDef.Title){var title=appDef.Title[0];document.title=title;}
if(appDef.MapSet){var mapSet=appDef.MapSet[0];if(mapSet.MapGroup instanceof Array){for(var i=0;i<mapSet.MapGroup.length;i++){var mapGroup=new Fusion.Lib.ApplicationDefinition.MapGroup(mapSet.MapGroup[i]);this.mapGroups[mapGroup.mapId]=mapGroup;}}}else{Fusion.reportError(new Fusion.Error(Fusion.Error.FATAL,OpenLayers.i18n('appDefParseError')));}
if(appDef.WidgetSet){for(var i=0;i<appDef.WidgetSet.length;i++){var widgetSet=new Fusion.Lib.ApplicationDefinition.WidgetSet(appDef.WidgetSet[i]);this.widgetSets.push(widgetSet);}}else{Fusion.reportError(new Fusion.Error(Fusion.Error.FATAL,OpenLayers.i18n('widgetSetParseError')));}
if(appDef.Extension){var extension=appDef.Extension[0];if(extension.SearchDefinitions instanceof Array){var categories=extension.SearchDefinitions[0];if(categories.SearchCategory instanceof Array){for(var i=0;i<categories.SearchCategory.length;i++){var oCategory={};var category=categories.SearchCategory[i];oCategory.id=category['@id'];oCategory.name=category['@name'];oCategory.layer=category.Layer?category.Layer[0]:'';oCategory.searchDefinitions=[];this.searchCategories[oCategory.id]=oCategory;var defns=category.SearchDefinition;for(var k=0;k<defns.length;k++){var defn=new Fusion.Lib.ApplicationDefinition.SearchDefinition(defns[k]);defn.category=oCategory;oCategory.searchDefinitions[defn.id]=defn;this.searchDefinitions[defn.id]=defn;}}}}}},create:function(){for(var i=0;i<this.widgetSets.length;i++){this.widgetSets[i].create(this);}},getMapByName:function(name){var map=null;for(var i=0;i<this.widgetSets.length;i++){map=this.widgetSets[i].getMapByName(name);if(map){break;}}
return map;},getMapById:function(id){var map=null;for(var i=0;i<this.widgetSets.length;i++){map=this.widgetSets[i].mapWidget;if(map.mapId==id){break;}}
return map;},getMapByIndice:function(indice){var map=null;if(this.widgetSets.length>indice){map=this.widgetSets[indice].getMapWidget();}
return map;},getMapGroup:function(mapGroupId){return this.mapGroups[mapGroupId];},getWidgetsByType:function(type){var widgets=[];for(var i=0;i<this.widgetSets.length;i++){widgets=widgets.concat(this.widgetSets[i].getWidgetsByType(type));}
return widgets;}});Fusion.Lib.ApplicationDefinition.MapGroup=OpenLayers.Class({initialView:null,maps:null,initialize:function(jsonNode){this.mapId=jsonNode['@id'][0];this.maps=[];if(jsonNode.InitialView){var iv=jsonNode.InitialView[0];if(iv.CenterX&&iv.CenterY&&iv.Scale){this.setInitialView({x:parseFloat(iv.CenterX[0]),y:parseFloat(iv.CenterY[0]),scale:parseFloat(iv.Scale[0])});}else if(iv.MinX&&iv.MinY&&iv.MaxX&&iv.MaxY){this.setInitialView({minX:parseFloat(iv.MinX[0]),minY:parseFloat(iv.MinY[0]),maxX:parseFloat(iv.MaxX[0]),maxY:parseFloat(iv.MaxY[0])});}else{}}
if(jsonNode.Map instanceof Array){for(var i=0;i<jsonNode.Map.length;i++){var map=new Fusion.Lib.ApplicationDefinition.Map(jsonNode.Map[i]);var links={groups:[],layers:[]};var mapEvents={layerEvents:{},groupEvents:{}};if(jsonNode.Map[i].Extension){var extension=jsonNode.Map[i].Extension[0];if(extension.Links){if(extension.Links[0].Group instanceof Array){for(var j=0;j<extension.Links[0].Group.length;j++){var group=extension.Links[0].Group[j];links.groups.push({name:group.Name[0],url:group.Url[0]});}}
if(extension.Links[0].Layer instanceof Array){for(var j=0;j<extension.Links[0].Layer.length;j++){var layer=extension.Links[0].Layer[j];links.layers.push({name:layer.Name[0],url:layer.Url[0]});}}}
if(extension.MapEvents){if(extension.MapEvents[0].Layer instanceof Array){for(var j=0;j<extension.MapEvents[0].Layer.length;j++){var layer=extension.MapEvents[0].Layer[j];var layerObj={};layerObj.name=layer.Name[0];layerObj.onEnable=[];if(layer.OnEnable instanceof Array){layerObj.onEnable=this.parseMapEventSubBlock(layer.OnEnable[0]);}
layerObj.onDisable=[];if(layer.OnDisable instanceof Array){layerObj.onDisable=this.parseMapEventSubBlock(layer.OnDisable[0]);}
mapEvents.layerEvents[layerObj.name]=layerObj;}}
if(extension.MapEvents[0].Group instanceof Array){for(var j=0;j<extension.MapEvents[0].Group.length;j++){var group=extension.MapEvents[0].Group[j];var groupObj={};groupObj.name=group.Name[0];groupObj.onEnable=[];if(layer.OnEnable instanceof Array){groupObj.onEnable=this.parseMapEventSubBlock(group.OnEnable[0]);}
groupObj.onDisable=[];if(layer.OnDisable instanceof Array){groupObj.onDisable=this.parseMapEventSubBlock(group.OnDisable[0]);}
mapEvents.groupEvents[groupObj.name]=groupObj;}}}}
map.mapInfo={links:links,mapEvents:mapEvents};this.maps.push(map);}}else{}},parseMapEventSubBlock:function(block){var a=[];if(block.Layer&&block.Layer instanceof Array){for(var i=0;i<block.Layer.length;i++){var layer=block.Layer[i];a.push({type:'layer',name:layer.Name[0],enable:layer.Enable[0]=='true'?true:false});}}
if(block.Group&&block.Group instanceof Array){for(var i=0;i<block.Group.length;i++){var group=block.Group[i];a.push({type:'group',name:group.Name[0],enable:group.Enable[0]=='true'?true:false});}}
return a;},getInitialView:function(){return this.initialView;},setInitialView:function(view){this.initialView=view;}});Fusion.Lib.ApplicationDefinition.Map=OpenLayers.Class({type:null,singleTile:false,extension:null,initialize:function(jsonNode){this.type=jsonNode.Type[0];if(jsonNode.SingleTile){var b=jsonNode.SingleTile[0].toLowerCase();this.singleTile=(b=="true")?true:false;}
if(jsonNode.Extension){this.extension=jsonNode.Extension[0];}else{this.extension={};}
this.resourceId=this.extension.ResourceId?this.extension.ResourceId[0]:'';var tagOptions=this.extension.Options;this.layerOptions={};if(tagOptions&&tagOptions[0]){for(var key in tagOptions[0]){this.layerOptions[key]=tagOptions[0][key][0];if(this.layerOptions[key].toLowerCase()=='true'){this.layerOptions[key]=true;}else if(this.layerOptions[key].toLowerCase()=='false'){this.layerOptions[key]=false;}
if(key=='maxExtent'||key=='minExtent'){this.layerOptions[key]=OpenLayers.Bounds.fromString(this.layerOptions[key]);}}}
var tagParams=this.extension.Parameters;this.layerParams={};if(tagParams&&tagParams[0]){for(var key in tagParams[0]){this.layerParams[key]=tagParams[0][key][0];}}
switch(this.type){case'MapGuide':case'MapServer':if(!Fusion.Layers[this.type]){Fusion.require('layers/'+this.type+'/'+this.type+'.js');}
break;default:if(!Fusion.Layers.Generic){Fusion.require('layers/Generic/Generic.js');}
break;}}});Fusion.Lib.ApplicationDefinition.WidgetSet=OpenLayers.Class({containers:null,containersByName:null,widgetTags:null,widgetTagsByName:null,widgetInstances:null,mapWidget:null,mapId:null,initialize:function(jsonNode){this.containers=[];this.widgetTags=[];this.widgetInstances=[];this.widgetTagsByName={};this.containersByName={};if(jsonNode.MapWidget){for(var i=0;i<jsonNode.MapWidget.length;i++){var widget=new Fusion.Lib.ApplicationDefinition.Widget(jsonNode.MapWidget[i]);widget.widgetSet=this;this.mapWidgetTag=widget;this.mapId=jsonNode.MapWidget[i].MapId[0];}}
if(jsonNode.Widget){for(var i=0;i<jsonNode.Widget.length;i++){var widget=new Fusion.Lib.ApplicationDefinition.Widget(jsonNode.Widget[i]);widget.widgetSet=this;this.widgetTags.push(widget);this.widgetTagsByName[widget.name]=widget;}}
if(jsonNode.Container){for(var i=0;i<jsonNode.Container.length;i++){var container=new Fusion.Lib.ApplicationDefinition.Container(jsonNode.Container[i]);this.containers.push(container);this.containersByName[container.name]=container;}}},addWidgetInstance:function(widget){this.widgetInstances.push(widget);},getMapWidget:function(){return this.mapWidget;},create:function(appDef){var mapGroup=null;var paramMapId=Fusion.getQueryParam('mapid');if(paramMapId.length>0){mapGroup=appDef.getMapGroup(paramMapId);if(mapGroup){this.mapId=paramMapId;}else{Fusion.reportError(new Fusion.Error(Fusion.Error.WARNING,"can't find MapGroup: "+paramMapId+' - reverting to default map'));}}
if(!mapGroup){mapGroup=appDef.getMapGroup(this.mapId);}
this.mapWidget=new Fusion.Widget.Map(this.mapWidgetTag,mapGroup,this);this.mapWidget.setMenu();$(this.mapWidgetTag.name).widget=this.mapWidget;for(var i=0;i<this.widgetTags.length;i++){this.widgetTags[i].create(this);}
for(var i=0;i<this.containers.length;i++){this.containers[i].create(this);}},getMapByName:function(name){var map=null;if(this.mapWidget.getMapName()==name){map=this.mapWidget;}
return map;},getWidgetsByType:function(type){var widgets=[];for(var i=0;i<this.widgetInstances.length;i++){if(this.widgetInstances[i].type==type){widgets.push(this.widgetInstances[i]);}}
return widgets;},getWidgetByName:function(name){return this.widgetTagsByName[name];},getContainerByName:function(name){return this.containersByName[name];}});Fusion.Lib.ApplicationDefinition.Container=OpenLayers.Class({name:null,type:null,validPositions:['top','left','bottom','right'],position:'top',items:null,initialize:function(jsonNode){this.type=jsonNode.Type[0];this.name=jsonNode.Name[0];var position=jsonNode.Position?jsonNode.Position[0].toLowerCase():this.position;for(var i=0;i<this.validPositions.length;i++){if(this.validPositions[i]==position){this.position=position;break;}}
this.items=[];if(jsonNode.Item){for(var i=0;i<jsonNode.Item.length;i++){var item=new Fusion.Lib.ApplicationDefinition.Item(jsonNode.Item[i]);this.items.push(item);}}else{}},create:function(widgetSet){var container;if(this.type=='Toolbar'||this.type=='Statusbar'){if($(this.name)){container=new Jx.Toolbar({parent:this.name,position:this.position});$(this.name).container=container;this.createWidgets(widgetSet,container);}}else if(this.type=='Splitterbar'){if($(this.name)){container=new Jx.Splitter(this.name,{splitInto:this.items.length});for(var i=0;i<this.items.length;i++){container.elements[i].id=this.name+'_'+i;}
$(this.name).container=container;this.createWidgets(widgetSet,container);}}
if(container&&container.domObj.jxLayout){container.domObj.jxLayout.resize({forceResize:true});}},createWidgets:function(widgetSet,container){for(var i=0;i<this.items.length;i++){this.items[i].create(widgetSet,container,this.name+'_'+i);}}});Fusion.Lib.ApplicationDefinition.Widget=OpenLayers.Class({name:null,type:null,statusText:null,location:null,imageUrl:null,imageClass:null,tooltip:null,label:null,disabled:null,extension:null,initialize:function(jsonNode){if(jsonNode){this.type=jsonNode.Type[0];this.name=jsonNode.Name?jsonNode.Name[0]:'';this.statusText=jsonNode.StatusText?jsonNode.StatusText[0]:'';this.statusText=OpenLayers.i18n(this.statusText);this.location=jsonNode.Location?jsonNode.Location[0]:'widgets/';if(this.location.slice(-1)!='/'){this.location+='/';}
this.imageUrl=jsonNode.ImageUrl?jsonNode.ImageUrl[0]:'';this.imageClass=jsonNode.ImageClass?jsonNode.ImageClass[0]:'';this.tooltip=jsonNode.Tooltip?jsonNode.Tooltip[0]:'';this.tooltip=OpenLayers.i18n(this.tooltip);this.label=jsonNode.Label?jsonNode.Label[0]:'';this.label=OpenLayers.i18n(this.label);this.disabled=jsonNode.Disabled?(jsonNode.Disabled[0].toLowerCase()=='true'?true:false):false;if(jsonNode.Extension){this.extension=jsonNode.Extension[0];}else{this.extension={};}
if(!Fusion.Widget[this.type]){Fusion.require(this.location+this.type+'.js');}}},getMapWidget:function(){if(this.widgetSet){return this.widgetSet.getMapWidget();}else{return null;}},create:function(widgetSet,widgetName){var widget=null;this.widgetSet=widgetSet;var oldName=this.name;if(typeof widgetName=='undefined'){widgetName=this.name;}
if(widgetName!=null&&(widgetName==''||$(widgetName)!=null)){this.name=widgetName;widget=eval("new Fusion.Widget."+this.type+"(this)");widgetSet.addWidgetInstance(widget);if($(this.name)){widget.id=this.name;$(this.name).widget=widget;if(widget.uiClass){widget.setUiObject(new widget.uiClass({label:this.label,image:this.imageUrl,imageClass:this.imageClass,toggle:this.isExclusive}));if(widget.uiObj.addTo){widget.uiObj.addTo($(this.name));}
if(widget.uiObj.setEnabled){widget.uiObj.setEnabled(widget.isEnabled());widget.registerForEvent(Fusion.Event.WIDGET_STATE_CHANGED,function(){widget.uiObj.setEnabled(widget.isEnabled());});}}}
this.name=oldName;}
return widget;}});Fusion.Lib.ApplicationDefinition.Item=OpenLayers.Class({uniqueId:[0],type:null,initialize:function(jsonNode){this.type=jsonNode.Function[0];switch(this.type){case'Widget':this.widgetName=jsonNode.Widget[0];break;case'Flyout':this.flyout=new Fusion.Lib.ApplicationDefinition.Flyout(jsonNode);break;case'Multi':this.multi=new Fusion.Lib.ApplicationDefinition.Multi(jsonNode);break;case'Separator':break;}},create:function(widgetSet,container,idx){switch(this.type){case'Widget':var widgetTag=widgetSet.getWidgetByName(this.widgetName);if(widgetTag){var name='FusionItem'+this.uniqueId[0];this.uniqueId[0]++;if(container instanceof Jx.Toolbar){var widget=widgetTag.create(widgetSet,'');if(!widget.uiClass){widget.uiClass=Jx.Toolbar.Item;widget.setUiObject(new widget.uiClass());}else if(widget.uiClass==Jx.Button||widget.uiClass==Jx.Button.Color||widget.uiClass==Jx.Menu){widget.setUiObject(new widget.uiClass({label:widgetTag.label,image:widgetTag.imageUrl,imageClass:widgetTag.imageClass,toggle:widget.isExclusive}));}
container.add(widget.uiObj);if(widget.uiObj.setEnabled){widget.uiObj.setEnabled(widget.isEnabled());widget.registerForEvent(Fusion.Event.WIDGET_STATE_CHANGED,function(){widget.uiObj.setEnabled(widget.isEnabled());});}}else if(container instanceof Jx.Splitter){var widget=widgetTag.create(widgetSet,idx);}else if(container instanceof Jx.Menu||container instanceof Jx.Menu.Context||container instanceof Jx.Menu.SubMenu){var widget=widgetTag.create(widgetSet,'');if(!widget.uiClass||widget.uiClass==Jx.Button){widget.uiClass=Jx.Menu.Item;}else if(widget.uiClass==Jx.Menu){widget.uiClass=Jx.Menu.SubMenu;}
widget.setUiObject(new widget.uiClass({label:widgetTag.label,image:widgetTag.imageUrl,imageClass:widgetTag.imageClass,toggle:widget.isExclusive}));container.add(widget.uiObj);if(widget.uiObj.setEnabled){widget.uiObj.setEnabled(widget.isEnabled());widget.registerForEvent(Fusion.Event.WIDGET_STATE_CHANGED,function(){widget.uiObj.setEnabled(widget.isEnabled());});}}else if(container instanceof Jx.Button.Multi){var widget=widgetTag.create(widgetSet,'');widget.uiClass=Jx.Button;widget.setUiObject(new widget.uiClass({label:widgetTag.label,image:widgetTag.imageUrl,imageClass:widgetTag.imageClass,toggle:widget.isExclusive}));container.add(widget.uiObj);if(widget.uiObj.setEnabled){widget.uiObj.setEnabled(widget.isEnabled());widget.registerForEvent(Fusion.Event.WIDGET_STATE_CHANGED,function(){widget.uiObj.setEnabled(widget.isEnabled());});}}}else{Fusion.reportError(new Fusion.Error(Fusion.Error.WARNING,"can't find widget: "+this.widgetName));}
break;case'Flyout':var menu;var opt={label:this.flyout.label,tooltip:this.flyout.tooltip,image:this.flyout.imageUrl,imageClass:this.flyout.imageClass};if(container instanceof Jx.Toolbar){menu=new Jx.Menu(opt);}else if(container instanceof Jx.Menu||container instanceof Jx.Menu.Context||container instanceof Jx.Menu.SubMenu){menu=new Jx.Menu.SubMenu(opt);}
container.add(menu);this.flyout.create(widgetSet,menu);break;case'Multi':var multi;var opt={label:this.multi.label,tooltip:this.multi.tooltip,image:this.multi.imageUrl,imageClass:this.multi.imageClass}
multi=new Jx.Button.Multi(opt);container.add(multi);this.multi.create(widgetSet,multi);break;case'Separator':if(container instanceof Jx.Toolbar){container.add(new Jx.Toolbar.Separator());}else if(container instanceof(Jx.Menu)||container instanceof(Jx.Menu.SubMenu)||container instanceof(Jx.Menu.Context)){container.add(new Jx.Menu.Separator());}
break;}}});Fusion.Lib.ApplicationDefinition.Flyout=OpenLayers.Class({label:null,tooltip:null,description:null,imageUrl:null,items:null,initialize:function(jsonNode){this.label=jsonNode.Label?OpenLayers.Lang.translate(jsonNode.Label[0]):'';this.tooltip=jsonNode.Tooltip?jsonNode.Tooltip[0]:'';this.description=jsonNode.Description?jsonNode.Description[0]:'';this.imageUrl=jsonNode.ImageUrl?jsonNode.ImageUrl[0]:'';this.items=[];if(jsonNode.Item instanceof Array){for(var i=0;i<jsonNode.Item.length;i++){this.items.push(new Fusion.Lib.ApplicationDefinition.Item(jsonNode.Item[i]));}}},create:function(widgetSet,menu){for(var i=0;i<this.items.length;i++){this.items[i].create(widgetSet,menu);}}});Fusion.Lib.ApplicationDefinition.Multi=OpenLayers.Class({label:null,tooltip:null,description:null,imageUrl:null,items:null,initialize:function(jsonNode){this.label=jsonNode.Label?jsonNode.Label[0]:'';this.tooltip=jsonNode.Tooltip?jsonNode.Tooltip[0]:'';this.description=jsonNode.Description?jsonNode.Description[0]:'';this.imageUrl=jsonNode.ImageUrl?jsonNode.ImageUrl[0]:'';this.items=[];if(jsonNode.Item instanceof Array){for(var i=0;i<jsonNode.Item.length;i++){this.items.push(new Fusion.Lib.ApplicationDefinition.Item(jsonNode.Item[i]));}}},create:function(widgetSet,multi){for(var i=0;i<this.items.length;i++){this.items[i].create(widgetSet,multi);}}});Fusion.Lib.ApplicationDefinition.SearchDefinition=OpenLayers.Class({id:null,name:null,category:null,parameters:null,join:null,rule:null,initialize:function(json){this.id=json['@id'];this.name=json['@name'];if(json.Join instanceof Array){this.join=new Fusion.Lib.ApplicationDefinition.SearchJoin(json.Join[0]);}
this.parameters=[];if(json.Parameter instanceof Array){for(var i=0;i<json.Parameter.length;i++){this.parameters.push(json.Parameter[i]['@name']);}}
this.reports=[];if(json.Report instanceof Array){for(var i=0;i<json.Report.length;i++){var label=json.Report[i].Label[0]
var link=json.Report[i].Link[0]
this.reports.push({'label':label,'link':link});}}
var rule;if(json.SearchAnd instanceof Array){this.rule=new Fusion.Lib.ApplicationDefinition.SearchRule('AND');rule=json.SearchAnd[0];}else if(json.SearchOr instanceof Array){this.rule=new Fusion.Lib.ApplicationDefinition.SearchRule('OR');rule=json.SearchOr[0];}
if(rule&&rule.SearchCondition instanceof Array){for(var i=0;i<rule.SearchCondition.length;i++){this.rule.add(new Fusion.Lib.ApplicationDefinition.SearchCondition(rule.SearchCondition[i]));}}},getJoinUrl:function(params){if(this.join){return'&joinlayer='+this.join.layer+'&joinpk='+this.join.primaryKey+'&joinfk='+this.join.foreignKey;}else{return'';}},getFilterUrl:function(params){return'&filter='+encodeURIComponent(this.rule.toString(params));}});Fusion.Lib.ApplicationDefinition.SearchJoin=OpenLayers.Class({layer:null,primaryKey:null,foreignKey:null,initialize:function(json){this.layer=json.Layer?json.Layer[0]:'';this.primaryKey=json.PrimaryKey?json.PrimaryKey[0]:'';this.foreignKey=json.ForeignKey?json.ForeignKey[0]:'';}});Fusion.Lib.ApplicationDefinition.SearchRule=OpenLayers.Class({type:null,conditions:null,initialize:function(type){this.type=type;this.conditions=[];},add:function(condition){this.conditions.push(condition);},remove:function(condition){for(var i=0;i<this.conditions.length;i++){if(this.conditions[i]==condition){this.conditions.splice(i,1);break;}}},toString:function(params){var conditions=[];for(var i=0;i<this.conditions.length;i++){this.conditions[i].setParams(params);var c=this.conditions[i].toString();if(c!=''){conditions.push(c);}}
return'('+conditions.join(') '+this.type+' (')+')';}});Fusion.Lib.ApplicationDefinition.SearchCondition=OpenLayers.Class({column:null,operator:null,parameter:null,quote:null,value:null,operators:{eq:'=',like:'like',lt:'<',lte:'<=',gt:'>',gte:'>=',neq:'<>'},includeIfEmpty:false,initialize:function(json){this.column=json.Column[0];this.operator=this.operators[json.Operator[0].toLowerCase()];this.parameter=json.Parameter[0];this.quote=json['@quote']?json['@quote']:'';this.wildcard=json['@wildcard']?json['@wildcard']:'both';this.caseSensitive=true;if(json['@caseSensitive']&&json['@caseSensitive']=='false'){this.caseSensitive=false;}},setParams:function(p){if(p[this.parameter]){this.value=p[this.parameter];}else{this.value='';}},toString:function(){var value=this.value?this.value:'';if(value==''&&!this.includeIfEmpty){return'';}
var upper='';if(!this.caseSensitive){value=value.toUpperCase();upper='Upper';}
var prewildcard='';var prewildcard='';var postwildcard='';if(this.operator=='like'){if(this.wildcard=='before'||this.wildcard=='both'){prewildcard='*';}
if(this.wildcard=='after'||this.wildcard=='both'){postwildcard='*';}}
var wildcard=this.operator=='like'?'*':'';return upper+'('+this.column+') '+this.operator+' '+this.quote+prewildcard+value+postwildcard+this.quote;}});Fusion.Lib.MGBroker=OpenLayers.Class({mapGuideURL:'',mapAgentURL:'',method:null,initialize:function(){},dispatchRequest:function(r,f){var s=r.encode()+'&ts='+(new Date()).getTime();if(this.method){r.options.method=this.method;}
var a=new OpenLayers.Ajax.Request(this.mapAgentURL,OpenLayers.Util.extend({parameters:r.parameters,onComplete:f},r.options));a.originalRequest=r;},setSiteURL:function(url,user,pass){this.user=user;this.pass=pass;if(url.indexOf('mapagent.fcgi')==-1){if(url.charAt(url.length-1)!='/'){url=url+'/';}
this.mapGuideURL=url;url=url+'mapagent/mapagent.fcgi';}
this.mapAgentURL=url;},clearSiteURL:function(){this.user='';this.pass='';this.mapGuideURL='';this.mapAgentURL='';}});Fusion.Lib.MGRequest=OpenLayers.Class({options:null,parameters:null,initializeRequest:function(){this.options={method:'post'};this.parameters={version:'1.0.0',locale:Fusion.locale,clientagent:'Fusion Viewer'};},setParams:function(o){OpenLayers.Util.extend(this.parameters,(o||{}));},setOptions:function(o){OpenLayers.Util.extend(this.options,(o||{}));},encode:function(){var s=sep='';for(var p in this.parameters){if(this.parameters[p]){s=s+sep+p+'='+encodeURI(this.parameters[p]);}
sep='&';}
return s;}});Fusion.Lib.MGRequest.MGEnumerateResources=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(resourceID,type,depth){this.initializeRequest();this.setParams({operation:'ENUMERATERESOURCES',resourceid:(resourceID||"Library://"),type:(type||""),depth:(typeof depth=='undefined'?-1:depth)});}});Fusion.Lib.MGRequest.MGGetResourceContent=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(resourceID){this.initializeRequest();this.setParams({operation:'GETRESOURCECONTENT',resourceid:(resourceID||"Library://")});}});Fusion.Lib.MGRequest.MGGetResourceHeader=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(resourceID){this.initializeRequest();this.setParams({operation:'GETRESOURCEHEADER',resourceid:(resourceID||"Library://")});}});Fusion.Lib.MGRequest.MGCreateSession=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(){this.initializeRequest();this.setParams({operation:'CREATESESSION'});}});Fusion.Lib.MGRequest.MGCopyResource=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(sourceID,destinationID,overwrite){this.initializeRequest();this.setParams({operation:'COPYRESOURCE',source:sourceID,destination:destinationID,overwrite:overwrite});}});Fusion.Lib.MGRequest.MGDeleteResource=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(resourceID){this.initializeRequest();this.setParams({operation:'DELETERESOURCE',resourceid:resourceID});}});Fusion.Lib.MGRequest.MGMoveResource=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(sourceID,destinationID,overwrite){this.initializeRequest();this.setParams({operation:'MOVERESOURCE',source:sourceID,destination:destinationID,overwrite:overwrite});}});Fusion.Lib.MGRequest.MGMoveResource=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(resourceID,content,header){this.initializeRequest();this.setParams({method:'post',operation:'SETRESOURCE',resourceid:resourceID,content:content,header:header});}});Fusion.Lib.MGRequest.MGDescribeSchema=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(resourceID,schema){this.initializeRequest();this.setParams({operation:'DESCRIBEFEATURESCHEMA',resourceid:resourceID,schema:schema});}});Fusion.Lib.MGRequest.MGGetSpatialContexts=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(resourceID,activeonly){this.initializeRequest();this.setParams({operation:'GETSPATIALCONTEXTS',resourceid:resourceID,activeonly:activeonly?'1':'0'});}});Fusion.Lib.MGRequest.MGEnumerateResourceReferences=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(resourceID){this.initializeRequest();this.setParams({operation:'ENUMERATERESOURCEREFERENCES',resourceid:resourceID});}});Fusion.Lib.MGRequest.MGEnumerateResourceData=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(resourceID){this.initializeRequest();this.setParams({operation:'ENUMERATERESOURCEDATA',resourceid:resourceID});}});Fusion.Lib.MGRequest.MGGetVisibleMapExtent=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(sessionId,mapName,viewCenterX,viewCenterY,viewScale,dataExtent,displayDpi,displayWidth,displayHeight,showLayers,hideLayers,showGroups,hideGroups,refreshLayers){this.initializeRequest();this.setParams({operation:'GETVISIBLEMAPEXTENT',session:sessionId,mapname:mapName,setviewcenterx:viewCenterX,setviewcentery:viewCenterY,setviewscale:viewScale,setdataextent:dataExtent,setdisplaydpi:displayDpi,setdisplaywidth:displayWidth,setdisplayheight:displayHeight,showlayers:showLayers,hidelayers:hideLayers,showgroups:showGroups,hidegroups:hideGroups,refreshlayers:refreshLayers});}});Fusion.Lib.MGRequest.MGQueryMapFeatures=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(sessionId,mapName,geometry,maxFeatures,persist,selectionVariant,layerNames,layerAttributeFilter)
{this.initializeRequest();this.setParams({operation:'QUERYMAPFEATURES',session:sessionId,mapname:mapName,geometry:geometry,maxFeatures:maxFeatures,persist:persist,selectionVariant:selectionVariant,layerNames:layerNames,layerAttributeFilter:layerAttributeFilter});}});Fusion.Lib.MGRequest.MGGetFeatureSetEnvelope=OpenLayers.Class(Fusion.Lib.MGRequest,{initialize:function(sessionId,mapName,features)
{this.initializeRequest();this.setParams({operation:'GETFEATURESETENVELOPE',session:sessionId,mapname:mapName,featureSet:features});}});Fusion.Event.WIDGET_STATE_CHANGED=Fusion.Event.lastEventId++;Fusion.Widget=OpenLayers.Class(Fusion.Lib.EventMgr,{isExclusive:false,name:null,type:null,oMap:null,enabled:false,mapLoadedWatcher:null,paramRegister:null,groups:[],group:null,domObj:null,uiClass:null,initialize:function(widgetTag){this.type=widgetTag.type;this.name=widgetTag.name;this.widgetTag=widgetTag;this.registerEventID(Fusion.Event.WIDGET_STATE_CHANGED);if(!Fusion.Widget.uiInstances[this.type]){Fusion.Widget.uiInstances[this.type]=[];}
var group=widgetTag.extension.Group?widgetTag.extension.Group[0]:'';if(group!=''){if(!this.groups[group]){this.groups[group]=[];}
this.groups[group].push(this);this.group=group;}
this.setMap(widgetTag.getMapWidget());if(widgetTag.name){this.domObj=$(widgetTag.name);}
this.paramRegister=[];this.initializeWidget(widgetTag);},initializeWidget:function(){},activate:function(){},deactivate:function(){},setUiObject:function(uiObj){Fusion.Widget.uiInstances[this.type].push(this);if(this.widgetTag.tooltip){if(uiObj.setTooltip){uiObj.setTooltip(this.widgetTag.tooltip);}else if(uiObj.button&&uiObj.button.setTooltip){uiObj.button.setTooltip(this.widgetTag.tooltip);}}
if(this.isExclusive){this.getMap().buttonSet.add(uiObj);}
if(uiObj.options.active){this.activate();}
if(uiObj.addEvents){if(Fusion.Widget.uiInstances[this.type][0].uiObj&&Fusion.Widget.uiInstances[this.type][0].uiObj.options.active&&Fusion.Widget.uiInstances[this.type][0].shouldActivateWith(this)){uiObj.options.active=true;if(uiObj.domA){uiObj.domA.addClass('jx'+uiObj.options.type+'Active');}}
uiObj.addEvents({'click':(function(){this.activate();}).bind(this),'up':(function(){var instances=Fusion.Widget.uiInstances[this.type];for(var i=0;i<instances.length;i++){var instance=instances[i];if(instance.shouldActivateWith(this)&&instance.uiObj){instance.uiObj.options.active=false;if(instance.uiObj.domA){instance.uiObj.domA.removeClass('jx'+instance.uiObj.options.type+'Active');}}}
this.deactivate();}).bind(this),'down':(function(){var instances=Fusion.Widget.uiInstances[this.type];for(var i=0;i<instances.length;i++){var instance=instances[i];if(instance.shouldActivateWith(this)&&instance.uiObj){instance.uiObj.options.active=true;if(instance.uiObj.domA){instance.uiObj.domA.addClass('jx'+instance.uiObj.options.type+'Active');}}}
this.activate();}).bind(this)});}
this.uiObj=uiObj;},shouldActivateWith:function(widget){return true;},setMap:function(oMap){if(this.mapLoadedWatcher){this.oMap.deregisterForEvent(Fusion.Event.MAP_LOADED,this.mapLoadedWatcher);this.mapLoadedWatcher=null;}
this.oMap=oMap;if(oMap){this.mapLoadedWatcher=OpenLayers.Function.bind(this._mapLoaded,this);oMap.registerForEvent(Fusion.Event.MAP_LOADED,this.mapLoadedWatcher);}
if(oMap&&oMap.isLoaded()){this.enable();}else{this.disable();}},getMap:function(){return this.oMap;},addControl:function(control){this.getMap().oMapOL.addControl(control);},_mapLoaded:function(){if(this.oMap&&this.oMap.isLoaded()){this.enable();}else{this.disable();}},setMutEx:function(bIsMutEx){this.isExclusive=bIsMutEx;},isMutEx:function(){return this.isExclusive;},getName:function(){return this.name;},getLocation:function(){return this.widgetTag.location;},isEnabled:function(){return this.enabled;},enable:function(){this.enabled=true;this.triggerEvent(Fusion.Event.WIDGET_STATE_CHANGED,this);},disable:function(){this.enabled=false;this.triggerEvent(Fusion.Event.WIDGET_STATE_CHANGED,this);},setParameter:function(param,value){},registerParameter:function(param){this.paramRegister.push(param);}});Fusion.Widget.uiInstances={};Fusion.Tool.Search=OpenLayers.Class({lastSearch:null,lastResult:null,resultOffset:0,initialize:function(){},getProperties:function(){var properties=null;if(this.lastResult&&this.lastResult.properties){properties=this.lastResult.properties;}
return properties;},getNumberOfProperties:function(){var n=0;if(this.lastResult&&this.lastResult.properties){n=this.lastResult.properties.length;}
return n;},getProperty:function(n){var property='';if(this.lastResult&&this.lastResult.properties){property=this.lastResult.properties[n];}
return property;},getNumberOfResults:function(){result=0;if(this.lastResult&&this.lastResult.values){result=this.lastResult.values.length;}
return result;},getFirstResult:function(){this.resultOffset=0;return this.getResult(this.resultOffset);},getNextResult:function(){this.resultOffset++;return this.getResult(this.resultOffset);},getResult:function(idx){result=null;if(this.lastResult&&this.lastResult.values){result=this.lastResult.values[idx];}
return result;},zoomToResult:function(filter){var filter='&filter='+filter;var s=this.getMap().arch+'/'+Fusion.getScriptLanguage()+"/Query."+Fusion.getScriptLanguage();var params={};params.parameters='session='+this.getMap().getSessionID()+'&mapname='+this.getMap().getMapName()+'&layers='+this.layerName+filter;params.onComplete=OpenLayers.Function.bind(this.selectComplete,this);Fusion.ajaxRequest(s,params);},selectComplete:function(r){var node=new DomNode(r.responseXML);var success=node.getNodeText('Selection');if(success=='true'){this.getMap().newSelection();this.getMap().getSelection(OpenLayers.Function.bind(this.zoomToSelection,this));}},zoomToSelection:function(selection){var ll=selection.getLowerLeftCoord();var ur=selection.getUpperRightCoord();var dX=ur.x-ll.x;var dY=ur.y-ll.y;ll.x=ll.x-dX;ur.x=ur.x+dX;ll.y=ll.y-dY;ur.y=ur.y+dY;this.getMap().setExtents(new OpenLayers.Bounds(ll.x,ll.y,ur.x,ur.y));}});Fusion.Event.MAP_EXTENTS_CHANGED=Fusion.Event.lastEventId++;Fusion.Event.MAP_BUSY_CHANGED=Fusion.Event.lastEventId++;Fusion.Event.MAP_GENERIC_EVENT=Fusion.Event.lastEventId++;Fusion.Event.MAP_RESIZED=Fusion.Event.lastEventId++;Fusion.Event.MAP_SELECTION_ON=Fusion.Event.lastEventId++;Fusion.Event.MAP_SELECTION_OFF=Fusion.Event.lastEventId++;Fusion.Event.MAP_ACTIVE_LAYER_CHANGED=Fusion.Event.lastEventId++;Fusion.Event.MAP_LOADED=Fusion.Event.lastEventId++;Fusion.Event.MAP_LOADING=Fusion.Event.lastEventId++;Fusion.Event.MAP_RELOADED=Fusion.Event.lastEventId++;Fusion.Event.MAP_SESSION_CREATED=Fusion.Event.lastEventId++;Fusion.Event.MAP_MAPTIP_REQ_FINISHED=Fusion.Event.lastEventId++;Fusion.Constant.LAYER_POINT_TYPE=0;Fusion.Constant.LAYER_LINE_TYPE=1;Fusion.Constant.LAYER_POLYGON_TYPE=2;Fusion.Constant.LAYER_SOLID_TYPE=3;Fusion.Constant.LAYER_RASTER_TYPE=4;Fusion.Constant.LAYER_DWF_TYPE=5;Fusion.Widget.Map=OpenLayers.Class(Fusion.Lib.EventMgr,{_oDomObj:null,_sDomObj:'',_sMapname:'',_nWidth:-1,_nHeight:-1,_fMetersperunit:-1,_fScale:-1,_nDpi:96,_oCurrentExtents:null,maxExtent:new OpenLayers.Bounds(),_nWorkers:0,oContextMenu:null,bSupressContextMenu:false,aMaps:null,mapsLoaded:false,layerRoot:null,singleTile:true,fractionalZoom:true,maxScale:null,initialize:function(widgetTag,mapGroup,widgetSet){this.widgetTag=widgetTag;var name=widgetTag.name;this.aMaps=[];this.buttonSet=new Jx.ButtonSet();this.widgetSet=widgetSet;this._nCellSize=-1;this._sDomObj=name;this._oDomObj=$(this._sDomObj);this.layerRoot=new Fusion.Layers.Group({legendLabel:'mapRoot',uniqueId:'mapRoot',groupName:'mapRoot',visible:true});var jxl=this._oDomObj.retrieve('jxLayout');if(jxl){jxl.addEvent('sizeChange',OpenLayers.Function.bind(this.sizeChanged,this));}
if(widgetTag.extension.FractionalZoom){this.fractionalZoom=widgetTag.extension.FractionalZoom[0]=='false'?false:true;}
var scalesArray=null;if(widgetTag.extension.Scales){scalesArray=widgetTag.extension.Scales[0].split(',');this.fractionalZoom=false;}
if(widgetTag.extension.MaxScale){this.maxScale=parseInt(widgetTag.extension.MaxExtent[0]);}
var maxExtent=null;if(widgetTag.extension.MaxExtent){maxExtent=OpenLayers.Bounds.fromString(widgetTag.extension.MaxExtent[0]);}
OpenLayers.DOTS_PER_INCH=this._nDpi;if(!this.oMapOL){var options={controls:[],fallThrough:true,scales:scalesArray,fractionalZoom:this.fractionalZoom};if(widgetTag.extension.ConstrainMapExtent){this.bRestrictExtent=widgetTag.extension.ConstrainMapExtent[0]=='true'?true:false;}
if(maxExtent){options.maxExtent=maxExtent;this.maxExtent=maxExtent;}
this.oMapOL=new OpenLayers.Map(this._sDomObj,options);}
this.oMapOL.viewPortDiv.style.position='absolute';this.oMapOL.viewPortDiv.style.zIndex=0;this.handlers=[];var useMouseWheel=true;if(widgetTag.extension.DisableMouseWheel&&widgetTag.extension.DisableMouseWheel[0]=='true'){useMouseWheel=false;}
if(useMouseWheel){this.wheelHandler=new OpenLayers.Handler.MouseWheel(this,{"up":this.wheelUp,"down":this.wheelDown});this.wheelHandler.map=this.oMapOL;this.wheelHandler.activate();this.handlers.push(this.wheelHandler);}
$(name).widget=this;this.registerEventID(Fusion.Event.MAP_EXTENTS_CHANGED);this.registerEventID(Fusion.Event.MAP_BUSY_CHANGED);this.registerEventID(Fusion.Event.MAP_GENERIC_EVENT);this.registerEventID(Fusion.Event.MAP_RESIZED);this.registerEventID(Fusion.Event.MAP_ACTIVE_LAYER_CHANGED);this.registerEventID(Fusion.Event.MAP_LOADED);this.registerEventID(Fusion.Event.MAP_LOADING);this.registerEventID(Fusion.Event.MAP_RELOADED);this.registerEventID(Fusion.Event.MAP_SELECTION_ON);this.registerEventID(Fusion.Event.MAP_SELECTION_OFF);this.registerEventID(Fusion.Event.MAP_MAPTIP_REQ_FINISHED);this.registerForEvent(Fusion.Event.MAP_LOADED,OpenLayers.Function.bind(this.mapLoaded,this));this.oMapOL.events.register('moveend',this,this.mapExtentsChanged);this._oDomObj.onselectstart=function(){return false;};this._oDomObj.oncontextmenu=function(){return false;};OpenLayers.Event.observe(this._oDomObj,'contextmenu',OpenLayers.Function.bind(this.onContextMenu,this));this.aSelectionCallbacks=[];this.bFetchingSelection=false;this.loadMapGroup(mapGroup);},mapLoaded:function(){this.setViewOptions(this.getUnits());},setFetchingSelection:function(val){this.bFetchingSelection=val;},setMenu:function(){if(this.widgetTag.extension.MenuContainer){var contextMenu=new Jx.Menu.Context();var container=this.widgetSet.getContainerByName(this.widgetTag.extension.MenuContainer[0]);if(container){container.createWidgets(this.widgetSet,contextMenu);this.setContextMenu(contextMenu);}}},loadMapGroup:function(mapGroup){this.mapsLoaded=false;this.clearSelection();this.mapGroup=mapGroup;for(var i=0;i<this.aMaps.length;i++){if(this.aMaps[i].oLayerOL){this.aMaps[i].oLayerOL.destroy();}}
this.aMaps=[];this.layerRoot.clear();for(var i=0;i<mapGroup.maps.length;++i){var mapTag=mapGroup.maps[i];if(Fusion.Layers[mapTag.type]){this.aMaps[i]=new Fusion.Layers[mapTag.type](this,mapTag,true);this.layerRoot.addGroup(this.aMaps[i].layerRoot);}else{this.aMaps[i]=new Fusion.Layers.Generic(this,mapTag,true);this.layerRoot.addLayer(this.aMaps[i].layerRoot);this.layerLoaded();}
this.aMaps[i].registerForEvent(Fusion.Event.LAYER_LOADED,OpenLayers.Function.bind(this.layerLoaded,this));}},layerLoaded:function(){for(var i=0;i<this.aMaps.length;++i){if(!this.aMaps[i].isMapLoaded()){return;}}
this.mapsLoaded=true;if(this.aMaps.length==1){this.oMapOL.setBaseLayer(this.aMaps[0].oLayerOL);}
var initialExtent=this.setInitialExtents();this.setExtents(initialExtent);this.triggerEvent(Fusion.Event.MAP_LOADED);},wheelChange:function(evt,deltaZ){if(this.wheelTimer){clearTimeout(this.wheelTimer);}else{this.cumulativeDelta=0;}
this.cumulativeDelta+=(deltaZ<0)?-1:1;this.wheelTimer=setTimeout(OpenLayers.Function.bind(function(){this.doWheelChange(evt,deltaZ);},this),200);},doWheelChange:function(evt,deltaZ){this.wheelTimer=null;if(this.cumulativeDelta==0){return;}
var size=this.oMapOL.getSize();var deltaX=size.w/2-evt.xy.x;var deltaY=evt.xy.y-size.h/2;var deltaRes=this.cumulativeDelta>0?1/(this.cumulativeDelta+1):Math.abs(this.cumulativeDelta)+1;var newRes=this.oMapOL.baseLayer.getResolution()*deltaRes;var zoomPoint=this.oMapOL.getLonLatFromPixel(evt.xy);var newCenter=new OpenLayers.LonLat(zoomPoint.lon+deltaX*newRes,zoomPoint.lat+deltaY*newRes);var newBounds=new OpenLayers.Bounds(newCenter.lon-size.w*newRes/2,newCenter.lat-size.h*newRes/2,newCenter.lon+size.w*newRes/2,newCenter.lat+size.h*newRes/2);this.setExtents(newBounds);},wheelUp:function(evt){this.wheelChange(evt,1);},wheelDown:function(evt){this.wheelChange(evt,-1);},getDomObj:function(){return this._oDomObj;},getMapName:function(){return this.aMaps[0].getMapName();},getMapTitle:function(){return this.aMaps[0]._sMapTitle;},getSessionID:function(){return this.aMaps[0].getSessionID();},getDomId:function(){return this._sDomObj;},setMapOptions:function(options){this.oMapOL.setOptions(options);},addMap:function(map){if(map.mapTag.layerOptions.maxExtent){this.projection=map.projection;this.units=map.units;this.maxExtent.extend(map.mapTag.layerOptions.maxExtent);this.oMapOL.setOptions({maxExtent:this.maxExtent,units:map.units,projection:this.projection});}
if(this.bRestrictExtent!=null){if(this.bRestrictExtent){this.oMapOL.restrictedExtent=map.mapTag.layerOptions.maxExtent;}else{this.oMapOL.restrictedExtent=false;}}
this.oMapOL.addLayer(map.oLayerOL);map.registerForEvent(Fusion.Event.MAP_LOADED,OpenLayers.Function.bind(this.mapLoadHandler,this));map.registerForEvent(Fusion.Event.MAP_SELECTION_OFF,OpenLayers.Function.bind(this.selectionHandler,this));map.registerForEvent(Fusion.Event.MAP_SELECTION_ON,OpenLayers.Function.bind(this.selectionHandler,this));},getAllMaps:function(){return this.aMaps;},reloadMap:function(){for(var i=0;i<this.aMaps.length;++i){var map=this.aMaps[i];window.setTimeout(OpenLayers.Function.bind(map.reloadMap,map),1);}},loadScaleRanges:function(userFunc){for(var i=0;i<this.aMaps.length;++i){var map=this.aMaps[i];OpenLayers.Function.bind(map.loadScaleRanges(userFunc),map);}},query:function(options){this.lastQueryOptions=options;for(var i=0;i<this.aMaps.length;i++){if(this.aMaps[i].query(options)){}}},mapLoadHandler:function(){++this.mapLoadCounter;if(this.mapLoadCounter==this.aMaps.length){this._oInitialExtents=null;this.fullExtents();this.triggerEvent(Fusion.Event.MAP_LOADED);}},selectionHandler:function(){if(this.hasSelection()){this.triggerEvent(Fusion.Event.MAP_SELECTION_ON);}else{this.triggerEvent(Fusion.Event.MAP_SELECTION_OFF);}},hasSelection:function(){for(var i=0;i<this.aMaps.length;i++){if(this.aMaps[i].hasSelection()){return true;}}
return false;},clearSelection:function(){this.oSelection=null;this.lastQueryOptions=null;for(var i=0;i<this.aMaps.length;i++){this.aMaps[i].clearSelection();}},getSelection:function(callback,layers,startcount){var layers=(arguments[1])?arguments[1]:'';var startcount=(arguments[2])?arguments[2]:'';this.aSelectionCallbacks.push(callback);if(this.bFetchingSelection){return;}
this.bFetchingSelection=true;this.oSelection={};this.nSelectionMaps=0;for(var i=0;i<this.aMaps.length;i++){this.nSelectionMaps++;this.aMaps[i].getSelection(OpenLayers.Function.bind(this.accumulateSelection,this,this.aMaps[i]),layers,startcount);}},setSelection:function(selText,zoomTo){for(var i=0;i<this.aMaps.length;i++){this.aMaps[i].setSelection(selText,zoomTo);}},accumulateSelection:function(map,oSelection){this.oSelection[map._sMapname]=oSelection;if(!--this.nSelectionMaps){this.bFetchingSelection=false;for(var i=0;i<this.aSelectionCallbacks.length;i++){this.aSelectionCallbacks[i](this.oSelection);}
this.aSelectionCallbacks=[];}},setActiveLayer:function(oLayer){this.oActiveLayer=oLayer;if(oLayer){this.oActiveMap=oLayer.map;}
this.triggerEvent(Fusion.Event.MAP_ACTIVE_LAYER_CHANGED,oLayer);},getActiveLayer:function(){return this.oActiveLayer;},_addWorker:function(){this._nWorkers+=1;this.triggerEvent(Fusion.Event.MAP_BUSY_CHANGED,this);this._oDomObj.style.cursor='wait';},_removeWorker:function(){if(this._nWorkers>0){this._nWorkers-=1;}
this.setCursor(this.cursor);this.triggerEvent(Fusion.Event.MAP_BUSY_CHANGED,this);},mapExtentsChanged:function(){this._oCurrentExtents=this.oMapOL.getExtent();this.triggerEvent(Fusion.Event.MAP_EXTENTS_CHANGED);},isBusy:function(){return this._nWorkers>0;},sizeChanged:function(){this.resize();},resize:function(){if(!this.mapsLoaded){return;}
this.oMapOL.updateSize();var d=$(this.getDomObj()).getContentBoxSize();this._nWidth=d.width;this._nHeight=d.height;if(this._oCurrentExtents){this.setExtents(this._oCurrentExtents);}
this.triggerEvent(Fusion.Event.MAP_RESIZED,this);if(panelman)
{if(panelman.activePanel)
{panelman.maximizePanel(panelman.activePanel);}}},redraw:function(){for(var i=0;i<this.aMaps.length;i++){this.aMaps[i].oLayerOL.params.ts=(new Date()).getTime();}
this.oMapOL.setCenter(this.oMapOL.getCenter(),this.oMapOL.getZoom(),false,true);},setBackgroundColor:function(color){this._oDomObj.style.backgroundColor=color;},setExtents:function(oExtents){if(!oExtents){Fusion.reportError(new Fusion.Error(Fusion.Error.WARNING,OpenLayers.i18n('nullExtents')));}
if(oExtents instanceof Array&&oExtents.length==4){oExtents=new OpenLayers.Bounds(oExtents[0],oExtents[1],oExtents[2],oExtents[3]);}
for(var i=0;i<this.aMaps.length;i++){if(this.aMaps[i].oLayerOL.params&&this.aMaps[i].noCache){this.aMaps[i].oLayerOL.params.ts=(new Date()).getTime();}}
this.oMapOL.zoomToExtent(oExtents,true);this._oCurrentExtents=this.oMapOL.getExtent();},setInitialExtents:function(){var initialExtents;var bbox=Fusion.getQueryParam("extent");if(bbox){initialExtents=new OpenLayers.Bounds.fromArray(bbox.split(","));}else if(this.mapGroup.initialView){var iv=this.mapGroup.getInitialView();if(iv.x){initialExtents=this.getExtentFromPoint(iv.x,iv.y,iv.scale);}else if(iv.minX){initialExtents=new OpenLayers.Bounds(iv.minX,iv.minY,iv.maxX,iv.maxY);}
if(!initialExtents.intersectsBounds(this.maxExtent)){Fusion.reportError("AppDef initial view is outside map maxExtent, resetting initialView to maxExtent");initialExtents=this.maxExtent;}}else{initialExtents=this.getMapGroupExtent();if(!initialExtents){initialExtents=this.getMapGroupExtent(true);}}
this.initialExtents=initialExtents;return initialExtents;},getMapGroupExtent:function(includeGenericLayers){var initialExtent;for(var i=0;i<this.aMaps.length;++i){if(!includeGenericLayers&&this.aMaps[i].arch=='Generic'){continue;}
initialExtent=this.aMaps[i].getMaxExtent();}
return initialExtent;},fullExtents:function(){var extents=this.maxExtent;this.setExtents(extents);},isMapLoaded:function(){return(this._oCurrentExtents)?true:false;},zoom:function(fX,fY,nFactor){if(nFactor==1||nFactor==0){this.oMapOL.panTo(new OpenLayers.LonLat(fX,fY));}else{var extent=this.oMapOL.getExtent();if(this.fractionalZoom){var fDeltaX=extent.right-extent.left;var fDeltaY=extent.top-extent.bottom;var fMinX,fMaxX,fMinY,fMaxY;if(nFactor>0){fMinX=fX-(fDeltaX/2/nFactor);fMaxX=fX+(fDeltaX/2/nFactor);fMinY=fY-(fDeltaY/2/nFactor);fMaxY=fY+(fDeltaY/2/nFactor);}else if(nFactor<0){fMinX=fX-((fDeltaX/2)*Math.abs(nFactor));fMaxX=fX+((fDeltaX/2)*Math.abs(nFactor));fMinY=fY-((fDeltaY/2)*Math.abs(nFactor));fMaxY=fY+((fDeltaY/2)*Math.abs(nFactor));}
this.setExtents(new OpenLayers.Bounds(fMinX,fMinY,fMaxX,fMaxY));}else{var currentZoomLevel=this.oMapOL.getZoom();if(nFactor>1){this.oMapOL.zoomTo(currentZoomLevel+1);}else if(nFactor<1){this.oMapOL.zoomTo(currentZoomLevel-1);}}}},zoomToScale:function(fScale){var center=this.getCurrentCenter();var extent=this.getExtentFromPoint(center.x,center.y,fScale);this.setExtents(extent);},queryRect:function(fMinX,fMinY,fMaxX,fMaxY){},queryPoint:function(fX,fY){},pixToGeo:function(pX,pY){var lonLat=this.oMapOL.getLonLatFromPixel(new OpenLayers.Pixel(pX,pY));if(lonLat!=null){return{x:lonLat.lon,y:lonLat.lat};}
return null;},geoToPix:function(gX,gY){if(!(this._oCurrentExtents)){return null;}
var px=this.oMapOL.getPixelFromLonLat(new OpenLayers.LonLat(gX,gY));return{x:Math.floor(px.x),y:Math.floor(px.y)};},pixToGeoMeasure:function(nPixels){var resolution=this.oMapOL.getResolution();return(nPixels*resolution);},setProjection:function(projCode){if(!Proj4js.defs[projCode]){Fusion.reportError(new Fusion.Error(Fusion.Error.WARNING,'Projection definition not found for:'+projCode));}
this.oMapOL.projection=projCode;},setMetersPerUnit:function(metersPerUnit){if(this._fMetersperunit<0){Fusion.initUnits(metersPerUnit);this._fMetersperunit=metersPerUnit;}else{if(metersPerUnit!=this._fMetersperunit){Fusion.reportError(new Fusion.Error(Fusion.Error.WARNING,'meters per unit value already set'));}}},getMetersPerUnit:function(){return this._fMetersperunit;},setViewOptions:function(data){this.setWidgetParam('Units',data);},setWidgetParam:function(param,data){for(var i=0;i<Fusion.applicationDefinition.widgetSets.length;++i){var widgetSet=Fusion.applicationDefinition.widgetSets[i];for(var j=0;j<widgetSet.widgetInstances.length;++j){var widget=widgetSet.widgetInstances[j];for(var k=0;k<widget.paramRegister.length;++k){if(widget.paramRegister[k]==param){widget.setParameter(param,data);}}}}},geoToPixMeasure:function(fGeo){return parseInt(fGeo/this.oMapOL.getResolution());},getCurrentCenter:function(){var c=this.getCurrentExtents().getCenterLonLat();return{x:c.lon,y:c.lat};},getCurrentExtents:function(){return this.oMapOL.getExtent();},getExtentFromPoint:function(fX,fY,fScale){if(!fScale){fScale=this.getScale();}
var res=OpenLayers.Util.getResolutionFromScale(fScale,this.oMapOL.baseLayer.units);var size=this.getSize();var w_deg=size.w*res;var h_deg=size.h*res;return new OpenLayers.Bounds(fX-w_deg/2,fY-h_deg/2,fX+w_deg/2,fY+h_deg/2);},getScale:function(){return this.oMapOL.getScale();},getResolution:function(){return this.oMapOL.getResolution();},getUnits:function(){return this.oMapOL.baseLayer.units;},getSize:function(){return this.oMapOL.getSize();},getEventPosition:function(e){return this.oMapOL.events.getMousePosition(e);},setCursor:function(cursor){this.cursor=cursor;if(this.isBusy()){return;}
if(cursor&&cursor.length&&typeof cursor=='object'){for(var i=0;i<cursor.length;i++){this._oDomObj.style.cursor=cursor[i];if(this._oDomObj.style.cursor==cursor[i]){break;}}}else if(typeof cursor=='string'){this._oDomObj.style.cursor=cursor;}else{this._oDomObj.style.cursor='auto';}},observeEvent:function(sEventName,fnCB)
{OpenLayers.Event.observe(this._oDomObj,sEventName,fnCB,false);},stopObserveEvent:function(sEventName,fnCB)
{OpenLayers.Event.stopObserving(this._oDomObj,sEventName,fnCB,false);},activateWidget:function(oWidget)
{},deactivateWidget:function(oWidget)
{},isLoaded:function(){return(this.oMapOL.getExtent()!=null);},getLinkParams:function(){var queryParams={extent:this.getCurrentExtents().toBBOX()};if(this.lastQueryOptions){if(this.lastQueryOptions.filter){queryParams.filter=this.lastQueryOptions.filter;}
if(this.lastQueryOptions.geometry){queryParams.spatialfilter=this.lastQueryOptions.geometry;}
if(this.lastQueryOptions.queryHiddenLayers){queryParams.queryHiddenLayers=this.lastQueryOptions.queryHiddenLayers;}
if(this.lastQueryOptions.maxFeatures){queryParams.maxfeatures=this.lastQueryOptions.maxFeatures;}
if(this.lastQueryOptions.layers){queryParams.selectlayer=this.lastQueryOptions.layers;}
if(this.lastQueryOptions.selectionType){queryParams.variant=this.lastQueryOptions.selectionType;}}
for(var i=0;i<this.aMaps.length;++i){queryParams=OpenLayers.Util.extend(queryParams,this.aMaps[i].getLinkParams());}
return OpenLayers.Util.getParameterString(queryParams);},getMapTip:function(oMapTips){this.aMaps[0].getMapTip(oMapTips);},supressContextMenu:function(bSupress){this.bSupressContextMenu=bSupress;},setContextMenu:function(menu){this.oContextMenu=menu;},onContextMenu:function(e){if(this.oContextMenu&&!this.bSupressContextMenu&&this.isLoaded()){this.oContextMenu.show(new Event(e));this.contextMenuPosition=this.getEventPosition(e);OpenLayers.Event.stop(e);}},executeFromContextMenu:function(widget){widget.activate(this.contextMenuPosition.x,this.contextMenuPosition.y);}});Fusion.SelectionObject=OpenLayers.Class({aLayers:null,initialize:function(o)
{this.aLayers=[];this.nTotalElements=0;this.nLayers=0;if(o.layers&&o.layers.length>0)
{this.fMinX=o.extents.minx;this.fMinY=o.extents.miny;this.fMaxX=o.extents.maxx;this.fMaxY=o.extents.maxy;this.nLayers=o.layers.length;for(var i=0;i<o.layers.length;i++)
{this.aLayers[i]=new Fusion.SelectionObject.Layer(o,o.layers[i]);}}},getNumElements:function()
{return this.nTotalElements;},getLowerLeftCoord:function()
{return{x:this.fMinX,y:this.fMinY};},getUpperRightCoord:function()
{return{x:this.fMaxX,y:this.fMaxY};},getNumLayers:function()
{return this.nLayers;},getLayerByName:function(name)
{var oLayer=null;for(var i=0;i<this.nLayers;i++)
{if(this.aLayers[i].getName()==name)
{oLayer=this.aLayers[i];break;}}
return oLayer;},getLayer:function(iIndice)
{if(iIndice>=0&&iIndice<this.nLayers)
{return this.aLayers[iIndice];}
else
{return null;}}});Fusion.SelectionObject.Layer=OpenLayers.Class({name:null,nElements:null,aElements:null,nProperties:null,aPropertiesName:null,aPropertiesTypes:null,type:null,area:null,distance:null,bbox:null,center:null,initialize:function(o,layerName)
{this.name=layerName;this.nElements=o[layerName].numelements;this.aElements=[];this.nProperties=o[layerName].propertyvalues.length;this.aPropertiesName=[];this.aPropertiesName=o[layerName].propertyvalues;this.aPropertiesTypes=[];this.aPropertiesTypes=o[layerName].propertytypes;this.area=0;this.distance=0;for(var i=0;i<o[layerName].values.length;i++)
{this.aElements[i]=[];for(var j=0;j<o[layerName].values[i].length;j++)
{this.aElements[i][j]=o[layerName].values[i][j];}}
for(var i=0;i<o[layerName].metadata.length;i++){var featureMetadata=o[layerName].metadata[i];var dim=featureMetadata[0];var bbox=featureMetadata[1];var center=featureMetadata[2];var area=featureMetadata[3];var length=featureMetadata[4];this.area+=parseFloat(area);this.distance+=parseFloat(length);}},getName:function()
{return this.name;},getNumElements:function()
{return this.nElements;},getNumProperties:function()
{return this.nProperties;},getPropertyNames:function()
{return this.aPropertiesName;},getPropertyTypes:function()
{return this.aPropertiesTypes;},getElementValue:function(iElement,iProperty)
{if(iElement>=0&&iElement<this.nElements&&iProperty>=0&&iProperty<this.nProperties)
{return this.aElements[iElement][iProperty];}
else
{return null;}}});Fusion.Event.MAP_LAYER_TOGGLED=Fusion.Event.lastEventId++;Fusion.Event.MAP_LAYER_ORDER_CHANGED=Fusion.Event.lastEventId++;Fusion.Event.LAYER_LOADED=Fusion.Event.lastEventId++;Fusion.Event.LAYER_LOADING=Fusion.Event.lastEventId++;Fusion.Layers=OpenLayers.Class(Fusion.Lib.EventMgr,{bSingleTile:null,bIsBaseLayer:false,bDisplayInLegend:true,bExpandInLegend:true,bMapLoaded:false,bIsMapWidgetLayer:true,bLayersReversed:false,sMapResourceId:null,sImageType:'png',clientAgent:'Fusion Viewer',noCache:false,_sMapTitle:null,_sMapname:null,initialize:function(map,mapTag,isMapWidgetLayer){this.registerEventID(Fusion.Event.MAP_SELECTION_ON);this.registerEventID(Fusion.Event.MAP_SELECTION_OFF);this.registerEventID(Fusion.Event.MAP_LOADED);this.registerEventID(Fusion.Event.LAYER_LOADED);this.registerEventID(Fusion.Event.LAYER_LOADING);this.registerEventID(Fusion.Event.MAP_LAYER_ORDER_CHANGED);this.mapWidget=map;this.oSelection=null;if(isMapWidgetLayer!=null){this.bIsMapWidgetLayer=isMapWidgetLayer;}
this.mapTag=mapTag;if(!this.mapTag.layerOptions){this.mapTag.layerOptions={};}
this.ratio=this.mapTag.layerOptions.MapRatio?this.extension.MapRatio[0]:1.0;this.bSingleTile=mapTag.singleTile;this.bIsBaseLayer=mapTag.isBaseLayer;this.sMapResourceId=mapTag.resourceId?mapTag.resourceId:'';this.mapInfo=mapTag.mapInfo;this.layerType=mapTag.type;if(mapTag.extension.ProjectionCode){this.projCode=mapTag.extension.ProjectionCode[0];}
if(mapTag.extension.ProjectionDef){var projDef=mapTag.extension.ProjectionDef[0];this.projCode="APP-DEF-PROJ";Proj4js.defs[this.projCode]=projDef;}},loadScaleRanges:function(userFunc){userFunc();},getMapName:function(){return this._sMapname;},getMapTitle:function(){return this._sMapTitle;},isMapLoaded:function(){return this.bMapLoaded;},getMaxExtent:function(){var maxExtent=null;if(this.oLayerOL){maxExtent=this.oLayerOL.maxExtent;}
return maxExtent;},hasSelection:function(){return this.bSelectionOn;},getSelectedFeatureCount:function(){var total=0;return total;},getSelectedLayers:function(){var layers=[];return layers;},getSelectableLayers:function(){var layers=[];return layers;},setSelection:function(selText,zoomTo){},getSelection:function(userFunc,layers,startcount){},clearSelection:function(){},query:function(options){},processLayerEvents:function(layer,isEnabling){if(this.mapInfo&&this.mapInfo.mapEvents.layerEvents[layer.layerName]){var layerEvent=this.mapInfo.mapEvents.layerEvents[layer.layerName];var events=isEnabling?layerEvent.onEnable:layerEvent.onDisable;for(var i=0;i<events.length;i++){var o=events[i];if(o.type=='layer'){var l=this.layerRoot.findLayer(o.name);if(l){if(o.enable){l.show(true);}else{l.hide(true);}}}else if(o.type=='group'){var g=this.layerRoot.findGroupByAttribute('groupName',o.name);if(g){if(o.enable){g.show(true);}else{g.hide(true);}}}}}},processGroupEvents:function(group,isEnabling){if(this.mapInfo&&this.mapInfo.mapEvents.groupEvents[group.groupName]){var groupEvent=this.mapInfo.mapEvents.groupEvents[group.groupName];var events=isEnabling?groupEvent.onEnable:groupEvent.onDisable;for(var i=0;i<events.length;i++){var o=events[i];if(o.type=='layer'){var l=this.layerRoot.findLayer(o.name);if(l){if(o.enable){l.show(true);}else{l.hide(true);}}}else if(o.type=='group'){var g=this.layerRoot.findGroupByAttribute('groupName',o.name);if(g){if(o.enable){g.show(true);}else{g.hide(true);}}}}}},refreshLayer:function(layer){this.drawMap();},setParameter:function(param,value){if(param=='SelectionType'){this.selectionType=value;}},loadStart:function(){if(this.bIsMapWidgetLayer){this.mapWidget._addWorker();}},loadEnd:function(){if(this.bIsMapWidgetLayer){this.mapWidget._removeWorker();}},getGroupInfoUrl:function(groupName){if(this.mapInfo){var groups=this.mapInfo.links.groups;for(var i=0;i<groups.length;i++){if(groups[i].name==groupName){return groups[i].url;}}}
return null;},getLayerInfoUrl:function(layerName){if(this.mapInfo){var layers=this.mapInfo.links.layers;for(var i=0;i<layers.length;i++){if(layers[i].name==layerName){return layers[i].url;}}}
return null;},getMapTip:function(mapTipWidget){}});Fusion.Event.GROUP_PROPERTY_CHANGED=Fusion.Event.lastEventId++;Fusion.Layers.Group=OpenLayers.Class(Fusion.Lib.EventMgr,{name:null,groups:null,layers:null,oMap:null,initialize:function(o,oMap){this.uniqueId=o.uniqueId;this.name=o.groupName;this.groups=[];this.layers=[];this.oMap=oMap;this.groupName=o.groupName;this.legendLabel=o.legendLabel;this.parentUniqueId=o.parentUniqueId;this.groupType=o.groupType;this.displayInLegend=o.displayInLegend;this.expandInLegend=o.expandInLegend;this.visible=o.visible;this.initiallyVisible=o.visible;this.actuallyVisible=o.actuallyVisible;this.registerEventID(Fusion.Event.GROUP_PROPERTY_CHANGED);},show:function(noDraw){if(this.visible){return;}
this.oMap.showGroup(this,noDraw?true:false);this.visible=true;if(this.legend&&this.legend.checkBox){this.legend.checkBox.checked=true;}},hide:function(noDraw){if(!this.visible){return;}
this.oMap.hideGroup(this,noDraw?true:false);this.visible=false;if(this.legend&&this.legend.checkBox){this.legend.checkBox.checked=false;}},isVisible:function(){return this.visible;},clear:function(){for(var i=0;i<this.groups.length;i++){this.groups[i].clear();}
for(var i=0;i<this.layers.length;i++){this.layers[i].clear();}
this.groups=[];this.layers=[];},set:function(property,value){this[property]=value;this.triggerEvent(Fusion.Event.GROUP_PROPERTY_CHANGED,this);},addGroup:function(group,reverse){group.parentGroup=this;if(reverse){this.groups.unshift(group);}else{this.groups.push(group);}},addLayer:function(layer,reverse){layer.parentGroup=this;if(reverse){this.layers.unshift(layer);}else{this.layers.push(layer);}},findGroup:function(name){return this.findGroupByAttribute('name',name);},findGroupByAttribute:function(attribute,value){if(this[attribute]==value){return this;}
for(var i=0;i<this.groups.length;i++){var group=this.groups[i].findGroupByAttribute(attribute,value);if(group){return group;}}
return null;},findLayer:function(name){return this.findLayerByAttribute('name',name);},findLayerByAttribute:function(attribute,value){for(var i=0;i<this.layers.length;i++){if(this.layers[i][attribute]==value){return this.layers[i];}}
for(var i=0;i<this.groups.length;i++){var layer=this.groups[i].findLayerByAttribute(attribute,value);if(layer){return layer;}}
return null;}});Fusion.Event.LAYER_PROPERTY_CHANGED=Fusion.Event.lastEventId++;Fusion.Layers.Layer=OpenLayers.Class(Fusion.Lib.EventMgr,{name:null,scaleRanges:null,oMap:null,initialize:function(o,oMap){this.oMap=oMap;this.layerName=o.layerName;this.uniqueId=o.uniqueId;this.resourceId=o.resourceId;this.selectedFeatureCount=0;this.layerTypes=[].concat(o.layerTypes);this.legendLabel=o.legendLabel;this.displayInLegend=o.displayInLegend;this.expandInLegend=o.expandInLegend;this.actuallyVisible=o.actuallyVisible;this.statusDefault=o.statusdefault;this.editable=o.editable;this.visible=o.visible;this.initiallyVisible=o.visible;this.selectable=o.selectable;this.layerType=null;if(this.supportsType(Fusion.Constant.LAYER_RASTER_TYPE)){this.layerType=Fusion.Constant.LAYER_RASTER_TYPE;}else if(this.supportsType(Fusion.Constant.LAYER_DWF_TYPE)){this.layerType=Fusion.Constant.LAYER_DWF_TYPE;}
this.parentGroup=o.parentGroup;this.minScale=o.minScale;this.maxScale=o.maxScale;if(this.maxScale=='infinity'){this.maxScale=1000000000000;}
this.scaleRanges=[];if(o.scaleRanges)
{for(var i=0;i<o.scaleRanges.length;i++){var scaleRange=new Fusion.Layers.ScaleRange(o.scaleRanges[i],this.layerType);this.scaleRanges.push(scaleRange);}}
this.registerEventID(Fusion.Event.LAYER_PROPERTY_CHANGED);},supportsType:function(type){for(var i=0;i<this.layerTypes.length;i++){if(this.layerTypes[i]==type){return true;}}
return false;},getScaleRange:function(fScale){for(var i=0;i<this.scaleRanges.length;i++){if(this.scaleRanges[i].contains(fScale)){return this.scaleRanges[i];}}
return null;},show:function(noDraw){if(this.visible){return;}
this.set('visible',true);this.oMap.showLayer(this,noDraw?true:false);if(this.legend&&this.legend.checkBox){this.legend.checkBox.checked=true;}},hide:function(noDraw){if(!this.visible){return;}
this.set('visible',false);this.oMap.hideLayer(this,noDraw?true:false);if(this.legend&&this.legend.checkBox){this.legend.checkBox.checked=false;}},isVisible:function(){return this.visible;},clear:function(){},set:function(property,value){this[property]=value;this.triggerEvent(Fusion.Event.LAYER_PROPERTY_CHANGED,this);}});Fusion.Layers.ScaleRange=OpenLayers.Class({styles:null,initialize:function(o,layerType){this.minScale=o.minScale;this.maxScale=o.maxScale;if(this.maxScale=='infinity'||this.maxScale=='auto'){this.maxScale=Infinity;}
this.styles=[];if(!o.styles){var styleItem=new Fusion.Layers.StyleItem({legendLabel:'DWF'},layerType);this.styles.push(styleItem);return;}
var staticIcon=o.styles.length>1?false:layerType;for(var i=0;i<o.styles.length;i++){var styleItem=new Fusion.Layers.StyleItem(o.styles[i],staticIcon);this.styles.push(styleItem);}},contains:function(fScale){var testScale=Math.round(fScale);return testScale>=this.minScale&&testScale<=this.maxScale;}});Fusion.Layers.StyleItem=OpenLayers.Class({clientAgent:'Fusion Viewer',initialize:function(o,staticIcon){this.legendLabel=o.legendLabel;this.filter=o.filter;this.geometryType=o.geometryType;if(this.geometryType==''){this.geometryType=-1;}
this.categoryIndex=o.categoryIndex;if(this.categoryindex==''){this.categoryindex=-1;}
this.index=o.index;this.staticIcon=staticIcon;}});Fusion.Strings.en={'scriptFailed':'failed to load script: ${script}','configParseError':'Error parsing fusion configuration file, initialization aborted','configLoadError':'Error loading fusion configuration file, initialization aborted.'+'Make sure that you have copied config_dist.json to config.json '+'and have configured the settings for your system','ajaxError':'Exception occurred in AJAX callback.\nMessage: ${exception}\nLocation: ${filename} (${line})\nResponse: ${response}','importFailed':'failed to import stylesheet: ${url}','registerEventError':'Error registering eventID, invalid (empty) eventID.','appDefLoadFailed':'failed to load: ${script}','appDefParseError':'failed to parse ApplicationDefinition','widgetSetParseError':'failed to parse the WidgetSet','fusionError':'Fusion Error: ${type}\n${message}','nullExtents':'Map.setExtents called with null extents','mapLoadError':'Failed to load requested map:\n${error}','setLayersError':"setLayers failure: ${error}",'printTitle':'Printable Page ','noSelection':'No Selection','selectionInfo':'${features} features selected on ${layers} layers','attribute':'Attribute','value':'Value','taskHome':'return to the task pane home','prevTask':'go to previous task executed','nextTask':'go to next task executed','taskList':'Task List','taskPane':'Task Pane','imperial':'Imperial','metric':'Metric','deg':'Degrees','refresh':'Refresh','expandAll':'Expand All','expand':'Expand','collapseAll':'Collapse All','collapse':'Collapse','defaultMapTitle':'Map','legendTitle':'Legend','selectionPanelTitle':'Selection','ovmapTitle':'Overview Map','ovmapTitleShort':'Overview','taskPaneTitle':'Tasks','segment':'Segment ${seg}','calculating':'calculating ...','panWest':'Pan West','panEast':'Pan East','panSouth':'Pan South','panNorth':'Pan North','zoomOut':'Zoom Out','zoomIn':'Zoom In','printCancel':'Cancel','printGenerate':'Generate','zoomRect':'Zoom Rectangle','end':''};Fusion.Strings.fr={'scriptFailed':'failed to load script: ${script}','configParseError':'Error parsing fusion configuration file, initialization aborted','configLoadError':'Error loading fusion configuration file, initialization aborted.'+'Make sure that you have copied config_dist.json to config.json '+'and have configured the settings for your system','ajaxError':'Exception occurred in AJAX callback.\n${exception}\nLocation: ${file} (${line}))','importFailed':'failed to import stylesheet: ${url}','registerEventError':'Error registering eventID, invalid (empty) eventID.','appDefLoadFailed':'failed to load: ${script}','appDefParseError':'failed to parse ApplicationDefinition','widgetSetParseError':'failed to parse the WidgetSet','fusionError':'Fusion Error: ${type}\n${message}','nullExtents':'Map.setExtents called with null extents','mapLoadError':'Failed to load requested map:\n${error}','setLayersError':"setLayers failure: ${error}",'printTitle':'Printable Page ','noSelection':'Aucun Sélection','selectionInfo':'${features} features selected on ${layers} layers','attribute':'Attribute','value':'Value','taskHome':'return to the task pane home','prevTask':'go to previous task executed','nextTask':'go to next task executed','taskList':'Task List','taskPane':'Task Pane','imperial':'Imperial','metric':'Metric','deg':'Degrees','refresh':'Refresh','expandAll':'Expand All','expand':'Expand','collapseAll':'Collapse All','collapse':'Collapse','defaultMapTitle':'Map','legendTitle':'Legend','selectionPanelTitle':'Sélection','ovmapTitle':'Overview Map','ovmapTitleShort':'Overview','taskPaneTitle':'Tasks','segment':'Segment ${seg}','calculating':'calculating ...','panWest':'Ouest','panEast':'Est','panSouth':'Sud','panNorth':'Nord','zoomOut':'Cliquer pour réduire','zoomIn':'Cliquer pour agrandir','printCancel':'Cancel','printGenerate':'Generate','end':''};OpenLayers.Lang.ca={'unhandledRequest':"Resposta a petici� no gestionada ${statusText}",'permalink':"Enlla� permanent",'overlays':"Capes addicionals",'baseLayer':"Capa Base",'sameProjection':"El mapa de refer�ncia nom�s funciona si t� la mateixa projecci� que el mapa principal",'readNotImplemented':"Lectura no implementada.",'writeNotImplemented':"Escriptura no implementada.",'noFID':"No es pot actualitzar un element per al que no existeix FID.",'errorLoadingGML':"Error caregant el fitxer GML ${url}",'browserNotSupported':"El seu navegador no suporta renderitzaci� vectorial. Els renderitzadors suportats actualmente s�n:\n${renderers}",'componentShouldBe':"addFeatures : el component ha de ser de tipus ${geomType}",'getFeatureError':"getFeatureFromEvent ha estat cridat a una capa sense renderizador. Aix� normalment vol dir que "+"s'ha eliminat una capa, per� no el handler associat a ella.",'minZoomLevelError':"La propietat minZoomLevel s'ha d'utilitzar nom�s "+"amb les capes que tenen FixedZoomLevels. El fet que "+"una capa wfs comprovi minZoomLevel �s una reliquia del "+"passat. No podem, per�, eliminar-la sense trencar "+"les aplicacions d'OpenLayers que en puguin dependre. "+"Aix� doncs estem fent-la obsoleta -- la comprovaci� "+"minZoomLevel s'eliminar� a la versi� 3.0. Feu servir "+"els par�metres min/max resolution en substituci�, tal com es descriu aqu�: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transacci� WFS: CORRECTA ${response}",'commitFailed':"Transacci� WFS: HA FALLAT ${response}",'googleWarning':"La capa Google no s'ha pogut carregar correctament.<br><br>"+"Per evitar aquest missatge, sel�leccioneu una nova Capa Base "+"al gestor de capes de la cantonada superior dreta.<br><br>"+"Probablement aix� �s degut a que l'script de la biblioteca de "+"Google Maps no ha estat incl�s a la vostra p�gina, o no "+"cont� la clau de l'API correcta per a la vostra adre�a.<br><br>"+"Desenvolupadors: Per obtenir consells sobre com fer anar aix�, "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>f�u clic aqu�</a>",'getLayerWarning':"Per evitar aquest missatge, sel�leccioneu una nova Capa Base "+"al gestor de capes de la cantonada superior dreta.<br><br>"+"Probablement aix� �s degut a que l'script de la biblioteca "+"${layerLib} "+"no ha estat incl�s a la vostra p�gina.<br><br>"+"Desenvolupadors: Per obtenir consells sobre com fer anar aix�, "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>f�u clic aqu�</a>",'scale':"Escala = 1 : ${scaleDenom}",'layerAlreadyAdded':"Heu intentat afegir la capa: ${layerName} al mapa, pero ja ha estat afegida anteriorment",'reprojectDeprecated':"Esteu fent servir l'opci� 'reproject' a la capa "+"${layerName}. Aquesta opci� �s obsoleta: el seu �s fou concebut "+"per suportar la visualitzaci� de dades sobre mapes base comercials, "+"per� aquesta funcionalitat s'hauria d'assolir ara mitjan�ant el suport "+"de la projecci� Spherical Mercator. M�s informaci� disponible a "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Aquest m�tode �s obsolet i s'eliminar� a la versi� 3.0. "+"Si us plau feu servir em m�tode alternatiu ${newMethod}.",'boundsAddError':"Ha de proporcionar els valors x i y a la funci� add.",'lonlatAddError':"Ha de proporcionar els valors lon i lat a la funci� add.",'pixelAddError':"Ha de proporcionar els valors x i y a la funci� add.",'unsupportedGeometryType':"Tipus de geometria no suportada: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition ha fallat: l'element amb id ${elemId} pot estar fora de lloc.",'filterEvaluateNotImplemented':"evaluate no est� implementat per aquest tipus de filtre.",'end':''};OpenLayers.Lang["cs-CZ"]={'unhandledRequest':"Nezpracovaná návratová hodnota ${statusText}",'permalink':"Odkaz na aktuální mapu",'overlays':"Překryvné vrstvy",'baseLayer':"Podkladové vrstvy",'sameProjection':"Přehledka pracuje správně pouze pokud je ve stejné projekci, jako hlavní mapa",'readNotImplemented':"Read není implementováno.",'writeNotImplemented':"Write není implementováno.",'noFID':"Nelze aktualizovat prvek, pro který neexistuje FID.",'errorLoadingGML':"Chyba při načítání souboru GML ${url}",'browserNotSupported':"Váš prohlížeč nepodporuje vykreslování vektorů. Momentálně podporované nástroje jsou::\n${renderers}",'componentShouldBe':"addFeatures : komponenta by měla být ${geomType}",'getFeatureError':"getFeatureFromEvent bylo zavoláno na vrstvě, která nemá vykreslovač. To obyčejně znamená, že "+"jste odstranil vrstvu, ale ne rutinu s ní asociovanou.",'minZoomLevelError':"Vlastnost minZoomLevel by se měla používat pouze "+"s potomky FixedZoomLevels vrstvami. To znamená, že "+"vrstva wfs kontroluje, zda-li minZoomLevel není zbytek z minulosti."+"Nelze to ovšem vyjmout bez možnosti, že bychom rozbili "+"aplikace postavené na OL, které by na tom mohly záviset. "+"Proto tuto vlastnost nedoporučujeme používat --  kontrola minZoomLevel "+"bude odstraněna ve verzi 3.0. Použijte prosím "+"raději nastavení min/max podle příkaldu popsaného na: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS Transaction: ÚSPĚCH ${response}",'commitFailed':"WFS Transaction: CHYBA ${response}",'googleWarning':"Nepodařilo se správně načíst vrstvu Google.<br><br>"+"Abyste se zbavili této zprávy, zvolte jinou základní vrstvu "+"v přepínači vrstev.<br><br>"+"To se většinou stává, pokud "+"nebyl načten skript, nebo neobsahuje správný "+"klíč pro API pro tuto stránku.<br><br>"+"Vývojáři: Pro pomoc, aby tohle fungovalo , "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>klikněte sem</a>",'getLayerWarning':"The ${layerType} Layer was unable to load correctly.<br><br>"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.<br><br>"+"Most likely, this is because the ${layerLib} library "+"script was either not correctly included.<br><br>"+"Developers: For help getting this working correctly, "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>click here</a>",'scale':"Měřítko = 1 : ${scaleDenom}",'layerAlreadyAdded':"Pokusili jste se přidat vrstvu: ${layerName} do mapy, ale tato vrstva je již v mapě přítomna.",'reprojectDeprecated':"Použil jste volbu 'reproject' "+"ve vrstvě ${layerName}. Tato volba není doporučená: "+"byla zde proto, aby bylo možno zobrazovat data z okomerčních serverů, "+"ale tato funkce je nyní zajištěna pomocí podpory "+"Spherical Mercator. Více informací naleznete na "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Tato metodat není doporučená a bude vyjmuta ve verzi 3.0. "+"Prosím, použijte raději ${newMethod}.",'boundsAddError':"Pro přídavnou funkci musíte zadat obě souřadnice x a y.",'lonlatAddError':"Pro přídavnou funkci musíte zadat obě souřadnice lon a lat.",'pixelAddError':"Pro přídavnou funkci musíte zadat obě souřadnice x a y.",'unsupportedGeometryType':"Nepodporovaný typ geometrie: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition selhalo: element s  id ${elemId} je asi umístěn chybně.",'end':''};OpenLayers.Lang['da-DK']={'unhandledRequest':"En ikke h�ndteret foresp�rgsel returnerede ${statusText}",'permalink':"Permalink",'overlays':"Kortlag",'baseLayer':"Baggrundslag",'sameProjection':"Oversigtskortet fungerer kun n�r det har samme projektion som hovedkortet",'readNotImplemented':"L�sning er ikke implementeret.",'writeNotImplemented':"Skrivning er ikke implementeret.",'noFID':"Kan ikke opdateret en feature (et objekt) der ikke har et FID.",'errorLoadingGML':"Fejlede under indl�sning af GML fil ${url}",'browserNotSupported':"Din browser underst�tter ikke vektor visning. F�lgende vektor visninger underst�ttes:\n${renderers}",'componentShouldBe':"addFeatures : komponenten skal v�re en ${geomType}",'getFeatureError':"getFeatureFromEvent blev kaldt p� et lag uden en visning. Dette betyder som regel at du "+"har destrueret et lag, men ikke de h�ndteringer der var tilknyttet.",'minZoomLevelError':"Egenskaben minZoomLevel er kun beregnet til brug "+"med FixedZoomLevels. At dette WFS lag kontrollerer "+"minZoomLevel egenskaben, er et levn fra en tidligere "+"version. Vi kan desv�rre ikke fjerne dette uden at risikere "+"at �del�gge eksisterende OL baserede programmer der "+" benytter denne funktionalitet. "+"Egenskaben b�r derfor ikke anvendes, og minZoomLevel "+"kontrollen herunder vil blive fjernet i version 3.0. "+"Benyt istedet min/max opl�snings indstillingerne, som "+"er beskrevet her: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS transaktion: LYKKEDES ${response}",'commitFailed':"WFS transaktion: MISLYKKEDES ${response}",'googleWarning':"Google laget kunne ikke indl�ses.<br><br>"+"For at fjerne denne besked, v�lg et nyt bagrundskort i "+"lagskifteren i �verste h�jre hj�rne.<br><br>"+"Fejlen skyldes formentlig at Google Maps bibliotekts "+"scriptet ikke er inkluderet, eller ikke indeholder den "+"korrkte API n�gle for dit site.<br><br>"+"Udviklere: For hj�lp til at f� dette til at fungere, "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>klik her</a>",'getLayerWarning':"${layerType}-laget kunne ikke indl�ses.<br><br>"+"For at fjerne denne besked, v�lg et nyt bagrundskort i "+"lagskifteren i �verste h�jre hj�rne.<br><br>"+"Fejlen skyldes formentlig at ${layerLib} bibliotekts "+"scriptet ikke er inkluderet.<br><br>"+"Udviklere: For hj�lp til at f� dette til at fungere, "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>klik her</a>",'scale':"M�lforhold = 1 : ${scaleDenom}",'layerAlreadyAdded':"Du har fors�gt at tilf�je laget: ${layerName} til kortet, men det er allerede tilf�jet",'reprojectDeprecated':"Du anvender indstillingen 'reproject' p� laget ${layerName}."+"Denne indstilling b�r ikke l�ngere anvendes. Den var beregnet "+"til at vise data ovenp� kommercielle grundkort, men den funktionalitet "+"b�r nu opn�s ved at anvende Spherical Mercator underst�ttelsen. "+"Mere information er tilg�ngelig her: "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Denne funktion b�r ikke l�ngere anvendes, og vil blive fjernet i version 3.0. "+"Anvend venligst funktionen ${newMethod} istedet.",'boundsAddError':"Du skal angive b�de x og y v�rdier i kaldet til add funktionen.",'lonlatAddError':"Du skal angive b�de lon og lat v�rdier i kaldet til add funktionen.",'pixelAddError':"Du skal angive b�de x og y v�rdier i kaldet til add funktionen.",'unsupportedGeometryType':"Geometri typen: ${geomType} er ikke underst�ttet.",'pagePositionFailed':"OpenLayers.Util.pagePosition fejlede: elementet med id ${elemId} er m�ske placeret forkert.",'filterEvaluateNotImplemented':"evaluering er ikke implementeret for denne filter type."};OpenLayers.Lang.de=OpenLayers.Util.applyDefaults({'unhandledRequest':"Unbehandelte Anfragerückmeldung ${statusText}",'permalink':"Permalink",'overlays':"Overlays",'baseLayer':"Grundkarte",'sameProjection':"Die Übersichtskarte funktioniert nur, wenn sie dieselbe Projektion wie die Hauptkarte verwendet",'readNotImplemented':"Lesen nicht implementiert.",'writeNotImplemented':"Schreiben nicht implementiert.",'noFID':"Ein Feature, für das keine FID existiert, kann nicht aktualisiert werden.",'errorLoadingGML':"Fehler beim Laden der GML-Datei ${url}",'browserNotSupported':"Ihr Browser unterstützt keine Vektordarstellung. Aktuell unterstützte Renderer:\n${renderers}",'componentShouldBe':"addFeatures : Komponente sollte vom Typ ${geomType} sein",'commitSuccess':"WFS-Transaktion: ERFOLGREICH ${response}",'commitFailed':"WFS-Transaktion: FEHLGESCHLAGEN ${response}",'googleWarning':"Der Google-Layer konnte nicht korrekt geladen werden.<br><br>"+"Um diese Meldung nicht mehr zu erhalten, wählen Sie einen anderen "+"Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.<br><br>"+"Sehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der "+"Google-Maps-Bibliothek nicht eingebunden wurde oder keinen gültigen "+"API-Schlüssel für Ihre URL enthält.<br><br>"+"Entwickler: Für Hilfe zum korrekten Einbinden des Google-Layers "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>hier klicken</a>",'getLayerWarning':"Der ${layerType}-Layer konnte nicht korrekt geladen werden.<br><br>"+"Um diese Meldung nicht mehr zu erhalten, wählen Sie einen anderen "+"Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.<br><br>"+"Sehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der "+'"${layerLib}"-Bibliothek nicht eingebunden wurde.<br><br>'+"Entwickler: Für Hilfe zum korrekten Einbinden von Layern "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>hier klicken</a>",'scale':"Maßstab = 1 : ${scaleDenom}",'end':''},OpenLayers.Lang["en"]);OpenLayers.Lang['en-CA']=OpenLayers.Util.applyDefaults({},OpenLayers.Lang["en"]);OpenLayers.Lang.en={'unhandledRequest':"Unhandled request return ${statusText}",'permalink':"Permalink",'overlays':"Overlays",'baseLayer':"Base Layer",'sameProjection':"The overview map only works when it is in the same projection as the main map",'readNotImplemented':"Read not implemented.",'writeNotImplemented':"Write not implemented.",'noFID':"Can't update a feature for which there is no FID.",'errorLoadingGML':"Error in loading GML file ${url}",'browserNotSupported':"Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",'componentShouldBe':"addFeatures : component should be an ${geomType}",'getFeatureError':"getFeatureFromEvent called on layer with no renderer. This usually means you "+"destroyed a layer, but not some handler which is associated with it.",'minZoomLevelError':"The minZoomLevel property is only intended for use "+"with the FixedZoomLevels-descendent layers. That this "+"wfs layer checks for minZoomLevel is a relic of the"+"past. We cannot, however, remove it without possibly "+"breaking OL based applications that may depend on it."+" Therefore we are deprecating it -- the minZoomLevel "+"check below will be removed at 3.0. Please instead "+"use min/max resolution setting as described here: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS Transaction: SUCCESS ${response}",'commitFailed':"WFS Transaction: FAILED ${response}",'googleWarning':"The Google Layer was unable to load correctly.<br><br>"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.<br><br>"+"Most likely, this is because the Google Maps library "+"script was either not included, or does not contain the "+"correct API key for your site.<br><br>"+"Developers: For help getting this working correctly, "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>click here</a>",'getLayerWarning':"The ${layerType} Layer was unable to load correctly.<br><br>"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.<br><br>"+"Most likely, this is because the ${layerLib} library "+"script was not correctly included.<br><br>"+"Developers: For help getting this working correctly, "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>click here</a>",'scale':"Scale = 1 : ${scaleDenom}",'layerAlreadyAdded':"You tried to add the layer: ${layerName} to the map, but it has already been added",'reprojectDeprecated':"You are using the 'reproject' option "+"on the ${layerName} layer. This option is deprecated: "+"its use was designed to support displaying data over commercial "+"basemaps, but that functionality should now be achieved by using "+"Spherical Mercator support. More information is available from "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"This method has been deprecated and will be removed in 3.0. "+"Please use ${newMethod} instead.",'boundsAddError':"You must pass both x and y values to the add function.",'lonlatAddError':"You must pass both lon and lat values to the add function.",'pixelAddError':"You must pass both x and y values to the add function.",'unsupportedGeometryType':"Unsupported geometry type: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.",'end':'','filterEvaluateNotImplemented':"evaluate is not implemented for this filter type."};OpenLayers.Lang.es={'unhandledRequest':"Respuesta a petición no gestionada ${statusText}",'permalink':"Enlace permanente",'overlays':"Capas superpuestas",'baseLayer':"Capa Base",'sameProjection':"El mini mapa sólo funciona si está en la misma proyección que el mapa principal",'readNotImplemented':"Lectura no implementada.",'writeNotImplemented':"Escritura no implementada.",'noFID':"No se puede actualizar un elemento para el que no existe FID.",'errorLoadingGML':"Error cargando el fichero GML ${url}",'browserNotSupported':"Su navegador no soporta renderización vectorial. Los renderizadores soportados actualmente son:\n${renderers}",'componentShouldBe':"addFeatures : el componente debe ser del tipo ${geomType}",'getFeatureError':"getFeatureFromEvent llamado en una capa sin renderizador. Esto normalmente quiere decir que "+"se ha destruido una capa, pero no el manejador asociado a ella.",'minZoomLevelError':"La propiedad minZoomLevel debe sólo utilizarse "+"con las capas que tienen FixedZoomLevels. El hecho de que "+"una capa wfs compruebe minZoomLevel is una reliquia del "+"pasado. Sin embargo, no podemos eliminarla sin discontinuar "+"probablemente las aplicaciones OL que puedan depender de ello. "+"Así pues estamos haciéndolo obsoleto --la comprobación "+"minZoomLevel se eliminará en la versión 3.0. Utilice el ajuste "+"de resolution min/max en su lugar, tal como se describe aquí: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transacción WFS: ÉXITO ${response}",'commitFailed':"Transacción WFS: FALLÓ ${response}",'googleWarning':"La capa Google no pudo ser cargada correctamente.<br><br>"+"Para evitar este mensaje, seleccione una nueva Capa Base "+"en el selector de capas en la esquina superior derecha.<br><br>"+"Probablemente, esto se debe a que el script de la biblioteca de "+"Google Maps no fue correctamente incluido en su página, o no "+"contiene la clave del API correcta para su sitio.<br><br>"+"Desarrolladores: Para ayudar a hacer funcionar esto correctamente, "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>haga clic aquí</a>",'getLayerWarning':"La capa ${layerType} no pudo ser cargada correctamente.<br><br>"+"Para evitar este mensaje, seleccione una nueva Capa Base "+"en el selector de capas en la esquina superior derecha.<br><br>"+"Probablemente, esto se debe a que el script de "+"la biblioteca ${layerLib} "+"no fue correctamente incluido en su página.<br><br>"+"Desarrolladores: Para ayudar a hacer funcionar esto correctamente, "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>haga clic aquí</a>",'scale':"Escala = 1 : ${scaleDenom}",'layerAlreadyAdded':"Intentó añadir la capa: ${layerName} al mapa, pero ya había sido añadida previamente",'reprojectDeprecated':"Está usando la opción 'reproject' en la capa "+"${layerName}. Esta opción está obsoleta: su uso fue diseñado "+"para soportar la visualización de datos sobre mapas base comerciales, "+"pero esa funcionalidad debería conseguirse ahora mediante el soporte "+"de la proyección Spherical Mercator. Más información disponible en "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Este método está obsoleto y se eliminará en la versión 3.0. "+"Por favor utilice el método ${newMethod} en su lugar.",'boundsAddError':"Debe proporcionar los valores x e y a la función add.",'lonlatAddError':"Debe proporcionar los valores lon y lat a la función add.",'pixelAddError':"Debe proporcionar los valores x e y a la función add.",'unsupportedGeometryType':"Tipo de geometría no soportada: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition falló: el elemento con id ${elemId} puede haberse colocado de manera errónea.",'filterEvaluateNotImplemented':"evaluate no está implementado para este tipo de filtro.",'end':''};OpenLayers.Lang.fr={'unhandledRequest':"Requête non gérée, retournant ${statusText}",'permalink':"Permalien",'overlays':"Calques",'baseLayer':"Calque de base",'sameProjection':"La carte de situation ne fonctionne que lorsque sa projection est la même que celle de la carte principale",'readNotImplemented':"Lecture non implémentée.",'writeNotImplemented':"Ecriture non implémentée.",'noFID':"Impossible de mettre à jour un objet sans identifiant (fid).",'errorLoadingGML':"Erreur au chargement du fichier GML ${url}",'browserNotSupported':"Votre navigateur ne supporte pas le rendu vectoriel. Les renderers actuellement supportés sont : \n${renderers}",'componentShouldBe':"addFeatures : le composant devrait être de type ${geomType}",'getFeatureError':"getFeatureFromEvent a été appelé sur un calque sans renderer. Cela signifie généralement que vous "+"avez détruit cette couche, mais que vous avez conservé un handler qui lui était associé.",'minZoomLevelError':"La propriété minZoomLevel doit seulement être utilisée "+"pour des couches FixedZoomLevels-descendent. Le fait que "+"cette couche WFS vérifie la présence de minZoomLevel "+"est une relique du passé. Nous ne pouvons toutefois la "+"supprimer sans casser des applications qui pourraient en dépendre."+" C'est pourquoi nous la déprécions -- la vérification du minZoomLevel "+"sera supprimée en version 3.0. A la place, merci d'utiliser "+"les paramètres de résolutions min/max tel que décrit sur : "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transaction WFS : SUCCES ${response}",'commitFailed':"Transaction WFS : ECHEC ${response}",'googleWarning':"La couche Google n'a pas été en mesure de se charger correctement.<br><br>"+"Pour supprimer ce message, choisissez une nouvelle BaseLayer "+"dans le sélecteur de couche en haut à droite.<br><br>"+"Cela est possiblement causé par la non-inclusion de la "+"librairie Google Maps, ou alors parce que la clé de l'API "+"ne correspond pas à votre site.<br><br>"+"Développeurs : pour savoir comment corriger ceci, "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>cliquez ici</a>",'getLayerWarning':"La couche ${layerType} n'est pas en mesure de se charger correctement.<br><br>"+"Pour supprimer ce message, choisissez une nouvelle BaseLayer "+"dans le sélecteur de couche en haut à droite.<br><br>"+"Cela est possiblement causé par la non-inclusion de la "+"librairie ${layerLib}.<br><br>"+"Développeurs : pour savoir comment corriger ceci, "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>cliquez ici</a>",'scale':"Echelle ~ 1 : ${scaleDenom}",'layerAlreadyAdded':"Vous avez essayé d'ajouter à la carte le calque : ${layerName}, mais il est déjà présent",'reprojectDeprecated':"Vous utilisez l'option 'reproject' "+"sur la couche ${layerName}. Cette option est dépréciée : "+"Son usage permettait d'afficher des données au dessus de couches raster commerciales."+"Cette fonctionalité est maintenant supportée en utilisant le support de la projection "+"Mercator Sphérique. Plus d'information est disponible sur "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Cette méthode est dépréciée, et sera supprimée à la version 3.0. "+"Merci d'utiliser ${newMethod} à la place.",'boundsAddError':"Vous devez passer les deux valeurs x et y à la fonction add.",'lonlatAddError':"Vous devez passer les deux valeurs lon et lat à la fonction add.",'pixelAddError':"Vous devez passer les deux valeurs x et y à la fonction add.",'unsupportedGeometryType':"Type de géométrie non supporté : ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition a échoué: l'élément d'id ${elemId} pourrait être mal positionné.",'end':''};OpenLayers.Lang.hu=OpenLayers.Util.applyDefaults({'unhandledRequest':"Nem kezelt kérés visszatérése ${statusText}",'permalink':"Permalink",'overlays':"Rávetítések",'baseLayer':"Alapréteg",'sameProjection':"Az áttekintő térkép csak abban az esetben működik, ha ugyanazon a vetületen van mint a fő térkép.",'readNotImplemented':"Olvasás nincs végrehajtva.",'writeNotImplemented':"Írás nincs végrehajtva.",'noFID':"Nem frissíthető olyan jellemző, amely nem rendelkezik FID-del.",'errorLoadingGML':"Hiba GML-fájl betöltésekor ${url}",'browserNotSupported':"A böngészője nem támogatja a vektoros renderelést. A jelenleg támogatott renderelők:\n${renderers}",'componentShouldBe':"addFeatures : az összetevőnek ilyen típusúnak kell lennie: ${geomType}",'getFeatureError':"A getFeatureFromEvent réteget hívott meg renderelő nélkül. Ez rendszerint azt jelenti, hogy "+"megsemmisített egy fóliát, de néhány ahhoz társított kezelőt nem.",'minZoomLevelError':"A minZoomLevel tulajdonságot csak a következővel való használatra szánták: "+"a FixedZoomLevels-leszármazott fóliák. Ez azt jelenti, hogy "+"a minZoomLevel wfs fólia jelölőnégyzetei már "+"a múlté. Mi azonban nem távolíthatjuk el annak a veszélye nélkül, hogy "+"az esetlegesen ettől függő OL alapú alkalmazásokat tönkretennénk."+"Ezért ezt érvénytelenítjük -- a minZoomLevel "+"az alul levő jelölőnégyzet a 3.0-s verzióból el lesz távolítva. Kérjük, helyette "+"használja a  min/max felbontás beállítást, amelyről az alábbi helyen talál leírást: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS tranzakció: SIKERES ${response}",'commitFailed':"WFS tranzakció: SIKERTELEN ${response}",'googleWarning':"A Google fólia betöltése sikertelen.<br><br>"+"Ahhoz, hogy ez az üzenet eltűnjön, válasszon egy új BaseLayer fóliát "+"a jobb felső sarokban található fóliakapcsoló segítségével.<br><br>"+"Nagy valószínűséggel ez azért van, mert a Google Maps könyvtár "+"parancsfájlja nem található, vagy nem tartalmazza "+"az Ön oldalához tartozó megfelelő API-kulcsot.<br><br>"+"Fejlesztőknek: A helyes működtetésre vonatkozó segítség az alábbi helyen érhető el, "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>kattintson ide</a>",'getLayerWarning':"A ${layerType} fólia nem töltődött be helyesen.<br><br>"+"Ahhoz, hogy ez az üzenet eltűnjön, válasszon egy új BaseLayer fóliát "+"a jobb felső sarokban található fóliakapcsoló segítségével.<br><br>"+"Nagy valószínűséggel ez azért van, mert a ${layerLib} könyvtár "+"parancsfájlja helytelen.<br><br>"+"Fejlesztőknek: A helyes működtetésre vonatkozó segítség az alábbi helyen érhető el, "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>kattintson ide</a>",'scale':"Lépték = 1 : ${scaleDenom}",'layerAlreadyAdded':"Megpróbálta hozzáadni a ${layerName} fóliát a térképhez, de az már hozzá van adva",'reprojectDeprecated':"Ön a 'reproject' beállítást használja "+"a ${layerName} fólián. Ez a beállítás érvénytelen: "+"használata az üzleti alaptérképek fölötti adatok megjelenítésének támogatására "+"szolgált, de ezt a funkció ezentúl a "+"Gömbi Mercator használatával érhető el. További információ az alábbi helyen érhető el: "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Ez a módszer érvénytelenítve lett és a 3.0-s verzióból el lesz távolítva. "+"Használja a ${newMethod} módszert helyette.",'boundsAddError':"Az x és y értékeknek egyaránt meg kell felelnie, hogy a funkciót hozzáadhassa.",'lonlatAddError':"A hossz. és szél. értékeknek egyaránt meg kell felelnie, hogy a funkciót hozzáadhassa.",'pixelAddError':"Az x és y értékeknek egyaránt meg kell felelnie, hogy a funkciót hozzáadhassa.",'unsupportedGeometryType':"Nem támogatott geometriatípus: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition failed: lehetséges, hogy az ${elemId} azonosítójú elem téves helyre került.",'filterEvaluateNotImplemented':"ennél a szűrőtípusnál kiértékelés nem hajtódik végre.",'end':''},OpenLayers.Lang["en"]);OpenLayers.Lang.it={'unhandledRequest':"Codice di ritorno della richiesta ${statusText}",'permalink':"Permalink",'overlays':"Overlays",'baseLayer':"Livello base",'sameProjection':"La mini mappa funziona solamente se ha la stessa proiezione della mappa principale",'readNotImplemented':"Lettura non implementata.",'writeNotImplemented':"Scrittura non implementata.",'noFID':"Impossibile aggiornare un elemento grafico che non abbia il FID.",'errorLoadingGML':"Errore nel caricamento del file GML ${url}",'browserNotSupported':"Il tuo browser non supporta il rendering vettoriale. I renderizzatore attualemnte supportati sono:\n${renderers}",'componentShouldBe':"addFeatures : il componente dovrebbe essere di tipo ${geomType}",'getFeatureError':"getFeatureFromEvent chiamata su di un livello senza renderizzatore. Ciò significa che "+"il livello è stato cancellato, ma non i gestori associati ad esso.",'minZoomLevelError':"La proprietà minZoomLevel è da utilizzare solamente "+"con livelli che abbiano FixedZoomLevels. Il fatto che "+"questo livello wfs controlli la proprietà minZoomLevel è "+"un retaggio del passato. Non possiamo comunque rimuoverla "+"senza rompere le vecchie applicazioni che dipendono su di essa."+"Quindi siamo costretti a deprecarla -- minZoomLevel "+"e sarà rimossa dalla vesione 3.0. Si prega di utilizzare i "+"settaggi di risoluzione min/max come descritto qui: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transazione WFS: SUCCESS ${response}",'commitFailed':"Transazione WFS: FAILED ${response}",'googleWarning':"Il livello Google non è riuscito a caricare correttamente.<br><br>"+"Per evitare questo messaggio, seleziona un nuovo BaseLayer "+"nel selettore di livelli nell'angolo in alto a destra.<br><br>"+"Più precisamente, ciò accade perchè la libreria Google Maps "+"non è stata inclusa nella pagina, oppure non contiene la "+"corretta API key per il tuo sito.<br><br>"+"Sviluppatori: Per aiuto su come farlo funzionare correttamente, "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>clicca qui</a>",'getLayerWarning':"Il livello ${layerType} non è riuscito a caricare correttamente.<br><br>"+"Per evitare questo messaggio, seleziona un nuovo BaseLayer "+"nel selettore di livelli nell'angolo in alto a destra.<br><br>"+"Più precisamente, ciò accade perchè la libreria ${layerLib} "+"non è stata inclusa nella pagina.<br><br>"+"Sviluppatori: Per aiuto su come farlo funzionare correttamente, "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>clicca qui</a>",'scale':"Scala = 1 : ${scaleDenom}",'layerAlreadyAdded':"Stai cercando di aggiungere il livello: ${layerName} alla mappa, ma tale livello è già stato aggiunto.",'reprojectDeprecated':"Stai utilizzando l'opzione 'reproject' sul livello ${layerName}. "+"Questa opzione è deprecata: il suo utilizzo è stato introdotto per"+"supportare il disegno dei dati sopra mappe commerciali, ma tale "+"funzionalità dovrebbe essere ottenuta tramite l'utilizzo della proiezione "+"Spherical Mercator. Per maggiori informazioni consultare qui "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Questo metodo è stato deprecato e sarà rimosso dalla versione 3.0. "+"Si prega di utilizzare il metodo ${newMethod} in alternativa.",'boundsAddError':"Devi specificare i valori di x e y alla funzione add.",'lonlatAddError':"Devi specificare i valori di lon e lat alla funzione add.",'pixelAddError':"Devi specificare i valori di x e y alla funzione add.",'unsupportedGeometryType':"Tipo di geometria non supportata: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition fallita: l'elemento con id ${elemId} è posizionato in modo errato.",'end':''};OpenLayers.Lang.ja=OpenLayers.Util.applyDefaults({'unhandledRequest':"未処理の要求が ${statusText} を返しました",'permalink':"Permalink",'overlays':"オーバーレイ",'baseLayer':"基準画層",'sameProjection':"オーバービュー マップは、メイン マップと同じ投影内にある場合のみ機能します",'readNotImplemented':"読み込みは実行されませんでした。",'writeNotImplemented':"書き込みは実行されませんでした。",'noFID':"FID が指定されていないフィーチャは更新できません。",'errorLoadingGML':"GML ファイル ${url} のロードでエラーが発生しました",'browserNotSupported':"ご使用のブラウザではベクトルのレンダリングがサポートされていません。現在サポートされているレンダラは次のとおりです:\n${renderers}",'componentShouldBe':"addFeatures : コンポーネントは ${geomType} である必要があります",'getFeatureError':"レンダラがない画層で getFeatureFromEvent が呼び出されました。通常これは、画層が"+"壊れていて、それに関連付けられている一部のハンドラが壊れていないことを意味します。",'minZoomLevelError':"minZoomLevel プロパティは、FixedZoomLevels の下位"+"画層で使用することを意図したものです。wfs 画層が "+"minZoomLevel をチェックすることはなくなりました。"+"ただしこのプロパティを削除するには、これに依存する"+" OL ベースのアプリケーションを削除する必要があります。"+"このため、minZoomLevel 以下のチェックは、3.0 で"+"廃止されます。代わりに最小/最大解像度設定を使用"+"してください。次のサイトを参照してください:"+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS トランザクション: 成功 ${response}",'commitFailed':"WFS トランザクション: 失敗 ${response}",'googleWarning':"Google 画層を正しくロードできませんでした。<br><br>"+"このメッセージを非表示にするには、右上にある画層"+"スイッチ内の新しい BaseLayer を選択します。<br><br>"+"これは、Google Maps ライブラリ スクリプトが含まれて"+"いないか、サイトの正しい API キーが含まれていない"+"ことが原因であると考えられます。<br><br>"+"開発者の方へ: この作業を正しく実行するための情報は、"+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>ここ</a>をクリックしてください",'getLayerWarning':"${layerType} 画層を正しくロードできませんでした。<br><br>"+"このメッセージを非表示にするには、右上にある画層"+"スイッチ内の新しい BaseLayer を選択します。<br><br>"+"これは、${layerLib} ライブラリ スクリプトが正しく含まれ"+"ていないことが原因であると考えられます。<br><br>"+"開発者の方へ: この作業を正しく実行するための情報は、"+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>ここ</a>をクリックしてください",'scale':"尺度 = 1 : ${scaleDenom}",'layerAlreadyAdded':"画層 ${layerName} をマップに追加しようとしましたが、この画層は既に追加されています",'reprojectDeprecated':"'reproject' オプションを同じ ${layerName} 画層で使用して"+"います。このオプションは推奨しません。このオプションは商用の"+"ベースマップにデータを表示することを意図したものですが、"+"その場合は Spherical Mercator サポートを使用してください。"+"詳細については、http://trac.openlayers.org/wiki/SphericalMercator"+"を参照してください。",'methodDeprecated':"このメソッドは非推奨で、3.0 で廃止されます。 "+"代わりに ${newMethod} を使用してください。",'boundsAddError':"関数を追加するには、x と y の両方の値を渡す必要があります。",'lonlatAddError':"関数を追加するには、lon と lat の両方の値を渡す必要があります。",'pixelAddError':"関数を追加するには、x と y の両方の値を渡す必要があります。",'unsupportedGeometryType':"サポートされていないジオメトリ タイプ: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition が失敗しました: ID ${elemId} を持つエレメントは誤った場所に配置されている可能性があります。",'filterEvaluateNotImplemented':"このフィルタの種類では評価が実装されていません。",'end':''},OpenLayers.Lang["en"]);OpenLayers.Lang["nb"]={'unhandledRequest':"Ubehandlet foresp�rsel returnerte ${statusText}",'permalink':"Kobling til denne siden",'overlays':"Kartlag",'baseLayer':"Bakgrunnskart",'sameProjection':"Oversiktskartet fungerer bare n�r det har samme projeksjon som hovedkartet",'readNotImplemented':"Lesing er ikke implementert.",'writeNotImplemented':"Skriving er ikke implementert.",'noFID':"Kan ikke oppdatere feature (objekt) som ikke har FID.",'errorLoadingGML':"Feil under lasting av GML-fil ${url}",'browserNotSupported':"Din nettleser st�tter ikke vektortegning. F�lgende tegnemetoder st�ttes:\n${renderers}",'componentShouldBe':"addFeatures : komponenten m� v�re en ${geomType}",'getFeatureError':"getFeatureFromEvent kj�rt mot lag uten tegnemetode. Dette betyr som regel at du "+"fjernet et lag uten � fjerne alle handlere tilknyttet laget.",'minZoomLevelError':"Egenskapen minZoomLevel er kun tenkt for bruk p� lag "+"basert p� FixedZoomLevels. At dette wfs-laget sjekker "+"minZoomLevel er en fortidslevning. Det kan dog ikke "+"tas bort uten � risikere at OL-baserte applikasjoner "+"slutter � virke, s� det er merket som foreldet: "+"minZoomLevel i sjekken nedenfor vil fjernes i 3.0. "+"Vennligst bruk innstillingene for min/maks oppl�sning "+"som er beskrevet her: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS-transaksjon: SUKSESS ${response}",'commitFailed':"WFS-transaksjon: FEILET ${response}",'googleWarning':"Google-laget kunne ikke lastes.<br><br>"+"Bytt til et annet bakgrunnslag i lagvelgeren i "+"�vre h�yre hj�rne for � slippe denne meldingen.<br><br>"+"Sannsynligvis for�rsakes feilen av at Google Maps-biblioteket "+"ikke er riktig inkludert p� nettsiden, eller at det ikke er "+"angitt riktig API-n�kkel for nettstedet.<br><br>"+"Utviklere: For hjelp til � f� dette til � virke se "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>her</a>.",'getLayerWarning':"${layerType}-laget kunne ikke lastes.<br><br>"+"Bytt til et annet bakgrunnslag i lagvelgeren i "+"�vre h�yre hj�rne for � slippe denne meldingen.<br><br>"+"Sannsynligvis for�rsakes feilen av at "+"${layerLib}-biblioteket ikke var riktig inkludert "+"p� nettsiden.<br><br>"+"Utviklere: For hjelp til � f� dette til � virke se "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>her</a>.",'scale':"<strong>Skala</strong> 1 : ${scaleDenom}",'layerAlreadyAdded':"Du fors�kte � legge til laget ${layerName} p� kartet, men det er allerede lagt til",'reprojectDeprecated':"Du bruker innstillingen 'reproject' p� laget ${layerName}. "+"Denne innstillingen er foreldet, den var ment for � st�tte "+"visning av kartdata over kommersielle bakgrunnskart, men det "+"b�r n� gj�res med st�tten for Spherical Mercator. Mer informasjon "+"finnes p� "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Denne metoden er markert som foreldet og vil bli fjernet i 3.0. "+"Bruk ${newMethod} i stedet.",'boundsAddError':"Du m� gi b�de x- og y-verdier til funksjonen add.",'lonlatAddError':"Du m� gi b�de lon- og lat-verdier til funksjonen add.",'pixelAddError':"Du m� gi b�de x- og y-verdier til funksjonen add.",'unsupportedGeometryType':"Ust�ttet geometritype: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition feilet: elementet med id ${elemId} kan v�re feilplassert.",'end':''};OpenLayers.Lang.nl=OpenLayers.Util.applyDefaults({'unhandledRequest':"Niet afgehandeld request met als terugmelding ${statusText}",'permalink':"Permalink",'overlays':"Overlays",'baseLayer':"Achtergrondkaart",'sameProjection':"De overzichtskaart werkt alleen als de projectie gelijk is aan de projectie van de hoofdkaart",'readNotImplemented':"Lezen niet geïmplementeerd.",'writeNotImplemented':"Schrijven niet geïmplementeerd.",'noFID':"Een feature welke geen FID heeft kan niet bijgewerkt worden.",'errorLoadingGML':"Fout bij het laden van GML bestand ${url}",'browserNotSupported':"Uw browser ondersteunt het weergeven van vector niet. Momenteel ondersteunde weergave engines:\n${renderers}",'componentShouldBe':"addFeatures : component zou van het type ${geomType} moeten zijn",'commitSuccess':"WFS-transactie: SUCCESVOL ${response}",'commitFailed':"WFS-transactie: MISLUKT ${response}",'googleWarning':"De Google-Layer kon niet correct geladen worden.<br><br>"+"Om deze melding niet meer te krijgen, moet u een andere "+"achtergrondkaart kiezen in de LayerSwitcher in de rechterbovenhoek.<br><br>"+"Dit is waarschijnlijk omdat de ${layerLib} bilbiotheek "+"niet correct ingevoegd is.<br><br>"+"Ontwikkelaars: om dit werkend te krijgen, "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>klik hier</a>",'getLayerWarning':"De ${layerType} Layer kon niet goed geladen worden.<br><br>"+"Om deze melding niet meer te krijgen, moet u een andere "+"achtergrondkaart kiezen in de LayerSwitcher in de rechterbovenhoek.<br><br>"+"Dit is waarschijnlijk omdat de ${layerLib} bilbiotheek "+"niet correct ingevoegd is.<br><br>"+"Ontwikkelaars: om dit werkend te krijgen, "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>klik hier</a>",'scale':"Schaal = 1 : ${scaleDenom}",'end':''},OpenLayers.Lang["en"]);OpenLayers.Lang["pt-BR"]={'unhandledRequest':"A requisição retornou um erro não tratado: ${statusText}",'permalink':"Link para essa página",'overlays':"Camadas de Sobreposição",'baseLayer':"Camada Base",'sameProjection':"O mapa de referência só funciona quando ele está na mesma projeção do mapa principal",'readNotImplemented':"Leitura não implementada.",'writeNotImplemented':"Escrita não implementada.",'noFID':"Não é possível atualizar uma feição que não tenha um FID.",'errorLoadingGML':"Erro ao carregar o arquivo GML ${url}",'browserNotSupported':"Seu navegador não suporta renderização de vetores. Os renderizadores suportados atualmente são:\n${renderers}",'componentShouldBe':"addFeatures: o componente deve ser do tipo ${geomType}",'getFeatureError':"getFeatureFromEvent foi executado mas nenhum renderizador foi encontrado. "+"Isso pode indicar que você destruiu uma camana, mas não o handler associado a ela.",'minZoomLevelError':"A propriedade minZoomLevel é de uso restrito das camadas "+"descendentes de FixedZoomLevels. A verificação dessa propriedade "+"pelas camadas wfs é um resíduo do passado. Não podemos, entretanto "+"não é possível removê-la sem possívelmente quebrar o funcionamento "+"de aplicações OL que possuem depência com ela. Portanto estamos "+"tornando seu uso obsoleto -- a verificação desse atributo será "+"removida na versão 3.0. Ao invés, use as opções de resolução "+"min/max como descrito em: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transação WFS : SUCESSO ${response}",'commitFailed':"Transação WFS : ERRO ${response}",'googleWarning':"Não foi possível carregar a camada Google corretamente.<br><br>"+"Para se livrar dessa mensagem, selecione uma nova Camada Base, "+"na ferramenta de alternação de camadas localização do canto "+"superior direito.<br><br>"+"Muito provavelmente, isso foi causado porque o script da "+"biblioteca do Google Maps não foi incluído, ou porque ele não "+"contém a chave correta da API para o seu site.<br><br>"+"Desenvolvedores: Para obter ajuda em solucionar esse problema "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>cliquem aqui</a>",'getLayerWarning':"Não foi possível carregar a camada ${layerType} corretamente.<br><br>"+"Para se livrar dessa mensagem, selecione uma nova Camada Base, "+"na ferramenta de alternação de camadas localização do canto "+"superior direito.<br><br>"+"Muito provavelmente, isso foi causado porque o script da "+"biblioteca ${layerLib} não foi incluído corretamente.<br><br>"+"Desenvolvedores: Para obter ajuda em solucionar esse problema "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>cliquem aqui</a>",'scale':"Escala = 1 : ${scaleDenom}",'layerAlreadyAdded':"Você tentou adicionar a camada: ${layerName} ao mapa, mas ela já foi adicionada",'reprojectDeprecated':"Você está usando a opção 'reproject' na camada ${layerName}. "+"Essa opção está obsoleta: seu uso foi projetado para suportar "+"a visualização de dados sobre bases de mapas comerciais, "+"entretanto essa funcionalidade deve agora ser alcançada usando "+"o suporte à projeção Mercator. Mais informação está disponível em: "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Esse método está obsoleto e será removido na versão 3.0. "+"Ao invés, por favor use ${newMethod}.",'boundsAddError':"Você deve informar ambos os valores x e y para a função add.",'lonlatAddError':"Você deve informar ambos os valores lon e lat para a função add.",'pixelAddError':"Você deve informar ambos os valores x e y para a função add.",'unsupportedGeometryType':"Tipo geométrico não suportado: ${geomType}.",'pagePositionFailed':"OpenLayers.Util.pagePosition falhou: o elemento de id ${elemId} deve estar fora do lugar.",'end':''};OpenLayers.Lang["sv-SE"]={'unhandledRequest':"Ej hanterad fr�ga retur ${statusText}",'permalink':"Permal�nk",'overlays':"Kartlager",'baseLayer':"Bakgrundskarta",'sameProjection':"�versiktskartan fungerar endast n�r den har samma projektion som huvudkartan",'readNotImplemented':"L�sning ej implementerad.",'writeNotImplemented':"Skrivning ej implementerad.",'noFID':"Kan ej uppdatera feature (objekt) f�r vilket FID saknas.",'errorLoadingGML':"Fel i laddning av GML-fil ${url}",'browserNotSupported':"Din webbl�sare st�der inte vektorvisning. F�r n�rvarande st�ds f�ljande visning:\n${renderers}",'componentShouldBe':"addFeatures : komponenten skall vara en ${geomType}",'getFeatureError':"getFeatureFromEvent anropad f�r lager utan utritning. Detta betyder oftast att man "+"raderat ett lager, men inte en hanterare som �r knuten till lagret.",'minZoomLevelError':"Egenskapen minZoomLevel �r endast avsedd att anv�ndas "+"med lager med FixedZoomLevels. Att detta WFS-lager "+"kontrollerar minZoomLevel �r en relik fr�n �ldre versioner. "+"Vi kan dock inte ta bort det utan att riskera att "+"OL-baserade till�mpningar som anv�nder detta slutar "+"fungera. D�rf�r �r det satt som deprecated, minZoomLevel "+"kommer att tas bort i version 3.0. Anv�nd i st�llet "+"inst�llning av min/max resolution som beskrivs h�r: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS-transaktion: LYCKADES ${response}",'commitFailed':"WFS-transaktion: MISSLYCKADES ${response}",'googleWarning':"Google-lagret kunde inte laddas korrekt.<br><br>"+"F�r att slippa detta meddelande, v�lj en annan bakgrundskarta "+"i lagerv�ljaren i �vre h�gra h�rnet.<br><br>"+"Sannolikt beror felet p� att Google Maps-biblioteket "+"inte �r inkluderat p� webbsidan eller p� att sidan "+"inte anger korrekt API-nyckel f�r webbplatsen.<br><br>"+"Utvecklare: hj�lp f�r att �tg�rda detta, "+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>klicka h�r</a>.",'getLayerWarning':"${layerType}-lagret kunde inte laddas korrekt.<br><br>"+"F�r att slippa detta meddelande, v�lj en annan bakgrundskarta "+"i lagerv�ljaren i �vre h�gra h�rnet.<br><br>"+"Sannolikt beror felet p� att ${layerLib}-biblioteket "+"inte �r inkluderat p� webbsidan.<br><br>"+"Utvecklare: hj�lp f�r att �tg�rda detta, "+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>klicka h�r</a>.",'scale':"<strong>Skala</strong> 1 : ${scaleDenom}",'layerAlreadyAdded':"Du f�rs�kte l�gga till lagret: ${layerName} p� kartan, men det har lagts till tidigare",'reprojectDeprecated':"Du anv�nder inst�llningen 'reproject' p� lagret ${layerName}. "+"Denna inst�llning markerad som deprecated: den var avsedd "+"att anv�ndas f�r att st�dja visning av kartdata p� kommersiella "+"bakgrundskartor, men nu b�r man i st�llet "+"anv�nda Spherical Mercator-st�d f�r den funktionaliteten. "+"Mer information finns "+"p� http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Denna metod �r markerad som deprecated och kommer att tas bort i 3.0. "+"Anv�nd ${newMethod} i st�llet.",'boundsAddError':"Du m�ste skicka b�de x- och y-v�rde till funktionen add.",'lonlatAddError':"Du m�ste skicka b�de lon- och lat-v�rde till funktionen add.",'pixelAddError':"Du m�ste skicka b�de x- och y-v�rde till funktionen add.",'unsupportedGeometryType':"St�d saknas f�r geometritypen: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition misslyckades: elementet med id ${elemId} kan placeras fel.",'end':''};OpenLayers.Lang["zh-CN"]={'unhandledRequest':"未处理的请求，返回值为 ${statusText}",'permalink':"永久链接",'overlays':"叠加层",'baseLayer':"基础图层",'sameProjection':"鹰眼地图只有在和主地图使用相同的投影的时候才能正常共工作",'readNotImplemented':"读取功能没有实现。",'writeNotImplemented':"写入功能没有实现。",'noFID':"无法更新feature，缺少FID。",'errorLoadingGML':"加载GML文件 ${url} 出现错误。",'browserNotSupported':"你使用的浏览器不支持矢量渲染。当前支持的渲染方式包括：\n${renderers}",'componentShouldBe':"addFeatures : 组件类型应该是 ${geomType}",'getFeatureError':"getFeatureFromEvent方法在一个没有渲染器的图层上被调用。 这通常意味着您"+"销毁了一个图层，但并未销毁其关联的handler。",'minZoomLevelError':"minZoomLevel属性仅适合用于"+"使用了固定缩放级别的图层。这个 "+"wfs 图层检查 minZoomLevel 是过去遗留下来的。"+"然而，我们不能移除它，"+"而破坏依赖于它的基于OL的应用程序。"+"因此，我们废除了它 -- minZoomLevel "+"将会在3.0中被移除。请改用 "+"min/max resolution 设置，参考："+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS Transaction: 成功。 ${response}",'commitFailed':"WFS Transaction: 失败。 ${response}",'googleWarning':"Google图层不能正确加载。<br><br>"+"要消除这个信息，请在右上角的"+"图层控制面板中选择其他的基础图层。<br><br>"+"这种情况很可能是没有正确的包含Google地图脚本库，"+"或者是没有包含在你的站点上"+"使用的正确的Google Maps API密匙。<br><br>"+"开发者：获取使其正确工作的帮助信息，"+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>点击这里</a>",'getLayerWarning':"${layerType} 图层不能正确加载。<br><br>"+"要消除这个信息，请在右上角的"+"图层控制面板中选择其他的基础图层。<br><br>"+"这种情况很可能是没有正确的包含"+"${layerLib} 脚本库。<br><br>"+"开发者：获取使其正确工作的帮助信息，"+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>点击这里</a>",'scale':"比例尺 = 1 : ${scaleDenom}",'layerAlreadyAdded':"你尝试添加图层： ${layerName} 到地图中，但是它之前就已经被添加。",'reprojectDeprecated':"你正在使用 ${layerName} 图层上的'reproject'选项。"+"这个选项已经不再使用："+"它是被设计用来支持显示商业的地图数据，"+"不过现在该功能可以通过使用Spherical Mercator来实现。"+"更多信息可以参阅"+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"该方法已经不再被支持，并且将在3.0中被移除。"+"请使用 ${newMethod} 方法来替代。",'boundsAddError':"您必须传递 x 和 y 两个参数值到 add 方法。",'lonlatAddError':"您必须传递 lon 和 lat 两个参数值到 add 方法。",'pixelAddError':"您必须传递 x and y 两个参数值到 add 方法。",'unsupportedGeometryType':"不支持的几何体类型： ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition 失败：id 为 ${elemId} 的元素可能被错置。",'end':''};OpenLayers.Lang["zh-TW"]={'unhandledRequest':"未處理的請求，傳回值為 ${statusText}。",'permalink':"永久連結",'overlays':"額外圖層",'baseLayer':"基礎圖層",'sameProjection':"地圖縮覽(OverviewMap)只能在跟主地圖相同投影時起作用。",'readNotImplemented':"沒有實作讀取的功能。",'writeNotImplemented':"沒有實作寫入的功能。",'noFID':"因為沒有 FID 所以無法更新 feature。",'errorLoadingGML':"讀取GML檔案 ${url} 錯誤。",'browserNotSupported':"您的瀏覽器未支援向量渲染. 目前支援的渲染方式是:\n${renderers}",'componentShouldBe':"addFeatures : 元件應該為 ${geomType}",'getFeatureError':"getFeatureFromEvent 在一個沒有被渲染的圖層裡被呼叫。這通常意味著您 "+"摧毀了一個圖層，但並未摧毀相關的handler。",'minZoomLevelError':"minZoomLevel 屬性僅適合用在 "+"FixedZoomLevels-descendent 類型的圖層. 這個"+"wfs layer 的 minZoomLevel 是過去所遺留下來的，"+"然而我們不能移除它而不讓它將"+"過去的程式相容性給破壞掉。"+"因此我們將會迴避使用它 -- minZoomLevel "+"會在3.0被移除，請改"+"用在這邊描述的 min/max resolution 設定: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS Transaction: 成功 ${response}",'commitFailed':"WFS Transaction: 失敗 ${response}",'googleWarning':"The Google Layer 圖層無法被正確的載入。<br><br>"+"要迴避這個訊息, 請在右上角的圖層改變器裡，"+"選一個新的基礎圖層。<br><br>"+"很有可能是因為 Google Maps 的函式庫"+"腳本沒有被正確的置入，或沒有包含 "+"您網站上正確的 API key <br><br>"+"開發者: 要幫助這個行為正確完成，"+"<a href='http://trac.openlayers.org/wiki/Google' "+"target='_blank'>請按這裡</a>",'getLayerWarning':"${layerType} 圖層無法被正確的載入。<br><br>"+"要迴避這個訊息, 請在右上角的圖層改變器裡，"+"選一個新的基礎圖層。<br><br>"+"很有可能是因為 ${layerLib} 的函式庫"+"腳本沒有被正確的置入。<br><br>"+"開發者: 要幫助這個行為正確完成，"+"<a href='http://trac.openlayers.org/wiki/${layerLib}' "+"target='_blank'>請按這裡</a>",'scale':"Scale = 1 : ${scaleDenom}",'layerAlreadyAdded':"你試著新增圖層: ${layerName} 到地圖上，但圖層之前就已經被新增了。",'reprojectDeprecated':"你正使用 'reproject' 這個選項 "+"在 ${layerName} 層。這個選項已經不再使用:"+"它的使用原本是設計用來支援在商業地圖上秀出資料，"+"但這個功能已經被"+"Spherical Mercator所取代。更多的資訊可以在 "+"http://trac.openlayers.org/wiki/SphericalMercator 找到。",'methodDeprecated':"這個方法已經不再使用且在3.0將會被移除，"+"請使用 ${newMethod} 來代替。",'boundsAddError':"您必須傳入 x 跟 y 兩者的值進 add 函數。",'lonlatAddError':"您必須傳入 lon 跟 lat 兩者的值進 add 函數。",'pixelAddError':"您必須傳入 x 跟 y 兩者的值進 add 函數。",'unsupportedGeometryType':"未支援的幾何型別: ${geomType}。",'pagePositionFailed':"OpenLayers.Util.pagePosition 失敗: id ${elemId} 的 element 可能被錯置。",'end':''};Fusion.configuration={"general":{"scriptLanguage":"php","temporaryDirectory":"/ms4w/tmp"},"mapguide":{"webTierUrl":"","useAsyncOverlay":true,"tileCacheUrl":"http://localhost:8008/sheboygan"},"mapserver":{"cgi":"/cgi-bin/mapserv","imagePath":"/ms4w/tmp/ms_tmp","imageUrl":"http://localhost/ms_tmp","legendIconCacheDir":"/ms4w/tmp/ms_tmp","mapFileRoot":"/ms4w/apps/"}}
Fusion.Widget.About=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,_nWidth:500,_nHeight:400,_sAboutUrl:null,_sDefaultUrl:'widgets/About/About.html',initializeWidget:function(widgetTag){var json=widgetTag.extension;this._sAboutUrl=(json.AboutURL)?json.AboutURL[0]:this._sDefaultUrl;if(this._sAboutUrl==this._sDefaultUrl){this._sAboutUrl=Fusion.getFusionURL()+this._sAboutUrl;}
this.enable();},activate:function(){var sFeatures='menubar=no,location=no,resizable=no,status=no';sFeatures+=',width='+this._nWidth;sFeatures+=',height='+this._nHeight;window.open(this._sAboutUrl,'AboutPopup',sFeatures);}});Fusion.Widget.ActivityIndicator=OpenLayers.Class(Fusion.Widget,{element:null,initializeWidget:function(widgetTag){this.element=this.domObj;var json=widgetTag.extension;if(json.ElementId){var elm=$(json.ElementId[0]);if(elm&&elm!=this.domObj){this.domObj.appendChild(elm);this.element=elm;}}
this.element.style.visibility='hidden';this.getMap().registerForEvent(Fusion.Event.MAP_BUSY_CHANGED,OpenLayers.Function.bind(this.busyChanged,this));},busyChanged:function(){this.element.style.visibility=this.getMap().isBusy()?'visible':'hidden';}});Fusion.Widget.BasemapSwitcher=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Menu,options:{'G_NORMAL_MAP':null,'G_SATELLITE_MAP':null,'G_HYBRID_MAP':null,'YAHOO_MAP_REG':null,'YAHOO_MAP_SAT':null,'YAHOO_MAP_HYB':null,'Road':null,'Aerial':null,'Hybrid':null,'None':null},baseMaps:{},defaultBasemap:null,menuItems:null,initializeWidget:function(widgetTag){var maps=this.getMap().aMaps;for(var i=0,len=maps.length;i<len;i++){var map=maps[i];switch(map.layerType){case'MapGuide':this.options['None']='None';this.baseMaps['None']=map;break;case'Google':if(!map.mapTag.extension.Options||!map.mapTag.extension.Options[0].type){this.options['G_NORMAL_MAP']="Google Street";this.baseMaps['G_NORMAL_MAP']=map;if(!this.defaultBasemap){this.defaultBasemap="G_NORMAL_MAP";}}
else{switch(map.mapTag.extension.Options[0].type[0]){case'G_NORMAL_MAP':if(map.mapTag.extension.Options[0].name)
this.options['G_NORMAL_MAP']=map.mapTag.extension.Options[0].name[0];else
this.options['G_NORMAL_MAP']="Google Street";this.baseMaps['G_NORMAL_MAP']=map;break;case'G_SATELLITE_MAP':if(map.mapTag.extension.Options[0].name)
this.options['G_SATELLITE_MAP']=map.mapTag.extension.Options[0].name[0];else
this.options['G_SATELLITE_MAP']="Google Satellite";this.baseMaps['G_SATELLITE_MAP']=map;break;case'G_HYBRID_MAP':if(map.mapTag.extension.Options[0].name)
this.options['G_HYBRID_MAP']=map.mapTag.extension.Options[0].name[0];else
this.options['G_HYBRID_MAP']="Google Hybrid";this.baseMaps['G_HYBRID_MAP']=map;break;default:break;}
if(!this.defaultBasemap){this.defaultBasemap=map.mapTag.extension.Options[0].type[0];}}
break;case'Yahoo':if(!map.mapTag.extension.Options||!map.mapTag.extension.Options[0].type){this.options['YAHOO_MAP_REG']="Yahoo Street";this.baseMaps['YAHOO_MAP_REG']=map;if(!this.defaultBasemap){this.defaultBasemap="YAHOO_MAP_REG";}}
else{switch(map.mapTag.extension.Options[0].type[0]){case'YAHOO_MAP_REG':if(map.mapTag.extension.Options[0].name)
this.options['YAHOO_MAP_REG']=map.mapTag.extension.Options[0].name[0];else
this.options['YAHOO_MAP_REG']="Yahoo Street";this.baseMaps['YAHOO_MAP_REG']=map;break;case'YAHOO_MAP_SAT':if(map.mapTag.extension.Options[0].name)
this.options['YAHOO_MAP_SAT']=map.mapTag.extension.Options[0].name[0];else
this.options['YAHOO_MAP_SAT']="Yahoo Satellite";this.baseMaps['YAHOO_MAP_SAT']=map;break;case'YAHOO_MAP_HYB':if(map.mapTag.extension.Options[0].name)
this.options['YAHOO_MAP_HYB']=map.mapTag.extension.Options[0].name[0];else
this.options['YAHOO_MAP_HYB']="Yahoo Hybrid";this.baseMaps['YAHOO_MAP_HYB']=map;break;default:break;}
if(!this.defaultBasemap){this.defaultBasemap=map.mapTag.extension.Options[0].type[0];}}
break;case'VirtualEarth':if(!map.mapTag.extension.Options||!map.mapTag.extension.Options[0].type){this.options['Road']="Bing Street";this.baseMaps['Road']=map;if(!this.defaultBasemap){this.defaultBasemap="Road";}}
else{switch(map.mapTag.extension.Options[0].type[0]){case'Road':if(map.mapTag.extension.Options[0].name)
this.options['Road']=map.mapTag.extension.Options[0].name[0];else
this.options['Road']="Bing Street";this.baseMaps['Road']=map;break;case'Aerial':if(map.mapTag.extension.Options[0].name)
this.options['Aerial']=map.mapTag.extension.Options[0].name[0];else
this.options['Aerial']="Bing Satellite";this.baseMaps['Aerial']=map;break;case'Hybrid':if(map.mapTag.extension.Options[0].name)
this.options['Hybrid']=map.mapTag.extension.Options[0].name[0];else
this.options['Hybrid']="Bing Hybrid";this.baseMaps['Hybrid']=map;break;default:break;}
if(!this.defaultBasemap){this.defaultBasemap=map.mapTag.extension.Options[0].type[0];}}
break;default:break;}}
this.getMap().registerForEvent(Fusion.Event.MAP_LOADED,OpenLayers.Function.bind(this.setDefaultBasemap,this));this.menuItems={};},setUiObject:function(uiObj){Fusion.Widget.prototype.setUiObject.apply(this,[uiObj]);var buttonSet=new Jx.ButtonSet();for(var key in this.options){if(this.options[key]){var menuItem=new Jx.Menu.Item({label:OpenLayers.i18n(this.options[key]),toggle:true,onDown:OpenLayers.Function.bind(this.setBasemap,this,key)});buttonSet.add(menuItem);this.uiObj.add(menuItem);this.menuItems[key]=menuItem;}}},setBasemap:function(baseMap){if("None"!=baseMap&&this.getMap().oMapOL.baseLayer.CLASS_NAME=="OpenLayers.Layer.MapGuide"){var visibility=this.baseMaps["None"].oLayerOL.visibility;this.getMap().oMapOL.setBaseLayer(this.baseMaps[baseMap].oLayerOL,false);this.baseMaps["None"].oLayerOL.visibility=visibility;this.baseMaps["None"].oLayerOL.redraw();}
else{this.getMap().oMapOL.setBaseLayer(this.baseMaps[baseMap].oLayerOL,false);}},setDefaultBasemap:function(){this.menuItems[this.defaultBasemap].setActive(true);this.setBasemap(this.defaultBasemap);}});Fusion.Widget.Buffer=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,isExclusive:true,layerName:null,layerNameInput:null,bufferDistance:null,bufferDistanceInput:null,bufferUnits:null,bufferUnitsInput:null,borderColor:null,borderColorInput:null,fillColor:null,fillColorInput:null,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.layerName=json.LayerName?json.LayerName[0]:'';this.layerNameInput=json.LayerNameInput?json.LayerNameInput[0]:null;this.bufferDistance=json.BufferDistance?parseFloat(json.BufferDistance[0]):'';this.bufferDistanceInput=json.BufferDistanceInput?json.BufferDistanceInput[0]:null;this.bufferUnits=Fusion.unitFromName(json.BufferUnits?json.BufferUnits[0]:'meters');this.bufferUnitsInput=json.BufferUnitsInput?json.BufferUnitsInput[0]:null;this.borderColor=json.BorderColor?json.BorderColor[0]:'00000000';this.borderColorInput=json.BorderColorInput?json.BorderColorInput[0]:null;this.fillColor=json.FillColor?json.FillColor[0]:'00000000';this.fillColorInput=json.FillColorInput?json.FillColorInput[0]:null;if(this.layerNameInput){this.layerNameInput=$(this.layerNameInput);this.setValue(this.layerNameInput,this.layerName);}
if(this.bufferDistanceInput){this.bufferDistanceInput=$(this.bufferDistanceInput);this.setValue(this.bufferDistanceInput,this.bufferDistance);}
if(this.bufferUnitsInput){this.bufferUnitsInput=$(this.bufferUnitsInput);this.setValue(this.bufferUnitsInput,this.bufferUnits);}
if(this.borderColorInput){this.borderColorInput=$(this.borderColorInput);this.setValue(this.borderColorInput,this.borderColor);}
if(this.fillColorInput){this.fillColorInput=$(this.fillColorInput);this.setValue(this.fillColorInput,this.fillColor);}
this.enable=Fusion.Widget.Buffer.prototype.enable;this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_ON,OpenLayers.Function.bind(this.enable,this));this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_OFF,OpenLayers.Function.bind(this.disable,this));},setValue:function(input,value){if(input.tagName.toLowerCase()=="input"){switch(input.type){case'radio':case'checkbox':for(var i=0;i<input.length;i++){if(input[i].value==value){input[i].checked=true;}}
break;case'file':break;case'button':case'hidden':case'image':case'password':case'reset':case'submit':case'text':input.value=value;break;default:}}
if(input.tagName.toLowerCase()=='textarea'){input.value=value;}
if(input.tagName.toLowerCase()=='select'){for(var i=0;i<input.options.length;i++){if(input.options[i].value==value){input.options[i].selected=true;break;}}}},getValue:function(input){if(input.tagName.toLowerCase()=="input"){switch(input.type){case'radio':case'checkbox':return input.value;break;case'file':case'button':case'hidden':case'image':case'password':case'reset':case'submit':case'text':return input.value;break;default:}}
if(input.tagName.toLowerCase()=='textarea'){return input.value;}
if(input.tagName.toLowerCase()=='select'){return input.options[input.selectedIndex].value;}},enable:function(){if(this.oMap&&this.oMap.hasSelection()){Fusion.Widget.prototype.enable.apply(this,[]);}else{this.disable();}},execute:function(){if(this.layerNameInput){this.layerName=this.getValue(this.layerNameInput);}
var layer='&layer='+this.layerName;var d;if(this.bufferDistanceInput){d=this.getValue(this.bufferDistanceInput);}else{d=this.bufferDistance;}
var du;if(this.bufferUnitsInput){du=this.getValue(this.bufferUnitsInput);}else{du=this.bufferUnits;}
var distance='&distance='+Fusion.toMeter(Fusion.unitFromName(du),d);var borderColor='&bordercolor=';if(this.borderColorInput){borderColor+=this.getValue(this.borderColorInput);}else{borderColor+=this.borderColor;}
var fillColor='&fillcolor=';if(this.fillColorInput){fillColor+=this.getValue(this.fillColorInput);}else{fillColor+=this.fillColor;}
var mapWidget=this.getMap();var aMaps=mapWidget.getAllMaps();var s=aMaps[0].arch+'/'+Fusion.getScriptLanguage()+"/Buffer."+Fusion.getScriptLanguage();var params={};params.parameters='locale='+Fusion.locale+'&merge=1'+'&session='+aMaps[0].getSessionID()+'&mapname='+aMaps[0].getMapName()+
layer+distance+borderColor+fillColor;params.onComplete=OpenLayers.Function.bind(this.bufferCreated,this);Fusion.ajaxRequest(s,params);},bufferCreated:function(){var aMaps=this.getMap().getAllMaps();var layer=aMaps[0].getLayerByName(this.layerName);if(layer){layer.noCache=true;}
aMaps[0].reloadMap();aMaps[0].drawMap();}});Fusion.Widget.BufferPanel=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,sFeatures:'menubar=no,location=no,resizable=no,status=no',isExclusive:true,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.sTarget=json.Target?json.Target[0]:"BufferPanelWindow";this.sBaseUrl=Fusion.getFusionURL()+'widgets/BufferPanel/BufferPanel.php';this.bSelectionOnly=(json.DisableIfSelectionEmpty&&(json.DisableIfSelectionEmpty[0]=='true'||json.DisableIfSelectionEmpty[0]=='1'))?true:false;this.additionalParameters=[];if(json.AdditionalParameter){for(var i=0;i<json.AdditionalParameter.length;i++){var p=json.AdditionalParameter[i];var k=p.Key[0];var v=p.Value[0];this.additionalParameters.push(k+'='+encodeURIComponent(v));}}
this.enable=Fusion.Widget.BufferPanel.prototype.enable;this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_ON,OpenLayers.Function.bind(this.enable,this));this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_OFF,OpenLayers.Function.bind(this.enable,this));this.disable();},enable:function(){var map=this.getMap();if(this.bSelectionOnly||!map){if(map&&map.hasSelection()){if(this.action){this.action.setEnabled(true);}else{Fusion.Widget.prototype.enable.apply(this,[]);}}else{if(this.action){this.action.setEnabled(false);}else{this.disable();}}}else{if(this.action){this.action.setEnabled(true);}else{Fusion.Widget.prototype.enable.apply(this,[]);}}},activate:function(){var url=this.sBaseUrl;var map=this.getMap();var mapLayers=map.getAllMaps();var taskPaneTarget=Fusion.getWidgetById(this.sTarget);var pageElement=$(this.sTarget);var params=[];params.push('locale='+Fusion.locale);params.push('session='+mapLayers[0].getSessionID());params.push('mapname='+mapLayers[0].getMapName());if(taskPaneTarget||pageElement){params.push('popup=false');}else{params.push('popup=true');}
params.push('us=0');params=params.concat(this.additionalParameters);if(url.indexOf('?')<0){url+='?';}else if(url.slice(-1)!='&'){url+='&';}
url+=params.join('&');if(taskPaneTarget){taskPaneTarget.setContent(url);}else{if(pageElement){pageElement.src=url;}else{window.open(url,this.sTarget,this.sWinFeatures);}}}});Fusion.Widget.CenterSelection=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,initializeWidget:function(widgetTag){Fusion.Widget.prototype.initialize.apply(this,[widgetTag,false]);Fusion.Widget.prototype.initialize.apply(this,[]);this.enable=Fusion.Widget.CenterSelection.prototype.enable;this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_ON,OpenLayers.Function.bind(this.enable,this));this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_OFF,OpenLayers.Function.bind(this.disable,this));},activate:function(){this.getMap().getSelection(OpenLayers.Function.bind(this.centerSelection,this));},centerSelection:function(selection){var map=this.getMap();var extents=map.getCurrentExtents();var curWidth=extents[2]-extents[0];var curHeight=extents[3]-extents[1];var ll=selection[map.getMapName()].getLowerLeftCoord();var ur=selection[map.getMapName()].getUpperRightCoord();var newWidth=ur.x-ll.x;var newHeight=ur.y-ll.y;if(newWidth<curWidth&&newHeight<curHeight){var cx=(ur.x+ll.x)/2;var cy=(ur.y+ll.y)/2;map.zoom(cx,cy,1);}else{var buffer=0.1;var minx=ll.x-newWidth*buffer;var miny=ll.y-newHeight*buffer;var maxx=ur.x+newWidth*buffer;var maxy=ur.y+newHeight*buffer;map.setExtents(new OpenLayers.Bounds(minx,miny,maxx,maxy));}},enable:function(){if(this.oMap&&this.oMap.hasSelection()){Fusion.Widget.prototype.enable.apply(this,[]);}else{this.disable();}}});Fusion.Widget.ClearSelection=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,initializeWidget:function(widgetTag){this.enable=Fusion.Widget.ClearSelection.prototype.enable;this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_ON,OpenLayers.Function.bind(this.enable,this));this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_OFF,OpenLayers.Function.bind(this.disable,this));},activate:function(){this.getMap().clearSelection();},enable:function(){if(this.oMap&&this.oMap.hasSelection()){Fusion.Widget.prototype.enable.apply(this,[]);}else{this.disable();}}});Fusion.Widget.ColorPicker=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button.Color,colorInput:null,alpha:100,color:'#000000',colorButton:null,initializeWidget:function(widgetTag){var json=widgetTag.extension;if(json.ColorInputId){this.colorInput=$(json.ColorInputId[0]);}
if(this.colorInput){this.alpha=100*parseInt('0x'+this.colorInput.value.substring(0,2))/255;this.color='#'+this.colorInput.value.substring(2);this.colorInput.widget=this;}},setUiObject:function(uiObj){Fusion.Widget.prototype.setUiObject.apply(this,[uiObj]);this.uiObj.setColor(this.color);this.uiObj.addEvent('change',OpenLayers.Function.bind(this.colorChanged,this));},colorChanged:function(button){var a=parseInt(button.options.alpha*255/100).toString(16);var c=a+button.options.color.substring(1);if(this.colorInput){this.colorInput.value=c;}}});Fusion.Widget.CursorPosition=OpenLayers.Class(Fusion.Widget,{defaultTemplate:'x: {x}, y: {y}',domSpan:null,units:Fusion.UNKNOWN,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.template=json.Template?json.Template[0]:this.defaultTemplate;this.precision=json.Precision?parseInt(json.Precision[0]):-1;this.units=json.Units?Fusion.unitFromName(json.Units[0]):Fusion.UNKOWN;this.domSpan=document.createElement('span');this.domSpan.className='spanCursorPosition';this.domSpan.innerHTML=this.emptyText;this.emptyText=json.EmptyText?json.EmptyText[0]:(this.domObj?this.domObj.innerHTML:'');if(this.domObj){this.domObj.innerHTML='';this.domObj.appendChild(this.domSpan);}
this.enable=Fusion.Widget.CursorPosition.prototype.enable;this.disable=Fusion.Widget.CursorPosition.prototype.enable;this.getMap().registerForEvent(Fusion.Event.MAP_LOADED,OpenLayers.Function.bind(this.setUnits,this));this.registerParameter('Units');},setUiObject:function(uiObj){Fusion.Widget.prototype.setUiObject.apply(this,[uiObj]);if(this.uiObj.domObj){this.uiObj.domObj.appendChild(this.domSpan);}else{this.uiObj.appendChild(this.domSpan);}},enable:function(){this.mouseMoveWatcher=OpenLayers.Function.bind(this.mouseMove,this);this.mouseOutWatcher=OpenLayers.Function.bind(this.mouseOut,this);this.getMap().observeEvent('mousemove',this.mouseMoveWatcher);this.getMap().observeEvent('mouseout',this.mouseOutWatcher);},disable:function(){this.getMap().stopObserveEvent('mousemove',this.mouseMoveWatcher);this.getMap().stopObserveEvent('mouseout',this.mouseOutWatcher);},mouseOut:function(e){this.domSpan.innerHTML=this.emptyText;},mouseMove:function(e){var map=this.getMap();var p=map.getEventPosition(e);if(this.units!=Fusion.PIXELS){p=map.pixToGeo(p.x,p.y);if(p){if(this.units!=Fusion.UNKNOWN){var convFactor=map.getMetersPerUnit();p.x=Fusion.fromMeter(this.units,p.x*convFactor);p.y=Fusion.fromMeter(this.units,p.y*convFactor);}
if(this.precision>=0){var factor=Math.pow(10,this.precision);p.x=Math.round(p.x*factor)/factor;p.y=Math.round(p.y*factor)/factor;}}}
if(p){var unitAbbr=Fusion.unitAbbr(this.units);this.domSpan.innerHTML=this.template.replace('{x}',p.x).replace('{y}',p.y).replace('{units}',unitAbbr).replace('{units}',unitAbbr);}},setUnits:function(){if(this.units==Fusion.UNKNOWN){this.setParameter('Units',this.getMap().getUnits());}},setParameter:function(param,value){if(param=='Units'){this.units=Fusion.unitFromName(value);}}});Fusion.Widget.EditableScale=OpenLayers.Class(Fusion.Widget,{precision:4,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.domPrefix=document.createElement('span');this.domPrefix.className='inputEditableScalePrefix';this.domPrefix.innerHTML='1: ';this.domScale=document.createElement('input');this.domScale.className='inputEditableScale';OpenLayers.Event.observe(this.domScale,'keypress',OpenLayers.Function.bindAsEventListener(this.keyPressHandler,this));this.precision=json.Precision?parseInt(json.Precision[0]):this.precision;this.getMap().registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED,OpenLayers.Function.bind(this.scaleChanged,this));Fusion.addWidgetStyleSheet(widgetTag.location+'/EditableScale/EditableScale.css');if(this.domObj){this.domObj.appendChild(this.domPrefix);this.domObj.appendChild(this.domScale);}},setUiObject:function(uiObj){Fusion.Widget.prototype.setUiObject.apply(this,[uiObj]);if(this.uiObj.domObj){this.uiObj.domObj.appendChild(this.domPrefix);this.uiObj.domObj.appendChild(this.domScale);}else{this.uiObj.appendChild(this.domPrefix);this.uiObj.appendChild(this.domScale);}},scaleChanged:function(){this.domScale.value=this.scaleToString(this.getMap().oMapOL.getScale());},scaleToString:function(scale){scale=Math.abs(parseFloat(scale));return""+Math.round(scale*Math.pow(10,this.precision))/Math.pow(10,this.precision);},keyPressHandler:function(e){if(e.keyCode==OpenLayers.Event.KEY_RETURN){this.zoomToScale();}},zoomToScale:function(e){var scale=parseFloat(this.domScale.value);if(scale){this.getMap().zoomToScale(scale);}}});Fusion.Event.HISTORY_CHANGED=Fusion.Event.lastEventId++;Fusion.Widget.ExtentHistory=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,events:[],aHistory:[],sDirection:null,EPS:0.00000001,initializeWidget:function(widgetTag){var json=widgetTag.extension;var sDirection=json.Direction?json.Direction[0].toLowerCase():'previous';if(sDirection!='previous'&&sDirection!='next'){this.sDirection='previous';}else{this.sDirection=sDirection;}
if(!this.aHistory['history']){this.aHistory['history']=[];this.aHistory['index']=-1;this.getMap().registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED,OpenLayers.Function.bind(this.extentsChanged,this));this.getMap().registerForEvent(Fusion.Event.MAP_LOADED,OpenLayers.Function.bind(this.reset,this));}
this.enable=Fusion.Widget.ExtentHistory.prototype.historyChanged;this.disable=Fusion.Widget.ExtentHistory.prototype.historyChanged;this.registerEventID(Fusion.Event.HISTORY_CHANGED);this.registerForEvent(Fusion.Event.HISTORY_CHANGED,OpenLayers.Function.bind(this.historyChanged,this));this.disable();},reset:function(){if(this.getMap().isMapLoaded()){this.aHistory['history']=[this.getMap().getCurrentExtents()];this.aHistory['index']=0;}else{this.aHistory['history']=[];this.aHistory['index']=-1;}
this.historyChanged();},extentsChanged:function(){var extents=this.getMap().getCurrentExtents();if(this.aHistory['history'].length==0){this.aHistory['history'].push(extents);this.aHistory['index']=0;}else{var aExtents=this.aHistory['history'][this.aHistory['index']];if(this.boundsEqual(extents,aExtents)){return;}
if(this.aHistory['index']!=(this.aHistory['history'].length-1)){this.aHistory['history']=this.aHistory['history'].slice(0,this.aHistory['index']+1);}
this.aHistory['history'].push(extents);this.aHistory['index']=this.aHistory['history'].length-1;}
this.triggerEvent(Fusion.Event.HISTORY_CHANGED);},historyChanged:function(){if(this.sDirection=='previous'){if(this.aHistory['index']>0){Fusion.Widget.prototype.enable.apply(this,[]);}else{Fusion.Widget.prototype.disable.apply(this,[]);}}else{if(this.aHistory['index']<(this.aHistory['history'].length-1)){Fusion.Widget.prototype.enable.apply(this,[]);}else{Fusion.Widget.prototype.disable.apply(this,[]);}}},activate:function(){if(this.sDirection=='previous'){if(this.aHistory['index']>0){this.aHistory['index']--;this.getMap().setExtents(this.aHistory['history'][this.aHistory['index']]);this.triggerEvent(Fusion.Event.HISTORY_CHANGED);}}else{if(this.aHistory['index']<(this.aHistory['history'].length-1)){this.aHistory['index']++;this.getMap().setExtents(this.aHistory['history'][this.aHistory['index']]);this.triggerEvent(Fusion.Event.HISTORY_CHANGED);}}},boundsEqual:function(b1,b2){var equal=false;var offset=100;if(b2.top==0){b1.top+=offset;b2.top+=offset;}
if(b2.bottom==0){b1.bottom+=offset;b2.bottom+=offset;}
if(b2.left==0){b1.left+=offset;b2.left+=offset;}
if(b2.right==0){b1.right+=offset;b2.right+=offset;}
equal=(Math.abs(b1.top-b2.top)/b2.top<this.EPS&&Math.abs(b1.bottom-b2.bottom)/b2.bottom<this.EPS&&Math.abs(b1.left-b2.left)/b2.left<this.EPS&&Math.abs(b1.right-b2.right)/b2.right<this.EPS);return equal;}});Fusion.Widget.FeatureInfo=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,sFeatures:'menubar=no,location=no,resizable=no,status=no',initializeWidget:function(widgetTag){var json=widgetTag.extension;this.sTarget=json.Target?json.Target[0]:"FeatureInfoWindow";this.sBaseUrl=Fusion.getFusionURL()+'widgets/FeatureInfo/featureinfomain.php';},activate:function(){var url=this.sBaseUrl;var map=this.getMap();var mapLayers=map.getAllMaps();var taskPaneTarget=Fusion.getWidgetById(this.sTarget);var pageElement=$(this.sTarget);var params=[];params.push('LOCALE='+Fusion.locale);params.push('SESSION='+mapLayers[0].getSessionID());params.push('MAPNAME='+mapLayers[0].getMapName());if(taskPaneTarget||pageElement){params.push('POPUP=false');}else{params.push('POPUP=true');}
if(url.indexOf('?')<0){url+='?';}else if(url.slice(-1)!='&'){url+='&';}
url+=params.join('&');if(taskPaneTarget){taskPaneTarget.setContent(url);}else{if(pageElement){pageElement.src=url;}else{window.open(url,this.sTarget,this.sWinFeatures);}}}});Fusion.Widget.Help=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,sFeatures:'menubar=no,location=no,resizable=no,status=no',target:'HelpWindow',baseUrl:null,defaultUrl:'widgets/sneHelp/Infrapath_'+window._FusionLocale+'.pdf',initializeWidget:function(widgetTag){var json=widgetTag.extension;this.target=json.Target?json.Target[0]:"HelpWindow";this.baseUrl=json.Url?json.Url[0]:this.defaultUrl;if(this.baseUrl==this.defaultUrl){this.baseUrl=Fusion.getFusionURL()+this.baseUrl;}
if(!widgetTag.Disabled||widgetTag.Disabled[0].toLowerCase()!='true'){this.enable();}},activate:function(){var url=this.baseUrl;var map=this.getMap();var params=[];params.push('LOCALE='+Fusion.locale);params.push('SESSION='+map.getSessionID());params.push('MAPNAME='+map.getMapName());if(url.indexOf('?')<0){url+='?';}else if(url.slice(-1)!='&'){url+='&';}
url+=params.join('&');var taskPaneTarget=Fusion.getWidgetById(this.target);if(taskPaneTarget){taskPaneTarget.setContent(url);}else{var pageElement=$(this.target);if(pageElement){pageElement.src=url;}else{window.open(url,this.target,this.sWinFeatures);}}}});Fusion.Widget.InitialMapView=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,viewType:'initial',initializeWidget:function(widgetTag){var json=widgetTag.extension;if(json.ViewType&&(json.ViewType[0].toLowerCase()=='full')){this.viewType='full';}},activate:function(){if(this.viewType=='full'){this.getMap().fullExtents();}else{var mapWidget=this.getMap();mapWidget.setExtents(mapWidget.initialExtents);}}});Fusion.Widget.InvokeScript=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,script:null,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.script=json.Script?json.Script[0]:'';},activate:function(){eval(this.script);}});Fusion.Widget.InvokeURL=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,sFeatures:'menubar=no,location=no,resizable=no,status=no',initializeWidget:function(widgetTag){var json=widgetTag.extension;this.sTarget=json.Target?json.Target[0]:"InvokeUrlWindow";this.sBaseUrl=json.Url[0];this.bSelectionOnly=(json.DisableIfSelectionEmpty&&(json.DisableIfSelectionEmpty[0]=='true'||json.DisableIfSelectionEmpty[0]=='1'))?true:false;this.additionalParameters=[];if(json.AdditionalParameter){for(var i=0;i<json.AdditionalParameter.length;i++){var p=json.AdditionalParameter[i];var k=p.Key[0];var v=p.Value[0];this.additionalParameters.push(k+'='+encodeURIComponent(v));}}
this.enable=Fusion.Widget.InvokeURL.prototype.enable;this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_ON,OpenLayers.Function.bind(this.enable,this));this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_OFF,OpenLayers.Function.bind(this.enable,this));this.disable();},enable:function(){var map=this.getMap();if(this.bSelectionOnly||!map){if(map&&map.hasSelection()){if(this.action){this.action.setEnabled(true);}else{Fusion.Widget.prototype.enable.apply(this,[]);}}else{if(this.action){this.action.setEnabled(false);}else{this.disable();}}}else{if(this.action){this.action.setEnabled(true);}else{Fusion.Widget.prototype.enable.apply(this,[]);}}},activate:function(){var url=this.sBaseUrl;var map=this.getMap();var params=[];params.push('LOCALE='+Fusion.locale);params.push('SESSION='+map.getSessionID());params.push('MAPNAME='+map.getMapName());params=params.concat(this.additionalParameters);if(url.indexOf('?')<0){url+='?';}else if(url.slice(-1)!='&'){url+='&';}
url+=params.join('&');var taskPaneTarget=Fusion.getWidgetById(this.sTarget);if(taskPaneTarget){taskPaneTarget.setContent(url);}else{var pageElement=$(this.sTarget);if(pageElement){pageElement.src=url;}else{window.open(url,this.sTarget,this.sFeatures);}}}});Fusion.Widget.LayerManager=OpenLayers.Class(Fusion.Widget,{currentNode:null,bIsDrawn:false,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.delIconSrc=json.DeleteIcon?json.DeleteIcon[0]:'images/icons/select-delete.png';Fusion.addWidgetStyleSheet(widgetTag.location+'LayerManager/LayerManager.css');this.cursorNormal=["url('images/grab.cur'),move",'grab','-moz-grab','move'];this.cursorDrag=["url('images/grabbing.cur'),move",'grabbing','-moz-grabbing','move'];this.getMap().registerForEvent(Fusion.Event.MAP_LOADED,OpenLayers.Function.bind(this.mapLoaded,this));this.getMap().registerForEvent(Fusion.Event.MAP_RELOADED,OpenLayers.Function.bind(this.mapLoaded,this));},mapLoaded:function(){this.draw();},clear:function(node){while(node.childNodes.length>0){this.clear(node.childNodes[0]);node.remove(node.childNodes[0]);}},draw:function(r){if(this.mapList){this.mapList=null;}
this.mapList=document.createElement('ul');this.mapList.className='jxLman';this.domObj.appendChild(this.mapList);var map=this.getMap();for(var i=0;i<map.aMaps.length;++i){var mapBlock=document.createElement('li');mapBlock.className='jxLmanMap';mapBlock.id='mapBlock_'+i;var handle=document.createElement('a');handle.innerHTML=map.aMaps[i]._sMapTitle;handle.className='jxLmanHandle';mapBlock.appendChild(handle);this.mapList.appendChild(mapBlock);this.processMapBlock(mapBlock,map.aMaps[i]);}
if(map.aMaps.length>1){var options=[];options.onUpdate=OpenLayers.Function.bind(this.updateMapBlock,this,map);options.handle='jxLmanHandle';options.scroll=this.domObj.id;Sortable.create(this.mapList.id,options);}},processMapBlock:function(blockDom,map){var mapBlockList=document.createElement('ul');mapBlockList.className='jxLmanSet';mapBlockList.id='fusionLayerManager_'+map.getMapName();blockDom.appendChild(mapBlockList);map.layerPrefix='layer_';var processArray=map.aLayers;if(map.bLayersReversed){processArray.reverse();}
for(var i=0;i<processArray.length;++i){var blockItem=document.createElement('li');blockItem.className='jxLmanLayer';blockItem.id=map.layerPrefix+i;mapBlockList.appendChild(blockItem);this.createItemHtml(blockItem,processArray[i]);blockItem.layer=processArray[i];}},createItemHtml:function(parent,layer){var delIcon=document.createElement('img');delIcon.src=this.delIconSrc;OpenLayers.Event.observe(delIcon,'click',OpenLayers.Function.bind(this.deleteLayer,this,layer));delIcon.style.visibility='hidden';parent.appendChild(delIcon);var visSelect=document.createElement('input');visSelect.type='checkbox';OpenLayers.Event.observe(visSelect,'click',OpenLayers.Function.bind(this.visChanged,this,layer));parent.appendChild(visSelect);if(layer.visible){visSelect.checked=true;}else{visSelect.checked=false;}
var label=document.createElement('a');label.innerHTML=layer.legendLabel;OpenLayers.Event.observe(label,'mouseover',OpenLayers.Function.bind(this.setGrabCursor,this));OpenLayers.Event.observe(label,'mousedown',OpenLayers.Function.bind(this.setDragCursor,this));OpenLayers.Event.observe(label,'mouseout',OpenLayers.Function.bind(this.setNormalCursor,this));parent.appendChild(label);OpenLayers.Event.observe(parent,'mouseover',OpenLayers.Function.bind(this.setHandleVis,this,delIcon));OpenLayers.Event.observe(parent,'mouseout',OpenLayers.Function.bind(this.setHandleHide,this,delIcon));},setHandleVis:function(delIcon){delIcon.style.visibility='visible';},setHandleHide:function(delIcon){delIcon.style.visibility='hidden';},setGrabCursor:function(ev){},setDragCursor:function(ev){},setNormalCursor:function(ev){},setCursor:function(cursor,domObj){this.cursor=cursor;if(cursor&&cursor.length&&typeof cursor=='object'){for(var i=0;i<cursor.length;i++){domObj.style.cursor=cursor[i];if(domObj.style.cursor==cursor[i]){break;}}}else if(typeof cursor=='string'){domObj.style.cursor=cursor;}else{domObj.style.cursor='auto';}},updateLayer:function(map,ul){var aLayerIndex=[];var aIds=[];var nLayers=ul.childNodes.length;for(var i=0;i<nLayers;++i){aIds[i]=ul.childNodes[i].id.split('_');var index=parseInt(aIds[i].pop());if(map.bLayersReversed){index=nLayers-(index+1);}
aLayerIndex.push(index);ul.childNodes[i].id='';}
for(var i=0;i<ul.childNodes.length;++i){var node=ul.childNodes[i];aIds[i].push(i);node.id=aIds[i].join('_');node.childNodes[1].checked=node.layer.isVisible()}
if(map.bLayersReversed){aLayerIndex.reverse();}
map.reorderLayers(aLayerIndex);},updateMapBlock:function(map,ul){},deleteLayer:function(layer,ev){var targetLI=(new Event(ev)).target.parentNode;var ul=targetLI.parentNode;$(targetLI).dispose();this.updateLayer(layer.oMap,ul);},visChanged:function(layer2,ev){var target=(new Event(ev)).target;var layer=target.parentNode.layer;if(target.checked){layer.show();}else{layer.hide();}}});Fusion.Widget.Legend=OpenLayers.Class(Fusion.Widget,{defaultLayerDWFIcon:'images/icons/legend-DWF.png',defaultLayerRasterIcon:'images/icons/legend-raster.png',defaultLayerThemeIcon:'images/icons/legend-theme.png',defaultDisabledLayerIcon:'images/icons/legend-layer.png',defaultRootFolderIcon:'images/icons/legend-map.png',defaultLayerInfoIcon:'images/icons/tree_layer_info.png',defaultGroupInfoIcon:'images/icons/tree_group_info.png',initializeWidget:function(widgetTag){Fusion.addWidgetStyleSheet(widgetTag.location+'Legend/Legend.css');var json=widgetTag.extension;if(json.LegendRenderer)
{var renderer=eval(json.LegendRenderer[0]);if(renderer&&renderer.prototype.CLASS_NAME&&renderer.prototype.CLASS_NAME=="Fusion.Widget.Legend.LegendRenderer"){this.renderer=new renderer(this,widgetTag);}else if(typeof renderer=="function"){var renderFunction=renderer;this.renderer=new Fusion.Widget.Legend.LegendRenderer(this);this.renderer.mapLoaded=renderFunction;this.renderer.mapReloaded=renderFunction;this.renderer.mapLoading=false;}else{this.renderer=new Fusion.Widget.Legend.LegendRendererDefault(this,widgetTag);}}else{this.renderer=new Fusion.Widget.Legend.LegendRendererDefault(this,widgetTag);}
if(this.renderer.mapReloaded)
this.getMap().registerForEvent(Fusion.Event.MAP_RELOADED,OpenLayers.Function.bind(this.renderer.mapReloaded,this.renderer));if(this.renderer.mapLoading)
this.getMap().registerForEvent(Fusion.Event.MAP_LOADING,OpenLayers.Function.bind(this.renderer.mapLoading,this.renderer));if(this.renderer.mapLoaded)
this.getMap().registerForEvent(Fusion.Event.MAP_LOADED,OpenLayers.Function.bind(this.renderer.mapLoaded,this.renderer));}});Fusion.Widget.Legend.LegendRenderer=OpenLayers.Class({oLegend:null,layerRoot:null,initialize:function(legend){this.oLegend=legend;this.layerRoot=this.getMap().layerRoot;},renderLegend:function(){},mapLoading:function(){},mapLoaded:function(){},mapReloaded:function(){},getMap:function(){return this.oLegend.getMap();},CLASS_NAME:"Fusion.Widget.Legend.LegendRenderer"});Fusion.Widget.Legend.LegendRendererDefault=OpenLayers.Class(Fusion.Widget.Legend.LegendRenderer,{showRootFolder:false,currentNode:null,bIsDrawn:false,targetFolder:null,bIncludeVisToggle:true,initialize:function(legend,widgetTag){Fusion.Widget.Legend.LegendRenderer.prototype.initialize.apply(this,[legend]);var json=widgetTag.extension;this.imgLayerDWFIcon=json.LayerDWFIcon?json.LayerDWFIcon[0]:this.oLegend.defaultLayerDWFIcon;this.imgLayerRasterIcon=json.LayerRasterIcon?json.LayerRasterIcon[0]:this.oLegend.defaultLayerRasterIcon;this.imgLayerThemeIcon=json.LayerThemeIcon?json.LayerThemeIcon[0]:this.oLegend.defaultLayerThemeIcon;this.imgDisabledLayerIcon=json.DisabledLayerIcon?json.DisabledLayerIcon[0]:this.oLegend.defaultDisabledLayerIcon;this.imgLayerInfoIcon=json.LayerInfoIcon?json.LayerInfoIcon[0]:this.oLegend.defaultLayerInfoIcon;this.imgGroupInfoIcon=json.GroupInfoIcon?json.GroupInfoIcon[0]:this.oLegend.defaultGroupInfoIcon;this.selectedLayer=null;this.oTree=new Jx.Tree({parent:this.oLegend.domObj});this.hideInvisibleLayers=(json.HideInvisibleLayers&&json.HideInvisibleLayers[0])=='true'?true:false;this.showRootFolder=(json.ShowRootFolder&&json.ShowRootFolder[0]=='true')?true:false;this.showMapFolder=(json.ShowMapFolder&&json.ShowMapFolder[0]=='false')?false:true;if(!this.showRootFolder){this.oRoot=this.oTree;}else{var opt={label:OpenLayers.i18n('defaultMapTitle'),open:true,draw:this.renderFolder,contextMenu:this.getContextMenu(),'class':'fusionLegendFolder'};this.oRoot=new Jx.TreeFolder(opt);this.oTree.append(this.oRoot);this.oRoot.options.contextMenu.add(new Jx.Menu.Item({label:OpenLayers.i18n('collapse'),onClick:OpenLayers.Function.bind(this.collapseBranch,this,this.oRoot)}),new Jx.Menu.Item({label:OpenLayers.i18n('expand'),onClick:OpenLayers.Function.bind(this.expandBranch,this,this.oRoot)}));}
this.extentsChangedWatcher=this.update.bind(this);},getContextMenu:function(){return new Jx.Menu.Context(this.name).add(new Jx.Menu.Item({label:OpenLayers.i18n('refresh'),onClick:OpenLayers.Function.bind(this.update,this)}),new Jx.Menu.Item({label:OpenLayers.i18n('collapseAll'),onClick:OpenLayers.Function.bind(this.collapseAll,this)}),new Jx.Menu.Item({label:OpenLayers.i18n('expandAll'),onClick:OpenLayers.Function.bind(this.expandAll,this)}));},expandAll:function(folder){for(var i=0;i<this.oTree.nodes.length;i++){var item=this.oTree.nodes[i];if(item instanceof Jx.TreeFolder){this.recurseTree('expand',item);}}
if(this.showRootFolder){this.oRoot.expand();}},collapseAll:function(folder){for(var i=0;i<this.oTree.nodes.length;i++){var item=this.oTree.nodes[i];if(item instanceof Jx.TreeFolder){this.recurseTree('collapse',item);}}
if(this.showRootFolder){this.oRoot.collapse();}},collapseBranch:function(folder){folder.collapse();},expandBranch:function(folder){folder.expand();},recurseTree:function(op,folder){for(var i=0;i<folder.nodes.length;i++){var item=folder.nodes[i];if(item instanceof Jx.TreeFolder){this.recurseTree(op,item);item[op]();}}},scaleRangesLoaded:function(){this.layerRoot=this.getMap().layerRoot;this.renderLegend();},mapLoading:function(){this.getMap().deregisterForEvent(Fusion.Event.MAP_EXTENTS_CHANGED,this.extentsChangedWatcher);this.clear();},mapLoaded:function(){this.getMap().registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED,this.extentsChangedWatcher);this.getMap().loadScaleRanges(OpenLayers.Function.bind(this.scaleRangesLoaded,this));},mapReloaded:function(){this.getMap().loadScaleRanges(OpenLayers.Function.bind(this.scaleRangesLoaded,this));},invalidate:function(){this.draw();},renderLegend:function(r){this.bIsDrawn=false;this.clear();if(this.showRootFolder){this.oRoot.itemLabelobj.innerHTML=this.getMap().getMapTitle();}
var startGroup=this.layerRoot;if(!this.showMapFolder){startGroup=this.layerRoot.groups[0];}
if(!startGroup.legend){startGroup.legend={};startGroup.legend.treeItem=this.oRoot;}
for(var i=0;i<startGroup.groups.length;i++){this.processMapGroup(startGroup.groups[i],this.oRoot);}
for(var i=0;i<startGroup.layers.length;i++){this.processMapLayer(startGroup.layers[i],this.oRoot);}
this.bIsDrawn=true;this.update();},processMapGroup:function(group,folder){if(group.displayInLegend){group.legend={};var opt={label:group.legendLabel,open:group.expandInLegend,draw:this.renderFolder,contextMenu:this.getContextMenu(),'class':'fusionLegendFolder'};group.legend.treeItem=new Jx.TreeFolder(opt);group.legend.treeItem.domObj.store('data',group);group.legend.treeItem.options.contextMenu.add(new Jx.Menu.Item({label:OpenLayers.i18n('collapse'),onClick:OpenLayers.Function.bind(this.collapseBranch,this,group.legend.treeItem)}),new Jx.Menu.Item({label:OpenLayers.i18n('expand'),onClick:OpenLayers.Function.bind(this.expandBranch,this,group.legend.treeItem)}));folder.append(group.legend.treeItem);group.legend.treeItem.checkBox.checked=group.visible?true:false;OpenLayers.Event.observe(group.legend.treeItem.checkBox,'click',OpenLayers.Function.bind(this.stateChanged,this,group));var groupInfo=group.oMap.getGroupInfoUrl(group.groupName);if(groupInfo){var a=document.createElement('a');a.href=groupInfo;if(groupInfo.indexOf('javascript:')<0){a.target='_blank';}
var img=document.createElement('img');Jx.addToImgQueue({element:img,src:this.imgGroupInfoIcon});img.border=0;a.appendChild(img);group.legend.treeItem.domObj.insertBefore(a,group.legend.treeItem.domObj.childNodes[4]);}
if(this.oSelectionListener){group.legend.treeItem.addEvent('click',OpenLayers.Function.bind(this.selectionChanged,this));}
for(var i=0;i<group.groups.length;i++){this.processMapGroup(group.groups[i],group.legend.treeItem);}
for(var i=0;i<group.layers.length;i++){this.processMapLayer(group.layers[i],group.legend.treeItem);}}},processMapLayer:function(layer,folder){layer.legend={};layer.legend.parentItem=folder;layer.legend.currentRange=null;layer.registerForEvent(Fusion.Event.LAYER_PROPERTY_CHANGED,OpenLayers.Function.bind(this.layerPropertyChanged,this));},layerPropertyChanged:function(eventID,layer){layer.legend.treeItem.checkBox.checked=layer.isVisible();},update:function(){if(this.bIsDrawn){window.setTimeout(OpenLayers.Function.bind(this._update,this),1);}},_update:function(){var map=this.getMap();var currentScale=map.getScale();for(var i=0;i<map.layerRoot.groups.length;i++){this.updateGroupLayers(map.layerRoot.groups[i],currentScale);}
for(var i=0;i<map.layerRoot.layers.length;i++){this.updateLayer(map.layerRoot.layers[i],currentScale);}},clear:function(){while(this.oRoot.nodes.length>0){this.oRoot.remove(this.oRoot.nodes[0]);}},selectionChanged:function(o){if(this.currentNode){$(this.currentNode.domObj.childNodes[1]).removeClass('jxTreeItemSelected');}
this.currentNode=o;$(this.currentNode.domObj.childNodes[1]).addClass('jxTreeItemSelected');var data=o.domObj.retrieve('data');if(data instanceof Fusion.Layers.Group){this.getMap().setActiveLayer(null);}else{this.getMap().setActiveLayer(data);}},updateGroupLayers:function(group,fScale){for(var i=0;i<group.groups.length;i++){this.updateGroupLayers(group.groups[i],fScale);}
for(var i=0;i<group.layers.length;i++){this.updateLayer(group.layers[i],fScale);}},updateLayer:function(layer,fScale){if(!layer.displayInLegend||!layer.legend){return;}
var range=layer.getScaleRange(fScale);if(range==layer.legend.currentRange&&layer.legend.treeItem){return;}
layer.legend.currentRange=range;if(range!=null){if(range.styles.length>1){if(!layer.legend.treeItem){layer.legend.treeItem=this.createFolderItem(layer);OpenLayers.Event.observe(layer.legend.treeItem.checkBox,'click',OpenLayers.Function.bind(this.stateChanged,this,layer));layer.parentGroup.legend.treeItem.append(layer.legend.treeItem);}else if(layer.legend.treeItem instanceof Jx.TreeItem){this.clearTreeItem(layer);layer.legend.treeItem=this.createFolderItem(layer);OpenLayers.Event.observe(layer.legend.treeItem.checkBox,'click',OpenLayers.Function.bind(this.stateChanged,this,layer));layer.parentGroup.legend.treeItem.append(layer.legend.treeItem);}else{while(layer.legend.treeItem.nodes.length>0){layer.legend.treeItem.remove(layer.legend.treeItem.nodes[0]);}}
for(var i=0;i<range.styles.length;i++){var item=this.createTreeItem(layer,range.styles[i],fScale,false);layer.legend.treeItem.append(item);}}else{var style=range.styles[0];if(!layer.legend.treeItem){layer.legend.treeItem=this.createTreeItem(layer,style,fScale,this.bIncludeVisToggle);OpenLayers.Event.observe(layer.legend.treeItem.checkBox,'click',OpenLayers.Function.bind(this.stateChanged,this,layer));layer.parentGroup.legend.treeItem.append(layer.legend.treeItem);}else if(layer.legend.treeItem instanceof Jx.TreeFolder){this.clearTreeItem(layer);layer.legend.treeItem=this.createTreeItem(layer,style,fScale,this.bIncludeVisToggle);OpenLayers.Event.observe(layer.legend.treeItem.checkBox,'click',OpenLayers.Function.bind(this.stateChanged,this,layer));layer.parentGroup.legend.treeItem.append(layer.legend.treeItem);}else{if(range.styles.length>0){layer.legend.treeItem.domImg.style.backgroundImage='url('+layer.oMap.getLegendImageURL(fScale,layer,range.styles[0])+')';$(layer.legend.treeItem.domObj).removeClass('jxDisabled');}else{$(layer.legend.treeItem.domObj).addClass('jxDisabled');}}}
layer.legend.treeItem.checkBox.checked=layer.visible?true:false;if(layer.layerTypes[0]==4||range.styles.length>0){layer.legend.treeItem.checkBox.disabled=false;}else{layer.legend.treeItem.checkBox.disabled=true;}}else{if(this.hideInvisibleLayers){if(layer.legend.treeItem){layer.parentGroup.legend.treeItem.remove(layer.legend.treeItem);layer.legend.treeItem=null;}}else{var newTreeItem=this.createTreeItem(layer,null,null,this.bIncludeVisToggle);OpenLayers.Event.observe(newTreeItem.checkBox,'click',OpenLayers.Function.bind(this.stateChanged,this,layer));if(layer.legend.treeItem){layer.legend.treeItem.checkBox.disabled=true;layer.parentGroup.legend.treeItem.replace(newTreeItem,layer.legend.treeItem);layer.legend.treeItem.finalize();}else{layer.parentGroup.legend.treeItem.append(newTreeItem);}
layer.legend.treeItem=newTreeItem;}}
if(layer.legend.treeItem){layer.legend.treeItem.domObj.store('data',layer);}},createFolderItem:function(layer){var opt={label:layer.legendLabel==''?'&nbsp;':layer.legendLabel,isOpen:layer.expandInLegend,draw:this.renderFolder,'class':'fusionLegendItemCheckbox',contextMenu:this.getContextMenu(),image:this.imgLayerThemeIcon};var folder=new Jx.TreeFolder(opt);folder.options.contextMenu.add(new Jx.Menu.Item({label:OpenLayers.i18n('collapse'),onClick:OpenLayers.Function.bind(this.collapseBranch,this,folder)}),new Jx.Menu.Item({label:OpenLayers.i18n('expand'),onClick:OpenLayers.Function.bind(this.expandBranch,this,folder)}));var layerInfo=layer.oMap.getLayerInfoUrl(layer.layerName);if(layerInfo){var a=document.createElement('a');a.href=layerInfo;if(layerInfo.indexOf('javascript:')<0){a.target='_blank';}
var img=document.createElement('img');Jx.addToImgQueue({element:img,src:this.imgLayerInfoIcon});img.border=0;a.appendChild(img);folder.domObj.insertBefore(a,folder.domObj.childNodes[4]);}
folder.addEvent('click',OpenLayers.Function.bind(this.selectionChanged,this));return folder;},createTreeItem:function(layer,style,scale,bCheckBox){var opt={};opt.statusIsDefault=layer.statusDefault;if(bCheckBox){opt.label=layer.legendLabel==''?'&nbsp;':layer.legendLabel;opt.draw=this.renderItemCheckBox;}else{opt.label=style.legendLabel==''?'&nbsp;':style.legendLabel;opt.draw=this.renderItem;}
if(layer.layerTypes[0]==4){if(style&&style.staticIcon==Fusion.Constant.LAYER_DWF_TYPE){opt.image=this.imgLayerDWFIcon;}else{opt.image=this.imgLayerRasterIcon;}}else if(!style){opt.image=this.imgDisabledLayerIcon;opt.enabled=false;}else{opt.image=layer.oMap.getLegendImageURL(scale,layer,style);}
opt.contextMenu=this.getContextMenu();var item=new Jx.TreeItem(opt);if(bCheckBox){var layerInfo=layer.oMap.getLayerInfoUrl(layer.layerName);if(layerInfo){var a=document.createElement('a');a.href=layerInfo;if(layerInfo.indexOf('javascript:')<0){a.target='_blank';}
var img=document.createElement('img');Jx.addToImgQueue({element:img,src:this.imgLayerInfoIcon});img.border=0;a.appendChild(img);item.domObj.insertBefore(a,item.domObj.childNodes[4]);}}
item.addEvent('click',OpenLayers.Function.bind(this.selectionChanged,this));return item;},clearTreeItem:function(layer){if(layer.legend.treeItem&&layer.legend.treeItem.owner){layer.legend.treeItem.domObj.store('data',null);layer.legend.treeItem.owner.remove(layer.legend.treeItem);layer.legend.treeItem.finalize();layer.legend.treeItem=null;}},stateChanged:function(obj,event){if(obj.legend&&obj.legend.treeItem.checkBox){if(obj.legend.treeItem.checkBox.checked){obj.show();}else{obj.hide();}}
OpenLayers.Event.stop(event,true);},renderFolder:function(){var domA=new Element('a',{'class':this.options['class'],href:'javascript:void(0)',events:{click:this.selected.bindWithEvent(this),dblclick:this.selected.bindWithEvent(this),contextmenu:this.options.contextMenu.show.bindWithEvent(this.options.contextMenu)}});this.checkBox=document.createElement('input');this.checkBox.type='checkbox';this.domImg=document.createElement('img');this.domImg.className='jxTreeIcon '+(this.options.imageClass?this.options.imageClass:'');this.domImg.src=Jx.aPixel.src;if(this.options.image){this.domImg.style.backgroundImage='url('+this.options.image+')';}
var domLabel=new Element('span',{'class':'fusionLegendLabel',html:this.options.label});domA.appendChild(this.checkBox);domA.appendChild(this.domImg);domA.appendChild(domLabel);this.itemLabelobj=domA;return domA;},renderItem:function(){var domA=new Element('a',{'class':'fusionLegendItem',href:'javascript:void(0)',events:{click:this.selected.bindWithEvent(this),dblclick:this.selected.bindWithEvent(this),contextmenu:this.options.contextMenu.show.bindWithEvent(this.options.contextMenu)}});this.domImg=document.createElement('img');this.domImg.className='jxTreeIcon '+(this.options.imageClass?this.options.imageClass:'');this.domImg.src=Jx.aPixel.src;if(this.options.image){this.domImg.style.backgroundImage='url('+this.options.image+')';}
var domLabel=new Element('span',{'class':'fusionLegendLabel',html:this.options.label});domA.appendChild(this.domImg);domA.appendChild(domLabel);this.itemLabelobj=domA;return domA;},renderItemCheckBox:function(){var domA=new Element('a',{'class':'fusionLegendItemCheckbox','href':'javascript:void(0);',events:{click:this.selected.bindWithEvent(this),dblclick:this.selected.bindWithEvent(this),contextmenu:this.options.contextMenu.show.bindWithEvent(this.options.contextMenu)}});this.checkBox=document.createElement('input');this.checkBox.type='checkbox';if(this.options.statusIsDefault){this.checkBox.checked=true;this.checkBox.disabled=true;this.checkBox.readOnly=true;}
this.domImg=document.createElement('img');this.domImg.className='jxTreeIcon '+(this.options.imageClass?this.options.imageClass:'');this.domImg.src=Jx.aPixel.src;if(this.options.image){this.domImg.style.backgroundImage='url('+this.options.image+')';}
var domLabel=new Element('span',{'class':'fusionLegendLabel',html:this.options.label});domA.appendChild(this.checkBox);domA.appendChild(this.domImg);domA.appendChild(domLabel);this.itemLabelobj=domA;return domA;}});Fusion.Widget.LinkToView=OpenLayers.Class(Fusion.Widget,{initializeWidget:function(widgetTag){var json=widgetTag.extension;this.baseUrl=window.location.protocol+'//'+window.location.host+window.location.pathname+'?';var join='';for(var param in Fusion.queryParams){if(typeof Fusion.queryParams[param]=='string'){if(param=='extent'||param=='filter'||param=='spatialfilter'||param=='variant'||param=='theme'||param=='selectlayer'||param=='showlayers'||param=='hidelayers'||param=='showgroups'||param=='hidegroups'){continue;}
this.baseUrl+=join+param+'='+Fusion.queryParams[param];join='&';}}
this.anchorLabel=json.Label?json.Label[0]:(this.domObj?this.domObj.innerHTML:'Link to View');Fusion.addWidgetStyleSheet(widgetTag.location+'LinkToView/LinkToView.css');this.anchor=document.createElement('a');this.anchor.className='anchorLinkToView';this.anchor.href=this.baseUrl;this.anchor.innerHTML=this.anchorLabel;this.anchor.title=json.Tooltip?json.Tooltip[0]:'Right-click to copy or bookmark link to current view';this.getMap().oMapOL.events.register("addlayer",this,this.setListener);this.enable();},setUiObject:function(uiObj){Fusion.Widget.prototype.setUiObject.apply(this,[uiObj]);if(this.uiObj.domObj){this.uiObj.domObj.appendChild(this.anchor);}else{this.uiObj.appendChild(this.anchor);}},setListener:function(evt){var layer=evt.layer;layer.events.register("loadend",this,this.updateLink);},updateLink:function(){var join=(this.baseUrl.indexOf('?')==this.baseUrl.length-1)?'':'&';var queryStr=this.getMap().getLinkParams();this.anchor.href=this.baseUrl+join+queryStr;}});Fusion.Widget.MapMenu=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Menu,domObj:null,mapGroupData:null,rootFolder:'',menus:null,initializeWidget:function(widgetTag){this.enable();},setUiObject:function(uiObj){Fusion.Widget.prototype.setUiObject.apply(this,[uiObj]);var json=this.widgetTag.extension;var mapGroups=Fusion.applicationDefinition.mapGroups;this.mapGroupData={};for(var key in mapGroups){if(mapGroups[key].mapId){var mapGroup=mapGroups[key];if(json.Folder){this.mapGroupData[mapGroup.maps[0].resourceId]=mapGroup;}else{var data=mapGroup;var menuItem=new Jx.Menu.Item({label:mapGroup.mapId,onClick:OpenLayers.Function.bind(this.switchMap,this,data)});this.uiObj.add(menuItem);}}}
this.arch=this.getMap().getAllMaps()[0].arch;if(this.arch=='MapGuide'&&json.Folder){this.rootFolder=json.Folder?json.Folder[0]:'Library://';var s='layers/'+this.arch+'/'+Fusion.getScriptLanguage()+'/MapMenu.'+Fusion.getScriptLanguage();var params={parameters:{'folder':this.rootFolder},onComplete:OpenLayers.Function.bind(this.processMapMenu,this)};Fusion.ajaxRequest(s,params);};},processMapMenu:function(r){if(r.status==200){var o;eval("o="+r.responseText);this.menus={};for(var i=0;i<o.maps.length;i++){var map=o.maps[i];var path=map.path.replace(this.rootFolder,'');if(path.lastIndexOf('/')>-1){path=path.slice(0,path.lastIndexOf('/'));this.createFolders(path);}else{path='';}
var data=null;if(this.mapGroupData[map.path]){data=this.mapGroupData[map.path];}else{data={maps:[{'resourceId':map.path,'singleTile':true,'type':this.arch,'extension':{'ResourceId':[map.path]}}]};data.getInitialView=function(){return this.initialView;};}
var menuItem=new Jx.Menu.Item({label:map.name,onClick:OpenLayers.Function.bind(this.switchMap,this,data)});if(path==''){this.uiObj.add(menuItem);}else{this.menus[path].add(menuItem);}}}},createFolders:function(id){var folders=id.split('/');var parent='';var pathSeparator='';for(var i=0;i<folders.length;i++){if(!this.menus[parent+pathSeparator+folders[i]]){var menu=new Jx.Menu.SubMenu({label:folders[i]});if(parent==''){this.uiObj.add(menu);}else{this.menus[parent].add(menu);}
this.menus[parent+pathSeparator+folders[i]]=menu;}
parent=parent+pathSeparator+folders[i];pathSeparator='/';}},switchMap:function(data){var ce=this.getMap().getCurrentExtents();data.initialView={minX:ce.left,minY:ce.bottom,maxX:ce.right,maxY:ce.top};this.getMap().loadMapGroup(data);}});Fusion.Widget.Maptip=OpenLayers.Class(Fusion.Widget,{oCurrentPosition:null,oMapTipPosition:null,nTimer:null,delay:null,aLayers:null,bOverTip:false,sWinFeatures:'menubar=no,location=no,resizable=no,status=no',offset:new OpenLayers.Pixel(2,20),szTip:'',szHref:'',szLabel:'',aTextFields:null,mapTipFired:false,bStartMapTips:false,initializeWidget:function(widgetTag){var json=widgetTag.widgetSet.getWidgetByName(this.name).extension;this.sTarget=json.Target?json.Target[0]:"MaptipWindow";if(json.WinFeatures){this.sWinFeatures=json.WinFeatures[0];}
this.delay=json.Delay?parseInt(json.Delay[0]):350;this.nTolerance=json.Tolerance?parseInt(json.Tolerance[0]):2;this.aCustomURL=[];this.aTextFields=[];this.aLayers=[];this.aLabels=[];if(json.Maptip){for(var i=0;i<json.Maptip.length;i++){this.aLayers.push(json.Maptip[i].Layer);this.aTextFields.push(json.Maptip[i].TextField);this.aLabels.push(json.Maptip[i].Label);this.aCustomURL.push(json.Maptip[i].CustomURL);}}
Fusion.addWidgetStyleSheet(widgetTag.location+'Maptip/Maptip.css');if(this.domObj){this.domObj.parentNode.removeChild(this.domObj);}else{this.domObj=document.createElement('div');}
this.domObj.className='maptipContainer';this.domObj.style.display='none';this.domObj.style.top='0px';this.domObj.style.left='0px';this.iframe=document.createElement('iframe');this.iframe.className='maptipShim';this.iframe.scrolling='no';this.iframe.frameborder=0;OpenLayers.Event.observe(this.domObj,'mouseover',OpenLayers.Function.bind(this.mouseOverTip,this));OpenLayers.Event.observe(this.domObj,'mouseout',OpenLayers.Function.bind(this.mouseOutTip,this));var oDomElem=this.getMap().getDomObj();document.getElementsByTagName('BODY')[0].appendChild(this.domObj);this.getMap().observeEvent('mousemove',OpenLayers.Function.bind(this.mouseMove,this));this.getMap().observeEvent('mousedown',OpenLayers.Function.bind(this.mouseDown,this));this.getMap().observeEvent('mouseup',OpenLayers.Function.bind(this.mouseUp,this));this.getMap().observeEvent('mouseout',OpenLayers.Function.bind(this.mouseOut,this));this.eventListener=false;this.getMap().registerForEvent(Fusion.Event.MAP_MAPTIP_REQ_FINISHED,OpenLayers.Function.bind(this._display,this));this.getMap().registerForEvent(Fusion.Event.MAP_BUSY_CHANGED,this.busyChanged.bind(this));this.getMap().registerForEvent(Fusion.Event.MAP_LOADED,this.startMapTips.bind(this));},mouseOut:function(e){if(this.nTimer){window.clearTimeout(this.nTimer);if(!this.nHideTimer){this.nHideTimer=window.setTimeout(OpenLayers.Function.bind(this.hideMaptip,this),250);}}},startMapTips:function(){this.bStartMapTips=true;},mouseMove:function(e){if(this.bStartMapTips==true){if(!this.eventListener){this.eventListener=true;}
if(this.bOverTip||this.mouseIsDown){return;}
var map=this.getMap();this.mapSize=map.getSize();this.mapOffset=map._oDomObj.offsets;var p=map.getEventPosition(e);this.oCurrentPosition=p;this.oMapTipPosition=p;if(typeof(this.nTimer)=="number"){window.clearTimeout(this.nTimer);this.nTimer=null;}
this.nTimer=window.setTimeout(OpenLayers.Function.bind(this.showMaptip,this),this.delay);}},mouseDown:function(){this.mouseIsDown=true;this._hide();},mouseUp:function(){this.mouseIsDown=false;},showMaptip:function(){this.getMap().getMapTip(this);this.mapTipFired=true;},_display:function(eventID,oMapTip){if(typeof(oMapTip)=="undefined"||oMapTip.t==''){return;}
if(this.domObj.style.visibility!='visible'||oMapTip.t!=this.szTip){this.domObj.innerHTML=null;var contentDiv=document.createElement('div');contentDiv.className='maptipContent';this.domObj.appendChild(contentDiv);var empty=true;this.bIsVisible=true;var tip=oMapTip.t;var hyperlink=oMapTip.h;var label=oMapTip.l;this.szTip=tip;this.szHref=hyperlink;this.label=label;if(typeof(tip)=="object"){for(var i=0;i<tip.length;i++){var t=tip[i];var h=hyperlink[i];var l=label[i];var oLinkDom=this.addMapTipDomObj(h,t);var mapTipContent=document.createElement('DIV');mapTipContent.className="mapTipContentDIV";if(l!=""){mapTipContent.innerHTML=l+" : ";contentDiv.appendChild(mapTipContent);mapTipContent.appendChild(oLinkDom);empty=false;}
else
{contentDiv.appendChild(mapTipContent);contentDiv.appendChild(oLinkDom);empty=false;}}}
else
{if(tip){var mapTipContent=document.createElement('DIV');mapTipContent.innerHTML=tip.replace(/\n/g,"<br>");contentDiv.appendChild(mapTipContent);empty=false;}
if(hyperlink){var mapTipContent=document.createElement('DIV');hyperlink=hyperlink.replace(/\n/g,"<br>");if(hyperlink.indexOf("href=")>0){mapTipContent.innerHTML=hyperlink}else{var anchor=document.createElement('A');anchor.href=hyperlink;anchor.target="_blank";anchor.innerHTML=hyperlink;mapTipContent.appendChild(anchor);}
contentDiv.appendChild(mapTipContent);empty=false;}}
if(!empty){var size=$(this.domObj).getBorderBoxSize();this.oMapTipPosition=this.oMapTipPosition.add(this.mapOffset[0],this.mapOffset[1]);if(this.oCurrentPosition.x<this.mapSize.w/2){this.domObj.style.left=(this.oMapTipPosition.x+this.offset.x)+'px';}else{this.domObj.style.left=(this.oMapTipPosition.x-(size.width+this.offset.x))+'px';}
if(this.oCurrentPosition.y<this.mapSize.h/2){this.domObj.style.top=(this.oMapTipPosition.y+this.offset.y)+'px';}else{this.domObj.style.top=(this.oMapTipPosition.y-(size.height+this.offset.y))+'px';}
this.domObj.style.visibility='hidden';this.domObj.style.display='block';if(!window.opera){contentDiv.appendChild(this.iframe);var size=$(this.domObj).getContentBoxSize();this.iframe.style.width=size.width+"px";this.iframe.style.height=size.height+"px";}
this.domObj.style.visibility='visible';}else{this.hideMaptip();}}
this.mapTipFired=false;},addMapTipDomObj:function(url,szText){if(url=="undefined"||url==typeof("undefined")||url==""){var linkSpan=document.createElement('SPAN');linkSpan.className="mapTipData";linkSpan.innerHTML=szText;return linkSpan;}
else
{var a,linkURL;var linkSpan=document.createElement('SPAN');linkSpan.className="mapTipData"
if(url.indexOf('href=')>0){linkSpan.innerHTML=url;a=linkDiv.firstChild;linkURL=a.href;}else{a=document.createElement('a');a.className="mapTipLink";a.innerHTML=szText;linkURL=url;linkSpan.appendChild(a);}
a.href='javascript:void(0)';var openLink=OpenLayers.Function.bind(this.openLink,this,linkURL);a.onclick=OpenLayers.Function.bindAsEventListener(openLink,this);return linkSpan;}},hideMaptip:function(){this.bIsVisible=false;this.hideTimer=window.setTimeout(OpenLayers.Function.bind(this._hide,this),10);},_hide:function(){this.hideTimer=null;this.domObj.style.display='none';this.domObj.style.visibility='';},mouseOverTip:function(){window.clearTimeout(this.nHideTimer);this.nHideTimer=null;this.bOverTip=true;},mouseOutTip:function(){this.nHideTimer=window.setTimeout(OpenLayers.Function.bind(this.hideMaptip,this),250);this.bOverTip=false;},busyChanged:function(){if(this.getMap().isBusy()){this.bIsVisible=false;this.hideMaptip();}},openLink:function(url,evt){var taskPaneTarget=Fusion.getWidgetById(this.sTarget);if(taskPaneTarget){taskPaneTarget.setContent(url);}else{var pageElement=$(this.sTarget);if(pageElement){pageElement.src=url;}else{window.open(url,this.sTarget,this.sWinFeatures);}}
OpenLayers.Event.stop(evt,true);return false;}});Fusion.Constant.MEASURE_TYPE_DISTANCE=1;Fusion.Constant.MEASURE_TYPE_AREA=2;Fusion.Event.MEASURE_SEGMENT_UPDATE=Fusion.Event.lastEventId++;Fusion.Event.MEASURE_CLEAR=Fusion.Event.lastEventId++;Fusion.Event.MEASURE_COMPLETE=Fusion.Event.lastEventId++;Fusion.Widget.Measure=OpenLayers.Class(Fusion.Widget,{isExclusive:true,uiClass:Jx.Button,distances:null,distanceMarkers:null,areaMarker:null,units:Fusion.UNKNOWN,measureType:null,distPrecision:4,areaPrecision:4,distanceNormalStyle:null,fillStyle:null,areaStyle:null,initializeWidget:function(widgetTag){this.asCursor=['crosshair'];var json=widgetTag.extension;this.units=(json.Units&&(json.Units[0]!=''))?Fusion.unitFromName(json.Units[0]):this.units;this.distPrecision=json.DistancePrecision?parseInt(json.DistancePrecision[0]):4;this.areaPrecision=json.AreaPrecision?parseInt(json.AreaPrecision[0]):4;this.sTarget=json.Target?json.Target[0]:"";this.sBaseUrl=Fusion.getFusionURL()+'widgets/Measure/Measure.php';this.measureType=0;if(json.Type){switch(json.Type[0].toLowerCase()){case'distance':this.measureType|=Fusion.Constant.MEASURE_TYPE_DISTANCE;break;case'area':this.measureType|=Fusion.Constant.MEASURE_TYPE_AREA;break;case'both':this.measureType|=Fusion.Constant.MEASURE_TYPE_DISTANCE;this.measureType|=Fusion.Constant.MEASURE_TYPE_AREA;break;default:break;}}
var fillStyle=json.FillStyle?json.FillStyle[0]:'rgba(0,0,255, 0.3)';var lineStyleWidth=json.LineStyleWidth?json.LineStyleWidth[0]:2;var lineStyleColor=json.LineStyleColor?json.LineStyleColor[0]:'rgba(0,0,255,0.3)';this.distanceMarkers=[];this.distances=[];this.registerEventID(Fusion.Event.MEASURE_SEGMENT_UPDATE);this.registerEventID(Fusion.Event.MEASURE_CLEAR);this.registerEventID(Fusion.Event.MEASURE_COMPLETE);var mapWidget=this.getMap();this.keyHandler=OpenLayers.Function.bind(this.onKeyPress,this);Fusion.addWidgetStyleSheet(widgetTag.location+'Measure/Measure.css');mapWidget.registerForEvent(Fusion.Event.MAP_LOADED,OpenLayers.Function.bind(this.setUnits,this,this.units));this.registerParameter('Units');this.sketchSymbolizers={"Point":{pointRadius:4,graphicName:"square",fillColor:"white",fillOpacity:1,strokeWidth:1,strokeOpacity:1,strokeColor:"#333333"},"Line":{strokeWidth:3,strokeOpacity:1,strokeColor:"#666666"},"Polygon":{strokeWidth:2,strokeOpacity:1,strokeColor:"#666666",fillColor:"white",fillOpacity:0.3}};var style=new OpenLayers.Style();style.addRules([new OpenLayers.Rule({symbolizer:this.sketchSymbolizers})]);var styleMap=new OpenLayers.StyleMap({"default":style});this.map=mapWidget.oMapOL;var handlerOptions={style:"default",layerOptions:{styleMap:styleMap}};var handler=OpenLayers.Handler.Path;if(this.measureType&Fusion.Constant.MEASURE_TYPE_AREA){handler=OpenLayers.Handler.Polygon;}
var controlOptions={persist:true,handlerOptions:handlerOptions,callbacks:{'modify':OpenLayers.Function.bind(this.measurePartial,this),'cancel':OpenLayers.Function.bind(this.resetMeasure,this)}};this.control=new OpenLayers.Control.Measure(handler,controlOptions);this.getMap().oMapOL.addControl(this.control);this.control.events.on({measure:this.measure,scope:this});},shouldActivateWith:function(widget){return(widget instanceof Fusion.Widget.Measure&&widget.measureType==this.measureType);},measure:function(stats){this.hasMeasure=true;var geom=stats.geometry;if(this.measureType&Fusion.Constant.MEASURE_TYPE_DISTANCE){var v=geom.getVertices();while(this.distanceMarkers.length>v.length-1){this.distanceMarkers.pop().destroy();}
var vFirst=v0=v[0];for(var i=1;i<v.length;i++){v1=v[i];if(this.distanceMarkers[i-1]){var m=this.distanceMarkers[i-1];m.label=i+': ';}else{m=new Fusion.Widget.Measure.Marker(this.units,this.distPrecision,i+': ');}
var seg=new OpenLayers.Geometry.LineString();seg.addPoint(v0.clone());seg.addPoint(v1.clone());this.updateMarker(m,seg);v0=v1;}
if(this.measureType&Fusion.Constant.MEASURE_TYPE_AREA){seg=new OpenLayers.Geometry.LineString();seg.addPoint(vFirst);seg.addPoint(v0);this.lastMarker.label=i+': ';this.updateMarker(this.lastMarker,seg);}}
if(this.measureType&Fusion.Constant.MEASURE_TYPE_AREA){this.updateArea(geom);}
this.triggerEvent(Fusion.Event.MEASURE_COMPLETE);},measurePartial:function(point,sketch){if(this.hasMeasure){this.resetMeasure();this.hasMeasure=false;}
var geom=sketch.geometry;if(this.measureType&Fusion.Constant.MEASURE_TYPE_DISTANCE){this.updateDistances(geom);}
if(this.measureType&Fusion.Constant.MEASURE_TYPE_AREA){this.updateArea(geom);}
this.triggerEvent(Fusion.Event.MEASURE_SEGMENT_UPDATE);},updateDistances:function(geom){var v=geom.getVertices();var last=v.length-1;if(last>0){var lastSeg=new OpenLayers.Geometry.LineString();lastSeg.addPoint(v[last-1].clone());lastSeg.addPoint(v[last].clone());var marker;if(this.distanceMarkers.length<last){marker=new Fusion.Widget.Measure.Marker(this.units,this.distPrecision,last+': ');this.distanceMarkers.push(marker);}else{marker=this.distanceMarkers[last-1];}
this.updateMarker(marker,lastSeg);if(last>1&&geom.CLASS_NAME.indexOf('LineString')==-1){lastSeg=new OpenLayers.Geometry.LineString();lastSeg.addPoint(v[0].clone());lastSeg.addPoint(v[last].clone());if(!this.lastMarker){this.lastMarker=new Fusion.Widget.Measure.Marker(this.units,this.distPrecision,'');}
this.lastMarker.label=v.length+': ';this.updateMarker(this.lastMarker,lastSeg);}}},updateArea:function(geom){if(!this.areaMarker){this.areaMarker=new Fusion.Widget.Measure.Marker(this.units,this.distPrecision,'',true);}
this.updateMarker(this.areaMarker,geom);},delayUpdate:function(marker,geom){this.delayUpdateTimer=null;this.updateMarker(marker,geom);},updateMarker:function(marker,geom){if(!marker){return;}
var quantity,from,to;var v=geom.getVertices();var map=this.getMap();var proj=map.oMapOL.baseLayer.projection;if(geom.CLASS_NAME.indexOf('LineString')!=-1){from=this.getMap().geoToPix(v[0].x,v[0].y);to=this.getMap().geoToPix(v[1].x,v[1].y);at={x:(from.x+to.x)/2,y:(from.y+to.y)/2};quantity=geom.getGeodesicLength(proj);measureUnits=Fusion.METERS;if(measureUnits!=this.units){quantity=Fusion.convert(measureUnits,this.units,quantity);}}else{var cg=geom.getCentroid();at=this.getMap().geoToPix(cg.x,cg.y);quantity=geom.getGeodesicArea(proj);}
if(quantity>1){marker.setQuantity(quantity);this.positionMarker(marker,at);}},positionMarker:function(marker,at){var oDomElem=this.getMap().getDomObj();if(!marker.domObj.parentNode||marker.domObj.parentNode!=oDomElem){oDomElem.appendChild(marker.domObj);}
var size=marker.getSize();var t=at.y-size.height/2;var l=at.x-size.width/2;if(!isNaN(t)&&!isNaN(l)){marker.domObj.style.top=t+'px';marker.domObj.style.left=l+'px';marker.domObj.style.display='block';}else{marker.domObj.style.display='none';}},onKeyPress:function(e){var charCode=(e.charCode)?e.charCode:((e.keyCode)?e.keyCode:e.which);if(charCode==OpenLayers.Event.KEY_ESC){this.control.cancel();}},initVars:function(){this.cumulativeDistance=0;this.lastDistance=0;this.cumulativeArea=0;this.lastArea=0;this.aAreaFirstPoint=null;},activate:function(){this.control.activate();this.resetMeasure();OpenLayers.Event.observe(document,"keypress",this.keyHandler);this.loadDisplayPanel();},loadDisplayPanel:function(){if(this.sTarget){var url=this.sBaseUrl;var queryStr='locale='+Fusion.locale;if(url.indexOf('?')<0){url+='?';}else if(url.slice(-1)!='&'){url+='&';}
url+=queryStr+'&type='+this.measureType;var taskPaneTarget=Fusion.getWidgetById(this.sTarget);var outputWin=window;if(taskPaneTarget){taskPaneTarget.setContent(url);outputWin=taskPaneTarget.iframe.contentWindow;}else{outputWin=window.open(url,this.sTarget,this.sWinFeatures);}
this.registerForEvent(Fusion.Event.MEASURE_CLEAR,OpenLayers.Function.bind(this.clearDisplay,this,outputWin));this.registerForEvent(Fusion.Event.MEASURE_SEGMENT_UPDATE,OpenLayers.Function.bind(this.updateDisplay,this,outputWin));this.registerForEvent(Fusion.Event.MEASURE_COMPLETE,OpenLayers.Function.bind(this.updateDisplay,this,outputWin));}else{this.totalDistanceMarker=new Fusion.Widget.Measure.Marker(this.units,this.distPrecision,'Total:');var oDomElem=this.getMap().getDomObj();if(!this.totalDistanceMarker.domObj.parentNode||this.totalDistanceMarker.domObj.parentNode!=oDomElem){oDomElem.appendChild(this.totalDistanceMarker.domObj);}
this.totalDistanceMarker.domObj.addClass='divMeasureTotal';this.totalDistanceMarker.domObj.style.display='none';this.registerForEvent(Fusion.Event.MEASURE_CLEAR,OpenLayers.Function.bind(this.clearTotalDistance,this));this.registerForEvent(Fusion.Event.MEASURE_SEGMENT_UPDATE,OpenLayers.Function.bind(this.updateTotalDistance,this));this.registerForEvent(Fusion.Event.MEASURE_COMPLETE,OpenLayers.Function.bind(this.updateTotalDistance,this));}},deactivate:function(){OpenLayers.Event.stopObserving(document,'keypress',this.keyHandler);this.control.deactivate();this.control.cancel();},resetMeasure:function(){this.initVars();for(var i=0;i<this.distanceMarkers.length;i++){this.distanceMarkers[i].destroy();}
this.distanceMarkers=[];if(this.areaMarker){this.areaMarker.destroy();this.areaMarker=null;}
if(this.lastMarker){this.lastMarker.destroy();this.lastMarker=null;}
this.triggerEvent(Fusion.Event.MEASURE_CLEAR,this);},remoteMeasureSegment:function(marker,from,to,geom){var mapWidget=this.getMap();var aMaps=mapWidget.getAllMaps();var s='layers/'+aMaps[0].arch+'/'+Fusion.getScriptLanguage()+"/Measure."+Fusion.getScriptLanguage();var fromGeo=mapWidget.pixToGeo(from.x,from.y);var toGeo=mapWidget.pixToGeo(to.x,to.y);var options={parameters:{'session':aMaps[0].getSessionID(),'locale':Fusion.locale,'mapname':mapWidget.getMapName(),'x1':fromGeo.x,'y1':fromGeo.y,'x2':toGeo.x,'y2':toGeo.y},'onComplete':OpenLayers.Function.bind(this.remoteMeasureCompleted,this,from,to,marker)};Fusion.ajaxRequest(s,options);},remoteMeasureCompleted:function(from,to,marker,r){if(r.status==200){var o;eval('o='+r.responseText);if(o.distance){mapUnits=Fusion.METERS;if(mapUnits!=this.units){o.distance=Fusion.convert(mapUnits,this.units,o.distance);}
marker.setQuantity(o.distance);this.positionMarker(marker,from,to);this.triggerEvent(Fusion.Event.MEASURE_SEGMENT_UPDATE);}}},updateDisplay:function(outputWin){var outputDoc=outputWin.document;this.clearDisplay(outputWin);var units=Fusion.unitAbbr(this.units);var value;var distPrecision=this.distPrecision;var createEntry=function(idx,distance){if(distance<1){return;}
var tr=outputDoc.createElement('tr');var td=outputDoc.createElement('td');td.innerHTML=OpenLayers.i18n('segment',{'seg':idx});tr.appendChild(td);td=outputDoc.createElement('td');if(distPrecision==0){value=Math.floor(distance);}
else{value=distance.toPrecision(distPrecision);}
td.innerHTML=value+' '+units;tr.appendChild(td);tbody.appendChild(tr);}
if(this.measureType&Fusion.Constant.MEASURE_TYPE_DISTANCE){var tbody=outputDoc.getElementById('segmentTBody');var totalDistance=0;if(tbody){for(var i=0;i<this.distanceMarkers.length;i++){var distance=this.distanceMarkers[i].getQuantity();totalDistance+=distance;createEntry(i+1,distance);}
if(this.lastMarker){totalDistance+=this.lastMarker.getQuantity();createEntry(i+1,this.lastMarker.getQuantity());}
var tDist=outputDoc.getElementById('totalDistance');if(this.distPrecision==0){value=Math.floor(totalDistance);}
else{value=totalDistance.toPrecision(this.distPrecision);}
tDist.innerHTML=value+' '+units;}}
if(this.measureType&Fusion.Constant.MEASURE_TYPE_AREA){var tArea=outputDoc.getElementById('totalArea');value=this.areaMarker.getQuantity();if(this.areaPrecision==0){value=Math.floor(value);}else{value=value.toPrecision(this.areaPrecision);}
tArea.innerHTML=value+' '+units+'<sup>2</sup>';}},updateTotalDistance:function(){if(this.distanceMarkers.length>1){var totalDistance=0;var units=Fusion.unitAbbr(this.units);for(var i=0;i<this.distanceMarkers.length;i++){var distance=this.distanceMarkers[i].getQuantity();totalDistance+=distance;}
this.totalDistanceMarker.domObj.style.display='block';this.totalDistanceMarker.setQuantity(totalDistance);}},clearDisplay:function(outputWin){var outputDoc=outputWin.document;var tbody=outputDoc.getElementById('segmentTBody');if(tbody){while(tbody.firstChild){tbody.firstChild.marker=null;tbody.removeChild(tbody.firstChild);}
var tDist=outputDoc.getElementById('totalDistance');tDist.innerHTML='';}},clearTotalDistance:function(){this.totalDistanceMarker.domObj.style.display='none';},setUnits:function(units){units=(units==Fusion.UNKNOWN)?Fusion.unitFromName(this.getMap().getUnits()):units;this.setParameter('Units',Fusion.unitName(units));},setParameter:function(param,value){if(param=='Units'){this.units=Fusion.unitFromName(value);for(var i=0;i<this.distanceMarkers.length;i++){this.distanceMarkers[i].setUnits(this.units);}
if(this.totalDistanceMarker){this.totalDistanceMarker.setUnits(this.units);}}}});Fusion.Widget.Measure.Marker=OpenLayers.Class({calculatingImg:null,quantity:0,isArea:false,initialize:function(units,precision,label,isArea){this.precision=precision;this.label=label?label:'';this.isArea=isArea||false;this.domObj=document.createElement('div');this.domObj.className='divMeasureMarker';this.calculatingImg=document.createElement('img');this.calculatingImg.src=Fusion.getFusionURL()+'widgets/Measure/MeasurePending.gif';this.calculatingImg.width=19;this.calculatingImg.height=4;this.setUnits(units);this.setCalculating();},destroy:function(){if(this.domObj.parentNode){this.domObj.parentNode.removeChild(this.domObj);this.domObj.style.display='none';}},setUnits:function(units){this.unit=units;this.unitAbbr=Fusion.unitAbbr(units);},getQuantity:function(){return this.quantity;},getQuantityLabel:function(){var value;if(this.precision==0){value=Math.floor(this.quantity);}
else{value=this.quantity.toPrecision(this.precision);}
var sq='';if(this.isArea){sq='<sup>2<sup>';}
return this.label+' '+value+' '+this.unitAbbr+sq;},setQuantity:function(quantity){if(this.calculatingImg.parentNode){this.calculatingImg.parentNode.removeChild(this.calculatingImg);}
this.quantity=quantity;this.domObj.innerHTML=this.getQuantityLabel();},setCalculating:function(){if(!this.calculatingImg.parentNode){this.domObj.innerHTML='';this.domObj.appendChild(this.calculatingImg);}},getSize:function(){var size=$(this.domObj).getBorderBoxSize();var imgSize={width:19,height:4};if(size.width<imgSize.width){size.width+=imgSize.width;}
if(size.height<imgSize.height){size.height+=imgSize.height;}
return size;}});Fusion.Widget.Navigator=OpenLayers.Class(Fusion.Widget,{bInternalChange:false,zoomInFactor:4,zoomOutFactor:2,panAmount:50,initializeWidget:function(widgetTag){this.activeControls=[];var m=document.createElement('map');m.name='Navigator_ImageMap';m.id='Navigator_ImageMap';var a=document.createElement('area');a.shape='poly';a.alt=OpenLayers.i18n('panEast');a.title=OpenLayers.i18n('panEast');a.coords='27,176, 27,177, 40,190, 44,182, 44,159';var panEast=OpenLayers.Function.bind(this.pan,this,this.panAmount/100,0);OpenLayers.Event.observe(a,'mousedown',OpenLayers.Function.bindAsEventListener(panEast,this));m.appendChild(a);var a=document.createElement('area');a.shape='poly';a.alt=OpenLayers.i18n('panWest');a.title=OpenLayers.i18n('panWest');a.coords='24,177, 24,176, 7,159, 7,182, 11,190';var panWest=OpenLayers.Function.bind(this.pan,this,-this.panAmount/100,0);OpenLayers.Event.observe(a,'mousedown',OpenLayers.Function.bindAsEventListener(panWest,this));m.appendChild(a);var a=document.createElement('area');a.shape='poly';a.alt=OpenLayers.i18n('panSouth');a.title=OpenLayers.i18n('panSouth');a.coords='25,178, 12,191, 21,197, 30,197, 39,191, 26,178';var panSouth=OpenLayers.Function.bind(this.pan,this,0,-this.panAmount/100);OpenLayers.Event.observe(a,'mousedown',OpenLayers.Function.bindAsEventListener(panSouth,this));m.appendChild(a);var a=document.createElement('area');a.shape='poly';a.alt=OpenLayers.i18n('panNorth');a.title=OpenLayers.i18n('panNorth');a.coords='26,175, 43,158, 8,158, 25,175';var panNorth=OpenLayers.Function.bind(this.pan,this,0,this.panAmount/100);OpenLayers.Event.observe(a,'mousedown',OpenLayers.Function.bindAsEventListener(panNorth,this));m.appendChild(a);var a=document.createElement('area');a.shape='circle';a.alt=OpenLayers.i18n('zoomOut');a.title=OpenLayers.i18n('zoomOut');a.coords='25,142,8';var zoomOut=OpenLayers.Function.bind(this.zoom,this,1/this.zoomOutFactor);OpenLayers.Event.observe(a,'mousedown',OpenLayers.Function.bindAsEventListener(zoomOut,this));m.appendChild(a);var a=document.createElement('area');a.shape='circle';a.alt=OpenLayers.i18n('zoomIn');a.title=OpenLayers.i18n('zoomIn');a.coords='25,34,8';var zoomIn=OpenLayers.Function.bind(this.zoom,this,this.zoomInFactor);OpenLayers.Event.observe(a,'mousedown',OpenLayers.Function.bindAsEventListener(zoomIn,this));m.appendChild(a);this.domObj.appendChild(m);var sliderBg=document.createElement('img');sliderBg.src=Fusion.getFusionURL()+widgetTag.location+'Navigator/sliderscale.png';sliderBg.className='png24';sliderBg.width=51;sliderBg.height=201;sliderBg.style.position='absolute';sliderBg.style.left='0px';sliderBg.style.top='0px';sliderBg.useMap='#Navigator_ImageMap';this.domObj.appendChild(sliderBg);var handleDiv=document.createElement('div');handleDiv.style.position='absolute';handleDiv.style.top='6px';handleDiv.style.left='6px';handleDiv.style.width='39px';handleDiv.style.height='16px';this.domObj.appendChild(handleDiv);var sliderDiv=document.createElement('div');sliderDiv.style.position='absolute';sliderDiv.style.top='44px';sliderDiv.style.left='0px';sliderDiv.style.width='51px';sliderDiv.style.height='85px';this.domObj.appendChild(sliderDiv);var sliderHandle=document.createElement('img');sliderHandle.src=Fusion.getFusionURL()+widgetTag.location+'Navigator/slider.png';sliderHandle.className='png24';sliderHandle.width=29;sliderHandle.height=12;sliderHandle.style.position='absolute';sliderHandle.style.left='11px';sliderHandle.style.top='49px';sliderDiv.appendChild(sliderHandle);this.activityIndicator=document.createElement('img');this.activityIndicator.src=Fusion.getFusionURL()+widgetTag.location+'Navigator/spinner.gif';this.activityIndicator.width=18;this.activityIndicator.height=6;this.activityIndicator.style.position='absolute';this.activityIndicator.style.top='3px';this.activityIndicator.style.right='4px';handleDiv.appendChild(this.activityIndicator);this.domObj.style.position='absolute';this.domObj.style.zIndex=1000;this.domObj.style.width='51px';this.domObj.style.height='204px';this.domObj.style.cursor='pointer';this.domObj.addEvents({mouseenter:OpenLayers.Function.bind(this.mouseEnter,this),mouseleave:OpenLayers.Function.bind(this.mouseLeave,this)});var checkPosition=OpenLayers.Function.bind(this.checkPosition,this);new Drag(this.domObj,{handle:handleDiv,onComplete:checkPosition,preventDefault:true});this.slider=new Slider(sliderDiv,sliderHandle,{mode:'vertical',steps:81,snap:true,onComplete:OpenLayers.Function.bind(this.scaleChanged,this)});this.LN9=Math.log(9);this.getMap().registerForEvent(Fusion.Event.MAP_LOADED,OpenLayers.Function.bind(this.updateSlider,this));this.getMap().registerForEvent(Fusion.Event.MAP_RESIZED,checkPosition);this.getMap().registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED,OpenLayers.Function.bind(this.updateSlider,this));this.getMap().registerForEvent(Fusion.Event.MAP_BUSY_CHANGED,OpenLayers.Function.bind(this.busyChanged,this));},scaleChanged:function(value){var map=this.getMap();var activeWidget=null;if(map.oActiveWidget){activeWidget=map.oActiveWidget;map.deactivateWidget(map.oActiveWidget);}
if(!this.bInternalChange){var olMap=this.getMap().oMapOL;var baseLayer=olMap.baseLayer;if(baseLayer.singleTile){var scale=Math.pow(9,value/9);var resolution=OpenLayers.Util.getResolutionFromScale(scale,baseLayer.units);resolution+=baseLayer.minResolution;this.bInternalChange=true;olMap.zoomTo(olMap.getZoomForResolution(resolution));this.bInternalChange=false;}else{var zoom=olMap.baseLayer.resolutions.length-value;this.bInternalChange=true;olMap.zoomTo(zoom);this.bInternalChange=false;}}
if(activeWidget){map.activateWidget(activeWidget);}
return false;},checkPosition:function(){var nav=this.domObj;var pDim=$(nav.parentNode).getContentBoxSize();var nLeft,nTop;nLeft=parseInt(nav.style.left);nTop=parseInt(nav.style.top);if(nLeft+nav.getWidth()>pDim.width){nLeft=pDim.width-nav.getWidth();nav.style.left=nLeft+'px';}
if(nTop+nav.getHeight()>pDim.height){nTop=pDim.height-nav.getHeight();nav.style.top=nTop+'px';}
if(nLeft<0){nav.style.left='0px';}
if(nTop<0){nav.style.top='0px';}},updateSlider:function(){var map=this.getMap().oMapOL;baseLayer=map.baseLayer
if(baseLayer.singleTile){this.slider.steps=81;var resolution=map.getResolution()-baseLayer.minResolution;var scale=OpenLayers.Util.getScaleFromResolution(resolution,baseLayer.units);var position=9*Math.log(scale)/this.LN9;this.bInternalChange=true;this.slider.set(position);this.bInternalChange=false;}else{this.slider.steps=map.baseLayer.resolutions.length;var position=map.baseLayer.resolutions.length-map.getZoom();this.bInternalChange=true;this.slider.set(position);this.bInternalChange=false;}},pan:function(x,y,e){var map=this.getMap();var center=map.getCurrentCenter();var res=map.oMapOL.getResolution();var size=map.oMapOL.getSize();map.zoom(center.x+(x*size.w*res),center.y+(y*size.h*res),1);OpenLayers.Event.stop(e);return false;},zoom:function(factor,e){var map=this.getMap();var center=map.getCurrentCenter();map.zoom(center.x,center.y,factor);OpenLayers.Event.stop(e);return false;},mouseEnter:function(){var mapWidget=this.getMap();var mapOL=mapWidget.oMapOL;for(var i=0;i<mapOL.controls.length;++i){var control=mapOL.controls[i];if(control.active){control.deactivate();this.activeControls.push(control);}}
for(var i=0;i<mapWidget.handlers.length;++i){var handler=mapWidget.handlers[i];if(handler.active){handler.deactivate();this.activeControls.push(handler);}}},mouseLeave:function(){var mapOL=this.getMap().oMapOL;while(this.activeControls.length>0){var control=this.activeControls.pop();control.activate();}},busyChanged:function(){this.activityIndicator.style.visibility=this.getMap().isBusy()?'visible':'hidden';}});Fusion.Widget.OverviewMap=OpenLayers.Class(Fusion.Widget,{oSize:null,nMinRatio:32,nMaxRatio:64,bDisplayed:false,initializeWidget:function(widgetTag){var json=widgetTag.extension;if(json.MinRatio){this.nMinRatio=json.MinRatio[0];}
if(json.MaxRatio){this.nMaxRatio=json.MaxRatio[0];}
var mapTag=null;if(json.MapId){this.sMapGroupId=json.MapId;var mapGroup=Fusion.applicationDefinition.getMapGroup(this.sMapGroupId);mapTag=mapGroup.maps[0];}else{var mainMap=this.getMap();mapTag=mainMap.mapGroup.maps[0];}
if(Fusion.Layers[mapTag.type]){this.mapObject=new Fusion.Layers[mapTag.type](this.getMap(),mapTag,false);}else{this.mapObject=new Fusion.Layers.Generic(this,mapTag,false);}
this.mapObject.registerForEvent(Fusion.Event.LAYER_LOADED,OpenLayers.Function.bind(this.loadOverview,this));if(this.domObj){this.domObj.style.overflow='hidden';var jxl=this.domObj.retrieve('jxLayout');if(!jxl){jxl=new Jx.Layout(this.domObj);}
jxl.addEvent('sizeChange',OpenLayers.Function.bind(this.sizeChanged,this));}
this.oMapOptions={};},mapWidgetLoaded:function()
{var mapWidget=this.getMap();if(this.sMapGroupId&&(mapWidget.projection==this.mapObject.projection)){this.loadOverview([this.mapObject.oLayerOL]);}else{var extent=this.oMap._oCurrentExtents;this.loadOverview([this.getMap().oMapOL.baseLayer.clone()]);}},keymapLoaded:function()
{this.mapObject.oLayerOL.isBaseLayer=true;},loadOverview:function()
{if(this.control){this.control.destroy();}
var size=$(this.domObj).getContentBoxSize();this.oSize=new OpenLayers.Size(size.width,size.height);this.mapObject.oLayerOL.isBaseLayer=true;if(this.mapObject.oLayerOL.singleTile){this.oMapOptions.numZoomLevels=3;}
this.mapObject.oLayerOL.ratio=1.0;var mapOpts={div:this.domObj,size:this.oSize,minRatio:this.nMinRatio,maxRatio:this.nMaxRatio,mapOptions:this.oMapOptions,layers:[this.mapObject.oLayerOL]};this.control=new OpenLayers.Control.OverviewMap(mapOpts);if(size.width==0||size.height==0){return;}else{this.getMap().oMapOL.addControl(this.control);this.bDisplayed=true;}},sizeChanged:function(){var size=$(this.domObj).getContentBoxSize();this.oSize=new OpenLayers.Size(size.width,size.height);if(size.width==0||size.height==0){return;}
if(!this.bDisplayed&&this.control){this.getMap().oMapOL.addControl(this.control);this.bDisplayed=true;}
if(this.control){this.control.size=new OpenLayers.Size(size.width,size.height);this.control.mapDiv.style.width=this.oSize.w+'px';this.control.mapDiv.style.height=this.oSize.h+'px';this.control.ovmap.updateSize();this.control.update();}}});Fusion.Widget.Pan=OpenLayers.Class(Fusion.Widget,{isExclusive:true,uiClass:Jx.Button,initializeWidget:function(widgetTag){this.control=new OpenLayers.Control.DragPan();this.getMap().oMapOL.addControl(this.control);this.control.handler.keyMask=0;this.cursorNormal=["url('images/grab.cur'),move",'grab','-moz-grab','move'];this.cursorDrag=["url('images/grabbing.cur'),move",'grabbing','-moz-grabbing','move'];},activate:function(){this.control.activate();this.getMap().setCursor(this.cursorNormal);},deactivate:function(){this.control.deactivate();this.getMap().setCursor('auto');}});Fusion.Widget.PanOnClick=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,fPercent:null,nDeltaX:null,nDeltaY:null,initializeWidget:function(widgetTag){var json=widgetTag.extension;var percent=json.Percentage?json.Percentage[0]:75;this.fPercent=parseFloat(percent)/100;var direction=json.Direction?json.Direction[0]:'';switch(direction){case'north':this.nDeltaX=0;this.nDeltaY=1;break;case'south':this.nDeltaX=0;this.nDeltaY=-1;break;case'east':this.nDeltaX=1;this.nDeltaY=0;break;case'west':this.nDeltaX=-1;this.nDeltaY=0;break;default:this.nDeltaX=0;this.nDeltaY=0;}},activate:function(){var extents=this.getMap().getCurrentExtents();var center=this.getMap().getCurrentCenter();var fX,fY;fX=center.x+this.nDeltaX*(extents[2]-extents[0])*this.fPercent;fY=center.y+this.nDeltaY*(extents[3]-extents[1])*this.fPercent;this.getMap().zoom(fX,fY,1);}});Fusion.Widget.PanQuery=OpenLayers.Class(Fusion.Widget,{isExclusive:true,uiClass:Jx.Button,selectionType:'INTERSECTS',nTolerance:3,bActiveOnly:false,initializeWidget:function(widgetTag){this.control=new OpenLayers.Control.DragPan();this.getMap().oMapOL.addControl(this.control);this.control.handler.up=OpenLayers.Function.bind(this.mouseUp,this);var json=widgetTag.extension;this.nTolerance=json.Tolerance?Math.abs(parseInt(json.Tolerance)):3;this.bComputeMetadata=(json.ComputeMetadata&&(json.ComputeMetadata[0]=='true'||json.ComputeMetadata[0]=='1'))?true:false;var activeOnly=json.QueryActiveLayer?json.QueryActiveLayer[0]:'false';this.bActiveOnly=(activeOnly=='true'||activeOnly=='1')?true:false;this.cursorNormal=['auto'];this.cursorDrag=["url('images/grabbing.cur'),move",'grabbing','-moz-grabbing','move'];},mouseUp:function(e){var handler=this.control.handler;var p={x:Event.pointerX(e),y:Event.pointerY(e)};var dx=handler.start.x-handler.last.x;var dy=handler.start.y-handler.last.y;if(Math.abs(dx)<this.nTolerance&&Math.abs(dy)<this.nTolerance){var pos=this.getMap().pixToGeo(handler.last.x,handler.last.y);var options={};var dfGeoTolerance=this.getMap().pixToGeoMeasure(this.nTolerance);var minx=pos.x-dfGeoTolerance;var miny=pos.y-dfGeoTolerance;var maxx=pos.x+dfGeoTolerance;var maxy=pos.y+dfGeoTolerance;options.geometry='POLYGON(('+minx+' '+miny+', '+maxx+' '+miny+', '+maxx+' '+maxy+', '+minx+' '+maxy+', '+minx+' '+miny+'))';options.selectionType="INTERSECTS";options.computed=this.bComputeMetadata;if(this.bActiveOnly){var layer=this.getMap().getActiveLayer();if(layer){options.layers=layer.layerName;}else{return;}}
if(e.shiftKey){options.extendSelection=true;}
this.getMap().query(options);}
Event.stop(e);},activate:function(){this.control.activate();this.getMap().setCursor(this.cursorNormal);},deactivate:function(){this.control.deactivate();this.getMap().setCursor('auto');},setParameter:function(param,value){if(param=="Tolerance"&&value>0){this.nTolerance=value;}
if(param=='SelectionType'){this.selectionType=value;}}});Fusion.Widget.Print=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,initializeWidget:function(widgetTag){var json=widgetTag.extension;var showPrintUI=json.ShowPrintUI?json.ShowPrintUI[0]:'false';this.showPrintUI=(showPrintUI.toLowerCase()=='true'||showPrintUI=='1');var showTitle=json.ShowTitle?json.ShowTitle[0]:'false';this.showTitle=(showTitle.toLowerCase()=='true'||showTitle=='1');this.pageTitle=json.PageTitle?json.PageTitle[0]:'';this.resultsLayer=json.ResultsLayer?json.ResultsLayer[0]:null;var showLegend=json.ShowLegend?json.ShowLegend[0]:'false';this.showLegend=(showLegend.toLowerCase()=='true'||showLegend=='1');var showNorthArrow=json.ShowNorthArrow?json.ShowNorthArrow[0]:'false';this.showNorthArrow=(showNorthArrow.toLowerCase()=='true'||showNorthArrow=='1');this.imageBaseUrl=json.ImageBaseUrl?json.ImageBaseUrl[0]:null;this.dialogContentURL=Fusion.getFusionURL()+widgetTag.location+'Print/Print.html';this.printablePageURL=Fusion.getFusionURL()+widgetTag.location+'Print/printablepage.php';Fusion.addWidgetStyleSheet(widgetTag.location+'Print/Print.css');},activate:function(){if(this.showPrintUI){this.openPrintUI();}else{this.openPrintable();}},openPrintUI:function(){if(!this.dialog){var toolbar=new Jx.Toolbar({position:'bottom'});var o={label:OpenLayers.i18n('printTitle'),id:'printablePage',contentURL:this.dialogContentURL,onContentLoaded:OpenLayers.Function.bind(this.contentLoaded,this),width:350,height:250,resize:true,toolbars:[toolbar]};var d=new Jx.Dialog(o);toolbar.add(new Jx.Button({label:OpenLayers.i18n('printGenerate'),onClick:OpenLayers.Function.bind(this.generate,this)}),new Jx.Button({label:OpenLayers.i18n('printCancel'),onClick:function(){d.close();}}));this.dialog=d;}
this.dialog.show();},setParameter:function(param,value){switch(param){case'Print_ShowTitle':this.showTitle=value;break;case'Print_Title':this.pageTitle=value;break;case'Print_ShowLegend':this.showLegend=value;break;case'Print_ShowNorthArrow':this.showNorthArrow=value;break;}},contentLoaded:function(dialog){dialog.content.getElementById('dialogPrintShowtitle').checked=this.showTitle;dialog.content.getElementById('dialogPrintTitle').value=this.pageTitle;dialog.content.getElementById('dialogPrintTitle').disabled=!this.showTitle;dialog.content.getElementById('dialogPrintShowlegend').checked=this.showLegend;dialog.content.getElementById('dialogPrintShowNorthArrow').checked=this.showNorthArrow;OpenLayers.Event.observe(dialog.content.getElementById('dialogPrintShowtitle'),'click',OpenLayers.Function.bind(this.controlTitle,this));},controlTitle:function(){this.dialog.content.getElementById('dialogPrintTitle').disabled=!this.dialog.content.getElementById('dialogPrintShowtitle').checked;},generate:function(){this.showTitle=this.dialog.content.getElementById('dialogPrintShowtitle').checked;this.pageTitle=this.dialog.content.getElementById('dialogPrintTitle').value;this.showLegend=this.dialog.content.getElementById('dialogPrintShowlegend').checked;this.showNorthArrow=this.dialog.content.getElementById('dialogPrintShowNorthArrow').checked;this.openPrintable();},openPrintable:function(){var mainMap=this.getMap();var url=this.printablePageURL+'?';var extents=mainMap.getCurrentExtents();var centerX=(extents.left+extents.right)/2;var centerY=(extents.top+extents.bottom)/2;var dpi=mainMap._nDpi;var scale=mainMap.getScale();var maps=mainMap.getAllMaps();url=url+'MAPNAME='+mainMap.getMapName();url=url+'&SESSION='+maps[0].getSessionID();url=url+'&CENTERX='+centerX;url=url+'&CENTERY='+centerY;url=url+'&DPI='+dpi;url=url+'&SCALE='+scale;url=url+'&ISTITLE='+(this.showTitle!=''?'1':'0');url=url+'&ISLEGEND='+(this.showLegend?'1':'0');url=url+'&ISARROW='+(this.showNorthArrow?'1':'0');if(this.pageTitle!=''){url=url+'&TITLE='+this.pageTitle;}
window.open(url,'printablepage','');}});Fusion.Widget.Query=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,sFeatures:'menubar=no,location=no,resizable=no,status=no',initializeWidget:function(widgetTag){var json=widgetTag.extension;this.sTarget=json.Target?json.Target[0]:"QueryWindow";this.sBaseUrl=Fusion.getFusionURL()+'widgets/Query/querymain.php';},activate:function(){var url=this.sBaseUrl;var map=this.getMap();var mapLayers=map.getAllMaps();var taskPaneTarget=Fusion.getWidgetById(this.sTarget);var pageElement=$(this.sTarget);var params=[];params.push('LOCALE='+Fusion.locale);params.push('SESSION='+mapLayers[0].getSessionID());params.push('MAPNAME='+mapLayers[0].getMapName());if(taskPaneTarget||pageElement){params.push('POPUP=false');}else{params.push('POPUP=true');}
if(url.indexOf('?')<0){url+='?';}else if(url.slice(-1)!='&'){url+='&';}
url+=params.join('&');if(taskPaneTarget){taskPaneTarget.setContent(url);}else{if(pageElement){pageElement.src=url;}else{window.open(url,this.sTarget,this.sWinFeatures);}}}});Fusion.Event.REDLINE_FEATURE_ADDED=Fusion.Event.lastEventId++;Fusion.Widget.Redline=OpenLayers.Class(Fusion.Widget,{isExclusive:true,uiClass:Jx.Button,mapWidget:null,taskPane:null,vectorLayers:null,drawControls:null,defaultFeatureStyle:new OpenLayers.Style({pointRadius:4,graphicName:"square",fillColor:"#55ff4e",fillOpacity:0.4,strokeWidth:2,strokeOpacity:1,strokeColor:"#666666"}),styleMap:null,activeControl:null,activeLayer:null,saveForm:null,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.mapWidget=Fusion.getWidgetById('Map');this.registerEventID(Fusion.Event.REDLINE_FEATURE_ADDED);this.sTarget=json.Target?json.Target[0]:"";if(this.sTarget)
this.taskPane=new Fusion.Widget.Redline.DefaultTaskPane(this,widgetTag.location);var defaultFeatureStyle;var jsonFeatureStyle=json.FeatureStyle?json.FeatureStyle[0]:null;if(jsonFeatureStyle&&(typeof(jsonFeatureStyle)=="object"))
{defaultFeatureStyle=new OpenLayers.Style();for(var styleProperty in jsonFeatureStyle){eval("defaultFeatureStyle.defaultStyle."+styleProperty+" = \""+jsonFeatureStyle[styleProperty][0]+"\";");}}else{defaultFeatureStyle=this.defaultFeatureStyle}
this.styleMap=new OpenLayers.StyleMap(defaultFeatureStyle);this.vectorLayers=this.mapWidget.oMapOL.getLayersByName('Digitizing Layer 0');if(!this.vectorLayers.length){this.vectorLayers[0]=new OpenLayers.Layer.Vector("Digitizing Layer 0",{styleMap:this.styleMap});this.vectorLayers[0].redLineLayer=true;this.mapWidget.oMapOL.addLayers([this.vectorLayers[0]]);}
this.createDrawControls();this.defaultControl='point';if(json.DefaultControl){var control=json.DefaultControl[0].toLowerCase();if(this.drawControls[control])
this.defaultControl=control;}
this.createSaveForm();},createDrawControls:function(){this.drawControls={point:new OpenLayers.Control.DrawFeature(this.vectorLayers[0],OpenLayers.Handler.Point,{handlerOptions:{layerOptions:{styleMap:this.styleMap}}}),line:new OpenLayers.Control.DrawFeature(this.vectorLayers[0],OpenLayers.Handler.Path,{handlerOptions:{freehandToggle:null,freehand:false,style:"default",layerOptions:{styleMap:this.styleMap}}}),rectangle:new OpenLayers.Control.DrawFeature(this.vectorLayers[0],OpenLayers.Handler.RegularPolygon,{handlerOptions:{sides:4,irregular:true,style:"default",layerOptions:{styleMap:this.styleMap}}}),polygon:new OpenLayers.Control.DrawFeature(this.vectorLayers[0],OpenLayers.Handler.Polygon,{handlerOptions:{freehand:false,style:"default",layerOptions:{styleMap:this.styleMap}}})};for(var key in this.drawControls){this.drawControls[key].events.register('featureadded',this,this.featureAdded);this.mapWidget.oMapOL.addControl(this.drawControls[key]);}},createSaveForm:function(panelDocument){var sl=Fusion.getScriptLanguage();var scriptURL=Fusion.getFusionURL()+'layers/Generic/'+sl+'/save.'+sl;var div=document.createElement("div");var type=document.createElement("input");var content=document.createElement("input");var name=document.createElement("input");var submit=document.createElement("input");div.style.display="none";this.saveForm=document.createElement("form");submit.type="submit";submit.name="submit_element";submit.value="submit";this.saveForm.method="POST";this.saveForm.action=scriptURL;type.type="text";type.name="type";type.value='text/xml';content.type="text";content.name="content";name.type="text";name.name="name";this.saveForm.appendChild(type);this.saveForm.appendChild(content);this.saveForm.appendChild(name);this.saveForm.appendChild(submit);div.appendChild(this.saveForm);document.body.appendChild(div);},activate:function(){if(this.taskPane){this.taskPane.loadDisplayPanel();}
this.activateLayer(0);this.activateControl(this.defaultControl,0);},deactivate:function(){this.activeControl.deactivate();this.activeControl=null;},featureAdded:function(evt){this.triggerEvent(Fusion.Event.REDLINE_FEATURE_ADDED,evt.feature);},activateLayer:function(layerIndex){this.activeLayer=this.vectorLayers[layerIndex];for(var key in this.drawControls){this.drawControls[key].layer=this.vectorLayers[layerIndex];}},activateControl:function(type){if(this.activeControl)
this.activeControl.deactivate();var control=this.drawControls[type];this.activeControl=control;control.activate();},exportToGML:function(){var gmlParser=new OpenLayers.Format.GML();var fileContent=gmlParser.write(this.activeLayer.features);this.saveForm.elements[0].value="text/xml";this.saveForm.elements[1].value=escape(fileContent);this.saveForm.elements[2].value=this.activeLayer.name+'.gml';this.saveForm.submit();},newLayer:function(layerName){var i=this.vectorLayers.length;this.vectorLayers[i]=new OpenLayers.Layer.Vector(layerName,{styleMap:this.styleMap});this.vectorLayers[i].redLineLayer=true;this.mapWidget.oMapOL.addLayer(this.vectorLayers[i]);},newLayerFromFile:function(fileName){var i=this.vectorLayers.length;this.vectorLayers[i]=new OpenLayers.Layer.Vector("Digitizing layer "+this.vectorLayers.length,{strategies:[new OpenLayers.Strategy.Fixed()],protocol:new OpenLayers.Protocol.HTTP({url:Fusion.getFusionURL()+"widgets/Redline/Redline.php?"+"file="+fileName,format:new OpenLayers.Format.GML()}),styleMap:this.styleMap});this.vectorLayers[i].redLineLayer=true;this.mapWidget.oMapOL.addLayer(this.vectorLayers[i]);},removeLayer:function(layerIndex){this.vectorLayers[layerIndex].destroyFeatures();this.vectorLayers[layerIndex].destroy();this.vectorLayers.splice(layerIndex,1);if(this.vectorLayers.length==0){this.vectorLayers[0]=new OpenLayers.Layer.Vector("Digitizing Layer 0",{styleMap:this.styleMap});this.mapWidget.oMapOL.addLayers([this.vectorLayers[0]]);this.vectorLayers[0].redLineLayer=true;}
this.activateLayer(0);}});Fusion.Widget.Redline.DefaultTaskPane=OpenLayers.Class({widget:null,taskPaneWin:null,panelUrl:'widgets/Redline/Redline.php',panelCss:'Redline/Redline.css',initialize:function(widget,widgetLocation){this.widget=widget;this.widget.registerForEvent(Fusion.Event.REDLINE_FEATURE_ADDED,OpenLayers.Function.bind(this.featureAdded,this));Fusion.addWidgetStyleSheet(widgetLocation+this.panelCss);},loadDisplayPanel:function(){var url=Fusion.getFusionURL()+this.panelUrl;var taskPaneTarget=Fusion.getWidgetById(this.widget.sTarget);var outputWin=window;if(taskPaneTarget){taskPaneTarget.setContent(url);outputWin=taskPaneTarget.iframe.contentWindow;}else{outputWin=window.open(url,this.widget.sTarget,this.widget.sWinFeatures);}
this.taskPaneWin=outputWin;var initFunction=OpenLayers.Function.bind(this.initPanel,this);setTimeout(initFunction,300);},initPanel:function(){if(!this.taskPaneWin.document.getElementById("panelIsLoaded")){var initFunction=OpenLayers.Function.bind(this.initPanel,this);setTimeout(initFunction,300);return;}
var radioName=this.widget.defaultControl.charAt(0).toUpperCase()+this.widget.defaultControl.substr(1);this.taskPaneWin.document.getElementById("RedlineWidget"+radioName+"Radio").checked=true;if(this.taskPaneWin.document.getElementById("uploadedFileName")){this.widget.activateControl(this.widget.defaultControl,0);this.widget.newLayerFromFile(this.taskPaneWin.document.getElementById("uploadedFileName").getAttribute("value"));}
this.bindEvents();this.updateLayerList();this.updateFeatureList();},bindEvents:function(){var doc=this.taskPaneWin.document;doc.getElementById("RedlineWidgetLayerList").onchange=OpenLayers.Function.bind(this.selectLayer,this);doc.getElementById("RedlineWidgetNewLayerButton").onclick=OpenLayers.Function.bind(this.newLayer,this);doc.getElementById("RedlineWidgetRenameLayerButton").onclick=OpenLayers.Function.bind(this.renameLayer,this);doc.getElementById("RedlineWidgetRemoveLayerButton").onclick=OpenLayers.Function.bind(this.removeLayer,this);doc.getElementById("RedlineWidgetSaveButton").onclick=OpenLayers.Function.bind(this.saveLayer,this);doc.getElementById("RedlineWidgetUploadButton").onclick=OpenLayers.Function.bind(this.uploadFile,this);doc.getElementById("RedlineWidgetPointRadio").onclick=OpenLayers.Function.bind(this.widget.activateControl,this.widget,'point');doc.getElementById("RedlineWidgetLineRadio").onclick=OpenLayers.Function.bind(this.widget.activateControl,this.widget,'line');doc.getElementById("RedlineWidgetRectangleRadio").onclick=OpenLayers.Function.bind(this.widget.activateControl,this.widget,'rectangle');doc.getElementById("RedlineWidgetPolygonRadio").onclick=OpenLayers.Function.bind(this.widget.activateControl,this.widget,'polygon');doc.getElementById("RedlineWidgetRemoveFeatureButton").onclick=OpenLayers.Function.bind(this.removeFeature,this);doc.getElementById("RedlineWidgetRenameFeatureButton").onclick=OpenLayers.Function.bind(this.renameFeature,this);},newLayer:function(){var name=prompt("Layer name:","Digitizing layer "+this.widget.vectorLayers.length);if(name!=null&&name!=""){this.widget.newLayer(name);this.updateLayerList();}},removeLayer:function(){var i=this.taskPaneWin.document.getElementById("RedlineWidgetLayerList").selectedIndex;this.widget.removeLayer(i);this.updateLayerList();this.updateFeatureList();},renameLayer:function(){var name=prompt("Layer name:","");if(name!=null&&name!=""){var i=this.taskPaneWin.document.getElementById("RedlineWidgetLayerList").selectedIndex;this.widget.vectorLayers[i].name=name;this.updateLayerList();}},selectLayer:function(){var i=this.taskPaneWin.document.getElementById("RedlineWidgetLayerList").selectedIndex;this.widget.activateLayer(i);this.updateFeatureList();},saveLayer:function(){this.widget.exportToGML();},uploadFile:function(){var initFunction=OpenLayers.Function.bind(this.initPanel,this);setTimeout(initFunction,300);},updateLayerList:function(){var select=this.taskPaneWin.document.getElementById('RedlineWidgetLayerList');var selectedIndex=select.selectedIndex;select.length=0;var olMap=this.widget.mapWidget.oMapOL;var numLayers=olMap.getNumLayers();this.widget.vectorLayers=[];for(var i=0;i<numLayers;i++){if(olMap.layers[i].redLineLayer){this.widget.vectorLayers.push(olMap.layers[i]);}};for(var i=0;i<this.widget.vectorLayers.length;i++)
{var opt=document.createElement('option');opt.text=this.widget.vectorLayers[i].name;if(i==selectedIndex)
opt.selected=true;try
{select.add(opt,null);}
catch(ex)
{select.add(opt);}}},featureAdded:function(eventID,feature){var select=this.taskPaneWin.document.getElementById('RedlineWidgetFeatureList');var opt=document.createElement('option');opt.text=feature.id;try
{select.add(opt,null);}
catch(ex)
{select.add(opt);}},removeFeature:function(){var select=this.taskPaneWin.document.getElementById('RedlineWidgetFeatureList');var i=select.selectedIndex;if(i!=-1){this.widget.activeLayer.destroyFeatures([this.widget.activeLayer.features[i]]);select.remove(i);}},renameFeature:function(){var select=this.taskPaneWin.document.getElementById('RedlineWidgetFeatureList');var i=select.selectedIndex;if(i!=-1){var name=prompt("Feature name:","");if(name!=null&&name!=""){this.widget.activeLayer.features[i].id=name;select.options[i].text=name;}}},updateFeatureList:function(){var select=this.taskPaneWin.document.getElementById('RedlineWidgetFeatureList');var selectedIndex=select.selectedIndex;select.length=0;for(var i=0;i<this.widget.activeLayer.features.length;i++)
{var opt=document.createElement('option');opt.text=this.widget.activeLayer.features[i].id;try
{select.add(opt,null);}
catch(ex)
{select.add(opt);}}},clearFeatureList:function(){var select=this.taskPaneWin.document.getElementById('RedlineWidgetFeatureList');for(var i=(select.options.length-1);i>=0;i--){select.options[i]=null;}
select.selectedIndex=-1;}});Fusion.Widget.RefreshMap=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,activate:function(){this.getMap().redraw();}});Fusion.Widget.SaveMap=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,iframe:null,printLayout:null,printScale:null,imageWidth:null,imageHeight:null,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.format=(json.Format&&json.Format[0]!='')?json.Format[0]:'png';if(this.format=='DWF'&&json.PrintLayout.length){var layouts=json.PrintLayout;for(var i=0;i<layouts.length;i++){var layout=layouts[i];var opt={label:layout.Name[0]};var data={rid:layout.ResourceId[0]};if(layout.PageHeight){data.pageHeight=layout.PageHeight[0];};if(layout.PageWidth){data.pageWidth=layout.PageWidth[0];};if(layout.Margins){data.margins=[layout.Margins[0].Top[0],layout.Margins[0].Left[0],layout.Margins[0].Right[0],layout.Margins[0].Bottom[0]];};var menuItem=null;if(layout.Scale){menuItem=new Jx.Menu.SubMenu(opt);data.scales=[];for(var j=0;j<layout.Scale.length;j++){data.scales.push(layout.Scale[j]);menuItem.add(new Jx.Menu.Item({label:layout.Scale[j],onClick:OpenLayers.Function.bind(this.setLayout,this,data,j)}));}
menuItem.add(new Jx.Menu.Item({label:'Current Scale',onClick:OpenLayers.Function.bind(this.setLayout,this,data)}));}else{opt.onClick=OpenLayers.Function.bind(this.setLayout,this,data);menuItem=new Jx.Menu.Item(opt);};this.oMenu.add(menuItem);}}else if(this.format.toLowerCase()=='dwf'){var layout=json;if(layout.ResourceId){this.printLayout=layout.ResourceId[0];};if(layout.PageHeight){this.pageHeight=layout.PageHeight[0];};if(layout.PageWidth){this.pageWidth=layout.PageWidth[0];};if(layout.Margins){this.margins=[layout.Margins[0].Top[0],layout.Margins[0].Left[0],layout.Margins[0].Right[0],layout.Margins[0].Bottom[0]];};if(layout.Scale&&layout.Scale!='0'){this.printScale=layout.Scale[0];};}else{if(json.Width&&json.Width[0]!=''){this.imageWidth=json.Width[0];}
if(json.Height&&json.Height[0]!=''){this.imageHeight=json.Height[0];}}
this.enable=Fusion.Widget.SaveMap.prototype.enable;},enable:function(){Fusion.Widget.prototype.enable.apply(this,[]);},setLayout:function(data){this.printLayout=data.rid;this.pageHeight=data.pageHeight;this.pageWidth=data.pageWidth;this.pageMargins=data.margins;if(arguments.length==3){this.printScale=parseFloat(data.scales[arguments[1]]);}else{this.printScale=null;}
this.activateTool();},activate:function(){if(!this.iframe){this.iframe=document.createElement('iframe');this.iframe.id='w';this.iframe.style.visibility='hidden';document.body.appendChild(this.iframe);}
var szLayout='';var szScale='';var szPageHeight='';var szPageWidth='';var szPageMargins='';if(this.format.toLowerCase()=='dwf'){if(this.printLayout){szLayout='&layout='+this.printLayout;}
if(this.printScale){szScale='&scale='+this.printScale;}
if(this.pageHeight){szPageHeight='&pageheight='+this.pageHeight;}
if(this.pageWidth){szPageWidth='&pagewidth='+this.pageWidth;}
if(this.pageMargins){szPageMargins='&margins='+this.pageMargins.join(',');}}
var szHeight='';if(this.imageHeight){szHeight='&height='+this.imageHeight;}
var szWidth='';if(this.imageWidth){szWidth='&width='+this.imageWidth;}
var m=this.getMap().aMaps[0];if(navigator.appVersion.match(/\bMSIE\b/)){var url=Fusion.fusionURL+'layers/'+m.arch+'/'+Fusion.getScriptLanguage()+"/SaveMapFrame."+Fusion.getScriptLanguage()+'?session='+m.getSessionID()+'&mapname='+m.getMapName()+'&format='+this.format.toUpperCase()+szLayout+szScale+szWidth+szHeight+szPageHeight+szPageWidth+szPageMargins;w=open(url,"Save",'menubar=no,height=200,width=300');}else{var s=Fusion.fusionURL+'layers/'+m.arch+'/'+Fusion.getScriptLanguage()+"/SaveMap."+Fusion.getScriptLanguage()+'?session='+m.getSessionID()+'&mapname='+m.getMapName()+'&format='+this.format.toUpperCase()+szLayout+szScale+szWidth+szHeight+szPageHeight+szPageWidth+szPageMargins;this.iframe.src=s;}}});if(typeof(ScaleBarTool)=='undefined'){Fusion.require('widgets/scalebar/scalebartool.js');}
Fusion.Widget.Scalebar=OpenLayers.Class(Fusion.Widget,{style:'thin',displaySystem:'metric',minWidth:100,maxWidth:200,divisions:2,subdivisions:2,showMinorMeasures:true,abbreviateLabel:true,singleLine:false,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.style=json.Style?json.Style[0].toLowerCase():this.style;if(this.style!='fancy'&&this.style!='fat'&&this.style!='thin'&&this.style!='thinner'){this.style='thin';}
this.displaySystem=json.DisplaySystem?json.DisplaySystem[0]:this.displaySystem;this.minWidth=json.MinWidth?json.MinWidth[0]:this.minWidth;this.maxWidth=json.MaxWidth?json.MaxWidth[0]:this.maxWidth;this.divisions=json.Divisions?json.Divisions[0]:this.divisions;this.subdivisions=json.SubDivisions?json.SubDivisions[0]:this.subdivisions;this.showMinorMeasures=(json.ShowMinorMeasures&&json.ShowMinorMeasures[0])=='false'?false:true;this.abbreviateLabel=(json.AbbreviateLabel&&json.AbbreviateLabel[0])=='true'?true:false;this.singleLine=(json.SingleLine&&json.SingleLine[0])=='true'?true:false;if(document.styleSheets){if(document.styleSheets[0]){var url=Fusion.getFusionURL()+'widgets/scalebar/scalebar-'+this.style+'.css';if(document.styleSheets[0].addImport){document.styleSheets[0].addImport(url);}else{document.styleSheets[0].insertRule('@import url('+url+');',0);}}}
this.oScaleBar=new ScaleBarTool(1);this.oScaleBar.displaySystem=this.displaySystem;this.oScaleBar.minWidth=this.minWidth;this.oScaleBar.maxWidth=this.maxWidth;this.oScaleBar.divisions=this.divisions;this.oScaleBar.subdivisions=this.subdivisions;this.oScaleBar.showMinorMeasures=this.showMinorMeasures;this.oScaleBar.abbreviateLabel=this.abbreviateLabel;this.oScaleBar.singleLine=this.singleLine;window.setTimeout(OpenLayers.Function.bind(this.oScaleBar,widgetTag.name),1);this.getMap().registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED,OpenLayers.Function.bind(this.extentsChangedCB,this));this.getMap().registerForEvent(Fusion.Event.MAP_LOADED,OpenLayers.Function.bind(this.extentsChangedCB,this));},extentsChangedCB:function(){this.oScaleBar.update(this.getMap().getScale());}});Fusion.Widget.ScalebarDual=OpenLayers.Class(Fusion.Widget,{initializeWidget:function(widgetTag){var json=widgetTag.extension;var maxWidth=json.MaxWidth?parseInt(json.MaxWidth[0]):300;var topInUnits=json.TopInUnits?json.TopInUnits[0]:'ft';var topOutUnits=json.TopOutUnits?json.TopOutUnits[0]:'mi';var bottomInUnits=json.BottomInUnits?json.BottomInUnits[0]:'m';var bottomOutUnits=json.BottomOutUnits?json.BottomOutUnits[0]:'km';var options={maxWidth:maxWidth,topInUnits:topInUnits,topOutUnits:topOutUnits,bottomInUnits:bottomInUnits,bottomOutUnits:bottomOutUnits};this.addControl(new OpenLayers.Control.ScaleLine(options));}});Fusion.Widget.Search=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,sFeatures:'menubar=no,location=no,status=no,scrollbars=yes',initializeWidget:function(widgetTag){var json=widgetTag.extension;this.sTarget=json.Target?json.Target[0]:"SearchWindow";this.sBaseUrl=Fusion.getFusionURL()+'widgets/Search/SearchPrompt.php';this.prompt=json.Prompt?json.Prompt[0]:"";this.layer=json.Layer?json.Layer[0]:"";this.filter=json.Filter?json.Filter[0]:"";this.limit=json.MatchLimit?json.MatchLimit[0]:100;this.resultColumns=json.ResultColumns?json.ResultColumns[0].Column:[];this.title=json.Title?json.Title[0]:widgetTag.label;},activate:function(){var url=this.sBaseUrl;var map=this.getMap();var mapLayers=map.getAllMaps();var taskPaneTarget=Fusion.getWidgetById(this.sTarget);var pageElement=$(this.sTarget);var params=[];params.push('locale='+Fusion.locale);params.push('session='+mapLayers[0].getSessionID());params.push('mapname='+mapLayers[0].getMapName());if(taskPaneTarget||pageElement){params.push('popup=false');}else{params.push('popup=true');}
params.push('title='+this.title);params.push('prompt='+this.prompt);params.push('target='+this.sTarget);params.push('filter='+this.filter);params.push('layer='+this.layer);params.push('limit='+this.limit);var names=[];var props=[];for(var i=0;i<this.resultColumns.length;++i){names.push(this.resultColumns[i].Name);props.push(this.resultColumns[i].Property);}
params.push('properties='+props.join(","));params.push('propNames='+names.join(","));if(url.indexOf('?')<0){url+='?';}else if(url.slice(-1)!='&'){url+='&';}
url+=params.join('&');if(taskPaneTarget){taskPaneTarget.setContent(url);}else{if(pageElement){pageElement.src=url;}else{window.open(url,this.sTarget,this.sFeatures);}}}});Fusion.Widget.Select=OpenLayers.Class(Fusion.Widget,{isExclusive:true,uiClass:Jx.Button,selectionType:'INTERSECTS',nTolerance:3,bActiveOnly:false,maxFeatures:0,pointClickSingleSelect:true,initializeWidget:function(widgetTag){this.asCursor=['auto'];this.layerMngr=new Fusion.Tool.sneLayerManager();this.enable=Fusion.Widget.Select.prototype.enable;var json=widgetTag.extension;this.selectionType=json.SelectionType?json.SelectionType[0]:'INTERSECTS';if(json.Tolerance&&(parseInt(json.Tolerance[0])>0)){this.nTolerance=parseInt(json.Tolerance[0]);}
if(json.MaxFeatures){this.maxFeatures=parseInt(json.MaxFeatures[0]);}
if(json.PointClickSingleSelect){this.pointClickSingleSelect=(json.PointClickSingleSelect[0]!='false');}
this.bActiveOnly=(json.QueryActiveLayer&&(json.QueryActiveLayer[0]=='true'||json.QueryActiveLayer[0]=='1'))?true:false;this.bComputeMetadata=(json.ComputeMetadata&&(json.ComputeMetadata[0]=='true'||json.ComputeMetadata[0]=='1'))?true:false;if(this.bActiveOnly){this.getMap().registerForEvent(Fusion.Event.MAP_ACTIVE_LAYER_CHANGED,OpenLayers.Function.bind(this.enable,this));}
var mapWidget=this.getMap();this.map=mapWidget.oMapOL;this.handler=new OpenLayers.Handler.Box(this,{done:this.execute});mapWidget.handlers.push(this.handler);this.isActive=false;OpenLayers.Event.observe(document,'keydown',this.keyDown.bind(this));},keyDown:function(event)
{if(this.isActive)
{if(event.keyCode===OpenLayers.Event.KEY_ESC)
{this.getMap().clearSelection();}}},shouldActivateWith:function(widget){return(widget instanceof Fusion.Widget.Select&&widget.bActiveOnly==this.bActiveOnly);},enable:function(){if(this.bActiveOnly){var layer=this.getMap().getActiveLayer();if(layer&&layer.selectable){Fusion.Widget.prototype.enable.apply(this,[]);}else{this.disable();}}else{Fusion.Widget.prototype.enable.apply(this,[]);}},activate:function(){this.handler.activate();this.getMap().setCursor(this.asCursor);this.isActive=true;},deactivate:function(){this.isActive=false;this.handler.deactivate();this.getMap().setCursor('auto');},execute:function(position,extend){if(this.keyModifiers&OpenLayers.Handler.MOD_CTRL){}
var nRight,nTop;var nLeft=position.left;var nBottom=position.bottom;var maxFeaturesToSelect=this.maxFeatures;if(position instanceof OpenLayers.Bounds){nRight=position.right;nTop=position.top;}else{nRight=nLeft=position.x;nTop=nBottom=position.y;if(this.pointClickSingleSelect){maxFeaturesToSelect=1;}}
var sMin=this.getMap().pixToGeo(nLeft,nBottom);var sMax=this.getMap().pixToGeo(nRight,nTop);var nXDelta=Math.abs(nLeft-nRight);var nYDelta=Math.abs(nBottom-nTop);var options={};if(nXDelta<=this.nTolerance&&nYDelta<=this.nTolerance){var dfGeoTolerance=this.getMap().pixToGeoMeasure(this.nTolerance);sMin.x=sMin.x-dfGeoTolerance;sMin.y=sMin.y-dfGeoTolerance;sMax.x=sMax.x+dfGeoTolerance;sMax.y=sMax.y+dfGeoTolerance;}
options.geometry='POLYGON(('+sMin.x+' '+sMin.y+', '+sMax.x+' '+sMin.y+', '+sMax.x+' '+sMax.y+', '+sMin.x+' '+sMax.y+', '+sMin.x+' '+sMin.y+'))';options.selectionType=this.selectionType;options.maxFeatures=maxFeaturesToSelect;options.computed=this.bComputeMetadata;options.layers=this.layerMngr.getActiveLayers();if(this.bActiveOnly){var layer=this.getMap().getActiveLayer();if(layer){options.layers=layer.layerName;}else{return;}}
if(this.handler.dragHandler.evt.shiftKey){options.extendSelection=true;}
this.getMap().query(options);},extend:function(position){this.execute(position,true);},setModifiers:function(evt){this.keyModifiers=(evt.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(evt.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(evt.altKey?OpenLayers.Handler.MOD_ALT:0);},clearModifiers:function(evt){this.keyModifiers=0;},setParameter:function(param,value){if(param=="Tolerance"&&value>0){this.nTolerance=value;}
if(param=='SelectionType'){this.selectionType=value;}},processGroups:function(group,layerName){var atBottom=true;if(group==null){group=map.layerRoot;}
for(var i=0;i<group.groups.length;i++){this.processGroups(group.groups[i],layerName);atBottom=false;}
for(var i=0;i<group.layers.length;i++){if(group.layers[i].visible==true){if(atBottom){}}}}});Fusion.Widget.SelectPolygon=OpenLayers.Class(Fusion.Widget,{isExclusive:true,uiClass:Jx.Button,selectionType:'INTERSECTS',nTolerance:3,initializeWidget:function(widgetTag){this.asCursor=['auto'];var json=widgetTag.extension;this.selectionType=json.SelectionType?json.SelectionType[0]:'INTERSECTS';if(json.Tolerance&&(parseInt(json.Tolerance[0])>0)){nTolerance=parseInt(json.Tolerance[0]);}
this.bComputeMetadata=(json.ComputeMetadata&&(json.ComputeMetadata[0]=='true'||json.ComputeMetadata[0]=='1'))?true:false;var mapWidget=this.getMap();this.map=mapWidget.oMapOL;this.handlerOptions={};this.handler=new OpenLayers.Handler.Polygon(this,{done:this.execute},this.handlerOptions);mapWidget.handlers.push(this.handler);},activate:function(){this.handler.activate();this.getMap().setCursor(this.asCursor);OpenLayers.Event.observe(document,"keypress",this.keyPressed.bind(this));},deactivate:function()
{this.handler.deactivate();this.getMap().setCursor('auto');OpenLayers.Event.stopObserving(document,'keypress',this.keyPressed.bind(this));},keyPressed:function(e)
{var charCode=(e.charCode)?e.charCode:((e.keyCode)?e.keyCode:e.which);if(charCode===OpenLayers.Event.KEY_ESC)
{this.handler.deactivate();this.handler.activate();}},execute:function(geom){var options={};options.geometry=geom.toString();options.selectionType=this.selectionType;options.computed=this.bComputeMetadata;if(this.handler.evt.ctrlKey){options.extendSelection=true;}
if(this.bActiveOnly){var layer=this.getMap().getActiveLayer();if(layer){options.layers=layer.layerName;}else{return;}}
this.getMap().query(options);},setParameter:function(param,value){if(param=="Tolerance"&&value>0){this.nTolerance=value;}
if(param=='SelectionType'){this.selectionType=value;}}});Fusion.Event.RADIUS_WIDGET_ACTIVATED=Fusion.Event.lastEventId++;Fusion.Widget.SelectRadius=OpenLayers.Class(Fusion.Widget,{isExclusive:true,uiClass:Jx.Button,selectionType:'INTERSECTS',nTolerance:3,defaultRadius:20,initializeWidget:function(widgetTag){this.asCursor=['auto'];var json=widgetTag.extension;this.selectionType=json.SelectionType?json.SelectionType[0]:'INTERSECTS';if(json.Tolerance&&(parseInt(json.Tolerance[0])>0)){nTolerance=parseInt(json.Tolerance[0]);}
this.defaultRadius=json.DefaultRadius?parseInt(json.DefaultRadius[0]):this.defaultRadius;this.bComputeMetadata=(json.ComputeMetadata&&(json.ComputeMetadata[0]=='true'||json.ComputeMetadata[0]=='1'))?true:false;var container=json.RadiusTooltipContainer?json.RadiusTooltipContainer[0]:'';if(container!=''){this.radiusTip=$(container);}
if(this.radiusTip){this.radiusTipType=json.RadiusTooltipType?json.RadiusTooltipType[0].toLowerCase():'dynamic';if(this.radiusTipType=='dynamic'){var oDomElem=this.getMap().getDomObj();oDomElem.appendChild(this.radiusTip);this.radiusTip.style.position='absolute';this.radiusTip.style.display='none';this.radiusTip.style.top='0px';this.radiusTip.style.left='0px';this.radiusTip.style.zIndex=101;}}
this.registerEventID(Fusion.Event.RADIUS_WIDGET_ACTIVATED);var mapWidget=this.getMap();this.map=mapWidget.oMapOL;this.handlerOptions={sides:40};this.handler=new OpenLayers.Handler.RegularPolygon(this,{interval:100,done:this.execute,down:this.mouseDown,move:this.mouseMove,up:this.mouseUp},this.handlerOptions);mapWidget.handlers.push(this.handler);},setRadius:function(r){this.defaultRadius=r;},getRadius:function(){if(this.handler.active){return this.handler.radius;}else{return this.defaultRadius;}},activate:function(){var radius=this.getMap().pixToGeoMeasure(this.defaultRadius);this.handler.setOptions({radius:radius});this.handler.activate();this.getMap().setCursor(this.asCursor);this.units=this.getMap().getAllMaps()[0].units;this.triggerEvent(Fusion.Event.RADIUS_WIDGET_ACTIVATED,true);},deactivate:function(){this.handler.deactivate();this.getMap().setCursor('auto');this.triggerEvent(Fusion.Event.RADIUS_WIDGET_ACTIVATED,false);},mouseDown:function(geom){var evt=this.handler.evt;if(OpenLayers.Event.isLeftClick(evt)){this.handler.fixedRadius=false;var p=this.getMap().getEventPosition(evt);var point=this.getMap().pixToGeo(p.x,p.y);var radius=this.getMap().pixToGeoMeasure(this.handler.radius);if(this.radiusTip&&this.radiusTipType=='dynamic'){this.radiusTip.style.display='block';var size=$(this.radiusTip).getBorderBoxSize();this.radiusTip.style.top=(p.y-size.height*2)+'px';this.radiusTip.style.left=p.x+'px';if(this.units=='m'||this.units=='ft'){radius=Math.round(radius*100)/100;}
this.radiusTip.innerHTML=radius+this.units;}}},mouseMove:function(geom){var evt=this.handler.evt;if(OpenLayers.Event.isLeftClick(evt)){var map=this.getMap();var p=map.getEventPosition(evt);var point=map.pixToGeo(p.x,p.y);var radius=this.getMap().pixToGeoMeasure(this.handler.radius);if(this.radiusTip&&this.radiusTipType=='dynamic'){this.radiusTip.style.display='block';var size=$(this.radiusTip).getBorderBoxSize();this.radiusTip.style.top=(p.y-size.height*2)+'px';this.radiusTip.style.left=p.x+'px';if(this.units=='m'||this.units=='ft'){radius=Math.round(radius*100)/100;}
this.radiusTip.innerHTML=radius+this.units;}}},mouseUp:function(geom){if(this.radiusTip&&this.radiusTipType=='dynamic'){this.radiusTip.style.display='none';this.radiusTip.innerHTML='';}
if(this.handler.start==this.handler.last){this.handler.clear();this.execute(geom);}},execute:function(geom){var options={};options.geometry=geom.toString();options.selectionType=this.selectionType;options.computed=this.bComputeMetadata;if(this.bActiveOnly){var layer=this.getMap().getActiveLayer();if(layer){options.layers=layer.layerName;}else{return;}}
if(this.handler.evt.shiftKey){options.extendSelection=true;}
this.getMap().query(options);},setParameter:function(param,value){if(param=="Tolerance"&&value>0){this.nTolerance=value;}
if(param=='SelectionType'){this.selectionType=value;}}});Fusion.Widget.SelectRadiusValue=OpenLayers.Class(Fusion.Widget,{radiusWidgetName:null,label:'',className:'',domLabel:null,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.radiusWidgetName=json.RadiusName?json.RadiusName[0]:null;this.label=json.Label?json.Label[0]:'';this.className=json.ClassName?json.ClassName[0]:'';Fusion.registerForEvent(Fusion.Event.FUSION_INITIALIZED,OpenLayers.Function.bind(this.mapLoaded,this));this.getMap().registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED,OpenLayers.Function.bind(this.mapExtentsChanged,this));},draw:function(){var units=this.getMap().getAllMaps()[0].units;this.domLabel=document.createElement('span');this.domLabel.className=this.className;this.domLabel.innerHTML=this.label+'('+units+')';this.input=document.createElement('input');this.input.type='text';this.domLabel.appendChild(this.input);this.domObj.appendChild(this.domLabel);OpenLayers.Event.observe(this.input,'blur',OpenLayers.Function.bind(this.onBlur,this));},setUiObject:function(uiObj){Fusion.Widget.prototype.setUiObject.apply(this,[uiObj]);if(this.uiObj.domObj){this.domObj=this.uiObj.domObj;}else{this.domObj=this.uiObj;}},mapLoaded:function(){this.draw();this.input.disabled=true;var widgets=Fusion.getWidgetsByType('SelectRadius');for(var i=0;i<widgets.length;i++){if(widgets[i].widgetTag.name==this.radiusWidgetName){this.widget=widgets[i];this.widget.registerForEvent(Fusion.Event.RADIUS_WIDGET_ACTIVATED,this.dependantEnable.bind(this));break;}}
this.updateFromWidgetValue();},dependantEnable:function(eventId,active){if(this.widget){if(active){this.input.disabled=false;}else{this.input.disabled=true;}}},mapExtentsChanged:function(){this.updateWidgetValue();},onBlur:function(){this.updateWidgetValue();},updateWidgetValue:function(){if(this.widget){var radius=this.input.getValue();this.widget.setRadius(radius);}},updateFromWidgetValue:function(){if(this.widget){this.input.value=this.widget.getRadius();}}});Fusion.Widget.SelectWithin=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,sFeatures:'menubar=no,location=no,resizable=no,status=no',initializeWidget:function(widgetTag){var json=widgetTag.extension;this.sTarget=json.Target?json.Target[0]:"SelectWithinWindow";this.sBaseUrl=Fusion.getFusionURL()+'widgets/SelectWithin/SelectWithinPanel.php';this.bSelectionOnly=(json.DisableIfSelectionEmpty&&(json.DisableIfSelectionEmpty[0]=='true'||json.DisableIfSelectionEmpty[0]=='1'))?true:false;this.additionalParameters=[];if(json.AdditionalParameter){for(var i=0;i<json.AdditionalParameter.length;i++){var p=json.AdditionalParameter[i];var k=p.Key[0];var v=p.Value[0];this.additionalParameters.push(k+'='+encodeURIComponent(v));}}
this.enable=Fusion.Widget.SelectWithin.prototype.enable;this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_ON,OpenLayers.Function.bind(this.enable,this));this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_OFF,OpenLayers.Function.bind(this.enable,this));this.disable();},enable:function(){var map=this.getMap();if(this.bSelectionOnly||!map){if(map&&map.hasSelection()){if(this.action){this.action.setEnabled(true);}else{Fusion.Widget.prototype.enable.apply(this,[]);}}else{if(this.action){this.action.setEnabled(false);}else{this.disable();}}}else{if(this.action){this.action.setEnabled(true);}else{Fusion.Widget.prototype.enable.apply(this,[]);}}},activate:function(){var url=this.sBaseUrl;var map=this.getMap();var mapLayers=map.getAllMaps();var taskPaneTarget=Fusion.getWidgetById(this.sTarget);var pageElement=$(this.sTarget);var params=[];params.push('locale='+Fusion.locale);params.push('session='+mapLayers[0].getSessionID());params.push('mapname='+mapLayers[0].getMapName());if(taskPaneTarget||pageElement){params.push('popup=false');}else{params.push('popup=true');}
params=params.concat(this.additionalParameters);if(url.indexOf('?')<0){url+='?';}else if(url.slice(-1)!='&'){url+='&';}
url+=params.join('&');if(taskPaneTarget){taskPaneTarget.setContent(url);}else{if(pageElement){pageElement.src=url;}else{window.open(url,this.sTarget,this.sWinFeatures);}}}});Fusion.Widget.SelectionInfo=OpenLayers.Class(Fusion.Widget,{defaultTemplate:'selectionInfo',domSpan:null,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.emptyText=json.EmptyText?json.EmptyText[0]:this.domObj.innerHTML;this.template=json.Template?json.Template[0]:null;this.domSpan=document.createElement('span');this.domSpan.className='spanSelectionInfo';this.domSpan.innerHTML=OpenLayers.i18n(this.emptyText);this.emptyText=json.EmptyText?json.EmptyText[0]:(this.domObj?this.domObj.innerHTML:null);if(this.domObj){this.domObj.innerHTML='';this.domObj.appendChild(this.domSpan);}
this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_ON,OpenLayers.Function.bind(this.update,this));this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_OFF,OpenLayers.Function.bind(this.update,this));},setUiObject:function(uiObj){Fusion.Widget.prototype.setUiObject.apply(this,[uiObj]);if(this.uiObj.domObj){this.uiObj.domObj.appendChild(this.domSpan);}else{this.uiObj.appendChild(this.domSpan);}},update:function(){var olMap=this.getMap();var aMaps=olMap.getAllMaps();var nLayers=0;var nFeatures=0;for(var i=0;i<aMaps.length;++i){var map=aMaps[i];if(map.hasSelection()){var layers=map.getSelectedLayers();nLayers+=layers.length;nFeatures+=map.getSelectedFeatureCount();}}
if(nFeatures>0){if(this.template){this.domSpan.innerHTML=this.template.replace('{0}',nFeatures).replace('{1}',nLayers);}else{this.domSpan.innerHTML=OpenLayers.i18n(this.defaultTemplate,{'features':nFeatures,'layers':nLayers});}}else{this.domSpan.innerHTML=OpenLayers.i18n(this.emptyText);}}});Fusion.Widget.SelectionPanel=OpenLayers.Class(Fusion.Widget,{previousIcon:'images/icon_back.gif',nextIcon:'images/icon_forward.gif',initializeWidget:function(widgetTag){var json=widgetTag.extension;if(json.PreviousImageUrl)this.previousIcon=json.PreviousImageUrl;if(json.NextImageUrl)this.nextIcon=json.NextImageUrl;this.iResultsPerPage=json.ResultsPerPage?json.ResultsPerPage[0]:0;this.iResultsPerPage=parseInt(this.iResultsPerPage);if(isNaN(this.iResultsPerPage)||(this.iResultsPerPage<0))
this.iResultsPerPage=0;if(json.SelectionRenderer)
{var renderer=eval(json.SelectionRenderer[0]);if(renderer&&renderer.prototype.CLASS_NAME&&renderer.prototype.CLASS_NAME=="Fusion.Widget.SelectionPanel.SelectionRenderer"){this.renderer=new renderer(this);}else if(typeof renderer=="function"){var renderFunction=renderer;this.renderer=new Fusion.Widget.SelectionPanel.SelectionRenderer(this);this.renderer.updateSelection=function(){this.getMap().getSelection(OpenLayers.Function.bind(renderFunction));};this.renderer.clearSelection=false;}else{this.renderer=new Fusion.Widget.SelectionPanel.SelectionRendererDefault(this);}}else{this.renderer=new Fusion.Widget.SelectionPanel.SelectionRendererDefault(this);}
this.iResultsPerPage=null;if(this.renderer.updateSelection){this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_ON,OpenLayers.Function.bind(this.renderer.updateSelection,this.renderer));}
if(this.renderer.clearSelection){this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_OFF,OpenLayers.Function.bind(this.renderer.clearSelection,this.renderer));}}});Fusion.Widget.SelectionPanel.SelectionRenderer=OpenLayers.Class({oSelection:null,aiCurrentIndex:null,iResultsPerPage:0,initialize:function(selectionPanel){this.oSelectionPanel=selectionPanel;this.iResultsPerPage=selectionPanel.iResultsPerPage;this.aiCurrentIndex=new Array();},updatePageIndexes:function(){var nLayers=this.oSelection.getNumLayers();for(var i=0;i<nLayers;i++){this.aiCurrentIndex[this.oSelection.getLayer(i).getName()]=0;}},getNextPage:function(selectionLayer){if(selectionLayer&&(this.iResultsPerPage!=0)){var layerName=selectionLayer.getName();if(this.aiCurrentIndex[layerName]>=selectionLayer.getNumElements()){this.aiCurrentIndex[layerName]=this.aiCurrentIndex[layerName]-this.iResultsPerPage;}
var iTotalElement=selectionLayer.getNumElements();var startIndex=this.aiCurrentIndex[layerName];var endIndex=startIndex+this.iResultsPerPage;if(endIndex>=iTotalElement){endIndex=iTotalElement;}
if(startIndex<0){startIndex=0;}
this.aiCurrentIndex[layerName]=endIndex;var diff=(endIndex-startIndex);if(diff!=this.iResultsPerPage){this.aiCurrentIndex[layerName]=this.aiCurrentIndex[layerName]+(this.iResultsPerPage-diff);}
return this.getPage(selectionLayer,startIndex,endIndex);}
return this.getPage(selectionLayer);},getPreviousPage:function(selectionLayer){var layerName=selectionLayer.getName();if(selectionLayer&&(this.aiCurrentIndex[layerName]!=0)&&(this.iResultsPerPage!=0)){var iTotalElement=selectionLayer.getNumElements();var startIndex=this.aiCurrentIndex[layerName]-(this.iResultsPerPage*2);var endIndex=this.aiCurrentIndex[layerName]-this.iResultsPerPage;if(startIndex<0){startIndex=0;endIndex=(iTotalElement<this.iResultsPerPage)?iTotalElement:this.iResultsPerPage;}
this.aiCurrentIndex[layerName]=endIndex;return this.getPage(selectionLayer,startIndex,endIndex);}
return this.getPage(selectionLayer);},getMap:function(){return this.oSelectionPanel.getMap();},getPage:function(selectionLayer,startIndex,endIndex){var page=false;if(selectionLayer){page=new Array();startIndex=startIndex?startIndex:0;endIndex=endIndex?endIndex:selectionLayer.getNumElements();var propNames=selectionLayer.getPropertyNames();var index=0;for(var i=startIndex;i<endIndex;i++,index++){page[index]=new Array();for(var j=0;j<propNames.length;j++){page[index][j]=selectionLayer.getElementValue(i,j);}}}
return page;},updateSelection:function(){},clearSelection:function(){},CLASS_NAME:"Fusion.Widget.SelectionPanel.SelectionRenderer"});Fusion.Widget.SelectionPanel.SelectionRendererDefault=OpenLayers.Class(Fusion.Widget.SelectionPanel.SelectionRenderer,{initialize:function(selectionPanel){Fusion.Widget.SelectionPanel.SelectionRenderer.prototype.initialize.apply(this,[selectionPanel]);var d=document.createElement('div');this.toolbar=document.createElement('div');this.toolbar.className='selectionPanelToolbar';this.layerList=document.createElement('select');this.layerList.className='layerSelector';this.toolbar.appendChild(this.layerList);OpenLayers.Event.observe(this.layerList,'change',OpenLayers.Function.bind(this.renderSelectionFeatures,this));this.featureList=document.createElement('select');this.featureList.className='featureSelector';this.toolbar.appendChild(this.featureList);OpenLayers.Event.observe(this.featureList,'change',OpenLayers.Function.bind(this.renderFeature,this));this.featureDiv=document.createElement('div');this.featureDiv.className='selectionPanelContent';this.clearSelection();d.appendChild(this.toolbar);d.appendChild(this.featureDiv);Fusion.addWidgetStyleSheet(this.oSelectionPanel.getLocation()+'SelectionPanel/SelectionPanel.css');this.oSelectionPanel.domObj.appendChild(d);},updateSelection:function(){this.getMap().getSelection(OpenLayers.Function.bind(this.renderSelectionLayers,this));},clearSelection:function(){this.layerList.options.length=0;this.featureList.options.length=0;this.oSelection=null;this.featureDiv.className='selectionPanelContent noSelection';this.featureDiv.innerHTML=OpenLayers.i18n('noSelection');},renderSelectionLayers:function(oSelection){this.oSelection=null;for(var mapName in oSelection){this.oSelection=oSelection[mapName];break;}
if(!this.oSelection){return;}
this.featureDiv.className='selectionPanelContent';while(this.layerList.length>0){this.layerList.remove(this.layerList.options[0]);}
var nLayers=this.oSelection.getNumLayers();for(var i=0;i<nLayers;i++){var layerObj=this.oSelection.getLayer(i);var mapLayers=this.getMap().aMaps[0].aLayers;var labelName=layerObj.getName();for(var j=0;j<mapLayers.length;++j){if(mapLayers[j].layerName==labelName){labelName=mapLayers[j].legendLabel;break;}}
var opt=new Option(labelName,i);this.layerList.options[i]=opt;}
this.layerList.selectedIndex=0;this.renderSelectionFeatures();},renderSelectionFeatures:function(){var layerIdx=this.layerList.selectedIndex;var layerObj=this.oSelection.getLayer(layerIdx);while(this.featureList.length>0){this.featureList.remove(this.featureList.options[0]);}
var nElements=layerObj.getNumElements();for(var i=0;i<nElements;i++){var opt=new Option(i+1,i);this.featureList.options[i]=opt;}
this.featureList.selectedIndex=0;this.renderFeature();},renderFeature:function(){var layerIdx=this.layerList.selectedIndex;var featureIdx=this.featureList.selectedIndex;var layerObj=this.oSelection.getLayer(layerIdx);var nProperties=layerObj.getNumProperties();var aNames=layerObj.getPropertyNames();var table=document.createElement('table');var thead=document.createElement('thead');var tr=document.createElement('tr');var th=document.createElement('th');th.innerHTML=OpenLayers.i18n('attribute');tr.appendChild(th);var th=document.createElement('th');th.innerHTML=OpenLayers.i18n('value');tr.appendChild(th);thead.appendChild(tr);table.appendChild(thead);var tbody=document.createElement('tbody');table.appendChild(tbody);for(var i=0;i<nProperties;i++){var tr=document.createElement('tr');if(i%2){tr.className='oddRow';}
var th=document.createElement('th');th.innerHTML=aNames[i];var td=document.createElement('td');td.innerHTML=layerObj.getElementValue(featureIdx,i);tr.appendChild(th);tr.appendChild(td);tbody.appendChild(tr);}
this.featureDiv.innerHTML='';this.featureDiv.appendChild(table);}});Fusion.Widget.SelectionPanel.SelectionRendererHorizontal=OpenLayers.Class(Fusion.Widget.SelectionPanel.SelectionRenderer,{initialize:function(selectionPanel){Fusion.Widget.SelectionPanel.SelectionRenderer.prototype.initialize.apply(this,[selectionPanel]);var d=document.createElement('div');this.featureDiv=document.createElement('div');this.featureDiv.innerHTML='No Selection';this.featureDiv.className='selectionPanelContent noSelection';d.appendChild(this.featureDiv);if(this.iResultsPerPage!=0){this.previousButton=document.createElement('img');this.previousButton.src=this.oSelectionPanel.previousIcon;this.previousButton.style.position="absolute";this.previousButton.style.left="0px";this.previousButton.style.padding="3px";OpenLayers.Event.observe(this.previousButton,'click',OpenLayers.Function.bind(this.renderLayers,this,'prev'));this.nextButton=document.createElement('img');this.nextButton.src=this.oSelectionPanel.nextIcon;this.nextButton.style.position="absolute";this.nextButton.style.right="0px";this.nextButton.style.padding="3px";OpenLayers.Event.observe(this.nextButton,'click',OpenLayers.Function.bind(this.renderLayers,this,'next'));d.appendChild(this.previousButton);d.appendChild(this.nextButton);}
Fusion.addWidgetStyleSheet(this.oSelectionPanel.getLocation()+'SelectionPanel/SelectionPanel.css');this.oSelectionPanel.domObj.appendChild(d);},updateSelection:function(){this.getMap().getSelection(OpenLayers.Function.bind(this.renderSelection,this));},clearSelection:function(){this.oSelection=null;this.featureDiv.className='selectionPanelContent noSelection';this.featureDiv.innerHTML=OpenLayers.i18n('noSelection');},renderSelection:function(oSelection){this.oSelection=null;for(var mapName in oSelection){this.oSelection=oSelection[mapName];break;}
this.updatePageIndexes();this.renderLayers("next");},renderLayers:function(renderingPage){if(!this.oSelection){return;}
$(this.featureDiv).removeClass('noSelection');this.featureDiv.innerHTML='';var nLayers=this.oSelection.getNumLayers();for(var i=0;i<nLayers;i++){var table=document.createElement('table');table.style.borderLeft="1px solid #CCCCCC";table.style.marginBottom="10px";var layerObj=this.oSelection.getLayer(i);var aNames=layerObj.getPropertyNames();var mapLayers=this.getMap().aMaps[0].aLayers;var labelName=layerObj.getName();for(var j=0;j<mapLayers.length;++j){if(mapLayers[j].layerName==labelName){labelName=mapLayers[j].legendLabel;break;}}
var thead=document.createElement('thead');var tr=document.createElement('tr');var th=document.createElement('th');th.innerHTML=labelName;th.colSpan=aNames.length;th.style.textAlign="center";tr.appendChild(th);thead.appendChild(tr);tr=document.createElement('tr');for(var j=0;j<aNames.length;j++){th=document.createElement('th');th.innerHTML=aNames[j];th.style.textAlign="center";tr.appendChild(th);}
thead.appendChild(tr);table.appendChild(thead);var tbody=document.createElement('tbody');var page=(renderingPage=='next')?this.getNextPage(layerObj):this.getPreviousPage(layerObj);this.renderFeatures(page,tbody);table.appendChild(tbody);this.featureDiv.appendChild(table);}},renderFeatures:function(page,dom){if(!page)
return;for(var i=0;i<page.length;i++){var tr=document.createElement('tr');if(i%2){tr.className='oddRow';}
for(var j=0;j<page[i].length;j++){var td=document.createElement('td');td.innerHTML=page[i][j];tr.appendChild(td);}
dom.appendChild(tr);}}});Fusion.Widget.TaskPane=OpenLayers.Class(Fusion.Widget,{aExecutedTasks:null,nCurrentTask:0,nTasks:0,initializeWidget:function(widgetTag){this.aExecutedTasks=[];var url=Fusion.getFusionURL();var homeIcon=url+widgetTag.location+'TaskPane/taskpane.png';var homeClass='TaskPane_home';var prevIcon=url+widgetTag.location+'TaskPane/taskpane.png';var prevClass='TaskPane_back';var nextIcon=url+widgetTag.location+'TaskPane/taskpane.png';var nextClass='TaskPane_forward';var taskIcon=url+widgetTag.location+'TaskPane/taskpane.png';var taskClass='TaskPane_tasks';var initialTask=widgetTag.location+'TaskPane/TaskPane.html';var json=widgetTag.extension;if(json.InitialTask){initialTask=taskURL=json.InitialTask[0];}else{initialTask=url+initialTask;}
homeIcon=json.HomeIcon?json.HomeIcon[0]:homeIcon;homeClass=json.HomeClass?json.HomeClass[0]:homeClass;prevIcon=json.PreviousIcon?json.PreviousIcon[0]:prevIcon;prevClass=json.PreviousClass?json.PreviousClass[0]:prevClass;nextIcon=json.NextIcon?json.NextIcon[0]:nextIcon;nextClass=json.NextClass?json.NextClass[0]:nextClass;taskIcon=json.TaskIcon?json.TaskIcon[0]:taskIcon;taskClass=json.TaskClass?json.TaskClass[0]:taskClass;if(json.MenuContainer){this.menuName=json.MenuContainer[0];}
this.toolbar=new Jx.Toolbar();this.homeButton=new Jx.Button({image:homeIcon,imageClass:homeClass,tooltip:OpenLayers.i18n('taskHome'),onClick:OpenLayers.Function.bind(this.goHome,this)});this.prevButton=new Jx.Button({image:prevIcon,imageClass:prevClass,tooltip:OpenLayers.i18n('prevTask'),onClick:OpenLayers.Function.bind(this.gotoPrevTask,this)});this.nextButton=new Jx.Button({image:nextIcon,imageClass:nextClass,tooltip:OpenLayers.i18n('nextTask'),onClick:OpenLayers.Function.bind(this.gotoNextTask,this)});this.toolbar.add(this.homeButton,this.prevButton,this.nextButton);this.taskMenu=new Jx.Menu({image:taskIcon,imageClass:taskClass,label:OpenLayers.i18n('taskList'),right:0});$(this.taskMenu.domObj).addClass('taskMenu');$(this.taskMenu.button.domObj).addClass('jxButtonContentLeft');this.toolbar.add(this.taskMenu);var iframeName=this.name+'_IFRAME';this.iframe=document.createElement('iframe');new Jx.Layout(this.iframe);this.iframe.setAttribute('name',iframeName);this.iframe.setAttribute('id',iframeName);this.iframe.setAttribute('frameborder',0);this.iframe.style.border='0px solid #fff';this.oTaskPane=new Jx.Panel({toolbars:[this.toolbar],hideTitle:true,content:this.iframe});$(this.domObj).addClass('taskPanePanel');Fusion.addWidgetStyleSheet(widgetTag.location+'TaskPane/TaskPane.css');this.domObj.appendChild(this.oTaskPane.domObj);this.oTaskPane.domObj.resize();Fusion.registerForEvent(Fusion.Event.FUSION_INITIALIZED,OpenLayers.Function.bind(this.setTaskMenu,this));this.getMap().registerForEvent(Fusion.Event.MAP_LOADED,OpenLayers.Function.bind(this.setContent,this,initialTask));},updateButtons:function(){this.prevButton.setEnabled(this.nCurrentTask>0);this.nextButton.setEnabled(this.nCurrentTask<this.aExecutedTasks.length-1);},gotoPrevTask:function(){this.nCurrentTask=this.nCurrentTask>0?--this.nCurrentTask:0;this.iframe.src=this.aExecutedTasks[this.nCurrentTask];this.updateButtons();},gotoNextTask:function(){this.nCurrentTask=this.nCurrentTask<this.aExecutedTasks.length-1?++this.nCurrentTask:this.aExecutedTasks.length-1;this.iframe.src=this.aExecutedTasks[this.nCurrentTask];this.updateButtons();},goHome:function(){this.nCurrentTask=0;this.iframe.src=this.aExecutedTasks[this.nCurrentTask];this.updateButtons();},setContent:function(url){if(this.nCurrentTask<this.aExecutedTasks.length){this.aExecutedTasks.splice(this.nCurrentTask,this.aExecutedTasks.length-this.nCurrentTask);}
this.aExecutedTasks.push(url);++this.nCurrentTask;this.iframe.src=url;this.iframe.taskPaneId=this.widgetTag.name;this.updateButtons();},setTaskMenu:function(){if(this.menuName){var container=this.getMap().widgetSet.getContainerByName(this.menuName);if(container){container.createWidgets(this.getMap().widgetSet,this.taskMenu);}}}});Fusion.Widget.Theme=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,sFeatures:'menubar=no,location=no,resizable=no,status=no',initializeWidget:function(widgetTag){var json=widgetTag.extension;this.sTarget=json.Target?json.Target[0]:"ThemeWindow";this.sBaseUrl=Fusion.getFusionURL()+'widgets/Theme/thememain.php';},activate:function(){var url=this.sBaseUrl;var map=this.getMap();var mapLayers=map.getAllMaps();var taskPaneTarget=Fusion.getWidgetById(this.sTarget);var pageElement=$(this.sTarget);var params=[];params.push('LOCALE='+Fusion.locale);params.push('SESSION='+mapLayers[0].getSessionID());params.push('MAPNAME='+mapLayers[0].getMapName());if(taskPaneTarget||pageElement){params.push('POPUP=false');}else{params.push('POPUP=true');}
if(url.indexOf('?')<0){url+='?';}else if(url.slice(-1)!='&'){url+='&';}
url+=params.join('&');if(taskPaneTarget){taskPaneTarget.setContent(url);}else{if(pageElement){pageElement.src=url;}else{window.open(url,this.sTarget,this.sWinFeatures);}}}});Fusion.Widget.ViewOptions=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Menu,displayUnits:false,options:{'imperial':'Miles','metric':'Meters','deg':'Degrees'},menuItems:null,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.displayUnits=json.DisplayUnits?json.DisplayUnits[0]:false;this.getMap().registerForEvent(Fusion.Event.MAP_LOADED,OpenLayers.Function.bind(this.setMapUnits,this));this.menuItems={};},setUiObject:function(uiObj){Fusion.Widget.prototype.setUiObject.apply(this,[uiObj]);var buttonSet=new Jx.ButtonSet();for(var key in this.options){var menuItem=new Jx.Menu.Item({label:OpenLayers.i18n(key),toggle:true,onDown:OpenLayers.Function.bind(this.setViewOptions,this,this.options[key])});buttonSet.add(menuItem);this.uiObj.add(menuItem);this.menuItems[key]=menuItem;}},setViewOptions:function(units){this.getMap().setViewOptions(units);},setMapUnits:function(){var units=this.displayUnits?this.displayUnits:this.getMap().getUnits();this.setViewOptions(units);var system=Fusion.unitSystem(Fusion.unitFromName(units));if(this.menuItems[system]){this.menuItems[system].setActive(true);}}});Fusion.Widget.ViewSize=OpenLayers.Class(Fusion.Widget,{defaultTemplate:'x: {x}, y: {y}',domSpan:null,emptyText:'',units:Fusion.UNKNOWN,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.template=json.Template?json.Template[0]:this.defaultTemplate;this.precision=json.Precision?parseInt(json.Precision[0]):-1;this.units=json.Units?Fusion.unitFromName(json.Units[0]):Fusion.UNKOWN;this.domSpan=document.createElement('span');this.domSpan.className='spanViewSize';this.domSpan.innerHTML=this.emptyText;if(this.domObj){this.emptyText=this.domObj.innerHTML;this.domObj.innerHTML='';this.domObj.appendChild(this.domSpan);}
this.getMap().registerForEvent(Fusion.Event.MAP_RESIZED,OpenLayers.Function.bind(this.updateViewSize,this));this.getMap().registerForEvent(Fusion.Event.MAP_LOADED,OpenLayers.Function.bind(this.setUnits,this));this.getMap().registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED,OpenLayers.Function.bind(this.updateViewSize,this));this.registerParameter('Units');},setUiObject:function(uiObj){Fusion.Widget.prototype.setUiObject.apply(this,[uiObj]);if(this.uiObj.domObj){this.uiObj.domObj.appendChild(this.domSpan);}else{this.uiObj.appendChild(this.domSpan);}},updateViewSize:function(e){var map=this.getMap();var p=map.getSize();if(this.units!=Fusion.PIXELS){var gw=map.pixToGeoMeasure(p.w);var gh=map.pixToGeoMeasure(p.h);if(this.units!=Fusion.UNKNOWN){var convFactor=map.getMetersPerUnit();gw=Fusion.fromMeter(this.units,gw*convFactor);gh=Fusion.fromMeter(this.units,gh*convFactor);}
if(this.precision>=0){var factor=Math.pow(10,this.precision);gw=Math.round(gw*factor)/factor;gh=Math.round(gh*factor)/factor;}}
var unitAbbr=Fusion.unitAbbr(this.units);this.domSpan.innerHTML=this.template.replace('{w}',gw).replace('{h}',gh).replace('{units}',unitAbbr).replace('{units}',unitAbbr);},setUnits:function(){if(this.units==Fusion.UNKNOWN){this.setParameter('Units',this.getMap().getUnits());}
this.updateViewSize();},setParameter:function(param,value){if(param=='Units'){this.units=Fusion.unitFromName(value);this.updateViewSize();}}});Fusion.Widget.Zoom=OpenLayers.Class(Fusion.Widget,{isExclusive:true,tolerance:5,factor:2,zoomIn:true,uiClass:Jx.Button,initializeWidget:function(widgetTag){this.asCursor=["url('images/zoomin.cur'),auto",'-moz-zoom-in','auto'];this.zoomInCursor=["url('images/zoomin.cur'),auto",'-moz-zoom-in','auto'];this.zoomOutCursor=["url('images/zoomout.cur'),auto",'-moz-zoom-out','auto'];var json=widgetTag.extension;this.tolerance=json.Tolerance?json.Tolerance[0]:this.tolerance;this.factor=json.Factor?json.Factor[0]:this.factor;this.zoomIn=(json.Direction&&json.Direction[0]=='out')?false:true;this.keypressWatcher=OpenLayers.Function.bind(this.keypressHandler,this);var mapWidget=this.getMap();this.map=mapWidget.oMapOL;this.handler=new OpenLayers.Handler.Box(this,{done:this.execute},{keyMask:0});this.shiftHandler=new OpenLayers.Handler.Box(this,{done:this.altZoom},{keyMask:OpenLayers.Handler.MOD_SHIFT});mapWidget.handlers.push(this.handler);mapWidget.handlers.push(this.shiftHandler);},shouldActivateWith:function(widget){return(widget instanceof Fusion.Widget.Zoom&&widget.zoomIn==this.zoomIn&&widget.factor==this.factor&&widget.tolerance==this.tolerance);},activate:function(){this.handler.activate();this.shiftHandler.activate();if(this.zoomIn){this.getMap().setCursor(this.zoomInCursor);}else{this.getMap().setCursor(this.zoomOutCursor);}
OpenLayers.Event.observe(document,'keypress',this.keypressWatcher);},deactivate:function(){this.handler.deactivate();this.shiftHandler.deactivate();this.getMap().setCursor('auto');OpenLayers.Event.stopObserving(document,'keypress',this.keypressWatcher);},execute:function(position,altZoom){var zoomIn=this.zoomIn;if(altZoom){zoomIn=!zoomIn;}
if(position instanceof OpenLayers.Bounds){var minXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.left,position.bottom));var maxXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.right,position.top));var bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);if(zoomIn){this.getMap().setExtents(bounds);}else{var newWidth=bounds.getWidth();var newHeight=bounds.getHeight();var currentExtents=this.getMap().getCurrentExtents();var currentWidth=currentExtents.getWidth();var currentHeight=currentExtents.getHeight();var factor=Math.min(newWidth/currentWidth,newHeight/currentHeight);var center=bounds.getCenterLonLat();this.getMap().zoom(center.lon,center.lat,factor);}}else{var center=this.map.getLonLatFromPixel(position);var factor;if(!zoomIn&&this.factor>1){factor=1/this.factor;}else{factor=this.factor;}
this.getMap().zoom(center.lon,center.lat,factor);}},altZoom:function(position){this.execute(position,true);},setParameter:function(param,value){if(param=="Factor"&&value>0){this.factor=value;}},keypressHandler:function(e){var charCode=(e.charCode)?e.charCode:e.keyCode;if(charCode==Event.KEY_ESC){this.handler.deactivate();this.handler.activate();}}});Fusion.Widget.ZoomOnClick=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,factor:4,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.factor=parseFloat(json.Factor?json.Factor[0]:this.factor);},activate:function(){var center=this.getMap().getCurrentCenter();this.getMap().zoom(center.x,center.y,this.factor);},setParameter:function(param,value){if(param=="Factor"&&value>0){this.factor=value;}}});Fusion.Widget.ZoomToSelection=OpenLayers.Class(Fusion.Widget,{uiClass:Jx.Button,initializeWidget:function(widgetTag){var json=widgetTag.extension;this.maxDimension=json.MaximumZoomDimension?json.MaximumZoomDimension[0]:-1;this.zoomFactor=json.ZoomFactor?json.ZoomFactor[0]:2;this.enable=Fusion.Widget.ZoomToSelection.prototype.enable;this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_ON,OpenLayers.Function.bind(this.enable,this));this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_OFF,OpenLayers.Function.bind(this.disable,this));},activate:function(){this.getMap().getSelection(OpenLayers.Function.bind(this.zoomToSelection,this));},zoomToSelection:function(selection){var map=this.oMap.aMaps[0];var ll=selection[map.getMapName()].getLowerLeftCoord();var ur=selection[map.getMapName()].getUpperRightCoord();var zoom_size=this.zoomFactor*Math.max(Math.abs(ur.x-ll.x),Math.abs(ur.y-ll.y))/2;var cX=(ur.x+ll.x)/2;var cY=(ur.y+ll.y)/2;ll.x=cX-zoom_size;ur.x=cX+zoom_size;ll.y=cY-zoom_size;ur.y=cY+zoom_size;this.getMap().setExtents(new OpenLayers.Bounds(ll.x,ll.y,ur.x,ur.y));},enable:function(){if(this.oMap&&this.oMap.hasSelection()){Fusion.Widget.prototype.enable.apply(this,[]);}else{this.disable();}}});function ScaleBarTool(scaleDenominator){this.scaleDenominator=(scaleDenominator==null)?1:scaleDenominator;this.displaySystem='metric';this.minWidth=100;this.maxWidth=200;this.divisions=2;this.subdivisions=2;this.showMinorMeasures=false;this.abbreviateLabel=false;this.singleLine=false;this.resolution=72;this.align='center';this.container=document.createElement('div');this.container.className='sbWrapper';this.labelContainer=document.createElement('div');this.labelContainer.className='sbUnitsContainer';this.labelContainer.style.position='absolute';this.graphicsContainer=document.createElement('div');this.graphicsContainer.style.position='absolute';this.graphicsContainer.className='sbGraphicsContainer';this.numbersContainer=document.createElement('div');this.numbersContainer.style.position='absolute';this.numbersContainer.className='sbNumbersContainer';var markerMajor=document.createElement('div');markerMajor.className='sbMarkerMajor';this.graphicsContainer.appendChild(markerMajor);var markerMinor=document.createElement('div');markerMinor.className='sbMarkerMinor';this.graphicsContainer.appendChild(markerMinor);var barPiece=document.createElement('div');barPiece.className='sbBar';this.graphicsContainer.appendChild(barPiece);var barPieceAlt=document.createElement('div');barPieceAlt.className='sbBarAlt';this.graphicsContainer.appendChild(barPieceAlt);}
ScaleBarTool.prototype.update=function(scaleDenominator){if(scaleDenominator!=null){this.scaleDenominator=scaleDenominator;};function HandsomeNumber(smallUglyNumber,bigUglyNumber,sigFigs){var sigFigs=(sigFigs==null)?10:sigFigs;var bestScore=Number.POSITIVE_INFINITY;var bestTieBreaker=Number.POSITIVE_INFINITY;var handsomeValue=smallUglyNumber;var handsomeNumDec=3;for(var halvingExp=0;halvingExp<3;++halvingExp){var comelyMultiplicand=Math.pow(2,(-1*halvingExp));var maxTensExp=Math.floor(Math.log(bigUglyNumber/comelyMultiplicand)/Math.LN10);for(var tensExp=maxTensExp;tensExp>(maxTensExp-sigFigs+1);--tensExp){var numDec=Math.max(halvingExp-tensExp,0);var testMultiplicand=comelyMultiplicand*Math.pow(10,tensExp);if((testMultiplicand*Math.floor(bigUglyNumber/testMultiplicand))>=smallUglyNumber){if(smallUglyNumber%testMultiplicand==0){var testMultiplier=smallUglyNumber/testMultiplicand;}
else{var testMultiplier=Math.floor(smallUglyNumber/testMultiplicand)+1;}
var testScore=testMultiplier+(2*halvingExp);var testTieBreaker=(tensExp<0)?(Math.abs(tensExp)+1):tensExp;if((testScore<bestScore)||((testScore==bestScore)&&(testTieBreaker<bestTieBreaker))){bestScore=testScore;bestTieBreaker=testTieBreaker;handsomeValue=(testMultiplicand*testMultiplier).toFixed(numDec);handsomeNumDec=numDec;}}}}
this.value=handsomeValue;this.score=bestScore;this.tieBreaker=bestTieBreaker;this.numDec=handsomeNumDec;};HandsomeNumber.prototype.toString=function(){return this.value.toString();};HandsomeNumber.prototype.valueOf=function(){return this.value;};function styleValue(aSelector,styleKey){var aValue=0;if(document.styleSheets){for(var sheetIndex=document.styleSheets.length-1;sheetIndex>=0;--sheetIndex){var aSheet=document.styleSheets[sheetIndex];if(!aSheet.disabled){var allRules;if(typeof(aSheet.cssRules)=='undefined'){if(typeof(aSheet.rules)=='undefined'){return 0;}
else{allRules=aSheet.rules;}}
else{allRules=aSheet.cssRules;}
for(var ruleIndex=0;ruleIndex<allRules.length;++ruleIndex){var aRule=allRules[ruleIndex];if(aRule.selectorText&&(aRule.selectorText.toLowerCase()==aSelector.toLowerCase())){if(aRule.style[styleKey]!=''){aValue=parseInt(aRule.style[styleKey]);}}}}}}
return aValue?aValue:0;};function formatNumber(aNumber,numDecimals){numDecimals=(numDecimals)?numDecimals:0;var formattedInteger=''+Math.round(aNumber);var thousandsPattern=/(-?[0-9]+)([0-9]{3})/;while(thousandsPattern.test(formattedInteger)){formattedInteger=formattedInteger.replace(thousandsPattern,'$1,$2');}
if(numDecimals>0){var formattedDecimal=Math.floor(Math.pow(10,numDecimals)*(aNumber-Math.round(aNumber)));if(formattedDecimal==0){return formattedInteger;}
else{return formattedInteger+'.'+formattedDecimal;}}
else{return formattedInteger;}};this.container.title='scale 1:'+formatNumber(this.scaleDenominator);var measurementProperties=new Object();measurementProperties.english={units:['miles','feet','inches'],abbr:['mi','ft','in'],inches:[63360,12,1]};measurementProperties.metric={units:['kilometers','meters','centimeters'],abbr:['km','m','cm'],inches:[39370.07874,39.370079,0.393701]};var comparisonArray=new Array();for(var unitIndex=0;unitIndex<measurementProperties[this.displaySystem].units.length;++unitIndex){comparisonArray[unitIndex]=new Object();var pixelsPerDisplayUnit=this.resolution*measurementProperties[this.displaySystem].inches[unitIndex]/this.scaleDenominator;var minSDDisplayLength=(this.minWidth/pixelsPerDisplayUnit)/(this.divisions*this.subdivisions);var maxSDDisplayLength=(this.maxWidth/pixelsPerDisplayUnit)/(this.divisions*this.subdivisions);for(var valueIndex=0;valueIndex<(this.divisions*this.subdivisions);++valueIndex){var minNumber=minSDDisplayLength*(valueIndex+1);var maxNumber=maxSDDisplayLength*(valueIndex+1);var niceNumber=new HandsomeNumber(minNumber,maxNumber);comparisonArray[unitIndex][valueIndex]={value:(niceNumber.value/(valueIndex+1)),score:0,tieBreaker:0,numDec:0,displayed:0};for(var valueIndex2=0;valueIndex2<(this.divisions*this.subdivisions);++valueIndex2){displayedValuePosition=niceNumber.value*(valueIndex2+1)/(valueIndex+1);niceNumber2=new HandsomeNumber(displayedValuePosition,displayedValuePosition);var isMajorMeasurement=((valueIndex2+1)%this.subdivisions==0);var isLastMeasurement=((valueIndex2+1)==(this.divisions*this.subdivisions));if((this.singleLine&&isLastMeasurement)||(!this.singleLine&&(isMajorMeasurement||this.showMinorMeasures))){comparisonArray[unitIndex][valueIndex].score+=niceNumber2.score;comparisonArray[unitIndex][valueIndex].tieBreaker+=niceNumber2.tieBreaker;comparisonArray[unitIndex][valueIndex].numDec=Math.max(comparisonArray[unitIndex][valueIndex].numDec,niceNumber2.numDec);comparisonArray[unitIndex][valueIndex].displayed+=1;}
else{comparisonArray[unitIndex][valueIndex].score+=niceNumber2.score/this.subdivisions;comparisonArray[unitIndex][valueIndex].tieBreaker+=niceNumber2.tieBreaker/this.subdivisions;}}
var scoreAdjustment=(unitIndex+1)*comparisonArray[unitIndex][valueIndex].tieBreaker/comparisonArray[unitIndex][valueIndex].displayed;comparisonArray[unitIndex][valueIndex].score*=scoreAdjustment;}}
var subdivisionDisplayLength=null;var displayUnits=null;var displayUnitsAbbr=null;var subdivisionPixelLength=null;var bestScore=Number.POSITIVE_INFINITY;var bestTieBreaker=Number.POSITIVE_INFINITY;var numDec=0;for(var unitIndex=0;unitIndex<comparisonArray.length;++unitIndex){for(valueIndex in comparisonArray[unitIndex]){if((comparisonArray[unitIndex][valueIndex].score<bestScore)||((comparisonArray[unitIndex][valueIndex].score==bestScore)&&(comparisonArray[unitIndex][valueIndex].tieBreaker<bestTieBreaker))){bestScore=comparisonArray[unitIndex][valueIndex].score;bestTieBreaker=comparisonArray[unitIndex][valueIndex].tieBreaker;subdivisionDisplayLength=comparisonArray[unitIndex][valueIndex].value;numDec=comparisonArray[unitIndex][valueIndex].numDec;displayUnits=measurementProperties[this.displaySystem].units[unitIndex];displayUnitsAbbr=measurementProperties[this.displaySystem].abbr[unitIndex];pixelsPerDisplayUnit=this.resolution*measurementProperties[this.displaySystem].inches[unitIndex]/this.scaleDenominator;subdivisionPixelLength=pixelsPerDisplayUnit*subdivisionDisplayLength;}}}
var xOffsetMarkerMajor=(styleValue('.sbMarkerMajor','borderLeftWidth')+styleValue('.sbMarkerMajor','width')+styleValue('.sbMarkerMajor','borderRightWidth'))/2;var xOffsetMarkerMinor=(styleValue('.sbMarkerMinor','borderLeftWidth')+styleValue('.sbMarkerMinor','width')+styleValue('.sbMarkerMinor','borderRightWidth'))/2;var xOffsetBar=(styleValue('.sbBar','borderLeftWidth')+styleValue('.sbBar','borderRightWidth'))/2;var xOffsetBarAlt=(styleValue('.sbBarAlt','borderLeftWidth')+styleValue('.sbBarAlt','borderRightWidth'))/2;if(!document.styleSheets){xOffsetMarkerMajor=0.5;xOffsetMarkerMinor=0.5;}
while(this.labelContainer.hasChildNodes()){this.labelContainer.removeChild(this.labelContainer.firstChild);}
while(this.graphicsContainer.hasChildNodes()){this.graphicsContainer.removeChild(this.graphicsContainer.firstChild);}
while(this.numbersContainer.hasChildNodes()){this.numbersContainer.removeChild(this.numbersContainer.firstChild);}
var aMarker,aBarPiece,numbersBox,xOffset;var alignmentOffset={left:0,center:(-1*this.divisions*this.subdivisions*subdivisionPixelLength/2),right:(-1*this.divisions*this.subdivisions*subdivisionPixelLength)};var xPosition=0+alignmentOffset[this.align];var markerMeasure=0;for(var divisionIndex=0;divisionIndex<this.divisions;++divisionIndex){xPosition=divisionIndex*this.subdivisions*subdivisionPixelLength;xPosition+=alignmentOffset[this.align];markerMeasure=(divisionIndex==0)?0:((divisionIndex*this.subdivisions)*subdivisionDisplayLength).toFixed(numDec);aMarker=document.createElement('div');aMarker.className='sbMarkerMajor';aMarker.style.position='absolute';aMarker.style.overflow='hidden';aMarker.style.left=Math.round(xPosition-xOffsetMarkerMajor)+'px';aMarker.appendChild(document.createTextNode(' '));this.graphicsContainer.appendChild(aMarker);if(!this.singleLine){numbersBox=document.createElement('div');numbersBox.className='sbNumbersBox';numbersBox.style.position='absolute';numbersBox.style.overflow='hidden';numbersBox.style.textAlign='center';if(this.showMinorMeasures){numbersBox.style.width=Math.round(subdivisionPixelLength*2)+'px';numbersBox.style.left=Math.round(xPosition-subdivisionPixelLength)+'px';}
else{numbersBox.style.width=Math.round(this.subdivisions*subdivisionPixelLength*2)+'px';numbersBox.style.left=Math.round(xPosition-(this.subdivisions*subdivisionPixelLength))+'px';}
numbersBox.appendChild(document.createTextNode(markerMeasure));this.numbersContainer.appendChild(numbersBox);}
for(var subdivisionIndex=0;subdivisionIndex<this.subdivisions;++subdivisionIndex){aBarPiece=document.createElement('div');aBarPiece.style.position='absolute';aBarPiece.style.overflow='hidden';aBarPiece.style.width=Math.round(subdivisionPixelLength)+'px';if((subdivisionIndex%2)==0){aBarPiece.className='sbBar';aBarPiece.style.left=Math.round(xPosition-xOffsetBar)+'px';}
else{aBarPiece.className='sbBarAlt';aBarPiece.style.left=Math.round(xPosition-xOffsetBarAlt)+'px';}
aBarPiece.appendChild(document.createTextNode(' '));this.graphicsContainer.appendChild(aBarPiece);if(subdivisionIndex<(this.subdivisions-1)){xPosition=((divisionIndex*this.subdivisions)+(subdivisionIndex+1))*subdivisionPixelLength;xPosition+=alignmentOffset[this.align];markerMeasure=(divisionIndex*this.subdivisions+subdivisionIndex+1)*subdivisionDisplayLength;aMarker=document.createElement('div');aMarker.className='sbMarkerMinor';aMarker.style.position='absolute';aMarker.style.overflow='hidden';aMarker.style.left=Math.round(xPosition-xOffsetMarkerMinor)+'px';aMarker.appendChild(document.createTextNode(' '));this.graphicsContainer.appendChild(aMarker);if(this.showMinorMeasures&&!this.singleLine){numbersBox=document.createElement('div');numbersBox.className='sbNumbersBox';numbersBox.style.position='absolute';numbersBox.style.overflow='hidden';numbersBox.style.textAlign='center';numbersBox.style.width=Math.round(subdivisionPixelLength*2)+'px';numbersBox.style.left=Math.round(xPosition-subdivisionPixelLength)+'px';numbersBox.appendChild(document.createTextNode(markerMeasure));this.numbersContainer.appendChild(numbersBox);}}}}
xPosition=(this.divisions*this.subdivisions)*subdivisionPixelLength;xPosition+=alignmentOffset[this.align];markerMeasure=((this.divisions*this.subdivisions)*subdivisionDisplayLength).toFixed(numDec);aMarker=document.createElement('div');aMarker.className='sbMarkerMajor';aMarker.style.position='absolute';aMarker.style.overflow='hidden';aMarker.style.left=Math.round(xPosition-xOffsetMarkerMajor)+'px';aMarker.appendChild(document.createTextNode(' '));this.graphicsContainer.appendChild(aMarker);if(!this.singleLine){numbersBox=document.createElement('div');numbersBox.className='sbNumbersBox';numbersBox.style.position='absolute';numbersBox.style.overflow='hidden';numbersBox.style.textAlign='center';if(this.showMinorMeasures){numbersBox.style.width=Math.round(subdivisionPixelLength*2)+'px';numbersBox.style.left=Math.round(xPosition-subdivisionPixelLength)+'px';}
else{numbersBox.style.width=Math.round(this.subdivisions*subdivisionPixelLength*2)+'px';numbersBox.style.left=Math.round(xPosition-(this.subdivisions*subdivisionPixelLength))+'px';}
numbersBox.appendChild(document.createTextNode(markerMeasure));this.numbersContainer.appendChild(numbersBox);}
var labelBox=document.createElement('div');labelBox.style.position='absolute';var labelText;if(this.singleLine){labelText=markerMeasure;labelBox.className='sbLabelBoxSingleLine';labelBox.style.top='-0.6em';labelBox.style.left=(xPosition+10)+'px';}
else{labelText='';labelBox.className='sbLabelBox';labelBox.style.textAlign='center';labelBox.style.width=Math.round(this.divisions*this.subdivisions*subdivisionPixelLength)+'px';labelBox.style.left=Math.round(alignmentOffset[this.align])+'px';labelBox.style.overflow='hidden';}
if(this.abbreviateLabel){labelText+=' '+displayUnitsAbbr;}
else{labelText+=' '+displayUnits;}
labelBox.appendChild(document.createTextNode(labelText));this.labelContainer.appendChild(labelBox);if(!document.styleSheets){var defaultStyle=document.createElement('style');defaultStyle.type='text/css';var styleText='.sbBar {top: 0px; background: #666666; height: 1px; border: 0;}';styleText+='.sbBarAlt {top: 0px; background: #666666; height: 1px; border: 0;}';styleText+='.sbMarkerMajor {height: 7px; width: 1px; background: #666666; border: 0;}';styleText+='.sbMarkerMinor {height: 5px; width: 1px; background: #666666; border: 0;}';styleText+='.sbLabelBox {top: -16px;}';styleText+='.sbNumbersBox {top: 7px;}';defaultStyle.appendChild(document.createTextNode(styleText));document.getElementsByTagName('head').item(0).appendChild(defaultStyle);}
this.container.appendChild(this.graphicsContainer);this.container.appendChild(this.labelContainer);this.container.appendChild(this.numbersContainer);};ScaleBarTool.prototype.place=function(elementId){if(elementId==null){document.body.appendChild(this.container);}
else{var anElement=document.getElementById(elementId);if(anElement!=null){anElement.appendChild(this.container);}}
this.update();};Fusion.Layers.Generic=OpenLayers.Class(Fusion.Layers,{arch:'Generic',sActiveLayer:null,selectionType:'INTERSECTS',bSelectionOn:false,oSelection:null,initialize:function(map,mapTag,isMapWidgetLayer){Fusion.Layers.prototype.initialize.apply(this,arguments);this._sMapname=mapTag.layerOptions['name']?mapTag.layerOptions['name']:'generic layer';this.minScale=mapTag.layerOptions.minScale?mapTag.layerOptions.minScale:1;this.maxScale=mapTag.layerOptions.maxScale?mapTag.layerOptions.maxScale:'auto';var scaleRange=new Fusion.Layers.ScaleRange({minScale:this.minScale,maxScale:this.maxScale},Fusion.Constant.LAYER_RASTER_TYPE);rootOpts={layerName:this._sMapname,resourceId:this.sMapResourceId,selectable:false,editable:false,layerTypes:[Fusion.Constant.LAYER_RASTER_TYPE],minScale:this.minScale,maxScale:this.maxScale,scaleRanges:[scaleRange],parentGroup:map.layerRoot,displayInLegend:this.bDisplayInLegend,expandInLegend:this.bExpandInLegend,legendLabel:this._sMapname,uniqueId:'layerRoot',visible:true,actuallyVisible:true};this.layerRoot=new Fusion.Layers.Layer(rootOpts,this);if(isMapWidgetLayer){this.loadMap(this.sMapResourceId);}},loadMap:function(resourceId){this.bMapLoaded=false;this.triggerEvent(Fusion.Event.LAYER_LOADING);if(this.bIsMapWidgetLayer){this.mapWidget._addWorker();}
if(this.oLayerOL){this.oLayerOL.events.unregister("loadstart",this,this.loadStart);this.oLayerOL.events.unregister("loadend",this,this.loadEnd);this.oLayerOL.events.unregister("loadcancel",this,this.loadEnd);this.oLayerOL.destroy();}
switch(this.layerType){case'Google':switch(this.mapTag.layerOptions.type){case'G_PHYSICAL_MAP':this.mapTag.layerOptions.type=G_PHYSICAL_MAP;break;case'G_HYBRID_MAP':this.mapTag.layerOptions.type=G_HYBRID_MAP;break;case'G_SATELLITE_MAP':this.mapTag.layerOptions.type=G_SATELLITE_MAP;break;case'G_NORMAL_MAP':default:this.mapTag.layerOptions.type=G_NORMAL_MAP;break;}
break;case'VirtualEarth':switch(this.mapTag.layerOptions.type){case'Aerial':this.mapTag.layerOptions.type=VEMapStyle.Aerial;break;case'Shaded':this.mapTag.layerOptions.type=VEMapStyle.Shaded;break;case'Hybrid':this.mapTag.layerOptions.type=VEMapStyle.Hybrid;break;default:this.mapTag.layerOptions.type=VEMapStyle.Road;break;}
break;case'Yahoo':switch(this.mapTag.layerOptions.type){case'YAHOO_MAP_SAT':this.mapTag.layerOptions.type=YAHOO_MAP_SAT;break;case'YAHOO_MAP_HYB':this.mapTag.layerOptions.type=YAHOO_MAP_HYB;break;case'YAHOO_MAP_REG':default:this.mapTag.layerOptions.type=YAHOO_MAP_REG;break;}
break;default:this.oLayerOL=new OpenLayers.Layer[this.layerType](this.getMapName(),this.sMapResourceId,this.mapTag.layerParams,this.mapTag.layerOptions);break;}
if(!this.oLayerOL){if(!this.mapTag.layerOptions.maxExtent){this.mapTag.layerOptions.maxExtent=new OpenLayers.Bounds(-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892);}
if(typeof this.mapTag.layerOptions.sphericalMercator=='undefined'){this.mapTag.layerOptions.sphericalMercator=true;}
if(typeof this.mapTag.layerOptions.numZoomLevels=='undefined'){this.mapTag.layerOptions.numZoomLevels=20;}
this.oLayerOL=new OpenLayers.Layer[this.layerType](this.getMapName(),this.mapTag.layerOptions);this.mapWidget.fractionalZoom=false;this.mapWidget.oMapOL.setOptions({fractionalZoom:false});}
this.oLayerOL.events.register("loadstart",this,this.loadStart);this.oLayerOL.events.register("loadend",this,this.loadEnd);this.oLayerOL.events.register("loadcancel",this,this.loadEnd);if(this.bIsMapWidgetLayer){this.mapWidget.addMap(this);this.mapWidget._removeWorker();}
window.setTimeout(OpenLayers.Function.bind(this.asyncTrigger,this),1);},asyncTrigger:function(){this.bMapLoaded=true;this.triggerEvent(Fusion.Event.LAYER_LOADED);},reloadMap:function(){this.loadMap(this.sResourceId);this.mapWidget.triggerEvent(Fusion.Event.MAP_RELOADED);this.drawMap();},drawMap:function(){if(!this.bMapLoaded){return;}
this.oLayerOL.mergeNewParams(params);},showLayer:function(layer,noDraw){this.processLayerEvents(layer,true);if(!noDraw){this.oLayerOL.setVisibility(true);}},hideLayer:function(layer,noDraw){this.processLayerEvents(layer,false);if(!noDraw){this.oLayerOL.setVisibility(false);}},showGroup:function(group,noDraw){this.processGroupEvents(group,true);},hideGroup:function(group,noDraw){this.processGroupEvents(group,false);},refreshLayer:function(layer){this.drawMap();},getLegendImageURL:function(fScale,layer,style){var url=null;return url;}});Fusion.Layers.MapGuide=OpenLayers.Class(Fusion.Layers,{arch:'MapGuide',session:[null],aShowLayers:null,aHideLayers:null,aShowGroups:null,aHideGroups:null,aRefreshLayers:null,sActiveLayer:null,selectionType:'INTERSECTS',bSelectionOn:false,oSelection:null,selectionAsOverlay:true,useAsyncOverlay:false,defaultFormat:'PNG',initialize:function(map,mapTag,isMapWidgetLayer){Fusion.Layers.prototype.initialize.apply(this,arguments);var newTheme=Fusion.getQueryParam('theme');if(newTheme!=''){this.sMapResourceId=newTheme;Fusion.queryParams['theme']=null;}
this.registerEventID(Fusion.Event.MAP_SESSION_CREATED);this.mapInfo=mapTag.mapInfo;this.imageFormat=mapTag.extension.ImageFormat?mapTag.extension.ImageFormat[0]:this.defaultFormat;this.selectionType=mapTag.extension.SelectionType?mapTag.extension.SelectionType[0]:'INTERSECTS';this.selectionColor=mapTag.extension.SelectionColor?mapTag.extension.SelectionColor[0]:'';this.selectionFormat=mapTag.extension.SelectionFormat?mapTag.extension.SelectionFormat[0]:'PNG';if(mapTag.extension.SelectionAsOverlay&&mapTag.extension.SelectionAsOverlay[0]=='false'){this.selectionAsOverlay=false;}
if(!this.bIsMapWidgetLayer){this.selectionAsOverlay=false;}
if(this.bIsMapWidgetLayer){var ctrlClickEnabled=true;if(mapTag.extension.DisableCtrlClick&&mapTag.extension.DisableCtrlClick[0]=='true'){ctrlClickEnabled=false;}
if(ctrlClickEnabled){this.map=this.mapWidget.oMapOL;this.handler=new OpenLayers.Handler.Click(this,{click:OpenLayers.Function.bind(this.mouseUpCRTLClick,this)},{keyMask:OpenLayers.Handler.MOD_CTRL});this.handler.activate();this.nTolerance=2;}}
rootOpts={displayInLegend:this.bDisplayInLegend,expandInLegend:this.bExpandInLegend,legendLabel:this._sMapname,uniqueId:'layerRoot',groupName:'layerRoot',visible:true,actuallyVisible:true};this.layerRoot=new Fusion.Layers.Group(rootOpts,this);this.keepAliveInterval=parseInt(mapTag.extension.KeepAliveInterval?mapTag.extension.KeepAliveInterval[0]:300);this.noCache=true;var sid=Fusion.sessionId;if(sid){this.session[0]=sid;this.mapSessionCreated();}else{this.createSession();}},createSession:function(){if(!this.session[0]){this.session[0]=this;var sl=Fusion.getScriptLanguage();var scriptURL='layers/'+this.arch+'/'+sl+'/CreateSession.'+sl;var options={onSuccess:OpenLayers.Function.bind(this.createSessionCB,this)};Fusion.ajaxRequest(scriptURL,options);}
if(this.session[0]instanceof Fusion.Layers.MapGuide){this.session[0].registerForEvent(Fusion.Event.MAP_SESSION_CREATED,OpenLayers.Function.bind(this.mapSessionCreated,this));}else{this.mapSessionCreated();}},createSessionCB:function(xhr){if(xhr.status==200){var o;eval('o='+xhr.responseText);this.session[0]=o.sessionId;this.triggerEvent(Fusion.Event.MAP_SESSION_CREATED);}},mapSessionCreated:function(){if(this.sMapResourceId!=''){var options={};if(this.bIsMapWidgetLayer){var showlayers=Fusion.getQueryParam('showlayers');Fusion.queryParams['showlayers']=null;var hidelayers=Fusion.getQueryParam('hidelayers');Fusion.queryParams['hidelayers']=null;var showgroups=Fusion.getQueryParam('showgroups');Fusion.queryParams['showgroups']=null;var hidegroups=Fusion.getQueryParam('hidegroups');Fusion.queryParams['hidegroups']=null;var options={showlayers:showlayers==''?[]:showlayers.split(','),hidelayers:hidelayers==''?[]:hidelayers.split(','),showgroups:showgroups==''?[]:showgroups.split(','),hidegroups:hidegroups==''?[]:hidegroups.split(',')};}
this.loadMap(this.sMapResourceId,options);}
window.setInterval(OpenLayers.Function.bind(this.pingServer,this),this.keepAliveInterval*1000);},sessionReady:function(){return(typeof this.session[0]=='string');},getSessionID:function(){return this.session[0];},loadMap:function(resourceId,options){this.bMapLoaded=false;if(!this.sessionReady()){this.sMapResourceId=resourceId;return;}
this.triggerEvent(Fusion.Event.LAYER_LOADING);this.mapWidget._addWorker();this._fScale=-1;this._nDpi=96;options=options||{};this.aShowLayers=options.showlayers||[];this.aHideLayers=options.hidelayers||[];this.aShowGroups=options.showgroups||[];this.aHideGroups=options.hidegroups||[];this.aRefreshLayers=options.refreshlayers||[];this.aLayers=[];this.oSelection=null;this.aSelectionCallbacks=[];this._bSelectionIsLoading=false;var sl=Fusion.getScriptLanguage();var loadmapScript='layers/'+this.arch+'/'+sl+'/LoadMap.'+sl;var sessionid=this.getSessionID();var params={'mapid':resourceId,"session":sessionid};var options={onSuccess:OpenLayers.Function.bind(this.mapLoaded,this),parameters:params};Fusion.ajaxRequest(loadmapScript,options);},mapLoaded:function(r){if(r.status==200){var o;eval('o='+r.responseText);this._sResourceId=o.mapId;this._sMapname=o.mapName;this._sMapTitle=o.mapTitle;this.mapWidget.setMetersPerUnit(o.metersPerUnit);this.mapWidget.setBackgroundColor(o.backgroundColor);var version=o.siteVersion;var bits=version.split('.');this.siteVersion=new Array(parseInt(bits[0]),parseInt(bits[1]),parseInt(bits[2]),parseInt(bits[3]));this.mapTag.layerOptions.maxExtent=OpenLayers.Bounds.fromArray(o.extent);this.layerRoot.clear();this.layerRoot.legendLabel=this._sMapTitle;this.layerRoot.displayInLegend=true;this.layerRoot.expandInLegend=true;this.parseMapLayersAndGroups(o);this.minScale=1.0e10;this.maxScale=0;for(var i=0;i<this.aLayers.length;i++){this.minScale=Math.min(this.minScale,this.aLayers[i].minScale);this.maxScale=Math.max(this.maxScale,this.aLayers[i].maxScale);}
if(this.minScale<=0){this.minScale=1.0;}
for(var i=0;i<this.aShowLayers.length;i++){var layer=this.layerRoot.findLayerByAttribute('layerName',this.aShowLayers[i]);if(layer){this.aShowLayers[i]=layer.uniqueId;}else{this.aShowLayers[i]='';}}
for(var i=0;i<this.aHideLayers.length;i++){var layer=this.layerRoot.findLayerByAttribute('layerName',this.aHideLayers[i]);if(layer){this.aHideLayers[i]=layer.uniqueId;}else{this.aHideLayers[i]='';}}
for(var i=0;i<this.aShowGroups.length;i++){var group=this.layerRoot.findGroupByAttribute('groupName',this.aShowGroups[i]);if(group){this.aShowGroups[i]=group.uniqueId;}else{this.aShowGroups[i]='';}}
for(var i=0;i<this.aHideGroups.length;i++){var group=this.layerRoot.findGroupByAttribute('groupName',this.aHideGroups[i]);if(group){this.aHideGroups[i]=group.uniqueId;}else{this.aHideGroups[i]='';}}
if(!this.bSingleTile){if(o.groups.length>0){this.bSingleTile=false;this.noCache=false;this.groupName=o.groups[0].groupName;this.mapWidget.registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED,OpenLayers.Function.bind(this.mapExtentsChanged,this));}else{this.bSingleTile=true;}}
this.units=Fusion.getClosestUnits(o.metersPerUnit);if(o.FiniteDisplayScales&&o.FiniteDisplayScales.length>0){this.scales=o.FiniteDisplayScales;this.mapWidget.fractionalZoom=false;this.mapWidget.oMapOL.fractionalZoom=false;}
if(this.oLayerOL){this.oLayerOL.events.unregister("loadstart",this,this.loadStart);this.oLayerOL.events.unregister("loadend",this,this.loadEnd);this.oLayerOL.events.unregister("loadcancel",this,this.loadEnd);this.oLayerOL.destroy();}
this.oLayerOL=this.createOLLayer(this._sMapname,this.bSingleTile,2);this.oLayerOL.events.register("loadstart",this,this.loadStart);this.oLayerOL.events.register("loadend",this,this.loadEnd);this.oLayerOL.events.register("loadcancel",this,this.loadEnd);this.bMapLoaded=true;if(this.bIsMapWidgetLayer){this.mapWidget.addMap(this);}}
this.mapWidget._removeWorker();this.triggerEvent(Fusion.Event.LAYER_LOADED);},reloadMap:function(){this.mapWidget._addWorker();this.aShowLayers=[];this.aHideLayers=[];this.aShowGroups=[];this.aHideGroups=[];this.aRefreshLayers=[];this.layerRoot.clear();this.oldLayers=$A(this.aLayers);this.aLayers=[];var sl=Fusion.getScriptLanguage();var loadmapScript='layers/'+this.arch+'/'+sl+'/LoadMap.'+sl;var sessionid=this.getSessionID();var params={'mapname':this._sMapname,'session':sessionid};var options={onSuccess:OpenLayers.Function.bind(this.mapReloaded,this),onException:OpenLayers.Function.bind(this.reloadFailed,this),parameters:params};Fusion.ajaxRequest(loadmapScript,options);},reloadFailed:function(r){Fusion.reportError(new Fusion.Error(Fusion.Error.FATAL,OpenLayers.i18n('mapLoadError',{'error':r.transport.responseText})));this.mapWidget._removeWorker();},loadScaleRanges:function(userFunc){var sl=Fusion.getScriptLanguage();var loadmapScript='layers/'+this.arch+'/'+sl+'/LoadScaleRanges.'+sl;var sessionid=this.getSessionID();var params={'mapname':this._sMapname,"session":sessionid};var options={onSuccess:OpenLayers.Function.bind(this.scaleRangesLoaded,this,userFunc),parameters:params};Fusion.ajaxRequest(loadmapScript,options);},scaleRangesLoaded:function(userFunc,r)
{if(r.status==200)
{var o;eval('o='+r.responseText);if(o.layers&&o.layers.length>0)
{for(var i=0;i<o.layers.length;i++)
{var oLayer=this.getLayerById(o.layers[i].uniqueId);if(oLayer)
{oLayer.scaleRanges=[];for(var j=0;j<o.layers[i].scaleRanges.length;j++)
{var scaleRange=new Fusion.Layers.ScaleRange(o.layers[i].scaleRanges[j],oLayer.layerType);oLayer.scaleRanges.push(scaleRange);}}}}
userFunc();}},mapReloaded:function(r){if(r.status==200){var o;eval('o='+r.responseText);this.parseMapLayersAndGroups(o);for(var i=0;i<this.aLayers.length;++i){var newLayer=this.aLayers[i];for(var j=0;j<this.oldLayers.length;++j){if(this.oldLayers[j].uniqueId==newLayer.uniqueId){newLayer.selectedFeatureCount=this.oldLayers[j].selectedFeatureCount;newLayer.noCache=this.oldLayers[j].noCache;break;}}}
this.oldLayers=null;this.mapWidget.triggerEvent(Fusion.Event.MAP_RELOADED);this.drawMap();}
this.mapWidget._removeWorker();},reorderLayers:function(aLayerIndex){var sl=Fusion.getScriptLanguage();var loadmapScript='layers/'+this.arch+'/'+sl+'/SetLayers.'+sl;var params={'mapname':this._sMapname,'session':this.getSessionID(),'layerindex':aLayerIndex.join()};var options={onSuccess:OpenLayers.Function.bind(this.mapLayersReset,this,aLayerIndex),parameters:params};Fusion.ajaxRequest(loadmapScript,options);},mapLayersReset:function(aLayerIndex,r){if(r.status==200){var o;eval('o='+r.responseText);if(o.success){var layerCopy=$A(this.aLayers);this.aLayers=[];this.aVisibleLayers=[];for(var i=0;i<aLayerIndex.length;++i){this.aLayers.push(layerCopy[aLayerIndex[i]]);if(this.aLayers[i].visible){this.aVisibleLayers.push(this.aLayers[i].layerName);}}
this.drawMap();this.triggerEvent(Fusion.Event.MAP_LAYER_ORDER_CHANGED);}else{alert(OpenLayers.i18n('setLayersError',{'error':o.layerindex}));}}},parseMapLayersAndGroups:function(o){for(var i=0;i<o.groups.length;i++){var group=new Fusion.Layers.Group(o.groups[i],this);var parent;if(group.parentUniqueId!=''){parent=this.layerRoot.findGroupByAttribute('uniqueId',group.parentUniqueId);}else{parent=this.layerRoot;}
parent.addGroup(group,this.bLayersReversed);}
for(var i=0;i<o.layers.length;i++){var layer=new Fusion.Layers.Layer(o.layers[i],this);var parent;if(layer.parentGroup!=''){parent=this.layerRoot.findGroupByAttribute('uniqueId',layer.parentGroup);}else{parent=this.layerRoot;}
parent.addLayer(layer,this.bLayersReversed);this.aLayers.push(layer);}},drawMap:function(){if(!this.bMapLoaded){return;}
var params={ts:(new Date()).getTime(),showLayers:this.aShowLayers.length>0?this.aShowLayers.toString():null,hideLayers:this.aHideLayers.length>0?this.aHideLayers.toString():null,showGroups:this.aShowGroups.length>0?this.aShowGroups.toString():null,hideGroups:this.aHideGroups.length>0?this.aHideGroups.toString():null,refreshLayers:this.aRefreshLayers.length>0?this.aRefreshLayers.toString():null};this.aShowLayers=[];this.aHideLayers=[];this.aShowGroups=[];this.aHideGroups=[];this.aRefreshLayers=[];this.oLayerOL.mergeNewParams(params);},drawSelection:function(){if(this.queryLayer){this.queryLayer.redraw(true);}else{this.drawMap();}},createOLLayer:function(layerName,bSingleTile,behavior){this.useAsyncOverlay=Fusion.getConfigurationItem('mapguide','useAsyncOverlay');if(!this.useAsyncOverlay){this.selectionAsOverlay=false;}
var layerOptions={units:this.units,maxResolution:'auto',useOverlay:this.selectionAsOverlay,useAsyncOverlay:this.useAsyncOverlay,ratio:this.ratio};if((behavior&1)==0&&!/WebKit/.test(navigator.userAgent)){layerOptions.transitionEffect='resize';}
if(this.scales&&this.scales.length>0){layerOptions.scales=this.scales;}
if(this.maxScale!=Infinity){layerOptions.minScale=this.maxScale;}else{if(this.mapWidget.minScale){layerOptions.minScale=this.mapWidget.maxScale;}}
if(!this.mapWidget.oMapOL.scales&&!this.scales){layerOptions.maxScale=this.minScale;}
layerOptions.singleTile=bSingleTile;OpenLayers.Util.extend(layerOptions,this.mapTag.layerOptions);var params={};if(bSingleTile){params={session:this.getSessionID(),mapname:this._sMapname,format:this.imageFormat,behavior:behavior,clientagent:this.clientAgent};params.showLayers=this.aShowLayers.length>0?this.aShowLayers.toString():null;params.hideLayers=this.aHideLayers.length>0?this.aHideLayers.toString():null;params.showGroups=this.aShowGroups.length>0?this.aShowGroups.toString():null;params.hideGroups=this.aHideGroups.length>0?this.aHideGroups.toString():null;params.refreshLayers=this.aRefreshLayers.length>0?this.aRefreshLayers.toString():null;if(behavior==5){params.selectioncolor=this.selectionColor;params.format=this.selectionFormat;layerOptions.isBaseLayer=false;}}else{params={mapdefinition:this._sResourceId,basemaplayergroupname:this.groupName,session:this.getSessionID(),clientagent:this.clientAgent};}
if(params.format&&params.format.toLowerCase().indexOf('png')>=0){layerOptions.alpha=true;}
var url;if(!bSingleTile&&layerOptions.useHttpTile){url=Fusion.getConfigurationItem('mapguide','tileCacheUrl');}else{url=Fusion.getConfigurationItem('mapguide','mapAgentUrl');}
var oLayerOL=new OpenLayers.Layer.MapGuide(layerName,url,params,layerOptions);return oLayerOL;},getLayerByName:function(name)
{var oLayer=null;for(var i=0;i<this.aLayers.length;i++)
{if(this.aLayers[i].layerName==name)
{oLayer=this.aLayers[i];break;}}
return oLayer;},getLayerById:function(id)
{var oLayer=null;for(var i=0;i<this.aLayers.length;i++)
{if(this.aLayers[i].uniqueId==id)
{oLayer=this.aLayers[i];break;}}
return oLayer;},getSelectionCB:function(userFunc,r){if(r.status==200){var o;eval("o="+r.responseText);var oSelection=new Fusion.SelectionObject(o);userFunc(oSelection);}},newSelection:function(){if(this.oSelection){this.oSelection=null;}
this.bSelectionOn=true;this.triggerEvent(Fusion.Event.MAP_SELECTION_ON);},getSelectedFeatureCount:function(){var total=0;for(var j=0;j<this.aLayers.length;++j){total+=this.aLayers[j].selectedFeatureCount;}
return total;},getSelectedLayers:function(){var layers=[];for(var j=0;j<this.aLayers.length;++j){if(this.aLayers[j].selectedFeatureCount>0){layers.push(this.aLayers[j]);}}
return layers;},getSelectableLayers:function(){var layers=[];for(var j=0;j<this.aLayers.length;++j){if(this.aLayers[j].selectable){layers.push(this.aLayers[j]);}}
return layers;},setSelection:function(selText,zoomTo){if(selText!=""&&selText!=null){this.updateSelection(selText,zoomTo,false);}
else{this.clearSelection();}},updateSelection:function(selText,zoomTo,extendSelection){this.updateMapSelection(selText,zoomTo);this.getSelectedFeatureProperties(selText);},getSelectedFeatureProperties:function(selText){this.mapWidget._addWorker();var sl=Fusion.getScriptLanguage();var getPropertiesScript='layers/'+this.arch+'/'+sl+'/GetSelectionProperties.'+sl;var params={'mapname':this.getMapName(),'session':this.getSessionID(),'selection':selText,'seq':Math.random()};var options={onSuccess:OpenLayers.Function.bind(this.processSelectedFeatureProperties,this),parameters:params};Fusion.ajaxRequest(getPropertiesScript,options);},updateMapSelection:function(selText,zoomTo){this.mapWidget._addWorker();var sl=Fusion.getScriptLanguage();var updateSelectionScript='layers/'+this.arch+'/'+sl+'/SaveSelection.'+sl;var params={'mapname':this.getMapName(),'session':this.getSessionID(),'selection':selText,'seq':Math.random(),'getextents':zoomTo?'true':'false'};var options={onSuccess:OpenLayers.Function.bind(this.renderSelection,this,zoomTo),parameters:params};Fusion.ajaxRequest(updateSelectionScript,options);},getSelection:function(userFunc,layers,startcount){if(userFunc)
{var s='layers/'+this.arch+'/'+Fusion.getScriptLanguage()+"/Selection."+Fusion.getScriptLanguage();var options={parameters:{'session':this.getSessionID(),'mapname':this._sMapname,'layers':layers,'startcount':startcount},onSuccess:OpenLayers.Function.bind(this.getSelectionCB,this,userFunc)};Fusion.ajaxRequest(s,options);}},selectionCleared:function()
{for(var j=0;j<this.aLayers.length;++j){this.aLayers[j].selectedFeatureCount=0;}
this.bSelectionOn=false;if(this.queryLayer){this.queryLayer.setVisibility(false);}
this.triggerEvent(Fusion.Event.MAP_SELECTION_OFF);this.drawMap();this.oSelection=null;},clearSelection:function(){if(this.hasSelection()){var s='layers/'+this.arch+'/'+Fusion.getScriptLanguage()+"/ClearSelection."+Fusion.getScriptLanguage();var options={parameters:{'session':this.getSessionID(),'mapname':this._sMapname},onSuccess:OpenLayers.Function.bind(this.selectionCleared,this)};Fusion.ajaxRequest(s,options);}
if(this.previousSelection!=null)
{this.previousSelection.clear();}},removeQueryLayer:function(){if(this.queryLayer){this.queryLayer.destroy();this.queryLayer=null;}},processQueryResults:function(zoomTo,r){this.renderSelection(zoomTo,r);this.processSelectedFeatureProperties(r);},processSelectedFeatureProperties:function(r){this.mapWidget._removeWorker();if(r.responseText){var oNode;eval('oNode='+r.responseText);if(oNode.hasSelection){this.newSelection();}else{this.clearSelection();return;}}},renderSelection:function(zoomTo,r){this.mapWidget._removeWorker();if(r.responseText){var oNode;eval('oNode='+r.responseText);if(oNode.hasSelection){if(this.selectionAsOverlay){if(!this.queryLayer){this.queryLayer=this.createOLLayer("query layer",true,5);this.mapWidget.oMapOL.addLayer(this.queryLayer);this.mapWidget.registerForEvent(Fusion.Event.MAP_LOADING,OpenLayers.Function.bind(this.removeQueryLayer,this));}else{this.queryLayer.setVisibility(true);}}
for(var i=0;i<oNode.layers.length;++i){var layerName=oNode.layers[i];for(var j=0;j<this.aLayers.length;++j){if(layerName==this.aLayers[j].layerName){this.aLayers[j].selectedFeatureCount=oNode[layerName].featureCount;}}}
if(zoomTo){var ext=oNode.extents;var extents=new OpenLayers.Bounds(ext.minx,ext.miny,ext.maxx,ext.maxy);this.mapWidget.setExtents(extents);}
this.drawSelection();}else{this.clearSelection();return;}}},query:function(options){this.mapWidget._addWorker();for(var j=0;j<this.aLayers.length;++j){this.aLayers[j].selectedFeatureCount=0;}
var persist=1;var layerAttributeFilter=3;var maxFeatures=options.maxFeatures;if(maxFeatures==null||maxFeatures==0)
{maxFeatures=-1;}
var r=new Fusion.Lib.MGRequest.MGQueryMapFeatures(this.getSessionID(),this._sMapname,options.geometry,maxFeatures,persist,options.selectionType||this.selectionType,options.layers,layerAttributeFilter);var callback=(options.extendSelection==true)?OpenLayers.Function.bind(this.processAndMergeFeatureInfo,this):OpenLayers.Function.bind(this.processFeatureInfo,this);Fusion.oBroker.dispatchRequest(r,OpenLayers.Function.bind(Fusion.xml2json,this,callback));},showLayer:function(layer,noDraw){this.processLayerEvents(layer,true);this.aShowLayers.push(layer.uniqueId);if(!noDraw){this.drawMap();}},hideLayer:function(layer,noDraw){this.processLayerEvents(layer,false);this.aHideLayers.push(layer.uniqueId);if(!noDraw){this.drawMap();}},sneShowLayers:function(layers,noDraw){for(var i=0;i<layers.length;i++){this.processLayerEvents(layers[i],true);this.aShowLayers.push(layers[i].uniqueId);}
if(!noDraw){this.drawMap();}},sneHideLayers:function(layers,noDraw){for(var i=0;i<layers.length;i++){this.processLayerEvents(layers[i],false);this.aHideLayers.push(layers[i].uniqueId);}
if(!noDraw){this.drawMap();}},showGroup:function(group,noDraw){this.processGroupEvents(group,true);if(group.groupName=='layerRoot'){this.oLayerOL.setVisibility(true);}else{this.aShowGroups.push(group.uniqueId);if(!noDraw){this.drawMap();}}},hideGroup:function(group,noDraw){this.processGroupEvents(group,false);if(group.groupName=='layerRoot'){this.oLayerOL.setVisibility(false);}else{this.aHideGroups.push(group.uniqueId);if(!noDraw){this.drawMap();}}},refreshLayer:function(layer){this.aRefreshLayers.push(layer.uniqueId);this.drawMap();},mouseUpCRTLClick:function(evt){if(evt.ctrlKey){var min=this.mapWidget.pixToGeo(evt.xy.x-this.nTolerance,evt.xy.y-this.nTolerance);var max=this.mapWidget.pixToGeo(evt.xy.x+this.nTolerance,evt.xy.y+this.nTolerance);if(!min){return;}
var sGeometry='POLYGON(('+min.x+' '+min.y+', '+min.x+' '+max.y+', '+max.x+' '+max.y+', '+max.x+' '+min.y+', '+min.x+' '+min.y+'))';var maxFeatures=1;var persist=0;var selection='INTERSECTS';var layerNames='';var layerAttributeFilter=3;var sep='';for(var i=0;i<this.aLayers.length;++i){layerNames+=sep+this.aLayers[i].layerName;sep=',';}
var r=new Fusion.Lib.MGRequest.MGQueryMapFeatures(this.mapWidget.getSessionID(),this._sMapname,sGeometry,maxFeatures,persist,selection,layerNames,layerAttributeFilter);var callback=OpenLayers.Function.bind(this.crtlClickDisplay,this);Fusion.oBroker.dispatchRequest(r,OpenLayers.Function.bind(Fusion.xml2json,this,callback));}},crtlClickDisplay:function(xhr){if(xhr.status==200){var o;eval('o='+xhr.responseText);var h=o['FeatureInformation']['Hyperlink'];if(h){window.open(h[0],"");}}},mapExtentsChanged:function(){if(!this.singleTile){var center=this.mapWidget.oMapOL.getCenter();var display=this.mapWidget.oMapOL.getSize();var r=new Fusion.Lib.MGRequest.MGGetVisibleMapExtent(this.mapWidget.getSessionID(),this._sMapname,center.lon,center.lat,this.mapWidget.oMapOL.getScale(),null,this._nDpi,display.w,display.h);Fusion.oBroker.dispatchRequest(r);}},pingServer:function(){var s='layers/'+this.arch+'/'+Fusion.getScriptLanguage()+"/Common."+Fusion.getScriptLanguage();var params={};params.parameters={'session':this.getSessionID()};Fusion.ajaxRequest(s,params);},getLinkParams:function(){var queryParams={};queryParams.theme=this.sMapResourceId;var showLayers=[];var hideLayers=[];for(var i=0;i<this.aLayers.length;++i){var layer=this.aLayers[i];if(layer.visible&&!layer.initiallyVisible){showLayers.push(layer.layerName);}
if(!layer.visible&&layer.initiallyVisible){hideLayers.push(layer.layerName);}}
queryParams.showlayers=showLayers.join(',');queryParams.hidelayers=hideLayers.join(',');var showGroups=[];var hideGroups=[];for(var i=0;i<this.layerRoot.groups.length;++i){var group=this.layerRoot.groups[i];if(group.visible&&!group.initiallyVisible){showGroups.push(group.groupName);}
if(!group.visible&&group.initiallyVisible){hideGroups.push(group.groupName);}}
queryParams.showgroups=showGroups.join(',');queryParams.hidegroups=hideGroups.join(',');return queryParams;},getMapTip:function(mapTipWidget){var oBroker=Fusion.oBroker;var x=mapTipWidget.oCurrentPosition.x;var y=mapTipWidget.oCurrentPosition.y;var min=this.mapWidget.pixToGeo(x-mapTipWidget.nTolerance,y-mapTipWidget.nTolerance);var max=this.mapWidget.pixToGeo(x+mapTipWidget.nTolerance,y+mapTipWidget.nTolerance);if(!min){return;}
var sGeometry='POLYGON(('+min.x+' '+min.y+', '+min.x+' '+max.y+', '+max.x+' '+max.y+', '+max.x+' '+min.y+', '+min.x+' '+min.y+'))';var maxFeatures=1;var persist=0;var selection='INTERSECTS';var layerAttributeFilter=5;var layerNames=mapTipWidget.aLayers.toString();var r=new Fusion.Lib.MGRequest.MGQueryMapFeatures(this.getSessionID(),this._sMapname,sGeometry,maxFeatures,persist,selection,layerNames,layerAttributeFilter);oBroker.dispatchRequest(r,OpenLayers.Function.bind(Fusion.xml2json,this,OpenLayers.Function.bind(this.parseMapTip,this)));},parseMapTip:function(xhr){var o;eval("tooltip="+xhr.responseText);this.oMaptip={t:"",h:""};var t=tooltip['FeatureInformation']['Tooltip'];if(t){this.oMaptip.t=t[0].replace(/\\n/g,"<br>");}
var h=tooltip['FeatureInformation']['Hyperlink'];if(h){this.oMaptip.h=h[0];}
this.mapWidget.triggerEvent(Fusion.Event.MAP_MAPTIP_REQ_FINISHED,this.oMaptip);},getLegendImageURL:function(fScale,layer,style){var url=Fusion.getConfigurationItem('mapguide','mapAgentUrl');url+="?OPERATION=GETLEGENDIMAGE&SESSION="+layer.oMap.getSessionID();url+="&VERSION=1.0.0&SCALE="+fScale;url+="&LAYERDEFINITION="+encodeURIComponent(layer.resourceId);url+="&THEMECATEGORY="+style.categoryIndex;url+="&TYPE="+style.geometryType;url+="&CLIENTAGENT="+encodeURIComponent(this.clientAgent);if(layer.noCache){url+="&TS="+(new Date()).getTime();}
return url;},processAndMergeFeatureInfo:function(r){this.processSelectedFeatureInfo(r,true);},processFeatureInfo:function(r){this.processSelectedFeatureInfo(r,false);},processSelectedFeatureInfo:function(r,mergeSelection){eval('o='+r.responseText);var newSelection=new Fusion.SimpleSelectionObject(o);if(mergeSelection==true)
{newSelection.merge(this.previousSelection);}
this.previousSelection=newSelection;var selText=newSelection.getSelectionXml();this.setSelection(selText,false);this.mapWidget._removeWorker();}});Fusion.SimpleSelectionObject=OpenLayers.Class({aLayers:null,nLayers:0,initialize:function(featureInfoResponse)
{this.aLayers=[];this.nLayers=0;try
{var layers=featureInfoResponse.FeatureInformation.FeatureSet[0].Layer;if(layers!=null)
{for(var i=0;i<layers.length;i++)
{var layerId=o['FeatureInformation']['FeatureSet'][0]['Layer'][i]['@id'][0];var classElt=o['FeatureInformation']['FeatureSet'][0]['Layer'][i]['Class'][0];var className=o['FeatureInformation']['FeatureSet'][0]['Layer'][i]['Class'][0]['@id'][0];var layer=new Fusion.SimpleSelectionObject.Layer(layerId,className);this.addLayer(layer);var features=classElt.ID;for(var j=0;j<features.length;j++)
{layer.addFeature(features[j]);}}}}
catch(e){}},addLayer:function(layer)
{this.aLayers[this.nLayers]=layer;this.nLayers++;},getNumLayers:function()
{return this.nLayers;},getLayerByName:function(name)
{var oLayer=null;for(var i=0;i<this.nLayers;i++)
{if(this.aLayers[i].getName()==name)
{oLayer=this.aLayers[i];break;}}
return oLayer;},getLayer:function(iIndice)
{if(iIndice>=0&&iIndice<this.nLayers)
{return this.aLayers[iIndice];}
else
{return null;}},getSelectionXml:function()
{var xmlSelection="";if(this.nLayers>0)
{xmlSelection="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<FeatureSet>\n";for(var i=0;i<this.nLayers;i++)
{var layer=this.aLayers[i];xmlSelection+="<Layer id=\""+layer.getName()+"\">\n";xmlSelection+="<Class id=\""+layer.getClassName()+"\">\n";for(var j=0;j<layer.getNumFeatures();j++)
{var featId=layer.featIds[j];xmlSelection+="<ID>"+featId+"</ID>\n";}
xmlSelection+="</Class>\n</Layer>\n";}
xmlSelection+="</FeatureSet>\n";}
return xmlSelection;},merge:function(previousSelection)
{if(previousSelection!=null&&previousSelection.nLayers>0)
{for(var prevSelIndex=0;prevSelIndex<previousSelection.nLayers;prevSelIndex++)
{var prevSelLayer=previousSelection.aLayers[prevSelIndex];var currentLayer=this.getLayerByName(prevSelLayer.getName());if(currentLayer!=null)
{for(var j=0;j<prevSelLayer.getNumFeatures();j++)
{var prevSelFeatureIndexes=currentLayer.featIds.find(prevSelLayer.featIds[j]);if(prevSelFeatureIndexes==null)
{currentLayer.addFeature(prevSelLayer.featIds[j]);}
else
{currentLayer.removeFeatures(prevSelFeatureIndexes);}}
if(currentLayer.featIds.length==0)
{this.clear();}}
else
{var missingLayer=new Fusion.SimpleSelectionObject.Layer(prevSelLayer.getName(),prevSelLayer.getClassName());for(var k=0;k<prevSelLayer.getNumFeatures();k++)
{missingLayer.addFeature(prevSelLayer.featIds[k]);}
this.addLayer(missingLayer);}}}},clear:function()
{this.aLayers=[];this.nLayers=0;}});Fusion.SimpleSelectionObject.Layer=OpenLayers.Class({name:"",className:"",featIds:null,nFeatures:0,initialize:function(layerName,className)
{this.name=layerName;this.className=className;this.nFeatures=0;this.featIds=[];},addFeature:function(featId)
{this.featIds[this.nFeatures]=featId;this.nFeatures++;},getName:function()
{return this.name;},getClassName:function()
{return this.className;},getNumFeatures:function()
{return this.nFeatures;},removeFeatures:function(featureIndexes)
{var numIndexes=featureIndexes.length;for(var featIndex=0;featIndex<numIndexes;featIndex++)
{this.featIds.remove(featureIndexes[featIndex]);this.nFeatures--;}}});Array.prototype.find=function(searchStr){var returnArray=null;for(i=0;i<this.length;i++){if(typeof(searchStr)=='function'){if(searchStr.test(this[i])){if(!returnArray){returnArray=[]}
returnArray.push(i);}}else{if(this[i]===searchStr){if(!returnArray){returnArray=[]}
returnArray.push(i);}}}
return returnArray;};Array.prototype.remove=function(indexToRemove){this.splice(indexToRemove,1);};Fusion.Event.MAP_LAYER_ORDER_CHANGED=Fusion.Event.lastEventId++;Fusion.Layers.MapServer=OpenLayers.Class(Fusion.Layers,{arch:'MapServer',session:[null],sActiveLayer:null,selectionType:'INTERSECTS',bSelectionOn:false,oSelection:null,bLayersReversed:true,mapMetadataKeys:null,layerMetadataKeys:null,oMaptip:null,bMapTipFired:false,sMapFile:null,initialize:function(map,mapTag,isMapWidgetLayer){Fusion.Layers.prototype.initialize.apply(this,arguments);this.registerEventID(Fusion.Event.MAP_SESSION_CREATED);this.sMapFile=mapTag.extension.MapFile?mapTag.extension.MapFile[0]:'';var newTheme=Fusion.getQueryParam('theme');if(newTheme!=''){this.sMapFile=newTheme;Fusion.queryParams['theme']=null;}
this.mapMetadataKeys=mapTag.extension.MapMetadata?mapTag.extension.MapMetadata[0]:null;this.layerMetadataKeys=mapTag.extension.LayerMetadata?mapTag.extension.LayerMetadata[0]:null;rootOpts={displayInLegend:this.bDisplayInLegend,expandInLegend:this.bExpandInLegend,legendLabel:this._sMapname,uniqueId:'layerRoot',groupName:'layerRoot',visible:true,actuallyVisible:true};this.layerRoot=new Fusion.Layers.Group(rootOpts,this);this.keepAliveInterval=parseInt(mapTag.extension.KeepAliveInterval?mapTag.extension.KeepAliveInterval[0]:300);this.noCache=true;if(mapTag.sid){this.session[0]=mapTag.sid;this.mapSessionCreated();}else{this.createSession();}},createSession:function(){if(!this.session[0]){this.session[0]=this;var sl=Fusion.getScriptLanguage();var scriptURL='layers/'+this.arch+'/'+sl+'/CreateSession.'+sl;var options={onSuccess:OpenLayers.Function.bind(this.createSessionCB,this)};Fusion.ajaxRequest(scriptURL,options);}
if(this.session[0]instanceof Fusion.Layers.MapServer){this.session[0].registerForEvent(Fusion.Event.MAP_SESSION_CREATED,OpenLayers.Function.bind(this.mapSessionCreated,this));}else{this.mapSessionCreated();}},createSessionCB:function(r){if(r.status==200){var o;eval('o='+r.responseText);this.session[0]=o.sessionId;this.triggerEvent(Fusion.Event.MAP_SESSION_CREATED);}},mapSessionCreated:function(){if(this.sMapFile!=''){this.loadMap(this.sMapFile);}
window.setInterval(OpenLayers.Function.bind(this.pingServer,this),this.keepAliveInterval*1000);},sessionReady:function(){return(typeof this.session[0]=='string');},getSessionID:function(){return this.session[0];},loadMap:function(mapfile,options){while(this.mapWidget.isBusy()){this.mapWidget._removeWorker();}
this.bMapLoaded=false;if(this._sMapFile==mapfile){return;}
if(!this.sessionReady()){this.sMapFile=mapfile;return;}
this.triggerEvent(Fusion.Event.LAYER_LOADING);this.mapWidget._addWorker();this._fScale=-1;this._nDpi=72;options=options||{};this.aVisibleLayers=options.showlayers||[];this.aVisibleGroups=options.showgroups||[];this.aLayers=[];this.oSelection=null;this.aSelectionCallbacks=[];this._bSelectionIsLoading=false;var sl=Fusion.getScriptLanguage();var loadmapScript='layers/'+this.arch+'/'+sl+'/LoadMap.'+sl;var params={'mapfile':mapfile,'session':this.getSessionID()};if(this.mapMetadataKeys){params.map_metadata=this.mapMetadataKeys;}
if(this.layerMetadataKeys){params.layer_metadata=this.layerMetadataKeys;}
var options={onSuccess:OpenLayers.Function.bind(this.mapLoaded,this),parameters:params};Fusion.ajaxRequest(loadmapScript,options);},mapLoaded:function(r){if(r.status==200)
{var o;eval('o='+r.responseText);this._sMapFile=o.mapId;this._sMapname=o.mapName;this._sMapTitle=o.mapTitle;this._sImageType=o.imagetype;this.metadata=o.metadata;if(o.projString.length>0){var epsg=o.projString.indexOf("init=");if(epsg>=0){this.projCode=o.projString.substring(epsg+5).toUpperCase();}else{this.projCode=o.mapName.toUpperCase();Proj4js.defs[this.projCode]=o.projString;}}
if(this.projCode){this.mapWidget.setProjection(this.projCode);}
this.mapWidget.setMetersPerUnit(o.metersPerUnit);this.mapTag.layerOptions.maxExtent=OpenLayers.Bounds.fromArray(o.extent);this.layerRoot.clear();this.layerRoot.legendLabel=this._sMapTitle;this.layerRoot.displayInLegend=true;this.layerRoot.expandInLegend=true;this.parseMapLayersAndGroups(o);var minScale=1.0e10;var maxScale=0;for(var i=0;i<this.aLayers.length;i++){if(this.aLayers[i].visible){this.aVisibleLayers.push(this.aLayers[i].layerName);}
minScale=Math.min(minScale,this.aLayers[i].minScale);maxScale=Math.max(maxScale,this.aLayers[i].maxScale);}
if(minScale<=0){minScale=1.0;}
if(o.dpi){OpenLayers.DOTS_PER_INCH=o.dpi;}
this.units=Fusion.getClosestUnits(o.metersPerUnit);var layerOptions={singleTile:true,ratio:this.ratio,units:this.units,maxResolution:'auto',minScale:maxScale,maxScale:minScale};OpenLayers.Util.extend(layerOptions,this.mapTag.layerOptions);var params={layers:this.aVisibleLayers.join(' '),session:this.getSessionID(),map:this._sMapFile,map_imagetype:this.sImageType};OpenLayers.Util.extend(params,this.mapTag.layerParams);if(this.oLayerOL){this.oLayerOL.events.unregister("loadstart",this,this.loadStart);this.oLayerOL.events.unregister("loadend",this,this.loadEnd);this.oLayerOL.events.unregister("loadcancel",this,this.loadEnd);this.oLayerOL.destroy();}
var url=Fusion.getConfigurationItem('mapserver','cgi');this.oLayerOL=new OpenLayers.Layer.MapServer(o.mapName,url,params,layerOptions);this.oLayerOL.events.register("loadstart",this,this.loadStart);this.oLayerOL.events.register("loadend",this,this.loadEnd);this.oLayerOL.events.register("loadcancel",this,this.loadEnd);if(this.bIsMapWidgetLayer){this.mapWidget.addMap(this);this.mapWidget.oMapOL.units=this.oLayerOL.units;}
this.bMapLoaded=true;}
else
{Fusion.reportError(new Fusion.Error(Fusion.Error.FATAL,'Failed to load requested map:\n'+r.responseText));}
this.mapWidget._removeWorker();this.triggerEvent(Fusion.Event.LAYER_LOADED);},reloadMap:function(){this.mapWidget._addWorker();this.aVisibleLayers=[];this.aVisibleGroups=[];this.layerRoot.clear();this.aLayers=[];var sl=Fusion.getScriptLanguage();var loadmapScript='layers/'+this.arch+'/'+sl+'/LoadMap.'+sl;var params={'mapname':this._sMapname,'session':this.getSessionID()};if(this.mapMetadataKeys){params.map_metadata=this.mapMetadataKeys;}
if(this.layerMetadataKeys){params.layer_metadata=this.layerMetadataKeys;}
var options={onSuccess:OpenLayers.Function.bind(this.mapReloaded,this),parameters:params};Fusion.ajaxRequest(loadmapScript,options);},loadScaleRanges:function(userFunc){var sl=Fusion.getScriptLanguage();var loadmapScript='layers/'+this.arch+'/'+sl+'/LoadScaleRanges.'+sl;var sessionid=this.getSessionID();var params={'mapname':this._sMapname,"session":this.getSessionID()};var options={onSuccess:OpenLayers.Function.bind(this.scaleRangesLoaded,this,userFunc),parameters:params};Fusion.ajaxRequest(loadmapScript,options);},scaleRangesLoaded:function(userFunc,r)
{if(r.status==200)
{var o;eval('o='+r.responseText);if(o.layers&&o.layers.length>0)
{for(var i=0;i<o.layers.length;i++)
{var oLayer=this.getLayerById(o.layers[i].uniqueId);if(oLayer)
{oLayer.scaleRanges=[];for(var j=0;j<o.layers[i].scaleRanges.length;j++)
{var scaleRange=new Fusion.Layers.ScaleRange(o.layers[i].scaleRanges[j],oLayer.layerType);oLayer.scaleRanges.push(scaleRange);}}}}
userFunc();}},mapReloaded:function(r){if(r.status==200){var o;eval('o='+r.responseText);this.parseMapLayersAndGroups(o);this.aVisibleLayers=[];for(var i=0;i<this.aLayers.length;i++){if(this.aLayers[i].visible){this.aVisibleLayers.push(this.aLayers[i].layerName);}}
this.drawMap();this.mapWidget.triggerEvent(Fusion.Event.MAP_RELOADED);}else{Fusion.reportError(new Fusion.Error(Fusion.Error.FATAL,OpenLayers.i18n('mapLoadError',{'error':r.responseText})));}
this.mapWidget._removeWorker();},reorderLayers:function(aLayerIndex){var sl=Fusion.getScriptLanguage();var loadmapScript='layers/'+this.arch+'/'+sl+'/SetLayers.'+sl;var params={'mapname':this._sMapname,'session':this.getSessionID(),'layerindex':aLayerIndex.join()};var options={onSuccess:OpenLayers.Function.bind(this.mapLayersReset,this,aLayerIndex),parameters:params};Fusion.ajaxRequest(loadmapScript,options);},mapLayersReset:function(aLayerIndex,r){if(r.status==200){var o;eval('o='+r.responseText);if(o.success){var layerCopy=$A(this.aLayers);var nLayers=layerCopy.length-1;aLayerIndex.reverse();this.aLayers=[];this.aVisibleLayers=[];for(var i=0;i<aLayerIndex.length;++i){this.aLayers.push(layerCopy[nLayers-aLayerIndex[i]]);if(this.aLayers[i].visible){this.aVisibleLayers.push(this.aLayers[i].layerName);}}
this.drawMap();this.triggerEvent(Fusion.Event.MAP_LAYER_ORDER_CHANGED);}}},parseMapLayersAndGroups:function(o){for(var i=0;i<o.groups.length;i++){var group=new Fusion.Layers.Group(o.groups[i],this);var parent;if(group.parentUniqueId!=''){parent=this.layerRoot.findGroup(group.parentUniqueId);}else{parent=this.layerRoot;}
parent.addGroup(group,this.bLayersReversed);}
for(var i=0;i<o.layers.length;i++){var layer=new Fusion.Layers.Layer(o.layers[i],this);var parent;if(layer.parentGroup!=''){parent=this.layerRoot.findGroup(layer.parentGroup);}else{parent=this.layerRoot;}
parent.addLayer(layer,this.bLayersReversed);this.aLayers.push(layer);}},getScale:function(){return this.mapWidget.getScale();},updateLayer:function(){if(this.hasSelection()){this.oLayerOL.addOptions({queryfile:this._sQueryfile});}},drawMap:function(){if(!this.bMapLoaded||this.deferredDraw){return;}
var aLayers=[];for(var i=0;i<this.aLayers.length;i++){var l=this.aLayers[i];if(l.isVisible()){aLayers.push(l.layerName);}}
var params={layers:aLayers.join(' '),ts:(new Date()).getTime()};if(this.hasSelection()){params['queryfile']=this._sQueryfile;}else{params['queryfile']='';}
this.oLayerOL.mergeNewParams(params);},showLayer:function(sLayer){this.aVisibleLayers.push(sLayer.layerName);this.drawMap();},hideLayer:function(sLayer){for(var i=0;i<this.aLayers.length;i++){if(this.aVisibleLayers[i]==sLayer.layerName){this.aVisibleLayers.splice(i,1);break;}}
this.drawMap();},showGroup:function(group,noDraw){this.processGroupEvents(group,true);if(group.groupName=='layerRoot'){this.oLayerOL.setVisibility(true);}else{this.aVisibleGroups.push(group.uniqueId);this.deferredDraw=true;for(var i=0;i<group.layers.length;++i){if(group.layers[i].wasVisibleInGroup){group.layers[i].show();}
group.layers[i].wasVisibleInGroup=null;}
this.deferredDraw=false;this.drawMap();}},hideGroup:function(group,noDraw){this.processGroupEvents(group,false);if(group.groupName=='layerRoot'){this.oLayerOL.setVisibility(false);}else{for(var i=0;i<this.aVisibleGroups.length;i++){if(this.aVisibleGroups[i]==group.uniqueId){this.aVisibleGroups.splice(i,1);break;}}
this.deferredDraw=true;for(var i=0;i<group.layers.length;++i){if(group.layers[i].visible){group.layers[i].wasVisibleInGroup=true;group.layers[i].hide();}}
this.deferredDraw=false;this.drawMap();}},showGroupOLD:function(sGroup){if(sGroup=='layerRoot'){this.oLayerOL.setVisibility(true);}else{this.aVisibleGroups.push(sGroup);var group=this.layerRoot.findGroup(sGroup);this.deferredDraw=true;for(var i=0;i<group.layers.length;++i){group.layers[i].show();}
this.deferredDraw=false;this.drawMap();}},hideGroupOLD:function(sGroup){if(sGroup=='layerRoot'){this.oLayerOL.setVisibility(false);}else{for(var i=0;i<this.aVisibleGroups.length;i++){if(this.aVisibleGroups[i]==sGroup){this.aVisibleGroups.splice(i,1);break;}}
var group=this.layerRoot.findGroup(sGroup);this.deferredDraw=true;for(var i=0;i<group.layers.length;++i){group.layers[i].hide();}
this.deferredDraw=false;this.drawMap();}},refreshLayer:function(sLayer){this.drawMap();},hasSelection:function(){return this.bSelectionOn;},getSelectionCB:function(userFunc,r){if(r.status==200){var o;eval("o="+r.responseText);var oSelection=new Fusion.SelectionObject(o);userFunc(oSelection);}},newSelection:function(){this.bSelectionOn=true;this.drawMap();this.triggerEvent(Fusion.Event.MAP_SELECTION_ON);},getSelectedFeatureCount:function(){var total=0;for(var j=0;j<this.aLayers.length;++j){total+=this.aLayers[j].selectedFeatureCount;}
return total;},getSelectedLayers:function(){var layers=[];for(var j=0;j<this.aLayers.length;++j){if(this.aLayers[j].selectedFeatureCount>0){layers.push(this.aLayers[j]);}}
return layers;},getSelectableLayers:function(){var layers=[];for(var j=0;j<this.aLayers.length;++j){if(this.aLayers[j].selectable){layers.push(this.aLayers[j]);}}
return layers;},getSelection:function(userFunc,layers,startcount){if(userFunc)
{var s='layers/'+this.arch+'/'+Fusion.getScriptLanguage()+"/Selection."+Fusion.getScriptLanguage();var params={'mapname':this._sMapname,'session':this.getSessionID(),'layers':layers,'startcount':startcount,'queryfile':this._sQueryfile};var options={parameters:params,onSuccess:OpenLayers.Function.bind(this.getSelectionCB,this,userFunc)};Fusion.ajaxRequest(s,options);}},clearSelection:function(){if(!this.aLayers)return;for(var j=0;j<this.aLayers.length;++j){this.aLayers[j].selectedFeatureCount=0;}
this.bSelectionOn=false;this._sQueryfile="";this.triggerEvent(Fusion.Event.MAP_SELECTION_OFF);this.drawMap();this.oSelection=null;},processQueryResults:function(zoomTo,r){this.mapWidget._removeWorker();if(r.status==200){var o;eval("o="+r.responseText);if(!o.hasSelection){return;}else{this._sQueryfile=o.queryFile;for(var i=0;i<o.layers.length;++i){var layerName=o.layers[i];for(var j=0;j<this.aLayers.length;++j){if(layerName==this.aLayers[j].layerName){this.aLayers[j].selectedFeatureCount=o[layerName].featureCount;}}}
this.newSelection();if(zoomTo){var ext=oNode.extents;var extents=new OpenLayers.Bounds(ext.minx,ext.miny,ext.maxx,ext.maxy);this.zoomToSelection(extents);}}}},query:function(options){this.mapWidget._addWorker();for(var j=0;j<this.aLayers.length;++j){this.aLayers[j].selectedFeatureCount=0;}
var bPersistant=options.persistent||true;var layers=options.layers||'';if(layers==''){layers=this.aVisibleLayers.join(',');}
var zoomTo=options.zoomTo||false;var sl=Fusion.getScriptLanguage();var queryScript='layers/'+this.arch+'/'+sl+'/Query.'+sl;var params={'mapname':this._sMapname,'session':this.getSessionID(),'spatialfilter':options.geometry||'','maxfeatures':options.maxFeatures||-1,'layers':layers,'variant':options.selectionType||this.selectionType};if(options.filter){params.filter=options.filter;}
if(options.extendSelection){params.extendselection=true;}
if(options.computedProperties){params.computed=true;}
var ajaxOptions={onSuccess:OpenLayers.Function.bind(this.processQueryResults,this,zoomTo),parameters:params};Fusion.ajaxRequest(queryScript,ajaxOptions);},pingServer:function(){var s='layers/'+this.arch+'/'+Fusion.getScriptLanguage()+"/Common."+Fusion.getScriptLanguage();var params={};params.parameters={'session':this.getSessionID()};Fusion.ajaxRequest(s,params);},getGroupInfoUrl:function(groupName){return null;},getLayerInfoUrl:function(layerName){return null;},getLayerById:function(id)
{var oLayer=null;for(var i=0;i<this.aLayers.length;i++)
{if(this.aLayers[i].uniqueId==id)
{oLayer=this.aLayers[i];break;}}
return oLayer;},getMetadata:function(key){if(typeof this.metadata[key]!='undefined'){return this.metadata[key];}else{return'';}},getLegendImageURL:function(fScale,layer,style){var sl=Fusion.getScriptLanguage();var url=Fusion.getFusionURL()+'/layers/'+this.arch+'/'+sl+'/LegendIcon.'+sl;var sessionid=this.getSessionID();var params='mapname='+this._sMapname+"&session="+sessionid+'&layername='+layer.resourceId+'&classindex='+style.index;return url+'?'+params;},getMapTip:function(oMapTips){if(this.bMapTipFired==false){var pos=this.mapWidget.pixToGeo(oMapTips.oCurrentPosition.x,oMapTips.oCurrentPosition.y);var dfGeoTolerance=this.mapWidget.pixToGeoMeasure(oMapTips.nTolerance);var minx=pos.x-dfGeoTolerance;var miny=pos.y-dfGeoTolerance;var maxx=pos.x+dfGeoTolerance;var maxy=pos.y+dfGeoTolerance;var geometry='POLYGON(('+minx+' '+miny+', '+minx+' '+maxy+', '+maxx+' '+maxy+', '+maxx+' '+miny+', '+minx+' '+miny+'))';var selectionType="INTERSECTS";var loadmapScript='/layers/'+this.arch+'/php/Maptip.php';var params={'mapname':this._sMapname,'session':this.getSessionID(),'spatialfilter':geometry,'maxfeatures':0,'variant':selectionType,'layer':oMapTips.aLayers||'','textfield':oMapTips.aTextFields||'','label':oMapTips.aLabels||'','customURL':oMapTips.aCustomURL||''}
var parseMapTip=this.parseMapTip.bind(this);this.bMapTipFired=true;var ajaxOptions={onSuccess:function(response){eval("rjson="+response.responseText);parseMapTip(rjson);},parameters:params};Fusion.ajaxRequest(loadmapScript,ajaxOptions);}},parseMapTip:function(json){this.bMapTipFired=false;this.oMaptip={};this.oMaptip.t=json.maptips;this.oMaptip.h=json.url;this.oMaptip.l=json.label;this.mapWidget.triggerEvent(Fusion.Event.MAP_MAPTIP_REQ_FINISHED,this.oMaptip);}});var MSLAYER_POINT_TYPE=0;var MSLAYER_LINE_TYPE=1;var MSLAYER_POLYGON_TYPE=2;var MSLAYER_SOLID_TYPE=3;var MSLAYER_RASTER_TYPE=4;
