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 scriptName=OpenLayers._scriptName;var scripts=document.getElementsByTagName('script');for(var i=0;i<scripts.length;i++){var src=scripts[i].getAttribute('src');if(src){var index=src.lastIndexOf(scriptName);var pathLength=src.lastIndexOf('?');if(pathLength<0){pathLength=src.length;}
if((index>-1)&&(index+scriptName.length==pathLength)){scriptLocation=src.slice(0,pathLength-scriptName.length);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/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/MultiMap.js","OpenLayers/Layer/Markers.js","OpenLayers/Layer/Text.js","OpenLayers/Layer/WorldWind.js","OpenLayers/Layer/WMS.js","OpenLayers/Layer/WMS/Untiled.js","OpenLayers/Layer/GeoRSS.js","OpenLayers/Layer/Boxes.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/OrigDrag.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/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/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/VML.js","OpenLayers/Layer/Vector.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/Format.js","OpenLayers/Format/XML.js","OpenLayers/Format/GML.js","OpenLayers/Format/KML.js","OpenLayers/Format/GeoRSS.js","OpenLayers/Format/WFS.js","OpenLayers/Format/WKT.js","OpenLayers/Format/OSM.js","OpenLayers/Format/SLD.js","OpenLayers/Format/SLD/v1.js","OpenLayers/Format/SLD/v1_0_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/Layer/WFS.js","OpenLayers/Control/MouseToolbar.js","OpenLayers/Control/NavToolbar.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;i<jsfiles.length;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="$Revision: 6819 $";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.Util={};OpenLayers.Util.getElement=function(){var elements=[];for(var i=0,len=arguments.length;i<len;i++){var element=arguments[i];if(typeof element=='string'){element=document.getElementById(element);}
if(arguments.length==1){return element;}
elements.push(element);}
return elements;};OpenLayers.Util.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&&(px.x||px.x==0)&&(px.y||px.y==0)){element.style.left=px.x+"px";element.style.top=px.y+"px";}
if(sz){element.style.width=((sz.w>0)?sz.w:0)+"px";element.style.height=((sz.h>0)?sz.h:0)+"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.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.getTime=function(){var ms=(new Date()).getTime();return ms/1000.0;};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.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.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.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.getIEVersion=function(){var rv=-1;if(navigator.appName=='Microsoft Internet Explorer'){var ua=navigator.userAgent;var re=new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");if(re.exec(ua)!=null)
rv=parseFloat(RegExp.$1);}
return rv;}
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.getDivPosition=function(div,stopAt)
{var x=div;var divObjLeft=x.offsetLeft;var divObjTop=x.offsetTop;while(x.offsetParent!=stopAt&&x.offsetParent!=null)
{var divObjParent=x.offsetParent;divObjLeft+=divObjParent.offsetLeft;divObjTop+=divObjParent.offsetTop;x=divObjParent;}
return new OpenLayers.Pixel(divObjLeft,divObjTop);};OpenLayers.Util.smooth=function(lonlat,map)
{var prec=map.getResolution();var ret=new OpenLayers.LonLat(Math.round(lonlat.lon*prec)/prec,Math.round(lonlat.lat*prec)/prec);return ret;};OpenLayers.Util.changeImageName=function(old_path,new_name)
{var toks=old_path.split("/");toks.pop();return toks.join("/")+"/"+new_name;};OpenLayers.Util.eventGetMousePosition=function(evt)
{return new OpenLayers.Pixel((evt.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))
-(document.documentElement.clientLeft||0),(evt.clientY+(document.documentElement.scrollTop||document.body.scrollTop))
-(document.documentElement.clientTop||0));};OpenLayers.Util.getDivSize=function(div)
{return new OpenLayers.Size(div.clientWidth,div.clientHeight);};OpenLayers.Util.eventMouseIn=function(evt,_div,opts)
{var div=(_div)?_div:OpenLayers.Event.element(evt);var dp=(opts&&opts.dp)?opts.dp:OpenLayers.Util.getDivPosition(div);var dsz=(opts&&opts.dsz)?opts.dsz:OpenLayers.Util.getDivSize(div);var mp=(opts&&opts.mp)?opts.mp:OpenLayers.Util.eventGetMousePosition(evt);if(mp.x<(dp.x)||mp.y<(dp.y)||mp.x>(dp.x+dsz.w)||mp.y>(dp.y+dsz.h))
return 0;return 1;};OpenLayers.Util.distKm=function(pa,pb)
{return OpenLayers.Util.distInches(pa,pb)/39370.0787;};OpenLayers.Util.distInches=function(pa,pb)
{var R=251106299;var dLat=(pb.lat-pa.lat)*Math.PI/180;var dLon=(pb.lon-pa.lon)*Math.PI/180;var lat1=pa.lat*Math.PI/180,lat2=pb.lat*Math.PI/180;var a=Math.sin(dLat/2)*Math.sin(dLat/2)+
Math.cos(lat1)*Math.cos(lat2)*Math.sin(dLon/2)*Math.sin(dLon/2);var c=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));var d=R*c;return d;};OpenLayers.Util.setOpacity=function(obj,opacity)
{opacity=(opacity==100)?99.999:opacity;obj.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+opacity+");";obj.style.KHTMLOpacity=opacity/100;obj.style.MozOpacity=opacity/100;obj.style.opacity=opacity/100;};OpenLayers.Util.getDivsDown=function(idiv)
{var allDivs=[];var queue=[[],[]];var cur=0;queue[cur].push(idiv);while(queue[cur].length)
{var nxt=(cur)?0:1;queue[nxt]=[];for(var i=0;i<queue[cur].length;i++)
{var div=queue[cur][i];allDivs.push(div);for(var j=0;j<div.childNodes.length;j++)
queue[nxt].push(div.childNodes[j]);}
cur=nxt;}
return allDivs;};OpenLayers.Util.disableSelection=function(target,opts)
{if(typeof target.onselectstart!='undefined')
target.onselectstart=function(){return false;};else if(typeof target.style.MozUserSelect!='undefined')
target.style.MozUserSelect='none';else if(!opts||(!opts.noMouseDown||opts.noMouseDown==false))
target.onmousedown=function(){return false;};};OpenLayers.Util.disableSelectionDown=function(target,opts)
{if(target==null)
return;var allDivs=OpenLayers.Util.getDivsDown(target);for(var i=0;i<allDivs.length;i++)
{if(!allDivs[i]||!allDivs[i].tagName)
continue;var tag=allDivs[i].tagName.toLowerCase();if(tag!="div"&&tag!="span")
continue;OpenLayers.Util.disableSelection(allDivs[i],opts);}};OpenLayers.Util.blockEvent=function(target,evt)
{OpenLayers.Event.observe(target,evt,function(e){OpenLayers.Event.stop(e);return false;});};OpenLayers.Util.blockEventDown=function(target,evt)
{if(target==null)
return;var allDivs=OpenLayers.Util.getDivsDown(target);for(var i=0;i<allDivs.length;i++)
{if(!allDivs[i]||!allDivs[i].tagName)
continue;var tag=allDivs[i].tagName.toLowerCase();if(tag!="div"&&tag!="span")
continue;OpenLayers.Util.blockEvent(allDivs[i],evt);}};OpenLayers.Util.qs_swap=function(array,ia,ib)
{var tmp=array[ia];array[ia]=array[ib];array[ib]=tmp;};OpenLayers.Util.qs_partition=function(array,begin,end,pivot)
{var piv=array[pivot]._sortItem;OpenLayers.Util.qs_swap(array,pivot,end-1);var store=begin;var ix;for(ix=begin;ix<end-1;++ix){if(array[ix]._sortItem<=piv){OpenLayers.Util.qs_swap(array,store,ix);++store;}}
OpenLayers.Util.qs_swap(array,end-1,store);return store;};OpenLayers.Util.qs_main=function(array,begin,end)
{if(end-1>begin){var pivot=begin+Math.floor(Math.random()*(end-begin));pivot=OpenLayers.Util.qs_partition(array,begin,end,pivot);OpenLayers.Util.qs_main(array,begin,pivot);OpenLayers.Util.qs_main(array,pivot+1,end);}};OpenLayers.Util.quickSort=function(array)
{OpenLayers.Util.qs_main(array,0,array.length);};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.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.Size=OpenLayers.Class({w:0.0,h:0.0,initialize:function(w,h){this.w=parseFloat(w);this.h=parseFloat(h);},toString:function(){return("w="+this.w+",h="+this.h);},clone:function(){return new OpenLayers.Size(this.w,this.h);},equals:function(sz){var equals=false;if(sz!=null){equals=((this.w==sz.w&&this.h==sz.h)||(isNaN(this.w)&&isNaN(this.h)&&isNaN(sz.w)&&isNaN(sz.h)));}
return equals;},CLASS_NAME:"OpenLayers.Size"});OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(error){alert(error);},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"};(function(){var scripts=document.getElementsByTagName("script");for(var i=0,len=scripts.length;i<len;++i){if(scripts[i].src.indexOf("firebug.js")!=-1){if(console){OpenLayers.Util.extend(OpenLayers.Console,console);break;}}}})();OpenLayers.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.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&&maxExtent.CLASS_NAME=="OpenLayers.LonLat")
{var cLon=maxExtent.lon;var tLon=newLonLat.lon-cLon;var lonOffset=Math.floor(Math.abs(tLon)/GenieMap.distanceAroundEarth+0.5);if(tLon<0)lonOffset=-lonOffset;err(lonOffset+" "+GenieMap.distanceAroundEarth);newLonLat.lon-=lonOffset*GenieMap.distanceAroundEarth;}
else 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.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.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.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.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.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.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.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,nativeRes:null,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.baseRes=this.layer.map.getResolution();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.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:2.0,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:20,paddingForPopups:null,firstForceZoom:true,layerContainerOffset: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);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.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});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();try{popupDiv=popupDiv[0];}catch(e){}
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(evt){this.events.clearMouseCache();var oldSize=this.getSize();var newSize=this.getCurrentSize();if(oldSize==null||this.getCenter()==null||(oldSize&&(isNaN(oldSize.w)||isNaN(oldSize.h))))
{this.size=newSize.clone();oldSize=newSize.clone();if(this.updateSizeCbk)
this.updateSizeCbk();return true;}
else if(!newSize.equals(this.size))
{this.size=newSize.clone();if(this.recenterOnResize&&this.recenterOnResize==true)
{for(var i=0;i<this.layers.length;i++){this.layers[i].onMapResize();}
if(this.baseLayer!=null){var zoom=this.getZoom();this.zoom=null;this.setCenter(this.getCenter(),zoom,null,true);}}
else
{var offsetPx=new OpenLayers.Pixel(((newSize.w-oldSize.w)/2),((newSize.h-oldSize.h)/2));if(!this.layerContainerOriginSize)
this.layerContainerOriginSize=oldSize.clone();var offsetOrgPx=new OpenLayers.Pixel(((newSize.w-this.layerContainerOriginSize.w)/2),((newSize.h-this.layerContainerOriginSize.h)/2));this.layerContainerOffset=offsetOrgPx.clone();var centerPx=this.getLayerPxFromLonLat(this.getCenter());centerPx.x+=offsetPx.x;centerPx.y+=offsetPx.y;var centerLL=this.getLonLatFromLayerPx(centerPx);for(var i=0;i<this.layers.length;i++){this.layers[i].onMapResize();}
if(this.baseLayer!=null){var zoom=this.getZoom();this.setCenter(centerLL,zoom,null,null,null,new OpenLayers.Size(offsetPx.x,offsetPx.y));}}
if(this.updateSizeCbk)
this.updateSizeCbk(newSize.clone());return true;}},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,fromDrag:false});var centerPx=this.getViewPortPxFromLonLat(this.getCenter());var newCenterPx=centerPx.add(dx,dy);if(!options.dragging||!newCenterPx.equals(centerPx)||options.dragStill==true){var newCenterLonLat=this.getLonLatFromViewPortPx(newCenterPx);if(options.animate){this.panTo(newCenterLonLat);}else{this.setCenter(newCenterLonLat,null,options.dragging,null,options.dragStill,null,options.fromDrag);}}},panTo:function(lonlat,noEvent){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){if(noEvent==null||noEvent==false)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':false,'forceEvent':true});this.panTween._flag=false;if(noEvent==null||noEvent==false)this.events.triggerEvent("moveend");},this)}});}else{this.setCenter(lonlat);}},setCenter:function(lonlat,zoom,dragging,forceZoomChange,dragStill,sizeOffset,fromDrag){if(this.firstForceZoom)
{forceZoomChange=true;this.firstForceZoom=false;}
this.moveTo(lonlat,zoom,{'dragging':dragging,'dragStill':(typeof(dragStill)!="undefined")?dragStill:true,'forceZoomChange':forceZoomChange,'caller':'setCenter','forceEvent':!dragging,'sizeOffset':sizeOffset,'fromDrag':fromDrag});},moveTo:function(lonlat,zoom,options){var oldRes=this.getResolution();var zoomDiff=Math.abs(zoom-this.zoom);if(!options){options={};}
var dragging=options.dragging;var forceEvent=options.forceEvent;this._lastDragging=dragging;var forceZoomChange=options.forceZoomChange;var sizeOffset=options.sizeOffset;if(!options.sizeOffset)
sizeOffset=null;var noEvent=options.noEvent;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(this.panTween&&this.panTween.playing&&dragging&&options.caller=="setCenter")
return;if(this.panTween&&(options.caller=="setCenter"&&(zoomChanged||centerChanged))){this.panTween.stop();}
if(zoomChanged||centerChanged||!dragging||options.dragStill){if(!this.dragging&&!noEvent){this.events.triggerEvent("movestart");}
if(centerChanged){if((!zoomChanged)&&(this.center)){this.centerLayerContainer(lonlat,sizeOffset);}
this.center=lonlat.clone();}
if((zoomChanged)||(this.layerContainerOrigin==null)){this.layerContainerOrigin=this.center.clone();this.layerContainerOffset=null;this.layerContainerOriginSize=this.size.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();for(var i=0,len=this.layers.length;i<len;i++){var layer=this.layers[i];layer.fakeResolution=oldRes;}
if(!dragging||options.dragStill||zoomChanged){if(this.baseLayer.visibility){this.baseLayer.moveTo(bounds,zoomChanged,dragging,(sizeOffset!=null),zoomDiff);if(dragging){this.baseLayer.events.triggerEvent("move");}else{this.baseLayer.events.triggerEvent("moveend",{"zoomChanged":zoomChanged||(sizeOffset!=null)});}}}
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||(sizeOffset!=null),dragging);if(dragging){layer.events.triggerEvent("move");}else{layer.events.triggerEvent("moveend",{"zoomChanged":zoomChanged||(sizeOffset!=null)});}}}}
if(zoomChanged){for(var i=0,len=this.popups.length;i<len;i++){this.popups[i].updatePosition();}}
this.events.triggerEvent("move");if(zoomChanged||(sizeOffset!=null)){this.events.triggerEvent("zoomend");}}
if(((!dragging||options.dragStill)&&!noEvent)||forceEvent||(sizeOffset!=null)){if(zoomChanged||centerChanged||forceEvent||(sizeOffset!=null))
{if(this.gmap&&this.gmap.callback)
this.gmap.callback.call("bounds_changed",[this.gmap.getBounds()]);}
if(zoomChanged||(sizeOffset!=null))
{if(this.gmap&&this.gmap.callback)
this.gmap.callback.call("zoom_changed",[this.gmap.getZoom()]);}
this.events.triggerEvent("moveend",{dragStill:options.dragStill,dragging:dragging,wasDragging:options.fromDrag==true&&options.dragging==false});}
this.dragging=!!dragging;},centerLayerContainer:function(lonlat,sizeOffset){if(!this.layerContainerOffset)
this.layerContainerOffset=new OpenLayers.Pixel(0,0);var originPx=this.getViewPortPxFromLonLat(this.layerContainerOrigin);var newPx=this.getViewPortPxFromLonLat(lonlat);if((originPx!=null)&&(newPx!=null)){var left=Math.round(originPx.x-newPx.x)+Math.round(this.layerContainerOffset.x);var top=Math.round(originPx.y-newPx.y)+Math.round(this.layerContainerOffset.y);if((left||left==0)&&(top||top==0))
{this.layerContainerDiv.style.left=left+'px';this.layerContainerDiv.style.top=top+'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(res){var extent=null;if(this.baseLayer!=null){extent=this.baseLayer.getExtent(res);}
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,wrapDateLine,res){var lonlat=null;if(this.baseLayer!=null){lonlat=this.baseLayer.getLonLatFromViewPortPx(viewPortPx,wrapDateLine,res);}
return lonlat;},getViewPortPxFromLonLat:function(lonlat,res){var px=null;if(this.baseLayer!=null){px=this.baseLayer.getViewPortPxFromLonLat(lonlat,res);}
return px;},getLonLatFromPixel:function(px){return this.getLonLatFromViewPortPx(px);},getPixelFromLonLat:function(lonlat,res){var px=this.getViewPortPxFromLonLat(lonlat,res);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,wrapDateLine,res){px=this.getViewPortPxFromLayerPx(px);return this.getLonLatFromViewPortPx(px,wrapDateLine,res);},getLayerPxFromLonLat:function(lonlat,res){var px=this.getPixelFromLonLat(lonlat,res);return this.getLayerPxFromViewPortPx(px);},CLASS_NAME:"OpenLayers.Map"});OpenLayers.Map.TILE_WIDTH=256;OpenLayers.Map.TILE_HEIGHT=256;OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:false,lastRatio:1,isFirstDraw:true,backBufferTile:null,curRes:null,updateRes:function(newRes)
{this.curRes=newRes;this.renderTile();},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;var res=this.curRes;if(res==null)
res=this.layer.map.getResolution();var p1=this.layer.map.getLayerPxFromLonLat(new OpenLayers.LonLat(this.bounds.left,this.bounds.top),res);var p2=this.layer.map.getLayerPxFromLonLat(new OpenLayers.LonLat(this.bounds.right,this.bounds.bottom),res);var sz;if(p2==null||p1==null||p2.x==null||p1.x==null||p2.y==null||p1.y==null)
sz=this.layer.getImageSize();else
sz=new OpenLayers.Size(Math.abs(p2.x-p1.x),Math.abs(p2.y-p1.y));OpenLayers.Util.modifyDOMElement(this.frame,null,p1,sz);var imageSize=sz;var _url=null;if(!this.noReload&&this.noReload!=true)
_url=this.url;if(this.layerAlphaHack){OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,imageSize,_url);}else{OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,imageSize);if(_url!=null)
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.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,lastEvt:null,start:null,oldOnselectstart:null,dragInterval:null,dragFinish:true,dragCbkCPS:60,dragStillTimer:0,mmAllCbk:null,muAllCbk:null,interval:(1000/60),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)
{if((typeof this.oldOnselectstart)=="undefined"){this.oldOnselectstart=document.onselectstart;}
document.onselectstart=function(){return false;};if(!(this.map.mouseOverMarker||this.hold))
{this.started=true;this.start=evt.xy;this.last=evt.xy;this.lastMoveTime=-1;OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown");this.dragging=true;this.dragStilTimer=0;this.firstDragCall=true;}
else
this.hold=true;this.down(evt);this.callback("down",[evt.xy]);OpenLayers.Event.stop(evt);if(this.map.largeMap)
this.map.largeMap._mouseDown=true;else
this.map._mouseDown=true;propagate=!this.stopDown;}else{this.dragging=false;this.started=false;this.start=null;}
return propagate;},stopTimer:function()
{if(this.dragInterval!=null)
{window.clearTimeout(this.dragInterval);this.dragInterval=null;}},startTimer:function()
{if(this.dragInterval!=null)
this.stopTimer();this.dragInterval=window.setTimeout(OpenLayers.Function.bind(this.dragCbk,this),Math.floor(1000/this.dragCbkCPS));},doMove:function(evt)
{this.move(evt);evt.xy.dragStill=evt.dragStill;this.callback("move",[evt.xy]);},dragCbk:function()
{if(!this.started)
{return;}
evt=this.lastEvt;this.lastEvt=null;if(evt!=null&&this.dragStillTimer)
{window.clearTimeout(this.dragStillTimer);this.dragStillTimer=null;}
if(evt==null)
{if(this.last!=null&&this.dragFinish==false)
{this.dragStillTimer=window.setTimeout(OpenLayers.Function.bind(function()
{if(this.started)
{evt={xy:this.last,dragStill:true};this.doMove(evt);}
this.dragStillTimer=null;},this),0.25*1000);evt={xy:this.last,dragStill:false};this.doMove(evt);}
this.startTimer();return;}
this.dragFinish=false;evt.dragStill=false;this.doMove(evt);this.last=evt.xy;this.startTimer();return true;},_getXY:function(evt){var docVpPx=OpenLayers.Util.getDivPosition(this.map.div);var e=(evt)?evt:window.event;var mouseX=(e.pageX)?e.pageX:(e.clientX+document.body.scrollLeft);var mouseY=(e.pageY)?e.pageY:(e.clientY+document.body.scrollTop);var xy=new OpenLayers.Pixel((mouseX-docVpPx.x),(mouseY-docVpPx.y));return xy;},mousemoveAll:function(evt){if(!this.mmCbkAll)
return true;if(!evt)evt=window.event;if(this.started)
{evt.xy=this._getXY(evt);this.lastEvt={xy:evt.xy.clone()};}
return true;},mousemove:function(evt){if(!(this.checkModifiers(evt)&&OpenLayers.Event.isLeftClick(evt)))
{this.mouseup(evt);return true;}
if(this.mmCbkAll)
return true;if(this.started){this.lastEvt={xy:evt.xy.clone()};if(this.firstDragCall)
{this.dragCbk();this.firstDragCall=false;}}
else
{}
return true;},mouseup:function(evt){if(!evt)evt=window.event;this.hold=false;if(this.started){this.dragFinish=true;this.lastEvt=null;var dragged=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(evt);if(this.muCbkAll)
evt.xy=this._getXY(evt);evt.dragStill=true;this.callback("up",[evt.xy]);if(dragged){this.callback("done",[evt.xy]);}
document.onselectstart=this.oldOnselectstart;if(document.layers||document.all)document.onmousemove=function(){return true;};if(document.removeEventListener&&this.mmCbkAll)document.removeEventListener('mousemove',this.mmCbkAll,true);if(document.layers||document.all)document.onmouseup=function(){return true;};if(document.removeEventListener&&this.muCbkAll)document.removeEventListener('mouseup',this.muCbkAll,true);this.mmCbkAll=null;this.muCbkAll=null;if(this.map.largeMap)
this.map.largeMap._mouseDown=false;else
this.map._mouseDown=false;}
return true;},mouseout:function(evt){if(this.started&&OpenLayers.Util.mouseLeft(evt,this.map.div)){if(!this.map.noMouseOut)
{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]);}
document.onselectstart=this.oldOnselectstart;}
else
{if(!this.mmCbkAll)
{if(!this.mmCbkAll)
this.mmCbkAll=OpenLayers.Function.bind(this.mousemoveAll,this);if(!this.muCbkAll)
this.muCbkAll=OpenLayers.Function.bind(this.mouseup,this);if(document.layers)document.captureEvents(Event.MOUSEMOVE);if(document.layers)document.captureEvents(Event.MOUSEUP);if(document.layers)document.captureEvents(Event.MOUSEOUT);if(document.layers||document.all)document.onmousemove=this.mmCbkAll;if(document.addEventListener)document.addEventListener('mousemove',this.mmCbkAll,true);if(document.layers||document.all)document.onmouseup=this.muCbkAll;if(document.addEventListener)document.addEventListener('mouseup',this.muCbkAll,true);}}}
else
{document.onselectstart=this.oldOnselectstart;}
if(this.map.largeMap)
this.map.largeMap._mouseDown=false;else
this.map._mouseDown=false;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;this.dragFinish=false;this.startTimer();activated=true;}
return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.stopTimer();this.started=false;this.dragging=false;this.start=null;this.last=null;deactivated=true;}
return deactivated;},CLASS_NAME:"OpenLayers.Handler.Drag"});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){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(this.map.gmapNav)
{if(delta<0){this.map.gmapNav.zoomOutClicked();}else{this.map.gmapNav.zoomInClicked();}}
else
{}}},mousemove:function(evt){this.mousePosition=evt.xy;},activate:function(evt){if(this.map.gmap.noMouseWheel)
return false;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.Handler.OrigDrag=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;this.map.div.style.cursor="move";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;this.map.div.style.cursor="";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;this.map.div.style.cursor="";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;}
return deactivated;},CLASS_NAME:"OpenLayers.Handler.OrigDrag"});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,true,100);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(res){return this.map.calculateBounds(null,res);},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,wrapDateLine,res){var lonlat=null;if(viewPortPx!=null){var size=this.map.getSize();var center=this.map.getCenter();if(center){if(res==null)
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&&(wrapDateLine==null||wrapDateLine==true)){lonlat=lonlat.wrapDateLine(this.maxExtent);}}}
return lonlat;},getViewPortPxFromLonLat:function(lonlat,res){var px=null;if(lonlat!=null){var resolution=this.map.getResolution();var extent=this.map.getExtent(res);if(res!=null)
resolution=res;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.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,fromDrag:true});},panMapDone:function(xy){if(this.panned){this.panMap(xy);this.panned=false;}},CLASS_NAME:"OpenLayers.Control.DragPan"});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.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.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.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,out: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);}
this.map.zoomToExtent(bounds);}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.Layer.Grid=OpenLayers.Class(OpenLayers.Layer.HTTPRequest,{tileSize:null,grid:null,singleTile:false,ratio:1.5,buffer:2,numLoadingTiles:0,gridb:null,transitionTime:0.75,transitionFreq:75,oldTilesClearTime:2000,transitionStep:0,transitionTO:null,transfirst:true,maxZoomDiff:3,initialize:function(name,url,params,options){OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,arguments);this.events.addEventType("tileloaded");this.grid=[];this.gridb=[];},destroy:function(){this.clearGrid();this.grid=null;this.gridb=null;this.tileSize=null;OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this,arguments);},clearGrid:function(igrid){var tg=this.grid;if(igrid!=null)
tg=igrid;if(tg){for(var iRow=0,len=tg.length;iRow<len;iRow++){var row=tg[iRow];for(var iCol=0,clen=row.length;iCol<clen;iCol++){var tile=row[iCol];this.removeTileMonitoringHooks(tile);tile.destroy();}}
tg=[];}},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=[];obj.gridb=[];return obj;},moveTo:function(bounds,zoomChanged,dragging,sizeChange,zoomDiff){if(zoomDiff==null)
zoomDiff=0;OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);bounds=bounds||this.map.getExtent();if(bounds!=null){var forceReTile=!this.grid.length||zoomChanged;if(sizeChange&&this.grid)
{var viewSize=this.map.getSize();if(viewSize)
{var minRows=Math.ceil(viewSize.h/this.tileSize.h)+1;var minCols=Math.ceil(viewSize.w/this.tileSize.w)+1;if(minRows>this.grid.length)
forceReTile=true;if(this.grid.length>0&&minCols>this.grid[0].length)
forceReTile=true;}}
var tilesBounds=this.getTilesBounds();if(this.singleTile){if(forceReTile||(!dragging&&!tilesBounds.containsBounds(bounds))){this.initSingleTile(bounds);}}else{if(forceReTile||!tilesBounds.containsBounds(bounds,true)){if(this.transitionTO!=null)
{window.clearTimeout(this.transitionTO);this.transitionTO=null;}
if(zoomChanged&&this.transfirst==false&&this.grid.length!=0&&this.map.largeMap==null&&zoomDiff<=this.maxZoomDiff)
{var tmp=this.gridb;this.gridb=this.grid;for(var row in this.gridb)
{for(var col in this.gridb[row])
{var tile=this.gridb[row][col];if(tile!=null)
{tile.noReload=true;tile.shouldDraw=false;}}}
this.grid=tmp;this.transEndBounds=bounds.clone();this.startTransition();}
else
{this.clearGrid(this.gridb);this.initGriddedTiles(bounds);this.transfirst=false;this.lastRes=this.map.getResolution();if(this.map._overviewZoomChange)
this.map._overviewZoomChange();this.updateLayers(this.map.getResolution());}}else{this.moveGriddedTiles(bounds);}}}
this.clearNullTiles();this.clearNullTiles(this.gridb);},stepTransition:function(){if(this.inTrans==true)
return;this.inTrans=true;var curTime=(new Date().getTime())/1000.0;t=(curTime-this.transStartTime)/this.transitionTime;if(t>1.0)
t=1.0;newRes=OpenLayers.Easing.Expo.easeOut(t,this.transStartRes,this.transEndRes-this.transStartRes,1.0);if(t<1.0)
{this.transitionTO=window.setTimeout(OpenLayers.Function.bind(this.stepTransition,this),this.transitionFreq);}
for(var row in this.gridb)
{for(var col in this.gridb[row])
{var tile=this.gridb[row][col];tile.updateRes(newRes);}}
this.transitionStep+=1;if(t<1.0)
{this.updateLayers(newRes);}
else
{if(this.map._overviewZoomChange)
this.map._overviewZoomChange();this.transitionTO=null;if(this.transNewLoad==false)
{this.initGriddedTiles(this.transEndBounds);this.updateLayers(newRes);}}
this.inTrans=false;},updateLayers:function(newRes){for(var i=0,len=this.map.layers.length;i<len;i++)
{var layer=this.map.layers[i];if(layer!==this.baseLayer&&!layer.isBaseLayer){layer.fakeResolution=newRes;layer.redraw();}}
for(var i=0,len=this.map.popups.length;i<len;i++){this.map.popups[i].updatePosition();}},startTransition:function(){if(this.clearTilesTO!=null)
window.clearTimeout(this.clearTilesTO);this.transNewLoad=false;this.transStartRes=this.lastRes;this.transEndRes=this.getResolution();this.transStartTime=(new Date().getTime())/1000.0;this.lastRes=this.getResolution();this.transitionStep=0;this.clearGrid();this.grid=[];this.tilesOut=0;this.stepTransition();},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();},clearNullTiles:function(igrid){var g=this.grid;if(igrid!=null)
g=igrid;for(var i=0,len=g.length;i<len;i++)
{if(!g[i])
{g.splice(i,1);i-=1;len-=1;continue;}
for(var j=0,len2=g[i].length;j<len2;j++)
{if(!g[i][j]||!g[i][j].bounds)
{g[i].splice(j,1);j-=1;len2-=1;}}
if(g[i].length==0)
{g.splice(i,1);i-=1;len-=1;}}},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,spiralWait){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);if(spiralWait==null)
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 y=0;y<this.grid.length;y++)
for(var x=0;x<this.grid[y].length;x++)
if(!this.grid[y][x].queued)
{tileQueue.push(this.grid[y][x]);this.grid[y][x].queued=true;}
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.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();if(this.zoomBox)
this.zoomBox.activate();return OpenLayers.Control.prototype.activate.apply(this,arguments);},deactivate:function(){if(this.zoomBox!=null)
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));if(this.map.largeMap==null)
{this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:this.zoomBoxKeyMask});this.zoomBox.draw();}
this.dragPan.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);if(this.map.largeMap)
{if(this.map.largeMap.panTween)
this.map.largeMap.panTween._flag=true;this.map.largeMap.panTo(newCenter);}
else if(this.map.smallMap)
{if(this.map.smallMap.panTween)
{this.map.smallMap.panTween.stop();this.map.smallMap.events.triggerEvent("moveend");}}
if(this.map._onDblClick)
this.map._onDblClick();},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=this.map.getCenter();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.Layer.KaMap=OpenLayers.Class(OpenLayers.Layer.Grid,{isBaseLayer:true,units:null,resolution:OpenLayers.DOTS_PER_INCH,DEFAULT_PARAMS:{i:'jpeg',map:''},initialize:function(name,url,params,options){var newArguments=[];newArguments.push(name,url,params,options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);this.params=OpenLayers.Util.applyDefaults(this.params,this.DEFAULT_PARAMS);},getURL:function(bounds){bounds=this.adjustBounds(bounds);var mapRes=this.map.getResolution();var scale=Math.round((this.map.getScale()*10000))/10000;var pX=Math.round(bounds.left/mapRes);var pY=-Math.round(bounds.top/mapRes);return this.getFullRequestString({t:pY,l:pX,s:scale});},addTile:function(bounds,position){var url=this.getURL(bounds);return new OpenLayers.Tile.Image(this,position,bounds,url,this.tileSize);},calculateGridLayout:function(bounds,extent,resolution){var tilelon=resolution*this.tileSize.w;var tilelat=resolution*this.tileSize.h;var offsetlon=bounds.left;var tilecol=Math.floor(offsetlon/tilelon)-this.buffer;var tilecolremain=offsetlon/tilelon-tilecol;var tileoffsetx=-tilecolremain*this.tileSize.w;var tileoffsetlon=tilecol*tilelon;var offsetlat=bounds.top;var tilerow=Math.ceil(offsetlat/tilelat)+this.buffer;var tilerowremain=tilerow-offsetlat/tilelat;var tileoffsety=-(tilerowremain+1)*this.tileSize.h;var tileoffsetlat=tilerow*tilelat;return{tilelon:tilelon,tilelat:tilelat,tileoffsetlon:tileoffsetlon,tileoffsetlat:tileoffsetlat,tileoffsetx:tileoffsetx,tileoffsety:tileoffsety};},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.KaMap(this.name,this.url,this.params,this.options);}
obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);if(this.tileSize!=null){obj.tileSize=this.tileSize.clone();}
obj.grid=[];return obj;},getTileBounds:function(viewPortPx){var resolution=this.getResolution();var tileMapWidth=resolution*this.tileSize.w;var tileMapHeight=resolution*this.tileSize.h;var mapPoint=this.getLonLatFromViewPortPx(viewPortPx);var tileLeft=tileMapWidth*Math.floor(mapPoint.lon/tileMapWidth);var tileBottom=tileMapHeight*Math.floor(mapPoint.lat/tileMapHeight);return new OpenLayers.Bounds(tileLeft,tileBottom,tileLeft+tileMapWidth,tileBottom+tileMapHeight);},CLASS_NAME:"OpenLayers.Layer.KaMap"});if(/MSIE (5\.5|6\.)/.test(navigator.userAgent)){var __gmcss="/site_media/geniemap-api-ol-bedrock/install/geniemap_ie-6503.css";}else{var __gmcss="/site_media/geniemap-api-ol-bedrock/install/geniemap-6503.css";}
OpenLayers.ImgPath="/site_media/geniemap-api-ol-bedrock/install/images/";var headID=document.getElementsByTagName("head")[0];var cssNode=document.createElement('link');cssNode.type='text/css';cssNode.rel='stylesheet';cssNode.href=__gmcss;cssNode.media='screen';headID.appendChild(cssNode);var _gmap_maxSpeed=50;var _gmap_attenuation=0.10;var _gmap_updateInterval=25;var _gmap_parentBuffer=35;var _gmap_viewPortBuffer=35;var _gmap_div=null;var _gmap_curTime=0;var _gmap_lOffset=[0,0,0,0,0,0,0,0,0,0];var _gmap_=null;window.GenieMap=OpenLayers.Class({mainDiv:null,mapDiv:null,smapDiv:null,smapVPDiv:null,smapVPBoxDiv:null,smapVPBoxFDiv:null,smapHiderDiv:null,copyrightDiv:null,logoDiv:null,mainDivID:null,mapDivID:null,smapDivID:null,smapVPDivID:null,smapVPBoxDivID:null,smapVPBoxFDivID:null,smapHiderDivID:null,copyrightDivID:null,logoDivID:null,logoLink:"",logoAlt:"",map:null,mainLayer:null,smap:null,smapLayer:null,maxExtent:null,hybridExtent:null,zoneLayer:null,markerLayer:null,mapMode:null,overviewEnabled:null,navControls:null,scaleBars:null,scaleBarDivs:null,scaleBarDivIDs:null,hybridZoneExtent:null,zoomTransition:"resize",tips:null,border:true,servers:["http://mapserv1.genieknows.com/geniemap-v2/tile.php?","http://mapserv2.genieknows.com/geniemap-v2/tile.php?","http://mapserv3.genieknows.com/geniemap-v2/tile.php?","http://mapserv4.genieknows.com/geniemap-v2/tile.php?"],initialize:function(div,width,height,initialBounds,flags,_servers,_mode,bedrockOpts){if(bedrockOpts)
{if(bedrockOpts[0])_gmap_maxSpeed=bedrockOpts[0];if(bedrockOpts[1])_gmap_attenuation=bedrockOpts[1];if(bedrockOpts[2])_gmap_updateInterval=bedrockOpts[2];if(bedrockOpts[3])_gmap_parentBuffer=bedrockOpts[3];if(bedrockOpts[4])_gmap_viewPortBuffer=bedrockOpts[4];if(bedrockOpts[5])this.noMouseWheel=true;_gmap_=this;}
this.noMouseWheel=true;if(_mode==null)this.iFormat="AGGA";else this.iFormat=_mode;if(_servers!=null)
this.servers=_servers;this.mapMode=GenieMap.MAPMODE_MAP;if(flags)
{if(flags["serverOverride"])
this.servers=flags["serverOverride"];if(flags["noBorder"])
this.border=!flags["noBorder"];}
this.callback=new _Callback();this.maxExtent=[(new LatLonPoint(-86,-180)).toOL(),(new LatLonPoint(86,180)).toOL()];if(!initialBounds)
{this.resetExtent=(new BoundingBox(-45,-168.046875,85.999,-6.85546875)).toOL();}
else if(initialBounds.classType&&initialBounds.classType=="BoundingBox")
{this.resetExtent=initialBounds.toOL();}
this.mainDivID=((typeof div)=="string")?div:div.id;this.mainDiv=OpenLayers.Util.getElement(div);if(this.mainDiv.style.position!="relative"&&this.mainDiv.style.position!="absolute")
this.mainDiv.style.position="relative";this.mapDivID=OpenLayers.Util.createUniqueID("GenieMap_Map_");this.mapDiv=OpenLayers.Util.createDiv(this.mapDivID,null,null);this.mainDiv.appendChild(this.mapDiv);if(this.border)
{this.mapDiv.style.border="1px solid #afafad";this.mapDiv.style.borderStyle="solid solid solid solid";}
else
{this.mapDiv.style.border="0px";this.mapDiv.style.borderStyle="";}
this.mapDiv.style.overflow="hidden";this.mapDiv.style.width="100%";this.mapDiv.style.height="100%";this.mapDiv.style.padding="0px";this.mapDiv.style.margin="0px";this.mapDiv.style.position="absolute";this.mapDiv.style.zIndex="0";if(width)
{if(!/\%/.test(width))this.mainDiv.style.width=width+(/px/.test(width.toString())?"":"px");else this.mainDiv.style.width=width;}
else
{this.mainDiv.style.width="100%";}
if(height)
{if(!/\%/.test(height))this.mainDiv.style.height=height+(/px/.test(height.toString())?"":"px");else this.mainDiv.style.height=height;}
else
{this.mainDiv.style.height="100%";}
res=this.calcRes();this.map=new OpenLayers.Map(this.mapDivID,{units:"m",maxExtent:new OpenLayers.Bounds(this.maxExtent[0].lon,this.maxExtent[0].lat,this.maxExtent[1].lon,this.maxExtent[1].lat),resolutions:res,controls:[new OpenLayers.Control.Navigation()],noMouseOut:true,gmap:this,_baseDiv:this.mainDiv,updateSizeCbk:OpenLayers.Function.bind(this.onResize,this)});this.onResize();this.mainLayer=new OpenLayers.Layer.KaMap("GenieMap",this.servers,{g:"__base__",map:"gmap",i:this.iFormat},{wrapDateLine:true,transitionEffect:GenieMap.transEffect,buffer:1});this.markerLayer=new _Markers("GenieMarkers",{map:this.map,gmap:this});this.map.addLayers([this.mainLayer,this.markerLayer]);this.markerLayer.setVisibility(false);this.navControls=new _Navigation(this);this.map.gmapNav=this.navControls;if(initialBounds&&(!initialBounds.classType||initialBounds.classType!="BoundingBox"))
{this.setCenterAndZoom(initialBounds[0],initialBounds[1]);this.resetExtent=this.map.getExtent();}
else
{this._zoomToExtent(this.resetExtent,0,null,false);}
this.buttons=new _Buttons(this,0,["Map","Zones","Hybrid","Pins"],[GenieMap.MAPMODE_MAP,GenieMap.MAPMODE_ZONES,GenieMap.MAPMODE_HYBRID,GenieMap.MAPMODE_PINS]);this.buttons.buttonChangeCbk=OpenLayers.Function.bind(this.setMapMode,this);this.copyrightDivID=OpenLayers.Util.createUniqueID("copyrights_");this.copyrightDiv=OpenLayers.Util.createDiv(this.copyrightDivID);this.mapDiv.appendChild(this.copyrightDiv);this.copyrightDiv.className="geniemap_copyrights";this.copyrightDiv.style.right='5px';this.copyrightDiv.innerHTML+='<a target="_blank" class="copyright" title="GenieKnows Terms of Service" href="http://www.genieknows.com/tos">&copy; '
+(new Date()).getFullYear().toString()+' GenieKnows</a>';this.addScalebar=this.showScalebar;this.removeScalebar=this.hideScalebar;this.zoneInfo=new Array();;this.fZoneInfo=new Array();;for(var row=0;row<3;row++)
{this.zoneInfo.push(new Array());this.fZoneInfo.push(new Array());for(var col=0;col<3;col++)
{this.zoneInfo[row].push({text:"",alttext:"",link:""});this.fZoneInfo[row].push({alttext:"",link:""});}}
this.tips=new _TooltipManager(this);if(bedrockOpts)
{_gmap_div=this.mainDiv;window.setInterval(function()
{var pos=OpenLayers.Util.pagePosition(_gmap_div);_gmap_curTime+=_gmap_updateInterval;var offset=((_gmap_viewPortBuffer-pos[1])*_gmap_attenuation);for(var i=1;i<4;i++)
_gmap_lOffset[i-1]=_gmap_lOffset[i];_gmap_lOffset[3]=offset;offset=0.0;for(var i=0;i<10;i++)
offset+=_gmap_lOffset[i];offset=Math.floor(offset/4.0);if(offset>_gmap_maxSpeed)
offset=_gmap_maxSpeed;if(offset<-_gmap_maxSpeed)
offset=-_gmap_maxSpeed;var newY=(parseInt(_gmap_div.style.top.replace("px",""))+offset);var oNewY=newY;if(newY<_gmap_parentBuffer)
newY=Math.floor(_gmap_parentBuffer);var par=_gmap_div.parentNode;var maxY=(par.offsetHeight-_gmap_div.offsetHeight)-_gmap_parentBuffer;if(newY>maxY)
newY=maxY;_gmap_div.style.top=newY+"px";if(offset==0||(newY!=oNewY))
_gmap_.map.updateSize(false);},_gmap_updateInterval);}},setLogo:function(corner,link,alt)
{if(corner==null)
{if(this.logoDiv)
{this.logoDiv.style.display="none";}}
else
{if(link==null&&alt==null)
{alt="Visit GenieKnows Local";link="http://local.genieknows.com";}
else
{if(alt==null)
alt="";if(link==null)
link="";}
var imgExt="png";var isIE7=(document.all&&!window.opera&&window.XMLHttpRequest)?true:false;if(!isIE7&&/MSIE/.test(navigator.userAgent))
imgExt="gif";if(!this.logoDiv)
{this.logoDivID=OpenLayers.Util.createUniqueID("logo_");this.logoDiv=OpenLayers.Util.createDiv(this.logoDivID);this.mapDiv.appendChild(this.logoDiv);this.logoDiv.position="absolute";this.logoDiv.style.width="135px";this.logoDiv.style.height="28px";this.logoDiv.style.zIndex="6000";this.logoDiv.style.padding="0px";this.logoDiv.style.border="none";this.logoDiv.style.margin="0px";OpenLayers.Event.observe(this.logoDiv,"mousedown",OpenLayers.Function.bind(function(e){this.mouseDown=true;OpenLayers.Event.stop(e);},this));OpenLayers.Util.disableSelectionDown(this.logoDiv);OpenLayers.Util.blockEventDown(this.logoDiv,"dblclick");}
this.logoLink=link;this.logoAlt=alt;this.logoDiv.innerHTML="<a href=\""+this.logoLink+"\" target=\"_blank\"><img border=\"0px\" src=\"/site_media/geniemap-api-ol-bedrock/install/images/gklocal_logo."+imgExt+"\" alt=\""+this.logoAlt+"\" /></a>";this.logoDiv.title=this.logoAlt;this.logoDiv.style.top="";this.logoDiv.style.bottom="";this.logoDiv.style.left="";this.logoDiv.style.right="";if(corner==0)
{this.logoDiv.style.top="5px";this.logoDiv.style.left="5px";}
else if(corner==1)
{this.logoDiv.style.top="5px";this.logoDiv.style.right="5px";}
else if(corner==2)
{this.logoDiv.style.bottom="20px";this.logoDiv.style.right="123px";}
else if(corner==3)
{this.logoDiv.style.bottom="5px";this.logoDiv.style.left="5px";}
this.logoDiv.style.display="block";}},addMapModeControls:function()
{this.buttons.addAllButtons();},removeMapModeControls:function()
{this.buttons.removeAllButtons();},addMapModeControl:function(buttonID)
{this.buttons.addButton(buttonID);},removeMapModeControl:function(buttonID)
{this.buttons.removeButton(buttonID);},initScalebar:function(){if(this.scaleBars)
return;this.scaleBars=new Array(new _ScaleBar(null,this.map),new _ScaleBar(null,this.map));this.scaleBarDivIDs=new Array(OpenLayers.Util.createUniqueID("Scale_bar_"),OpenLayers.Util.createUniqueID("Scale_bar_"),OpenLayers.Util.createUniqueID("Scale_bar_cont_"));this.scaleBarDivs=new Array(OpenLayers.Util.createDiv(this.scaleBarDivIDs[0]),OpenLayers.Util.createDiv(this.scaleBarDivIDs[1]),OpenLayers.Util.createDiv(this.scaleBarDivIDs[2]));for(var i=0;i<this.scaleBars.length;i++)
{this.scaleBars[i].divisions=1;this.scaleBars[i].subdivisions=1;this.scaleBars[i].align='left';this.scaleBars[i].abbreviateLabel=true;this.scaleBars[i].minWidth=80;this.scaleBars[i].maxWidth=140;}
this.scaleBars[0].displaySystem="english";this.scaleBars[1].displaySystem="metric";this.mapDiv.appendChild(this.scaleBarDivs[2]);this.scaleBarDivs[2].appendChild(this.scaleBarDivs[0]);this.scaleBarDivs[2].appendChild(this.scaleBarDivs[1]);OpenLayers.Util.disableSelectionDown(this.scaleBarDivs[2]);this.scaleBarDivs[2].className="geniemap_scaleContainer";this.scaleBarDivs[0].className="geniemap_scalebar_english";this.scaleBarDivs[1].className="geniemap_scalebar_metric";this.scaleBars[0].place(this.scaleBarDivIDs[0]);this.scaleBars[1].place(this.scaleBarDivIDs[1]);this.map.events.register("moveend",this,function(){this.updateScalebar();});this.map.events.register("zoomend",this,function(){this.updateScalebar();});},setResetAlt:function(alttext){this.navControls.resetAlt=alttext;},showScalebar:function(){this.initScalebar();if(!this.scaleBars)
return;this.scaleBarDivs[2].style.visibility="visible";},hideScalebar:function(){if(!this.scaleBars)
return;this.scaleBarDivs[2].style.visibility="hidden";},updateScalebar:function(){if(!this.scaleBars)
return;for(var i=0;i<this.scaleBars.length;i++)
this.scaleBars[i].update();},calcRes:function(small){scales=[110936068.20090523,73957378.8006035,36978689.40030175,22187213.640181046,12326229.800100582,7157165.690380983,4108743.2667001938,2360341.876615005,1369581.0889000646,789580.5565900728,456527.02963335486,263506.1002396799,152175.67654445162,87870.15303041998,50725.225514817204,29286.184847123874,16908.40850493907,9762.061615707958,5636.1361683130235,3254.0205385693193,1878.712056104341];this.scaleCount=scales.length;if(small!=null)
{if(small)
{scales=[221872136.40181047,110936068.20090523,73957378.8006035,44374427.28036209,24652459.600201163,13867008.525113154,8217486.5334003875,4720683.75323001,2739162.177800129,1584800.9742986462,913054.0592667097,527012.2004793598,304351.35308890324,175670.73349311991,101450.45102963441,58572.36969424775,33816.81700987814,19524.123231415917,11272.272336626047,6508.041077138639,3757.424112208682];this.smScaleCount=scales.length;}}
res=[];for(i=0;i<scales.length;i++)
res[i]=OpenLayers.Util.getResolutionFromScale(scales[i],"m");return res;},_delayedSetCenterAndZoom:function(args)
{if(args.point==null)
return;if(args.newZoom!=null)
this.setCenterAndZoom(args.point,args.newZoom);else
this.setCenter(args.point);},setCenter:function(center)
{if((typeof center)=="string")
window.__Geocoder.sendRequest(GenieMap.GEOCODE_ADDRESS,OpenLayers.Function.bind(this._delayedSetCenterAndZoom,this),center,{newZoom:null});else if((typeof center)=="number")
window.__Geocoder.sendRequest(GenieMap.GEOCODE_BUSINESS_ID,OpenLayers.Function.bind(this._delayedSetCenterAndZoom,this),center,{newZoom:null});else
this.map.setCenter(center.toOL());},setCenterAndZoom:function(center,zoom)
{if((typeof center)=="string")
window.__Geocoder.sendRequest(GenieMap.GEOCODE_ADDRESS,OpenLayers.Function.bind(this._delayedSetCenterAndZoom,this),center,{newZoom:zoom});else if((typeof center)=="number")
window.__Geocoder.sendRequest(GenieMap.GEOCODE_BUSINESS_ID,OpenLayers.Function.bind(this._delayedSetCenterAndZoom,this),center,{newZoom:zoom});else
{if(!center||!zoom)
return;if(zoom<0)zoom=0;if(zoom>=this.scaleCount)zoom=this.scaleCount-1;this.map.setCenter(center.toOL(),this.scaleCount-1-zoom);}},setResetBounds:function(bb)
{if(bb==null)
this.resetExtent=null;else
{this.resetExtent=bb.toOL();}},getResetBounds:function()
{if(!this.resetExtent)
return null;var ret=new BoundingBox();ret.fromOL(this.resetExtent);return ret;},getCenter:function()
{var ret=new LatLonPoint(0,0);ret.fromOL(this.map.getCenter());return ret;},getBounds:function()
{var ret=new BoundingBox();ret.fromOL(this.map.getExtent());return ret;},getZoom:function()
{return this.scaleCount-1-this.map.getZoom();},setZoom:function(zoom)
{if(zoom<0)
zoom=0;if(zoom>=this.scaleCount)
zoom=this.scaleCount-1;this.map.setCenter(null,this.scaleCount-1-zoom);},getHybridZones:function()
{var ret=new BoundingBox();ret.fromOL(this.hybridZoneExtent);return ret;},getFloatingZones:function()
{var size=this.map.getSize();size.w-=GenieMap.zoneMargin;size.h-=GenieMap.zoneMargin;var tl=new OpenLayers.Pixel(GenieMap.zoneMargin/2,GenieMap.zoneMargin/2);var br=new OpenLayers.Pixel(GenieMap.zoneMargin/2+size.w,GenieMap.zoneMargin/2+size.h);var tlLL=this.map.getLonLatFromViewPortPx(tl,false);var brLL=this.map.getLonLatFromViewPortPx(br,false);var bb=new OpenLayers.Bounds(Math.min(tlLL.lon,brLL.lon),Math.max(tlLL.lat,brLL.lat),Math.max(tlLL.lon,brLL.lon),Math.min(tlLL.lat,brLL.lat));var ret=new BoundingBox();ret.fromOL(bb);return ret;},setHybridZones:function(bb)
{if(this.mapMode==GenieMap.MAPMODE_HYBRID)
{this._setHybridZones(bb);return;}
if(bb)
{this.hybridZoneExtent=bb.toOL();this.resetExtent=this.hybridZoneExtent.clone();}
else
{this.hybridZoneExtent=null;}},_setMarkers:function()
{this.markerLayer.setVisibility(true);if(this.markerLayer.infoWin!=null)
this.markerLayer.infoWin.display(true);},_removeMarkers:function()
{this.markerLayer.setVisibility(false);if(this.markerLayer.infoWin!=null)
this.markerLayer.infoWin.display(false);},_removeZones:function()
{if(this.zoneLayer!=null)
{this.zoneLayer.deinit();this.map.removeLayer(this.zoneLayer);this.zoneLayer=null;}},_setFloatingZones:function()
{if(this.zoneLayer)
{this._removeZones();}
this.zoneLayer=new _Zones("GenieZones",{map:this.map,gmap:this,zoneInfo:this.fZoneInfo});this.map.addLayers([this.zoneLayer]);},_updateZoneInfo:function(row,col)
{if(!this.zoneLayer)
return;var cell=this.zoneLayer.getCell(row,col);if(!cell)
return;if(cell.floating)
cell.info=this.fZoneInfo[row][col];else
cell.info=this.zoneInfo[row][col];cell.setDivData();cell.draw();},setZoneText:function(row,col,text)
{if((typeof text).toLowerCase()!="string")
text=text.toString();this.zoneInfo[row][col].text=text;this._updateZoneInfo(row,col);},setZoneAltText:function(row,col,alttext)
{this.zoneInfo[row][col].alttext=alttext;this._updateZoneInfo(row,col);},setZoneLink:function(row,col,link)
{this.zoneInfo[row][col].link=link;this._updateZoneInfo(row,col);},setFloatingZoneLink:function(row,col,link)
{this.fZoneInfo[row][col].link=link;this._updateZoneInfo(row,col);},getZoneCellBounds:function(row,col)
{var cell=this.zoneLayer.getCell(row,col);if(!cell)
return null;var ret=new BoundingBox();ret.fromOL(cell.getBounds());return ret;},_zoomToExtent:function(extent,padding,retZoom,onlyWidth)
{var vpSize=this.map.getCurrentSize();if(padding)
{vpSize.w-=padding*2;vpSize.h-=padding*2;}
var width=extent.getWidth();var height=extent.getHeight();for(var i=this.map.resolutions.length-1;i>=0;i--)
{var res=this.map.resolutions[i];if(((width/res)<=vpSize.w)&&(((height/res)<=vpSize.h)||onlyWidth==true)||i==0)
{if(retZoom)
return i;else
{this.map.setCenter(extent.getCenterLonLat(),i);}
return;}}},_delayedSetBounds:function(args)
{if(!args.bounds)
return;this.setBounds(args.bounds);},setBounds:function(bounds)
{if((typeof bounds)=="string")
window.__Geocoder.sendRequest(GenieMap.GEOCODE_ADDRESS,OpenLayers.Function.bind(this._delayedSetBounds,this),bounds,{});else
this._zoomToExtent(bounds.toOL(),20);},setBoundsToHybridZones:function()
{if(this.hybridZoneExtent)
{this._zoomToExtent(this.hybridZoneExtent,20);}},resizeTo:function(width,height,recenter)
{if(width&&height)
{if(!/\%/.test(width))this.mainDiv.style.width=width+(/px/.test(width.toString())?"":"px");else this.mainDiv.style.width=width;if(!/\%/.test(height))this.mainDiv.style.height=height+(/px/.test(height.toString())?"":"px");else this.mainDiv.style.height=height;}
this.map.updateSize(recenter);},removeHybridZones:function()
{if(this.mapMode==GenieMap.MAPMODE_HYBRID)
this._removeZones();this.hybridZoneExtent=null;},_setHybridZones:function(bb)
{if(this.zoneLayer)
{this._removeZones();}
if(bb)
{this.hybridZoneExtent=bb.toOL();this.resetExtent=this.hybridZoneExtent.clone();}
if(this.hybridZoneExtent!=null)
{this.zoneLayer=new _Zones("GenieZones",{map:this.map,gmap:this,zoneInfo:this.zoneInfo},this.hybridZoneExtent);this.map.addLayers([this.zoneLayer]);this.map.moveTo(this.map.getExtent());}},addMarker:function(marker)
{if(!marker)
return;if(marker.marker)
this.removeMarker(marker);marker.marker=new _Marker(marker.type,marker.lonlat.toOL(),marker.label,marker.iwtext,this.markerLayer,marker._enableInfoWindow);marker.marker._marker=marker;this.markerLayer.addMarker(marker.marker);},removeMarker:function(marker)
{if(!marker)
return;if(!marker.marker)
return;this.markerLayer.removeMarker(marker.marker);delete marker.marker;marker.marker=null;},removeAllMarkers:function()
{this.markerLayer.clearMarkers();},_extendBounds:function(bounds,_voffset)
{var vpSize=this.map.getSize();var percentX=80.0/vpSize.w;var percentY=80.0/vpSize.h;var center=bounds.getCenterLonLat();var width=bounds.getWidth();var height=bounds.getHeight();if(width>height)height=width;if(height>width)width=height;width*=(1.0+percentY);height*=(1.0+percentX);var voffset=0;return new OpenLayers.Bounds(center.lon-width/2.0,center.lat+height/2.0+voffset,center.lon+width/2.0,center.lat-height/2.0+voffset);},getMarkerBounds:function()
{if(this.markerLayer)
{var bb=new BoundingBox();var ex=this.markerLayer.getDataExtent();if(!ex)
return null;bb.fromOL(ex);return bb;}},setBoundsToMarkers:function()
{if(this.markerLayer)
{var bounds=this.markerLayer.getDataExtent();if(bounds)
this._zoomToExtent(bounds,40);}},onResize:function()
{if(!this.afterFirstResize)
{this.afterFirstResize=true;}
if(this.overviewEnabled)
{var isIE7=(document.all&&!window.opera&&window.XMLHttpRequest)?true:false;if(!isIE7&&/MSIE/.test(navigator.userAgent))
{offset=1;var size=this.map.getCurrentSize().clone();if((size.w%2))
{this.smapHiderDiv.style.right="-1px";this.smapDiv.style.right="-"+offset+"px";}
else
{this.smapHiderDiv.style.right="0px";this.smapDiv.style.right="0px";}
if((size.h%2))
{if(!isIE7)
this.smapHiderDiv.style.bottom="-1px";else
this.smapHiderDiv.style.bottom="-2px";this.smapDiv.style.bottom="-"+offset+"px";}
else
{if(!isIE7)
this.smapHiderDiv.style.bottom="0px";else
this.smapHiderDiv.style.bottom="-1px";this.smapDiv.style.bottom="0px";}
if(this.border)
{this.smapDiv.style.bottom=(parseInt(this.smapDiv.style.bottom)-2)+"px";this.smapDiv.style.right=(parseInt(this.smapDiv.style.right)-2)+"px";this.smapHiderDiv.style.bottom=(parseInt(this.smapHiderDiv.style.bottom)-1)+"px";this.smapHiderDiv.style.right=(parseInt(this.smapHiderDiv.style.right)-1)+"px";}}}},addOverview:function()
{if(this.overviewEnabled)
return;if(this.smapDivID==null)
{this.smapDivID=OpenLayers.Util.createUniqueID("SmallMap_Container_");this.smapDiv=OpenLayers.Util.createDiv(this.smapDivID);this.smapVPDivID=OpenLayers.Util.createUniqueID("SmallMap_Map_");this.smapVPDiv=OpenLayers.Util.createDiv(this.smapVPDivID);this.mainDiv.appendChild(this.smapDiv);this.smapDiv.appendChild(this.smapVPDiv);var isIE7=(document.all&&!window.opera&&window.XMLHttpRequest)?true:false;this.smapDiv.className="geniemap_smallMapContainer";this.smapVPDiv.className="geniemap_small_viewport";this.smapVPDiv.style.position="relative";if(!this.border)
{this.smapDiv.style.border="0px";this.smapVPDiv.style.border="0px";this.smapVPDiv.style.left="8px";this.smapVPDiv.style.top="8px";}
if(/MSIE/.test(navigator.userAgent)||isIE7)
{if(isIE7&&this.border)
{this.smapDiv.style.bottom="-4px";this.smapDiv.style.right="-4px";}
else
{if(!isIE7)
{this.smapDiv.style.bottom="-4px";this.smapDiv.style.right="-4px";}
else
{this.smapDiv.style.bottom="0px";this.smapDiv.style.right="0px";}}
this.smapDiv.style.width="120px";this.smapDiv.style.height="120px";if(!this.border)
{this.smapDiv.style.width="117px";this.smapDiv.style.height="117px";}}
else
{if(!this.border)
{this.smapDiv.style.bottom="0px";this.smapDiv.style.right="0px";this.smapDiv.style.width="117px";this.smapDiv.style.height="117px";}}
this.smapHiderDivID=OpenLayers.Util.createUniqueID("SmallMap_Hider_");this.smapHiderDiv=OpenLayers.Util.createDiv(this.smapHiderDivID);this.mainDiv.appendChild(this.smapHiderDiv);this.smapHiderDiv.className="geniemap_smallMapHider";this.smapHiderDiv.style.width="17px";this.smapHiderDiv.style.height="17px";if(!this.border)
this.smapHiderDiv.style.overflow="hidden";this.smapHiderDiv.style.border="0px";this.smapHiderDiv.style.borderStyle="";this.smapHiderDiv.style.margin="0px";this.smapHiderDiv.style.padding="0px";this.smapHiderDiv.style.zIndex="2010";this.smapHiderDiv.style.top="";this.smapHiderDiv.style.left="";OpenLayers.Util.disableSelectionDown(this.smapHiderDiv);OpenLayers.Util.disableSelectionDown(this.smapDiv);if(isIE7)
{this.smapHiderDiv.style.right="0px";this.smapHiderDiv.style.bottom="-2px";}
else if(/MSIE/.test(navigator.userAgent))
{this.smapHiderDiv.style.right="-4px";this.smapHiderDiv.style.bottom="-4px";}
else
{if(!this.border)
{this.smapHiderDiv.style.right="0px";this.smapHiderDiv.style.bottom="0px";}}
OpenLayers.Event.observe(this.smapHiderDiv,"click",OpenLayers.Function.bind(this.toggleOverview,this));res=this.calcRes(true);this.smap=new OpenLayers.Map(this.smapVPDivID,{units:"m",maxExtent:new OpenLayers.Bounds(this.maxExtent[0].lon,this.maxExtent[0].lat,this.maxExtent[1].lon,this.maxExtent[1].lat),resolutions:res,controls:[new OpenLayers.Control.Navigation()],noMouseOut:true,largeMap:this.map,_baseDiv:this.mainDiv,center:this.map.getCenter(),zoom:this._smScaleForLmScale(this.map.getZoom()),recenterOnResize:true});this.map.smallMap=this.smap;this.smapLayer=new OpenLayers.Layer.KaMap("GenieMap",this.servers,{g:"__base__",map:"gmap_small",i:this.iFormat},{wrapDateLine:true,buffer:1,transitionEffect:GenieMap.transEffect});this.smapInInit=true;this.smap.addLayers([this.smapLayer]);this._smapPuaseEvents=true;this.smap.events.register("moveend",this,this._smapMoveEnd);this.smap.events.register("zoomend",this,function(){this._updateSmapVP();});this.smap.events.register("move",this,function(){this._updateSmapVP();});this.map.events.register("move",this,this._mapMoving);this.map.events.register("moveend",this,function(){this._smapPauseEvents=false;});this.map.events.register("zoomend",this,this._mapZoomed);this.map._onDblClick=OpenLayers.Function.bind(function(){this._smapPauseEvents=false;},this);}
this.overviewEnabled=true;this.smapHiderDiv.style.display="block";this.showOverview();for(var i=1;i<=5;i++)
window.setTimeout(OpenLayers.Function.bind(function(){this.smap.setCenter(this.map.getCenter(),this._smScaleForLmScale(this.map.getZoom()));},this),500*i);},_smapPauseEvents:false,smapMinZoom:4,smapMaxZoom:20,onSMapResize:function(newSize)
{},_updateSmapVP:function()
{if(this._smScaleForLmScale(this.map.getZoom())!=this.smap.getZoom())
return;var isIE7=(document.all&&!window.opera&&window.XMLHttpRequest)?true:false;var IEVer=OpenLayers.Util.getIEVersion();var isIE678=(IEVer>=6.0&&IEVer<9)?true:false;if(!this.smapVPBoxDiv)
{this.smapVPBoxDivID=OpenLayers.Util.createUniqueID("SmallMap_Box_");this.smapVPBoxDiv=OpenLayers.Util.createDiv(this.smapVPBoxDivID);this.smapVPBoxFDivID=OpenLayers.Util.createUniqueID("SmallMap_BoxF_");this.smapVPBoxFDiv=OpenLayers.Util.createDiv(this.smapVPBoxFDivID);this.smapVPBoxFInnerDivID=OpenLayers.Util.createUniqueID("SmallMap_BoxFI_");this.smapVPBoxFInnerDiv=OpenLayers.Util.createDiv(this.smapVPBoxFInnerDivID);this.smapVPDiv.appendChild(this.smapVPBoxDiv);this.smapVPDiv.appendChild(this.smapVPBoxFDiv);this.smapVPDiv.appendChild(this.smapVPBoxFInnerDiv);this.smapVPBoxDiv.className="geniemap_smallvp_border";this.smapVPBoxFDiv.className="geniemap_smallvp";this.smapVPBoxFInnerDiv.className="geniemap_smallvp_border";OpenLayers.Util.disableSelectionDown(this.smapDiv);}
var bmSz=this.map.getSize();var tlB=this.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(0,0),false);var brB=this.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(bmSz.w-1,bmSz.h-1),false);if(!tlB||!brB||!tlB.lon||!tlB.lat||!brB.lon||!brB.lat)
return;tlB=OpenLayers.Util.smooth(tlB,this.map);brB=OpenLayers.Util.smooth(brB,this.map);var tlPx=this.smap.getViewPortPxFromLonLat(tlB);var brPx=this.smap.getViewPortPxFromLonLat(brB);var smCP=this.smap.getViewPortPxFromLonLat(this.smap.getCenter());var boxSz=new OpenLayers.Size(Math.abs(Math.floor(brPx.x)-Math.floor(tlPx.x)),Math.abs(Math.floor(brPx.y)-Math.floor(tlPx.y)));var smSz=this.smap.getSize();var p2=[Math.floor(tlPx.x),Math.floor(tlPx.y)];var p1=[Math.floor(smCP.x-boxSz.w/2),Math.floor(smCP.y-boxSz.h/2)];if((!boxSz.w&&boxSz.w!=0)||(!boxSz.h&&boxSz.h!=0))
return;this.smapVPBoxFDiv.style.zIndex="2004";this.smapVPBoxFDiv.style.width=(boxSz.w+(isIE678?2:1))+"px";this.smapVPBoxFDiv.style.height=(boxSz.h+(isIE678?2:1))+"px";this.smapVPBoxFDiv.style.left=p1[0]+"px";this.smapVPBoxFDiv.style.top=p1[1]+"px";this.smapVPBoxFInnerDiv.style.zIndex="2005";this.smapVPBoxFInnerDiv.style.width=(boxSz.w+(isIE678?1:0))+"px";this.smapVPBoxFInnerDiv.style.height=(boxSz.h+(isIE678?1:0))+"px";this.smapVPBoxFInnerDiv.style.left=p1[0]+"px";this.smapVPBoxFInnerDiv.style.top=p1[1]+"px";this.smapVPBoxDiv.style.zIndex="2006";this.smapVPBoxDiv.style.width=(boxSz.w+(isIE678?1:0))+"px";this.smapVPBoxDiv.style.height=(boxSz.h+(isIE678?1:0))+"px";this.smapVPBoxDiv.style.left=p2[0]+"px";this.smapVPBoxDiv.style.top=p2[1]+"px";},_smScaleForLmScale:function(lmScale)
{var newZoom=(lmScale-this.smapMinZoom>0)?lmScale-this.smapMinZoom:0;newZoom=(newZoom<=this.smapMaxZoom)?newZoom:this.smapMaxZoom;return newZoom;},_mapZoomed:function()
{if(this._smapPauseEvents)
{this._updateSmapVP();return;}
this._smapPauseEvents=true;var newZoom=this._smScaleForLmScale(this.map.getZoom());if(newZoom!=this.smap.getZoom())
this.smap.setCenter(this.map.getCenter(),newZoom);this._smapPauseEvents=false;},_smapMoveEnd:function(opts)
{if(opts.wasDragging)
{this.map.panTo(this.smap.getCenter());this._smapPauseEvents=true;}
this._updateSmapVP();},_mapMoving:function()
{if(this.smapDivID)
{if(this._smapPauseEvents)
{this._updateSmapVP();return;}
this._smapPauseEvents=true;this.smap.moveTo(this.map.getCenter(),null);this._smapPauseEvents=false;}},removeOverview:function()
{if(!this.overviewEnabled)
return;this.hideOverview();this.smapHiderDiv.style.display="none";this.overviewEnabled=false;this.copyrightDiv.style.right='5px';},toggleOverview:function()
{if(this.smapDiv.style.display=="block")
this.hideOverview();else
this.showOverview();},showOverview:function()
{if(!this.overviewEnabled)
return;this.smapHiderDiv.style.background='url(/site_media/geniemap-api-ol-bedrock/install/images/close-mini.gif) no-repeat top left'
this.smapDiv.style.display="block";this.smap.moveTo(this.map.getCenter(),this._smScaleForLmScale(this.map.getZoom()));this.onResize();this.copyrightDiv.style.right='121px';},hideOverview:function()
{if(!this.overviewEnabled)
return;this.smapHiderDiv.style.background='url(/site_media/geniemap-api-ol-bedrock/install/images/open-mini.gif) no-repeat top left'
this.smapDiv.style.display="none";this.copyrightDiv.style.right='20px';},getMapMode:function()
{return this.mapMode;},setMapMode:function(mode)
{if(mode==this.mapMode)
return;switch(this.mapMode)
{case GenieMap.MAPMODE_MAP:break;case GenieMap.MAPMODE_PINS:this._removeMarkers();break;case GenieMap.MAPMODE_ZONES:this._removeZones();break;case GenieMap.MAPMODE_HYBRID:this._removeZones();break;default:break;}
this.mapMode=mode;this.buttons.activateButton(mode);switch(this.mapMode)
{case GenieMap.MAPMODE_MAP:break;case GenieMap.MAPMODE_PINS:this._setMarkers();break;case GenieMap.MAPMODE_ZONES:this._setFloatingZones();break;case GenieMap.MAPMODE_HYBRID:this._setHybridZones(arguments[1]);break;default:break;}
this.callback.call("map_mode_changed",[mode]);},addEventListener:function(eventID,func,funcOwner)
{return this.callback.add(eventID,func,funcOwner);},removeEventListener:function(eventID,callbackID)
{this.callback.remove(eventID,callbackID);},resetEventListeners:function()
{this.callback.clear();},geoCode:function(type,query,callback,extraArgs)
{window.__Geocoder.sendRequest(type,callback,query,extraArgs);}});window.GenieMap.MAPMODE_MAP=0;window.GenieMap.MAPMODE_PINS=1;window.GenieMap.MAPMODE_HYBRID=2;window.GenieMap.MAPMODE_ZONES=3;window.GenieMap.BUTTON_MAP=0;window.GenieMap.BUTTON_PINS=1;window.GenieMap.BUTTON_HYBRID=2;window.GenieMap.BUTTON_ZONES=3;window.GenieMap.EVENT_MAP_MODE_CHANGED="map_mode_changed";window.GenieMap.EVENT_MAP_BOUNDS_CHANGED="bounds_changed";window.GenieMap.EVENT_MAP_ZOOM_CHANGED="zoom_changed";window.GenieMap.EVENT_MARKER_MOUSE_OVER="marker_mouse_over";window.GenieMap.EVENT_MARKER_MOUSE_OUT="marker_mouse_out";window.GenieMap.EVENT_MARKER_CLICKED="marker_clicked";window.GenieMap.EVENT_MARKER_OPENED="marker_opened";window.GenieMap.EVENT_MARKER_CLOSED="marker_closed";window.GenieMap.EVENT_RESET_CLICKED="reset_clicked";window.GenieMap.EVENT_ZONE_CLICKED="zone_clicked";window.GenieMap.EVENT_ZONE_MOUSE_OVER="zone_mouse_over";window.GenieMap.EVENT_ZONE_MOUSE_OUT="zone_mouse_out";window.GenieMap.EVENT_BUTTON_MOUSE_OVER="button_mouse_over";window.GenieMap.EVENT_BUTTON_MOUSE_OUT="button_mouse_out";window.GenieMap.GEOCODE_ADDRESS=1;window.GenieMap.GEOCODE_BUSINESS_ID=2;window.GenieMap.ttAltTimeIn=0.75;window.GenieMap.ttTimeLeave=3.5;window.GenieMap.zoneMargin=40;window.GenieMap.cantZoomMsg='<img src="/site_media/geniemap-api-ol-bedrock/install/images/error.png" width="10px" height="10px"> Can\'t zoom further';window.GenieMap.transEffect="none";window.GenieMap.distanceAroundEarth=40075016.685578;LatLonPoint=OpenLayers.Class({classType:"LatLonPoint",lat:0,lon:0,latlon:null,merc:null,__l2m:function(p){return OpenLayers.Projection.transform(p,this.latlon,this.merc);},__m2l:function(p){return OpenLayers.Projection.transform(p,this.merc,this.latlon);},__P:function(ln,lt){var __p=this.__l2m({x:ln,y:lt});return new OpenLayers.LonLat(__p.x,__p.y);},__IP:function(p){var __p=this.__m2l({x:p.lon,y:p.lat});return new OpenLayers.LonLat(__p.x,__p.y);},initialize:function(_lat,_lon){this.latlon=new OpenLayers.Projection("EPSG:4326");this.merc=new OpenLayers.Projection("EPSG:900913");if(_lat&&_lon)
{this.lat=_lat;this.lon=_lon;}},toOL:function(){return this.__P(this.lon,this.lat);},fromOL:function(p){var __p=this.__IP(p)
this.lat=__p.lat;this.lon=__p.lon;},toString:function(){return this.lat+", "+this.lon;},equals:function(otherPoint)
{return(this.lat==otherPoint.lat)&&(this.lon==otherPoint.lon);},distance:function(otherPoint)
{return OpenLayers.Util.distKm(this,otherPoint);},clone:function(){return new LatLonPoint(this.lat,this.lon);}});_ZoneCell=OpenLayers.Class({divHtml:null,bounds:null,map:null,zones:null,size:null,offset:null,pinSize:null,pinOffset:null,imageDiv:null,pinDiv:null,lonlat:null,px:null,row:null,col:null,oPinClassName:"",zclass:"",ovrclass:"",isIE:false,isIE7:false,initialize:function(info,bounds,row,col,owner,floating){this.zones=owner;this.map=owner.map;this.tips=owner.tips;this.info=info;if(this.info==null)this.info={text:"",alttext:"",link:""};if(!this.info.text)this.info.text="";if(!this.info.alttext)this.info.alttext="";if(!this.info.link)this.info.link="";this.bounds=bounds;this.floating=(floating)?floating:false;if(/MSIE/.test(navigator.userAgent))
{this.isIE=true;}
else
{this.isIE=false;}
this.isIE7=(document.all&&!window.opera&&window.XMLHttpRequest)?true:false;var px;var sizeOffsetZ=1;if(this.isIE)
sizeOffsetZ=0;if(!this.floating)
{this.size=new OpenLayers.Size(Math.floor(this.bounds[2]-this.bounds[0])-sizeOffsetZ,Math.floor(this.bounds[3]-this.bounds[1])-sizeOffsetZ);if(row==0)this.bounds[1]-=sizeOffsetZ;else if(this.isIE7||this.isIE)this.bounds[1]+=row+1;if(col==0)this.bounds[0]-=sizeOffsetZ;else if(this.isIE7||this.isIE)this.bounds[0]+=col+1;px=new OpenLayers.Pixel(Math.round((this.bounds[0]+this.bounds[2])/2),Math.round((this.bounds[1]+this.bounds[3])/2));this.px=px;this.lonlat=this.map.getLonLatFromLayerPx(px,false);this.offset=new OpenLayers.Pixel(0,0);}
else
{var sz=this.map.getSize();this.size=new OpenLayers.Size(Math.floor((sz.w-this.zones.zoneMargin*2)/this.zones.cols),Math.floor((sz.h-this.zones.zoneMargin*2)/this.zones.rows));tl=new OpenLayers.Pixel(this.zones.zoneMargin+this.size.w*col,this.zones.zoneMargin+this.size.h*row);px=new OpenLayers.Pixel(tl.x+Math.floor(this.size.w/2),tl.y+Math.floor(this.size.h/2));this.bounds=new Array();this.bounds[0]=tl.x;this.bounds[1]=tl.y;this.bounds[2]=tl.x+this.size.w;this.bounds[3]=tl.y+this.size.h;this.size.w-=sizeOffsetZ;this.size.h-=sizeOffsetZ;if(row==0)this.bounds[1]-=sizeOffsetZ;else if(this.isIE7||this.isIE){this.bounds[1]+=row+1;}
if(col==0)this.bounds[0]-=sizeOffsetZ;else if(this.isIE7||this.isIE){this.bounds[0]+=col+1;}
this.px=px;this.lonlat=this.map.getLonLatFromLayerPx(px,false);this.offset=new OpenLayers.Pixel(0,0);}
var id=OpenLayers.Util.createUniqueID("ZoneCell_");var pid=OpenLayers.Util.createUniqueID("ZonePin_");this.imageDiv=OpenLayers.Util.createDiv(id,new OpenLayers.Pixel(this.bounds[0],this.bounds[1]),this.size);this.pinDiv=OpenLayers.Util.createDiv(pid,px);this.row=row;this.col=col;if(this.size.w<0)this.size.w=0;if(this.size.h<0)this.size.h=0;this.setDivData();},getBounds:function(){if(!this.bounds)
return null;var tl=new OpenLayers.Pixel(this.bounds[0],this.bounds[1]);var br=new OpenLayers.Pixel(this.bounds[2],this.bounds[3]);if(this.floating)
{var tlLL=this.map.getLonLatFromViewPortPx(tl,false);var brLL=this.map.getLonLatFromViewPortPx(br,false);}
else
{var tlLL=this.map.getLonLatFromLayerPx(tl,false);var brLL=this.map.getLonLatFromLayerPx(br,false);}
function swap(a,b){var t=a;a=b;b=t;}
if(tlLL.lon>brLL.lon){swap(tlLL.lon,brLL.lon);}
if(tlLL.lat<brLL.lat){swap(tlLL.lat,brLL.lat);}
return new OpenLayers.Bounds(tlLL.lon,tlLL.lat,brLL.lon,brLL.lat);},select:function(){var sizeOffset=2;var szOffX=0;var szOffY=0;if(this.isIE||this.isIE7)
{sizeOffset=1;szOffY=1;szOffX=1;}
var _dhtml='<div class="'+this.ovrclass+'" style="width:'+(this.size.w-sizeOffset-szOffX)+'px; height:'+(this.size.h-sizeOffset-szOffY)+'px; border: 1px solid #000; z-index: 1000;"></div>';var style="";style="top: 0px; left: 0px";this.imageDiv.innerHTML='<table class="c_table" style="'+style+'"><tr class="c_tr"><td class="c_td" align="center">'+
_dhtml+'</td></tr></table>';this.pinDiv.className=this.oPinClassName+"Active";this.moveTo(this.px);if(this.altTextTO)
window.clearTimeout(this.altTextTO);this.altTextTO=window.setTimeout(OpenLayers.Function.bind(function()
{if(this.info.alttext)
{var _px=OpenLayers.Util.getDivPosition(this.pinDiv,document.body);this.tips.msg(null,null,this.info.alttext);}},this),GenieMap.ttAltTimeIn*1000);},deselect:function(){if(this.altTextTO)
window.clearTimeout(this.altTextTO);this.altTextTO=null;this.imageDiv.innerHTML='<div class="'+this.ovrclass+'" style="width:'+(this.size.w-2)+'px; height:'+(this.size.h-2)+'px;"></div>';this.pinDiv.className=this.oPinClassName;this.moveTo(this.px);},setDivData:function(){this.zclass="geniemap_zone_cell";this.ovrclass="geniemap_zone_ovr_cell";if(this.row==0){this.zclass+=" geniemap_fr_zone_cell";this.ovrclass+=" geniemap_fr_zone_ovr_cell";}
if(this.col==0){this.zclass+=" geniemap_fc_zone_cell";this.ovrclass+=" geniemap_fc_zone_ovr_cell";}
this.imageDiv.className=this.zclass;this.imageDiv.style.width=this.size.w+'px';this.imageDiv.style.height=this.size.h+'px';this.imageDiv.innerHTML='<div class="'+this.ovrclass+'" style="width:'+(this.size.w-2)+'px; height:'+(this.size.h-2)+'px;"></div>';if(!this.floating)
{var nlen=this.info.text.length;var image_size="";if(nlen>3)
{image_size="Largest";this.pinSize=new OpenLayers.Size(54,54);this.pinOffset=new OpenLayers.Pixel(-27,-27);}
else if(nlen>1)
{image_size="Large";this.pinSize=new OpenLayers.Size(39,40);this.pinOffset=new OpenLayers.Pixel(-19,-19);}
else
{this.pinSize=new OpenLayers.Size(30,30);this.pinOffset=new OpenLayers.Pixel(-15,-15);}
this.oPinClassName="png pinDCenter"+image_size;this.pinDiv.className=this.oPinClassName;this.pinDiv.innerHTML='<table class="c_table"><tr class="c_tr"><td class="c_td"><center>'+'<div style="font-size: 12px; color: white; font-weight:bold; font-family:arial,verdana,sans-serif; margin:0px">'+
this.info.text+'</div></center></td></tr></table>';}
else
{this.oPinClassName="png pinCenter";this.pinDiv.className=this.oPinClassName;this.pinDiv.innerHTML='<table class="c_table"><tr class="c_tr"><td class="c_td"><center>'+'<div class="pinCross"></div></center></td></tr></table>';this.pinSize=new OpenLayers.Size(31,31);this.pinOffset=new OpenLayers.Pixel(-15,-15);}
OpenLayers.Util.blockEventDown(this.pinDiv,"dblclick");},destroy:function(){OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);OpenLayers.Event.stopObservingElement(this.pinDiv.firstChild);this.imageDiv.innerHTML="";this.imageDiv=null;this.pinDiv.innerHTML="";this.pinDiv=null;},clone:function(){return new _ZoneCell(this.info,this.bounds,this.row,this.col,this.zones,this.floating);},setSize:function(size){if(size!=null){this.size=size;}
this.draw();},draw:function(px){this.moveTo(px);this.lonlat=this.map.getLonLatFromLayerPx(px,false);return[this.imageDiv,this.pinDiv];},moveTo:function(px){var floating=this.floating;if(px!=null&&!floating){this.px=px;}
if(this.imageDiv!=null){if(this.px==null){this.display(false);}else{var offsetPx=new OpenLayers.Pixel(this.bounds[0],this.bounds[1]);OpenLayers.Util.modifyDOMElement(this.imageDiv,null,offsetPx);offsetPx=this.px.offset(this.pinOffset);OpenLayers.Util.modifyDOMElement(this.pinDiv,null,offsetPx);}}
this.lonlat=this.map.getLonLatFromLayerPx(px,false);},pointIn:function(px){var tl;if(this.floating)
tl=this.px.offset(this.pinOffset);else
tl=this.map.getViewPortPxFromLayerPx(this.px.offset(this.pinOffset));if((px.x<tl.x)|(px.y<tl.y)|(px.x>(tl.x+this.pinSize.w))|(px.y>(tl.y+this.pinSize.h)))
return false;return true;},display:function(display){this.imageDiv.style.display=(display)?"":"none";this.pinDiv.style.display=(display)?"":"none";}});_Zones=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:false,cells:null,rows:3,cols:3,activeCell:-1,zoneMargin:40,drawn:false,initialize:function(name,options,zbounds){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.cells=[];this.floating=(!zbounds)?true:false;this.setBounds(zbounds);this.map.events.register("mousemove",this,this.mouseMove);this.map.events.register("mousedown",this,this.mouseDown);this.map.events.register("click",this,this.mouseClick);this.tips=new _TooltipManager(this.gmap);this.initialized=true;this.zoneMargin=GenieMap.zoneMargin;},mouseDown:function(e){if(this.activeCell>=0)
OpenLayers.Event.stop(e);return true;},mouseMove:function(e){var position=this.map.events.getMousePosition(e);var pActiveCell=this.activeCell;this.activeCell=-1;for(var i=0;i<this.cells.length;i++)
{if(this.cells[i].pointIn(position))
{this.activeCell=i;break;}}
if(this.activeCell!=pActiveCell)
{if(pActiveCell!=-1&&pActiveCell<this.cells.length)
{this.cells[pActiveCell].deselect();this.gmap.callback.call("zone_mouse_out",this.toXY([this.cells[pActiveCell].row,this.cells[pActiveCell].col]));}
if(this.activeCell!=-1&&this.activeCell<this.cells.length)
{this.cells[this.activeCell].select();this.gmap.callback.call("zone_mouse_over",this.toXY([this.cells[this.activeCell].row,this.cells[this.activeCell].col]));}}
return true;},mouseClick:function(e){if(this.activeCell!=-1)
{var cell=this.cells[this.activeCell];if(Math.abs(this.gmap.map.getZoom()-this.gmap._zoomToExtent(cell.getBounds(),null,true))<2)
{this.tips.msg(null,null,GenieMap.cantZoomMsg,'id_nomorezooms');return false;}
this.gmap.callback.call("zone_clicked",this.toXY([cell.row,cell.col]));if(cell.info.link.length>0)
document.location=cell.info.link;else if(this.floating)
{this.gmap._zoomToExtent(cell.getBounds());}
return false;}
return true;},toXY:function(rc){return[rc[1],this.rows-1-rc[0]];},fromXY:function(xy){return[this.rows-1-xy[1],xy[0]];},setBounds:function(zbounds,reset){if(reset)
this.clearZoneCells();if(!zbounds)
{if(this.cells.length!=(this.rows*this.cols))
{var r,c;for(r=0;r<this.rows;r++)
for(c=0;c<this.cols;c++)
{var xy=this.toXY([r,c]);cell=new _ZoneCell(this.zoneInfo[xy[0]][xy[1]],null,r,c,this,true);this.addZoneCell(cell);}}
return;}
this.clearZoneCells();var tl=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(zbounds.left,zbounds.top));var br=this.map.getLayerPxFromLonLat(new OpenLayers.LonLat(zbounds.right,zbounds.bottom));var r,c;var width=Math.round(Math.abs(tl.x-br.x)/this.cols);var height=Math.round(Math.abs(tl.y-br.y)/this.rows);for(r=0;r<this.rows;r++)
for(c=0;c<this.cols;c++)
{var xy=this.toXY([r,c]);cell=new _ZoneCell(this.zoneInfo[xy[0]][xy[1]],[tl.x+(c*width),tl.y+(r*height),tl.x+(c*width)+width,tl.y+(r*height)+height],r,c,this);this.addZoneCell(cell);}
this.zbounds=zbounds;this.floating=(!zbounds)?true:false;},getCell:function(row,col,isrc)
{if(!isrc)
{rc=this.fromXY([row,col]);row=rc[0];col=rc[1];}
for(var i=0;i<this.cells.length;i++)
if(this.cells[i].row==row&&this.cells[i].col==col)
return this.cells[i];return null;},deinit:function(){if(!this.initialized)
return;this.initialized=false;this.clearZoneCells();this.cells=null;this.map.events.unregister("mousemove",this,this.mouseMove);this.map.events.unregister("click",this,this.mouseClick);},destroy:function(){this.deinit();OpenLayers.Layer.prototype.destroy.apply(this,arguments);},setOpacity:function(opacity){},redraw:function(){this.moveTo(this.map.getExtent(),true,false,true);},moveTo:function(bounds,zoomChanged,dragging,zooming){if(zooming&&Math.abs(this.map.getResolution()-this.fakeResolution)>0.0001)
{this.clearZoneCells();return;}
if(this.floating)
{if(zoomChanged)
this.setBounds(null,true);return;}
OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(zoomChanged&&!this.floating)
{this.setBounds(this.zbounds);}
if(zoomChanged||!this.drawn){for(var i=0;i<this.cells.length;i++){this.drawZoneCell(this.cells[i]);}
this.drawn=true;}},addZoneCell:function(cell){this.cells.push(cell);if(this.opacity!=null){cell.setOpacity(this.opacity);}
if(this.map&&this.map.getExtent()){cell.map=this.map;this.drawZoneCell(cell);}},removeZoneCell:function(cell){if(this.cells&&this.cells.length){OpenLayers.Util.removeItem(this.cells,cell);if((cell.imageDiv!=null)){if(this.floating&&cell.imageDiv.parentNode==this.gmap.mapDiv)
{this.gmap.mapDiv.removeChild(cell.imageDiv);this.gmap.mapDiv.removeChild(cell.pinDiv);}
else if(cell.imageDiv.parentNode==this.div)
{this.div.removeChild(cell.imageDiv);this.div.removeChild(cell.pinDiv);}
cell.drawn=false;}}},clearZoneCells:function(){if(this.cells!=null){while(this.cells.length>0){this.removeZoneCell(this.cells[0]);}}},drawZoneCell:function(cell){if(this.floating)
{var cellDivs=cell.draw(null);if(!cell.drawn){for(var i=0;i<cellDivs.length;i++)
{cellDivs[i].style.zIndex="1000";this.gmap.mapDiv.appendChild(cellDivs[i]);}
cell.drawn=true;}}
else
{var px=this.map.getLayerPxFromLonLat(cell.lonlat);if(px==null){cell.display(false);}else{var cellDivs=cell.draw(px);if(!cell.drawn){for(var i=0;i<cellDivs.length;i++)
{this.div.appendChild(cellDivs[i]);}
cell.drawn=true;}}}},getDataExtent:function(){var maxExtent=null;if(this.cells&&(this.cells.length>0)){var maxExtent=new OpenLayers.Bounds();for(var i=0;i<this.cells.length;i++){var cells=this.cells[i];maxExtent.extend(cells.lonlat);}}
return maxExtent;},calculateInRange:function(){return true;}});BoundingBox=OpenLayers.Class({classType:"BoundingBox",ne:null,sw:null,initialize:function(swlat,swlon,nelat,nelon){if(swlat&&swlon&&nelat&&nelon)
{this.ne=new LatLonPoint(nelat,nelon);this.sw=new LatLonPoint(swlat,swlon);}
else
{this.ne=new LatLonPoint();this.sw=new LatLonPoint();}},toOL:function(){var tr=this.ne.toOL();var bl=this.sw.toOL();return new OpenLayers.Bounds(bl.lon,bl.lat,tr.lon,tr.lat);},fromOL:function(bb){this.sw.fromOL(new OpenLayers.LonLat(bb.left,bb.bottom));this.ne.fromOL(new OpenLayers.LonLat(bb.right,bb.top));},getNorthEast:function(){return this.ne.clone();},getSouthWest:function(){return this.sw.clone();},contains:function(point){return point.lat>=this.sw.lat&&point.lat<=this.ne.lat&&point.lon>=this.sw.lon&&point.lon<=this.ne.lon;},toSpan:function(){return new LatLonPoint(Math.abs(ne.lat-sw.lat),Math.abs(ne.lon-sw.lon));},extend:function(point){if(this.sw.lat>point.lat){this.sw.lat=point.lat;}
if(this.sw.lon>point.lon){this.sw.lon=point.lon;}
if(this.ne.lat<point.lat){this.ne.lat=point.lat;}
if(this.ne.lon<point.lon){this.ne.lon=point.lon;}},toString:function(){return"("+this.sw.toString()+")-("+this.ne.toString()+")";},clone:function(){return new BoundingBox(sw.lat,sw.lon,ne.lat,ne.lon);}});_Marker=OpenLayers.Class({markers:null,map:null,size:null,colSize:null,offset:null,colOffset:null,imageDiv:null,lonlat:null,px:null,isIE:false,isIE7:false,type:0,text:"",iwtext:"",iclass:"",mouseOver:null,mouseOut:null,mouseClick:null,enableInfoWindow:true,imageDivID:null,iclassID:null,onTop:false,oldzIndex:'',infoWin:null,zIndexBase:0,initialize:function(type,lonlat,text,iwtext,owner,iwinbool){this.markers=owner;this.map=owner.map;this.type=type;this.text=text;this.iwtext=iwtext;this.lonlat=lonlat;this.enableInfoWindow=iwinbool;this.isIE=(/MSIE/.test(navigator.userAgent))?true:false;this.isIE8=(OpenLayers.Util.getIEVersion()>=8.0)?true:false;this.isIE7=(this.isIE8==false&&document.all&&!window.opera&&window.XMLHttpRequest)?true:false;this.isIE8Comp=OpenLayers.Util.getIEVersion()>=7.0&&this.isIE8==false;if(/Firefox/.test(navigator.userAgent))
{this.isFF=true;if(navigator.oscpu&&document.getElementsByClassName)
this.isFF3=true;}
else
this.isFF=false;this.imageDivID=OpenLayers.Util.createUniqueID("Marker_");this.iclassID=OpenLayers.Util.createUniqueID("MarkerInner_");this.innerMostID=OpenLayers.Util.createUniqueID("MarkerInnerMost_");this.imageDiv=OpenLayers.Util.createDiv(this.imageDivID);this.setDivData();},putOnTop:function(){this.imageDiv.style.zIndex=this.zIndexOnTop;this.onTop=true;},putBack:function(){this.imageDiv.style.zIndex=this.zIndexBase;this.onTop=false;},activate:function(){var vpSize=this.map.getSize();var panLonLat=this.lonlat.clone();if(this.enableInfoWindow==true)
{if(this.type==Marker.MARKER_PREMIUM)
this.imageDiv.style.display="none";var winHeight=_InfoWindow.windowSize[this.type].h;var winWidth=_InfoWindow.windowSize[this.type].w;var offsetY=0,offsetX=0;;if(winHeight>((vpSize.h-54)/2))
offsetY=Math.floor(winHeight-(vpSize.h)/2)+54;if((winWidth/2)>((vpSize.w/2)-32))
offsetX=Math.floor(winWidth/2-(vpSize.w)/2)+32;if(offsetX!=0||offsetY!=0)
{var pinVP=this.map.getViewPortPxFromLonLat(this.lonlat);pinVP.y-=offsetY;pinVP.x-=offsetX;panLonLat=this.map.getLonLatFromViewPortPx(pinVP);}
this.markers.removeInfoWindow(true);this.infoWin=new _InfoWindow(this.type,this.iwtext,this);this.markers.setInfoWindow(this.infoWin);this.markers.infoWin.display(true);}
this.map.panTo(panLonLat);},close:function(){if(this.infoWin)
{if(this.type==Marker.MARKER_PREMIUM)
this.imageDiv.style.display="block";this.map.resetPanHold=true;this.markers.removeInfoWindow(true);this.infoWin=null;this.map.mouseOverMarker=false;}
return true;},select:function(){var iicDiv=OpenLayers.Util.getElement(this.innerMostID);var icDiv=OpenLayers.Util.getElement(this.iclassID);if(iicDiv==null||icDiv==null)
{if(this.type==Marker.MARKER_PREMIUM&&icDiv!=null)
icDiv.className=this.iclass+"_hover";this.putOnTop();}
else if(!this.onTop)
{if(iicDiv)
iicDiv.style.color=this.innerMostSelectColor;icDiv.className=this.iclass+"_hover";this.putOnTop();}},deselect:function(){var iicDiv=OpenLayers.Util.getElement(this.innerMostID);var icDiv=OpenLayers.Util.getElement(this.iclassID);if(iicDiv==null||icDiv==null)
{if(this.type==Marker.MARKER_PREMIUM&&icDiv!=null)
icDiv.className=this.iclass;this.putBack();}
else if(this.onTop)
{if(iicDiv)
iicDiv.style.color="white";icDiv.className=this.iclass;this.putBack();}},setDivData:function(){this.mouseOver=null;this.mouseOut=null;this.mouseClick=null;var pintext="";var pinWidth=27;var style="";if(this.isIE)
{if(this.isIE7)
style="left: 0px; position: absolute;";else if(this.isIE8)
style="left: -1px; position: absolute;";else if(this.isIE8Comp)
style="left: 0px; position: absolute;";else
style="left: 0px; position: absolute;";}
else
{if(this.isFF3)
style="left: 0px; position: absolute;";else if(this.isFF)
style="left: 0px; position: absolute;";else
style="left: -1px; position: absolute;";}
switch(this.type)
{case Marker.MARKER_LABEL:this.iclass="map_pin";var nlen=this.text.length;if(nlen>3)
{this.iclass+="_largest";pinWidth=39;}
else if(nlen>2)
{this.iclass+="_large";pinWidth=31;}
pintext='<table class="c_table" style="width: '+pinWidth+'px; height: 20px; '+style+'"><tr class="c_tr" style="height: 20px;"><td class="c_td" style="height: 20px;">'+'<div id="'+this.innerMostID+'" style="font-size: 12px; color: white; font-weight:bold; font-family:arial,verdana,sans-serif; margin:0px">'+
this.text+'</div></td></tr></table>';this.innerMostSelectColor="#FF4200";if(this.enableInfoWindow==null)
this.enableInfoWindow=true;break;case Marker.MARKER_CENTER:pinWidth-=0;this.iclass="map_pin_center";if(this.enableInfoWindow==null)
this.enableInfoWindow=true;break;case Marker.MARKER_LANDING:pinWidth-=0;this.iclass="map_pin_landing";if(this.enableInfoWindow==null)
this.enableInfoWindow=false;break;case Marker.MARKER_PREMIUM:pinWidth-=0;this.iclass="map_pin_premium";if(this.enableInfoWindow==null)
this.enableInfoWindow=true;break;case Marker.MARKER_ADVERT:pinWidth-=0;this.iclass="map_pin_advert";pintext='<table class="c_table" style="width: '+pinWidth+'px; height: 20px; '+style+'"><tr class="c_tr" style="height: 20px;"><td class="c_td" style="height: 20px;">'+'<div id="'+this.innerMostID+'" style="font-size: 12px; color: white; font-weight:bold; font-family:arial,verdana,sans-serif; margin:0px">'+
this.text+'</div></td></tr></table>';this.innerMostSelectColor="#7DDC21";if(this.enableInfoWindow==null)
this.enableInfoWindow=true;break;default:return;}
this.setInfoWindowEnabled(this.enableInfoWindow);this.size=new OpenLayers.Size(pinWidth,31);this.colOffset=new OpenLayers.Pixel(-((pinWidth+1)/2),-31);this.colSize=new OpenLayers.Size(pinWidth,20);this.offset=new OpenLayers.Pixel(0,0);this.px=this.map.getLayerPxFromLonLat(this.lonlat);this.imageDiv.className="geniemap_ResPinCont";OpenLayers.Util.modifyDOMElement(this.imageDiv,this.imageDivID,this.px.offset(this.offset),this.size);this.imageDiv.style.zIndex=this.zIndexBase;this.imageDiv.innerHTML='<div id="'+this.iclassID+'" class="'+this.iclass+'" style="width: '+pinWidth+'px;">'+pintext+'</div>';},destroy:function(){OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);this.imageDiv.innerHTML="";this.imageDiv=null;},clone:function(){return new _ZoneCell(this.type,this.lonlat,this.text,this.iwtext,this.markers,this.enableInfoWindow);},setSize:function(size){if(size!=null){this.size=size;}
this.draw();},draw:function(px){this.moveTo(px);return[this.imageDiv];},moveTo:function(px){px=this.map.getLayerPxFromLonLat(this.lonlat,this.markers.fakeResolution);px.x=Math.round(px.x);px.y=Math.round(px.y);if(px!=null){this.px=px;}
if(this.imageDiv!=null){if(this.px==null){this.display(false);}else{var offsetPx=this.px.offset(this.offset);OpenLayers.Util.modifyDOMElement(this.imageDiv,null,offsetPx);}}},setInfoWindowEnabled:function(bool){if(bool==true)
{this.enableInfoWindow=true;this.mouseOver=OpenLayers.Function.bind(this.select,this);this.mouseOut=OpenLayers.Function.bind(this.deselect,this);this.mouseClick=OpenLayers.Function.bind(this.activate,this);}
else
{this.mouseOver=this.mouseOut=this.mouseClick=null;this.enableInfoWindow=false;}},pointIn:function(px){if(!this.colOffset||!this.colSize)
return false;var tl={x:this.px.x+this.colOffset.x,y:this.px.y+this.colOffset.y};if((px.x<tl.x)|(px.y<tl.y)|(px.x>(tl.x+this.colSize.w))|(px.y>(tl.y+this.colSize.h)))
return false;return true;},display:function(display){this.imageDiv.style.display=(display)?"":"none";}});Marker=OpenLayers.Class({classType:"Marker",lonlat:null,type:null,label:"",iwtext:"",_enableInfoWindow:null,marker:null,initialize:function(loc)
{this.type=Marker.MARKER_LABEL;this.lonlat=loc;},isOnMap:function()
{if(this.marker&&this.marker.drawn&&this.marker.drawn==true)
return true;else
return false;},clone:function()
{var newMarker=new Marker(this.lonlat.clone());newMarker.type=this.type;newMarker.label=this.label;newMarker.iwtext=this.iwtext;newMarker._enableInfoWindow=this._enableInfoWindow;return newMarker;},destroy:function()
{if(this.marker)
{this.marker.markers.removeMarker(this.marker);this.marker=null;}},setLabel:function(label)
{this.label=label;if(this.marker)
{this.marker.text=this.label;this.marker.setDivData();}},setHtml:function(html)
{this.iwtext=html;if(this.marker)
{this.marker.iwtext=this.iwtext;this.marker.setDivData();}},setType:function(type)
{this.type=type;if(this.marker)
{this.marker.type=type;this.marker.setDivData();}},enableInfoWindow:function(bool)
{this._enableInfoWindow=bool;if(this.marker)
{if(this.marker.infoWin&&(this.marker.infoWin==this.marker.markers.infoWin))
{this.marker.markers.removeInfoWindow();this.marker.infoWin=null;}
this.marker.setInfoWindowEnabled(bool);}}});Marker.MARKER_LABEL=0;Marker.MARKER_CENTER=1;Marker.MARKER_LANDING=2;Marker.MARKER_ADVERT=3;Marker.MARKER_PREMIUM=4;_Markers=OpenLayers.Class(OpenLayers.Layer,{isBaseLayer:false,markers:null,activeMarker:null,drawn:false,infoWin:null,initialize:function(name,options){OpenLayers.Layer.prototype.initialize.apply(this,arguments);this.markers=[];this.map.events.register("mousemove",this,this.mouseMove);this.map.events.registerPriority("click",this,this.mouseClick);this.initialized=true;},mouseMove:function(evt){if(!this.getVisibility())
return true;var position=this.map.getLayerPxFromViewPortPx(this.map.events.getMousePosition(evt));var pActiveMarker=this.activeMarker;this.activeMarker=null;this.map.stopWheel=false;if(this.infoWin&&this.infoWin.visible&&this.infoWin.pointIn(position))
{this.activeMarker=this.infoWin;this.map.stopWheel=true;this.map.div.style.cursor="";}
else
{if(pActiveMarker&&(pActiveMarker!=this.infoWin)&&pActiveMarker.pointIn(position))
{this.activeMarker=pActiveMarker;}
else
{for(var i=this.markers.length-1;i>=0;i--)
{if(this.markers[i]!=pActiveMarker&&this.markers[i].pointIn(position))
{this.activeMarker=this.markers[i];break;}}}}
if(this.activeMarker!=pActiveMarker)
{if(pActiveMarker!=null)
{if(pActiveMarker.mouseOut)
pActiveMarker.mouseOut();if(pActiveMarker==this.infoWin)
{}
else
this.gmap.callback.call("marker_mouse_out",[pActiveMarker._marker]);this.map.mouseOverMarker=false;this.map.div.style.cursor="";}
if(this.activeMarker!=null)
{if(this.activeMarker.mouseOver)
this.activeMarker.mouseOver();if(this.activeMarker==this.infoWin)
{}
else
this.gmap.callback.call("marker_mouse_over",[this.activeMarker._marker]);this.map.mouseOverMarker=true;if(this.activeMarker!=this.infoWin)
this.map.div.style.cursor="pointer";}}
return true;},closeInfoWindow:function(){if(this.infoWin!=null)
{if(this.infoWin.marker!=null)
{this.infoWin.marker.close();}}
this.infoWin=null;},mouseClick:function(evt){if(!this.getVisibility())
return true;var position=this.map.getLayerPxFromViewPortPx(this.map.events.getMousePosition(evt));if(this.infoWin&&this.infoWin.pointIn(position))
{return false;}
if(this.activeMarker&&this.activeMarker.onTop&&this.activeMarker.pointIn(position))
{if(this.activeMarker.mouseClick)
{this.closeInfoWindow();this.activeMarker.mouseClick();this.gmap.callback.call("marker_clicked",[this.activeMarker._marker]);}
return false;}
for(var i=this.markers.length-1;i>=0;i--)
{if(this.markers[i]!=this.activeMarker&&this.markers[i].pointIn(position))
{if(this.markers[i].mouseClick)
{this.closeInfoWindow();this.markers[i].mouseClick();this.gmap.callback.call("marker_clicked",[this.markers[i]._marker]);}
return false;}}
this.mouseMove(evt);return true;},deinit:function(){if(!this.initialized)return;this.initialized=false;this.clearMarkers();this.markers=null;this.map.events.unregister("mousemove",this,this.mouseMove);this.map.events.unregister("click",this,this.mouseClick);},destroy:function(){this.deinit();OpenLayers.Layer.prototype.destroy.apply(this,arguments);},setOpacity:function(opacity){},redraw:function(){this.moveTo(this.map.getExtent(),true,false);},moveTo:function(bounds,zoomChanged,dragging){OpenLayers.Layer.prototype.moveTo.apply(this,arguments);if(zoomChanged||!this.drawn){for(var i=0;i<this.markers.length;i++){this.drawMarker(this.markers[i]);}
this.drawn=true;}},addMarker:function(marker){this.markers.push(marker);if(this.opacity!=null){marker.setOpacity(this.opacity);}
this.sortMarkers();if(this.map&&this.map.getExtent()){this.drawMarker(marker);}
for(i=0;i<this.markers.length;i++)
this.markers[i].imageDiv.style.zIndex=this.markers[i].zIndexBase;},setInfoWindow:function(iwin){this.removeInfoWindow(true);this.map.addPopup(iwin,true);iwin.setEvents();this.infoWin=iwin;this.gmap.callback.call("marker_opened",[this.infoWin.marker._marker]);},removeInfoWindow:function(destroy){if(!this.infoWin)
return;this.gmap.callback.call("marker_closed",[this.infoWin.marker._marker]);if(!this.infoWin)
return;this.infoWin.display(false);if(destroy)
this.infoWin.destroy();this.map.removePopup(this.infoWin);if(this.activeMarker==this.infoWin)
this.activeMarker=null;this.infoWin=null;},removeMarker:function(marker){if(this.markers&&this.markers.length){OpenLayers.Util.removeItem(this.markers,marker);if((marker.imageDiv!=null)){if(marker.imageDiv.parentNode==this.div)
{this.div.removeChild(marker.imageDiv);}
marker.drawn=false;}
if(marker.infoWin&&(marker.infoWin==this.infoWin))
this.removeInfoWindow();}},sortMarkers:function(){var i;for(i=0;i<this.markers.length;i++)
{var premium_bump=0;if(this.markers[i].type==Marker.MARKER_PREMIUM)
premium_bump=0.00000001;this.markers[i]._sortItem=-(this.markers[i].lonlat.lat-premium_bump);}
OpenLayers.Util.quickSort(this.markers);for(i=0;i<this.markers.length;i++)
{this.markers[i].zIndexBase=i;this.markers[i].zIndexOnTop=this.markers.length;}},clearMarkers:function(){this.closeInfoWindow();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{var markerDivs=marker.draw(px);if(!marker.drawn){for(var i=0;i<markerDivs.length;i++)
{this.div.appendChild(markerDivs[i]);if(marker.setEvents)
marker.setEvents();}
marker.drawn=true;}}},getDataExtent:function(){var maxExtent=null;if(this.markers&&(this.markers.length>0)){var maxExtent=new OpenLayers.Bounds();for(var i=0;i<this.markers.length;i++){var markers=this.markers[i];maxExtent.extend(markers.lonlat);}}
return maxExtent;},calculateInRange:function(){return true;}});_InfoWindow=OpenLayers.Class({marker:null,markers:null,map:null,size:null,offset:null,imageDiv:null,lonlat:null,px:null,isIE:false,isIE7:false,type:0,iwtext:"",iclass:"",imageDivID:null,iclassID:null,html:"",initialize:function(type,html,owner){this.marker=owner;this.markers=owner.markers;this.map=owner.markers.map;this.type=type;this.html=html;this.lonlat=owner.lonlat;if(/MSIE/.test(navigator.userAgent))
{this.isIE=true;}
else
{this.isIE=false;}
this.isIE7=(document.all&&!window.opera&&window.XMLHttpRequest)?true:false;if(/Firefox/.test(navigator.userAgent))
{this.isFF=true;if(navigator.oscpu&&document.getElementsByClassName)
this.isFF3=true;}
else
{this.isFF=false;}
this.imageDivID=OpenLayers.Util.createUniqueID("InfoWindow_");this.innerDivID=OpenLayers.Util.createUniqueID("InfoWinInsidePanel_");this.closeDivID=OpenLayers.Util.createUniqueID("InfoWindowClose_");this.imageDiv=OpenLayers.Util.createDiv(this.imageDivID);this.div=this.imageDiv;this.setDivData();this.display(false);},setDivData:function(){var inClass="";var xClass="";var bgImage="";var xOffset=0;var yOffset=0;this.size=_InfoWindow.windowSize[this.type].clone();switch(this.type)
{case Marker.MARKER_LANDING:inClass="geniemap_infoWinInsidePanel";xClass="geniemap_infoWinCloseImg";bgImage="map-info-bg.";xOffset=-1;break;case Marker.MARKER_LABEL:inClass="geniemap_infoWinInsidePanel";xClass="geniemap_infoWinCloseImg";bgImage="map-info-bg.";xOffset=-1;break;case Marker.MARKER_CENTER:inClass="geniemap_CInfoWinInsidePanel";xClass="geniemap_CInfoWinCloseImg";bgImage="center-display-bg.";xOffset=-1;break;case Marker.MARKER_ADVERT:inClass="geniemap_infoWinInsidePanel";xClass="geniemap_infoWinCloseImg";bgImage="ad-map-info-bg.";xOffset=0;break;case Marker.MARKER_PREMIUM:inClass="geniemap_infoWinInsidePanel";xClass="geniemap_infoWinCloseImg";bgImage="premium-map-info-bg.";xOffset=0;yOffset=1;break;default:break;}
if(this.isIE&&!this.isIE7)
bgImage+="gif";else
bgImage+="png";if(this.isIE||this.isIE7)
this.size.w+=2;this.imageDiv=OpenLayers.Util.createDiv(this.imageDivID);this.imageDiv.style.width=this.size.w+"px";this.imageDiv.style.height=this.size.h+"px";this.imageDiv.style.background="url(/site_media/geniemap-api-ol-bedrock/install/images/"+bgImage+") no-repeat top left";this.imageDiv.style.margin="0px";this.imageDiv.style.padding="0px";this.imageDiv.style.zIndex="2";this.colSize=new OpenLayers.Size(this.size.w,this.size.h-12);this.colOffset=new OpenLayers.Pixel(-Math.floor((this.size.w)/2)+xOffset,-this.size.h+yOffset);this.offset=this.colOffset.clone();this.px=this.marker.px;var html='<div class="'+xClass+' clearfix"><a href="" id="'+this.closeDivID+'"></a></div>';html+='<div id="'+this.innerDivID+'" class="'+inClass+' clearfix">'+this.html+'</div>';this.imageDiv.innerHTML=html;},moveStart:function(){var style=document.defaultView.getComputedStyle(this.innerDiv,null);var currentOverflow=style.getPropertyValue("overflow");var currentScrollTop=this.innerDiv.scrollTop;if(currentOverflow!="hidden"){this.innerDiv._oldOverflow=currentOverflow;this.innerDiv._oldScrollTop=currentScrollTop;this.innerDiv.style.overflow="hidden";}},moveEnd:function(){var oldOverflow=this.innerDiv._oldOverflow;var oldScrollTop=this.innerDiv._oldScrollTop;if(oldOverflow){this.innerDiv.style.overflow=oldOverflow;this.innerDiv.scrollTop=oldScrollTop;this.innerDiv._oldOverflow=null;this.innerDiv._oldScrollTop=null;}},setEvents:function(){OpenLayers.Event.observe(OpenLayers.Util.getElement(this.closeDivID),"click",OpenLayers.Function.bind(function(e){this.marker.close();OpenLayers.Event.stop(e);},this));this.events=new OpenLayers.Events(this,this.imageDiv,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});this.innerDiv=OpenLayers.Util.getElement(this.innerDivID);this.innerDiv.style.overflow="auto";if(this.isFF&&!this.isFF3){this.map.events.register("movestart",this,this.moveStart);this.map.events.register("moveend",this,this.moveEnd);}
if(this.isIE7)
{OpenLayers.Util.getElement(this.closeDivID).style.right="6px";}},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){},onmouseout:function(evt){this.mousedown=false;},ondblclick:function(evt){OpenLayers.Event.stop(evt,true);},destroy:function(){this.map.events.unregister("movestart",this,this.moveStart);this.map.events.unregister("moveend",this,this.moveEnd);this.events.destroy();this.events=null;this.imageDiv.innerHTML="";this.imageDiv=null;},clone:function(){return new _InfoWindow(this.type,this.html,this.marker);},setSize:function(size){if(size!=null){this.size=size;}
this.draw();},draw:function(px){if(px==null){if((this.lonlat!=null)&&(this.map!=null)){px=this.marker.px;}}
this.moveTo(px);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=function(){return false;};}
return[this.imageDiv];},moveTo:function(px){if((px!=null)&&(this.imageDiv!=null)){var offsetPx=px.offset(this.offset);this.imageDiv.style.left=offsetPx.x+"px";this.imageDiv.style.top=offsetPx.y+"px";}},updatePosition:function(px){this.px=this.marker.px;px=this.px;this.moveTo(px);},display:function(display){this.imageDiv.style.display=(display)?"":"none";this.visible=display;if(display)
{this.updatePosition();}},pointIn:function(px){var tl={x:this.px.x+this.colOffset.x,y:this.px.y+this.colOffset.y};if((px.x<tl.x)|(px.y<tl.y)|(px.x>(tl.x+this.colSize.w))|(px.y>(tl.y+this.colSize.h)))
return false;return true;}});window._InfoWindow.windowSize=[new OpenLayers.Size(263,150),new OpenLayers.Size(263,150),new OpenLayers.Size(263,150),new OpenLayers.Size(263,150),new OpenLayers.Size(263,151)];_Navigation=OpenLayers.Class({gmap:null,divs:null,divIDs:null,divClass:null,slider:null,zoomInOutPause:150,normalPause:125,initialize:function(owner){this.gmap=owner;this.tips=new _TooltipManager(this.gmap);if(/MSIE/.test(navigator.userAgent))
{this.isIE=true;}
else
{this.isIE=false;}
this.isIE7=(document.all&&!window.opera&&window.XMLHttpRequest)?true:false;if(this.isIE&&!this.isIE7)
this.imgExt="gif";else
this.imgExt="png";this.divs={};this.divIDs={};this.divClass={};this.divs["root"]=this.gmap.mapDiv;this.mkDiv("nav_container","geniemap_navigatorContainer");this.mkDiv("nav_top","geniemap_navigatorTop");this.mkDiv("nav_top_p1","geniemap_navigatorTop_part1");this.mkDiv("nav_top_p2","geniemap_navigatorTop_part2");this.mkDiv("nav_reset","geniemap_navigatorReset");this.mkDiv("nav_zoomin","geniemap_navigatorZoomIn");this.mkDiv("nav_zoomout","geniemap_navigatorZoomOut");this.mkDiv("nav_slider_bg","geniemap_sliderbg");this.mkDiv("nav_slider_thumb","geniemap_sliderthumb");this.mkDiv("nav_slider_thumb_img","geniemap_sliderthumbImg");this.mkDiv("nav_labels","geniemap_navigator_labels");this.mkDiv("nav_label_street","geniemap_navigator_label");this.mkDiv("nav_label_city","geniemap_navigator_label");this.mkDiv("nav_label_state","geniemap_navigator_label");this.mkDiv("nav_label_country","geniemap_navigator_label");var filler='<img src="/site_media/geniemap-api-ol-bedrock/install/images/pixel.gif" height="100%" width="100%" alt="" />';this.mkParent("root","nav_container");this.mkParent("nav_container","nav_top");this.mkParent("nav_top","nav_top_p1");this.mkParent("nav_top_p1","nav_reset");this.appendHtml("nav_reset",filler);this.mkParent("nav_top","nav_top_p2");this.appendHtml("nav_top_p2",filler);this.mkParent("nav_top_p2","nav_zoomin");this.appendHtml("nav_zoomin",filler);this.mkParent("nav_top_p2","nav_zoomout");this.appendHtml("nav_zoomout",filler);this.mkParent("nav_top_p2","nav_slider_bg");this.appendHtml("nav_slider_bg",filler);this.mkParent("nav_slider_bg","nav_slider_thumb");this.mkParent("nav_slider_thumb","nav_slider_thumb_img");this.divs["nav_slider_thumb_img"].style.background='url(/site_media/geniemap-api-ol-bedrock/install/images/slider.gif) no-repeat top left';this.mkParent("nav_container","nav_labels");this.divs["nav_labels"].style.display="none";this.appendHtml("nav_labels",filler);this.mkParent("nav_labels","nav_label_street");this.divs["nav_label_street"].style.top="6px";this.appendHtml("nav_label_street","<span>Street</span>");this.mkParent("nav_labels","nav_label_city");this.divs["nav_label_city"].style.top="26px";this.appendHtml("nav_label_city","<span>City</span>");this.mkParent("nav_labels","nav_label_state");this.divs["nav_label_state"].style.top="54px";this.appendHtml("nav_label_state","<span>State</span>");this.mkParent("nav_labels","nav_label_country");this.divs["nav_label_country"].style.top="70px";this.appendHtml("nav_label_country","<span>Country</span>");this.navLabelZooms={"nav_label_street":18,"nav_label_city":13,"nav_label_state":6,"nav_label_country":2};OpenLayers.Util.disableSelectionDown(this.divs["nav_container"],{noMouseDown:true});OpenLayers.Util.blockEventDown(this.divs["nav_container"],"dblclick");OpenLayers.Event.observe(this.divs["nav_reset"],"click",OpenLayers.Function.bind(this.resetClicked,this));OpenLayers.Event.observe(this.divs["nav_zoomin"],"click",OpenLayers.Function.bind(this.zoomInClicked,this));OpenLayers.Event.observe(this.divs["nav_zoomout"],"click",OpenLayers.Function.bind(this.zoomOutClicked,this));OpenLayers.Event.observe(this.divs["nav_container"],"mouseover",OpenLayers.Function.bind(this.labelsOver,this));OpenLayers.Event.observe(this.divs["nav_container"],"mouseout",OpenLayers.Function.bind(this.labelsOut,this));OpenLayers.Event.observe(this.divs["nav_reset"],"mouseover",OpenLayers.Function.bind(function()
{this.divs["nav_top"].style.background="url(/site_media/geniemap-api-ol-bedrock/install/images/zoom-back."+this.imgExt+") no-repeat -21px 0px";if(this.resetAlt&&this.resetAlt.length)
{if(this.resetAltTO)
{window.clearTimeout(this.resetAltTO);this.resetAltTO=null;}
this.resetAltTO=window.setTimeout(OpenLayers.Function.bind(function()
{this.tips.msg(null,null,this.resetAlt);this.resetAltTO=null;},this),GenieMap.ttAltTimeIn*1000);}},this));OpenLayers.Event.observe(this.divs["nav_reset"],"mouseout",OpenLayers.Function.bind(function()
{this.divs["nav_top"].style.background="url(/site_media/geniemap-api-ol-bedrock/install/images/zoom-back."+this.imgExt+") no-repeat 0px 0px";if(this.resetAltTO)
{window.clearTimeout(this.resetAltTO);this.resetAltTO=null;}},this));this.mouseOutTimeout=null;for(var div in this.divs)
{if(div!="root")
{OpenLayers.Event.observe(this.divs[div],"mousedown",OpenLayers.Function.bind(function(e)
{if(this.divs["nav_slider_bg"]._mouseIn==false)
{this.gmap.map._mouseDown=true;OpenLayers.Event.stop(e);}
return false;},this));OpenLayers.Event.observe(this.divs[div],"mouseup",OpenLayers.Function.bind(function(e)
{this.gmap.map._mouseDown=false;{this.sliderMoving=true;}
return true;},this));}}
OpenLayers.Event.observe(this.divs["nav_container"],"click",OpenLayers.Function.bind(function(e)
{this.gmap.map._mouseDown=false;{for(var label in this.navLabelZooms)
{var div=this.divs[label];if(div._mouseIn&&div._mouseIn==true)
{this.sliderMoving=true;this.slider.setZoom(this.navLabelZooms[label]);return true;}}}
this.sliderChanged();return true;},this));OpenLayers.Event.observe(this.divs["nav_container"],"mousemove",OpenLayers.Function.bind(function(e)
{if(OpenLayers.Util.eventMouseIn(e,this.divs["nav_container"]))
{if(this.mouseOutTimeout)
{window.clearTimeout(this.mouseOutTimeout);this.mouseOutTimeout=null;}}
for(var label in this.navLabelZooms)
{var div=this.divs[label];if(OpenLayers.Util.eventMouseIn(e,div,{dsz:new OpenLayers.Size(58,13)}))
{div._mouseIn=true;if(div.className=="geniemap_navigator_label")
{div.className="geniemap_navigator_label_hover";}}
else
{div._mouseIn=false;if(div.className=="geniemap_navigator_label_hover"&&!div._forceHover)
{div.className="geniemap_navigator_label";}}}
if(OpenLayers.Util.eventMouseIn(e,this.divs["nav_slider_bg"]))
{this.divs["nav_slider_bg"]._mouseIn=true;}
else
{this.divs["nav_slider_bg"]._mouseIn=false;}
return true;},this));this.slider=new _Slider(this.gmap,this.divs["nav_slider_bg"],this.divs["nav_slider_thumb"]);this.firstChange=false;this.sliderTimeout=this.normalPause;this.gmap.map.events.register("zoomend",this,this.zoomChanged);this.slider.moveComplete=OpenLayers.Function.bind(this.sliderChanged,this);this.slider.moving=OpenLayers.Function.bind(this.sliderChanging,this);},labelsOver:function()
{if(this.mouseOutTimeout)
{window.clearTimeout(this.mouseOutTimeout);this.mouseOutTimeout=null;}
this.divs["nav_labels"].style.display="block";},labelsOut:function()
{if(this.mouseOutTimeout)
{window.clearTimeout(this.mouseOutTimeout);}
this.mouseOutTimeout=window.setTimeout(OpenLayers.Function.bind(function(){this.divs["nav_labels"].style.display="none";this.mouseOutTimeout=null;},this),0.25*1000);},resetClicked:function()
{this.gmap.callback.call("reset_clicked",[]);if(this.gmap.resetExtent)
this.gmap._zoomToExtent(this.gmap.resetExtent,-1);this.gmap.markerLayer.closeInfoWindow();},zoomInClicked:function()
{var level=this.slider.getZoom()+1;if(level>=this.gmap.scaleCount)
{this.gmap.tips.msg(null,null,GenieMap.cantZoomMsg,'id_nomorezooms');level=this.gmap.scaleCount-1;}
if(level!=this.slider.getZoom())
{if(this.slideChangeTimeoutID)
window.clearTimeout(this.slideChangeTimeoutID);this.slideChangeTimeoutID=null;this.sliderTimeout=this.zoomInOutPause;this.slider.setZoom(level);}},zoomOutClicked:function()
{var level=this.slider.getZoom()-1;if(level<0)
{this.gmap.tips.msg(null,null,GenieMap.cantZoomMsg,'id_nomorezooms');level=0;}
if(level!=this.slider.getZoom())
{if(this.slideChangeTimeoutID)
window.clearTimeout(this.slideChangeTimeoutID);this.slideChangeTimeoutID=null;this.sliderTimeout=this.zoomInOutPause;this.slider.setZoom(level);}},sliderChanging:function()
{var level=this.slider.getZoom();for(label in this.navLabelZooms)
{var div=this.divs[label];var nlevel=this.navLabelZooms[label];if(nlevel==level)
{if(div.className=="geniemap_navigator_label")
{div.className="geniemap_navigator_label_hover";}
div._forceHover=true;}
else
{if(!div._mouseIn)
{div.className="geniemap_navigator_label";}
div._forceHover=false;}}},sliderChanged:function(notEvent)
{if(this.slideChangeTimeoutID)
window.clearTimeout(this.slideChangeTimeoutID);this.slideChangeTimeoutID=window.setTimeout(OpenLayers.Function.bind(this._sliderChanged,this),this.sliderTimeout);},_sliderChanged:function()
{this.sliderTimeout=this.normalPause;this.slideChangeTimeoutID=null;var level=this.slider.getZoom();this.sliderChanging();if(this.gmap.map._mouseDown==true)
return;if(this.firstChange)
return;if(level!=this.gmap.map.getZoom()&&!(this.slider.passiveChange==true))
{this.gmap.map.events.unregister("zoomend",this,this.zoomChanged);this.gmap.map.setCenter(null,level);this.gmap.map.events.register("zoomend",this,this.zoomChanged);}
this.sliderMoving=false;this.slider.passiveChange=false;},zoomChanged:function()
{var level=this.gmap.map.getZoom();for(var label in this.navLabelZooms)
{if(level==this.navLabelZooms[label])
this.divs[label].className="geniemap_navigator_label_active";else if(this.divs[label].className=="geniemap_navigator_label_active")
this.divs[label].className="geniemap_navigator_label";}
if(level!=this.slider.getZoom())
{this.slider.passiveChange=true;this.slider.setZoom(level);}
this.skipNextCBChange=false;this.firstChange=false;},appendHtml:function(tag,html)
{var old_html=this.divs[tag].innerHTML;if(!old_html)old_html="";this.divs[tag].innerHTML=old_html+html;},mkParent:function(parent,child)
{this.divs[parent].appendChild(this.divs[child]);this.divs[child]._owner=this;this.divs[child].className=this.divClass[child];},mkDiv:function(tag,className)
{this.divIDs[tag]=OpenLayers.Util.createUniqueID(tag+"_");this.divs[tag]=OpenLayers.Util.createDiv(this.divIDs[tag]);this.divClass[tag]=className;},destroy:function(){}});function safeParseInt(val){return Math.round(parseFloat(val));};_ScaleBar=new OpenLayers.Class({initialize:function(scaleDenominator,owner)
{this.map=owner;this.scaleDenominator=(scaleDenominator==null)?1:scaleDenominator;this.displaySystem='english';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);},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 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'],abbr:['mi','ft'],inches:[63360,12]};measurementProperties.metric={units:['kilometers','meters'],abbr:['km','m'],inches:[39370.07874,39.370079]};var ext=this.map.getExtent().toArray();var p1=new OpenLayers.LonLat(ext[0],ext[1]);var p2=new OpenLayers.LonLat(ext[2],ext[3]);var p1ll=new LatLonPoint(),p2ll=new LatLonPoint();p1ll.fromOL(p1);p2ll.fromOL(p2);var inches=OpenLayers.Util.distInches(p1ll,p2ll);var vpsz=this.map.getSize();var pixels=Math.sqrt(vpsz.w*vpsz.w+vpsz.h*vpsz.h);var dpi=pixels/inches;var comparisonArray=new Array();for(var unitIndex=0;unitIndex<measurementProperties[this.displaySystem].units.length;++unitIndex){comparisonArray[unitIndex]=new Object();var pixelsPerDisplayUnit=dpi*measurementProperties[this.displaySystem].inches[unitIndex];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=dpi*measurementProperties[this.displaySystem].inches[unitIndex];subdivisionPixelLength=pixelsPerDisplayUnit*subdivisionDisplayLength;}}}
var xOffsetMarkerMajor=1;var xOffsetMarkerMinor=1;var xOffsetBar=0;var xOffsetBarAlt=0;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));if(markerMeasure!=0){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.8em';labelBox.style.left=(xPosition+10)+'px';}
else{labelText='';labelBox.className='sbLabelBox';labelBox.style.textAlign='center';labelBox.style.width=(safeParseInt(numbersBox.style.width)+Math.round(markerMeasure.toString().length*6)+6)+'px';labelBox.style.left=Math.round(alignmentOffset[this.align]+5)+'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);},place:function(elementId){if(elementId==null){document.body.appendChild(this.container);}
else{var anElement=OpenLayers.Util.getElement(elementId);if(anElement!=null){anElement.appendChild(this.container);}}
this.update();},getContainer:function()
{return this.container;}});_Buttons=OpenLayers.Class({divs:null,divIDs:null,divClass:null,gmap:null,button_labels:null,button_tags:null,button_ids:null,active_button:null,initialize:function(owner,active_b,button_l,button_id)
{this.divs={};this.divIDs={};this.divClass={};this.gmap=owner;this.button_ids=(button_id)?button_id:[0,1,2,3];this.button_labels=(button_l)?button_l:["Map","Zones","Hybrid","Pins"];this.button_tags=[];this.active_button=(active_b)?active_b:0;this.divs["root"]=this.gmap.mapDiv;this.mkDiv("button_container","geniemap_map_buttons_cont");OpenLayers.Event.observe(document.body,"mouseup",OpenLayers.Function.bind(function(e){this.mouseDown=false;return true;},this));OpenLayers.Event.observe(document.body,"mouseout",OpenLayers.Function.bind(function(e){this.mouseDown=false;return true;},this));this.mkParent("root","button_container");for(var i=0;i<this.button_labels.length;i++)
{tag="_button_"+this.button_labels[i];this.mkDiv(tag,"geniemap_map_buttons"+((this.active_button==i)?"_active":""));this.button_tags.push(tag);this.mkParent("button_container",tag);this.divs[tag].style.position="relative";this.appendHtml(tag,this.button_labels[i]);OpenLayers.Event.observe(this.divs[tag],"mousedown",OpenLayers.Function.bind(function(e){this.mouseDown=true;OpenLayers.Event.stop(e);},this));OpenLayers.Event.observe(this.divs[tag],"mousemove",OpenLayers.Function.bind(function(e)
{if(this.mouseDown)
{OpenLayers.Event.stop(e);}
return false;},this));OpenLayers.Event.observe(this.divs[tag],"mouseover",OpenLayers.Function.bind(this.mouseOver,this));OpenLayers.Event.observe(this.divs[tag],"mouseout",OpenLayers.Function.bind(this.mouseOut,this));OpenLayers.Event.observe(this.divs[tag],"click",OpenLayers.Function.bind(this.click,this));}
OpenLayers.Util.disableSelectionDown(this.divs["button_container"]);OpenLayers.Util.blockEventDown(this.divs["button_container"],"dblclick");},remapID:function(index)
{for(var i=0;i<this.button_ids.length;i++)
if(this.button_ids[i]==index)
{return i;break;}
return index;},addButton:function(index,nremapid)
{if(!nremapid)
index=this.remapID(index);this.divs[this.button_tags[index]].style.display="block";},removeButton:function(index,nremapid)
{if(!nremapid)
index=this.remapID(index);this.divs[this.button_tags[index]].style.display="none";},addAllButtons:function()
{for(var i=0;i<this.button_tags.length;i++)
this.addButton(i,true);},removeAllButtons:function()
{for(var i=0;i<this.button_tags.length;i++)
this.removeButton(i,true);},mouseOver:function(e)
{if(!e)var e=window.event;var tg=(window.event)?e.srcElement:e.target;for(var i=0;i<this.button_tags.length;i++)
if(tg==this.divs[this.button_tags[i]])
{if(this.active_button!=i)
{tg.className="geniemap_map_buttons_hover";tg.style.display="block";}
this.gmap.callback.call("button_mouse_over",[this.button_ids[i]]);break;}},mouseOut:function(e)
{if(!e)var e=window.event;var tg=(window.event)?e.srcElement:e.target;for(var i=0;i<this.button_tags.length;i++)
if(tg==this.divs[this.button_tags[i]])
{if(this.active_button!=i)
{tg.className="geniemap_map_buttons";tg.style.display="block";}
this.gmap.callback.call("button_mouse_out",[this.button_ids[i]]);break;}},click:function(e)
{this.mouseDown=false;if(!e)var e=window.event;var tg=(window.event)?e.srcElement:e.target;for(var i=0;i<this.button_tags.length;i++)
if(tg==this.divs[this.button_tags[i]])
{if(this.active_button!=i)
{this.activateButton(i,tg);}
break;}},activateButton:function(id,_tg)
{var cbk=true;var tg=_tg;if(tg==null)
{for(var i=0;i<this.button_ids.length;i++)
if(this.button_ids[i]==id)
{tg=this.divs[this.button_tags[i]];id=i;break;}
if(!tg)
return;cbk=false;}
if(this.active_button==id)
return;var display=tg.style.display;tg.className="geniemap_map_buttons_active";tg.style.display=display;this.divs[this.button_tags[this.active_button]].className="geniemap_map_buttons";this.active_button=id;if(this.buttonChangeCbk&&cbk)
this.buttonChangeCbk(this.button_ids[this.active_button]);},appendHtml:function(tag,html)
{var old_html=this.divs[tag].innerHTML;if(!old_html)old_html="";this.divs[tag].innerHTML=old_html+html;},mkParent:function(parent,child)
{this.divs[parent].appendChild(this.divs[child]);this.divs[child]._owner=this;this.divs[child].className=this.divClass[child];},mkDiv:function(tag,className)
{this.divIDs[tag]=OpenLayers.Util.createUniqueID(tag+"_");this.divs[tag]=OpenLayers.Util.createDiv(this.divIDs[tag]);this.divClass[tag]=className;},destroy:function()
{}});_Tooltip=OpenLayers.Class({map:null,size:null,divID:null,div:null,px:null,html:"",initialize:function(px,size,html,owner,id){this.id=(id)?id:null;this.init=true;this.px=px;this.size=size;this.owner=owner;this.map=owner.map;this.html=html;this.events=null;this.parent=document.body;this.timeOut=GenieMap.ttTimeLeave;this.divID=OpenLayers.Util.createUniqueID("tooltip_");this.div=OpenLayers.Util.createDiv(this.divID);this.parent.appendChild(this.div);this.div.style.position="absolute";this.div.style.zIndex="3000";if(this.size)
{this.div.style.width=size.w+"px";this.div.style.height=size.h+"px";}
else
{this.div.style.width="auto";this.div.style.height="auto";}
this.div.style.backgroundColor="#fdfbe7";this.div.style.padding="3px";this.div.style.border="1px solid #808080";this.div.innerHTML='<center><div style="font-size: 12px; color: black; font-weight:bold; font-family:arial,verdana,sans-serif; margin:0px">'+html+'</div></center>';this.div.style.display="block";this.div.style.cursor="default";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});this.div.style.overflow="hidden";OpenLayers.Util.disableSelectionDown(this.div);if(!px)
{px=this.owner.mousePos;if(px)px=px.clone();else px=new OpenLayers.Pixel(0,0);px.y+=21;this.px=px;}
this.div.style.left=px.x+"px";this.div.style.top=px.y+"px";this.setTimeout(1.5);},setTimeout:function(factor)
{var f=(factor)?factor:1.0;this.clearTimeout();this.closeTimeout=window.setTimeout(OpenLayers.Function.bind(function(){this.destroy();},this),this.timeOut*f*1000);},clearTimeout:function()
{if(this.closeTimeout)
window.clearTimeout(this.closeTimeout);this.closeTimeout=null;},onmousedown:function(evt){this.mousedown=true;OpenLayers.Event.stop(evt,true);},onmousemove:function(evt){this.clearTimeout();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){this.destroy();OpenLayers.Event.stop(evt,true);},onmouseout:function(evt){this.mousedown=false;this.setTimeout();},ondblclick:function(evt){this.destroy();OpenLayers.Event.stop(evt,true);},destroy:function(){this.init=false;this.clearTimeout();this.events.destroy();this.events=null;this.div.innerHTML="";if(this.div.parentNode==this.parent)
this.parent.removeChild(this.div);this.div=null;}});_TooltipManager=OpenLayers.Class({tips:null,gmap:null,events:null,mousePos:null,initialize:function(owner)
{this.gmap=owner;this.tips=new Array();this.events=new OpenLayers.Events(this,this.gmap.mainDiv,null,true);this.events.on({"mousemove":this.updateMousePos,scope:this});},updateMousePos:function(e)
{var newPos=OpenLayers.Util.eventGetMousePosition(e);if(this.mousePos)
if(Math.abs(newPos.x-this.mousePos.x)>3||Math.abs(newPos.y-this.mousePos.y)>3)
this.clearAll();this.mousePos=OpenLayers.Util.eventGetMousePosition(e);return true;},msg:function(px,size,html,id)
{for(var i=0;i<this.tips.length;i++)
if(this.tips[i].id&&this.tips[i].id==id)
{if(this.tips[i].init==true)
{this.tips[i].destroy();this.tips.splice(i,1);i--;}}
this.tips.push(new _Tooltip(px,size,html,this,id));},clearAll:function()
{for(var i=0;i<this.tips.length;i++)
if(this.tips[i].init)
this.tips[i].destroy();this.tips=[];},destroy:function()
{this.clearAll();this.events.destroy();this.events=this.tips=this.gmap=this.mousePos=null;}});_Callback=OpenLayers.Class({callbacks:null,lastid:null,initialize:function()
{this.callbacks={};this.lastid=0;},destroy:function()
{this.callbacks=null;this.lastid=null;},remove:function(name,id)
{var cb=this.callbacks[name];if(cb)
{for(var i=0;i<cb.length;i++)
if(cb[i][1]==id)
{cb.splice(i,1);return true;}}
return false;},call:function(name,args)
{var cb=this.callbacks[name];if(cb)
{for(var i=0;i<cb.length;i++)
cb[i][0].apply(null,args);}},clear:function()
{this.callbacks={};this.lastid=0;},add:function(name,func,_this)
{var cb=this.callbacks[name];if(!cb)this.callbacks[name]=cb=new Array();id=this.lastid;this.lastid++;cb.push([(_this)?OpenLayers.Function.bind(func,_this):func,id]);return id;}});_Slider=OpenLayers.Class({gmap:null,divs:null,value:null,startValue:null,targetValue:null,moveComplete:null,moving:null,slideTO:null,events:null,startTime:null,zoomSmallDuration:0.1,zoomLargeDuration:0.5,slideDuration:0.5,updateFreq:40,pixPerTick:4,initialize:function(owner,bgDiv,thumbDiv)
{this.gmap=owner;this.divs={bg:bgDiv,thumb:thumbDiv};this.value=this.targetValue=null;this.slideTO=null;this.updateValue();this.events=new OpenLayers.Events(this,this.divs["bg"],null,true);this.mouseDown=false;this.events.on({"mousedown":this.onmousedown,"click":this.onclick,"dblclick":this.ondblclick,scope:this});this.globalEvents=new OpenLayers.Events(this,this.gmap.mapDiv,null,true);this.globalEvents.on({"mousemove":this.onmousemove,"mouseup":this.onmouseup,"mouseout":this.onmouseout,scope:this});},onmousemove:function(e)
{if(this.mouseDown)
{var mousep=OpenLayers.Util.eventGetMousePosition(e);var divp=OpenLayers.Util.getDivPosition(this.divs["bg"]);this.delayEvent=true;var newZoom=this.zoomForTop(mousep.y-divp.y);if(Math.abs(this.value-newZoom)<=1)
this.dragging=true;if(newZoom!=this.value)
{if(!this.dragging)
this.setZoom(this.zoomForTop(mousep.y-divp.y));else
this.forceZoom(this.zoomForTop(mousep.y-divp.y));}
OpenLayers.Event.stop(e);}
return true;},onmouseup:function(e)
{this.mouseDown=false;if(((this.delayEvent&&this.readyEnd)||this.dragging)&&this.moveComplete)
this.moveComplete();this.dragging=false;this.delayEvent=this.readyEnd=false;return true;},onmouseout:function(e)
{if(OpenLayers.Util.eventMouseIn(e,this.gmap.mapDiv))
return true;this.mouseDown=false;if(((this.delayEvent&&this.readyEnd)||this.dragging)&&this.moveComplete)
this.moveComplete();this.dragging=false;this.delayEvent=this.readyEnd=false;return true;},onmousedown:function(e)
{this.mouseDown=true;var mousep=OpenLayers.Util.eventGetMousePosition(e);var divp=OpenLayers.Util.getDivPosition(this.divs["bg"]);this.delayEvent=true;this.setZoom(this.zoomForTop(mousep.y-divp.y));OpenLayers.Event.stop(e);return false;},onclick:function(e){OpenLayers.Event.stop(e);return false;},ondblclick:function(e){OpenLayers.Event.stop(e);return false;},destroy:function()
{this.events.destroy();this.globalEvents.destroy();this.gmap=this.slideTO=this.moveComplete=this.moving=this.value=this.dragging=this.targetValue=this.startValue=this.divs=this.events=this.globalEvents=this.mouseDown=this.readyEnd=this.delayEvent=this.startTime=null;},stopSlide:function(restart)
{if(this.slideTO)
{window.clearTimeout(this.slideTO);this.slideTO=null;var eq=this.value==this.targetValue;this.value=this.targetValue;if(this.moving&&!eq&&!restart)
this.moving();if(this.moveComplete)
this.moveComplete();this.updateValue();}},startSlide:function()
{if(this.slideTO)
{this.stopSlide(true);this.updateValue();}
this.slideTO=window.setTimeout(OpenLayers.Function.bind(function(){this.slideTO=null;if(this.moving)
this.moving();if(Math.abs(this.value-this.targetValue)<(0.25))
{this.value=this.targetValue;this.updateValue();if(this.delayEvent)
{this.readyEnd=true;}
else
{if(this.moveComplete)
this.moveComplete();}
return;}
else
{var t=this.curTime();this.value=OpenLayers.Easing.Expo.easeOut(t,this.startValue,this.targetValue-this.startValue,this.slideDuration);}
this.updateValue();this.startSlide();},this),Math.round((1.0/this.updateFreq)*1000));},updateValue:function()
{this.divs["thumb"].style.top=this.topForZoom(this.value)+"px";this.divs["thumb"].style.display="block";},forceZoom:function(zoom)
{zoom=Math.floor(zoom);if(this.slideTO)
{window.clearTimeout(this.slideTO);this.slideTO=null;}
var eq=this.value==zoom;this.value=this.targetValue=zoom;if(this.moving&&!eq)
this.moving();this.updateValue();},setZoom:function(zoom)
{zoom=Math.floor(zoom);if(this.zoom==null)
{this.zoom=0;}
if(zoom==this.targetZoom&&this.slideTO)
return;this.stopSlide(true);if(zoom==this.value)
return;if(Math.abs(this.value-zoom)<=2)
{this.slideDuration=this.zoomSmallDuration;}
else
{this.slideDuration=this.zoomLargeDuration;}
this.startValue=this.value;this.targetValue=zoom;this.startTime=(new Date()).getTime()/1000.0;this.startSlide();},curTime:function()
{if(this.startTime==null)
return null;var time=(new Date()).getTime()/1000.0;return time-this.startTime;},getZoom:function()
{return Math.floor(this.value);},topForZoom:function(zoom)
{var top=Math.floor((this.gmap.scaleCount-1-zoom)*this.pixPerTick)+1;return top;},zoomForTop:function(top)
{var zoom=Math.floor(((top-4)/this.pixPerTick)+0.5);if(zoom<0)zoom=0;if(zoom>=this.gmap.scaleCount)zoom=this.gmap.scaleCount-1;zoom=this.gmap.scaleCount-1-zoom;return zoom;}});_Geocoder=OpenLayers.Class({requests:null,nextID:null,initialize:function()
{this.requests=[];this.nextID=0;},destroy:function()
{if(this.requests==null)
return;for(var ID in this.requests)
{if(this.requests[ID]!=null)
{this.cancelRequest(ID);}}
this.requests=null;this.nextID=null;},requestToHead:function(request)
{head=document.getElementsByTagName('HEAD')[0];obj=document.createElement('SCRIPT');obj.type='text/javascript';obj.src=request;head.appendChild(obj);return obj;},removeReqFromHead:function(obj)
{head=document.getElementsByTagName('HEAD')[0];head.removeChild(obj);},sendRequest:function(mode,func,query,extraArgs)
{if(extraArgs==null)
extraArgs=[];ID=this.nextID;this.requests[ID]=[];this.requests[ID].mode=mode;this.requests[ID].func=func;this.requests[ID].eArgs=extraArgs;this.requests[ID].obj=this.requestToHead("http://www.genieknows.com/geocode.php?m="+mode+"&q="+query+"&i="+ID);this.nextID++;return ID;},cancelRequest:function(ID)
{if(this.requests[ID]!=null)
{this.removeReqFromHead(this.requests[ID].obj);this.requests[ID]=null;}},callback:function(ID,args)
{if(this.requests[ID]==null)
return;var nArgs=this.requests[ID].eArgs;var argCount=0;for(var key in args)
argCount+=1;if(argCount>0)
{if(this.requests[ID].mode==GenieMap.GEOCODE_ADDRESS)
{if(args.lat&&args.lon)
{args.lat=parseFloat(args.lat);args.lon=parseFloat(args.lon);args.point=new LatLonPoint(args.lat,args.lon);}
if(args.sw_lat&&args.sw_lon&&args.ne_lat&&args.ne_lon)
{args.sw_lat=parseFloat(args.sw_lat);args.sw_lon=parseFloat(args.sw_lon);args.ne_lat=parseFloat(args.ne_lat);args.ne_lon=parseFloat(args.ne_lon);args.bounds=new BoundingBox(args.sw_lat,args.sw_lon,args.ne_lat,args.ne_lon);}}
else if(this.requests[ID].mode==GenieMap.GEOCODE_BUSINESS_ID)
{args.lat=parseFloat(args.lat);args.lon=parseFloat(args.lon);args.point=new LatLonPoint(args.lat,args.lon);}
for(var key in args)
nArgs[key]=args[key];}
this.requests[ID].func(nArgs);this.cancelRequest(ID);}});window.__Geocoder=new _Geocoder();

