window._globals={xmlns:"http://www.w3.org/1999/xhtml",svgns:"http://www.w3.org/2000/svg",vmlns:"urn:schemas-microsoft-com:vml",vmlnsPrefix:"v",nzCenterX:2530000,nzCenterY:5990000,nzTopY:6748000,tileSetVersion:35,resourceURL:(document.location.protocol.indexOf("http")==-1?"http:":document.location.protocol)+"//api.geosmart.co.nz/sfapi-v3.4.6/assets/",roundedCornersService:(document.location.protocol.indexOf("http")==-1?"http:":document.location.protocol)+"//api.geosmart.co.nz/rounded_corners",multipleTileHosts:true,maps:[],DEBUG:false};var GSKeyEvents={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,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34};function GSUtil(){}GSUtil.extend=function(c,a){function b(){}b.prototype=a.prototype;c.prototype=new b();c.prototype.constructor=c;c.baseConstructor=a;c.superClass=a.prototype};GSUtil.include=function(){var b=Array.prototype.slice.call(arguments);var d=b.shift();for(var c=0,a=b.length;c<a;c++){GSUtil.merge(b[c],d.prototype)}};GSUtil.merge=function(c,d){if(!d){d={}}for(var b in c){var a=c[b];var f=d[b];if((typeof a)=="object"&&(typeof f)=="object"){d[b]=GSUtil.merge(a,f)}else{d[b]=a}}return d};GSUtil.getPropertyArray=function(c,b){var f=[];for(var d=0,a=c.length;d<a;d++){var g=c[d];if(g[b]!==undefined){f.push(g[b])}}return f};GSUtil.getMinimum=function(b){var d=Infinity;for(var c=0,a=b.length;c<a;c++){d=Math.min(d,b[c])}return d};GSUtil.getMaximum=function(c){var a=-Infinity;for(var d=0,b=c.length;d<b;d++){a=Math.max(a,c[d])}return a};GSUtil.findPosX=function(a){var b=0;if(a.offsetParent){while(a.offsetParent){b+=a.offsetLeft;a=a.offsetParent}}else{if(a.x){b+=a.x}}return b};GSUtil.findPosY=function(c){var a=c;var b=0;if(c.offsetParent){while(c.offsetParent){b+=c.offsetTop;c=c.offsetParent}}else{if(c.y){b+=c.y}}if(_browser.isOpera||((_browser.isWebkit&&a.style.position=="absolute")||(_browser.isSafari&&a.style.position=="relative"))){b-=document.body.offsetTop}return b};GSUtil.getMousePixelCoordinate=function(d,a){d=d||window.event;var c,b;if(typeof d.pageX!="undefined"){c=d.pageX;b=d.pageY}else{if(typeof d.clientX!="undefined"){c=d.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;b=d.clientY+document.body.scrollTop+document.documentElement.scrollTop}else{return new GSPoint(0,0)}}if(a){var f=GSUtil.getElementPosition(a);return new GSPoint(c-f.x,b-f.y)}return new GSPoint(c,b)};GSUtil.getTouchPixelCoordinate=function(c,a){if(a){var b=GSUtil.getElementPosition(a);return new GSPoint(c.pageX-b.x,c.pageY-b.y)}return new GSPoint(c.pageX,c.pageY)};GSUtil.getElementPosition=function(d,g){if(d.getBoundingClientRect){var m=d.getBoundingClientRect();var n=d.ownerDocument;var b=n.documentElement;var h=n.body;var f=b.clientTop||h.clientTop||0;var j=b.clientLeft||h.clientLeft||0;var l=m.top+(window.pageYOffset||b.scrollTop||h.scrollTop)-f;var c=m.left+(window.pageXOffset||b.scrollLeft||h.scrollLeft)-j;if(!g){return new GSPoint(c,l)}else{var a=GSUtil.getElementPosition(g);return new GSPoint(m.left-j-a.x,m.top-f-a.y)}}var k=new GSPoint(0,0);while(d){k.x+=d.offsetLeft;k.y+=d.offsetTop;d=d.offsetParent;if(g&&g==d){break}}return k};GSUtil.getWindowSize=function(){var a={};if(self.innerHeight){a.width=self.innerWidth;a.height=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){a.width=document.documentElement.clientWidth;a.height=document.documentElement.clientHeight}else{if(document.body){a.width=document.body.clientWidth;a.height=document.body.clientHeight}}}return a};GSUtil.getOffsetFromAncestor=function(c,a){var b=new GSPoint(0,0);while(c&&c!=a){b.x+=c.offsetLeft;b.y+=c.offsetTop;c=c.offsetParent}return b};GSUtil.getMousePos=function(b){var a=b?b:window.event;if(typeof a.pageX!="undefined"){return new GSPoint(a.pageX,a.pageY)}else{if(typeof a.clientX!="undefined"){return new GSPoint(a.clientX+document.body.scrollLeft,a.clientY+document.body.scrollTop)}else{return new GSPoint(0,0)}}};GSUtil.cancelEvent=function(a){a=a?a:window.event;GSUtil.eventStopPropagation(a);GSUtil.eventPreventDefault(a);return false};GSUtil.eventStopPropagation=function(a){if(a.stopPropagation){a.stopPropagation()}else{a.cancelBubble=true}};GSUtil.eventPreventDefault=function(a){if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}};GSUtil.translateElement=function(a,c,b){if(_browser.isWebkit){a.style.WebkitTransform="translate("+c+"px, "+b+"px)"}else{GSUtil.positionElement(a,c,b)}};GSUtil.positionElement=function(d,g,f,c,b){var a=GSUtil.getComputedStyle(d,"position");if(a!="absolute"&&a!="relative"){d.style.position="absolute"}if(g||g==0){d.style.left=g+"px"}if(f||f==0){d.style.top=f+"px"}if(b||b==0){d.style.bottom=b+"px"}if(c||c==0){d.style.right=c+"px"}};GSUtil.attributes={html:"innerHTML","class":"className","for":"htmlFor",defaultValue:"defaultValue"};GSUtil.createElement=function(a,f){f=f||{};f.styles=f.styles||{};f.events=f.events||{};var h=null;if(f.parent){h=f.parent;delete f.parent}var d=null;if(document.createElementNS){d=document.createElementNS(_globals.xmlns,a)}else{d=document.createElement(a)}GSUtil.setStyles(d,f.styles);delete f.styles;for(var c in f.events){var g=f.events[c];GSEventManager.addEventListener(d,c,GSUtil.bindAsEventListener(g,d))}delete f.events;for(var c in f){var b=GSUtil.attributes[c];var j=f[c];if(d.tagName.toLowerCase()=="img"&&c=="src"&&_browser.pngAlpha&&GSUtil.isTransparentPng(j)){d.src=_globals.resourceURL+"blank.gif";j=j.replace(/\'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29");d.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+j+"',sizingMethod='scale')"}else{if(c=="html"){if((typeof j).toLowerCase()=="string"){d.innerHTML=j}else{d.appendChild(j)}}else{if(c=="unselectable"&&j!==false){GSUtil.makeUnselectable(d)}else{(b)?d[b]=j:GSUtil.setAttribute(d,c,j)}}}}if(h){h.appendChild(d)}return d};GSUtil.setStyles=function(b,c){for(var a in c){b.style[a]=c[a]}};GSUtil.setElementBackgroundImage=function(c,b){b=b.replace(/\'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29");if(_browser.pngAlpha&&GSUtil.isTransparentPng(b)){var a=c["DXImageTransform.Microsoft.AlphaImageLoader"];if(a==null){c.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b+"',sizingMethod='scale')"}else{a.src=b}}else{c.style.background="url("+b+") repeat"}};GSUtil.isTransparentPng=function(a){var b=a.substring(a.lastIndexOf(".")+1).toLowerCase();return b=="png"||(a.indexOf("bc=transparent")!=-1)};GSUtil.setAttribute=function(b,a,c){if(b.setAttributeNS){b.setAttributeNS(null,a,c)}else{b.setAttribute(a,c)}};GSUtil.innerXHTML=function(d,g){if(window.DOMParser){var h=new DOMParser();var f=h.parseFromString(g,"application/xhtml+xml");var b=f.documentElement;for(var c=0,a=b.childNodes.length;c<a;c++){d.appendChild(document.importNode(b.childNodes[c],true))}}else{d.innerHTML=g}};GSUtil.createContainer=function(j,f,c,k,d,h,b,g){var a=GSUtil.createElement("div");j.appendChild(a);if(f){a.className=f}if(c){a.style.width=c=="auto"?"auto":c+"px"}if(k){a.style.height=k=="auto"?"auto":k+"px"}if(d||h||d==0||h==0){a.style.position="absolute";a.style.left=d+"px";a.style.top=h+"px"}if(b){a.style.visibility=b}if(g!=undefined){a.style.zIndex=g}return a};GSUtil.setImageSrc=function(b,c){if(_browser.pngAlpha){c=c.replace(/\'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29");var a=b["DXImageTransform.Microsoft.AlphaImageLoader"];if(a==null){b.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+c+"',sizingMethod='scale')"}else{a.src=url}}else{b.src=c}};GSUtil.getImageSrc=function(c){var d="";if(c.src!=undefined){d=c.src}if(c.style.filter){var b=/src='([^']+)'/;var a=c.style.filter.match(b);d=a[1]}return d};GSUtil.createImageMap=function(b,j,l,c,h,f,g,k){var a=GSUtil.createElement("map");a.id=b;a.setAttribute("name",b);var d=GSUtil.createElement("area");d.setAttribute("shape",j);d.setAttribute("coords",l.toString());d.setAttribute("href",c);d.setAttribute("title",h);if(k!=undefined){d.peer=k}if(g!=undefined){GSEventManager.addEventListener(d,f,g)}a.appendChild(d);return a};GSUtil.setOpacity=function(b,a){a=(a==100)?99.999:a;b.style.filter="alpha(opacity:"+a+")";b.style.KHTMLOpacity=a/100;b.style.MozOpacity=a/100;b.style.opacity=a/100};GSUtil.getComputedStyle=function(a,c){if(typeof a=="string"){a=document.getElementById(a)}if(a.style[c]){return a.style[c]}else{if(a.currentStyle){return a.currentStyle[c]}else{if(document.defaultView&&document.defaultView.getComputedStyle){c=c.replace(/([A-Z])/g,"-$1");c=c.toLowerCase();var b=document.defaultView.getComputedStyle(a,"");if(b){return b.getPropertyValue(c)}return null}else{return null}}}};GSUtil.getFeatureById=function(c,f){for(var d=0,b=c.length;d<b;d++){if(c[d].id==f){return c[d]}}return undefined};GSUtil.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)};GSUtil.reverseString=function(a){return a.split("").reverse().join("")};GSUtil.addThousandsSeparators=function(b){var a=(""+b).split(".");a[0]=GSUtil.reverseString(GSUtil.reverseString(a[0]).replace(/(\d{3})/g,"$1,").replace(/,$/,""));return a.join(".")};GSUtil.getBaseName=function(a){return a.substring(a.lastIndexOf("/")+1)};GSUtil.getBaseNameWithoutExtension=function(b){var a=GSUtil.getBaseName(b);return a.substring(0,a.indexOf("."))};GSUtil.getDirName=function(a){return a.substring(0,a.lastIndexOf("/"))};GSUtil.clone=function(f,a){try{var b=new f.constructor();for(var c in f){if(!a){if(c!="eventListeners"){b[c]=f[c]}}else{if(c!="eventListeners"){if(typeof f[c]=="object"){b[c]=GSUtil.clone(f[c],a)}else{b[c]=f[c]}}}}return b}catch(d){return undefined}};GSUtil.toXML=function(c){try{if(typeof ActiveXObject!="undefined"&&typeof GetObject!="undefined"){var b=new ActiveXObject("Microsoft.XMLDOM");b.loadXML(c);return b}else{if(typeof DOMParser!="undefined"){return(new DOMParser()).parseFromString(c,"text/xml")}else{return undefined}}}catch(a){alert("parse error: "+a.message);return undefined}};GSUtil.stringToBoolean=function(a){if(!a){return false}if(a=="true"){return true}if(a=="false"){return false}if(a=="yes"){return true}if(a=="no"){return false}return a==true};GSUtil.getCaseInsensitiveProperty=function(d,b,a){if(!d||!(d instanceof Object)){return undefined}var c=undefined;if(d[b]!=undefined){c=d[b]}else{if(d[b.toLowerCase()]){c=d[b.toLowerCase()]}}if(c!==undefined&&(typeof c).toLowerCase()=="string"&&c!="null"){return c}else{return c!=undefined?c:(a!=undefined?a:undefined)}};GSUtil.joinAssociativeArray=function(f,d,c){var b=[];for(var a in f){b.push(a+c+(f[a]!=undefined?f[a]:""))}return b.join(d)};GSUtil.getParameter=function(c,b,a){if(c[b]==undefined){if(arguments.length<3){throw new Error("Missing parameter: "+b)}else{return a}}else{return c[b]}};GSUtil.makeUnselectable=function(a){if(typeof a.style.MozUserSelect=="string"){a.style.MozUserSelect="none"}else{if(typeof a.style.KhtmlUserSelect!="undefined"){a.style.KhtmlUserSelect="none"}else{if(typeof a.onselectstart!="undefined"){a.setAttribute("galleryimg","no");a.onselectstart=function(){return false}}}}};GSUtil.objToJson=function(f){var c=["{"];var d,a;for(d in f){if(f.hasOwnProperty(d)){if(a){c.push(",")}a=true;c.push('"'+(d.replace(/(["\\])/g,"\\$1"))+'"',":",((typeof f[d])=="object"&&f[d].toJson?f[d].toJson():GSUtil.serialize(f[d])))}}c.push("}");return c.join("")};GSUtil.arrayToJson=function(g){var f=["["];var c;for(var h=0,d=g.length;h<d;h++){if(c){f.push(",")}c=true;f.push(g[h].toJson?g[h].toJson():GSUtil.serialize(g[h]))}f.push("]");return f.join("")};GSUtil.serialize=function(a){switch(typeof a){case"object":if(a instanceof Array){return GSUtil.arrayToJson(a)}else{return GSUtil.objToJson(a)}case"string":return'"'+a.replace(/(["\\])/g,"\\$1")+'"';case"number":return isFinite(a)?String(a):"null";case"boolean":return String(a);default:return""}};GSUtil.toCC=function(d){var b={};for(var c in d){var a=c;for(var f=/-([a-z])/;f.test(a);a=a.replace(f,RegExp.$1.toUpperCase())){}b[a]=d[c]}return b};GSUtil.getMinimumBoundingRectangle=function(d){var b=[];for(var j=0,g=d.length;j<g;j++){var k=d[j];if(k.getBounds){b.push(k.getBounds())}}var h=GSUtil.getMinimum(GSUtil.getPropertyArray(b,"minX"));var f=GSUtil.getMinimum(GSUtil.getPropertyArray(b,"minY"));var c=GSUtil.getMaximum(GSUtil.getPropertyArray(b,"maxX"));var a=GSUtil.getMaximum(GSUtil.getPropertyArray(b,"maxY"));return new GSBounds(h,f,c,a)};GSUtil.bind=function(c,b){var a=Array.prototype.slice.call(arguments);c=a.shift();b=a.shift();return function(){return c.apply(b,a.concat(Array.prototype.slice.call(arguments)))}};GSUtil.bindAsEventListener=function(c,b){var a=Array.prototype.slice.call(arguments);c=a.shift(),b=a.shift();return function(d){return c.apply(b,[d||window.event].concat(a))}};GSUtil.escapeHTML=function(a){return new String(a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")};function GSEventBroadcasterMixin(){}GSEventBroadcasterMixin.prototype.broadcastMessage=function(){if(!this.listeners){return}var b=arguments[0];var c=[];for(var d=1,a=arguments.length;d<a;d++){c.push(arguments[d])}var f=[];for(var d=0,a=this.listeners.length;d<a;d++){f.push(this.listeners[d])}for(var d=0;d<f.length;d++){if(f[d][b]){f[d][b].apply(f[d],c)}}};GSEventBroadcasterMixin.prototype.addListener=function(a){if(!this.listeners){this.listeners=[]}this.removeListener(a);this.listeners.push(a);return true};GSEventBroadcasterMixin.prototype.removeListener=function(c){if(!this.listeners){return false}for(var b=0,a=this.listeners.length;b<a;b++){if(this.listeners[b]===c){this.listeners.splice(b,1);return true}}return false};GSEventBroadcasterMixin.prototype.clearListeners=function(){if(!this.listeners){return false}this.listeners=[]};function GSDOMEventsMixin(){}GSDOMEventsMixin.prototype.addEventListener=function(c,f,d){d=d||this;if(!this.eventListeners){this.eventListeners={}}var b=this.graphicsEl||this.element;if(!b){throw new Error("Cannot add event listener. No reference to this.element or this.graphicsEl defined on this class.")}var a=GSEventManager.addEventListener(b,c,f,d);this.addListenerToken(c,a);return a};GSDOMEventsMixin.prototype.removeEventListener=function(d){if(!this.eventListeners){return}for(var c in this.eventListeners){if(this.eventListeners.hasOwnProperty(c)){if(this.eventListeners[c] instanceof Array){for(var a=this.eventListeners[c].length-1,b=null;b=this.eventListeners[c][a];a--){if(d==b){GSEventManager.release(d);delete this.eventListeners[c][a]}}}else{if(d==this.eventListeners[c]){GSEventManager.release(this.eventListeners[c]);delete this.eventListeners[c]}}}}};GSDOMEventsMixin.prototype.addListenerToken=function(a,b){if(this.eventListeners[a]){if(!(this.eventListeners[a] instanceof Array)){this.eventListeners[a]=[this.eventListeners[a]]}this.eventListeners[a].push(b)}else{this.eventListeners[a]=b}};GSDOMEventsMixin.prototype.removeEventListeners=function(){if(!this.eventListeners){return}for(var c in this.eventListeners){if(this.eventListeners.hasOwnProperty(c)){if(this.eventListeners[c] instanceof Array){for(var a=this.eventListeners[c].length-1,b=null;b=this.eventListeners[c][a];a--){GSEventManager.release(b)}}else{GSEventManager.release(this.eventListeners[c])}}}delete this.eventListeners};function GSSelectionMixin(){}GSSelectionMixin.prototype.getSelection=function(){if(!this.selection){this.selection=[]}return this.selection};GSSelectionMixin.prototype.setSelection=function(a){if(!this.selection){this.selection=[]}var b=0,c=null;for(;c=this.selection[b];b++){if(!this.arrayContains(a,c)&&c.deselect){c.deselect()}}for(b=0,c=null;c=a[b];b++){if(!this.arrayContains(this.selection,c)&&c.select){c.select()}}this.selection=a;this.broadcastMessage("selectionChanged",this.selection)};GSSelectionMixin.prototype.isSelected=function(a){if(!this.selection){return false}return this.arrayContains(this.selection,a)};GSSelectionMixin.prototype.addToSelection=function(a){if(!this.selection){this.selection=[]}this.selection.push(a);if(a.select){a.select()}this.broadcastMessage("selectionChanged",this.selection)};GSSelectionMixin.prototype.clearSelection=function(){if(!this.selection){return}for(var a=0,b=null;b=this.selection[a];a++){if(b.deselect){b.deselect()}}this.selection=[];this.broadcastMessage("selectionChanged",this.selection)};GSSelectionMixin.prototype.removeFromSelection=function(c){if(!this.selection){return false}for(var a=0,b=null;b=this.selection[a];a++){if(c==b){this.selection.splice(a,1);if(c.deselect){c.deselect()}this.broadcastMessage("selectionChanged",this.selection);return true}}return false};GSSelectionMixin.prototype.arrayContains=function(a,d){for(var b=0,c=null;c=a[b];b++){if(d==c){return true}}return false};function GSAnimator(h,g,b,f,a,c,d){this.from=h;this.to=g;this.framerate=b;this.duration=f;this.setvalue=a;this.onstart=c;this.onfinish=d;this.currentValue=h;this.startTime=0;this.timer=undefined}GSAnimator.prototype.animate=function(){if(!this.timer){this.startTime=new Date().getTime()-this.framerate}this.timer=setInterval(GSUtil.bind(this.frame,this),this.framerate);if(this.onstart){this.onstart(this)}};GSAnimator.prototype.frame=function(){var b=new Date().getTime()-this.startTime;if(b>=this.duration){this.stopAnimate();this.currentValue=this.to;this.setvalue(this,this.currentValue);if(this.onfinish){setTimeout(GSUtil.bind(this.onfinish,this,this),0)}}else{var c=0.5-(0.5*Math.cos(Math.PI*Math.max(b,0)/this.duration));var a=this.interpolate(this.from.x,this.to.x,c);var d=this.interpolate(this.from.y,this.to.y,c);this.currentValue=new GSPoint(a,d);this.setvalue(this,this.currentValue)}};GSAnimator.prototype.stopAnimate=function(){if(this.timer){clearInterval(this.timer);this.timer=null}};GSAnimator.prototype.interpolate=function(c,b,a){return c+(b-c)*a};function GSBounds(a,d,c,b){this.minX=parseFloat(a);this.minY=parseFloat(d);this.maxX=parseFloat(c);this.maxY=parseFloat(b)}GSBounds.prototype.contains=function(a){return(a.x>=this.minX&&a.x<=this.maxX)&&(a.y>=this.minY&&a.y<=this.maxY)};GSBounds.prototype.overlaps=function(c){var g=this.maxX-this.minX;var f=this.maxY-this.minY;var b=c.maxX-c.minX;var a=c.maxY-c.minY;var d=!(this.minY+f<c.minY||this.minY>c.minY+a||this.minX+g<c.minX||this.minX>c.minX+b);return d};GSBounds.prototype.intersection=function(a){var b=new GSBounds(0,0,0,0);b.minX=Math.max(this.minX,a.minX);b.maxX=Math.min(this.maxX,a.maxX);b.minY=Math.max(this.minY,a.minY);b.maxY=Math.min(this.maxY,a.maxY);if(b.maxX<b.minX||b.minY>b.maxY){return null}return b};GSBounds.prototype.toString=function(){return"Bounds: minX=["+this.minX+"], minY=["+this.minY+"], maxX=["+this.maxX+"], maxY=["+this.maxY+"]"};function GSBrowser(){var a=navigator.userAgent.toLowerCase();this.isFirefox=a.indexOf("firefox")!=-1;this.firefoxVersion=parseFloat(a.substring(a.indexOf("firefox")+8));this.isWebkit=a.indexOf("applewebkit")!=-1;this.webkitVersion=a.substr(a.indexOf("applewebkit")+12,3);this.isMobileWebkit=this.isWebkit&&(a.indexOf(" mobile/")!=-1||a.indexOf(" mobile ")!=-1);this.isAndroid=a.indexOf("android")!=-1;this.androidVersion=parseFloat(a.substring(a.indexOf("android")+8));this.isGecko=!this.isWebkit&&a.indexOf("gecko")!=-1;this.isCamino=a.indexOf("camino")!=-1;this.caminoVersion=parseFloat(a.substring(a.indexOf("camino")+7));this.isIE=((a.indexOf("msie")!=-1)&&(a.indexOf("opera")==-1));this.versionMinor=parseFloat(navigator.appVersion);if(this.isIE&&this.versionMinor>=4){this.versionMinor=parseFloat(a.substring(a.indexOf("msie ")+5))}this.versionMajor=parseInt(this.versionMinor);this.isIE6x=(this.isIE&&this.versionMajor==6);this.isIE6up=(this.isIE&&this.versionMajor>=6);this.isIE7x=(this.isIE&&this.versionMajor==7);this.isIE8x=(this.isIE&&this.versionMajor==8);this.isIE9x=(this.isIE&&this.versionMajor==9);this.isIE9up=(this.isIE&&this.versionMajor>=9);this.isOpera=a.indexOf("opera")!=-1;this.operaVersion=parseFloat(a.substring(a.indexOf("version")+8));this.isWin=(a.indexOf("win")!=-1);this.isWin32=(this.isWin&&(a.indexOf("95")!=-1||a.indexOf("98")!=-1||a.indexOf("nt")!=-1||a.indexOf("win32")!=-1||a.indexOf("32bit")!=-1));this.pngAlpha=(this.isIE6x&&this.isWin32);this.svg=(this.isIE9up)||((this.isFirefox&&this.firefoxVersion>=1.5)||(this.isCamino&&this.caminoVersion>=1)||(this.isOpera&&this.versionMajor>=8)||(this.isWebkit&&this.webkitVersion>=500));if(this.isAndroid&&this.androidVersion<3&&this.isMobileWebkit){this.svg=false}this.canvas=!!document.createElement("canvas").getContext}GSBrowser.prototype.isSmartfindCompatible=function(){return(this.isIE6up||this.isGecko||this.isWebkit||this.isOpera)};GSBrowser.prototype.isVectorGraphicsCapable=function(){return(this.isIE6up||this.svg)};GSBrowser.prototype.isRGBaCapable=function(){return((this.isFirefox&&this.firefoxVersion>3)||(this.isWebkit&&this.webkitVersion>=500)||this.isIE9up)};GSBrowser.prototype.isCssTransformCapable=function(){return(this.mobileWebkit||(this.isWebkit&&this.webkitVersion>=530))};window._browser=new GSBrowser();GSUtil.extend(GSButton,GSPanel);function GSButton(b,c,a){this.options={buttonType:GSButton.NORMAL,height:14,width:40,boxShadow:true,active:false,className:"GSButton",styles:{cursor:"pointer",fontSize:12,padding:"2px 12px"},eventsDisablePropagation:["dblclick","contextmenu"]};GSUtil.merge(a,this.options);switch(this.options.buttonType){case GSButton.NORMAL:this.options.borderRadius=9;break;case GSButton.LEFT:this.options.borderRadius=9;this.options.borderCorners="tl,bl";break;case GSButton.INNER:GSUtil.merge({borderLeftStyle:"solid",borderWidth:"1px",borderColor:"#bbb"},this.options.styles);break;case GSButton.RIGHT:GSUtil.merge({borderLeftStyle:"solid",borderWidth:"1px",borderColor:"#bbb"},this.options.styles);this.options.borderRadius=9;this.options.borderCorners="tr,br";break}this.name=b;this.text;GSButton.baseConstructor.call(this,c,this.options)}GSButton.NORMAL=0;GSButton.LEFT=1;GSButton.INNER=2;GSButton.RIGHT=3;GSButton.prototype.initialize=function(){GSButton.superClass.initialize.call(this);GSUtil.makeUnselectable(this.element);this.text=GSUtil.createElement("div",{styles:{position:"absolute",height:this.options.height+"px",width:this.options.width+"px",lineHeight:this.options.height+"px",fontFamily:"Helvetica, Arial, Sans-serif",fontSize:this.options.styles.fontSize+"px",textAlign:"center"},html:this.name,unselectable:true});this.setContent(this.text);this.addEventListeners();this.setActive(this.options.active)};GSButton.prototype.setName=function(a){this.text.innerHTML=a};GSButton.prototype.addEventListeners=function(){this.addEventListener("mouseover",this.onMouseOver,this);this.addEventListener("mouseout",this.onMouseOut,this)};GSButton.prototype.setActive=function(a){this.options.active=a;if(a){GSUtil.setStyles(this.text,{color:"#fff",textShadow:"1px 1px #222"});this.setBackgroundColor("rgba(0,0,0,0.80)")}else{GSUtil.setStyles(this.text,{color:"#ebeced",textShadow:"1px 1px #222"});this.setBackgroundColor("rgba(0,0,0,0.55)")}};GSButton.prototype.onMouseOver=function(){if(!this.options.active){this.text.style.color="#fff";this.setBackgroundColor("rgba(0,0,0,0.70)")}};GSButton.prototype.onMouseOut=function(){if(!this.options.active){this.text.style.color="#ebeced";this.setBackgroundColor("rgba(0,0,0,0.55)")}};function GSControl(a){this.name=a;this.element;this.map=null;this.position=null;this.hidden=false;this.parentPositioned=false}GSControl.prototype.setElement=function(a){this.element=a;this.element.style.zIndex=10;if(!this.element.style.cursor){this.element.style.cursor="default"}};GSControl.prototype.setPosition=function(a){if(!a.offset){a.offset=new GSPoint(0,0)}switch(a.anchor){case GSControl.ANCHOR_TOP_CENTER:GSUtil.positionElement(this.element,((this.map.pxWidth-this.element.offsetWidth)/2)+a.offset.x,a.offset.y);break;case GSControl.ANCHOR_TOP_RIGHT:GSUtil.positionElement(this.element,null,a.offset.y,a.offset.x);break;case GSControl.ANCHOR_BOTTOM_LEFT:GSUtil.positionElement(this.element,a.offset.x,null,null,a.offset.y);break;case GSControl.ANCHOR_BOTTOM_CENTER:GSUtil.positionElement(this.element,((this.map.pxWidth-this.element.offsetWidth)/2)+a.offset.x,null,null,a.offset.y);break;case GSControl.ANCHOR_BOTTOM_RIGHT:GSUtil.positionElement(this.element,null,null,a.offset.x,a.offset.y);break;case GSControl.ANCHOR_CENTER:GSUtil.positionElement(this.element,((this.map.pxWidth-this.element.offsetWidth)/2)+a.offset.x,((this.map.pxHeight-this.element.offsetHeight)/2)+a.offset.y);break;case GSControl.ANCHOR_TOP_LEFT:default:GSUtil.positionElement(this.element,a.offset.x,a.offset.y);break}this.position=a};GSControl.prototype.setMap=function(a){this.map=a;this.map.addListener(this)};GSControl.prototype.mapResized=function(c,b,a){this.setPosition(this.position)};GSControl.prototype.getPosition=function(){return this.position};GSControl.prototype.render=function(a){};GSControl.prototype.getDefaultPosition=function(){return{anchor:GSControl.ANCHOR_TOP_LEFT,offset:new GSPoint(7,7)}};GSControl.prototype.getWidth=function(){return 0};GSControl.prototype.getHeight=function(){return 0};GSControl.prototype.getOrientation=function(){return undefined};GSControl.prototype.remove=function(b){try{b.container.removeChild(this.element)}catch(a){}this.element=null};GSControl.prototype.hide=function(){this.element.style.visibility="hidden";this.hidden=true};GSControl.prototype.show=function(){this.element.style.visibility="visible";this.hidden=false};GSControl.ANCHOR_TOP_LEFT=0;GSControl.ANCHOR_TOP_CENTER=1;GSControl.ANCHOR_TOP_RIGHT=2;GSControl.ANCHOR_BOTTOM_LEFT=3;GSControl.ANCHOR_BOTTOM_CENTER=4;GSControl.ANCHOR_BOTTOM_RIGHT=5;GSControl.ANCHOR_CENTER=6;GSUtil.extend(GSCompactZoomControl,GSControl);function GSCompactZoomControl(){GSCompactZoomControl.baseConstructor.call(this,GSMap.COMPACT_ZOOM_CONTROL);this.width=22;this.height=43}GSCompactZoomControl.prototype.render=function(c){this.map=c;var b=GSUtil.createElement("div",{styles:{width:this.width+"px",height:this.height+"px"}});var f=GSUtil.createElement("img",{src:_globals.resourceURL+"smallZoomBG.png",styles:{width:"22px",height:"43px",position:"absolute",top:0,left:0},"class":"noprint",events:{contextmenu:GSUtil.cancelEvent},parent:b});var d=GSUtil.createElement("img",{src:_globals.resourceURL+"zoomIn.png",styles:{width:"14px",height:"13px",position:"absolute",left:"2px",top:"3px",zIndex:10,cursor:"pointer"},events:{click:GSUtil.bindAsEventListener(this.zoomIn,this),dblclick:GSUtil.cancelEvent,contextmenu:GSUtil.cancelEvent},"class":"noprint",title:"Zoom in",parent:b});var a=GSUtil.createElement("img",{src:_globals.resourceURL+"zoomOut.png",styles:{width:"14px",height:"13px",position:"absolute",left:"2px",top:"22px",zIndex:10,cursor:"pointer"},events:{click:GSUtil.bindAsEventListener(this.zoomOut,this),dblclick:GSUtil.cancelEvent,contextmenu:GSUtil.cancelEvent},title:"Zoom out",parent:b});return b};GSCompactZoomControl.prototype.zoomIn=function(a){GSUtil.cancelEvent(a);var b=this.map.scaleIdx;if(b+1>this.map.getBaseLayer().maxZoom){return}this.map.animatedZoom(b+1)};GSCompactZoomControl.prototype.zoomOut=function(a){GSUtil.cancelEvent(a);var b=this.map.scaleIdx;if(b-1<this.map.getBaseLayer().minZoom){return}this.map.animatedZoom(b-1)};GSUtil.extend(GSMapControl,GSControl);function GSMapControl(a){GSMapControl.baseConstructor.call(this,GSMap.MAP_CONTROL);this.width=54;this.height=55;this.zoomControl=new GSZoomControl(a);this.zoomControl.parentPositioned=true}GSMapControl.prototype.getWidth=function(){return this.width};GSMapControl.prototype.getHeight=function(){return this.height};GSMapControl.prototype.render=function(f){this.map=f;var c=GSUtil.createElement("div",{styles:{width:this.width+"px",height:this.height+"px"}});var h=GSUtil.createElement("img",{src:_globals.resourceURL+"compassBG.png",styles:{width:"54px",height:"55px",position:"absolute",left:0,top:0,zIndex:100},"class":"noprint",events:{contextmenu:GSUtil.cancelEvent},parent:c});var a=GSUtil.createElement("img",{src:_globals.resourceURL+"arrowUp.png",styles:{width:"14px",height:"13px",position:"absolute",left:"18px",top:"3px",zIndex:100,cursor:"pointer"},"class":"noprint",title:"Move up",events:{click:GSUtil.bindAsEventListener(this.panTo,this,"up"),dblclick:GSUtil.cancelEvent,contextmenu:GSUtil.cancelEvent},parent:c});var d=GSUtil.createElement("img",{src:_globals.resourceURL+"arrowLeft.png",styles:{width:"14px",height:"13px",position:"absolute",left:"3px",top:"19px",zIndex:100,cursor:"pointer"},"class":"noprint",title:"Move left",events:{click:GSUtil.bindAsEventListener(this.panTo,this,"left"),dblclick:GSUtil.cancelEvent,contextmenu:GSUtil.cancelEvent},parent:c});d.direction="left";var b=GSUtil.createElement("img",{src:_globals.resourceURL+"arrowRight.png",styles:{width:"14px",height:"13px",position:"absolute",left:"33px",top:"19px",zIndex:100,cursor:"pointer"},"class":"noprint",title:"Move right",events:{click:GSUtil.bindAsEventListener(this.panTo,this,"right"),dblclick:GSUtil.cancelEvent,contextmenu:GSUtil.cancelEvent},parent:c});b.direction="right";var g=GSUtil.createElement("img",{src:_globals.resourceURL+"arrowDown.png",styles:{width:"14px",height:"13px",position:"absolute",left:"18px",top:"35px",zIndex:100,cursor:"pointer"},"class":"noprint",title:"Move down",events:{click:GSUtil.bindAsEventListener(this.panTo,this,"down"),dblclick:GSUtil.cancelEvent,contextmenu:GSUtil.cancelEvent},parent:c});g.direction="down";this.map.addControl(this.zoomControl);return c};GSMapControl.prototype.hide=function(){this.zoomControl.hide();GSMapControl.superClass.hide.call(this)};GSMapControl.prototype.show=function(){this.zoomControl.show();GSMapControl.superClass.show.call(this)};GSMapControl.prototype.setPosition=function(a){if(a.anchor==GSControl.ANCHOR_TOP_LEFT||a.anchor==GSControl.ANCHOR_BOTTOM_LEFT){this.zoomControl.setPosition({anchor:a.anchor,offset:new GSPoint(21,65)})}else{this.zoomControl.setPosition({anchor:a.anchor,offset:new GSPoint(25,65)})}GSMapControl.superClass.setPosition.call(this,a)};GSMapControl.prototype.panTo=function(f,h){var j=0.25;var a=this.map.getBounds();var g=this.map.getMapCenter();var b=a.maxX-a.minX;var m=a.maxY-a.minY;var d=g.x;var c=g.y;var k=0;switch(h){case"up":k=j*m;c+=k;break;case"left":k=j*b;d-=k;break;case"right":k=j*b;d+=k;break;case"down":k=j*m;c-=k;break}var l=new GSPoint(d,c);this.map.centerAtCoordinate(l);GSUtil.cancelEvent(f)};GSMapControl.prototype.remove=function(a){this.zoomControl.remove(a);GSMapControl.superClass.remove.call(this,a)};GSUtil.extend(GSScalebarControl,GSControl);function GSScalebarControl(){GSScalebarControl.baseConstructor.call(this,GSMap.SCALEBAR_CONTROL);this.width=220;this.height=30;this.scalebarPreloads=[];this.availableImages=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096]}GSScalebarControl.prototype.getWidth=function(){return this.width};GSScalebarControl.prototype.getHeight=function(){return this.height};GSScalebarControl.prototype.getDefaultPosition=function(){return{anchor:GSControl.ANCHOR_BOTTOM_LEFT,offset:new GSPoint(7,7)}};GSScalebarControl.prototype.render=function(b){this.map=b;this.preloadScalebarImages();var a=GSUtil.createElement("img",{src:this.getImageUrl(b.mpx),styles:{width:this.width+"px",height:this.height+"px",position:"absolute",zIndex:20},"class":"noprint"});this.map.addListener(this);return a};GSScalebarControl.prototype.preloadScalebarImages=function(){var b;for(var c=0,a=this.map.scaleRange.length;c<a;c++){var d=this.map.scaleRange[c];if(this.imageAvailable(d)){b=new Image();b.src=this.getImageUrl(d);this.scalebarPreloads.push(b)}}};GSScalebarControl.prototype.getImageUrl=function(a){if(this.imageAvailable(a)){return _globals.resourceURL+"scalebarmpx/"+a+"mpx.png"}return _globals.resourceURL+"blank.gif"};GSScalebarControl.prototype.imageAvailable=function(c){for(var b=0,a=this.availableImages.length;b<a;b++){if(this.availableImages[b]==c){return true}}return false};GSScalebarControl.prototype.mapZoomed=function(a){this.updateScalebar()};GSScalebarControl.prototype.updateScalebar=function(){var a=this.getImageUrl(this.map.mpx);GSUtil.setImageSrc(this.element,a)};GSScalebarControl.prototype.remove=function(a){this.map.removeListener(this);GSScalebarControl.superClass.remove.call(this,a)};GSUtil.extend(GSSnapbackControl,GSControl);function GSSnapbackControl(a){GSSnapbackControl.baseConstructor.call(this,GSMap.SNAPBACK_CONTROL);if(!a){a={}}this.options=a;this.width=16;this.height=16;this.tooltip=this.options.tooltip?this.options.tooltip:"Snapback to saved map position"}GSSnapbackControl.prototype.getWidth=function(){return this.width};GSSnapbackControl.prototype.getHeight=function(){return this.height};GSSnapbackControl.prototype.getDefaultPosition=function(){return{anchor:GSControl.ANCHOR_TOP_RIGHT,offset:new GSPoint(7,7)}};GSSnapbackControl.prototype.render=function(b){this.map=b;var a=GSUtil.createElement("img",{src:_globals.resourceURL+"snapback.png",styles:{width:this.width+"px",height:this.height+"px",position:"absolute",zIndex:10,cursor:"pointer"},"class":"noprint",title:this.tooltip,events:{click:GSUtil.bind(this.snapback,this)}});return a};GSSnapbackControl.prototype.snapback=function(a){GSUtil.cancelEvent(a);this.map.snapback()};GSUtil.extend(GSZoomControl,GSControl);function GSZoomControl(a){GSZoomControl.baseConstructor.call(this,GSMap.ZOOM_CONTROL);this.sliderBar=null;this.sliderThumb=null;this.labelContainer=null;this.zooming=false;this.width=22;this.height=135;this.labels=a;this.labelControls=[];this.sliderIncrement=0}GSZoomControl.prototype.getWidth=function(){return this.width};GSZoomControl.prototype.getHeight=function(){return this.height};GSZoomControl.prototype.render=function(f){this.map=f;this.sliderIncrement=this.calculateSliderIncrement();var b=GSUtil.createElement("div",{styles:{width:this.width+"px",height:this.height+"px"}});this.map.addListener(this);var d=GSUtil.createElement("div",{styles:{position:"absolute",left:"2px",top:"0px"}});b.appendChild(d);var a=GSUtil.createElement("img",{src:_globals.resourceURL+"zoomIn.png",styles:{width:"14px",height:"13px",position:"absolute",left:"2px",top:"3px",zIndex:110,cursor:"pointer"},"class":"noprint",title:"Zoom in",parent:d});var c=GSUtil.createElement("img",{src:_globals.resourceURL+"zoomOut.png",styles:{width:"14px",height:"13px",position:"absolute",left:"2px",top:"115px",zIndex:110,cursor:"pointer"},"class":"noprint",title:"Zoom out",parent:d});this.sliderBar=GSUtil.createElement("img",{src:_globals.resourceURL+"sliderBG.png",styles:{width:"22px",height:"135px",position:"absolute",top:0,left:0,zIndex:100,cursor:"pointer"},"class":"noprint",title:"Click to set zoom level",parent:d});this.sliderThumb=GSUtil.createElement("img",{src:_globals.resourceURL+"sliderThumb.png",styles:{width:"15px",height:"14px",position:"absolute",left:"1px",top:(GSZoomControl.SLIDER_MAX-4)+"px",zIndex:1015,cursor:!_browser.isWebkit?"url("+_globals.resourceURL+"cursor-grab.cur),-moz-grab":"pointer"},"class":"noprint",title:"Drag to zoom"});if(this.labels){this.createLabels(d);this.positionLabels()}GSEventManager.addEventListener(a,"click",GSUtil.bindAsEventListener(this.zoomIn,this));GSEventManager.addEventListener(a,"dblclick",GSUtil.cancelEvent);GSEventManager.addEventListener(a,"contextmenu",GSUtil.cancelEvent);GSEventManager.addEventListener(c,"click",GSUtil.bindAsEventListener(this.zoomOut,this));GSEventManager.addEventListener(c,"dblclick",GSUtil.cancelEvent);GSEventManager.addEventListener(c,"contextmenu",GSUtil.cancelEvent);GSDrag.init(this.sliderThumb,null,1,1,GSZoomControl.SLIDER_MIN,GSZoomControl.SLIDER_MAX);this.sliderThumb.onDragStart=GSUtil.bind(this.dragStartHandler,this);this.sliderThumb.onDragEnd=GSUtil.bind(this.dragEndHandler,this);GSEventManager.bind(this.sliderBar,"click",this,this.sliderClicked);GSEventManager.addEventListener(this.sliderBar,"dblclick",GSUtil.cancelEvent);GSEventManager.addEventListener(this.sliderBar,"contextmenu",GSUtil.cancelEvent);d.appendChild(this.sliderThumb);if(this.labels){GSEventManager.addEventListener(this.sliderBar,"mouseover",GSUtil.bindAsEventListener(this.showLabels,this));GSEventManager.addEventListener(this.sliderBar,"mouseout",GSUtil.bindAsEventListener(this.delayHideLabels,this))}if(this.map.getZoomLevel()){this.updateThumb(this.map.getZoomLevel())}return b};GSZoomControl.prototype.showLabels=function(a){this.labelContainer.style.display="block";GSUtil.cancelEvent(a)};GSZoomControl.prototype.delayHideLabels=function(a){setTimeout(GSUtil.bind(this.hideLabels,this),3000);GSUtil.cancelEvent(a)};GSZoomControl.prototype.hideLabels=function(){if(this.labelContainer){this.labelContainer.style.display="none"}};GSZoomControl.prototype.createLabels=function(c){this.labelContainer=GSUtil.createElement("div",{styles:{position:"absolute",display:"none"}});c.appendChild(this.labelContainer);for(var b=0,a=this.labels.length;b<a;b++){this.labelControls.push(this.createLabel(this.labelContainer,this.labels[b]))}};GSZoomControl.prototype.positionLabels=function(){for(var c=0,b=this.labelControls.length;c<b;c++){var g=this.labelControls[c];var a=this.map.getBaseLayer();if(g.level>=a.minZoom&&g.level<=a.maxZoom){var f=16;var d=GSZoomControl.SLIDER_OFFSET+((a.maxZoom-g.level)*this.sliderIncrement);d=d<GSZoomControl.SLIDER_MIN+(this.sliderIncrement/2)?GSZoomControl.SLIDER_MIN:d>GSZoomControl.SLIDER_MAX-(this.sliderIncrement/2)?GSZoomControl.SLIDER_MAX:d;GSUtil.positionElement(g,f,d);g.style.visibility="visible"}else{g.style.visibility="hidden"}}};GSZoomControl.prototype.createLabel=function(c,b){var d=GSUtil.createElement("div",{styles:{cursor:"pointer",position:"absolute",zIndex:115},events:{click:GSUtil.bindAsEventListener(this.zoom,this,b.level),mouseover:this.onLabelOver,mouseout:this.onLabelOut,contextmenu:GSUtil.cancelEvent}});d.level=b.level;c.appendChild(d);var a=GSUtil.createElement("img",{src:_globals.resourceURL+"zoomLabel.png",styles:{width:"82px",height:"17px",position:"absolute",left:0,top:"-2px"},"class":"noprint",parent:d});d.img=a;var f=GSUtil.createElement("div",{styles:{width:"76px",paddingRight:"6px",textAlign:"right",fontFamily:"Helvetica, Arial, Sans-serif",fontWeight:"bold",fontSize:"11px",lineHeight:"11px",position:"absolute",top:"1px"},html:b.value,unselectable:true});d.appendChild(f);return d};GSZoomControl.prototype.zoom=function(a,b){this.map.zoom(b);GSUtil.cancelEvent(a)};GSZoomControl.prototype.onLabelOver=function(a){GSUtil.setImageSrc(this.img,_globals.resourceURL+"zoomLabelOver.png")};GSZoomControl.prototype.onLabelOut=function(a){GSUtil.setImageSrc(this.img,_globals.resourceURL+"zoomLabel.png")};GSZoomControl.prototype.zoomIn=function(a){GSUtil.cancelEvent(a);var b=this.map.scaleIdx;if(b+1>this.map.getBaseLayer().maxZoom){return}this.map.animatedZoom(b+1)};GSZoomControl.prototype.zoomOut=function(a){GSUtil.cancelEvent(a);var b=this.map.scaleIdx;if(b-1<this.map.getBaseLayer().minZoom){return}this.map.animatedZoom(b-1)};GSZoomControl.prototype.dragStartHandler=function(a,b){if(!_browser.isWebkit){this.sliderThumb.style.cursor="url("+_globals.resourceURL+"cursor-grabbing.cur),-moz-grabbing"}};GSZoomControl.prototype.dragEndHandler=function(a,b){if(!_browser.isWebkit){this.sliderThumb.style.cursor="url("+_globals.resourceURL+"cursor-grab.cur),-moz-grab"}this.sliderMoved(a,b)};GSZoomControl.prototype.sliderClicked=function(g){GSUtil.cancelEvent(g);var d,b;if(_browser.isIE){d=g.offsetX;b=g.offsetY}else{d=(window.pageXOffset+g.clientX-GSUtil.findPosX(this.sliderBar));b=(window.pageYOffset+g.clientY-GSUtil.findPosY(this.sliderBar))}if(b<GSZoomControl.SLIDER_MIN||b>GSZoomControl.SLIDER_MAX){return}var f=this;var k=GSUtil.bind(this.onSlideFrame,this);var a=GSUtil.bind(this.onSlideComplete,this,d,b);var h=new GSPoint(parseInt(this.sliderThumb.style.left,10),parseInt(this.sliderThumb.style.top,10));var j=new GSPoint(parseInt(this.sliderThumb.style.left,10),b);var c=new GSAnimator(h,j,16,500,k,null,a);c.animate()};GSZoomControl.prototype.onSlideFrame=function(b,a){this.sliderThumb.style.top=a.y+"px"};GSZoomControl.prototype.onSlideComplete=function(c,b,a){this.sliderMoved(c,b)};GSZoomControl.prototype.calculateSliderIncrement=function(){return(GSZoomControl.SLIDER_MAX-GSZoomControl.SLIDER_MIN)/(this.map.getBaseLayer().getNumZoomLevels()-1)};GSZoomControl.prototype.sliderMoved=function(a,d){this.zooming=true;var b=Math.round((this.map.getBaseLayer().maxZoom)-((d-GSZoomControl.SLIDER_OFFSET)/this.sliderIncrement));var c=this.map.getBaseLayer().minZoom;if(b<c){b=c}this.map.animatedZoom(b)};GSZoomControl.prototype.mapZoomed=function(c,b,a){this.updateThumb(a)};GSZoomControl.prototype.refresh=function(){this.sliderIncrement=this.calculateSliderIncrement();this.updateThumb(this.map.getZoomLevel());this.positionLabels()};GSZoomControl.prototype.updateThumb=function(a){var b=Math.round((this.map.getBaseLayer().maxZoom-a)*this.sliderIncrement);b+=GSZoomControl.SLIDER_OFFSET;b=b<GSZoomControl.SLIDER_MIN+(this.sliderIncrement/2)?GSZoomControl.SLIDER_MIN:(b>GSZoomControl.SLIDER_MAX-(this.sliderIncrement/2)?GSZoomControl.SLIDER_MAX:b);this.sliderThumb.style.top=b+"px"};GSZoomControl.prototype.remove=function(a){this.map.removeListener(this);this.labelContainer=null;this.sliderBar=null;GSDrag.obj=null;this.sliderThumb.root=null;this.sliderThumb=null;GSZoomControl.superClass.remove.call(this,a)};GSZoomControl.SLIDER_OFFSET=22;GSZoomControl.SLIDER_MIN=22;GSZoomControl.SLIDER_MAX=100;function GSDimension(b,a){this.width=parseInt(b);this.height=parseInt(a)}GSDimension.prototype.toString=function(){return"Dimension: width=["+this.width+"], h=["+this.height+"]"};GSDimension.prototype.toJson=function(){var a={width:this.width,height:this.height};return GSUtil.objToJson(a)};function GSEventManager(){}GSEventManager.bind=function(h,g,c,j){var d=[];for(var f=4,b=arguments.length;f<b;f++){d.push(arguments[f])}var a=GSEventManager.createAdapter(c,j,d);return GSEventManager.addEventListener(h,g,a)};GSEventManager.createAdapter=function(a,c){var b=Array.prototype.slice.call(arguments);a=b.shift();c=b.shift();return function(d){return c.apply(a,[d||window.event].concat(b[0]))}};GSEventManager.release=function(a){GSEventManager.removeEventListener(a)};GSEventManager.addEventListener=function(d,a,c,b){if(b){c=GSUtil.bindAsEventListener(c,b)}if(d.addEventListener){a=_browser.isMobileWebkit&&a=="click"?"touchend":a;d.addEventListener(a,c,false)}else{d.attachEvent("on"+a,c)}return GSEventCache.add(d,a,c)};GSEventManager.removeEventListener=function(a){if(!a){return}GSEventCache.remove(a)};var GSEventCache=function(){var c=0;var b={};var a={handlerId:c,handlers:b,nextHandlerId:function(){return"h"+this.handlerId++},add:function(g,d,f){var h=this.nextHandlerId();this.handlers[h]=Array.prototype.slice.call(arguments);return h},flush:function(){for(var d in this.handlers){this.remove(d)}},remove:function(f){var d=this.handlers[f];if(d){if(d[0].removeEventListener){d[0].removeEventListener(d[1],d[2],false)}if(d[1].substring(0,2)!="on"){d[1]="on"+d[1]}if(d[0].detachEvent){d[0].detachEvent(d[1],d[2])}d[0][d[1]]=null}this.handlers[f]=undefined;delete this.handlers[f]}};return a}();function GSUnload(){var d=null;for(var b=0,a=_globals.maps.length;b<a;b++){d=_globals.maps[b];d.remove();for(var c in d){d[c]=null}}}GSEventManager.addEventListener(window,"unload",GSUnload);function GSMouseWheel(){}GSMouseWheel.bind=function(d,a,f,b){var c=(window.addEventListener&&!_browser.isWebkit)?"DOMMouseScroll":"mousewheel";return GSEventManager.addEventListener(d,c,GSUtil.bindAsEventListener(this.wheelHandler,a,f,b))};GSMouseWheel.wheelHandler=function(c,b,a){if(a==undefined||c[a+"Key"]){var d=0;if(c.wheelDelta){d=c.wheelDelta/120;if(window.opera){d=-d}}else{if(c.detail){d=-c.detail/3}}if(d){b.call(this,d,c)}GSUtil.cancelEvent(c)}};function GSIcon(a){this.type="GSIcon";this.cls=undefined;this.imageSrc=undefined;if(a){this.imageSrc=a.imageSrc}this.imageSize=undefined;if(a){this.imageSize=a.imageSize}this.printSrc=undefined;if(a){this.printSrc=a.printSrc}this.printSize=undefined;if(a){this.printSize=a.printSize}this.shadowSrc=undefined;if(a){this.shadowSrc=a.shadowSrc}this.shadowSize=undefined;if(a){this.shadowSize=a.shadowSize}this.alt=undefined;this.iconOffset=new GSPoint(0,0);if(a){this.iconOffset=new GSPoint(a.iconOffset.x,a.iconOffset.y)}this.iconInfoWindowOffset=new GSPoint(0,0);if(a){this.iconInfoWindowOffset=new GSPoint(a.iconInfoWindowOffset.x,a.iconInfoWindowOffset.y)}this.imageMap=undefined;if(a){this.imageMap=a.imageMap}this.imageMapShape="poly";if(a){this.imageMapShape=a.imageMapShape}this.layer=undefined;this.visible=true;this.arcHeight=10;this.dragging=false}GSIcon.iconId=0;GSIcon.nextId=function(){return GSIcon.iconId++};GSIcon.prototype.initialize=function(){this.image=GSUtil.createElement("img",{src:this.imageSrc,styles:{width:this.imageSize.width+"px",height:this.imageSize.height+"px",position:"absolute",left:0,top:0,cursor:"pointer",zIndex:10},"class":"noprint"+(this.cls?" "+this.cls:""),events:{contextmenu:GSUtil.cancelEvent}});if(this.alt){this.image.title=this.alt}this.dragCrosshair=GSUtil.createElement("img",{src:_globals.resourceURL+"dragCross.png",styles:{width:"16px",height:"16px",position:"absolute",left:0,top:0,display:"none"},"class":"noprint"});if(this.printSrc!=null){this.printImage=GSUtil.createElement("img",{src:this.printSrc,styles:{width:this.printSize.width+"px",height:this.printSize.height+"px",position:"absolute",left:0,top:0},"class":"noscreen"})}if(this.shadowSrc!=null){this.shadow=GSUtil.createElement("img",{src:this.shadowSrc,styles:{width:this.shadowSize.width+"px",height:this.shadowSize.height+"px",position:"absolute",left:0,top:0},"class":"noprint",events:{contextmenu:GSUtil.cancelEvent}})}if(_browser.isGecko&&this.imageMap!=null){var a="map_"+GSIcon.nextId();this.image.setAttribute("usemap",a);this.htmlImageMap=GSUtil.createImageMap(a,this.imageMapShape,this.imageMap,"#",this.alt);GSEventManager.addEventListener(this.htmlImageMap,"contextmenu",GSUtil.cancelEvent)}this.graphicsEl=this.image};GSIcon.prototype.setVisible=function(a){this.visible=a};GSIcon.prototype.addToLayer=function(a){this.layer=a;this.layer.iconContainer.appendChild(this.graphicsEl);this.layer.iconContainer.appendChild(this.dragCrosshair);if(this.printImage){this.layer.iconContainer.appendChild(this.printImage)}if(this.shadow){this.layer.iconShadowContainer.appendChild(this.shadow)}if(this.htmlImageMap){this.layer.iconContainer.appendChild(this.htmlImageMap)}};GSIcon.prototype.addToMapContainer=function(a){if(this.shadow){a.container.appendChild(this.shadow);this.shadow.style.zIndex=30}a.container.appendChild(this.graphicsEl);this.graphicsEl.style.zIndex=40;a.container.appendChild(this.dragCrosshair);this.dragCrosshair.style.zIndex=30};GSIcon.prototype.removeFromMapContainer=function(a){a.container.removeChild(this.graphicsEl);a.container.removeChild(this.dragCrosshair);if(this.shadow){a.container.removeChild(this.shadow)}};GSIcon.prototype.startDragging=function(a){this.dragging=true;this.dragCrosshair.style.display="block";this.addToMapContainer(a)};GSIcon.prototype.stopDragging=function(a){this.dragging=false;this.dragCrosshair.style.display="none";this.removeFromMapContainer(a)};GSIcon.prototype.render=function(d,j,a){var b=d.map.getBounds();b.maxX-=(this.iconOffset.x)*d.map.mpx;b.minY+=(this.iconOffset.y-1)*d.map.mpx;if(b.contains(j)){var h=d.map.translateToMapCoordinate(j);var g=(h.x+this.iconOffset.x);var f=(h.y+this.iconOffset.y);GSUtil.positionElement(this.graphicsEl,Math.floor(g),Math.floor(f)-(this.dragging?this.arcHeight:0));if(this.shadow){GSUtil.positionElement(this.shadow,g,f-(this.dragging?this.arcHeight/2:0))}if(this.printImage){GSUtil.positionElement(this.printImage,g,f)}if(this.dragging){if(a!=undefined&&a!=null&&!d.map.panning){h=d.map.translateToMapCoordinate(a)}this.repositionDragCrosshair(h.x,h.y)}var c=this.visible?"":"none";if(this.printImage){this.printImage.style.display=c}if(this.shadow){this.shadow.style.display=c}this.graphicsEl.style.display=c;if(this.dragging){this.dragCrosshair.style.display=(this.visible?"block":"none")}return this.visible}else{this.graphicsEl.style.display="none";if(this.printImage){this.printImage.style.display="none"}if(this.shadow){this.shadow.style.display="none"}if(this.dragging){this.dragCrosshair.style.display="none"}return false}};GSIcon.prototype.repositionDragCrosshair=function(a,b){GSUtil.positionElement(this.dragCrosshair,a-8,b-8)};GSIcon.prototype.getEventTarget=function(){return this.graphicsEl};GSIcon.prototype.remove=function(a){a=a!==undefined?a:true;try{this.layer.iconContainer.removeChild(this.image);if(a){this.image=this.graphicsEl=null}if(this.htmlImageMap!=null){this.layer.iconContainer.removeChild(this.htmlImageMap);if(a){this.htmlImageMap=null}}if(this.printImage!=null){this.layer.iconContainer.removeChild(this.printImage);if(a){this.printImage=null}}if(this.shadow!=null){this.layer.iconShadowContainer.removeChild(this.shadow);if(a){this.shadow=null}}}catch(b){}};GSIcon.prototype.toString=function(){var a="";a+=("image src: "+this.imageSrc+"<br/>");a+=("print image src: "+this.printSrc+"<br/>");a+=("shadow image src: "+this.shadowSrc+"<br/>");a+=("icon offset: "+this.iconOffset+"<br/>");a+=("icon info window offset: "+this.iconInfoWindowOffset+"<br/>");if(_browser.isGecko&&this.imageMap){a+=("image map: "+this.imageMap.name)}return a};GSIcon.prototype.toJson=function(){var a={type:this.type,iconImageSrc:this.imageSrc,iconOffset:this.iconOffset,iconSize:this.imageSize};return GSUtil.objToJson(a)};GSIcon.defaultIcon=new GSIcon();GSIcon.defaultIcon.imageSrc=_globals.resourceURL+"poi-default.png";GSIcon.defaultIcon.printSrc=_globals.resourceURL+"poi-default.gif";GSIcon.defaultIcon.imageSize=new GSDimension(22,27);GSIcon.defaultIcon.printSize=new GSDimension(22,27);GSIcon.defaultIcon.iconOffset=new GSPoint(-7,-25);GSIcon.defaultIcon.iconInfoWindowOffset=new GSPoint(10,1);function GSAbstractLayer(b,a){this.options={zIndex:0,isBaseLayer:false,visible:true};GSUtil.merge(a,this.options);this.type="GSAbstractLayer";this.name=b;this.visible=this.options.visible;this.map}GSAbstractLayer.prototype.addToMap=function(a){this.map=a};GSAbstractLayer.prototype.isBaseLayer=function(){return this.options.isBaseLayer};GSAbstractLayer.prototype.setVisible=function(a){this.visible=a};GSAbstractLayer.prototype.isVisible=function(){return this.visible};GSAbstractLayer.prototype.setZIndex=function(a){this.options.zIndex=a;if(this.container){this.container.style.zIndex=a}};GSAbstractLayer.prototype.getBounds=function(){throw new Error("This method must be overriden by subclasses")};GSAbstractLayer.prototype.remove=function(){this.map.layerContainer.removeChild(this.container)};GSAbstractLayer.prototype.toJson=function(){var a={type:this.type,zIndex:this.zIndex,visible:this.visible};return GSUtil.objToJson(a)};GSAbstractLayer.prototype.toString=function(){var a="Layer:<br/>";a+="type: "+this.type;a+="zIndex: "+this.zIndex;a+="visible: "+this.visible;return a};GSUtil.extend(GSLayer,GSAbstractLayer);function GSLayer(b,a){this.options={zIndex:10};GSUtil.merge(a,this.options);GSLayer.baseConstructor.call(this,b,this.options);this.type="GSLayer";this.data=[]}GSLayer.prototype.addToMap=function(c){GSLayer.superClass.addToMap.call(this,c);this.createOverlayContainers();for(var b=0,a;a=this.data[b];b++){a.addToLayer(this);if(a.isSnappable&&a.isSnappable()){this.map.addSnappable(a)}}};GSLayer.prototype.setVisible=function(c){GSLayer.superClass.setVisible.call(this,c);for(var b=0,a=this.data.length;b<a;b++){this.data[b].setVisible(c);if(c){this.data[b].render()}}};GSLayer.prototype.getFeatures=function(){return this.data};GSLayer.prototype.getFeatureById=function(a){return GSUtil.getFeatureById(this.data,a)};GSLayer.prototype.addFeatures=function(c){for(var b=0,a=c.length;b<a;b++){this.addFeature(c[b])}};GSLayer.prototype.addFeaturesJson=function(h,g){var b;if(arguments.length>2){b=[];for(var d=2,a=arguments.length;d<a;d++){b.push(arguments[d])}}for(var d=0,a=h.length;d<a;d++){var f=h[d].jsclass;if(f){if(window[f]){var c=new window[f](h[d]);if(g){g(c,h[d],b)}this.addFeature(c)}else{throw new Error("Trying to instantiate a non-existent class: "+f)}}}};GSLayer.prototype.addFeature=function(a){this.data.push(a);a.setVisible(this.visible);if(this.map){a.addToLayer(this);if(a.isSnappable&&a.isSnappable()){this.map.addSnappable(a)}}};GSLayer.prototype.removeFeature=function(d,c){for(var b=0,a=this.data.length;b<a;b++){if(d==this.data[b]){d.remove(c);return this.data.splice(b,1)}}return null};GSLayer.prototype.clear=function(){for(var b=0,a=this.data.length;b<a;b++){this.data[b].remove()}this.data.length=0};GSLayer.prototype.remove=function(){GSLayer.superClass.remove.call(this);this.clear();this.container=null;this.lineContainer=null;this.iconShadowContainer=null;this.iconContainer=null;this.labelContainer=null};GSLayer.prototype.getBounds=function(){return GSUtil.getMinimumBoundingRectangle(this.data)};GSLayer.prototype.createOverlayContainers=function(){this.container=GSUtil.createContainer(this.map.layerContainer,"GSLayer",null,null,0,0,null,this.options.zIndex);this.container.id="GSLayer-"+this.map.id+"-"+this.name;this.imageContainer=GSUtil.createContainer(this.container,null,null,null,0,0,null,10);this.iconShadowContainer=GSUtil.createContainer(this.container,null,null,null,0,0,null,30);this.iconContainer=GSUtil.createContainer(this.container,null,null,null,0,0,null,40);this.labelContainer=GSUtil.createContainer(this.container,null,null,null,0,0,null,50)};GSLayer.prototype.createVectorContainer=function(){var a=null;var b=this.map;if(_browser.svg){a=document.createElementNS(_globals.svgns,"svg");this.container.appendChild(a);a.style.zIndex=20;GSUtil.positionElement(a,0,0);a.setAttributeNS(null,"width",b.pxWidth+"px");a.setAttributeNS(null,"height",b.pxHeight+"px");a.mapResized=GSUtil.bind(this.mapResized,a,b)}else{if(_browser.isIE6up){a=document.createElement(_globals.vmlnsPrefix+":group");this.container.appendChild(a);a.style.zIndex=20;GSUtil.positionElement(a,0,0);a.style.width=b.pxWidth+"px";a.style.height=b.pxHeight+"px";a.coordorigin="0 0";a.coordsize=b.pxWidth+" "+b.pxHeight;a.mapResized=GSUtil.bind(this.mapResizedIE,a,b)}else{if(_browser.canvas){a=document.createElement("div");this.container.appendChild(a);a.style.zIndex=20;GSUtil.positionElement(a,0,0);a.style.width=b.pxWidth+"px";a.style.height=b.pxHeight+"px";a.mapResized=GSUtil.bind(this.mapResized,a,b)}}}b.addListener(a);return a};GSLayer.prototype.mapResized=function(a){this.setAttributeNS(null,"width",a.pxWidth+"px");this.setAttributeNS(null,"height",a.pxHeight+"px")};GSLayer.prototype.mapResizedIE=function(a){this.style.width=a.pxWidth+"px";this.style.height=a.pxHeight+"px";this.coordsize=a.pxWidth+" "+a.pxHeight};GSLayer.prototype.toJson=function(){var a={name:this.name,type:this.type,zIndex:this.options.zIndex,visible:this.visible,feature:this.data};return GSUtil.objToJson(a)};GSLayer.prototype.toString=function(){var c="Layer:<br/>";for(var b=0,a=this.data.length;b<a;b++){c+=this.data[b].toString()}return c};GSUtil.extend(GSTileLayer,GSAbstractLayer);function GSTileLayer(c,d,a,b){this.options={hostname:"{tiles}.geosmart.co.nz",pathTemplate:"/nz/v"+_globals.tileSetVersion+"/carto/{mpx}/{x}/{x}_{y}.png",defaultTile:"/nz/v"+_globals.tileSetVersion+"/carto/default.png",getTileUrl:GSUtil.bind(this.getTileUrl,this),maxExtent:new GSBounds(1669840,5258864,3450000,6864496),tileSize:256,isBaseLayer:true,mimetype:"image/png",magicMimetype:true,opacity:1};GSUtil.merge(b,this.options);GSTileLayer.baseConstructor.call(this,c,this.options);this.type="GSTileLayer";this.minZoom=d;this.maxZoom=a;this.imagePool=[];this.tileClass=GSTile;this.paramRegex=/\{([a-z]+)\}/gi;this.updating=false}GSTileLayer.STREET_MAP="Map";GSTileLayer.TERRAIN_MAP="Terrain";GSTileLayer.SATELLITE_MAP="Satellite";GSTileLayer.prototype.createContainer=function(){this.container=GSUtil.createContainer(this.map.layerContainer,"GSTileLayer",null,null,0,0,null,this.options.zIndex);this.container.id="GSTileLayer-"+this.map.id+"-"+this.name};GSTileLayer.prototype.addToMap=function(a){GSTileLayer.superClass.addToMap.call(this,a);this.map.addListener(this);this.createContainer();if(this.map.isReady){this.tileUpdateRequired(false,true)}};GSTileLayer.prototype.setVisible=function(a){GSTileLayer.superClass.setVisible.call(this,a);if(a){this.container.style.display="";this.tileUpdateRequired(false,true)}else{this.container.style.display="none"}};GSTileLayer.prototype.isVisible=function(){return this.visible&&this.map.getZoomLevel()>=this.minZoom&&this.map.getZoomLevel()<=this.maxZoom};GSTileLayer.prototype.getBounds=function(){return this.options.maxExtent};GSTileLayer.prototype.getTileSize=function(){return this.options.tileSize};GSTileLayer.prototype.getContainerPosition=function(){return new GSPoint(parseInt(this.container.style.left,10),parseInt(this.container.style.top,10))};GSTileLayer.prototype.setContainerPosition=function(a){GSUtil.translateElement(this.container,a.x,a.y)};GSTileLayer.prototype.getNumZoomLevels=function(){return this.maxZoom-this.minZoom+1};GSTileLayer.prototype.getTileUrl=function(b,d,h,g,a){var c=null;if(this.options.maxExtent.overlaps(h)){var f=this.execTemplate(d,h,g,a);c=(document.location.protocol.indexOf("http")==-1?"http:":document.location.protocol)+"//"+this.getHostname(b,h.minX,h.maxY,g)+f}return c};GSTileLayer.prototype.execTemplate=function(b,d,c,a){return b.replace(this.paramRegex,function(f){switch(f){case"{x}":return d.minX;case"{y}":return d.maxY;case"{mpx}":return c;case"{minX}":return d.minX;case"{minY}":return d.minY;case"{maxX}":return d.maxX;case"{maxY}":return d.maxY;case"{mimetype}":return a}})};GSTileLayer.prototype.getDefaultTileUrl=function(){if(!this.options.isBaseLayer){return _globals.resourceURL+"blank.gif"}var b=this.options.defaultTile;var a=(document.location.protocol.indexOf("http")==-1?"http:":document.location.protocol)+"//"+this.getHostname()+b;return a};GSTileLayer.prototype.getHostname=function(b,a,f,d){if(!b){b=this.options.hostname}if(b.indexOf("{")==-1){return b}else{var c=0;if(a!==undefined&&f!==undefined&&d!==undefined){c=((a/(this.options.tileSize*d))+(f/(this.options.tileSize*d)))&3}return b.replace(this.paramRegex,"$1"+c)}};GSTileLayer.prototype.tileUpdateRequired=function(n,o){if(!this.isVisible()){this.container.style.display="none";return}else{this.updating=true;this.container.style.display=""}var z=this.map.mpx;var m=this.map.getBounds();var u=this.options.tileSize;var x=u;var b=this.options.tileSize*z;var c=b;var j=Math.floor(m.minX/b)*b;var h=Math.floor(m.maxX/b)*b;var g=Math.ceil(m.minY/c)*c;var d=Math.ceil(m.maxY/c)*c;if(!this.tiles){this.tiles={};this.blankTile=new Image();this.blankTile.src=_globals.resourceURL+"blank.gif"}var p=Math.floor(j/z);var y=Math.floor(d/z);var k=Math.floor((j-m.minX)/z);var s=Math.floor((m.maxY-d)/z);var a=0;var f=0;if(o){for(var t in this.tiles){this.tiles[t].removeFromContainer()}this.tiles={};this.imagePool.length=0}var l=false;if((!n||o)||!this.tilesOriginMpx){this.tilesOriginMpx=new GSPoint(p,y);l=true;GSUtil.translateElement(this.container,k,s)}else{k-=p-this.tilesOriginMpx.x;s-=this.tilesOriginMpx.y-y;a-=this.tilesOriginMpx.x-p;f+=this.tilesOriginMpx.y-y}var A=0;var v=0;var q=f;var r=a;for(var B=d;B>=g;B-=c){v=0;r=a;for(var C=j;C<=h;C+=b){this.addTile(C,B,r,q,l);v++;r+=u}A++;q+=x}var w={rowTileCount:v,columnTileCount:A,pxStart:a,pyStart:f,pxEnd:r,pyEnd:q,tilesMinX:j,tilesMinY:g,tilesMaxX:h,tilesMaxY:d,tileWidthMetres:b,tileHeightMetres:c};if(this.map.dragCoordinates){this.updateTilesForDelta(m,z,this.map.dragCoordinates.lastDelta,w,l)}this.addNeededTiles();this.updating=false};GSTileLayer.prototype.updateTilesForDelta=function(b,f,h,d,a){var g;var c=this.options.tileSize;if(h.x===0&&this.map.dragCoordinatesLastLastDelta){h.x=this.map.dragCoordinatesLastLastDelta.x}if(h.y===0&&this.map.dragCoordinatesLastLastDelta){h.y=this.map.dragCoordinatesLastLastDelta.y}if(h.x<0){g=Math.floor((b.minX-d.tilesMinX)/f);this.updateTileColumn(d.tilesMinX-d.tileWidthMetres,d.tilesMaxY,d.pxStart-c,d.pyStart,d.tileHeightMetres,d.columnTileCount,g,a)}else{if(h.x>0){g=Math.floor(((d.tilesMaxX+d.tileWidthMetres)-b.maxX)/f);this.updateTileColumn(d.tilesMaxX+d.tileWidthMetres,d.tilesMaxY,d.pxEnd,d.pyStart,d.tileHeightMetres,d.columnTileCount,g,a)}}if(h.y>0){g=Math.floor((d.tilesMaxY-b.maxY)/f);this.updateTileRow(d.tilesMinX,d.tilesMaxY+d.tileHeightMetres,d.pxStart,d.pyStart-c,d.tileWidthMetres,d.rowTileCount,g,a)}else{if(h.y<0){g=Math.floor((b.minY-(d.tilesMinY-d.tileHeightMetres))/f);this.updateTileRow(d.tilesMinX,d.tilesMinY-d.tileHeightMetres,d.pxStart,d.pyEnd,d.tileWidthMetres,d.rowTileCount,g,a)}}};GSTileLayer.prototype.updateTileColumn=function(d,c,p,o,g,k,b,l){var q=this.options.tileSize;var j=d;var f=c;var n=p;var m=o;var a=Math.min(Math.floor((k+1)*(q-b)/q),k);for(var h=0;h<a;h++){this.addTile(j,f,n,m,l);m+=q;f-=g}};GSTileLayer.prototype.updateTileRow=function(d,c,p,o,l,f,b,k){var q=this.options.tileSize;var j=d;var g=c;var n=p;var m=o;var a=Math.min(Math.floor((f+1)*(q-b)/q),f);for(var h=0;h<a;h++){this.addTile(j,g,n,m,k);n+=q;j+=l}};GSTileLayer.prototype.addTile=function(g,f,b,a,c){var h=this.map.mpx;var j=this.name+"_tile_"+g+"_"+f+"_"+h;var d=null;if(!this.tiles[j]){d=new this.tileClass(j,this,g,f,b,a,this.options.tileSize,h);d.addListener(this);this.tiles[j]=d}else{d=this.tiles[j];if(c){d.pixelX=b;d.pixelY=a}}d.active=true};GSTileLayer.prototype.addNeededTiles=function(){for(var b in this.tiles){var a=this.tiles[b];if(!a.active){a.removeFromContainer();delete this.tiles[b]}else{a.display();a.active=false}}};GSTileLayer.prototype.toJson=function(){var a={name:this.name,type:this.type,minZoom:this.minZoom,maxZoom:this.maxZoom,hostname:this.getHostname(),pathTemplate:this.options.pathTemplate,defaultTileUrl:this.getDefaultTileUrl(),isBaseLayer:this.isBaseLayer(),visible:this.visible,zIndex:this.options.zIndex,mimetype:this.options.mimetype,tileSize:this.options.tileSize};return GSUtil.objToJson(a)};function GSTile(j,c,g,d,b,a,f,h){this.id=j;this.parent=c;this.tileX=g;this.tileY=d;this.pixelX=b;this.pixelY=a;this.tileSize=f;this.mpx=h;this.tileBounds=new GSBounds(this.tileX,this.tileY-(this.mpx*this.tileSize),this.tileX+(this.mpx*this.tileSize),this.tileY);this.mimetype=(_browser.pngAlpha&&!this.parent.options.isBaseLayer&&this.parent.options.mimetype=="image/png"&&this.parent.options.magicMimetype)?"image/gif":this.parent.options.mimetype;this.imageSrc=this.parent.options.getTileUrl(this.parent.options.hostname,this.parent.options.pathTemplate,this.tileBounds,this.mpx,this.mimetype);this.imageElement=undefined}GSUtil.include(GSTile,new GSEventBroadcasterMixin());GSTile.prototype.display=function(){if(!this.imageElement){this.imageElement=this.createImageElement();GSEventManager.addEventListener(this.imageElement,"load",this.oncomplete,this);GSEventManager.addEventListener(this.imageElement,"error",this.oncomplete,this);this.setImageSrc(this.imageSrc?this.imageSrc:this.parent.getDefaultTileUrl());if(this.imageElement.parentNode!=this.parent.container){this.parent.container.appendChild(this.imageElement)}else{this.imageElement.style.display=""}}this.updatePosition()};GSTile.prototype.oncomplete=function(){this.broadcastMessage("tileLoaded",this)};GSTile.prototype.release=function(){if(this.imageElement){this.imageElement.src=_globals.resourceURL+"blank.gif";this.imageElement.style.display="none";this.parent.imagePool.push(this.imageElement)}};GSTile.prototype.createImageElement=function(){var a;a=GSUtil.createElement("img",{styles:{position:"absolute"},border:0,unselectable:true});return a};GSTile.prototype.setPosition=function(a,b){this.pixelX=a;this.pixelY=b;this.updatePosition()};GSTile.prototype.updatePosition=function(){this.imageElement.style.left=this.pixelX+"px";this.imageElement.style.top=this.pixelY+"px"};GSTile.prototype.setImageSrc=function(a){if(_browser.pngAlpha&&!this.parent.options.isBaseLayer&&this.mimetype=="image/png"){this.imageElement.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a+"', sizingMethod='image')";if(parseFloat(this.parent.options.opacity)>=0&&parseFloat(this.parent.options.opacity)<1){this.imageElement.style.filter+=" alpha(opacity="+this.parent.options.opacity*100+")"}this.imageElement.src=_globals.resourceURL+"blank.gif"}else{this.imageElement.src=a}};GSTile.prototype.removeFromContainer=function(){this.clearListeners();if(this.imageElement&&this.imageElement.parentNode==this.parent.container){this.parent.container.removeChild(this.imageElement)}};function GSMap(b,c){_globals.maps.push(this);this.type="GSMap";this.id=_globals.maps.length;this.options=c||{};this.options.infoWindowOptions=this.options.infoWindowOptions||{};if(arguments[0]){if((typeof arguments[0])=="string"){this.container=document.getElementById(b)}else{this.container=b}}else{throw new Error("Cannot create map, no container argument provided.")}this.isChildMap=GSUtil.stringToBoolean(GSUtil.getCaseInsensitiveProperty(this.options,"isChildMap",false));this.useLogo=GSUtil.stringToBoolean(GSUtil.getCaseInsensitiveProperty(this.options,"useLogo",true));if(this.isChildMap){this.useLogo=false}this.centerOnDblClick=GSUtil.stringToBoolean(GSUtil.getCaseInsensitiveProperty(this.options,"centerOnDblClick",true));this.dragToPan=GSUtil.stringToBoolean(GSUtil.getCaseInsensitiveProperty(this.options,"dragToPan",true));this.useMouseWheelZooming=GSUtil.stringToBoolean(GSUtil.getCaseInsensitiveProperty(this.options,"useMouseWheelZooming",true));this.mouseWheelModifierKey=GSUtil.getCaseInsensitiveProperty(this.options,"mouseWheelModifierKey");this.animatedZooming=GSUtil.stringToBoolean(GSUtil.getCaseInsensitiveProperty(this.options,"animatedZooming",true));this.useCopyright=GSUtil.stringToBoolean(GSUtil.getCaseInsensitiveProperty(this.options,"useCopyright",true));this.useInfoWindow=GSUtil.stringToBoolean(GSUtil.getCaseInsensitiveProperty(this.options,"useInfoWindow",true));this.useScalebar=GSUtil.stringToBoolean(GSUtil.getCaseInsensitiveProperty(this.options,"useScalebar",true));this.scaleRange=[65536,32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1];this.scaleRange.indexOf=function(h){for(var g=0,f=this.length;g<f;g++){if(h==this[g]){return g}}return -1};this.scaleIdx=0;this.mpx=0;this.centerX=GSUtil.getCaseInsensitiveProperty(this.options,"centerX")?parseFloat(GSUtil.getCaseInsensitiveProperty(this.options,"centerX")):2530000;this.centerY=GSUtil.getCaseInsensitiveProperty(this.options,"centerY")?parseFloat(GSUtil.getCaseInsensitiveProperty(this.options,"centerY")):5990000;this.pxWidth=GSUtil.getCaseInsensitiveProperty(this.options,"width")?Number(GSUtil.getCaseInsensitiveProperty(this.options,"width")):500;this.pxHeight=GSUtil.getCaseInsensitiveProperty(this.options,"height")?Number(GSUtil.getCaseInsensitiveProperty(this.options,"height")):400;this.resizeable=false;if(this.options.width&&this.options.height){this.resizeable=false}else{this.resizeable=GSUtil.stringToBoolean(GSUtil.getCaseInsensitiveProperty(this.options,"resizeable",true))}this.customCursor=GSUtil.getCaseInsensitiveProperty(this.options,"customCursor");this.baseLayer=null;this.recalculateMapExtents();this.initDOM();this.controls=[];this.initControls();this.layers=[];this.initBaseLayers();this.createLayer("__base__");this.eventListeners={};this.addEventListeners();if(this.options.listeners){for(var d=0,a=this.options.listeners.length;d<a;d++){this.addListener(this.options.listeners[d])}}this.snappables=[];if(this.useLogo){this.addLogo()}this.infoWindow=undefined;if(this.useInfoWindow){this.infoWindow=new GSInfoWindow(this,this.options.infoWindowOptions)}if(this.useMouseWheelZooming&&!_browser.isMobileWebkit){this.enableMouseWheelZooming()}this.panning=false;this.isReady=false;if(window.GSStyleInspector){GSStyleInspector.getInstance().listenForSelectionEvents(this)}if(GSUtil.getCaseInsensitiveProperty(this.options,"centerX")&&GSUtil.getCaseInsensitiveProperty(this.options,"centerY")&&GSUtil.getCaseInsensitiveProperty(this.options,"zoomLevel")!==undefined){this.centerAndZoom(new GSPoint(this.centerX,this.centerY),GSUtil.getCaseInsensitiveProperty(this.options,"zoomLevel"))}}GSUtil.include(GSMap,new GSEventBroadcasterMixin(),new GSSelectionMixin());GSMap.SUPPRESS_MESSAGING=1;GSMap.COPYRIGHT_CONTROL="copyright";GSMap.MAP_TYPE_CONTROL="map-type";GSMap.ZOOM_CONTROL="zoom";GSMap.COMPACT_ZOOM_CONTROL="compact-zoom";GSMap.MAP_CONTROL="map";GSMap.SNAPBACK_CONTROL="snapback";GSMap.SCALEBAR_CONTROL="scalebar";GSMap.MOBILE_ZOOM_CONTROL="mobile-zoom";GSMap.prototype.getContainer=function(){return this.container};GSMap.prototype.initBaseLayers=function(){var a=new GSTileLayer(GSTileLayer.STREET_MAP,4,16,this.options.baseLayerOptions||{});this.addLayer(a);var b=new GSTileLayer(GSTileLayer.TERRAIN_MAP,4,10,{pathTemplate:"/nz/v"+_globals.tileSetVersion+"/relief/{mpx}/{x}/{x}_{y}.png"});this.addLayer(b);this.setBaseLayer(a.name,false)};GSMap.prototype.setBaseLayer=function(d,j){if(j===undefined){j=true}var b=false;for(var h=0,c=this.layers.length;h<c;h++){var g=this.layers[h];if(g.name==d){this.baseLayer=g;this.baseLayer.visible=true;this.baseLayer.container.style.display="";if(j){var f=this.getZoomLevel();if(f<this.baseLayer.minZoom||f>this.baseLayer.maxZoom){this.zoom(this.getZoomLevel())}else{this.baseLayer.tileUpdateRequired(false,true)}}var a=this.getControl(GSMap.ZOOM_CONTROL);if(a){a.refresh()}b=true}else{if(g.isBaseLayer()){g.setVisible(false)}}}if(b){this.broadcastMessage("mapBaseLayerChanged",this,this.baseLayer)}else{throw new Error("Could not set tile layer ["+d+"]. No such tile layer registered with this map")}};GSMap.prototype.getBaseLayer=function(){return this.baseLayer};GSMap.prototype.initDOM=function(){if(GSUtil.getComputedStyle(this.container,"position")!="absolute"){this.container.style.position="relative"}this.container.style.overflow="hidden";if(!this.resizeable){this.container.style.width=this.pxWidth+"px";this.container.style.height=this.pxHeight+"px"}else{this.sizeToContainerDimensions()}if(!_browser.isMobileWebkit){if(this.dragToPan&&!this.customCursor){new Image().src=_globals.resourceURL+"cursor-grab.cur";new Image().src=_globals.resourceURL+"cursor-grabbing.cur"}this.setCursor()}this.createOverlayContainers()};GSMap.prototype.initControls=function(){if(this.useScalebar){this.addControl(GSMap.SCALEBAR_CONTROL)}var a=GSUtil.getCaseInsensitiveProperty(this.options,"mapControls");if(a&&a!="none"){this.addControl(a)}if(this.useCopyright){this.addControl(GSMap.COPYRIGHT_CONTROL)}};GSMap.prototype.setCursor=function(){if(this.customCursor){this.container.style.cursor=this.customCursor}else{if(this.dragToPan&&!_browser.isWebkit&&!_browser.isIE9x){var a=this.panning?"url("+_globals.resourceURL+"cursor-grabbing.cur),-moz-grabbing":"url("+_globals.resourceURL+"cursor-grab.cur),-moz-grab";this.container.style.cursor=a}else{this.container.style.cursor="default"}}};GSMap.prototype.addLogo=function(){var a=GSUtil.createElement("img",{src:_globals.resourceURL+"smartfindLogo.png",styles:{width:"120px",height:"19px",position:"absolute",bottom:"7px",right:"7px",cursor:"pointer",zIndex:40},"class":"GSLogo noprint",title:"GeoSmart Web Site",events:{contextmenu:GSUtil.cancelEvent},parent:this.container});if(!_browser.isMobileWebkit){GSEventManager.addEventListener(a,"click",function(b){GSUtil.cancelEvent(b);window.open("http://www.geosmart.co.nz","geosmart")})}};GSMap.prototype.setMapOptions=function(a){for(var b in a){switch(b){case"centerOnDblClick":this.centerOnDblClick=a[b];break;case"dragToPan":this.dragToPan=a[b];break;case"useMouseWheelZooming":this.useMouseWheelZooming=a[b];if(this.useMouseWheelZooming&&!_browser.isMobileWebkit){this.enableMouseWheelZooming()}else{this.disableMouseWheelZooming()}break;case"mouseWheelModifierKey":this.mouseWheelModifierKey=a[b];break;case"useInfoWindow":this.useInfoWindow=a[b];break;case"useScalebar":this.useScalebar=a[b];if(this.useScalebar){this.addControl(GSMap.SCALEBAR_CONTROL)}else{this.removeControl(GSMap.SCALEBAR_CONTROL)}break;case"resizeable":this.resizeable=a[b];if(this.resizeable){this.enableResizing()}else{this.disableResizing()}break;default:throw new Error('Property "'+b+'" not supported by GSMap')}}};GSMap.prototype.allowMouseWheelEvents=function(){this.blockMouseWheelEvents=false};GSMap.prototype.enableMouseWheelZooming=function(){var a=function(f,d){this.zoomCoord=this.getMouseCoordinate(d);var c=this.getZoomLevel();var b=f<0?c-1:c+1;if(this.animatedZooming){this.handleMouseWheelAnimatedZoom(b,f)}else{this.zoom(b)}};this.eventListeners.mousewheel_zooming=GSMouseWheel.bind(this.container,this,a,this.mouseWheelModifierKey)};GSMap.prototype.handleMouseWheelAnimatedZoom=function(b,c,a){if(this.blockMouseWheelEvents){return}this.blockMouseWheelEvents=true;setTimeout(GSUtil.bind(this.allowMouseWheelEvents,this),300);this.animatedZoom(b)};GSMap.prototype.disableMouseWheelZooming=function(){GSEventManager.release(this.eventListeners.mousewheel_zooming)};GSMap.prototype.enableResizing=function(){if(_browser.isMobileWebkit){this.eventListeners.resize=GSEventManager.bind(window,"orientationchange",this,this.updateSize)}else{this.eventListeners.resize=GSEventManager.bind(window,"resize",this,this.updateSize);this.resizeable=true}};GSMap.prototype.disableResizing=function(){if(this.eventListeners.resize){GSEventManager.release(this.eventListeners.resize)}this.resizeable=false};GSMap.prototype.sizeToContainerDimensions=function(){this.pxWidth=this.container.offsetWidth;this.pxHeight=this.container.offsetHeight};GSMap.prototype.didSetContextMenu=function(a){a.addToMap(this)};GSMap.prototype.remove=function(){var b=0,a;for(a=this.layers.length;b<a;b++){this.layers[b].remove()}for(b=0,a=this.controls.length;b<a;b++){this.removeControl(this.controls[b])}if(this.infoWindow){this.infoWindow.remove()}while(this.container.hasChildNodes()){this.container.removeChild(this.container.firstChild)}if(!this.isChildMap){GSEventCache.flush()}};GSMap.prototype.resize=function(a,d,g,b){var f=new GSDimension(this.pxWidth,this.pxHeight);if(a){this.pxHeight-=a;this.maxY-=a*this.mpx}if(d){this.pxWidth+=d;this.maxX+=d*this.mpx}if(g){this.pxHeight+=g;this.minY-=g*this.mpx}if(b){this.pxWidth-=b;this.minX+=b*this.mpx}this.centerX=(this.minX+this.maxX)/2;this.centerY=(this.minY+this.maxY)/2;var c=function(){this.broadcastMessage("mapResized",this,f,new GSDimension(this.pxWidth,this.pxHeight))};this.update(c,false,true)};GSMap.prototype.updateSize=function(){var b=new GSDimension(this.pxWidth,this.pxHeight);this.sizeToContainerDimensions();this.recalculateMapExtents();var a=function(){this.broadcastMessage("mapResized",this,b,new GSDimension(this.pxWidth,this.pxHeight))};this.update(a,false)};GSMap.prototype.getMapCenter=function(){return new GSPoint(this.centerX,this.centerY)};GSMap.prototype.getZoomLevel=function(){return this.scaleIdx};GSMap.prototype.getSize=function(){return new GSDimension(this.pxWidth,this.pxHeight)};GSMap.prototype.setBounds=function(b,p){var q=(arguments.length==3)?arguments[2]:null;var g=this.mpx;var j=this.scaleIdx;var c=new GSBounds(this.minX,this.minY,this.maxX,this.maxY);var l=b.minX;var k=b.minY;var d=b.maxX;var a=b.maxY;var f=d-l;var s=a-k;var n=f/2;var m=s/2;this.centerX=l+n;this.centerY=k+m;this.mpx=q?q:Math.ceil(Math.max(f/this.pxWidth,s/this.pxHeight));this.mpx=this.fitToScaleRange(this.mpx);this.scaleIdx=this.scaleRange.indexOf(this.mpx);if(this.scaleIdx<this.getBaseLayer().minZoom){this.scaleIdx=this.getBaseLayer().minZoom}var r=(this.pxWidth*this.mpx);var h=(this.pxHeight*this.mpx);this.minX=this.centerX-(r/2);this.minY=this.centerY-(h/2);this.maxX=this.centerX+(r/2);this.maxY=this.centerY+(h/2);this.centerX=this.minX+((this.maxX-this.minX)/2);this.centerY=this.minY+((this.maxY-this.minY)/2);this.zoomCoord=null;var o=this.mpx;this.update(function(){if(this.scaleIdx!==j){this.broadcastMessage("mapZoomed",this,j,this.scaleIdx)}this.broadcastMessage("mapBoundsChanged",this,c,this.getBounds());if(p){p()}},false,true)};GSMap.prototype.createOverlayContainers=function(){this.imageMapContainer=GSUtil.createContainer(this.container,"GSMap-imageMapContainer",null,null,0,0,null,10);this.contentContainer=GSUtil.createContainer(this.container,"GSMap-contentContainer",null,null,0,0,null,10);this.zoomContainer=GSUtil.createContainer(this.contentContainer,"GSMap-zoomContainer",null,null,0,0,null,5);this.layerContainer=GSUtil.createContainer(this.contentContainer,"GSMap-layerContainer",null,null,0,0,null,10);this.handleContainer=GSUtil.createContainer(this.contentContainer,"GSMap-handleContainer",null,null,0,0,null,20)};GSMap.prototype.dragStart=function(b){if(this.panning||this.continuouslyPanning){return}if(this.dragToPan){b=b?b:window.event;var a=false;if(b.which){a=(b.which==3)}else{if(b.button){a=(b.button==2)}}if(!a){GSUtil.cancelEvent(b);this.onPanStarted();this.setCursor();this.dragCoordinates={startPixel:new GSPoint(b.clientX,b.clientY),lastPixel:new GSPoint(b.clientX,b.clientY),lastDelta:new GSPoint(0,0),startTilePixel:this.getBaseLayer().getContainerPosition(),startNzmg:new GSPoint(this.centerX,this.centerY)};this.eventListeners.drag_mousemove=GSEventManager.bind(document,"mousemove",this,this.dragMove);this.eventListeners.drag_mouseup=GSEventManager.bind(document,"mouseup",this,this.dragStop)}}};GSMap.prototype.touchStart=function(o){o.preventDefault();switch(o.touches.length){case 1:this.onPanStarted();var j=o.touches[0];this.dragCoordinates={startPixel:new GSPoint(j.pageX,j.pageY),lastPixel:new GSPoint(j.pageX,j.pageY),lastDelta:new GSPoint(0,0),startTilePixel:this.getBaseLayer().getContainerPosition(),startNzmg:new GSPoint(this.centerX,this.centerY)};break;case 2:this.onPanStopped();this.dragCoordinates=null;if(!this.pinchZoomInProgress&&!this.zooming){this.pinchZoomInProgress=true;this.updateZoomContainer();this.zoomContainer.style.display="block";var p=this.getVisibleLayers();for(var k=0,c=p.length;k<c;k++){p[k].container.style.display="none"}var m=o.touches[0];var b=o.touches[1];var h=this.translateToRealWorldCoordinate(GSUtil.getMousePixelCoordinate({pageX:Math.min(m.pageX,b.pageX),pageY:Math.max(m.pageY,b.pageY)}));var q=this.translateToRealWorldCoordinate(GSUtil.getMousePixelCoordinate({pageX:Math.max(m.pageX,b.pageX),pageY:Math.min(m.pageY,b.pageY)}));this.zoomCoords=new GSBounds(h.x,h.y,q.x,q.y);var g=GSUtil.getElementPosition(this.container);var f=Math.abs(m.pageX-b.pageX);var d=Math.abs(m.pageY-b.pageY);var n=Math.min(m.pageX,b.pageX)-g.x+(f/2)-parseInt(this.zoomContainer.style.left);var a=Math.min(m.pageY,b.pageY)-g.y+(d/2)-parseInt(this.zoomContainer.style.top);this.zoomContainer.style.webkitTransformOrigin=n+"px "+a+"px";this.zoomContainer.style.webkitTransform="scale(1, 1)";this.zoomCoord=this.translateToRealWorldCoordinate(new GSPoint(Math.min(m.pageX,b.pageX)-g.x+(f/2),Math.min(m.pageY,b.pageY)-g.y+(d/2)));this.zoomParameters={zoomDelta:Math.round(Math.sqrt(Math.pow(Math.abs(m.pageX-b.pageX),2)+Math.pow(Math.abs(m.pageY-b.pageY),2))),zoomScale:1};if(this.infoWindow&&this.infoWindow.isOpen&&!this.infoWindow.isHidden()){this.zoomParameters.restoreInfoWindow=true;this.infoWindow.hide()}}break}};GSMap.prototype.dragMove=function(d){d=d?d:window.event;GSUtil.cancelEvent(d);if(!this.dragCoordinates||!this.hasDragged(this.dragCoordinates.startPixel,new GSPoint(d.clientX,d.clientY))){return}this.wasDragged=true;var c=this.dragCoordinates;GSUtil.positionElement(this.contentContainer,(d.clientX-c.startPixel.x),(d.clientY-c.startPixel.y));var b=(d.clientX-c.startPixel.x)*this.mpx;var a=(d.clientY-c.startPixel.y)*this.mpx;c.lastDelta=new GSPoint(c.lastPixel.x-d.clientX,d.clientY-c.lastPixel.y);c.lastPixel=new GSPoint(d.clientX,d.clientY);this.centerAtCoordinate({x:c.startNzmg.x-(d.clientX-c.startPixel.x)*this.mpx,y:c.startNzmg.y+(d.clientY-c.startPixel.y)*this.mpx},null,GSMap.SUPPRESS_MESSAGING,true)};GSMap.prototype.touchMove=function(h){h.preventDefault();switch(h.touches.length){case 1:if(this.panning){var k=this.dragCoordinates;this.wasDragged=true;this.touchMoved=true;var d=h.touches[0];GSUtil.positionElement(this.contentContainer,(d.pageX-k.startPixel.x),(d.pageY-k.startPixel.y));var c=(d.pageX-k.startPixel.x)*this.mpx;var b=(d.pageY-k.startPixel.y)*this.mpx;k.lastDelta=new GSPoint(k.lastPixel.x-d.pageX,d.pageY-k.lastPixel.y);k.lastPixel=new GSPoint(d.pageX,d.pageY)}break;case 2:if(this.pinchZoomInProgress&!this.panning){var f=h.touches[0];var a=h.touches[1];var c=Math.abs(f.pageX-a.pageX);var b=Math.abs(f.pageY-a.pageY);var j=Math.round(Math.sqrt(Math.pow(c,2)+Math.pow(b,2)));var g=j/this.zoomParameters.zoomDelta;g=Math.round(g*100)/100;this.zoomContainer.style.webkitTransform="scale("+g+", "+g+")";this.zoomParameters.zoomScale=g}break}};GSMap.prototype.dragStop=function(f){f=f?f:window.event;GSUtil.cancelEvent(f);GSEventManager.release(this.eventListeners.drag_mousemove);GSEventManager.release(this.eventListeners.drag_mouseup);if(this.dragCoordinates&&this.hasDragged(this.dragCoordinates.startPixel,{x:f.clientX,y:f.clientY})){var c=this.dragCoordinates;var b=(f.clientX-c.startPixel.x)*this.mpx;var a=(f.clientY-c.startPixel.y)*this.mpx;if(b!==0||a!==0){var d=GSUtil.bind(function(){GSUtil.positionElement(this.contentContainer,0,0)},this);this.centerAtCoordinate({x:c.startNzmg.x-(f.clientX-c.startPixel.x)*this.mpx,y:c.startNzmg.y+(f.clientY-c.startPixel.y)*this.mpx},d)}}this.onPanStopped();this.setCursor()};GSMap.prototype.touchStop=function(j){if(this.panning&&!this.pinchZoomInProgress){if(this.touchMoved){this.touchMoved=false;var l=GSUtil.bind(function(){GSUtil.positionElement(this.contentContainer,0,0)},this);var m=this.dragCoordinates;if(m){var c=j.changedTouches[0];this.centerAtCoordinate({x:m.startNzmg.x-(c.pageX-m.startPixel.x)*this.mpx,y:m.startNzmg.y+(c.pageY-m.startPixel.y)*this.mpx},l)}}this.onPanStopped()}if(this.pinchZoomInProgress&!this.panning){var d=this.mpx/this.zoomParameters.zoomScale;var g=Math.pow(2,Math.round(Math.log(d)/Math.LN2));if(g==this.mpx){g=(this.zoomParameters.zoomScale>1)?g/2:g*2}var h=this.scaleRange.indexOf(g);var a=this.scaleRange[this.getBaseLayer().maxZoom];var b=this.scaleRange[this.getBaseLayer().minZoom];if(g>b){h=this.getBaseLayer().minZoom}if(g<a){h=this.getBaseLayer().maxZoom}var f=this.mpx/this.scaleRange[h];this.zoomContainer.style.webkitTransform="scale("+f+", "+f+")";var k=GSUtil.bind(function(){var q=this.getVisibleLayers();var p=null;for(var o=0,n=q.length;o<n;o++){q[o].container.style.display="block"}if(this.zoomParameters.restoreInfoWindow){this.infoWindow.show()}this.zoomParameters=null;this.pinchZoomInProgress=false},this);if(h!=this.getZoomLevel()){this.zoom(h,k)}else{this.update(k,false,true)}}};GSMap.prototype.click=function(b){if(!this.wasDragged){this.closeInfoWindow()}else{this.wasDragged=false}b=b?b:window.event;if(_browser.isMobileWebkit){var d=b.changedTouches[0];var a=new GSPoint(d.pageX,d.pageY);var c=this.getMouseCoordinate(d);if(this.lastClick){if(!this.hasDragged(this.lastClick,a,50)){this.zoomCoord=c;this.animatedZoom(this.getZoomLevel()+1);this.broadcastMessage("mapDblClicked",this,a,b);return}}this.broadcastMessage("mapClicked",this,c,b);this.lastClick=a;setTimeout(GSUtil.bind(function(){this.lastClick=null},this),200)}else{this.broadcastMessage("mapClicked",this,this.getMouseCoordinate(b),b);this.clearSelection()}};GSMap.prototype.dblclick=function(a){GSUtil.eventStopPropagation(a);var b=this.getMouseCoordinate(a);if(this.centerOnDblClick){this.panTo(b)}this.broadcastMessage("mapDblClicked",this,b,a)};GSMap.prototype.addEventListeners=function(){if(_browser.isMobileWebkit){this.eventListeners.touchstart=GSEventManager.bind(this.container,"touchstart",this,this.touchStart);this.eventListeners.touchmove=GSEventManager.bind(this.container,"touchmove",this,this.touchMove);this.eventListeners.touchend=GSEventManager.addEventListener(document,"touchend",this.touchStop,this);this.eventListeners.click=GSEventManager.addEventListener(this.container,"touchend",this.click,this)}else{this.eventListeners.mousedown=GSEventManager.addEventListener(this.container,"mousedown",this.dragStart,this);this.eventListeners.click=GSEventManager.addEventListener(this.container,"click",this.click,this);this.eventListeners.dblclick=GSEventManager.addEventListener(this.container,"dblclick",this.dblclick,this);this.eventListeners.contextmenu=GSEventManager.addEventListener(this.container,"contextmenu",GSUtil.cancelEvent)}if(this.resizeable){this.enableResizing()}};GSMap.prototype.getMouseCoordinate=function(a){return this.translateToRealWorldCoordinate(GSUtil.getMousePixelCoordinate(a,this.container))};GSMap.prototype.hasDragged=function(d,c,b){if(!d||!c){return false}b=b||2;var a=(Math.abs(d.x-c.x)>b)||(Math.abs(d.y-c.y)>b);return a};GSMap.prototype.zoom=function(h,c){var f=((arguments.length==3)?arguments[2]:false);var a=this.scaleIdx;var b=parseInt(h,10);var g=this.getBaseLayer();if(b<g.minZoom){b=g.minZoom}if(b>g.maxZoom){b=g.maxZoom}if(a==b){return}this.mpx=this.scaleRange[b];this.scaleIdx=b;var d=this.getBounds();this.recalculateMapExtents(true);this.update(function(){if(!f){this.broadcastMessage("mapBoundsChanged",this,d,this.getBounds());this.broadcastMessage("mapZoomed",this,a,this.scaleIdx)}if(c){c()}},false,true)};GSMap.prototype.animatedZoom=function(p,s){if(this.pinchZoomInProgress){return}if(p==this.getZoomLevel()){return}if(!this.animatedZooming){return this.zoom(p,s)}var b=p<this.getZoomLevel();if(this.zooming){if(b!=this.animatedZoomDirection){this.animatedZoomQueue=0}else{if(!this.animatedZoomQueue){this.animatedZoomQueue=1}else{this.animatedZoomQueue++}}return}this.animatedZoomDirection=b;this.zoomCoord=this.zoomCoord||this.getMapCenter();var n=this.scaleIdx;var o=parseInt(p,10);var g=this.getBaseLayer();if(o<g.minZoom){o=g.minZoom}if(o>g.maxZoom){o=g.maxZoom}if(n==o){return}if(Math.abs(o-n)!==1){return this.zoom(p,s)}var x=o>n;this.zooming=true;var q=20;var a=350;var t=this.updateZoomContainer();var j=x?2:0.5;var w=this.pxWidth*j;var d=this.pxHeight*j;var y=(((this.zoomCoord.x-this.minX)/this.mpx)-(this.pxWidth/2));var v=(((this.zoomCoord.y-this.minY)/this.mpx)-(this.pxHeight/2));var c=-((w-this.pxWidth)/2)+t.x*j;c=x?c-y:c+y/2;var k=-((d-this.pxHeight)/2)+t.y*j;k=x?k+v:k-v/2;this.zoomParameters={left:t.x,top:t.y,duration:a,widthOrigin:this.pxWidth,widthCurrent:this.pxWidth,widthDelta:w-this.pxWidth,leftOrigin:t.x,leftCurrent:t.x,leftDelta:c-t.x,heightOrigin:this.pxHeight,heightCurrent:this.pxHeight,heightDelta:d-this.pxHeight,topOrigin:t.y,topCurrent:t.y,topDelta:k-t.y,targetZoomLevel:p,onZoom:s,oldBounds:this.getBounds(),oldScaleIdx:this.scaleIdx};var f=this.getLayers();var r=f.length;for(i=0;i<r;i++){f[i].container.style.visibility="hidden"}this.handleContainer.style.display="none";if(this.infoWindow&&this.infoWindow.isOpen&&!this.infoWindow.isHidden()){this.zoomParameters.restoreInfoWindow=true;this.infoWindow.hide()}this.zoom(this.zoomParameters.targetZoomLevel,null,true);this.zoomContainer.style.display="block";if(_browser.isCssTransformCapable()){var m=this.translateToMapCoordinate(this.zoomCoord);var u=m.x-t.x;var h=m.y-t.y;this.zoomContainer.style.webkitTransformOrigin=u+"px "+h+"px";this.zoomContainer.style.webkitTransform="";if(x){this.zoomContainer.className="GSMap-zoom-in"}else{this.zoomContainer.className="GSMap-zoom-out"}setTimeout(GSUtil.bind(this.zoomAnimationComplete,this),400)}else{this.zoomParameters.startTime=new Date();this.zoomParameters.intervalHandle=setInterval(GSUtil.bind(this.zoomAnimationFrame,this),q)}};GSMap.prototype.snapToTileGrid=function(){var b=new GSBounds();var c=this.getBaseLayer().getTileSize()*this.mpx;var a=c;b.minX=Math.floor(this.minX/c)*c;b.maxX=Math.floor(this.maxX/c)*c;b.minY=Math.ceil(this.minY/a)*a;b.maxY=Math.ceil(this.maxY/a)*a;return b};GSMap.prototype.updateZoomContainer=function(){var f=this.snapToTileGrid();var g=Math.floor(f.minX/this.mpx);var l=Math.floor(f.maxY/this.mpx);var d=Math.floor((f.minX-this.minX)/this.mpx);var j=Math.floor((this.maxY-f.maxY)/this.mpx);GSUtil.setStyles(this.zoomContainer,{left:d+"px",top:j+"px",width:this.pxWidth+"px",height:this.pxHeight+"px"});this.zoomContainer.innerHTML="";var k=this.getBaseLayer();var h=k.container;while(h.childNodes.length){var a=h.childNodes[0];if(a.nodeName.toLowerCase()=="img"){this.zoomContainer.appendChild(h.removeChild(a));var c=parseFloat(a.style.left)-(g-k.tilesOriginMpx.x);var b=parseFloat(a.style.top)-(k.tilesOriginMpx.y-l);GSUtil.setStyles(a,{left:(c*100/this.pxWidth)+"%",top:(b*100/this.pxHeight)+"%",width:(k.getTileSize()+1)*100/this.pxWidth+"%",height:(k.getTileSize()+1)*100/this.pxHeight+"%"})}}return new GSPoint(d,j)};GSMap.prototype.zoomAnimationFrame=function(){var a=Math.min(1,(new Date()-this.zoomParameters.startTime)/this.zoomParameters.duration);this.zoomParameters.widthCurrent=this.zoomParameters.widthOrigin+(a*this.zoomParameters.widthDelta);this.zoomParameters.heightCurrent=this.zoomParameters.heightOrigin+(a*this.zoomParameters.heightDelta);this.zoomParameters.leftCurrent=this.zoomParameters.leftOrigin+(a*this.zoomParameters.leftDelta);this.zoomParameters.topCurrent=this.zoomParameters.topOrigin+(a*this.zoomParameters.topDelta);GSUtil.setStyles(this.zoomContainer,{width:this.zoomParameters.widthCurrent+"px",height:this.zoomParameters.heightCurrent+"px",left:this.zoomParameters.leftCurrent+"px",top:this.zoomParameters.topCurrent+"px"});if(a==1){this.zoomAnimationComplete()}};GSMap.prototype.zoomAnimationComplete=function(){if(!this.zoomParameters){return}if(this.zoomParameters.intervalHandle){clearInterval(this.zoomParameters.intervalHandle)}this.zoomContainer.className=this.zoomContainer.className+"-complete";var d=this.getLayers();var a=d.length;for(i=0;i<a;i++){d[i].container.style.visibility="inherit"}this.handleContainer.style.display="block";if(this.zoomParameters.restoreInfoWindow){this.infoWindow.show()}this.zooming=false;if(this.animatedZoomQueue){this.animatedZoomQueue--;var c=this.getZoomLevel();var b=this.animatedZoomDirection?c-1:c+1;this.animatedZoom(b,this.zoomParameters.onZoom)}else{this.zoomCoord=null;this.broadcastMessage("mapBoundsChanged",this,this.zoomParameters.oldBounds,this.getBounds());this.broadcastMessage("mapZoomed",this,this.zoomParameters.oldScaleIdx,this.scaleIdx);if(this.zoomParameters.onZoom){this.zoomParameters.onZoom()}this.zoomParameters=null}};GSMap.prototype.getVisibleLayers=function(){var d=[];var c=this.getLayers();var b=null;for(var a=0;b=c[a];a++){if(b.isVisible()){d.push(b)}}return d};GSMap.prototype.onPanStarted=function(){this.panning=true;this.zoomContainer.style.display="none";this.broadcastMessage("mapPanStarted",this)};GSMap.prototype.onPanStopped=function(){this.panning=false;this.broadcastMessage("mapPanStopped",this)};GSMap.prototype.panTo=function(l,h,n){if(this.panning){return}var f={framerate:16,duration:800};GSUtil.merge(n,f);var a=this.getBounds();if(!a.contains(l)){return this.centerAtCoordinate(l,h)}this.onPanStarted();var b=this.getBaseLayer();var g=this.getMapCenter();var k=this.translateToMapCoordinate(new GSPoint(this.centerX,this.centerY));var j=this.translateToMapCoordinate(l);var m=GSUtil.bind(this.onPanFrame,this,k,j);var c=GSUtil.bind(this.onPanComplete,this,h);var d=new GSAnimator(k,j,f.framerate,f.duration,m,null,c);d.animate()};GSMap.prototype.onPanFrame=function(d,c,b,a){a.x=Math.floor(a.x);a.y=Math.floor(a.y);GSUtil.positionElement(this.contentContainer,(d.x-a.x),(d.y-a.y))};GSMap.prototype.onPanComplete=function(a,b){var c=function(){GSUtil.positionElement(this.contentContainer,0,0);this.onPanStopped();if(a){a()}};this.centerAtCoordinate(this.translateToRealWorldCoordinate(b.to),GSUtil.bind(c,this),null,false,true)};GSMap.prototype.featureDrag=function(a){this.panPointIntoView(a.coordinate)};GSMap.prototype.handleDrag=function(a){this.panPointIntoView(a.point,a.mapPanBuffer)};GSMap.prototype.panPointIntoView=function(g,a){var j=this.getBounds();var h=this.getMapCenter();var d=a||50;var c=d*this.mpx;var b=new GSBounds(j.minX+c,j.minY+c,j.maxX-c,j.maxY-c);if(!b.contains(g)){var f=10*this.mpx;var k=new GSPoint((h.x-g.x)/(h.x-j.maxX)*f,(h.y-g.y)/(h.y-j.maxY)*f);this.startContinuousPan(k)}else{this.stopContinuousPan()}};GSMap.prototype.featureDragEnd=function(){this.stopContinuousPan()};GSMap.prototype.handleDragEnd=function(){this.stopContinuousPan()};GSMap.prototype.startContinuousPan=function(a){if(this.continuouslyPanning){return}this.continuouslyPanning=true;if(!this.dragCoordinates){this.dragCoordinates={}}this.dragCoordinates.initialMapCenter=this.getMapCenter();this.dragCoordinates.lastDelta=a;this.continuousPanInterval=setInterval(GSUtil.bind(this.animateContinuousPan,this),50)};GSMap.prototype.animateContinuousPan=function(){if(this.continuouslyPanning&&this.dragCoordinates){var b=this.dragCoordinates;var c=this.getMapCenter();var a=new GSPoint(c.x+b.lastDelta.x,c.y+b.lastDelta.y);this.centerAtCoordinate(a,null,GSMap.SUPPRESS_MESSAGING,true);GSUtil.positionElement(this.contentContainer,(b.initialMapCenter.x-a.x)/this.mpx,(a.y-b.initialMapCenter.y)/this.mpx)}};GSMap.prototype.stopContinuousPan=function(){if(this.continuouslyPanning){if(this.continuousPanInterval){clearInterval(this.continuousPanInterval)}var a=this.dragCoordinates;var c=this.getMapCenter();this.dragCoordinates=undefined;this.continuousPanTimeout=undefined;var b=function(){GSUtil.positionElement(this.contentContainer,0,0)};this.centerAtCoordinate(c,GSUtil.bind(b,this));this.continuouslyPanning=false}};GSMap.prototype.centerAtCoordinate=function(h,a){var g,d,b;switch(arguments.length){case 5:b=arguments[4];case 4:d=arguments[3];case 3:g=arguments[2]}var c=new GSBounds(this.minX,this.minY,this.maxX,this.maxY);this.centerX=h.x;this.centerY=h.y;this.zoomCoord=null;this.recalculateMapExtents();var f=new GSBounds(this.minX,this.minY,this.maxX,this.maxY);this.update(function(){if(!g){this.broadcastMessage("mapBoundsChanged",this,c,f)}if(a){a()}},d,b)};GSMap.prototype.centerAndZoom=function(j,h,b){var a=this.scaleIdx;this.centerX=j.x;this.centerY=j.y;if(h!==undefined){var c=parseInt(h,10);var g=this.getBaseLayer();if(c<g.minZoom){c=g.minZoom}if(c>g.maxZoom){c=g.maxZoom}this.mpx=this.scaleRange[c];this.scaleIdx=c}var d=new GSBounds(this.minX,this.minY,this.maxX,this.maxY);this.zoomCoord=null;this.recalculateMapExtents();var f=new GSBounds(this.minX,this.minY,this.maxX,this.maxY);this.update(function(){this.broadcastMessage("mapBoundsChanged",this,d,f);this.broadcastMessage("mapZoomed",this,a,this.scaleIdx);if(b){b()}},false,true)};GSMap.prototype.centerOnNewZealand=function(c){var b=this.scaleIdx;this.centerX=_globals.nzCenterX;this.centerY=_globals.nzCenterY;var h=false;var j=this.getBaseLayer();for(var d=j.maxZoom,a=j.minZoom;d>=a;d--){if(_globals.nzCenterY+((this.scaleRange[d]*this.pxHeight)/2)>_globals.nzTopY){this.mpx=this.scaleRange[d];this.scaleIdx=d;h=true;break}}if(!h){this.scaleIdx=j.minZoom;this.mpx=this.scaleRange[this.scaleIdx]}var f=new GSBounds(this.minX,this.minY,this.maxX,this.maxY);this.zoomCoord=null;this.recalculateMapExtents();var g=new GSBounds(this.minX,this.minY,this.maxX,this.maxY);this.update(function(){this.broadcastMessage("mapBoundsChanged",this,f,g);if(this.oldScaleIdx!==this.scaleIdx){this.broadcastMessage("mapZoomed",this,b,this.scaleIdx)}if(c){c()}},false,true)};GSMap.prototype.fitToScaleRange=function(f){var d=this.getBaseLayer();var g=this.scaleRange[d.minZoom];for(var b=d.maxZoom,a=d.minZoom;b>=a;b--){var c=this.scaleRange[b];if(c==f){return f}else{if(c>f){g=c;break}}}return g};GSMap.prototype.addControl=function(f,a){var d=null;var c=false;if(GSControl.prototype.isPrototypeOf){c=GSControl.prototype.isPrototypeOf(f)}else{if(f.__proto__){c=(typeof f).toLowerCase()=="object"}}if(c){d=f}else{d=this.instantiateControl(f)}if(d!=null){this.controls.push(d);d.setMap(this);var b=d.render(this);this.container.appendChild(b);d.setElement(b);if(!d.parentPositioned){d.setPosition(a?GSUtil.merge(a,d.getDefaultPosition()):d.getDefaultPosition())}}};GSMap.prototype.removeControl=function(f){var c="";var b=false;if(GSControl.prototype.isPrototypeOf){b=GSControl.prototype.isPrototypeOf(f)}else{if(f.__proto__){b=(typeof f).toLowerCase()=="object"}}if(b){c=f.name}else{c=f}for(var d=0,a=this.controls.length;d<a;d++){if(this.controls[d].name==c){this.controls[d].remove(this);this.controls.splice(d,1);return true}}return false};GSMap.prototype.getControl=function(b){for(var c=0,a=this.controls.length;c<a;c++){if(this.controls[c].name==b){return this.controls[c]}}return null};GSMap.prototype.hideControls=function(){for(var b=0,a=this.controls.length;b<a;b++){this.controls[b].hide()}};GSMap.prototype.showControls=function(){for(var b=0,a=this.controls.length;b<a;b++){this.controls[b].show()}};GSMap.prototype.instantiateControl=function(a){var b;switch(a){case GSMap.MAP_TYPE_CONTROL:b=new GSMapTypeControl();break;case GSMap.ZOOM_CONTROL:b=new GSZoomControl();break;case GSMap.COMPACT_ZOOM_CONTROL:b=new GSCompactZoomControl();break;case GSMap.MAP_CONTROL:b=new GSMapControl();break;case GSMap.SNAPBACK_CONTROL:if(!window.GSSnapbackControl){throw new Error("Snapback control is no longer included as part of the core Maps API. To use this                             control load the 'additional-controls' module.")}b=new GSSnapbackControl();break;case GSMap.SCALEBAR_CONTROL:b=new GSScalebarControl();break;case GSMap.COPYRIGHT_CONTROL:b=new GSCopyright();break;case GSMap.MOBILE_ZOOM_CONTROL:b=new GSMobileZoomControl();break;default:throw new Error("Tried to instantiate unknown map control")}return b};GSMap.prototype.centerOnLayer=function(f,c){var b=(f instanceof GSAbstractLayer)?f.name:f;var f=this.getLayer(b);if(f==undefined){throw new Error("Layer ["+b+"] does not exist, map will not be re-centered")}var h=f.getBounds();var g=h.maxX-h.minX;var a=h.maxY-h.minY;var d=g*0.05;var j=a*0.05;h.minX-=d;h.maxX+=d;h.minY-=j;h.maxY+=j;this.setBounds(h,c)};GSMap.prototype.createLayer=function(b,a){a=a?a:{};var c=new GSLayer(b,a);this.addLayer(c);return c};GSMap.prototype.addLayer=function(a){if(this.getLayer(a.name)){this.removeLayer(a.name)}a.addToMap(this);this.layers.push(a);return a};GSMap.prototype.removeLayer=function(b){if(b=="__base__"){return}for(var d=0,a=this.layers.length;d<a;d++){var c=this.layers[d];if(c.name==b){c.remove();this.layers.splice(d,1);return true}}return false};GSMap.prototype.clearLayers=function(){for(var b=0,a=this.layers.length;b<a;b++){this.layers[b].clear()}};GSMap.prototype.getLayers=function(){return this.layers};GSMap.prototype.getLayer=function(b){for(var d=0,a=this.layers.length;d<a;d++){var c=this.layers[d];if(c.name==b){return c}}return null};GSMap.prototype.addFeature=function(b){var a=this.getLayer("__base__");a.addFeature(b)};GSMap.prototype.removeFeature=function(c,b){b=b!==undefined?b:true;var a=this.getLayer("__base__");a.removeFeature(c,b)};GSMap.prototype.recalculateMapExtents=function(b){if(b&&this.zoomCoord){this.recalculateMapExtentsForCoordinate(this.zoomCoord,a,c)}else{var a=this.pxWidth*this.mpx;var c=this.pxHeight*this.mpx;this.minX=this.centerX-(a/2);this.minY=this.centerY-(c/2);this.maxX=this.centerX+(a/2);this.maxY=this.centerY+(c/2)}};GSMap.prototype.recalculateMapExtentsForCoordinate=function(k){var g=this.pxWidth*this.mpx;var a=this.pxHeight*this.mpx;var c=k.x-this.minX;var b=k.y-this.minY;var d=this.maxX-this.minX;var h=this.maxY-this.minY;var f=c/d;var j=b/h;this.minX=k.x-(f*g);this.maxX=k.x+((1-f)*g);this.minY=k.y-(j*a);this.maxY=k.y+((1-j)*a);this.centerX=this.minX+(g/2);this.centerY=this.minY+(a/2)};GSMap.prototype.translateToMapCoordinate=function(f){var b=f.x;var d=f.y;var c=(b-this.minX);var a=(this.maxY-d);return new GSPoint((c/this.mpx),(a/this.mpx))};GSMap.prototype.translateToRealWorldCoordinate=function(g,c){if(!c){c=new GSBounds(this.minX,this.minY,this.maxX,this.maxY)}var b=this.pxWidth*this.mpx;var d=this.pxHeight*this.mpx;var a=c.minX+(b*(g.x/this.pxWidth));var f=c.maxY-(d*(g.y/this.pxHeight));return new GSPoint(Math.round(a),Math.round(f))};GSMap.prototype.contains=function(a){return(a.x>this.minX&&a.x<this.maxX&&a.y>this.minY&&a.y<this.maxY)};GSMap.prototype.getBounds=function(){return new GSBounds(this.minX,this.minY,this.maxX,this.maxY)};GSMap.prototype.featureClicked=function(a,b){if(a.isSelectable()){if(b.shiftKey){if(this.isSelected(a)){this.removeFromSelection(a)}else{this.addToSelection(a)}}else{this.setSelection([a])}}};GSMap.prototype.featureRemoved=function(a){if(this.isSelected(a)){this.removeFromSelection(a)}};GSMap.prototype.update=function(a,c,b){this.broadcastMessage("tileUpdateRequired",c,b);if(this.dragCoordinates){this.dragCoordinatesLastLastDelta=this.dragCoordinates.lastDelta}if(!this.isReady){this.isReady=true;this.broadcastMessage("mapReady",this)}if(a){a.call(this)}};GSMap.prototype.openMapBlowup=function(j,c){c=c?c:{};if(c.offset==undefined){c.offset=new GSPoint(0,0)}if(c.zoomLevel==undefined){c.zoomLevel=Math.min(15,this.getBaseLayer().maxZoom)}if(c.size==undefined){c.size=new GSDimension(180,180)}var a=GSUtil.getComputedStyle(this.container,"background-color");if(!a){a="#c5c5c5"}var f=GSUtil.createElement("div",{styles:{backgroundColor:a,border:"1px solid #a0a0a4"}});var b={width:c.size.width+15,height:c.size.height,isChildMap:true,resizeable:false,useScalebar:false,centerOnDblClick:true,dragToPan:true,useInfoWindow:false,useMouseWheelZooming:false,useCopyright:false};var h=new GSMap(f,b);h.addControl(GSMap.COMPACT_ZOOM_CONTROL);h.addControl(GSMap.SNAPBACK_CONTROL);var d=GSUtil.bind(h.onMapBlowupOpen,h,j,c);var g=GSUtil.bind(h.onMapBlowupClose,h,c);this.infoWindow.open(j,f,{offset:c.offset,onopen:d,onclose:function(){if(c.onclose){c.onclose(h)}h.remove()}})};GSMap.prototype.onMapBlowupOpen=function(c,a){var b=this;this.centerAndZoom(c,a.zoomLevel,function(){b.markForSnapback();if(a.onopen){a.onopen(b)}})};GSMap.prototype.onMapBlowupClose=function(a){if(a.onclose){a.onclose(this)}this.remove()};GSMap.prototype.openInfoWindow=function(c,b,a){this.infoWindow.open(c,b,a)};GSMap.prototype.closeInfoWindow=function(){this.infoWindow.close()};GSMap.prototype.getInfoWindow=function(){if(this.infoWindow){return this.infoWindow}else{return undefined}};GSMap.prototype.addSnappable=function(a){this.snappables.push(a)};GSMap.prototype.getSnappables=function(){return this.snappables};GSMap.prototype.removeSnappable=function(c){for(var a=this.snappables.length,b=null;b=this.snappables[a];a--){if(b===c){this.snappables.splice(a,1);return true}}return false};GSMap.prototype.markForSnapback=function(a){this.snapbackState={coordinate:this.getMapCenter(),zoomLevel:this.getZoomLevel()};if(a){if(GSCookie.accept()){GSCookie.set("gssnapback",GSUtil.serialize(this.snapbackState),90)}else{throw new Error("Cookies must be enabled to persist map snapback state")}}};GSMap.prototype.snapback=function(){if(!this.snapbackState){var val=GSCookie.get("gssnapback");if(val){this.snapbackState=eval("("+val+")")}}if(this.snapbackState){try{this.centerAndZoom(this.snapbackState.coordinate,this.snapbackState.zoomLevel);return true}catch(e){return false}}return false};GSMap.prototype.toJson=function(){var a={map:{type:"GSMap",mpx:this.mpx,width:this.pxWidth,height:this.pxHeight,useScalebar:this.useScalebar,baseResourceUrl:GSUtil.getDirName(location.href),boundingBox:this.getBounds()},layers:this.layers};return GSUtil.objToJson(a)};GSMap.prototype.print=function(printServiceUrl,options){if(!options){options={}}var obj={map:{type:"GSMap",scale:options.scale!==undefined?options.scale:true,mpx:options.mpx!==undefined?options.mpx:this.mpx,width:options.width?options.width:this.pxWidth,height:options.height?options.height:this.pxHeight,useScalebar:options.useScalebar!==undefined?options.useScalebar:this.useScalebar,useLogo:options.useLogo!==undefined?options.useLogo:this.useLogo,baseResourceUrl:GSUtil.getDirName(location.href),boundingBox:options.boundingBox!==undefined?options.boundingBox:this.getBounds()},layers:this.getVisibleLayers()};var data=GSUtil.objToJson(obj);var req=new XMLHttpRequest();req.onreadystatechange=function(){if(req.readyState==4){if(req.status>=200&&req.status<300){if(options.onSuccess){options.onSuccess(eval("("+req.responseText+")"))}}else{if(options.onFailure){options.onFailure(eval("("+req.responseText+")"))}}}};var imageFormat=options.imageFormat!==undefined?options.imageFormat:"image/jpeg";if(options.method&&options.method.toLowerCase()=="get"){printServiceUrl+="?d="+encodeURIComponent(data);req.open("get",printServiceUrl,true);req.setRequestHeader("Accept",imageFormat);req.send(null)}else{req.open("post",printServiceUrl,true);req.setRequestHeader("Content-Type","application/json");req.setRequestHeader("Accept",imageFormat);req.send(data)}};if(!window.XMLHttpRequest&&window.ActiveXObject){window.XMLHttpRequest=function(){try{req=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{req=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){throw"Could not instantiate XMLHttpRequest object: "+a}}return req}}if(_browser.isCssTransformCapable()){document.write('<style type="text/css" media="screen">@-webkit-keyframes GSMap-zoom-in-animation {from {-webkit-transform: scale(1);}to {-webkit-transform: scale(2);}}@-webkit-keyframes GSMap-zoom-out-animation {from {-webkit-transform: scale(1);}to {-webkit-transform: scale(0.5);}}.GSMap-zoom-in {-webkit-transform: scale(2);-webkit-animation-name: GSMap-zoom-in-animation;-webkit-animation-duration: 400ms;-webkit-animation-timing-function: ease-in-out;}.GSMap-zoom-out {-webkit-transform: scale(0.5);-webkit-animation-name: GSMap-zoom-out-animation;-webkit-animation-duration: 400ms;-webkit-animation-timing-function: ease-in-out;}.GSMap-zoom-in-complete {-webkit-transform: scale(2);}.GSMap-zoom-out-complete {-webkit-transform: scale(0.5);}</style>')}try{document.write('<style type="text/css" media="screen">.noscreen{display: none;}.noprint{display:block}</style>');document.write('<style type="text/css" media="print">.noscreen{display: block;}.noprint{display:none}</style>');document.close()}catch(e){}function GSPoint(a,b){this.x=Number(a);this.y=Number(b)}GSPoint.prototype.toString=function(){return"{x: "+this.x+", y: "+this.y+"}"};GSPoint.prototype.toJson=function(){var a={x:this.x,y:this.y};return GSUtil.objToJson(a)};GSPoint.prototype.equals=function(a){return(a.x==this.x&&a.y==this.y)};GSPoint.prototype.distanceFrom=function(a){return Math.pow(Math.pow(this.x-a.x,2)+Math.pow(this.y-a.y,2),0.5)};GSPoint.prototype.toGeoJsonObj=function(){var a={type:"Point",coordinates:[this.x,this.y]};return a};function GSMapFeature(a){this.options={contextMenuItems:[]};GSUtil.merge(a,this.options);this.type="GSMapFeature";this.graphicsEl=undefined;this.layer=undefined;this.map=undefined;this.visible=true;this.selectable=false;this.selected=false;this.zIndex=0;this.tip=undefined;this.properties={}}GSUtil.include(GSMapFeature,new GSEventBroadcasterMixin(),new GSDOMEventsMixin());GSMapFeature.prototype.initializeContextMenu=function(){if(GSModule.isLoaded("additional-ui")){if(this.options.contextMenuItems.length){var f=GSContextMenuManager.getContextMenu();this.setContextMenu(f);var g=f.getItems().length;var a=0;for(var c=0,b=this.options.contextMenuItems.length;c<b;c++){var d=this.options.contextMenuItems[c];this.addContextMenuItemAt(d,a++)}if(g){this.addContextMenuItemAt(new GSMenuItem("",{type:"separator"}),a++)}}if(this.contextMenu&&!this.contextMenu.onmap){this.contextMenu.addToMap(this.map)}}};GSMapFeature.prototype.getProperties=function(){return this.properties};GSMapFeature.prototype.setProperty=function(a,b){this.properties[a]=b};GSMapFeature.prototype.getProperty=function(a){return this.properties[a]};GSMapFeature.prototype.deleteProperty=function(a){delete this.properties[a]};GSMapFeature.prototype.addToLayer=function(a){this.layer=a;this.map=a.map;this.addListener(this.map);this.map.addListener(this);this.addEventListener(_browser.isMobileWebkit?"touchend":"click",this.clickHandler,this);if(_browser.isMobileWebkit){this.addEventListener("touchstart",this.touchstartHandler,this)}if(this.tip){this.tip.addToParent(this.map.container)}this.initializeContextMenu();this.onmap=true;if(this.map.isReady){this.render()}};GSMapFeature.prototype.render=function(){};GSMapFeature.prototype.addEventHandler=function(a,b){return this.addEventListener(a,b,this)};GSMapFeature.prototype.removeEventHandler=function(a){GSEventManager.release(a)};GSMapFeature.prototype.setTip=function(b,a){if(!this.graphicsEl){throw new Error("Cannot set tool tip, graphics element does not exist")}if(this.tip){this.tip.remove()}if(!a){a={}}a.text=b;this.tip=new GSTip(this.graphicsEl,a)};GSMapFeature.prototype.setVisible=function(a){this.visible=a};GSMapFeature.prototype.isVisible=function(){return this.visible};GSMapFeature.prototype.isSelectable=function(){return this.selectable};GSMapFeature.prototype.select=function(){this.selected=true};GSMapFeature.prototype.deselect=function(){this.selected=false};GSMapFeature.prototype.setZIndex=function(a){this.zIndex=a;this.graphicsEl.style.zIndex=a};GSMapFeature.prototype.remove=function(a){a=a!==undefined?a:true;if(a){this.removeEventListeners()}if(this.onmap){this.map.removeListener(this)}if(this.tip){this.tip.remove(a)}if(a){this.graphicsEl=null}this.onmap=false;this.broadcastMessage("featureRemoved",this)};GSMapFeature.prototype.toJson=function(){var a={type:this.type};return GSUtil.objToJson(a)};GSMapFeature.prototype.mapResized=function(c,b,a){this.render()};GSMapFeature.prototype.mapZoomed=function(c,b,a){};GSMapFeature.prototype.mapBoundsChanged=function(c,a,b){this.render()};GSMapFeature.prototype.clickHandler=function(a){GSUtil.cancelEvent(a);this.broadcastMessage("featureClicked",this,a)};GSMapFeature.prototype.touchstartHandler=function(a){GSUtil.cancelEvent(a)};GSMapFeature.prototype.didHandleContextMenuEvent=function(a){GSUtil.cancelEvent(a);if(!this.selected){this.broadcastMessage("featureClicked",this,a)}};GSMapFeature.prototype.showInfoWindow=function(c,b){if(this.onmap){if(this.map.infoWindow){c=c!=undefined?c:this.infoHtml;if(c===undefined){throw new Error("Tried to open info window for feature without any HTML content")}var d=this.getInfoWindowOptions();var a=this.getInfoWindowPosition();this.map.openInfoWindow(a,c,GSUtil.merge(b,d));this.isShowingInfo=true}else{throw new Error("Info window is not enabled for the map this feature has been added to")}}};GSMapFeature.prototype.getInfoWindowOptions=function(){};GSMapFeature.prototype.getInfoWindowPosition=function(){};GSMapFeature.prototype.infoWindowOpened=function(a){};GSMapFeature.prototype.infoWindowClosed=function(a){if(this.isShowingInfo){this.isShowingInfo=false}};GSUtil.extend(GSPointFeature,GSMapFeature);function GSPointFeature(b){GSPointFeature.baseConstructor.call(this,b);this.type="GSPointFeature";this.id=GSUtil.getCaseInsensitiveProperty(b,"id");this.coordinate=GSUtil.getCaseInsensitiveProperty(b,"coordinate");if(!this.coordinate){var a=GSUtil.getCaseInsensitiveProperty(b,"x");var c=GSUtil.getCaseInsensitiveProperty(b,"y");this.coordinate=(a&&c)?new GSPoint(a,c):new GSPoint(0,0)}this.name=GSUtil.getCaseInsensitiveProperty(b,"name");this.iconType=undefined;this.infoHtml=GSUtil.getCaseInsensitiveProperty(b,"infoHtml");this.draggable=GSUtil.stringToBoolean(GSUtil.getCaseInsensitiveProperty(b,"draggable",false));this.label=undefined;this.isShowingInfo=false;this.visibleOnMap=false;this.icon=GSUtil.getCaseInsensitiveProperty(b,"icon");if(!this.icon){this.icon=new GSIcon(GSIcon.defaultIcon)}this.icon.alt=this.name;this.icon.initialize();this.graphicsEl=this.icon.getEventTarget();if(this.draggable){this.enableDragging()}this.icon.setVisible(this.visible)}GSPointFeature.prototype.addToLayer=function(a){this.icon.addToLayer(a);if(this.label){this.label.addToLayer(a)}if(this.badge){this.badge.addToParent(a.iconContainer)}GSPointFeature.superClass.addToLayer.call(this,a)};GSPointFeature.prototype.enableDragging=function(){GSEventManager.bind(this.graphicsEl,"mousedown",this,this.startDrag)};GSPointFeature.prototype.startDrag=function(a){var b=a.which?a.which==3:(a.button?a.button==2:false);if(b){return}this.dragStartPos=GSUtil.getMousePixelCoordinate(a);this.dragStartMousePos=GSUtil.getMousePixelCoordinate(a,this.map.container);this.dragStartFeaturePos=this.map.translateToMapCoordinate(this.coordinate);this.dragOffset=new GSPoint(this.dragStartMousePos.x-this.dragStartFeaturePos.x,this.dragStartMousePos.y-this.dragStartFeaturePos.y);if(this.isShowingInfo){this.map.infoWindow.close()}this.mousemoveListener=GSEventManager.bind(document,"mousemove",this,this.dragMove);this.mouseupListener=GSEventManager.bind(document,"mouseup",this,this.dragEnd);GSUtil.cancelEvent(a)};GSPointFeature.prototype.getIcon=function(){return this.icon};GSPointFeature.prototype.setName=function(a){this.name=a;if(this.icon.type=="GSTextIcon"){this.icon.setTitle(a)}};GSPointFeature.prototype.setBadge=function(b,a){if(!window.GSBadge){throw new Error("To set a badge on this feature you must include the 'badge' module.")}if(!this.graphicsEl){throw new Error("Cannot set badge, graphics element does not exist")}if(this.badge){this.badge.setCount(b,a)}else{this.badge=new GSBadge(this,b,a);if(this.onmap){this.badge.addToParent(this.layer.iconContainer)}}return this.badge};GSPointFeature.prototype.removeBadge=function(){if(this.badge){this.badge.remove()}this.badge=null};GSPointFeature.prototype.setZIndex=function(a){GSPointFeature.superClass.setZIndex.call(this,a);if(this.badge){this.badge.setZIndex(a+10)}};GSPointFeature.prototype.positionGhost=function(a){this.coordinate=this.map.getMouseCoordinate(a);this.ghostFeature.icon.render(this.layer,this.coordinate)};GSPointFeature.prototype.dragMove=function(a){if(!this.hasDragged(a)){return}if(!this.dragging){this.dragging=true;document.body.style.cursor="move";this.broadcastMessage("featureDragStart",this);if(!this.ghostFeature){this.ghostFeature=this.clone();this.ghostFeature.icon.startDragging(this.map);this.setVisible(false)}this.positionGhost(a)}else{this.positionGhost(a);this.broadcastMessage("featureDrag",this,[a])}GSUtil.cancelEvent(a)};GSPointFeature.prototype.dragEnd=function(a){if(this.hasDragged(a)){var b=GSUtil.getMousePixelCoordinate(a,this.map.container);this.coordinate=this.map.translateToRealWorldCoordinate(new GSPoint(b.x-this.dragOffset.x,b.y-this.dragOffset.y));this.finishDrag()}GSEventManager.release(this.mousemoveListener);GSEventManager.release(this.mouseupListener);GSUtil.cancelEvent(a)};GSPointFeature.prototype.finishDrag=function(){if(this.ghostFeature){this.ghostFeature.icon.stopDragging(this.map);this.ghostFeature.setVisible(false);this.ghostFeature=undefined}this.setVisible(true);this.renderIcon();this.dragging=false;document.body.style.cursor="default";this.broadcastMessage("featureDragEnd",this);this.removeListener(this.map)};GSPointFeature.prototype.clone=function(){var a=this.layer;var b=this.icon;var c=this.tip;this.layer=undefined;this.icon=undefined;this.tip=undefined;var d=GSUtil.clone(this);d.icon=new window[b.type](b);d.icon.alt=this.name;d.icon.initialize();d.onmap=false;d.isShowingInfo=false;this.layer=a;this.icon=b;this.tip=c;return d};GSPointFeature.prototype.setLabel=function(a){if(!this.graphicsEl){throw new Error("Cannot set label, graphics element does not exist")}if(this.label){this.label.remove()}this.label=a;this.label.graphicsEl.style.zIndex=1000;this.label.setCoordinate(this.coordinate);this.label.updatePosition=GSUtil.bind(this.updateLabelPosition,this.label,this)};GSPointFeature.prototype.updateLabelPosition=function(a,d){var c=d.x;var b=d.y;if(this.options.position.left!==undefined){c=d.x+this.options.position.left}else{if(this.options.position.right!==undefined){c=d.x-(this.textEl.offsetWidth+this.options.position.right)}else{c=d.x+a.icon.iconOffset.x+((a.icon.image.offsetWidth-this.backgroundEl.offsetWidth)/2)}}if(this.options.position.top!==undefined){b=d.y+this.options.position.top}else{if(this.options.position.bottom!==undefined){b=d.y-(this.textEl.offsetHeight+this.options.position.bottom)}}GSUtil.positionElement(this.graphicsEl,c,b)};GSPointFeature.prototype.setVisible=function(a){this.visible=a;if(this.icon){this.icon.setVisible(a);if(this.onmap){this.renderIcon()}}if(this.label){this.label.setVisible(a)}if(this.badge){this.badge.setVisible(a);if(this.onmap){this.badge.position(this.visibleOnMap)}}if(!a){if(this.isShowingInfo){this.map.infoWindow.close()}}};GSPointFeature.prototype.isVisible=function(){return this.visible};GSPointFeature.prototype.isDraggable=function(){return this.draggable};GSPointFeature.prototype.setCoordinate=function(a){this.coordinate=a;this.render()};GSPointFeature.prototype.setImage=function(a){GSUtil.setImageSrc(this.icon.image,a);this.renderIcon()};GSPointFeature.prototype.setIcon=function(f){if(this.layer){this.icon.remove(this.layer)}this.icon=f;this.icon.initialize();this.graphicsEl=this.icon.getEventTarget();if(this.draggable){this.enableDragging()}var d;if(this.eventListeners){for(var c in this.eventListeners){if(this.eventListeners[c] instanceof Array){for(var a=this.eventListeners[c].length,b=null;b=this.eventListeners[c][a];a--){d=GSEventCache.handlers[b];GSEventManager.bind(this.graphicsEl,d[1],this,d[2])}}else{d=GSEventCache.handlers[this.eventListeners[c]];if(d){GSEventManager.bind(this.graphicsEl,d[1],this,d[2])}}}}if(this.layer){this.icon.addToLayer(this.layer);if(this.onmap){this.renderIcon()}}};GSPointFeature.prototype.hasDragged=function(c){if(!this.dragStartPos){return false}var b=2;var d=GSUtil.getMousePixelCoordinate(c);var a=(Math.abs(this.dragStartPos.x-d.x)>b)||(Math.abs(this.dragStartPos.y-d.y)>b);return a};GSPointFeature.prototype.openMapBlowup=function(b){b=b?b:15;if(this.onmap){this.isShowingInfo=true;var a=this.icon.iconOffset.x+this.icon.iconInfoWindowOffset.x;var d=this.icon.iconOffset.y+this.icon.iconInfoWindowOffset.y;var c=this.clone();this.map.openMapBlowup(this.coordinate,{zoomLevel:b,offset:new GSPoint(a,d),onopen:function(f){f.addFeature(c)}})}};GSPointFeature.prototype.getInfoWindowOptions=function(){var a=this.icon.iconOffset.x+this.icon.iconInfoWindowOffset.x;var c=this.icon.iconOffset.y+this.icon.iconInfoWindowOffset.y;var b={offset:new GSPoint(a,c),title:this.name?this.name:""};return b};GSPointFeature.prototype.getInfoWindowPosition=function(){return this.coordinate};GSPointFeature.prototype.closestPoint=function(d,c){var f=this.map.translateToMapCoordinate(this.coordinate);var b=Math.abs(f.x-d.x);var a=Math.abs(f.y-d.y);if(b<c&&a<c){return{point:this.coordinate,delta:Math.min(b,a)}}else{return null}};GSPointFeature.prototype.getBounds=function(){return new GSBounds(this.coordinate.x,this.coordinate.y,this.coordinate.x,this.coordinate.y)};GSPointFeature.prototype.render=function(){this.renderIcon();if(this.badge){this.badge.position(this.visibleOnMap)}};GSPointFeature.prototype.renderIcon=function(){var a=this.visibleOnMap;this.visibleOnMap=this.icon.render(this.layer,this.coordinate);if(!a&&this.visibleOnMap){this.broadcastMessage("featureVisibleOnMap",this)}else{if(a&&!this.visibleOnMap){this.broadcastMessage("featureNotVisibleOnMap",this)}}};GSPointFeature.prototype.remove=function(a){a=a!==undefined?a:true;this.icon.remove(a);if(this.onmap&&this.isShowingInfo){this.map.infoWindow.close()}if(this.label){this.label.remove(a)}if(this.badge){this.badge.remove()}GSPointFeature.superClass.remove.call(this,a)};GSPointFeature.prototype.toJson=function(){var a={type:this.type,coordinate:this.coordinate,icon:this.icon,visible:this.visible};return GSUtil.objToJson(a)};GSPointFeature.prototype.toGeoJsonObj=function(){var a={type:"Point",coordinates:[this.coordinate.x,this.coordinate.y]};return a};GSPointFeature.prototype.toGML=function(){var a=[];a.push('<Point xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:27200">');a.push("<gml:coordinates>"+this.coordinate.x+","+this.coordinate.y+"</gml:coordinates>");a.push("</Point>");return a.join("")};GSPointFeature.prototype.toWKT=function(){return"POINT("+this.coordinate.x+" "+this.coordinate.y+")"};GSPointFeature.prototype.toString=function(){var a="Feature:<br/>";for(var b in this){if(this[b] instanceof Function){a+=(b+" : [Function]<br/>")}else{a+=(b+" : "+this[b]+"<br/>")}}return a};var GSDrag={obj:null,init:function(d,j,g,b,f,a,k,h,l,c){GSEventManager.addEventListener(d,"mousedown",GSUtil.bindAsEventListener(GSDrag.start,d));GSEventManager.addEventListener(d,"contextmenu",GSDrag.stopPropagation);d.hmode=k?false:true;d.vmode=h?false:true;d.root=j&&j!=null?j:d;if(d.hmode&&isNaN(parseInt(d.root.style.left))){d.root.style.left="0px"}if(d.vmode&&isNaN(parseInt(d.root.style.top))){d.root.style.top="0px"}if(!d.hmode&&isNaN(parseInt(d.root.style.right))){d.root.style.right="0px"}if(!d.vmode&&isNaN(parseInt(d.root.style.bottom))){d.root.style.bottom="0px"}d.minX=typeof g!="undefined"?g:null;d.minY=typeof f!="undefined"?f:null;d.maxX=typeof b!="undefined"?b:null;d.maxY=typeof a!="undefined"?a:null;d.xMapper=l?l:null;d.yMapper=c?c:null;d.root.onDragStart=new Function();d.root.onDragEnd=new Function();d.root.onDrag=new Function()},start:function(b){GSDrag.stopPropagation(b);var c=GSDrag.obj=this;b=GSDrag.fixE(b);var f=parseInt(c.vmode?c.root.style.top:c.root.style.bottom);var a=parseInt(c.hmode?c.root.style.left:c.root.style.right);c.root.onDragStart(a,f,b);var d=GSUtil.getMousePos(b);c.lastMouseX=d.x;c.lastMouseY=d.y;if(c.hmode){if(c.minX!=null){c.minMouseX=d.x-a+c.minX}if(c.maxX!=null){c.maxMouseX=c.minMouseX+c.maxX-c.minX}}else{if(c.minX!=null){c.maxMouseX=-c.minX+d.x+a}if(c.maxX!=null){c.minMouseX=-c.maxX+d.x+a}}if(c.vmode){if(c.minY!=null){c.minMouseY=d.y-f+c.minY}if(c.maxY!=null){c.maxMouseY=c.minMouseY+c.maxY-c.minY}}else{if(c.minY!=null){c.maxMouseY=-c.minY+d.y+f}if(c.maxY!=null){c.minMouseY=-c.maxY+d.y+f}}document.onmousemove=GSDrag.drag;document.onmouseup=GSDrag.end;return false},drag:function(d){GSDrag.stopPropagation(d);d=GSDrag.fixE(d);var a=GSDrag.obj;var h=GSUtil.getMousePos(d);var g=h.x;var f=h.y;var j=parseInt(a.vmode?a.root.style.top:a.root.style.bottom);var k=parseInt(a.hmode?a.root.style.left:a.root.style.right);var c,b;if(a.minX!=null){g=a.hmode?Math.max(g,a.minMouseX):Math.min(g,a.maxMouseX)}if(a.maxX!=null){g=a.hmode?Math.min(g,a.maxMouseX):Math.max(g,a.minMouseX)}if(a.minY!=null){f=a.vmode?Math.max(f,a.minMouseY):Math.min(f,a.maxMouseY)}if(a.maxY!=null){f=a.vmode?Math.min(f,a.maxMouseY):Math.max(f,a.minMouseY)}c=k+((g-a.lastMouseX)*(a.hmode?1:-1));b=j+((f-a.lastMouseY)*(a.vmode?1:-1));if(a.xMapper){c=a.xMapper(j)}else{if(a.yMapper){b=a.yMapper(k)}}GSDrag.obj.root.style[a.hmode?"left":"right"]=c+"px";GSDrag.obj.root.style[a.vmode?"top":"bottom"]=b+"px";GSDrag.obj.lastMouseX=g;GSDrag.obj.lastMouseY=f;GSDrag.obj.root.onDrag(c,b,d);return false},end:function(a){GSDrag.stopPropagation(a);a=GSDrag.fixE(a);document.onmousemove=null;document.onmouseup=null;GSDrag.obj.root.onDragEnd(parseInt(GSDrag.obj.root.style[GSDrag.obj.hmode?"left":"right"]),parseInt(GSDrag.obj.root.style[GSDrag.obj.vmode?"top":"bottom"]),a);GSDrag.obj=null},fixE:function(a){if(typeof a=="undefined"){a=window.event}if(typeof a.layerX=="undefined"){a.layerX=a.offsetX}if(typeof a.layerY=="undefined"){a.layerY=a.offsetY}return a},stopPropagation:function(a){a=a?a:window.event;if(a.stopPropagation){a.preventDefault();a.stopPropagation()}else{a.cancelBubble=true;a.returnValue=false}}};function GSInfoWindow(a){this.map=a;this.map.addListener(this);this.coordinate;this.offset=new GSPoint(0,0);this.isOpen=false;this.hidden=true;this.buttons={};this.element=undefined;this.restoreSize=undefined;this.maximized=false;this.dim=new GSDimension(0,0);this.createWindow();this.preloadImages();GSEventManager.bind(this.element,"click",this,this.processMouseEvent);if(_browser.isMobileWebkit){GSEventManager.bind(this.element,"touchstart",this,this.processMouseEvent)}else{GSEventManager.bind(this.element,"mousedown",this,this.processMouseEvent)}GSEventManager.bind(this.element,"dblclick",this,this.processMouseEvent);GSEventManager.bind(window,"resize",this,this.windowResizeHandler)}GSInfoWindow.CALLOUT_WIDTH=24;GSInfoWindow.CALLOUT_HEIGHT=40;GSInfoWindow.BORDER_WIDTH=1;GSInfoWindow.TITLE_HEIGHT=24;GSInfoWindow.MIN_BODY_WIDTH=160;GSInfoWindow.MIN_BODY_HEIGHT=40;GSInfoWindow.MAX_BODY_WIDTH=1000;GSInfoWindow.MAX_BODY_HEIGHT=800;GSInfoWindow.H_BODY_MARGIN=10;GSInfoWindow.PRELOAD_IMAGES=[_globals.resourceURL+"iw2/buttons.gif",_globals.resourceURL+"iw2/callout.gif",_globals.resourceURL+"iw2/hd-sprite.gif",_globals.resourceURL+"iw2/left.gif",_globals.resourceURL+"iw2/mid.gif",_globals.resourceURL+"iw2/right.gif"];GSInfoWindow.prototype.preloadImages=function(){var a=[];var c=null;for(var d=0,b=GSInfoWindow.PRELOAD_IMAGES.length;d<b;d++){a.push(new Image().src=GSInfoWindow.PRELOAD_IMAGES[d])}};GSInfoWindow.prototype.processMouseEvent=function(a){GSUtil.eventStopPropagation(a)};GSInfoWindow.prototype.canAnchorOnInfoWindow=function(){return this.isOpen&&this.map.contains(this.coordinate)};GSInfoWindow.prototype.open=function(g,c,b){this.map.broadcastMessage("infoWindowOpening",this);this.options={maximizable:false,maxContent:"",maxSize:new GSDimension(GSInfoWindow.MAX_BODY_WIDTH,GSInfoWindow.MAX_BODY_HEIGHT),showCloseButton:true};GSUtil.merge(b,this.options);if(this.isOpen){this.close()}this.isOpen=true;this.onclose=this.options.onclose;this.coordinate=g;if(this.options.offset){this.offset=this.options.offset}if((typeof c).toLowerCase()=="string"){var f=GSUtil.createElement("div",{html:c});c=f}this.setContent(c);this.setTitle(this.options.title);if(this.options.maximizable){if((typeof this.options.maxContent).toLowerCase()=="string"){this.maxContent=GSUtil.createElement("div",{html:this.options.maxContent})}else{this.maxContent=this.options.maxContent}this.buttons.maximizeBtn.style.display="block"}else{this.buttons.maximizeBtn.style.display="none"}if(this.options.showCloseButton){this.buttons.closeBtn.style.display="block"}else{this.buttons.closeBtn.style.display="none"}var d=this.map;var a=GSUtil.bind(function(){if(this.options.onopen){this.options.onopen()}d.broadcastMessage("infoWindowOpened",this)},this);this.updatePosition(a);this.show()};GSInfoWindow.prototype.getEdgeConstraint=function(){if(!this.map){return new GSPoint(0,0)}var h={top:5,right:5,bottom:5,left:5};for(var d=0,b=this.map.controls.length;d<b;d++){var g=this.map.controls[d];var f=g.getWidth();var a=g.getHeight();if(f&&a){var c=g.getOrientation()?g.getOrientation():(f>a?"horizontal":"vertical");var j=g.getPosition();switch(j.anchor){case GSControl.ANCHOR_TOP_LEFT:if(c=="horizontal"){h.top=Math.max(h.top,5+j.offset.y+a)}else{h.left=Math.max(h.left,5+j.offset.x+f)}break;case GSControl.ANCHOR_BOTTOM_LEFT:if(c=="horizontal"){h.bottom=Math.max(h.bottom,5+j.offset.y)}else{h.left=Math.max(h.left,5+j.offset.x+f)}break;case GSControl.ANCHOR_TOP_RIGHT:if(c=="horizontal"){h.top=Math.max(h.top,5+j.offset.y+a)}else{h.right=Math.max(h.right,5+j.offset.x)}break;case GSControl.ANCHOR_BOTTOM_RIGHT:if(c=="horizontal"){h.bottom=Math.max(h.bottom,5+j.offset.y)}else{h.right=Math.max(h.right,5+j.offset.x)}break}}}return h};GSInfoWindow.prototype.update=function(){this.updateSize();this.updatePosition()};GSInfoWindow.prototype.updateSize=function(c){this.element.style.width="auto";if(!c){c=new GSDimension()}var b=c.width||Math.max(this.body.offsetWidth,GSInfoWindow.MIN_BODY_WIDTH);var f=c.height||Math.max(this.body.offsetHeight,GSInfoWindow.MIN_BODY_HEIGHT);var d=b+((GSInfoWindow.H_BODY_MARGIN)*2);var a=f+GSInfoWindow.TITLE_HEIGHT+10;this.element.style.width=d+"px";this.element.style.height=a+"px";this.strut.style.height=(f+10)+"px";this.callout.style.left=((d-GSInfoWindow.CALLOUT_WIDTH)/2)+"px";this.dim=this.getSize();this.reposition()};GSInfoWindow.prototype.updatePosition=function(d){var a=this.getEdgeConstraint();var l=this.dim.width;var p=this.dim.height;var q=this.offset.x;var o=this.offset.y-(p+GSInfoWindow.CALLOUT_HEIGHT);var j=new GSPoint(q,o);var k,g;var n=this.map.translateToMapCoordinate(this.coordinate);if(this.coordinate.x>this.map.minX&&this.coordinate.x<this.map.maxX&&this.coordinate.y>this.map.minY&&this.coordinate.y<this.map.maxY){var c=n.x+j.x;var m=n.y+j.y;var h=0;var f=0;if((c+(l/2)+a.right)>this.map.pxWidth){h=this.map.pxWidth-(c+(l/2)+a.right)}else{if((c-(l/2)-a.left)<0){h=((l/2)+a.left)-c}}if((m-a.top)<0){f=0-(m-a.top)}else{if((m+p+GSInfoWindow.CALLOUT_HEIGHT+a.bottom)>this.map.pxHeight){f=this.map.pxHeight-(m+p+GSInfoWindow.CALLOUT_HEIGHT+a.bottom-this.offset.y)}}if(h==0&&f==0){if(d){d()}return}k=this.map.centerX-(h*this.map.mpx);g=this.map.centerY+(f*this.map.mpx)}else{var h=(this.map.pxWidth/2)>(j.x+(l/2)+a.left)?0:(j.x+(l/2)+a.left)-(this.map.pxWidth/2);var f=(this.map.pxHeight/2)>(Math.abs(j.y)+a.top)?0:(Math.abs(j.y)+a.top)-(this.map.pxHeight/2);k=this.coordinate.x+(h*this.map.mpx);g=this.coordinate.y+(f*this.map.mpx)}var b=this.map;this.map.panTo(new GSPoint(k,g),d)};GSInfoWindow.prototype.getSize=function(){return new GSDimension(this.element.offsetWidth,this.element.offsetHeight)};GSInfoWindow.prototype.updateContent=function(a){if(!this.isOpen){return}if((typeof a).toLowerCase()=="string"){var b=GSUtil.createElement("div",{html:a});a=b}this.setContent(a);this.updatePosition()};GSInfoWindow.prototype.close=function(){if(arguments[0]){GSUtil.cancelEvent(arguments[0])}if(this.onclose){this.onclose()}if(this.maximized){this.restore()}this.hide();this.isOpen=false;this.map.broadcastMessage("infoWindowClosed",this)};GSInfoWindow.prototype.hide=function(){this.element.style.visibility="hidden";this.hidden=true};GSInfoWindow.prototype.show=function(){this.element.style.visibility="visible";this.hidden=false};GSInfoWindow.prototype.isHidden=function(){return this.hidden};GSInfoWindow.prototype.getCoordinate=function(){return this.coordinate};GSInfoWindow.prototype.getPixelOffset=function(){return this.offset};GSInfoWindow.prototype.remove=function(){this.map.contentContainer.removeChild(this.element);this.element=null};GSInfoWindow.prototype.mapResized=function(){this.reposition()};GSInfoWindow.prototype.mapBoundsChanged=function(){this.reposition()};GSInfoWindow.prototype.reposition=function(){if(!this.isOpen){return}var c=this.dim.height;var b=this.dim.width;var f=this.map.translateToMapCoordinate(this.coordinate);var a=f.x+this.offset.x-(b/2);var d=f.y+(this.offset.y-(c+GSInfoWindow.CALLOUT_HEIGHT));GSUtil.positionElement(this.element,a,d)};GSInfoWindow.prototype.setContent=function(c,a){if(a===undefined){a=true}c.className="GSInfoWindow-content";var b=null;if(this.body.firstChild){b=this.body.replaceChild(c,this.body.firstChild)}else{this.body.appendChild(c)}if(a){this.updateSize()}return b};GSInfoWindow.prototype.createWindow=function(){this.element=GSUtil.createElement("div",{styles:{position:"absolute",visibility:"hidden",cursor:"default",zIndex:1000},events:{contextmenu:GSUtil.cancelEvent},"class":"GSInfoWindow noprint",parent:this.map.contentContainer});var f=GSUtil.createElement("div",{styles:{position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%"},parent:this.element});var a=GSUtil.createElement("div",{styles:{padding:"0 0 0 9px",background:"url("+_globals.resourceURL+"iw2/hd-sprite.gif) no-repeat left top"},parent:f});var c=GSUtil.createElement("div",{styles:{padding:"0 9px 0 0",background:"url("+_globals.resourceURL+"iw2/hd-sprite.gif) no-repeat right -24px"},parent:a});var d=GSUtil.createElement("div",{styles:{height:"24px",background:"url("+_globals.resourceURL+"iw2/hd-sprite.gif) repeat-x 0px -48px"},"class":"GSInfoWindow-title",parent:c});this.titleText=GSUtil.createElement("div",{styles:{fontSize:"12px",fontFamily:"Arial, Helvetica, sans-serif",lineHeight:"12px",padding:"6px 0 0 0",textAlign:"center"},parent:d,unselectable:true});var g=GSUtil.createElement("div",{styles:{padding:"0 0 0 8px",background:"url("+_globals.resourceURL+"iw2/left.gif) no-repeat left bottom"},parent:f});var b=GSUtil.createElement("div",{styles:{padding:"0 8px 0 0",background:"url("+_globals.resourceURL+"iw2/right.gif) no-repeat right bottom"},parent:g});this.strut=GSUtil.createElement("div",{styles:{height:"70px",background:"url("+_globals.resourceURL+"iw2/mid.gif) repeat-x center bottom"},"class":"GSInfoWindow-strut",parent:b});this.callout=GSUtil.createElement("div",{styles:{width:"24px",height:"42px",background:"url("+_globals.resourceURL+"iw2/callout.gif) no-repeat",position:"absolute",bottom:((GSInfoWindow.CALLOUT_HEIGHT+1)*-1)+"px"},"class":"GSInfoWindow-callout",unselectable:true,parent:f});this.body=GSUtil.createElement("div",{styles:{position:"absolute",top:"28px",background:"#fff",margin:"0px "+GSInfoWindow.H_BODY_MARGIN+"px"},"class":"GSInfoWindow-body",parent:this.element});this.buttons.maximizeBtn=GSUtil.createElement("a",{styles:{display:"block",overflow:"hidden",position:"absolute",right:"22px",top:"5px",width:"14px",height:"14px",background:"url("+_globals.resourceURL+"iw2/buttons.gif) no-repeat -14px 0px",cursor:"pointer"},events:{click:GSUtil.bindAsEventListener(this.maximize,this),mouseover:this.buttons.maximizeBtn,mouseout:this.buttons.maximizeBtn},href:"#",parent:this.element,title:"Maximize"});this.buttons.restoreBtn=GSUtil.createElement("a",{styles:{display:"none",overflow:"hidden",position:"absolute",right:"22px",top:"5px",width:"14px",height:"14px",background:"url("+_globals.resourceURL+"iw2/buttons.gif) no-repeat -28px 0px",cursor:"pointer"},events:{click:GSUtil.bindAsEventListener(this.restore,this),mouseover:this.restoreBtnOver,mouseout:this.restoreBtnOut},href:"#",parent:this.element,title:"Restore"});this.buttons.closeBtn=GSUtil.createElement("a",{styles:{display:"block",overflow:"hidden",position:"absolute",right:"5px",top:"5px",width:"14px",height:"14px",background:"url("+_globals.resourceURL+"iw2/buttons.gif) no-repeat 0px 0px",cursor:"pointer"},events:{click:GSUtil.bindAsEventListener(this.close,this),mouseover:this.closeBtnOver,mouseout:this.closeBtnOut},href:"#",parent:this.element,title:"Close"})};GSInfoWindow.prototype.maximize=function(){if(arguments[0]){GSUtil.cancelEvent(arguments[0])}if(this.maximized){return}this.restoreSize=new GSDimension(this.body.offsetWidth,this.body.offsetHeight);var g=GSUtil.bind(function(){this.map.hideControls();this.sizeToMapWindow();this.buttons.maximizeBtn.style.display="none";this.buttons.restoreBtn.style.display="block";this.restoreContent=this.setContent(this.maxContent,false);this.maximized=true;map.broadcastMessage("infoWindowMaximized",this)},this);var b=new GSPoint(Math.round(this.coordinate.x),Math.round(this.map.centerY+(this.coordinate.y-this.map.minY)-(this.getEdgeConstraint().top*this.map.mpx)));var d=this.map.getMapCenter();var c=Math.abs(b.x/this.map.mpx-d.x/this.map.mpx);var a=Math.abs(b.y/this.map.mpx-d.y/this.map.mpx);if(c<20&&a<20){this.map.centerAtCoordinate(b,g)}else{this.map.panTo(b,g)}};GSInfoWindow.prototype.restore=function(){if(arguments[0]){GSUtil.cancelEvent(arguments[0])}if(!this.maximized){return}this.body.replaceChild(this.restoreContent,this.maxContent);this.updateSize(this.restoreSize);this.buttons.restoreBtn.style.display="none";this.buttons.maximizeBtn.style.display="block";this.map.showControls();this.maximized=false;map.broadcastMessage("infoWindowRestored",this)};GSInfoWindow.prototype.windowResizeHandler=function(){if(this.maximized){var b=new GSPoint(Math.round(this.coordinate.x),Math.round(this.map.centerY+(this.coordinate.y-this.map.minY)-(this.getEdgeConstraint().top*this.map.mpx)));var d=this.map.getMapCenter();var c=Math.abs(b.x/this.map.mpx-d.x/this.map.mpx);var a=Math.abs(b.y/this.map.mpx-d.y/this.map.mpx);if(c<20&&a<20){this.map.centerAtCoordinate(b,GSUtil.bind(this.sizeToMapWindow,this))}else{this.map.panTo(b,GSUtil.bind(this.sizeToMapWindow,this))}}};GSInfoWindow.prototype.setTitle=function(b){while(this.titleText.firstChild){this.titleText.removeChild(this.titleText.firstChild)}var a=b?this.truncateTitle(b):"";this.titleText.appendChild(document.createTextNode(a))};GSInfoWindow.prototype.truncateTitle=function(b){var a=Math.floor(this.element.offsetWidth/7)-7;if(b.length<=a){return b}return b.substr(0,a)+"..."};GSInfoWindow.prototype.sizeToMapWindow=function(){var c=this.getEdgeConstraint();var a=this.map.pxWidth-(c.left*2);a=a<this.options.maxSize.width?a:this.options.maxSize.width;var b=this.map.pxHeight-(c.top*2)-GSInfoWindow.CALLOUT_HEIGHT+this.offset.y;b=b<this.options.maxSize.height?b:this.options.maxSize.height;this.element.style.width=a+"px";this.element.style.height=b+"px";this.strut.style.height=(b-GSInfoWindow.TITLE_HEIGHT)+"px";this.callout.style.left=((a-GSInfoWindow.CALLOUT_WIDTH)/2)+"px";this.reposition()};GSInfoWindow.prototype.closeBtnOver=function(a){this.style.backgroundPosition="0px -14px"};GSInfoWindow.prototype.closeBtnOut=function(a){this.style.backgroundPosition="0px 0px"};GSInfoWindow.prototype.maximizeBtnOver=function(a){this.style.backgroundPosition="-14px -14px"};GSInfoWindow.prototype.maximizeBtnOut=function(a){this.style.backgroundPosition="-14px 0px"};GSInfoWindow.prototype.restoreBtnOver=function(a){this.style.backgroundPosition="-28px -14px"};GSInfoWindow.prototype.restoreBtnOut=function(a){this.style.backgroundPosition="-28px 0px"};var GSCookie={set:function(c,f,b){var a="";if(b!=undefined){var g=new Date();g.setTime(g.getTime()+(86400000*parseFloat(b)));a="; expires="+g.toGMTString()}return(document.cookie=escape(c)+"="+escape(f||"")+a)},get:function(a){var b=document.cookie.match(new RegExp("(^|;)\\s*"+escape(a)+"=([^;\\s]*)"));return(b?unescape(b[2]):null)},erase:function(a){var b=GSCookie.get(a)||true;GSCookie.set(a,"",-1);return b},accept:function(){if(typeof navigator.cookieEnabled=="boolean"){if(document.cookie!==undefined){return navigator.cookieEnabled}else{return false}}GSCookie.set("_test","1");return(GSCookie.erase("_test")==="1")}};function GSTip(b,a){this.element=(typeof b)=="string"?document.getElementById(b):b;this.options={fixed:false,showDelay:100,hideDelay:100,maxDisplayChars:999999,offset:new GSPoint(0,20)};GSUtil.merge(a,this.options);var c=this.options.text?this.options.text:(this.element.title?this.element.title:"");if(c.length>this.options.maxDisplayChars){c=c.substring(0,this.options.maxDisplayChars)+"&hellip;"}this.element.removeAttribute("title");this.text=c;this.visible=false;this.eventHandlers={};this.initialize();return this}GSTip.prototype.initialize=function(){var b={display:"none",position:"absolute",zIndex:100000};if(!this.options.className){GSUtil.merge({color:"#000",backgroundColor:"#f0f0f0",fontFamily:"Arial, Helvetica, Sans-serif",fontSize:"11px",borderColor:"rgb(130, 130, 130)",borderStyle:"solid",borderWidth:"1px",padding:"2px 4px",WebkitBoxShadow:"0px 2px 4px #666",MozBoxShadow:"0px 2px 4px #666"},b)}this.tipEl=GSUtil.createElement("div",{styles:b,"class":(this.options.className?this.options.className:"GSTip"),html:this.text,unselectable:true});var d=this.getTextSize();this.tipEl.style.width=d.width+"px";this.tipEl.style.height=d.height+"px";var f=GSUtil.bindAsEventListener(this.show,this);GSEventManager.addEventListener(this.element,"mouseover",f);var c=GSUtil.bind(this.hide,this);GSEventManager.addEventListener(this.element,"mouseout",c);if(!this.options.fixed){var a=GSUtil.bindAsEventListener(this.onMouseMove,this);GSEventManager.addEventListener(this.element,"mousemove",a)}};GSTip.prototype.addToParent=function(a){this.parentNode=a;this.parentNode.appendChild(this.tipEl);return this};GSTip.prototype.position=function(){var c=GSUtil.getComputedStyle(this.element,"left");var b=GSUtil.getComputedStyle(this.element,"top");var a=c!="auto"?parseInt(c):0;var f=b!="auto"?parseInt(b):0;var d=new GSPoint(a,f);this.positionRelativeToParent(d)};GSTip.prototype.positionRelativeToParent=function(g){var d=this.getDimensions();var a=d.width;var c=d.height;var b=(g.x+a+this.options.offset.x)>parseInt(GSUtil.getComputedStyle(this.parentNode,"width"));var f=(g.y+c+this.options.offset.y)>parseInt(GSUtil.getComputedStyle(this.parentNode,"height"));if(b){this.tipEl.style.left="";this.tipEl.style.right=(this.parentNode.offsetWidth-g.x+this.options.offset.x)+"px"}else{this.tipEl.style.left=g.x+this.options.offset.x+"px";this.tipEl.style.right=""}if(f){this.tipEl.style.top="";this.tipEl.style.bottom=this.options.offset.y+"px"}else{this.tipEl.style.top=g.y+this.options.offset.y+"px";this.tipEl.style.bottom=""}};GSTip.prototype.getDimensions=function(){this.tipEl.style.left="-1000px";this.tipEl.style.right="auto";if(!this.visible){this.tipEl.style.display="block"}var a=parseInt(GSUtil.getComputedStyle(this.tipEl,"width"));var d=parseInt(GSUtil.getComputedStyle(this.tipEl,"height"));var c=parseInt(GSUtil.getComputedStyle(this.tipEl,"padding-left"));var j=parseInt(GSUtil.getComputedStyle(this.tipEl,"padding-right"));var g=parseInt(GSUtil.getComputedStyle(this.tipEl,"padding-top"));var b=parseInt(GSUtil.getComputedStyle(this.tipEl,"padding-bottom"));if(!this.visible){this.tipEl.style.display="none"}var f=new GSDimension(a+c+j,d+g+b);return f};GSTip.prototype.show=function(){if(!this.visible){var a=arguments[0];if(a){var b=GSUtil.getMousePixelCoordinate(a,this.parentNode);this.positionRelativeToParent(b)}setTimeout(GSUtil.bind(this.onShow,this,this.tipEl),this.options.showDelay)}};GSTip.prototype.hide=function(){if(!this.hiding){this.hiding=true;setTimeout(GSUtil.bind(this.onHide,this,this.tipEl),this.options.hideDelay)}};GSTip.prototype.onShow=function(a){a.style.display="block";this.visible=true};GSTip.prototype.setText=function(b){this.text=b;var a=this.getTextSize();this.tipEl.style.width=a.width+"px";this.tipEl.style.height=a.height+"px";this.tipEl.innerHTML=this.text};GSTip.prototype.onHide=function(a){a.style.display="none";this.hiding=false;this.visible=false};GSTip.prototype.onMouseMove=function(a){if(this.hiding){return}var b=GSUtil.getMousePixelCoordinate(a,this.parentNode);this.positionRelativeToParent(b)};GSTip.prototype.remove=function(b){b=b!==undefined?b:true;if(b){for(var a in this.eventHandlers){GSEventManager.release(this.eventHandlers[a])}}this.parentNode.removeChild(this.tipEl)};GSTip.prototype.getTextSize=function(){var a=GSUtil.createElement("div",{styles:{border:"1px solid red",position:"absolute",top:"-1000px",left:"-1000px",fontFamily:this.tipEl.style.fontFamily,fontSize:this.tipEl.style.fontSize,lineHeight:this.tipEl.style.fontSize,padding:0,margin:0},html:this.text+"",parent:document.body});var b=new GSDimension(a.offsetWidth,a.offsetHeight);document.body.removeChild(a);return b};function GSModule(){}GSModule.loading=false;GSModule.callOnLoad=null;GSModule.callModulesToLoad=[];GSModule.callRequestedModules=[];GSModule.callLoadedModules=[];GSModule.loadedModules=[];GSModule.load=function(a,b){if(GSModule.loading){throw new Error("Existing load operation in progress")}GSModule.loading=true;if((typeof a).toLowerCase()=="string"){a=[a]}GSModule.callModulesToLoad=a;GSModule.callRequestedModules=[];GSModule.callOnLoad=b;GSModule.loadNext()};GSModule.loadNext=function(){var b=GSModule.callModulesToLoad.shift();if(!GSModule.isLoaded(b)){GSModule.callRequestedModules.push(b);var a=GSModule.buildModuleUrl(b);GSModule.appendModuleScriptElement(a)}};GSModule.moduleLoaded=function(a){if(!GSModule.isLoaded(a)){GSModule.loadedModules.push(a)}if(!GSModule.arrayContains(GSModule.callLoadedModules,a)&&GSModule.arrayContains(GSModule.callRequestedModules,a)){GSModule.callLoadedModules.push(a);if((GSModule.callRequestedModules.length==GSModule.callLoadedModules.length)&&GSModule.callModulesToLoad.length==0){GSModule.callRequestedModules.length=0;GSModule.callLoadedModules.length=0;GSModule.loading=false;if(GSModule.callOnLoad){GSModule.callOnLoad();GSModule.callOnLoad=null}}else{GSModule.loadNext()}}};GSModule.buildModuleUrl=function(b){var a=GSModule.API_URL+"&module="+b.toLowerCase();return a};GSModule.appendModuleScriptElement=function(a){var b=GSUtil.createElement("script",{type:"text/javascript",src:a});var c=document.getElementsByTagName("head")[0];c.appendChild(b)};GSModule.getScriptUrl=function(){var a=document.getElementsByTagName("script");for(var c=0,b=a.length;c<b;c++){if(a[c].src.indexOf("service=sfapi")!=-1){return a[c].src}}};GSModule.isLoaded=function(a){return GSModule.arrayContains(GSModule.loadedModules,a)};GSModule.arrayContains=function(d,c){for(var b=0,a=d.length;b<a;b++){if(d[b]===c){return true}}return false};GSModule.API_URL=GSModule.getScriptUrl();function GSXHR(a){this.options={onSuccess:function(){},onFailure:function(){},autoCancel:false,method:"get",urlEncodeData:true,contentType:"application/x-www-form-urlencoded"};this.options=GSUtil.merge(a,this.options);this.running=false;this.setTransport()}GSXHR.prototype.setTransport=function(){this.transport=new XMLHttpRequest()};GSXHR.prototype.send=function(b,c){if(!c){c=null}if(this.options.autoCancel){this.cancel()}else{if(this.running){return}}this.running=true;this.transport.onreadystatechange=GSUtil.bind(this.onStateChange,this);if(c&&(typeof c!="string")&&(this.options.method=="get"||this.options.urlEncodeData)){var d=[];for(var a in c){if(c.hasOwnProperty(a)){d.push(encodeURIComponent(a)+"="+encodeURIComponent(c[a]))}}c=d.join("&")}else{if(c&&(typeof c=="string")&&this.options.method!="get"&&this.options.urlEncodeData){c=encodeURIComponent(c)}}if(c&&this.options.method=="get"){b+=(b.indexOf("?")==-1?"?":"&");b+=c;c=null}this.transport.open(this.options.method.toUpperCase(),b,true);this.transport.setRequestHeader("Content-Type",this.options.contentType);this.transport.send(c)};GSXHR.prototype.onStateChange=function(){if(this.transport.readyState==4){this.running=false;if(this.transport.status>=200&&this.transport.status<300){if(this.options.onSuccess){if(this.transport.responseText.length===0){this.options.onSuccess(null,null)}else{this.options.onSuccess(this.getResponse(),this.transport.responseText)}}}else{if(this.options.onFailure){if(this.transport.responseText.length===0){this.options.onFailure(null,null)}else{this.options.onFailure(this.getResponse(),this.transport.responseText)}}}this.setTransport()}};GSXHR.prototype.getResponse=function(){var contentType=this.transport.getResponseHeader("Content-Type").split(";")[0];var data=null;switch(contentType){case"text/xml":case"application/xml":data=this.transport.responseXML;break;case"text/javascript":case"application/json":data=eval("("+this.transport.responseText+")");break;case"text/html":default:data=this.transport.responseText;break}return data};GSXHR.prototype.cancel=function(){if(!this.running){return}this.running=false;this.transport.abort();this.transport.onreadystatechange=function(){};this.setTransport();return};GSUtil.extend(GSMapTypeControl,GSControl);function GSMapTypeControl(){GSMapTypeControl.baseConstructor.call(this,GSMap.MAP_TYPE_CONTROL);this.buttons=[];this.activeButton}GSMapTypeControl.prototype.render=function(g){var f=GSUtil.createElement("div",{styles:{height:"18px",margin:0,padding:0},id:GSMap.MAP_TYPE_CONTROL});var a=0;var h=this.getBaseLayers();for(var d=0,c=null;c=h[d];d++){var j=d==0?GSButton.LEFT:(d==h.length-1?GSButton.RIGHT:GSButton.INNER);var b=this.createToggleButton(h[d],f,j);b.setPosition(new GSPoint(a,0));a+=b.getSize().width;this.buttons.push(b)}return f};GSMapTypeControl.prototype.getBaseLayers=function(){var d=[];var a=this.map.getLayers();for(var c=0,b;b=a[c];c++){if(b.isBaseLayer()){d.push(b)}}return d};GSMapTypeControl.prototype.createToggleButton=function(c,f,g){var d=this.map.getBaseLayer().name==c.name;var b=new GSButton(c.name,f,{buttonType:g,active:d});var a=GSUtil.bindAsEventListener(this.onClick,this,b);b.addEventListener("click",a);b.addEventListener("dblclick",GSUtil.cancelEvent);return b};GSMapTypeControl.prototype.getWidth=function(){return this.element.offsetWidth};GSMapTypeControl.prototype.getHeight=function(){return this.element.offsetHeight};GSMapTypeControl.prototype.setPosition=function(a){GSUtil.positionElement(this.element,null,a.offset.y,a.offset.x);this.position=a};GSMapTypeControl.prototype.getDefaultPosition=function(){var a=7;for(var c=0,b=null;b=this.buttons[c];c++){a+=b.getSize().width}return{anchor:GSControl.ANCHOR_TOP_RIGHT,offset:new GSPoint(a,7)}};GSMapTypeControl.prototype.onClick=function(g,f){GSUtil.cancelEvent(g);if(!f.active){try{this.map.setBaseLayer(f.name);for(var d=0,c=this.buttons.length;d<c;d++){var a=this.buttons[d];a.setActive(f.name==a.name)}}catch(g){}}};function GSPanel(b,a){this.options={width:0,height:0,color:"#ebeced",backgroundColor:"rgba(0,0,0,0.65)",borderCorners:"tl,tr,bl,br",zIndex:0,visible:true,draggable:false,className:"GSPanel",styles:{padding:0},events:{}};GSUtil.merge(a,this.options);this.parent=(typeof b)=="string"?document.getElementById(b):b;this.element=null;this.borderCorners=this.options.borderCorners.split(",");this.defaultBackgroundImage=_globals.roundedCornersService+"?c="+this.options.backgroundColor+"&bc=transparent&w=2&h=2";this.eventListeners={};this.dragging=false;this.initialize()}GSPanel.prototype.initialize=function(){if(this.options.borderRadius){if(_browser.isRGBaCapable()){this.cssRoundCorners()}else{this.htmlRoundCorners()}}else{this.createRootElement()}if(this.options.html){this.setContent(this.options.html)}if(this.options.draggable){GSEventManager.addEventListener(this.element,"mousedown",this.dragStart,this)}if(this.options.eventsDisablePropagation){this.disableEventPropagation(this.options.eventsDisablePropagation)}this.setVisible(this.options.visible)};GSPanel.prototype.getElement=function(){return this.element};GSPanel.prototype.getContentElement=function(){var a=this.contentEl||this.element;if(this.border){if(!this.contentEl){this.contentEl=this.element.appendChild(GSUtil.createElement("div",{styles:{position:"absolute",left:0,top:0,padding:this.options.styles.padding}}))}return this.contentEl}return a};GSPanel.prototype.disableEventPropagation=function(b){if((typeof b)=="string"){b=[b]}for(var a=0,c=null;c=b[a];a++){GSEventManager.addEventListener(this.element,c,GSUtil.eventStopPropagation)}};GSPanel.prototype.dragStart=function(a){GSUtil.cancelEvent(a);this.dragging=true;this.lastPixel=GSUtil.getMousePixelCoordinate(a);this.eventListeners.mouseup=GSEventManager.addEventListener(document,"mouseup",this.dragStop,this);this.eventListeners.mousemove=GSEventManager.addEventListener(document,"mousemove",this.dragMove,this)};GSPanel.prototype.dragMove=function(d){GSUtil.cancelEvent(d);var c=GSUtil.getMousePixelCoordinate(d);var b=c.x-this.lastPixel.x;var a=c.y-this.lastPixel.y;this.lastPixel=c;GSUtil.setStyles(this.element,{left:(parseInt(this.element.style.left,10)+b)+"px",top:(parseInt(this.element.style.top,10)+a)+"px"})};GSPanel.prototype.dragStop=function(a){GSUtil.cancelEvent(a);GSEventManager.release(this.eventListeners.mouseup);GSEventManager.release(this.eventListeners.mousemove);this.dragging=false};GSPanel.prototype.createRootElement=function(a){var c=null;if(this.options.backgroundColor.indexOf("rgba(")!=-1&&!_browser.isRGBaCapable()){c={width:this.options.width+"px",height:this.options.height+"px",padding:this.options.styles.padding,position:"absolute"};this.element=GSUtil.createElement("div",{styles:GSUtil.merge(this.options.styles,a),events:this.options.events,"class":this.options.className,parent:this.parent});GSUtil.setStyles(this.element,GSUtil.merge(c,{color:this.options.color,zIndex:this.options.zIndex}));this.backgroundEl=GSUtil.createElement("div",{styles:{top:0,left:0},parent:this.element});GSUtil.setStyles(this.backgroundEl,c);var b=_globals.roundedCornersService+"?c="+this.options.backgroundColor+"&bc=transparent&w="+this.options.width+"&h="+this.options.height;GSUtil.setElementBackgroundImage(this.backgroundEl,b);this.contentEl=GSUtil.createElement("div",{styles:{top:0,left:0},parent:this.element});GSUtil.setStyles(this.contentEl,c)}else{c=GSUtil.merge(this.options.styles,{width:this.options.width+"px",height:this.options.height+"px",color:this.options.color,backgroundColor:this.options.backgroundColor,padding:this.options.styles.padding,zIndex:this.options.zIndex,position:"absolute"});if(this.options.x!==undefined||this.options.y!==undefined){c.left=(this.options.x||0)+"px";c.top=(this.options.y||0)+"px"}if(this.options.boxShadow){c.boxShadow="0px 2px 3px #555";c.WebkitBoxShadow="0px 2px 3px #555";c.MozBoxShadow="0px 2px 3px #555"}GSUtil.merge(a,c);this.element=GSUtil.createElement("div",{styles:c,events:this.options.events,"class":this.options.className,parent:this.parent})}};GSPanel.prototype.cssRoundCorners=function(){this.createRootElement(this.getBorderRadiusCssStyle())};GSPanel.prototype.htmlRoundCorners=function(){this.border={};var b=this.getPadding();var a=GSUtil.merge(this.options.styles,{width:this.options.width+(b.left*2)+"px",color:this.options.color,zIndex:this.options.zIndex,position:"absolute"});delete a.padding;if(this.options.x!==undefined||this.options.y!==undefined){a.left=(this.options.x||0)+"px";a.top=(this.options.y||0)+"px"}this.element=GSUtil.createElement("div",{styles:a,events:this.options.events,"class":this.options.className,parent:this.parent});this.border.top=this.createBorderSection(this.element);this.border.tl=this.createBorderCorner("tl",this.border.top);this.border.tc=this.createBorderEdge(this.border.top);this.border.tr=this.createBorderCorner("tr",this.border.top);this.border.center=this.createCenter(this.element);this.border.bottom=this.createBorderSection(this.element);this.border.bl=this.createBorderCorner("bl",this.border.bottom);this.border.bc=this.createBorderEdge(this.border.bottom);this.border.br=this.createBorderCorner("br",this.border.bottom)};GSPanel.prototype.createBorderSection=function(b){var a=GSUtil.createElement("div",{styles:{position:"relative",height:this.options.borderRadius+"px",zoom:1,fontSize:0},parent:b});return a};GSPanel.prototype.createBorderCorner=function(d,c){var a=this.shouldApplyBorderRadius(d)?_globals.roundedCornersService+"?c="+this.options.backgroundColor+"&bc=transparent&h="+this.options.borderRadius+"&w="+this.options.borderRadius+"&a="+d:this.defaultBackgroundImage;var b=GSUtil.createElement("img",{styles:{position:"absolute",width:this.options.borderRadius+"px",height:this.options.borderRadius+"px"},src:a,parent:c});switch(d){case"tl":case"bl":b.style.left=0;break;case"tr":case"br":b.style.right=0;break}return b};GSPanel.prototype.createBorderEdge=function(c){var b=GSUtil.createElement("div",{styles:{position:"absolute",top:0,left:this.options.borderRadius+"px",width:this.getInnerWidth()+"px",height:this.options.borderRadius+"px"},parent:c});if(this.options.backgroundColor.indexOf("rgba(")==-1||_browser.isRGBaCapable()){b.style.backgroundColor=this.options.backgroundColor}else{var a=_globals.roundedCornersService+"?c="+this.options.backgroundColor+"&bc=transparent&w=2&h=2";GSUtil.setElementBackgroundImage(b,a)}return b};GSPanel.prototype.createCenter=function(b){var a=GSUtil.createElement("div",{styles:{width:this.getInnerWidth()+"px",height:this.getInnerHeight()+"px",margin:0,fontSize:0,lineHeight:0,padding:"0 "+(this.options.borderRadius||0)+"px"},parent:b});if(this.options.backgroundColor.indexOf("rgba(")==-1||_browser.isRGBaCapable()){a.style.backgroundColor=this.options.backgroundColor}else{GSUtil.setElementBackgroundImage(a,this.defaultBackgroundImage)}return a};GSPanel.prototype.setContent=function(a){a=GSUtil.createElement("div",{html:a});if(this.border){if(this.contentEl){this.element.removeChild(this.contentEl)}GSUtil.setStyles(a,{position:"absolute",left:0,top:0,padding:this.options.styles.padding});this.contentEl=a;this.element.appendChild(this.contentEl)}else{this.removeChildren(this.element);this.element.appendChild(a)}};GSPanel.prototype.removeChildren=function(a){while(a.firstChild){a.removeChild(a.firstChild)}};GSPanel.prototype.setPosition=function(a){this.options.x=a.x;this.options.y=a.y;GSUtil.setStyles(this.element,{left:a.x+"px",top:a.y+"px"})};GSPanel.prototype.getSize=function(){var a=this.getPadding();return new GSDimension(this.options.width+a.left+a.right,this.options.height+a.top+a.bottom)};GSPanel.prototype.setSize=function(b){this.options.width=b.width;this.options.height=b.height;if(this.border){var c=this.getPadding();this.element.style.width=b.width+(c.left*2)+"px";var a=this.getInnerWidth();this.border.tc.style.width=a+"px";this.border.bc.style.width=a+"px";GSUtil.setStyles(this.border.center,{width:a+"px",height:this.getInnerHeight()+"px"})}else{GSUtil.setStyles(this.element,{width:b.width+"px",height:b.height+"px"})}};GSPanel.prototype.setBackgroundColor=function(a){this.options.backgroundColor=a;this.defaultBackgroundImage=_globals.roundedCornersService+"?c="+this.options.backgroundColor+"&bc=transparent&w=2&h=2";var b=null;if(this.border){b=this.shouldApplyBorderRadius("tl")?_globals.roundedCornersService+"?c="+this.options.backgroundColor+"&bc=transparent&h="+this.options.borderRadius+"&w="+this.options.borderRadius+"&a=tl":this.defaultBackgroundImage;GSUtil.setImageSrc(this.border.tl,b);if(this.options.backgroundColor.indexOf("rgba(")==-1||_browser.isRGBaCapable()){this.border.tc.style.backgroundColor=this.options.backgroundColor}else{b=_globals.roundedCornersService+"?c="+this.options.backgroundColor+"&bc=transparent&w=2&h=2";GSUtil.setElementBackgroundImage(this.border.tc,b)}b=this.shouldApplyBorderRadius("tr")?_globals.roundedCornersService+"?c="+this.options.backgroundColor+"&bc=transparent&h="+this.options.borderRadius+"&w="+this.options.borderRadius+"&a=tr":this.defaultBackgroundImage;GSUtil.setImageSrc(this.border.tr,b);if(this.options.backgroundColor.indexOf("rgba(")==-1||_browser.isRGBaCapable()){this.border.center.style.backgroundColor=this.options.backgroundColor}else{b=_globals.roundedCornersService+"?c="+this.options.backgroundColor+"&bc=transparent&w=2&h=2";GSUtil.setElementBackgroundImage(this.border.center,b)}b=this.shouldApplyBorderRadius("bl")?_globals.roundedCornersService+"?c="+this.options.backgroundColor+"&bc=transparent&h="+this.options.borderRadius+"&w="+this.options.borderRadius+"&a=bl":this.defaultBackgroundImage;GSUtil.setImageSrc(this.border.bl,b);if(this.options.backgroundColor.indexOf("rgba(")==-1||_browser.isRGBaCapable()){this.border.bc.style.backgroundColor=this.options.backgroundColor}else{b=_globals.roundedCornersService+"?c="+this.options.backgroundColor+"&bc=transparent&w=2&h=2";GSUtil.setElementBackgroundImage(this.border.bc,b)}b=this.shouldApplyBorderRadius("br")?_globals.roundedCornersService+"?c="+this.options.backgroundColor+"&bc=transparent&h="+this.options.borderRadius+"&w="+this.options.borderRadius+"&a=br":this.defaultBackgroundImage;GSUtil.setImageSrc(this.border.br,b)}else{if(this.options.backgroundColor.indexOf("rgba(")==-1||_browser.isRGBaCapable()){this.element.style.backgroundColor=this.options.backgroundColor}else{b=_globals.roundedCornersService+"?c="+this.options.backgroundColor+"&bc=transparent&w="+this.options.width+"&h="+this.options.height;GSUtil.setElementBackgroundImage(this.element,b)}}};GSPanel.prototype.setVisible=function(a){this.options.visible=a;this.element.style.visibility=this.options.visible?"inherit":"hidden"};GSPanel.prototype.addEventListener=function(b,c,a){GSEventManager.addEventListener(this.element,b,c,a)};GSPanel.prototype.getPadding=function(){if(this._padding){return this._padding}var a=GSUtil.createElement("div",{styles:{width:"1px",height:"1px",padding:this.options.styles.padding,position:"absolute",top:"-1000px",left:"-1000px"},parent:document.body});var b={top:parseInt(GSUtil.getComputedStyle(a,"paddingTop"),10),right:parseInt(GSUtil.getComputedStyle(a,"paddingRight"),10),bottom:parseInt(GSUtil.getComputedStyle(a,"paddingBottom"),10),left:parseInt(GSUtil.getComputedStyle(a,"paddingLeft"),10)};document.body.removeChild(a);this._padding=b;return b};GSPanel.prototype.getInnerWidth=function(){var b=this.getPadding();var a=this.options.width;if(this.options.borderRadius*2<b.left+b.right){a+=((b.left+b.right)-this.options.borderRadius*2)}else{if(b.left+b.right<this.options.borderRadius*2){a-=(this.options.borderRadius*2-(b.left+b.right))}}return Math.max(a,0)};GSPanel.prototype.getInnerHeight=function(){var b=this.getPadding();var a=this.options.height;if(this.options.borderRadius*2<b.top+b.bottom){a+=((b.top+b.bottom)-this.options.borderRadius*2)}else{if(b.top+b.bottom<this.options.borderRadius*2){a-=(this.options.borderRadius*2-(b.top+b.bottom))}}return Math.max(a,0)};GSPanel.prototype.shouldApplyBorderRadius=function(b){for(var a=0,d=null;d=this.borderCorners[a];a++){if(d==b){return true}}return false};GSPanel.prototype.getBorderRadiusCssStyle=function(){var a={};if(this.shouldApplyBorderRadius("tl")){a.borderTopLeftRadius=this.options.borderRadius+"px";a.MozBorderRadiusTopleft=this.options.borderRadius+"px";a.WebkitBorderTopLeftRadius=this.options.borderRadius+"px"}if(this.shouldApplyBorderRadius("tr")){a.borderTopRightRadius=this.options.borderRadius+"px";a.MozBorderRadiusTopright=this.options.borderRadius+"px";a.WebkitBorderTopRightRadius=this.options.borderRadius+"px"}if(this.shouldApplyBorderRadius("bl")){a.borderBottomLeftRadius=this.options.borderRadius+"px";a.MozBorderRadiusBottomleft=this.options.borderRadius+"px";a.WebkitBorderBottomLeftRadius=this.options.borderRadius+"px"}if(this.shouldApplyBorderRadius("br")){a.borderBottomRightRadius=this.options.borderRadius+"px";a.MozBorderRadiusBottomright=this.options.borderRadius+"px";a.WebkitBorderBottomRightRadius=this.options.borderRadius+"px"}return a};GSUtil.extend(GSCopyright,GSControl);function GSCopyright(a){GSCopyright.baseConstructor.call(this,"copyright");this.notice=a?a:"&#169;"+new Date().getFullYear()+" GeoSmart"}GSCopyright.prototype.getDefaultPosition=function(){return{anchor:GSControl.ANCHOR_BOTTOM_CENTER,offset:new GSPoint(0,7)}};GSCopyright.prototype.render=function(a){this.element=GSUtil.createElement("div",{styles:{position:"absolute",fontSize:"11px",fontFamily:"Helvetica, Arial, Sans-serif",color:"#000"},html:this.notice,"class":"GSCopyright"});return this.element};GSUtil.extend(GSMobileZoomControl,GSControl);function GSMobileZoomControl(){GSMobileZoomControl.baseConstructor.call(this,GSMap.MOBILE_ZOOM_CONTROL);this.width=51;this.height=107}GSMobileZoomControl.prototype.render=function(c){this.map=c;var b=GSUtil.createElement("div",{styles:{width:this.width+"px",height:this.height+"px"}});var f=GSUtil.createElement("img",{src:_globals.resourceURL+"zoomBG.png",styles:{width:"51px",height:"107px",position:"absolute",top:0,left:0},"class":"noprint",parent:b});var d=GSUtil.createElement("img",{src:_globals.resourceURL+"zoomInLarge.png",styles:{width:"35px",height:"35px",position:"absolute",left:"5px",top:"6px",zIndex:10,cursor:"pointer"},events:{touchend:GSUtil.bindAsEventListener(this.zoomIn,this)},"class":"noprint",title:"Zoom in",parent:b});var a=GSUtil.createElement("img",{src:_globals.resourceURL+"zoomOutLarge.png",styles:{width:"35px",height:"35px",position:"absolute",left:"5px",top:"60px",zIndex:10,cursor:"pointer"},events:{touchend:GSUtil.bindAsEventListener(this.zoomOut,this)},title:"Zoom out",parent:b});return b};GSMobileZoomControl.prototype.zoomIn=function(a){GSUtil.cancelEvent(a);var b=this.map.scaleIdx;if(b+1>this.map.getBaseLayer().maxZoom){return}this.map.animatedZoom(b+1)};GSMobileZoomControl.prototype.zoomOut=function(a){GSUtil.cancelEvent(a);var b=this.map.scaleIdx;if(b-1<this.map.getBaseLayer().minZoom){return}this.map.animatedZoom(b-1)};