﻿(function(a){a.PaginationCalculator=function(a,b){this.maxentries=a;this.opts=b};a.extend(a.PaginationCalculator.prototype,{numPages:function(){return Math.ceil(this.maxentries/this.opts.items_per_page)},getInterval:function(a){var b=Math.floor(this.opts.num_display_entries/2),c=this.numPages(),d=c-this.opts.num_display_entries,e=a>b?Math.max(Math.min(a-b,d),0):0,f=a>b?Math.min(a+b+this.opts.num_display_entries%2,c):Math.min(this.opts.num_display_entries,c);return{start:e,end:f}}});a.PaginationRenderers={};a.PaginationRenderers.defaultRenderer=function(b,c){this.maxentries=b;this.opts=c;this.pc=new a.PaginationCalculator(b,c)};a.extend(a.PaginationRenderers.defaultRenderer.prototype,{createLink:function(b,f,c){var d,e=this.pc.numPages();b=b<0?0:b<e?b:e-1;c=a.extend({text:b+1,classes:""},c||{});if(b==f)d=a("<span class='current'>"+c.text+"</span>");else d=a("<a>"+c.text+"</a>").attr("href",this.opts.link_to.replace(/__id__/,b));c.classes&&d.addClass(c.classes);d.data("page_id",b);return d},appendRange:function(c,b,d,f,e){for(var a=d;a<f;a++)this.createLink(a,b,e).appendTo(c)},getLinks:function(b,h){var f,g,d=this.pc.getInterval(b),e=this.pc.numPages(),c=a("<div class='pagination'></div>");this.opts.prev_text&&(b>0||this.opts.prev_show_always)&&c.append(this.createLink(b-1,b,{text:this.opts.prev_text,classes:"prev"}));if(d.start>0&&this.opts.num_edge_entries>0){g=Math.min(this.opts.num_edge_entries,d.start);this.appendRange(c,b,0,g,{classes:"sp"});this.opts.num_edge_entries<d.start&&this.opts.ellipse_text&&jQuery("<span>"+this.opts.ellipse_text+"</span>").appendTo(c)}this.appendRange(c,b,d.start,d.end);if(d.end<e&&this.opts.num_edge_entries>0){e-this.opts.num_edge_entries>d.end&&this.opts.ellipse_text&&jQuery("<span>"+this.opts.ellipse_text+"</span>").appendTo(c);f=Math.max(e-this.opts.num_edge_entries,d.end);this.appendRange(c,b,f,e,{classes:"ep"})}this.opts.next_text&&(b<e-1||this.opts.next_show_always)&&c.append(this.createLink(b+1,b,{text:this.opts.next_text,classes:"next"}));a("a",c).click(h);return c}});a.fn.pagination=function(d,b){b=jQuery.extend({items_per_page:10,num_display_entries:11,current_page:0,num_edge_entries:0,link_to:"#",prev_text:"Prev",next_text:"Next",ellipse_text:"...",prev_show_always:true,next_show_always:true,renderer:"defaultRenderer",callback:function(){return false}},b||{});var c=this,h,g,e;function i(c){var e,d=a(c.target).data("page_id"),b=f(d);!b&&c.stopPropagation();return b}function f(a){c.data("current_page",a);g=h.getLinks(a,i);c.empty();g.appendTo(c);var d=b.callback(a,c);return d}e=b.current_page;c.data("current_page",e);d=!d||d<0?1:d;b.items_per_page=!b.items_per_page||b.items_per_page<0?1:b.items_per_page;if(!a.PaginationRenderers[b.renderer])throw new ReferenceError("Pagination renderer '"+b.renderer+"' was not found in jQuery.PaginationRenderers object.");h=new a.PaginationRenderers[b.renderer](d,b);var k=new a.PaginationCalculator(d,b),j=k.numPages();c.bind("setPage",{numPages:j},function(b,a){if(a>=0&&a<b.data.numPages){f(a);return false}});c.bind("prevPage",function(){var b=a(this).data("current_page");b>0&&f(b-1);return false});c.bind("nextPage",{numPages:j},function(c){var b=a(this).data("current_page");b<c.data.numPages-1&&f(b+1);return false});g=h.getLinks(e,i);c.empty();g.appendTo(c);b.callback(e,c)}})(jQuery);(function(a){a.extend({metadata:{defaults:{type:"class",name:"metadata",cre:/({.*})/,single:"metadata"},setType:function(b,a){this.defaults.type=b;this.defaults.name=a},"get":function(d,h){var c=a.extend({},this.defaults,h);if(!c.single.length)c.single="metadata";var b=a.data(d,c.single);if(b)return b;b="{}";if(c.type=="class"){var g=c.cre.exec(d.className);if(g)b=g[1]}else if(c.type=="elem"){if(!d.getElementsByTagName)return undefined;var f=d.getElementsByTagName(c.name);if(f.length)b=a.trim(f[0].innerHTML)}else if(d.getAttribute!=undefined){var e=d.getAttribute(c.name);if(e)b=e}if(b.indexOf("{")<0)b="{"+b+"}";b=eval("("+b+")");a.data(d,c.single,b);return b}}});a.fn.metadata=function(b){return a.metadata.get(this[0],b)}})(jQuery);(function(a){var b=a.browser.msie;jQuery.fn.encHTML=function(){return this.each(function(){var b=a(this),c=b.text();b.text(c.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,escape("'")).replace(/"/g,escape('"')))})};a.mbflipText={author:"Matteo Bicocchi",version:"1.1",flipText:function(c){var d=a("meta[http-equiv=Content-Type]").attr("content")&&a("meta[http-equiv=Content-Type]").attr("content").indexOf("utf-8")>-1;return this.each(function(){var d=a(this),f="",e="",h="",t=d.css("background-color")&&d.css("background-color")!="rgba(0, 0, 0, 0)"?d.css("background-color"):"#fff",g=parseInt(d.css("font-size"))>0?parseInt(d.css("font-size")):14,p=d.css("font-family")?d.css("font-family").replace(/\'/g,"").replace(/"/g,""):"Arial",q=d.css("color")?d.css("color"):"#000";if(a.browser.msie){!c&&d.css({"writing-mode":"tb-rl",height:f,filter:'fliph() flipv("") ',whiteSpace:"nowrap",lineHeight:g+2+"px"}).css("font-weight","normal");h=a("<span style='writing-mode: tb-rl; whiteSpace:nowrap; height:"+f+"; width:"+e+"; line-height:"+(g+2)+"px'>"+d.html()+"</span>")}else{var l=d.getFlipTextDim(false);f=l[1];e=l[0];!b&&d.encHTML();var u=d.text(),m="-90",n="end",i=0,k=a.browser.opera?parseInt(e)-parseInt(e)/4:a.browser.safari?5:0;if(c){k=a.browser.opera?20:0;i=a.browser.safari?g/4:0;m="90, "+(parseInt(e)/2-i)+", "+parseInt(e)/2;n="start"}var j=d.attr("onclick")||d.attr("href"),o=j?"<div class='pointer' style='position:absolute;top:0;left:0;width:100%;height:100%;background:transparent'/>":"";h=a("<object class='flip_label' style='height:"+f+"px; width:"+e+'px;\' type=\'image/svg+xml\' data=\'data:image/svg+xml; charset=utf-8 ,<svg xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="'+e+'px" height="'+f+'px" fill="'+t+'" stroke="none"/><text  x="-'+i+'" y="'+k+'" font-family="'+p+'"  fill="'+q+'" font-size="'+g+'"  style="text-anchor: '+n+'; dominant-baseline: hanging" transform="rotate('+m+')" text-rendering="optimizeSpeed">'+u+"</text></svg>'></object>"+o+"")}var r=j?a("<div/>").css("position","relative"):a(""),s=d.wrap(r).css("position")!="absolute"||d.css("position")!="fixed"?"relative":d.css("position");d.html(h).css({position:s,width:e})})},getFlipTextDim:function(){var d=a(this),f=d.html(),e=parseInt(d.css("font-size")),c=d.css("font-family").replace(/'/g,"").replace(/"/g,"");if(c==undefined)c="Arial";var b=a("<span/>").css({position:"absolute",top:-100,whiteSpace:"noWrap",fontSize:e,fontFamily:c});b.text(f);a("body").append(b);var g=b.outerWidth()!=0?b.outerWidth():16+f.length*e*.6,h=b.outerHeight()!=0?b.outerHeight()+5:50;b.remove();return[h,g]}};a.fn.mbFlipText=a.mbflipText.flipText;a.fn.getFlipTextDim=a.mbflipText.getFlipTextDim})(jQuery);(function(a){document.extruder={};document.extruder.left=0;document.extruder.top=0;document.extruder.bottom=0;document.extruder.right=0;document.extruder.idx=0;var b=a.browser.msie;a.mbExtruder={author:"Matteo Bicocchi",version:"2.3",defaults:{width:350,positionFixed:true,sensibility:800,position:"top",accordionPanels:true,top:"auto",extruderOpacity:1,flapMargin:30,textOrientation:"bt",onExtOpen:function(){},onExtContentLoad:function(){},onExtClose:function(){},hidePanelsOnClose:true,closeOnExternalClick:true,autoCloseTime:0,autoOpenTime:0,slideTimer:300,icon:null,iconHeight:null,iconWidth:null,iconClass:null},buildMbExtruder:function(c){return this.each(function(){this.options={};a.extend(this.options,a.mbExtruder.defaults);a.extend(this.options,c);this.idx=document.extruder.idx;document.extruder.idx++;var d,m,e,n,o,g,p,r;d=a(this);m=d.html();d.css("zIndex",100);var j=this.options.position=="left"||this.options.position=="right",w=j?1:this.options.width,i=a("<div/>").addClass("content").css({overflow:"hidden",width:w});i.append(m);d.html(i);var k=this.options.positionFixed?"fixed":"absolute";d.addClass("extruder");d.addClass(this.options.position);var s=this.options.position=="top"||this.options.position=="bottom";n=this.options.position=="top"?{position:k,top:0,left:"50%",marginLeft:-this.options.width/2,width:this.options.width}:this.options.position=="bottom"?{position:k,bottom:0,left:"50%",marginLeft:-this.options.width/2,width:this.options.width}:this.options.position=="left"?{position:k,top:0,left:0,width:1}:{position:k,top:0,right:0,width:1};d.css(n);!b&&d.css({opacity:this.options.extruderOpacity});d.wrapInner("<div class='ext_wrapper'></div>");e=d.find(".ext_wrapper");o={position:"absolute",width:j?1:this.options.width};e.css(o);if(s){this.options.position=="top"?document.extruder.top++:document.extruder.bottom++;if(document.extruder.top>1||document.extruder.bottom>1){alert("more than 1 mb.extruder on top or bottom is not supported jet... hope soon!");return}}if(a.metadata){a.metadata.setType("class");d.metadata().title&&d.attr("extTitle",d.metadata().title);d.metadata().url&&d.attr("extUrl",d.metadata().url);d.metadata().data&&d.attr("extData",d.metadata().data)}var q=a("<div class='footer'/>"),f=a("<div class='flap'><span class='flapLabel'/></div>");if(document.extruder.bottom){e.prepend(q);e.prepend(f)}else{e.append(q);e.append(f)}g=d.attr("extTitle")?d.attr("extTitle"):"";var h=d.find(".flapLabel");if(d.get(0).options.icon===null){h.text(g);if(j){h.html(g).css({whiteSpace:"noWrap"});var t=this.options.textOrientation=="tb",l=d.find(".flapLabel").getFlipTextDim()[1];d.find(".flapLabel").mbFlipText(t)}else h.html(g).css({whiteSpace:"noWrap"})}else{var t=this.options.textOrientation=="tb";h.html('<img src="'+d.get(0).options.icon+'" class="'+d.get(0).options.iconClass+'" width="'+d.get(0).options.iconWidth+'" height="'+d.get(0).options.iconHeight+'" alt="'+g+'" title="'+g+'" />').css({whiteSpace:"noWrap",position:"relative",width:"28px"});var l=d.get(0).options.iconHeight;if(b&&parseInt(a.browser.version)==8)l=h.outerHeight()}if(d.attr("extUrl"))d.setMbExtruderContent({url:d.attr("extUrl"),data:d.attr("extData"),callback:function(){d.get(0).options.onExtContentLoad&&d.get(0).options.onExtContentLoad()}});else{var u=a("<div>").addClass("text").css({width:d.get(0).options.width-20,height:d.height()-20,overflowY:"auto"});i.wrapInner(u);d.setExtruderVoicesAction()}f.bind("click",function(){if(!d.attr("isOpened"))d.openMbExtruder();else{d.closeMbExtruder();d.removeAttr("isOpened")}}).bind("mouseenter",function(){if(d.get(0).options.autoOpenTime>0)r=setTimeout(function(){d.openMbExtruder();a(document).one("click.extruder"+d.get(0).idx,function(){d.closeMbExtruder()})},d.get(0).options.autoOpenTime)}).bind("mouseleave",function(){clearTimeout(r)});i.bind("mouseleave",function(b){if(d.get(0).options.closeOnExternalClick)if(!a(b.target).parents().is(".text"))a(document).one("click.extruder"+d.get(0).idx,function(){d.closeMbExtruder()});p=setTimeout(function(){d.get(0).options.autoCloseTime>0&&d.closeMbExtruder()},d.get(0).options.autoCloseTime)}).bind("mouseenter",function(){clearTimeout(p);a(document).unbind("click.extruder"+d.get(0).idx)});a(window).bind("resize",function(){d.find("div.content div.text").css({height:d.height()-20})});if(j){i.css({height:"100%"});if(this.options.top=="auto"){f.css({top:23+(this.options.position=="left"?document.extruder.left:document.extruder.right)});this.options.position=="left"?document.extruder.left+=l+this.options.flapMargin:document.extruder.right+=l+this.options.flapMargin}else f.css({top:this.options.top});var v=a("<div/>").css({position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"transparent"});f.append(v)}})},setMbExtruderContent:function(f){this.options={url:false,data:"",callback:function(){}};a.extend(this.options,f);if(!this.options.url||this.options.url.length==0){alert("internal error: no URL to call");return}var h=this.options.url,g=this.options.data,b=a(this),d,e=this.options.callback,c=a("<div>").addClass("container");!(a.browser.msie&&a.browser.version<=7)&&c.css({width:a(this).get(0).options.width});b.find(".content").wrapInner(c);a.ajax({type:"POST",url:h,data:g,async:false,dataType:"html",success:function(c){b.find(".container").append(c);d=b.find(".voice");d.hover(function(){a(this).addClass("hover")},function(){a(this).removeClass("hover")});b.setExtruderVoicesAction();e&&setTimeout(function(){e()},100)}})},openMbExtruder:function(f){var c=a(this);c.attr("isOpened",true);a(document).unbind("click.extruder"+c.get(0).idx);var d=c.get(0).options;c.addClass("isOpened");!b&&c.css("opacity",1);var e=d.position;c.mb_bringToFront();if(e=="top"||e=="bottom"){c.find(".content").slideDown(d.slideTimer);d.onExtOpen&&d.onExtOpen()}else{!b&&a(this).css("opacity",1);c.find(".ext_wrapper").css({width:""});c.find(".content").css({overflowX:"hidden",display:"block"});c.find(".content").animate({width:d.width},d.slideTimer);d.onExtOpen&&d.onExtOpen()}f&&setTimeout(function(){a(document).one("click.extruder"+c.get(0).idx,function(){c.closeMbExtruder()})},100)},closeMbExtruder:function(){var d=a(this);d.removeAttr("isOpened");var c=d.get(0).options;d.removeClass("isOpened");a(document).unbind("click.extruder"+d.get(0).idx);!b&&d.css("opacity",c.extruderOpacity);c.hidePanelsOnClose&&d.hidePanelsOnClose();if(c.position=="top"||c.position=="bottom"){d.find(".content").slideUp(c.slideTimer);c.onExtClose&&c.onExtClose()}else if(c.position=="left"||c.position=="right"){d.find(".content").css({overflow:"hidden"});d.find(".content").animate({width:1},c.slideTimer,function(){d.find(".ext_wrapper").css({width:1});d.find(".content").css({overflow:"hidden",display:"none"});c.onExtClose&&c.onExtClose()})}}};jQuery.fn.mb_bringToFront=function(){var b=10;a("*").each(function(){if(a(this).css("position")=="absolute"||a(this).css("position")=="fixed"){var c=parseInt(a(this).css("zIndex"));b=c>b?parseInt(a(this).css("zIndex")):b}});a(this).css("zIndex",b+=1);var c=a(this).attr("id");a("#"+c+" div.ext_wrapper").css("zIndex",b+100);return b};a.fn.setExtruderVoicesAction=function(){var b=a(this),d=b.get(0).options,c=a(this).find(".voice");c.each(function(){var e=a(this);if(a.metadata){a.metadata.setType("class");e.metadata().panel&&e.attr("panel",e.metadata().panel);e.metadata().data&&e.attr("data",e.metadata().data);e.metadata().disabled&&e.attr("setDisabled",e.metadata().disabled)}e.attr("setDisabled")&&e.disableExtruderVoice();if(e.attr("panel")&&e.attr("panel")!="false"){e.append("<span class='settingsBtn'/>");e.find(".settingsBtn").css({opacity:.5});e.find(".settingsBtn").hover(function(){a(this).css({opacity:1})},function(){a(this).not(".sel").css({opacity:.5})}).click(function(){if(a(this).parents().hasClass("sel")){if(d.accordionPanels)b.hidePanelsOnClose();else a(this).closePanel();return}if(d.accordionPanels){b.find(".optionsPanel").slideUp(400,function(){a(this).remove()});c.removeClass("sel");c.find(".settingsBtn").removeClass("sel").css({opacity:.5})}var f=a("<div class='optionsPanel'></div>");e.after(f);a.ajax({type:"POST",url:e.attr("panel"),data:e.attr("data"),async:false,dataType:"html",success:function(c){var d=a(c);f.html(d);f.children().not(".text").addClass("panelVoice").click(function(){b.closeMbExtruder()});f.slideDown(400)}});e.addClass("sel");e.find(".settingsBtn").addClass("sel").css({opacity:1})})}e.find("a").length==0&&e.attr("panel")&&e.find(".label").not(".disabled").css("cursor","pointer").click(function(){e.find(".settingsBtn").click()});(!e.attr("panel")||e.attr("panel")=="false")&&(!e.attr("setDisabled")||e.attr("setDisabled")!="true")&&e.find(".label").click(function(){b.hidePanelsOnClose();b.closeMbExtruder()})})};a.fn.disableExtruderVoice=function(){var b=a(this),c=b.find(".label");b.removeClass("sel");b.next(".optionsPanel").slideUp(400,function(){a(this).remove()});b.attr("setDisabled",true);c.css("opacity",.4);b.hover(function(){a(this).removeClass("hover")},function(){a(this).removeClass("hover")});c.addClass("disabled").css("cursor","default");b.find(".settingsBtn").hide();b.bind("click",function(a){a.stopPropagation();return false})};a.fn.enableExtruderVoice=function(){var b=a(this);b.attr("setDisabled",false);b.find(".label").css("opacity",1);b.find(".label").removeClass("disabled").css("cursor","pointer");b.unbind("click");b.find(".settingsBtn").show()};a.fn.hidePanelsOnClose=function(){var b=a(this).find(".voice");a(this).find(".optionsPanel").slideUp(400,function(){a(this).remove()});b.removeClass("sel");b.find(".settingsBtn").removeClass("sel").css("opacity",.5)};a.fn.openPanel=function(){var b=a(this).hasClass("voice")?a(this):a(this).find(".voice");b.each(function(){if(a(this).hasClass("sel"))return;a(this).find(".settingsBtn").click()})};a.fn.closePanel=function(){var b=a(this).hasClass("voice")?a(this):a(this).parent(".voice");b.next(".optionsPanel").slideUp(400,function(){a(this).remove()});b.removeClass("sel");a(this).removeClass("sel").css("opacity",.5)};a.fn.buildMbExtruder=a.mbExtruder.buildMbExtruder;a.fn.setMbExtruderContent=a.mbExtruder.setMbExtruderContent;a.fn.closeMbExtruder=a.mbExtruder.closeMbExtruder;a.fn.openMbExtruder=a.mbExtruder.openMbExtruder})(jQuery);(function(a){var r=a.fn.domManip,d="_tmplitem",q=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,b={},f={},e,p={key:0,data:{}},i=0,c=0,l=[];function g(g,d,h,e){var c={data:e||e===0||e===false?e:d?d.data:{},_wrap:d?d._wrap:null,tmpl:null,parent:d||null,nodes:[],calls:u,nest:w,wrap:x,html:v,update:t};g&&a.extend(c,g,{nodes:[],parent:d});if(h){c.tmpl=h;c._ctnt=c._ctnt||c.tmpl(a,c);c.key=++i;(l.length?f:b)[i]=c}return c}a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(f,d){a.fn[f]=function(n){var g=[],i=a(n),k,h,m,l,j=this.length===1&&this[0].parentNode;e=b||{};if(j&&j.nodeType===11&&j.childNodes.length===1&&i.length===1){i[d](this[0]);g=this}else{for(h=0,m=i.length;h<m;h++){c=h;k=(h>0?this.clone(true):this).get();a(i[h])[d](k);g=g.concat(k)}c=0;g=this.pushStack(g,f,i.selector)}l=e;e=null;a.tmpl.complete(l);return g}});a.fn.extend({tmpl:function(d,c,b){return a.tmpl(this[0],d,c,b)},tmplItem:function(){return a.tmplItem(this[0])},template:function(b){return a.template(b,this[0])},domManip:function(d,m,k){if(d[0]&&a.isArray(d[0])){var g=a.makeArray(arguments),h=d[0],j=h.length,i=0,f;while(i<j&&!(f=a.data(h[i++],"tmplItem")));if(f&&c)g[2]=function(b){a.tmpl.afterManip(this,b,k)};r.apply(this,g)}else r.apply(this,arguments);c=0;!e&&a.tmpl.complete(b);return this}});a.extend({tmpl:function(d,h,e,c){var i,k=!c;if(k){c=p;d=a.template[d]||a.template(null,d);f={}}else if(!d){d=c.tmpl;b[c.key]=c;c.nodes=[];c.wrapped&&n(c,c.wrapped);return a(j(c,null,c.tmpl(a,c)))}if(!d)return[];if(typeof h==="function")h=h.call(c||{});e&&e.wrapped&&n(e,e.wrapped);i=a.isArray(h)?a.map(h,function(a){return a?g(e,c,d,a):null}):[g(e,c,d,h)];return k?a(j(c,null,i)):i},tmplItem:function(b){var c;if(b instanceof a)b=b[0];while(b&&b.nodeType===1&&!(c=a.data(b,"tmplItem"))&&(b=b.parentNode));return c||p},template:function(c,b){if(b){if(typeof b==="string")b=o(b);else if(b instanceof a)b=b[0]||{};if(b.nodeType)b=a.data(b,"tmpl")||a.data(b,"tmpl",o(b.innerHTML));return typeof c==="string"?a.template[c]=b:b}return c?typeof c!=="string"?a.template(null,c):a.template[c]||a.template(null,q.test(c)?c:a(c)):null},encode:function(a){return(""+a).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){b={}},afterManip:function(f,b,d){var e=b.nodeType===11?a.makeArray(b.childNodes):b.nodeType===1?[b]:[];d.call(f,b);m(e);c++}});function j(e,g,f){var b,c=f?a.map(f,function(a){return typeof a==="string"?e.key?a.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+d+'="'+e.key+'" $2'):a:j(a,e,a._ctnt)}):e;if(g)return c;c=c.join("");c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(f,c,e,d){b=a(e).get();m(b);if(c)b=k(c).concat(b);if(d)b=b.concat(k(d))});return b?b:k(c)}function k(c){var b=document.createElement("div");b.innerHTML=c;return a.makeArray(b.childNodes)}function o(b){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+a.trim(b).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(m,l,k,g,b,c,d){var j=a.tmpl.tag[k],i,e,f;if(!j)throw"Unknown template tag: "+k;i=j._default||[];if(c&&!/\w$/.test(b)){b+=c;c=""}if(b){b=h(b);d=d?","+h(d)+")":c?")":"";e=c?b.indexOf(".")>-1?b+h(c):"("+b+").call($item"+d:b;f=c?e:"(typeof("+b+")==='function'?("+b+").call($item):("+b+"))"}else f=e=i.$1||"null";g=h(g);return"');"+j[l?"close":"open"].split("$notnull_1").join(b?"typeof("+b+")!=='undefined' && ("+b+")!=null":"true").split("$1a").join(f).split("$1").join(e).split("$2").join(g||i.$2||"")+"__.push('"})+"');}return __;")}function n(c,b){c._wrap=j(c,true,a.isArray(b)?b:[q.test(b)?b:a(b).html()]).join("")}function h(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function s(b){var a=document.createElement("div");a.appendChild(b.cloneNode(true));return a.innerHTML}function m(o){var n="_"+c,k,j,l={},e,p,h;for(e=0,p=o.length;e<p;e++){if((k=o[e]).nodeType!==1)continue;j=k.getElementsByTagName("*");for(h=j.length-1;h>=0;h--)m(j[h]);m(k)}function m(j){var p,h=j,k,e,m;if(m=j.getAttribute(d)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(p=h.getAttribute(d)));if(p!==m){h=h.parentNode?h.nodeType===11?0:h.getAttribute(d)||0:0;if(!(e=b[m])){e=f[m];e=g(e,b[h]||f[h]);e.key=++i;b[i]=e}c&&o(m)}j.removeAttribute(d)}else if(c&&(e=a.data(j,"tmplItem"))){o(e.key);b[e.key]=e;h=a.data(j.parentNode,"tmplItem");h=h?h.key:0}if(e){k=e;while(k&&k.key!=h){k.nodes.push(j);k=k.parent}delete e._ctnt;delete e._wrap;a.data(j,"tmplItem",e)}function o(a){a=a+n;e=l[a]=l[a]||g(e,b[e.parent.key+n]||e.parent)}}}function u(a,d,c,b){if(!a)return l.pop();l.push({_:a,tmpl:d,item:this,data:c,options:b})}function w(d,c,b){return a.tmpl(a.template(d),c,b,this)}function x(b,d){var c=b.options||{};c.wrapped=d;return a.tmpl(a.template(b.tmpl),b.data,c,b.item)}function v(d,c){var b=this._wrap;return a.map(a(a.isArray(b)?b.join(""):b).filter(d||"*"),function(a){return c?a.innerText||a.textContent:a.outerHTML||s(a)})}function t(){var b=this.nodes;a.tmpl(null,null,null,this).insertBefore(b[0]);a(b).remove()}})(jQuery);function ExtDraggableObject(b,D){var c=this,f=window.GEvent||google.maps.Event||google.maps.event,a=D||{},s=a.draggingCursor||"default",r=a.draggableCursor||"default",n=false,u,g,l,q,p,h,i,e,d,w,z,t,j,k,x=Math.round(a.intervalX/2),y=Math.round(a.intervalY/2),v=b.setCapture?b:document;if(typeof a.intervalX!=="number")a.intervalX=1;if(typeof a.intervalY!=="number")a.intervalY=1;if(typeof a.toleranceX!=="number")a.toleranceX=Infinity;if(typeof a.toleranceY!=="number")a.toleranceY=Infinity;w=f.addDomListener(b,"mousedown",A);z=f.addDomListener(v,"mouseup",C);o(false);a.container;b.style.position="absolute";a.left=a.left||b.offsetLeft;a.top=a.top||b.offsetTop;a.interval=a.interval||1;m(a.left,a.top,false);function o(a){if(a)b.style.cursor=s;else b.style.cursor=r}function m(i,m,h){var c,f;d=Math.round(i);e=Math.round(m);if(a.intervalX>1){c=Math.round(d%a.intervalX);d=c<x?d-c:d+(a.intervalX-c)}if(a.intervalY>1){f=Math.round(e%a.intervalY);e=f<y?e-f:e+(a.intervalY-f)}if(a.container&&a.container.offsetWidth){d=Math.max(0,Math.min(d,a.container.offsetWidth-b.offsetWidth));e=Math.max(0,Math.min(e,a.container.offsetHeight-b.offsetHeight))}if(typeof g==="number")if(d-g>a.toleranceX||g-(d+b.offsetWidth)>a.toleranceX||e-l>a.toleranceY||l-(e+b.offsetHeight)>a.toleranceY){d=j;e=k}if(!a.restrictX&&!h)b.style.left=d+"px";if(!a.restrictY&&!h)b.style.top=e+"px"}function B(b){var a=b||event;g=p+((a.pageX||a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft)-h);l=q+((a.pageY||a.clientY+document.body.scrollTop+document.documentElement.scrollTop)-i);p=g;q=l;h=a.pageX||a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;i=a.pageY||a.clientY+document.body.scrollTop+document.documentElement.scrollTop;if(n){m(g,l,u);f.trigger(c,"drag",{mouseX:h,mouseY:i,startLeft:j,startTop:k,event:a})}}function A(d){var a=d||event;o(true);f.trigger(c,"mousedown",a);if(b.style.position!=="absolute"){b.style.position="absolute";return}h=a.pageX||a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;i=a.pageY||a.clientY+document.body.scrollTop+document.documentElement.scrollTop;j=b.offsetLeft;k=b.offsetTop;p=j;q=k;t=f.addDomListener(v,"mousemove",B);b.setCapture&&b.setCapture();if(a.preventDefault){a.preventDefault();a.stopPropagation()}else{a.cancelBubble=true;a.returnValue=false}n=true;f.trigger(c,"dragstart",{mouseX:h,mouseY:i,startLeft:j,startTop:k,event:a})}function C(d){var a=d||event;if(n){o(false);f.removeListener(t);b.releaseCapture&&b.releaseCapture();n=false;f.trigger(c,"dragend",{mouseX:h,mouseY:i,startLeft:j,startTop:k,event:a})}g=l=null;f.trigger(c,"mouseup",a)}c.moveTo=function(a){m(a.x,a.y,false)};c.moveBy=function(a){m(b.offsetLeft+a.width,b.offsetHeight+a.height,false)};c.setDraggingCursor=function(a){s=a;o(n)};c.setDraggableCursor=function(a){r=a;o(n)};c.left=function(){return d};c.top=function(){return e};c.valueX=function(){var b=a.intervalX||1;return Math.round(d/b)};c.valueY=function(){var b=a.intervalY||1;return Math.round(e/b)};c.setValueX=function(b){m(b*a.intervalX,e,false)};c.setValueY=function(b){m(d,b*a.intervalY,false)};c.preventDefaultMovement=function(a){u=a}}var Geo={};Geo.toDMS=function(d,e,b){if(typeof d=="object")throw new TypeError("Geo.toDMS - deg is [DOM?] object");if(isNaN(d))return"NaN";if(typeof e=="undefined")e="dms";if(typeof b=="undefined")switch(e){case"d":b=4;break;case"dm":b=2;break;case"dms":b=0;break;default:e="dms";b=0}d=Math.abs(d);switch(e){case"dm":var h=(d*60).toFixed(b),a=Math.floor(h/60),c=(h%60).toFixed(b);if(a<100)a="0"+a;if(a<10)a="0"+a;if(c<10)c="0"+c;dms=a+"° "+c+"′ ";break;case"dms":var g=(d*3600).toFixed(b),a=Math.floor(g/3600),c=Math.floor(g/60)%60,f=(g%60).toFixed(b);if(a<100)a="0"+a;if(a<10)a="0"+a;if(c<10)c="0"+c;if(f<10)f="0"+f;dms=a+"° "+c+"′ "+f+"″ "}return dms};Geo.toLat=function(a,c,d){var b=Geo.toDMS(a,c,d);return b==""?"":b.slice(1)+(a<0?"S":"N")};Geo.toLon=function(a,c,d){var b=Geo.toDMS(a,c,d);return b==""?"":b+(a<0?"W":"E")};var mapsheets=[["AS21",true,1504000,1528000,6198000,6234000],["AT24",false,1564000,1588000,6162000,6198000],["AT25",false,1588000,1612000,6162000,6198000],["AU25",false,1588000,1612000,6126000,6162000],["AU26",false,1612000,1636000,6126000,6162000],["AU27",false,1636000,1.66e6,6126000,6162000],["AU28",true,1.66e6,1684000,6114000,6.15e6],["AU29",true,1684000,1708000,6114000,6.15e6],["AV25",true,1596000,1.62e6,6.09e6,6126000],["AV26",false,1612000,1636000,6.09e6,6126000],["AV27",false,1636000,1.66e6,6.09e6,6126000],["AV28",false,1.66e6,1684000,6.09e6,6126000],["AV29",false,1684000,1708000,6.09e6,6126000],["AV30",false,1708000,1732000,6.09e6,6126000],["AW26",false,1612000,1636000,6054000,6.09e6],["AW27",false,1636000,1.66e6,6054000,6.09e6],["AW28",false,1.66e6,1684000,6054000,6.09e6],["AW29",false,1684000,1708000,6054000,6.09e6],["AW30",false,1708000,1732000,6054000,6.09e6],["AW31",false,1732000,1756000,6054000,6.09e6],["AW32",false,1756000,1.78e6,6054000,6.09e6],["AX27",false,1636000,1.66e6,6018000,6054000],["AX28",false,1.66e6,1684000,6018000,6054000],["AX29",false,1684000,1708000,6018000,6054000],["AX30",false,1708000,1732000,6018000,6054000],["AX31",false,1732000,1756000,6018000,6054000],["AX32",true,1748000,1772000,6006000,6042000],["AX33",false,1.78e6,1804000,6018000,6054000],["AY28",false,1.66e6,1684000,5982000,6018000],["AY29",false,1684000,1708000,5982000,6018000],["AY30",false,1708000,1732000,5982000,6018000],["AY31",false,1732000,1756000,5982000,6018000],["AY32",false,1756000,1.78e6,5982000,6018000],["AY33",false,1.78e6,1804000,5982000,6018000],["AY34",false,1804000,1828000,5982000,6018000],["AZ29",false,1684000,1708000,5946000,5982000],["AZ30",false,1708000,1732000,5946000,5982000],["AZ31",false,1732000,1756000,5946000,5982000],["AZ32",false,1756000,1.78e6,5946000,5982000],["AZ34",false,1804000,1828000,5946000,5982000],["AZ35",false,1828000,1852000,5946000,5982000],["AZ36",true,1844000,1868000,5937000,5973000],["BA30",false,1708000,1732000,5.91e6,5946000],["BA31",false,1732000,1756000,5.91e6,5946000],["BA32",false,1756000,1.78e6,5.91e6,5946000],["BA33",false,1.78e6,1804000,5.91e6,5946000],["BA34",false,1804000,1828000,5.91e6,5946000],["BA35",false,1828000,1852000,5.91e6,5946000],["BA36",true,1844000,1868000,5.91e6,5946000],["BB30",true,1716000,1.74e6,5874000,5.91e6],["BB31",false,1732000,1756000,5874000,5.91e6],["BB32",false,1756000,1.78e6,5874000,5.91e6],["BB33",false,1.78e6,1804000,5874000,5.91e6],["BB34",false,1804000,1828000,5874000,5.91e6],["BB35",false,1828000,1852000,5874000,5.91e6],["BB36",false,1852000,1876000,5874000,5.91e6],["BB37",true,1868000,1892000,5874000,5.91e6],["BC31",false,1732000,1756000,5838000,5874000],["BC32",false,1756000,1.78e6,5838000,5874000],["BC33",false,1.78e6,1804000,5838000,5874000],["BC34",false,1804000,1828000,5838000,5874000],["BC35",false,1828000,1852000,5838000,5874000],["BC36",false,1852000,1876000,5838000,5874000],["BC37",false,1876000,1.9e6,5838000,5874000],["BC40",true,1956000,1.98e6,5826000,5862000],["BD31",true,1.74e6,1764000,5802000,5838000],["BD32",false,1756000,1.78e6,5802000,5838000],["BD33",false,1.78e6,1804000,5802000,5838000],["BD34",false,1804000,1828000,5802000,5838000],["BD35",false,1828000,1852000,5802000,5838000],["BD36",false,1852000,1876000,5802000,5838000],["BD37",false,1876000,1.9e6,5802000,5838000],["BD38",false,1.9e6,1924000,5802000,5838000],["BD39",true,1924000,1948000,5.79e6,5826000],["BD40",true,1948000,1972000,5.79e6,5826000],["BD42",false,1996000,2.02e6,5802000,5838000],["BD43",false,2.02e6,2044000,5802000,5838000],["BD44",false,2044000,2068000,5802000,5838000],["BD45",false,2068000,2092000,5802000,5838000],["BE31",false,1732000,1756000,5766000,5802000],["BE32",false,1756000,1.78e6,5766000,5802000],["BE33",false,1.78e6,1804000,5766000,5802000],["BE34",false,1804000,1828000,5766000,5802000],["BE35",false,1828000,1852000,5766000,5802000],["BE36",false,1852000,1876000,5766000,5802000],["BE37",false,1876000,1.9e6,5766000,5802000],["BE38",false,1.9e6,1924000,5766000,5802000],["BE39",false,1924000,1948000,5766000,5802000],["BE40",false,1948000,1972000,5766000,5802000],["BE41",false,1972000,1996000,5766000,5802000],["BE42",false,1996000,2.02e6,5766000,5802000],["BE43",false,2.02e6,2044000,5766000,5802000],["BE44",false,2044000,2068000,5766000,5802000],["BE45",false,2068000,2092000,5766000,5802000],["BF31",false,1732000,1756000,5.73e6,5766000],["BF32",false,1756000,1.78e6,5.73e6,5766000],["BF33",false,1.78e6,1804000,5.73e6,5766000],["BF34",false,1804000,1828000,5.73e6,5766000],["BF35",false,1828000,1852000,5.73e6,5766000],["BF36",false,1852000,1876000,5.73e6,5766000],["BF37",false,1876000,1.9e6,5.73e6,5766000],["BF38",false,1.9e6,1924000,5.73e6,5766000],["BF39",false,1924000,1948000,5.73e6,5766000],["BF40",false,1948000,1972000,5.73e6,5766000],["BF41",false,1972000,1996000,5.73e6,5766000],["BF42",false,1996000,2.02e6,5.73e6,5766000],["BF43",false,2.02e6,2044000,5.73e6,5766000],["BF44",false,2044000,2068000,5.73e6,5766000],["BF45",true,2.06e6,2084000,5.73e6,5766000],["BG30",true,1708000,1732000,5682000,5718000],["BG31",false,1732000,1756000,5694000,5.73e6],["BG32",false,1756000,1.78e6,5694000,5.73e6],["BG33",false,1.78e6,1804000,5694000,5.73e6],["BG34",false,1804000,1828000,5694000,5.73e6],["BG35",false,1828000,1852000,5694000,5.73e6],["BG36",false,1852000,1876000,5694000,5.73e6],["BG37",false,1876000,1.9e6,5694000,5.73e6],["BG38",false,1.9e6,1924000,5694000,5.73e6],["BG39",false,1924000,1948000,5694000,5.73e6],["BG40",false,1948000,1972000,5694000,5.73e6],["BG41",false,1972000,1996000,5694000,5.73e6],["BG42",false,1996000,2.02e6,5694000,5.73e6],["BG43",false,2.02e6,2044000,5694000,5.73e6],["BG44",false,2044000,2068000,5694000,5.73e6],["BH28",false,1.66e6,1684000,5658000,5694000],["BH29",false,1684000,1708000,5658000,5694000],["BH30",false,1708000,1732000,5658000,5694000],["BH31",false,1732000,1756000,5658000,5694000],["BH32",false,1756000,1.78e6,5658000,5694000],["BH33",false,1.78e6,1804000,5658000,5694000],["BH34",false,1804000,1828000,5658000,5694000],["BH35",false,1828000,1852000,5658000,5694000],["BH36",false,1852000,1876000,5658000,5694000],["BH37",false,1876000,1.9e6,5658000,5694000],["BH38",false,1.9e6,1924000,5658000,5694000],["BH39",false,1924000,1948000,5658000,5694000],["BH40",false,1948000,1972000,5658000,5694000],["BH41",false,1972000,1996000,5658000,5694000],["BH42",false,1996000,2.02e6,5658000,5694000],["BH43",false,2.02e6,2044000,5658000,5694000],["BJ28",false,1.66e6,1684000,5622000,5658000],["BJ29",false,1684000,1708000,5622000,5658000],["BJ30",false,1708000,1732000,5622000,5658000],["BJ31",false,1732000,1756000,5622000,5658000],["BJ32",false,1756000,1.78e6,5622000,5658000],["BJ33",false,1.78e6,1804000,5622000,5658000],["BJ34",false,1804000,1828000,5622000,5658000],["BJ35",false,1828000,1852000,5622000,5658000],["BJ36",false,1852000,1876000,5622000,5658000],["BJ37",false,1876000,1.9e6,5622000,5658000],["BJ38",false,1.9e6,1924000,5622000,5658000],["BJ39",false,1924000,1948000,5622000,5658000],["BJ40",true,1.94e6,1964000,5622000,5658000],["BJ43",true,2012000,2036000,5634000,5.67e6],["BK28",true,1.66e6,1684000,5598000,5634000],["BK29",false,1684000,1708000,5586000,5622000],["BK30",false,1708000,1732000,5586000,5622000],["BK31",false,1732000,1756000,5586000,5622000],["BK32",false,1756000,1.78e6,5586000,5622000],["BK33",false,1.78e6,1804000,5586000,5622000],["BK34",false,1804000,1828000,5586000,5622000],["BK35",false,1828000,1852000,5586000,5622000],["BK36",false,1852000,1876000,5586000,5622000],["BK37",false,1876000,1.9e6,5586000,5622000],["BK38",false,1.9e6,1924000,5586000,5622000],["BK39",false,1924000,1948000,5586000,5622000],["BK40",true,1.94e6,1964000,5586000,5622000],["BL31",true,1732000,1756000,5562000,5598000],["BL32",false,1756000,1.78e6,5.55e6,5586000],["BL33",false,1.78e6,1804000,5.55e6,5586000],["BL34",false,1804000,1828000,5.55e6,5586000],["BL35",false,1828000,1852000,5.55e6,5586000],["BL36",false,1852000,1876000,5.55e6,5586000],["BL37",false,1876000,1.9e6,5.55e6,5586000],["BL38",false,1.9e6,1924000,5.55e6,5586000],["BL39",false,1924000,1948000,5.55e6,5586000],["BM24",true,1564000,1588000,5502000,5538000],["BM25",true,1588000,1612000,5502000,5538000],["BM33",false,1.78e6,1804000,5514000,5.55e6],["BM34",false,1804000,1828000,5514000,5.55e6],["BM35",false,1828000,1852000,5514000,5.55e6],["BM36",false,1852000,1876000,5514000,5.55e6],["BM37",false,1876000,1.9e6,5514000,5.55e6],["BM38",false,1.9e6,1924000,5514000,5.55e6],["BM39",true,1916000,1.94e6,5514000,5.55e6],["BN22",false,1516000,1.54e6,5478000,5514000],["BN23",false,1.54e6,1564000,5478000,5514000],["BN24",false,1564000,1588000,5478000,5514000],["BN25",false,1588000,1612000,5478000,5514000],["BN28",false,1.66e6,1684000,5478000,5514000],["BN29",true,1676000,1.7e6,5478000,5514000],["BN32",true,1756000,1.78e6,5466000,5502000],["BN33",false,1.78e6,1804000,5478000,5514000],["BN34",false,1804000,1828000,5478000,5514000],["BN35",false,1828000,1852000,5478000,5514000],["BN36",false,1852000,1876000,5478000,5514000],["BN37",false,1876000,1.9e6,5478000,5514000],["BN38",true,1892000,1916000,5478000,5514000],["BP22",false,1516000,1.54e6,5442000,5478000],["BP23",false,1.54e6,1564000,5442000,5478000],["BP24",false,1564000,1588000,5442000,5478000],["BP25",false,1588000,1612000,5442000,5478000],["BP26",true,1.62e6,1644000,5442000,5478000],["BP27",false,1636000,1.66e6,5442000,5478000],["BP28",false,1.66e6,1684000,5442000,5478000],["BP29",false,1684000,1708000,5442000,5478000],["BP30",true,1708000,1732000,5.43e6,5466000],["BP31",false,1732000,1756000,5442000,5478000],["BP32",false,1756000,1.78e6,5442000,5478000],["BP33",false,1.78e6,1804000,5442000,5478000],["BP34",false,1804000,1828000,5442000,5478000],["BP35",false,1828000,1852000,5442000,5478000],["BP36",false,1852000,1876000,5442000,5478000],["BQ21",true,1.5e6,1524000,5406000,5442000],["BQ22",false,1516000,1.54e6,5406000,5442000],["BQ23",false,1.54e6,1564000,5406000,5442000],["BQ24",false,1564000,1588000,5406000,5442000],["BQ25",false,1588000,1612000,5406000,5442000],["BQ26",false,1612000,1636000,5406000,5442000],["BQ27",false,1636000,1.66e6,5406000,5442000],["BQ28",false,1.66e6,1684000,5406000,5442000],["BQ29",false,1684000,1708000,5406000,5442000],["BQ31",false,1732000,1756000,5406000,5442000],["BQ32",false,1756000,1.78e6,5406000,5442000],["BQ33",false,1.78e6,1804000,5406000,5442000],["BQ34",false,1804000,1828000,5406000,5442000],["BQ35",false,1828000,1852000,5406000,5442000],["BQ36",true,1844000,1868000,5406000,5442000],["BR20",false,1468000,1492000,5.37e6,5406000],["BR21",false,1492000,1516000,5.37e6,5406000],["BR22",false,1516000,1.54e6,5.37e6,5406000],["BR23",false,1.54e6,1564000,5.37e6,5406000],["BR24",false,1564000,1588000,5.37e6,5406000],["BR25",false,1588000,1612000,5.37e6,5406000],["BR26",false,1612000,1636000,5.37e6,5406000],["BR27",false,1636000,1.66e6,5.37e6,5406000],["BR28",false,1.66e6,1684000,5.37e6,5406000],["BR29",false,1684000,1708000,5.37e6,5406000],["BR33",false,1.78e6,1804000,5.37e6,5406000],["BR34",false,1804000,1828000,5.37e6,5406000],["BS19",false,1444000,1468000,5334000,5.37e6],["BS20",false,1468000,1492000,5334000,5.37e6],["BS21",false,1492000,1516000,5334000,5.37e6],["BS22",false,1516000,1.54e6,5334000,5.37e6],["BS23",false,1.54e6,1564000,5334000,5.37e6],["BS24",false,1564000,1588000,5334000,5.37e6],["BS25",false,1588000,1612000,5334000,5.37e6],["BS26",false,1612000,1636000,5334000,5.37e6],["BS27",false,1636000,1.66e6,5334000,5.37e6],["BS28",false,1.66e6,1684000,5334000,5.37e6],["BS29",false,1684000,1708000,5334000,5.37e6],["BT19",false,1444000,1468000,5298000,5334000],["BT20",false,1468000,1492000,5298000,5334000],["BT21",false,1492000,1516000,5298000,5334000],["BT22",false,1516000,1.54e6,5298000,5334000],["BT23",false,1.54e6,1564000,5298000,5334000],["BT24",false,1564000,1588000,5298000,5334000],["BT25",false,1588000,1612000,5298000,5334000],["BT26",false,1612000,1636000,5298000,5334000],["BT27",false,1636000,1.66e6,5298000,5334000],["BT28",false,1.66e6,1684000,5298000,5334000],["BU18",false,1.42e6,1444000,5262000,5298000],["BU19",false,1444000,1468000,5262000,5298000],["BU20",false,1468000,1492000,5262000,5298000],["BU21",false,1492000,1516000,5262000,5298000],["BU22",false,1516000,1.54e6,5262000,5298000],["BU23",false,1.54e6,1564000,5262000,5298000],["BU24",false,1564000,1588000,5262000,5298000],["BU25",false,1588000,1612000,5262000,5298000],["BU26",false,1612000,1636000,5262000,5298000],["BU27",false,1636000,1.66e6,5262000,5298000],["BV16",false,1372000,1396000,5226000,5262000],["BV17",false,1396000,1.42e6,5226000,5262000],["BV18",false,1.42e6,1444000,5226000,5262000],["BV19",false,1444000,1468000,5226000,5262000],["BV20",false,1468000,1492000,5226000,5262000],["BV21",false,1492000,1516000,5226000,5262000],["BV22",false,1516000,1.54e6,5226000,5262000],["BV23",false,1.54e6,1564000,5226000,5262000],["BV24",false,1564000,1588000,5226000,5262000],["BV25",false,1588000,1612000,5226000,5262000],["BV26",false,1612000,1636000,5226000,5262000],["BW14",true,1324000,1348000,5178000,5214000],["BW15",false,1348000,1372000,5.19e6,5226000],["BW16",false,1372000,1396000,5.19e6,5226000],["BW17",false,1396000,1.42e6,5.19e6,5226000],["BW18",false,1.42e6,1444000,5.19e6,5226000],["BW19",false,1444000,1468000,5.19e6,5226000],["BW20",false,1468000,1492000,5.19e6,5226000],["BW21",false,1492000,1516000,5.19e6,5226000],["BW22",false,1516000,1.54e6,5.19e6,5226000],["BW23",false,1.54e6,1564000,5.19e6,5226000],["BW24",false,1564000,1588000,5.19e6,5226000],["BW25",true,1.58e6,1604000,5.19e6,5226000],["BX12",true,1276000,1.3e6,5142000,5178000],["BX13",false,1.3e6,1324000,5154000,5.19e6],["BX14",false,1324000,1348000,5154000,5.19e6],["BX15",false,1348000,1372000,5154000,5.19e6],["BX16",false,1372000,1396000,5154000,5.19e6],["BX17",false,1396000,1.42e6,5154000,5.19e6],["BX18",false,1.42e6,1444000,5154000,5.19e6],["BX19",false,1444000,1468000,5154000,5.19e6],["BX20",false,1468000,1492000,5154000,5.19e6],["BX21",false,1492000,1516000,5154000,5.19e6],["BX22",false,1516000,1.54e6,5154000,5.19e6],["BX23",false,1.54e6,1564000,5154000,5.19e6],["BX24",false,1564000,1588000,5154000,5.19e6],["BX25",false,1588000,1612000,5154000,5.19e6],["BY10",true,1228000,1252000,5106000,5142000],["BY11",false,1252000,1276000,5118000,5154000],["BY12",false,1276000,1.3e6,5118000,5154000],["BY13",false,1.3e6,1324000,5118000,5154000],["BY14",false,1324000,1348000,5118000,5154000],["BY15",false,1348000,1372000,5118000,5154000],["BY16",false,1372000,1396000,5118000,5154000],["BY17",false,1396000,1.42e6,5118000,5154000],["BY18",false,1.42e6,1444000,5118000,5154000],["BY19",false,1444000,1468000,5118000,5154000],["BY20",false,1468000,1492000,5118000,5154000],["BY21",false,1492000,1516000,5118000,5154000],["BY22",false,1516000,1.54e6,5118000,5154000],["BY23",false,1.54e6,1564000,5118000,5154000],["BY24",false,1564000,1588000,5118000,5154000],["BY25",false,1588000,1612000,5118000,5154000],["BZ09",false,1204000,1228000,5082000,5118000],["BZ10",false,1228000,1252000,5082000,5118000],["BZ11",false,1252000,1276000,5082000,5118000],["BZ12",false,1276000,1.3e6,5082000,5118000],["BZ13",false,1.3e6,1324000,5082000,5118000],["BZ14",false,1324000,1348000,5082000,5118000],["BZ15",false,1348000,1372000,5082000,5118000],["BZ16",false,1372000,1396000,5082000,5118000],["BZ17",false,1396000,1.42e6,5082000,5118000],["BZ18",false,1.42e6,1444000,5082000,5118000],["BZ19",false,1444000,1468000,5082000,5118000],["BZ20",false,1468000,1492000,5082000,5118000],["BZ21",true,1484000,1508000,5082000,5118000],["CA07",true,1156000,1.18e6,5034000,5.07e6],["CA08",false,1.18e6,1204000,5046000,5082000],["CA09",false,1204000,1228000,5046000,5082000],["CA10",false,1228000,1252000,5046000,5082000],["CA11",false,1252000,1276000,5046000,5082000],["CA12",false,1276000,1.3e6,5046000,5082000],["CA13",false,1.3e6,1324000,5046000,5082000],["CA14",false,1324000,1348000,5046000,5082000],["CA15",false,1348000,1372000,5046000,5082000],["CA16",false,1372000,1396000,5046000,5082000],["CA17",false,1396000,1.42e6,5046000,5082000],["CA18",false,1.42e6,1444000,5046000,5082000],["CA19",false,1444000,1468000,5046000,5082000],["CB06",false,1132000,1156000,5.01e6,5046000],["CB07",false,1156000,1.18e6,5.01e6,5046000],["CB08",false,1.18e6,1204000,5.01e6,5046000],["CB09",false,1204000,1228000,5.01e6,5046000],["CB10",false,1228000,1252000,5.01e6,5046000],["CB11",false,1252000,1276000,5.01e6,5046000],["CB12",false,1276000,1.3e6,5.01e6,5046000],["CB13",false,1.3e6,1324000,5.01e6,5046000],["CB14",false,1324000,1348000,5.01e6,5046000],["CB15",false,1348000,1372000,5.01e6,5046000],["CB16",false,1372000,1396000,5.01e6,5046000],["CB17",false,1396000,1.42e6,5.01e6,5046000],["CB18",false,1.42e6,1444000,5.01e6,5046000],["CB19",false,1444000,1468000,5.01e6,5046000],["CC05",false,1108000,1132000,4974000,5.01e6],["CC06",false,1132000,1156000,4974000,5.01e6],["CC07",false,1156000,1.18e6,4974000,5.01e6],["CC08",false,1.18e6,1204000,4974000,5.01e6],["CC09",false,1204000,1228000,4974000,5.01e6],["CC10",false,1228000,1252000,4974000,5.01e6],["CC11",false,1252000,1276000,4974000,5.01e6],["CC12",false,1276000,1.3e6,4974000,5.01e6],["CC13",false,1.3e6,1324000,4974000,5.01e6],["CC14",false,1324000,1348000,4974000,5.01e6],["CC15",false,1348000,1372000,4974000,5.01e6],["CC16",false,1372000,1396000,4974000,5.01e6],["CC17",false,1396000,1.42e6,4974000,5.01e6],["CC18",false,1.42e6,1444000,4974000,5.01e6],["CC19",true,1436000,1.46e6,4974000,5.01e6],["CD04",true,1092000,1116000,4938000,4974000],["CD05",false,1108000,1132000,4938000,4974000],["CD06",false,1132000,1156000,4938000,4974000],["CD07",false,1156000,1.18e6,4938000,4974000],["CD08",false,1.18e6,1204000,4938000,4974000],["CD09",false,1204000,1228000,4938000,4974000],["CD10",false,1228000,1252000,4938000,4974000],["CD11",false,1252000,1276000,4938000,4974000],["CD12",false,1276000,1.3e6,4938000,4974000],["CD13",false,1.3e6,1324000,4938000,4974000],["CD14",false,1324000,1348000,4938000,4974000],["CD15",false,1348000,1372000,4938000,4974000],["CD16",false,1372000,1396000,4938000,4974000],["CD17",false,1396000,1.42e6,4938000,4974000],["CD18",false,1.42e6,1444000,4938000,4974000],["CE04",false,1084000,1108000,4902000,4938000],["CE05",false,1108000,1132000,4902000,4938000],["CE06",false,1132000,1156000,4902000,4938000],["CE07",false,1156000,1.18e6,4902000,4938000],["CE08",false,1.18e6,1204000,4902000,4938000],["CE09",false,1204000,1228000,4902000,4938000],["CE10",false,1228000,1252000,4902000,4938000],["CE11",false,1252000,1276000,4902000,4938000],["CE12",false,1276000,1.3e6,4902000,4938000],["CE13",false,1.3e6,1324000,4902000,4938000],["CE14",false,1324000,1348000,4902000,4938000],["CE15",false,1348000,1372000,4902000,4938000],["CE16",false,1372000,1396000,4902000,4938000],["CE17",false,1396000,1.42e6,4902000,4938000],["CE18",false,1.42e6,1444000,4902000,4938000],["CF04",false,1084000,1108000,4866000,4902000],["CF05",false,1108000,1132000,4866000,4902000],["CF06",false,1132000,1156000,4866000,4902000],["CF07",false,1156000,1.18e6,4866000,4902000],["CF08",false,1.18e6,1204000,4866000,4902000],["CF09",false,1204000,1228000,4866000,4902000],["CF10",false,1228000,1252000,4866000,4902000],["CF11",false,1252000,1276000,4866000,4902000],["CF12",false,1276000,1.3e6,4866000,4902000],["CF13",false,1.3e6,1324000,4866000,4902000],["CF14",false,1324000,1348000,4866000,4902000],["CF15",false,1348000,1372000,4866000,4902000],["CF16",false,1372000,1396000,4866000,4902000],["CG05",false,1108000,1132000,4.83e6,4866000],["CG06",false,1132000,1156000,4.83e6,4866000],["CG07",true,1156000,1.18e6,4842000,4878000],["CG08",false,1.18e6,1204000,4.83e6,4866000],["CG09",false,1204000,1228000,4.83e6,4866000],["CG10",false,1228000,1252000,4.83e6,4866000],["CG11",false,1252000,1276000,4.83e6,4866000],["CG12",false,1276000,1.3e6,4.83e6,4866000],["CG13",false,1.3e6,1324000,4.83e6,4866000],["CG14",false,1324000,1348000,4.83e6,4866000],["CG15",false,1348000,1372000,4.83e6,4866000],["CH05",true,1.12e6,1144000,4794000,4.83e6],["CH08",false,1.18e6,1204000,4794000,4.83e6],["CH09",false,1204000,1228000,4794000,4.83e6],["CH10",false,1228000,1252000,4794000,4.83e6],["CH11",false,1252000,1276000,4794000,4.83e6],["CH12",false,1276000,1.3e6,4794000,4.83e6],["CH13",false,1.3e6,1324000,4794000,4.83e6],["CJ07",true,1156000,1.18e6,4.74e6,4776000],["CJ08",false,1.18e6,1204000,4758000,4794000],["CJ09",false,1204000,1228000,4758000,4794000],["CJ10",false,1228000,1252000,4758000,4794000],["CK08",false,1.18e6,1204000,4722000,4758000]];Proj4js={defaultDatum:"WGS84",transform:function(b,c,a){if(!b.readyToUse||!c.readyToUse){this.reportError("Proj4js initialization for "+b.srsCode+" not yet complete");return a}if(b.srsProjNumber=="900913"&&c.datumCode!="WGS84"||c.srsProjNumber=="900913"&&b.datumCode!="WGS84"){var d=Proj4js.WGS84;this.transform(b,d,a);b=d}if(b.projName=="longlat"){a.x*=Proj4js.common.D2R;a.y*=Proj4js.common.D2R}else{if(b.to_meter){a.x*=b.to_meter;a.y*=b.to_meter}b.inverse(a)}if(b.from_greenwich)a.x+=b.from_greenwich;a=this.datum_transform(b.datum,c.datum,a);if(c.from_greenwich)a.x-=c.from_greenwich;if(c.projName=="longlat"){a.x*=Proj4js.common.R2D;a.y*=Proj4js.common.R2D}else{c.forward(a);if(c.to_meter){a.x/=c.to_meter;a.y/=c.to_meter}}return a},datum_transform:function(b,a,c){if(b.compare_datums(a))return c;if(b.datum_type==Proj4js.common.PJD_NODATUM||a.datum_type==Proj4js.common.PJD_NODATUM)return c;b.datum_type==Proj4js.common.PJD_GRIDSHIFT&&alert("ERROR: Grid shift transformations are not implemented yet.");a.datum_type==Proj4js.common.PJD_GRIDSHIFT&&alert("ERROR: Grid shift transformations are not implemented yet.");if(b.es!=a.es||b.a!=a.a||b.datum_type==Proj4js.common.PJD_3PARAM||b.datum_type==Proj4js.common.PJD_7PARAM||a.datum_type==Proj4js.common.PJD_3PARAM||a.datum_type==Proj4js.common.PJD_7PARAM){b.geodetic_to_geocentric(c);(b.datum_type==Proj4js.common.PJD_3PARAM||b.datum_type==Proj4js.common.PJD_7PARAM)&&b.geocentric_to_wgs84(c);(a.datum_type==Proj4js.common.PJD_3PARAM||a.datum_type==Proj4js.common.PJD_7PARAM)&&a.geocentric_from_wgs84(c);a.geocentric_to_geodetic(c)}a.datum_type==Proj4js.common.PJD_GRIDSHIFT&&alert("ERROR: Grid shift transformations are not implemented yet.");return c},reportError:function(){},extend:function(a,b){a=a||{};if(b)for(var c in b){var d=b[c];if(d!==undefined)a[c]=d}return a},Class:function(){for(var d=function(){this.initialize.apply(this,arguments)},c={},b,a=0;a<arguments.length;++a){if(typeof arguments[a]=="function")b=arguments[a].prototype;else b=arguments[a];Proj4js.extend(c,b)}d.prototype=c;return d},bind:function(c,a){var b=Array.prototype.slice.apply(arguments,[2]);return function(){var d=b.concat(Array.prototype.slice.apply(arguments,[0]));return c.apply(a,d)}},scriptName:"proj4js.js",defsLookupService:"http://spatialreference.org/ref",libPath:null,getScriptLocation:function(){if(this.libPath)return this.libPath;for(var d=this.scriptName,c=d.length,e=document.getElementsByTagName("script"),b=0;b<e.length;b++){var a=e[b].getAttribute("src");if(a){var f=a.lastIndexOf(d);if(f>-1&&f+c==a.length){this.libPath=a.slice(0,-c);break}}}return this.libPath||""},loadScript:function(b,e,d,c){var a=document.createElement("script");a.defer=false;a.type="text/javascript";a.id=b;a.src=b;a.onload=e;a.onerror=d;a.loadCheck=c;if(/MSIE/.test(navigator.userAgent))a.onreadystatechange=this.checkReadyState;document.getElementsByTagName("head")[0].appendChild(a)},checkReadyState:function(){if(this.readyState=="loaded")if(!this.loadCheck())this.onerror();else this.onload()}};Proj4js.Proj=Proj4js.Class({readyToUse:false,title:null,projName:null,units:null,datum:null,x0:0,y0:0,initialize:function(a){this.srsCodeInput=a;if(a.indexOf("urn:")==0){var b=a.split(":");if((b[1]=="ogc"||b[1]=="x-ogc")&&b[2]=="def"&&b[3]=="crs")a=b[4]+":"+b[b.length-1]}else if(a.indexOf("http://")==0){var c=a.split("#");if(c[0].match(/epsg.org/))a="EPSG:"+c[1];else if(c[0].match(/RIG.xml/))a="IGNF:"+c[1]}this.srsCode=a.toUpperCase();if(this.srsCode.indexOf("EPSG")==0){this.srsCode=this.srsCode;this.srsAuth="epsg";this.srsProjNumber=this.srsCode.substring(5)}else if(this.srsCode.indexOf("IGNF")==0){this.srsCode=this.srsCode;this.srsAuth="IGNF";this.srsProjNumber=this.srsCode.substring(5)}else if(this.srsCode.indexOf("CRS")==0){this.srsCode=this.srsCode;this.srsAuth="CRS";this.srsProjNumber=this.srsCode.substring(4)}else{this.srsAuth="";this.srsProjNumber=this.srsCode}this.loadProjDefinition()},loadProjDefinition:function(){if(Proj4js.defs[this.srsCode]){this.defsLoaded();return}var a=Proj4js.getScriptLocation()+"defs/"+this.srsAuth.toUpperCase()+this.srsProjNumber+".js";Proj4js.loadScript(a,Proj4js.bind(this.defsLoaded,this),Proj4js.bind(this.loadFromService,this),Proj4js.bind(this.checkDefsLoaded,this))},loadFromService:function(){var a=Proj4js.defsLookupService+"/"+this.srsAuth+"/"+this.srsProjNumber+"/proj4js/";Proj4js.loadScript(a,Proj4js.bind(this.defsLoaded,this),Proj4js.bind(this.defsFailed,this),Proj4js.bind(this.checkDefsLoaded,this))},defsLoaded:function(){this.parseDefs();this.loadProjCode(this.projName)},checkDefsLoaded:function(){return Proj4js.defs[this.srsCode]?true:false},defsFailed:function(){Proj4js.reportError("failed to load projection definition for: "+this.srsCode);Proj4js.defs[this.srsCode]=Proj4js.defs.WGS84;this.defsLoaded()},loadProjCode:function(a){if(Proj4js.Proj[a]){this.initTransforms();return}var b=Proj4js.getScriptLocation()+"projCode/"+a+".js";Proj4js.loadScript(b,Proj4js.bind(this.loadProjCodeSuccess,this,a),Proj4js.bind(this.loadProjCodeFailure,this,a),Proj4js.bind(this.checkCodeLoaded,this,a))},loadProjCodeSuccess:function(a){if(Proj4js.Proj[a].dependsOn)this.loadProjCode(Proj4js.Proj[a].dependsOn);else this.initTransforms()},loadProjCodeFailure:function(a){Proj4js.reportError("failed to find projection file for: "+a)},checkCodeLoaded:function(a){return Proj4js.Proj[a]?true:false},initTransforms:function(){Proj4js.extend(this,Proj4js.Proj[this.projName]);this.init();this.readyToUse=true},parseDefs:function(){this.defData=Proj4js.defs[this.srsCode];var d,a;if(!this.defData)return;for(var c=this.defData.split("+"),b=0;b<c.length;b++){var e=c[b].split("=");d=e[0].toLowerCase();a=e[1];switch(d.replace(/\s/gi,"")){case"title":this.title=a;break;case"proj":this.projName=a.replace(/\s/gi,"");break;case"units":this.units=a.replace(/\s/gi,"");break;case"datum":this.datumCode=a.replace(/\s/gi,"");break;case"nadgrids":this.nagrids=a.replace(/\s/gi,"");break;case"ellps":this.ellps=a.replace(/\s/gi,"");break;case"a":this.a=parseFloat(a);break;case"b":this.b=parseFloat(a);break;case"rf":this.rf=parseFloat(a);break;case"lat_0":this.lat0=a*Proj4js.common.D2R;break;case"lat_1":this.lat1=a*Proj4js.common.D2R;break;case"lat_2":this.lat2=a*Proj4js.common.D2R;break;case"lat_ts":this.lat_ts=a*Proj4js.common.D2R;break;case"lon_0":this.long0=a*Proj4js.common.D2R;break;case"alpha":this.alpha=parseFloat(a)*Proj4js.common.D2R;break;case"lonc":this.longc=a*Proj4js.common.D2R;break;case"x_0":this.x0=parseFloat(a);break;case"y_0":this.y0=parseFloat(a);break;case"k_0":this.k0=parseFloat(a);break;case"k":this.k0=parseFloat(a);break;case"r_a":this.R_A=true;break;case"zone":this.zone=parseInt(a);break;case"south":this.utmSouth=true;break;case"towgs84":this.datum_params=a.split(",");break;case"to_meter":this.to_meter=parseFloat(a);break;case"from_greenwich":this.from_greenwich=a*Proj4js.common.D2R;break;case"pm":a=a.replace(/\s/gi,"");this.from_greenwich=Proj4js.PrimeMeridian[a]?Proj4js.PrimeMeridian[a]:parseFloat(a);this.from_greenwich*=Proj4js.common.D2R}}this.deriveConstants()},deriveConstants:function(){if(this.nagrids=="@null")this.datumCode="none";if(this.datumCode&&this.datumCode!="none"){var a=Proj4js.Datum[this.datumCode];if(a){this.datum_params=a.towgs84?a.towgs84.split(","):null;this.ellps=a.ellipse;this.datumName=a.datumName?a.datumName:this.datumCode}}if(!this.a){var b=Proj4js.Ellipsoid[this.ellps]?Proj4js.Ellipsoid[this.ellps]:Proj4js.Ellipsoid.WGS84;Proj4js.extend(this,b)}if(this.rf&&!this.b)this.b=(1-1/this.rf)*this.a;if(Math.abs(this.a-this.b)<Proj4js.common.EPSLN){this.sphere=true;this.b=this.a}this.a2=this.a*this.a;this.b2=this.b*this.b;this.es=(this.a2-this.b2)/this.a2;this.e=Math.sqrt(this.es);if(this.R_A){this.a*=1-this.es*(Proj4js.common.SIXTH+this.es*(Proj4js.common.RA4+this.es*Proj4js.common.RA6));this.a2=this.a*this.a;this.b2=this.b*this.b;this.es=0}this.ep2=(this.a2-this.b2)/this.b2;if(!this.k0)this.k0=1;this.datum=new Proj4js.datum(this)}});Proj4js.Proj.longlat={init:function(){},forward:function(a){return a},inverse:function(a){return a}};Proj4js.defs={WGS84:"+title=long/lat:WGS84 +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees","EPSG:4326":"+title=long/lat:WGS84 +proj=longlat +a=6378137.0 +b=6356752.31424518 +ellps=WGS84 +datum=WGS84 +units=degrees","EPSG:4269":"+title=long/lat:NAD83 +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees","EPSG:3785":"+title= Google Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"};Proj4js.defs.GOOGLE=Proj4js.defs["EPSG:3785"];Proj4js.defs["EPSG:900913"]=Proj4js.defs["EPSG:3785"];Proj4js.defs["EPSG:102113"]=Proj4js.defs["EPSG:3785"];Proj4js.common={PI:3.1415926535897931,HALF_PI:1.5707963267949e0,TWO_PI:6.2831853071795862,FORTPI:.78539816339744828,R2D:57.295779513082323,D2R:.017453292519943295,SEC_TO_RAD:4.84813681109536e-6,EPSLN:1e-10,MAX_ITER:20,COS_67P5:.38268343236508978,AD_C:1.0026,PJD_UNKNOWN:0,PJD_3PARAM:1,PJD_7PARAM:2,PJD_GRIDSHIFT:3,PJD_WGS84:4,PJD_NODATUM:5,SRS_WGS84_SEMIMAJOR:6378137,SIXTH:.16666666666666666,RA4:.047222222222222221,RA6:.022156084656084655,RV4:.069444444444444448,RV6:.042438271604938273,msfnz:function(c,d,b){var a=c*d;return b/Math.sqrt(1-a*a)},tsfnz:function(b,e,c){var a=b*c,d=.5*b;a=Math.pow((1-a)/(1+a),d);return Math.tan(.5*(this.HALF_PI-e))/a},phi2z:function(d,e){var f=.5*d,c,b,a=this.HALF_PI-2*Math.atan(e);for(i=0;i<=15;i++){c=d*Math.sin(a);b=this.HALF_PI-2*Math.atan(e*Math.pow((1-c)/(1+c),f))-a;a+=b;if(Math.abs(b)<=1e-10)return a}alert("phi2z has NoConvergence");return-9999},qsfnz:function(a,c){var b;if(a>1e-7){b=a*c;return(1-a*a)*(c/(1-b*b)-.5/a*Math.log((1-b)/(1+b)))}else return 2*c},asinz:function(a){if(Math.abs(a)>1)a=a>1?1:-1;return Math.asin(a)},e0fn:function(a){return 1-.25*a*(1+a/16*(3+1.25*a))},e1fn:function(a){return.375*a*(1+.25*a*(1+.46875*a))},e2fn:function(a){return.05859375*a*a*(1+.75*a)},e3fn:function(a){return a*a*a*(35/3072)},mlfn:function(b,c,d,e,a){return b*a-c*Math.sin(2*a)+d*Math.sin(4*a)-e*Math.sin(6*a)},srat:function(a,b){return Math.pow((1-a)/(1+a),b)},sign:function(a){return a<0?-1:1},adjust_lon:function(a){a=Math.abs(a)<this.PI?a:a-this.sign(a)*this.TWO_PI;return a},adjust_lat:function(a){a=Math.abs(a)<this.HALF_PI?a:a-this.sign(a)*this.PI;return a},latiso:function(b,a,d){if(Math.abs(a)>this.HALF_PI)return+Number.NaN;if(a==this.HALF_PI)return Number.POSITIVE_INFINITY;if(a==-1*this.HALF_PI)return-1*Number.POSITIVE_INFINITY;var c=b*d;return Math.log(Math.tan((this.HALF_PI+a)/2))+b*Math.log((1-c)/(1+c))/2},fL:function(b,a){return 2*Math.atan(b*Math.exp(a))-this.HALF_PI},invlatiso:function(d,e){var a=this.fL(1,e),b=0,c=0;do{b=a;c=d*Math.sin(b);a=this.fL(Math.exp(d*Math.log((1+c)/(1-c))/2),e)}while(Math.abs(a-b)>1e-12);return a},sinh:function(b){var a=Math.exp(b);a=(a-1/a)/2;return a},cosh:function(b){var a=Math.exp(b);a=(a+1/a)/2;return a},tanh:function(b){var a=Math.exp(b);a=(a-1/a)/(a+1/a);return a},asinh:function(a){var b=a>=0?1:-1;return b*Math.log(Math.abs(a)+Math.sqrt(a*a+1))},acosh:function(a){return 2*Math.log(Math.sqrt((a+1)/2)+Math.sqrt((a-1)/2))},atanh:function(a){return Math.log((a-1)/(a+1))/2},gN:function(c,d,b){var a=d*b;return c/Math.sqrt(1-a*a)}};Proj4js.datum=Proj4js.Class({initialize:function(a){this.datum_type=Proj4js.common.PJD_WGS84;if(a.datumCode&&a.datumCode=="none")this.datum_type=Proj4js.common.PJD_NODATUM;if(a&&a.datum_params){for(var b=0;b<a.datum_params.length;b++)a.datum_params[b]=parseFloat(a.datum_params[b]);if(a.datum_params[0]!=0||a.datum_params[1]!=0||a.datum_params[2]!=0)this.datum_type=Proj4js.common.PJD_3PARAM;if(a.datum_params.length>3)if(a.datum_params[3]!=0||a.datum_params[4]!=0||a.datum_params[5]!=0||a.datum_params[6]!=0){this.datum_type=Proj4js.common.PJD_7PARAM;a.datum_params[3]*=Proj4js.common.SEC_TO_RAD;a.datum_params[4]*=Proj4js.common.SEC_TO_RAD;a.datum_params[5]*=Proj4js.common.SEC_TO_RAD;a.datum_params[6]=a.datum_params[6]/1e6+1}}if(a){this.a=a.a;this.b=a.b;this.es=a.es;this.ep2=a.ep2;this.datum_params=a.datum_params}},compare_datums:function(a){return this.datum_type!=a.datum_type?false:this.a!=a.a||Math.abs(this.es-a.es)>5e-11?false:this.datum_type==Proj4js.common.PJD_3PARAM?this.datum_params[0]==a.datum_params[0]&&this.datum_params[1]==a.datum_params[1]&&this.datum_params[2]==a.datum_params[2]:this.datum_type==Proj4js.common.PJD_7PARAM?this.datum_params[0]==a.datum_params[0]&&this.datum_params[1]==a.datum_params[1]&&this.datum_params[2]==a.datum_params[2]&&this.datum_params[3]==a.datum_params[3]&&this.datum_params[4]==a.datum_params[4]&&this.datum_params[5]==a.datum_params[5]&&this.datum_params[6]==a.datum_params[6]:this.datum_type==Proj4js.common.PJD_GRIDSHIFT?strcmp(pj_param(this.params,"snadgrids").s,pj_param(a.params,"snadgrids").s)==0:true},geodetic_to_geocentric:function(b){var c=b.x,a=b.y,g=b.z?b.z:0,i,j,k,l=0,e,d,h,f;if(a<-Proj4js.common.HALF_PI&&a>-1.001*Proj4js.common.HALF_PI)a=-Proj4js.common.HALF_PI;else if(a>Proj4js.common.HALF_PI&&a<1.001*Proj4js.common.HALF_PI)a=Proj4js.common.HALF_PI;else if(a<-Proj4js.common.HALF_PI||a>Proj4js.common.HALF_PI){Proj4js.reportError("geocent:lat out of range:"+a);return null}if(c>Proj4js.common.PI)c-=2*Proj4js.common.PI;d=Math.sin(a);f=Math.cos(a);h=d*d;e=this.a/Math.sqrt(1-this.es*h);i=(e+g)*f*Math.cos(c);j=(e+g)*f*Math.sin(c);k=(e*(1-this.es)+g)*d;b.x=i;b.y=j;b.z=k;return l},geocentric_to_geodetic:function(b){var i=1e-12,x=i*i,w=30,o,n,u,c,d,l,m,h,a,j,k,s,v,t,e=b.x,f=b.y,p=b.z?b.z:0,q,r,g;v=false;o=Math.sqrt(e*e+f*f);n=Math.sqrt(e*e+f*f+p*p);if(o/this.a<i){v=true;q=0;if(n/this.a<i){r=Proj4js.common.HALF_PI;g=-this.b;return}}else q=Math.atan2(f,e);u=p/n;c=o/n;d=1/Math.sqrt(1-this.es*(2-this.es)*c*c);h=c*(1-this.es)*d;a=u*d;t=0;do{t++;m=this.a/Math.sqrt(1-this.es*a*a);g=o*h+p*a-m*(1-this.es*a*a);l=this.es*m/(m+g);d=1/Math.sqrt(1-l*(2-l)*c*c);j=c*(1-l)*d;k=u*d;s=k*h-j*a;h=j;a=k}while(s*s>x&&t<w);r=Math.atan(k/Math.abs(j));b.x=q;b.y=r;b.z=g;return b},geocentric_to_geodetic_noniter:function(a){var e=a.x,b=a.y,c=a.z?a.z:0,f,g,h,j,t,o,p,r,s,l,u,k,i,d,n,m,q;e=parseFloat(e);b=parseFloat(b);c=parseFloat(c);q=false;if(e!=0)f=Math.atan2(b,e);else if(b>0)f=Proj4js.common.HALF_PI;else if(b<0)f=-Proj4js.common.HALF_PI;else{q=true;f=0;if(c>0)g=Proj4js.common.HALF_PI;else if(c<0)g=-Proj4js.common.HALF_PI;else{g=Proj4js.common.HALF_PI;h=-this.b;return}}t=e*e+b*b;j=Math.sqrt(t);o=c*Proj4js.common.AD_C;r=Math.sqrt(o*o+t);l=o/r;k=j/r;u=l*l*l;p=c+this.b*this.ep2*u;m=j-this.a*this.es*k*k*k;s=Math.sqrt(p*p+m*m);i=p/s;d=m/s;n=this.a/Math.sqrt(1-this.es*i*i);if(d>=Proj4js.common.COS_67P5)h=j/d-n;else if(d<=-Proj4js.common.COS_67P5)h=j/-d-n;else h=c/i+n*(this.es-1);if(q==false)g=Math.atan(i/d);a.x=f;a.y=g;a.z=h;return a},geocentric_to_wgs84:function(a){if(this.datum_type==Proj4js.common.PJD_3PARAM){a.x+=this.datum_params[0];a.y+=this.datum_params[1];a.z+=this.datum_params[2]}else if(this.datum_type==Proj4js.common.PJD_7PARAM){var f=this.datum_params[0],g=this.datum_params[1],h=this.datum_params[2],c=this.datum_params[3],d=this.datum_params[4],e=this.datum_params[5],b=this.datum_params[6],i=b*(a.x-e*a.y+d*a.z)+f,j=b*(e*a.x+a.y-c*a.z)+g,k=b*(-d*a.x+c*a.y+a.z)+h;a.x=i;a.y=j;a.z=k}},geocentric_from_wgs84:function(a){if(this.datum_type==Proj4js.common.PJD_3PARAM){a.x-=this.datum_params[0];a.y-=this.datum_params[1];a.z-=this.datum_params[2]}else if(this.datum_type==Proj4js.common.PJD_7PARAM){var i=this.datum_params[0],j=this.datum_params[1],k=this.datum_params[2],f=this.datum_params[3],g=this.datum_params[4],h=this.datum_params[5],e=this.datum_params[6],b=(a.x-i)/e,c=(a.y-j)/e,d=(a.z-k)/e;a.x=b+h*c-g*d;a.y=-h*b+c+f*d;a.z=g*b-f*c+d}}});Proj4js.Point=Proj4js.Class({initialize:function(a,c,d){if(typeof a=="object"){this.x=a[0];this.y=a[1];this.z=a[2]||0}else if(typeof a=="string"){var b=a.split(",");this.x=parseFloat(b[0]);this.y=parseFloat(b[1]);this.z=parseFloat(b[2])||0}else{this.x=a;this.y=c;this.z=d||0}},clone:function(){return new Proj4js.Point(this.x,this.y,this.z)},toString:function(){return"x="+this.x+",y="+this.y},toShortString:function(){return this.x+", "+this.y}});Proj4js.PrimeMeridian={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667};Proj4js.Ellipsoid={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},"APL4.":{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS72:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}};Proj4js.Datum={WGS84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},GGRS87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},NAD83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},NAD27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},OSGB36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"}};Proj4js.WGS84=new Proj4js.Proj("WGS84");Proj4js.Datum.OSB36=Proj4js.Datum.OSGB36;Proj4js.Proj.tmerc={init:function(){this.e0=Proj4js.common.e0fn(this.es);this.e1=Proj4js.common.e1fn(this.es);this.e2=Proj4js.common.e2fn(this.es);this.e3=Proj4js.common.e3fn(this.es);this.ml0=this.a*Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(g){var p=g.x,d=g.y,i=Proj4js.common.adjust_lon(p-this.long0),a,j,k,o=Math.sin(d),h=Math.cos(d);if(this.sphere){var e=h*Math.sin(i);if(Math.abs(Math.abs(e)-1)<1e-10){Proj4js.reportError("tmerc:forward: Point projects into infinity");return 93}else{j=.5*this.a*this.k0*Math.log((1+e)/(1-e));a=Math.acos(h*Math.cos(i)/Math.sqrt(1-e*e));if(d<0)a=-a;k=this.a*this.k0*(a-this.lat0)}}else{var l=h*i,c=Math.pow(l,2),f=this.ep2*Math.pow(h,2),m=Math.tan(d),b=Math.pow(m,2);a=1-this.es*Math.pow(o,2);var n=this.a/Math.sqrt(a),q=this.a*Proj4js.common.mlfn(this.e0,this.e1,this.e2,this.e3,d);j=this.k0*n*l*(1+c/6*(1-b+f+c/20*(5-18*b+Math.pow(b,2)+72*f-58*this.ep2)))+this.x0;k=this.k0*(q-this.ml0+n*m*c*(.5+c/24*(5-b+9*f+4*Math.pow(f,2)+c/30*(61-58*b+Math.pow(b,2)+600*f-330*this.ep2))))+this.y0}g.x=j;g.y=k;return g},inverse:function(c){var b,a,k,m,v=6,d,e;if(this.sphere){var t=Math.exp(c.x/(this.a*this.k0)),i=.5*(t-1/t),q=this.lat0+c.y/(this.a*this.k0),j=Math.cos(q);b=Math.sqrt((1-j*j)/(1+i*i));d=Proj4js.common.asinz(b);if(q<0)d=-d;if(i==0&&j==0)e=this.long0;else e=Proj4js.common.adjust_lon(Math.atan2(i,j)+this.long0)}else{var y=c.x-this.x0,u=c.y-this.y0;b=(this.ml0+u/this.k0)/this.a;a=b;for(m=0;true;m++){k=(b+this.e1*Math.sin(2*a)-this.e2*Math.sin(4*a)+this.e3*Math.sin(6*a))/this.e0-a;a+=k;if(Math.abs(k)<=Proj4js.common.EPSLN)break;if(m>=v){Proj4js.reportError("tmerc:inverse: Latitude failed to converge");return 95}}if(Math.abs(a)<Proj4js.common.HALF_PI){var w=Math.sin(a),o=Math.cos(a),p=Math.tan(a),g=this.ep2*Math.pow(o,2),l=Math.pow(g,2),h=Math.pow(p,2),r=Math.pow(h,2);b=1-this.es*Math.pow(w,2);var n=this.a/Math.sqrt(b),x=n*(1-this.es)/b,s=y/(n*this.k0),f=Math.pow(s,2);d=a-n*p*f/x*(.5-f/24*(5+3*h+10*g-4*l-9*this.ep2-f/30*(61+90*h+298*g+45*r-252*this.ep2-3*l)));e=Proj4js.common.adjust_lon(this.long0+s*(1-f/6*(1+2*h+g-f/20*(5-2*g+28*h-3*l+8*this.ep2+24*r)))/o)}else{d=Proj4js.common.HALF_PI*Proj4js.common.sign(u);e=this.long0}}c.x=e;c.y=d;return c}};Proj4js.Proj.nzmg={iterations:1,init:function(){this.A=[];this.A[1]=.6399175073;this.A[2]=-.1358797613;this.A[3]=.063294409;this.A[4]=-.02526853;this.A[5]=.0117879;this.A[6]=-.0055161;this.A[7]=.0026906;this.A[8]=-.001333;this.A[9]=.00067;this.A[10]=-.00034;this.B_re=[];this.B_im=[];this.B_re[1]=.7557853228;this.B_im[1]=0;this.B_re[2]=.249204646;this.B_im[2]=.003371507;this.B_re[3]=-.001541739;this.B_im[3]=.04105856;this.B_re[4]=-.10162907;this.B_im[4]=.01727609;this.B_re[5]=-.26623489;this.B_im[5]=-.36249218;this.B_re[6]=-.6870983;this.B_im[6]=-1.1651967;this.C_re=[];this.C_im=[];this.C_re[1]=1.3231270439;this.C_im[1]=0;this.C_re[2]=-.577245789;this.C_im[2]=-.007809598;this.C_re[3]=.508307513;this.C_im[3]=-.112208952;this.C_re[4]=-.15094762;this.C_im[4]=.18200602;this.C_re[5]=1.01418179;this.C_im[5]=1.64497696;this.C_re[6]=1.9660549;this.C_im[6]=2.5127645;this.D=[];this.D[1]=1.5627014243;this.D[2]=.5185406398;this.D[3]=-.03333098;this.D[4]=-.1052906;this.D[5]=-.0368594;this.D[6]=.007317;this.D[7]=.0122;this.D[8]=.00394;this.D[9]=-.0013},forward:function(c){var r=c.x,q=c.y,l=q-this.lat0,m=r-this.long0,p=l/Proj4js.common.SEC_TO_RAD*1e-5,o=m,d=1,e=0;for(n=1;n<=10;n++){d=d*p;e=e+this.A[n]*d}var k=e,j=o,b=1,a=0,i,h,g=0,f=0;for(n=1;n<=6;n++){i=b*k-a*j;h=a*k+b*j;b=i;a=h;g=g+this.B_re[n]*b-this.B_im[n]*a;f=f+this.B_im[n]*b+this.B_re[n]*a}x=f*this.a+this.x0;y=g*this.a+this.y0;c.x=x;c.y=y;return c},inverse:function(j){var C=j.x,D=j.y,x=C-this.x0,y=D-this.y0,s=y/this.a,r=x/this.a,h=1,g=0,u,t,d=0,c=0;for(n=1;n<=6;n++){u=h*s-g*r;t=g*s+h*r;h=u;g=t;d=d+this.C_re[n]*h-this.C_im[n]*g;c=c+this.C_im[n]*h+this.C_re[n]*g}for(i=0;i<this.iterations;i++){var b=d,a=c,l,k,o=s,m=r;for(n=2;n<=6;n++){l=b*d-a*c;k=a*d+b*c;b=l;a=k;o=o+(n-1)*(this.B_re[n]*b-this.B_im[n]*a);m=m+(n-1)*(this.B_im[n]*b+this.B_re[n]*a)}b=1;a=0;var f=this.B_re[1],e=this.B_im[1];for(n=2;n<=6;n++){l=b*d-a*c;k=a*d+b*c;b=l;a=k;f=f+n*(this.B_re[n]*b-this.B_im[n]*a);e=e+n*(this.B_im[n]*b+this.B_re[n]*a)}var v=f*f+e*e;d=(o*f+m*e)/v;c=(m*f-o*e)/v}var z=d,w=c,p=1,q=0;for(n=1;n<=9;n++){p=p*z;q=q+this.D[n]*p}var A=this.lat0+q*Proj4js.common.SEC_TO_RAD*1e5,B=this.long0+w;j.x=B;j.y=A;return j}};Proj4js.defs["EPSG:27200"]="+proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000 +y_0=6023150 +ellps=intl +datum=nzgd49 +units=m +no_defs";Proj4js.defs["EPSG:2193"]="+proj=tmerc +lat_0=0 +lon_0=173 +k=0.9996 +x_0=1600000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs";function GPXParser(a,b){this.xmlDoc=a;this.map=b;this.trackcolour="#ff00ff";this.trackwidth=5;this.mintrackpointdelta=1e-4}GPXParser.prototype.setTrackColour=function(a){this.trackcolour=a};GPXParser.prototype.setTrackWidth=function(a){this.trackwidth=a};GPXParser.prototype.setMinTrackPointDelta=function(a){this.mintrackpointdelta=a};GPXParser.prototype.translateName=function(a){return a=="wpt"?"Waypoint":a=="trkpt"?"Track Point":void 0};GPXParser.prototype.createMarker=function(a){var l=parseFloat(a.getAttribute("lon")),k=parseFloat(a.getAttribute("lat")),c="",d=a.getElementsByTagName("html");if(d.length>0)for(i=0;i<d.item(0).childNodes.length;i++)c+=d.item(0).childNodes[i].nodeValue;else{c="<b>"+this.translateName(a.nodeName)+"</b><br>";var e=a.attributes,j=e.length;for(i=0;i<j;i++)c+=e.item(i).name+" = "+e.item(i).nodeValue+"<br>";if(a.hasChildNodes){var b=a.childNodes,g=b.length;for(i=0;i<g;i++){if(b[i].nodeType!=1)continue;if(b[i].firstChild==null)continue;c+=b[i].nodeName+" = "+b[i].firstChild.nodeValue+"<br>"}}}var f=new google.maps.Marker({position:new google.maps.LatLng(k,l),map:this.map}),h=new google.maps.InfoWindow({content:c,size:new google.maps.Size(50,50)});google.maps.event.addListener(f,"click",function(){h.open(this.map,f)})};GPXParser.prototype.addTrackSegmentToMap=function(k,l,m){var a=k.getElementsByTagName("trkpt");if(a.length==0)return;var c=[],e=parseFloat(a[0].getAttribute("lon")),d=parseFloat(a[0].getAttribute("lat")),f=new google.maps.LatLng(d,e);c.push(f);for(var b=1;b<a.length;b++){var h=parseFloat(a[b].getAttribute("lon")),g=parseFloat(a[b].getAttribute("lat")),i=g-d,j=h-e;if(Math.sqrt(i*i+j*j)>this.mintrackpointdelta){e=h;d=g;f=new google.maps.LatLng(g,h);c.push(f)}}var n=new google.maps.Polyline({path:c,strokeColor:l,strokeWidth:m,map:this.map})};GPXParser.prototype.addRouteSegmentToMap=function(k,l,m){var a=k.getElementsByTagName("rtept");if(a.length==0)return;var c=[],e=parseFloat(a[0].getAttribute("lon")),d=parseFloat(a[0].getAttribute("lat")),f=new google.maps.LatLng(d,e);c.push(f);for(var b=1;b<a.length;b++){var h=parseFloat(a[b].getAttribute("lon")),g=parseFloat(a[b].getAttribute("lat")),i=g-d,j=h-e;if(Math.sqrt(i*i+j*j)>this.mintrackpointdelta){e=h;d=g;f=new google.maps.LatLng(g,h);c.push(f)}}var n=new google.maps.Polyline({path:c,strokeColor:l,strokeWidth:m,map:this.map})};GPXParser.prototype.addTrackToMap=function(d,c,e){for(var b=d.getElementsByTagName("trkseg"),a=0;a<b.length;a++)var f=this.addTrackSegmentToMap(b[a],c,e)};GPXParser.prototype.centerAndZoom=function(k){for(var j=["trkpt","wpt","rtept"],a=0,c=0,e=0,d=0,i=0;i<j.length;i++){var b=k.getElementsByTagName(j[i]);if(b.length>0&&a==c&&a==0){a=parseFloat(b[0].getAttribute("lat"));c=parseFloat(b[0].getAttribute("lat"));e=parseFloat(b[0].getAttribute("lon"));d=parseFloat(b[0].getAttribute("lon"))}for(var h=0;h<b.length;h++){var g=parseFloat(b[h].getAttribute("lon")),f=parseFloat(b[h].getAttribute("lat"));if(g<e)e=g;if(g>d)d=g;if(f<a)a=f;if(f>c)c=f}}if(a==c&&a==0)return;var m=(d+e)/2,l=(c+a)/2,n=new google.maps.LatLngBounds(new google.maps.LatLng(a,e),new google.maps.LatLng(c,d));this.map.setCenter(new google.maps.LatLng(l,m));this.map.fitBounds(n)};GPXParser.prototype.centerAndZoomToLatLngBounds=function(c){for(var a=new google.maps.LatLngBounds,b=0;b<c.length;b++)if(!c[b].isEmpty()){a.extend(c[b].getSouthWest());a.extend(c[b].getNorthEast())}var d=(a.getNorthEast().lat()+a.getSouthWest().lat())/2,e=(a.getNorthEast().lng()+a.getSouthWest().lng())/2;this.map.setCenter(new GLatLng(d,e),this.map.getBoundsZoomLevel(a))};GPXParser.prototype.addTrackpointsToMap=function(){for(var b=this.xmlDoc.documentElement.getElementsByTagName("trk"),a=0;a<b.length;a++)this.addTrackToMap(b[a],this.trackcolour,this.trackwidth)};GPXParser.prototype.addWaypointsToMap=function(){for(var b=this.xmlDoc.documentElement.getElementsByTagName("wpt"),a=0;a<b.length;a++)this.createMarker(b[a])};GPXParser.prototype.addRoutepointsToMap=function(){for(var b=this.xmlDoc.documentElement.getElementsByTagName("rte"),a=0;a<b.length;a++)this.addRouteSegmentToMap(b[a],this.trackcolour,this.trackwidth)};var nztopomap={};nztopomap.TOPO_ZOOM_MIN=5;nztopomap.TOPO_ZOOM_MAX=15;nztopomap.TOPO250_ZOOM_MIN=5;nztopomap.TOPO250_ZOOM_MAX=12;nztopomap.TOPO50_ZOOM_MIN=13;nztopomap.TOPO50_ZOOM_MAX=15;nztopomap.TILE_SIZE=256;Number.prototype.sign=function(){return this>0?1:this<0?-1:0};nztopomap.Tools={};nztopomap.Point=function(a,b){this.x=a;this.y=b};nztopomap.Tools.getUrlVars=function(){for(var b=[],a,d=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),c=0;c<d.length;c++){a=d[c].split("=");b.push(a[0]);b[a[0]]=a[1]}return b};nztopomap.Tools.getTileUrl=function(b,a,c){var g="http://www.topomap.co.nz/map/blanktile.png",d="",e=b%2==0?true:false,f=a%2==0?true:false;if(e==true&&f==true)d="1";else if(e==true&&f==false)d="2";else if(e==false&&f==false)d="3";else d="4";return c==5&&b==30&&a==11||c==5&&b==31&&a==10||c==5&&b==31&&a==11||c==6&&b==61&&a==22||c==7&&b==123&&a==44||c==8&&b==246&&a==89||c==9&&b==493&&a==178||c==10&&b==986&&a==356?"http://overlap-1.topomap.co.nz/"+c+"-"+b+"-"+a+".png":c==9&&b==492&&a==178||c==10&&b==985&&a==356||c==11&&b>=1971&&b<=1972&&a>=710&&a<=712||c==12&&b>=3942&&b<=3944&&a>=1421&&a<=1424||c==10&&b==1021&&a>=356&&a<=357||c==11&&b==2042&&a>=713&&a<=714||c==12&&b>=4084&&b<=4085&&a>=1426&&a<=1429||c==13&&b>=8168&&b<=8171&&a>=2852&&a<=2858||c==14&&b>=16336&&b<=16343&&a>=5705&&a<=5716||c==15&&b>=32673&&b<=32687&&a>=11411&&a<=11433||c==5&&b==31&&a==11||c==6&&b==63&&a==22||c==7&&b==127&&a==44||c==8&&b==255&&a==89||c==9&&b==510&&a==178?"http://offshore-"+d+".topomap.co.nz/"+c+"-"+b+"-"+a+".png":c==10&&b>=982&&b<=1020&&a>=356&&a<=408||c==11&&b>=1964&&b<=2040&&a>=712&&a<=817||c==12&&b>=3929&&b<=4081&&a>=1424&&a<=1635||c==5&&b>=30&&b<=31&&a>=11&&a<=12||c==6&&b>=61&&b<=63&&a>=22&&a<=25||c==7&&b>=122&&b<=127&&a>=44&&a<=51||c==8&&b>=245&&b<=255&&a>=89&&a<=102||c==9&&b>=491&&b<=510&&a>=178&&a<=204||c==10&&b>=7&&b<=12&&a>=369&&a<=375||c==11&&b>=15&&b<=24&&a>=738&&a<=751||c==12&&b>=31&&b<=48&&a>=1477&&a<=1502||c==5&&b==0&&a==11||c==6&&b==0&&a==23||c==7&&b>=0&&b<=1&&a==46||c==8&&b>=1&&b<=3&&a>=92&&a<=93||c==9&&b>=3&&b<=6&&a>=184&&a<=187?"http://topo250-"+d+".topomap.co.nz/"+c+"-"+b+"-"+a+".png":c==13&&b>=7880&&b<=8160&&a>=2863&&a<=3271||c==14&&b>=15761&&b<=16320&&a>=5748&&a<=6543||c==15&&b>=31522&&b<=32641&&a>=11453&&a<=13086||c==13&&b>=67&&b<=88&&a>=2962&&a<=2992||c==14&&b>=135&&b<=176&&a>=5924&&a<=5985||c==15&&b>=271&&b<=352&&a>=11848&&a<=11971?"http://topo50-"+d+".topomap.co.nz/"+c+"-"+b+"-"+a+".png":c==10&&b>=983&&b<=985&&a>=342&&a<=345||c==11&&b>=1967&&b<=1971&&a>=685&&a<=691||c==12&&b>=3934&&b<=3942&&a>=1370&&a<=1382||c==13&&b>=7868&&b<=7884&&a>=2741&&a<=2765||c==14&&b>=15737&&b<=15768&&a>=5483&&a<=5530||c==15&&b>=31474&&b<=31536&&a>=10967&&a<=11060||c==5&&b==30&&a==10||c==6&&b==61&&a==21||c==7&&b>=122&&b<=123&&a>=42&&a<=43||c==8&&b>=245&&b<=246&&a>=85&&a<=86||c==9&&b>=491&&b<=492&&a>=171&&a<=172||c==10&&b==1020&&a>=348&&a<=349||c==11&&b>=2040&&b<=2041&&a>=696&&a<=698||c==12&&b>=4081&&b<=4083&&a>=1393&&a<=1396||c==13&&b>=8162&&b<=8166&&a>=2786&&a<=2792||c==14&&b>=16324&&b<=16332&&a>=5572&&a<=5584||c==15&&b>=32649&&b<=32664&&a>=11145&&a<=11168||c==5&&b==31&&a==10||c==6&&b==63&&a==21||c==7&&b==127&&a==43||c==8&&b==255&&a==87||c==9&&b==510&&a==174||c==10&&b>=992&&b<=993&&a>=334&&a<=336||c==11&&b>=1985&&b<=1987&&a>=669&&a<=673||c==12&&b>=3970&&b<=3974&&a>=1339&&a<=1346||c==13&&b>=7940&&b<=7948&&a>=2679&&a<=2692||c==14&&b>=15881&&b<=15897&&a>=5359&&a<=5384||c==15&&b>=31762&&b<=31795&&a>=10719&&a<=10768||c==5&&b==31&&a==10||c==6&&b==62&&a>=20&&a<=21||c==7&&b==124&&a>=41&&a<=42||c==8&&b==248&&a>=83&&a<=84||c==9&&b==496&&a>=167&&a<=168||c==10&&b>=985&&b<=986&&a>=355&&a<=356||c==11&&b>=1971&&b<=1972&&a>=710&&a<=712||c==12&&b>=3942&&b<=3944&&a>=1421&&a<=1424||c==13&&b>=7884&&b<=7888&&a>=2843&&a<=2849||c==14&&b>=15768&&b<=15776&&a>=5687&&a<=5698||c==15&&b>=31537&&b<=31552&&a>=11374&&a<=11396||c==5&&b==30&&a==11||c==6&&b==61&&a==22||c==7&&b==123&&a==44||c==8&&b==246&&a>=88&&a<=89||c==9&&b>=492&&b<=493&&a>=177&&a<=178||c==10&&b>=5&&b<=6&&a>=424&&a<=425||c==11&&b>=11&&b<=12&&a>=849&&a<=850||c==12&&b>=22&&b<=25&&a>=1698&&a<=1700||c==13&&b>=45&&b<=50&&a>=3397&&a<=3401||c==14&&b>=91&&b<=100&&a>=6794&&a<=6802||c==15&&b>=182&&b<=201&&a>=13588&&a<=13605||c==5&&b==0&&a==13||c==6&&b==0&&a==26||c==7&&b==0&&a==53||c==8&&b==1&&a==106||c==9&&b>=2&&b<=3&&a==212||c==10&&b==4&&a>=421&&a<=422||c==11&&b>=8&&b<=9&&a>=842&&a<=844||c==12&&b>=17&&b<=18&&a>=1685&&a<=1688||c==13&&b>=34&&b<=37&&a>=3371&&a<=3376||c==14&&b>=69&&b<=74&&a>=6743&&a<=6752||c==15&&b>=138&&b<=149&&a>=13487&&a<=13504||c==5&&b==0&&a==13||c==6&&b==0&&a==26||c==7&&b==0&&a==52||c==8&&b==1&&a==105||c==9&&b==2&&a>=210&&a<=211||c==10&&b>=3&&b<=4&&a==420||c==11&&b>=7&&b<=8&&a>=840&&a<=841||c==12&&b>=15&&b<=17&&a>=1681&&a<=1683||c==13&&b>=31&&b<=34&&a>=3363&&a<=3367||c==14&&b>=63&&b<=69&&a>=6726&&a<=6735||c==15&&b>=126&&b<=138&&a>=13452&&a<=13470||c==5&&b==0&&a==13||c==6&&b==0&&a==26||c==7&&b==0&&a==52||c==8&&b>=0&&b<=1&&a==105||c==9&&b>=1&&b<=2&&a==210||c==10&&b==3&&a>=417&&a<=418||c==11&&b==6&&a>=835&&a<=836||c==12&&b>=12&&b<=13&&a>=1671&&a<=1673||c==13&&b>=24&&b<=27&&a>=3342&&a<=3347||c==14&&b>=48&&b<=54&&a>=6685&&a<=6694||c==15&&b>=96&&b<=108&&a>=13370&&a<=13388||c==5&&b==0&&a==13||c==6&&b==0&&a==26||c==7&&b==0&&a==52||c==8&&b==0&&a==104||c==9&&b==1&&a>=208&&a<=209?"http://offshore-"+d+".topomap.co.nz/"+c+"-"+b+"-"+a+".png":g};nztopomap.OFFSHORE_MAPS=[{bounds:new google.maps.LatLngBounds(new google.maps.LatLng(-49.7675718061,178.694604608),new google.maps.LatLng(-49.6053719368,178.861713427)),topo:"25"},{bounds:new google.maps.LatLngBounds(new google.maps.LatLng(-47.8432926133,178.959906273),new google.maps.LatLng(-47.6812977139,179.120301848)),topo:"25"},{bounds:new google.maps.LatLngBounds(new google.maps.LatLng(-52.6978758982,168.955593237),new google.maps.LatLng(-52.3739482978,169.310666568)),topo:"50"},{bounds:new google.maps.LatLngBounds(new google.maps.LatLng(-48.1210767622,166.48201585),new google.maps.LatLng(-47.9583718742,166.644768309)),topo:"25"},{bounds:new google.maps.LatLngBounds(new google.maps.LatLng(-51.0172348161,165.786209226),new google.maps.LatLng(-50.369027886,166.47031632)),topo:"50"},{bounds:new google.maps.LatLngBounds(new google.maps.LatLng(-31.4061458653,-178.935843599),new google.maps.LatLng(-29.1748798513,-177.779123324)),topo:"25"}];nztopomap.TopoMapOverlay=function(a){this.map=a;this.opacity=0;this.tiles=[];this.tileSize=new google.maps.Size(nztopomap.TILE_SIZE,nztopomap.TILE_SIZE);this.name="NZ Topo Map";this.alt="NZ Topo Map";this.visible=false;this.initialized=false;this.self=this};nztopomap.TopoMapOverlay.prototype=new google.maps.OverlayView;nztopomap.TopoMapOverlay.prototype.getTile=function(e,c,f){for(var b=0;b<this.tiles.length;b++)if(this.tiles[b].id=="t_"+e.x+"_"+e.y+"_"+c)return this.tiles[b];var a=f.createElement("div"),d=this.getTileUrlCoord(e,c);a.id="t_"+d.x+"_"+d.y+"_"+c;a.style.width=this.tileSize.width+"px";a.style.height=this.tileSize.height+"px";a.style.backgroundImage="url("+this.getTileUrl(d,c)+")";a.style.backgroundRepeat="no-repeat";if(!this.visible)a.style.display="none";this.tiles.push(a);this.setObjectOpacity(a);return a};nztopomap.TopoMapOverlay.prototype.deleteHiddenTiles=function(e){for(var h=this.map.getBounds(),i=this.getTileUrlCoordFromLatLng(h.getNorthEast(),e),j=this.getTileUrlCoordFromLatLng(h.getSouthWest(),e),d=j.x-1,c=i.x+1,o=j.y-1,n=i.y+1,g=[],l=this.tiles.length,b=0;b<l;b++){var f=this.tiles[b].id.split("_"),a=Number(f[1]),k=Number(f[2]),m=Number(f[3]);if((d<c&&a>=d&&a<=c||d>c&&(a>=d&&a<=Math.pow(2,e)-1||a>=0&&a<=c))&&k>=o&&k<=n&&m==e)g.push(this.tiles[b]);else delete this.tiles[b]}this.tiles=g};nztopomap.TopoMapOverlay.prototype.pointToTile=function(f,c){var e=this.map.getProjection(),b=e.fromLatLngToPoint(f),a=new google.maps.Point(b.x*Math.pow(2,c),b.y*Math.pow(2,c)),d=new google.maps.Point(Math.floor(a.x/this.tileSize.width),Math.floor(a.y/this.tileSize.height));return d};nztopomap.TopoMapOverlay.prototype.getTileUrlCoordFromLatLng=function(b,a){return this.getTileUrlCoord(this.pointToTile(b,a),a)};nztopomap.TopoMapOverlay.prototype.getTileUrlCoord=function(c,d){var a=1<<d,e=a-c.y-1,b=c.x;if(b<0||b>=a)b=(b%a+a)%a;return new google.maps.Point(b,e)};nztopomap.TopoMapOverlay.prototype.getTileUrl=function(a,b){return nztopomap.Tools.getTileUrl(a.x,a.y,b)};nztopomap.TopoMapOverlay.prototype.initialize=function(){if(this.initialized)return;var a=this.self;this.map.overlayMapTypes.insertAt(0,a);this.initialized=true};nztopomap.TopoMapOverlay.prototype.hide=function(){this.visible=false;for(var b=this.tiles.length,a=0;a<b;a++)this.tiles[a].style.display="none"};nztopomap.TopoMapOverlay.prototype.show=function(){this.initialize();this.visible=true;for(var b=this.tiles.length,a=0;a<b;a++)this.tiles[a].style.display=""};nztopomap.TopoMapOverlay.prototype.releaseTile=function(a){a=null};nztopomap.TopoMapOverlay.prototype.setOpacity=function(c){this.opacity=c;for(var b=this.tiles.length,a=0;a<b;a++)this.setObjectOpacity(this.tiles[a])};nztopomap.TopoMapOverlay.prototype.setObjectOpacity=function(a){if(this.opacity>0){if(typeof a.style.filter=="string")a.style.filter="alpha(opacity:"+this.opacity+")";if(typeof a.style.KHTMLOpacity=="string")a.style.KHTMLOpacity=this.opacity/100;if(typeof a.style.MozOpacity=="string")a.style.MozOpacity=this.opacity/100;if(typeof a.style.opacity=="string")a.style.opacity=this.opacity/100}};nztopomap.PrintArea=function(e,d,a,b,c){this.isInitialised=false;this.map=e;this.minAreaDimension=d;this.startAreaMinDimension=a;this.rectangleArea;this.rectangleAreaBoundsPreChange;this.pageOrientation;this.pageConstrainDimensionsRatio=true;this.pageSize;this.pageSizeLong;this.pageSizeShort;this.topo250ZoomMinGoodQuality=b;this.topo50ZoomMinGoodQuality=c;this.printZoom;this.printTileSize;this.printTileUrlPointNorthEast;this.printTileUrlPointSouthWest;nztopomap.PrintArea.overlay.draw=function(){};nztopomap.PrintArea.overlay.setMap(this.map);this.init=function(){this.rectangleArea=new google.maps.Rectangle({clickable:false,strokeWeight:1,strokeColor:"red",fillColor:"red",bounds:this.rectangleAreaBoundsPreChange,map:this.map,editable:true});var a=this;google.maps.event.addListener(this.rectangleArea,"bounds_changed",function(){a.bounds_changed()});this.refreshPrintProperties();this.isInitialised=true};this.bounds_changed=function(){this.refreshPrintProperties();this.rectangleAreaBoundsPreChange=this.rectangleArea.getBounds()};this.refreshPrintProperties=function(){var i=this.rectangleArea.bounds.getNorthEast(),j=this.rectangleArea.bounds.getSouthWest(),m=nztopomap.PrintArea.overlay.getProjection(),k=m.fromLatLngToContainerPixel(i),l=m.fromLatLngToContainerPixel(j),n=this.getPointDimensionDifference(l.x,k.x),o=this.getPointDimensionDifference(l.y,k.y),b,c;if(this.pageOrientation===nztopomap.PrintArea.PageOrientationEnum.LANDSCAPE){b=this.pageSizeLong;c=this.pageSizeShort}else{b=this.pageSizeShort;c=this.pageSizeLong}var d=n,e=o,a=this.map.getZoom();if(d<b&&e<c)while(d<b&&e<c){d=d*2;e=e*2;a++}else if(d>b||e>c){while(d>b||e>c){d=d/2;e=e/2;a--}a++}a++;if(a<nztopomap.TOPO250_ZOOM_MIN)a=nztopomap.TOPO250_ZOOM_MIN;else if(a>nztopomap.TOPO50_ZOOM_MAX)a=nztopomap.TOPO50_ZOOM_MAX;if(a>=nztopomap.TOPO250_ZOOM_MIN&&a<=nztopomap.TOPO250_ZOOM_MAX&&a<this.topo250ZoomMinGoodQuality)a=this.topo250ZoomMinGoodQuality;else if(a>=nztopomap.TOPO50_ZOOM_MIN&&a<=nztopomap.TOPO50_ZOOM_MAX&&a<this.topo50ZoomMinGoodQuality)a=this.topo50ZoomMinGoodQuality;this.printZoom=a;this.printTileUrlPointNorthEast=overlay.getTileUrlCoordFromLatLng(i,a);this.printTileUrlPointSouthWest=overlay.getTileUrlCoordFromLatLng(j,a);var f=nztopomap.TILE_SIZE,g=this.getPointDimensionDifference(this.printTileUrlPointNorthEast.x,this.printTileUrlPointSouthWest.x),h=this.getPointDimensionDifference(this.printTileUrlPointNorthEast.y,this.printTileUrlPointSouthWest.y);if(g<1)g=1;if(h<1)h=1;while(g*f<b&&h*f<c)f++;while(g*f>b||h*f>c)f--;this.printTileSize=f;$(this).trigger("change")};this.getPointDimensionDifference=function(a,b){var c;if(a<b)c=b-a;else c=a-b;return c};this.setVisible=function(a){if(this.isInitialised)if(a===true)this.rectangleArea.setMap(this.map);else this.rectangleArea.setMap(null)};this.getInitialBoundsFromCenter=function(h){var f=nztopomap.PrintArea.overlay.getProjection(),b=f.fromLatLngToContainerPixel(h),c=a,d=a,g=Math.round(a*(this.pageSizeLong/this.pageSizeShort));if(this.pageOrientation===nztopomap.PrintArea.PageOrientationEnum.PORTRAIT)d=g;else if(this.pageOrientation===nztopomap.PrintArea.PageOrientationEnum.LANDSCAPE)c=g;c=c/2;d=d/2;var e=new google.maps.LatLngBounds;e.extend(f.fromContainerPixelToLatLng(new google.maps.Point(b.x-c,b.y-d)));e.extend(f.fromContainerPixelToLatLng(new google.maps.Point(b.x-c,b.y+d)));e.extend(f.fromContainerPixelToLatLng(new google.maps.Point(b.x+c,b.y+d)));e.extend(f.fromContainerPixelToLatLng(new google.maps.Point(b.x+c,b.y-d)));return e};this.getConstrainedDimensionLengthsAsPoint=function(a,b){var c=this.pageSizeLong/this.pageSizeShort;if(a<b){if(this.pageOrientation===nztopomap.PrintArea.PageOrientationEnum.PORTRAIT)b=Math.round(a*c);else if(this.pageOrientation===nztopomap.PrintArea.PageOrientationEnum.LANDSCAPE)b=Math.round(a/c)}else if(this.pageOrientation===nztopomap.PrintArea.PageOrientationEnum.PORTRAIT)a=Math.round(b/c);else if(this.pageOrientation===nztopomap.PrintArea.PageOrientationEnum.LANDSCAPE)a=Math.round(b*c);return new google.maps.Point(a,b)}};nztopomap.PrintArea.overlay=new nztopomap.TopoMapOverlay;nztopomap.PrintArea.prototype.setPageOrientation=function(a){this.pageOrientation=a;this.refreshPrintProperties()};nztopomap.PrintArea.prototype.setPageSize=function(b){this.pageSize=b;for(var a in nztopomap.PrintArea.PageSizeEnum)if(nztopomap.PrintArea.PageSizeEnum[a].value===b){this.pageSizeLong=nztopomap.PrintArea.PageSizeEnum[a].long;this.pageSizeShort=nztopomap.PrintArea.PageSizeEnum[a].short;break}this.isInitialised&&this.refreshPrintProperties()};nztopomap.PrintArea.prototype.show=function(b,a,c){this.setPageSize(c);this.pageOrientation=a;this.rectangleAreaBoundsPreChange=this.getInitialBoundsFromCenter(b);if(!this.isInitialised)this.init();else{this.rectangleArea.setBounds(this.rectangleAreaBoundsPreChange);this.setVisible(true)}};nztopomap.PrintArea.prototype.hide=function(){this.setVisible(false)};nztopomap.PrintArea.PageOrientationEnum={PORTRAIT:"Portrait",LANDSCAPE:"Landscape"};nztopomap.PrintArea.PageSizeEnum={A5:{value:"A5","short":420,"long":595},A4:{value:"A4","short":595,"long":842},A3:{value:"A3","short":842,"long":1190}};var urlVars=nztopomap.Tools.getUrlVars(),SEARCH_PAGESIZE=20,searchText="",searchPageIndex=0;function initUI(){if(urlVars.nc!="1"){$("div.cont-body").prepend($("#inject-header").html());$("#inject").hide();$("#extruderPrint").buildMbExtruder({position:"left",width:300,extruderOpacity:1,hidePanelsOnClose:true,accordionPanels:false,onExtOpen:function(){printarea.show(mapGetCenterWrapped(),$("input:radio[name=PrintOrientation]:checked").val(),$("input:radio[name=PrintSize]:checked").val());syncPrintSeries();_gaq.push(["_trackEvent","Tabs","Open","Print"])},onExtContentLoad:function(){_gaq.push(["_trackEvent","Tabs","Close","Print"])},onExtClose:function(){printarea.hide()},closeOnExternalClick:false,icon:"/css/print.png",iconHeight:15,iconWidth:16,iconClass:"flapIcon"});$("#extruderDownload").buildMbExtruder({position:"left",width:300,extruderOpacity:1,hidePanelsOnClose:true,accordionPanels:false,onExtOpen:function(){setMapSheetsVisibility(true);_gaq.push(["_trackEvent","Tabs","Open","Download"])},onExtContentLoad:function(){},onExtClose:function(){setMapSheetsVisibility(false);_gaq.push(["_trackEvent","Tabs","Close","Download"])},closeOnExternalClick:false,icon:"/css/download.png",iconHeight:18,iconWidth:16,iconClass:"flapIcon"});$("#extruderSearch").buildMbExtruder({position:"left",width:300,extruderOpacity:1,hidePanelsOnClose:true,accordionPanels:false,onExtOpen:function(){_gaq.push(["_trackEvent","Tabs","Open","Search"])},onExtContentLoad:function(){},onExtClose:function(){_gaq.push(["_trackEvent","Tabs","Close","Search"])},closeOnExternalClick:false});$("#extruderLegend").buildMbExtruder({position:"left",width:410,extruderOpacity:1,hidePanelsOnClose:true,accordionPanels:true,onExtOpen:function(){syncLegend();_gaq.push(["_trackEvent","Tabs","Open","Legend"])},onExtContentLoad:function(){},onExtClose:function(){_gaq.push(["_trackEvent","Tabs","Close","Legend"])},closeOnExternalClick:false});$("#extruderCoords").buildMbExtruder({position:"left",width:300,extruderOpacity:1,hidePanelsOnClose:true,accordionPanels:false,onExtOpen:function(){syncCoordsLatLng(mapGetCenterWrapped());callOnMapMouseMove=true;syncMapSheetsVisibility();setInitialCoordsLocation();coordsPin.setVisible(true);_gaq.push(["_trackEvent","Tabs","Open","Coords"])},onExtContentLoad:function(){},onExtClose:function(){callOnMapMouseMove=false;setMapSheetsVisibility(false);coordsPin.setVisible(false);_gaq.push(["_trackEvent","Tabs","Close","Coords"])},closeOnExternalClick:false});$("#extruderShare").buildMbExtruder({position:"left",width:300,extruderOpacity:1,hidePanelsOnClose:true,accordionPanels:false,onExtOpen:function(){syncShareLinks(mapGetCenterWrapped());syncSharePinVisibility();_gaq.push(["_trackEvent","Tabs","Open","Share"])},onExtContentLoad:function(){},onExtClose:function(){sharePin.setVisible(false);_gaq.push(["_trackEvent","Tabs","Close","Share"])},closeOnExternalClick:false});$("#extruderInfo").buildMbExtruder({position:"left",width:300,extruderOpacity:1,hidePanelsOnClose:true,accordionPanels:false,onExtOpen:function(){_gaq.push(["_trackEvent","Tabs","Open","Info"])},onExtContentLoad:function(){},onExtClose:function(){_gaq.push(["_trackEvent","Tabs","Close","Info"])},closeOnExternalClick:false});$("input:radio[name=PrintOrientation]").click(function(){printarea.setPageOrientation($(this).val())});$("input:radio[name=PrintSize]").click(function(){printarea.setPageSize($(this).val())});$("#legend-topo250 a").click(function(){selectLegend(TopoDetail.TOPO250)});$("#legend-topo50 a").click(function(){selectLegend(TopoDetail.TOPO50)});var b=$("#ShareLink,#ShareEmbed");$(b).focus(function(){this.select()});$(b).click(function(){this.select()});$("#coords-share").click(function(){var a=new google.maps.LatLng(parseFloat($("#CoordsLat").val()),parseFloat($("#CoordsLng").val()));map.setCenter(a);$("#extruderCoords").closeMbExtruder();$("#extruderShare").openMbExtruder()});$("#CoordsMapSheets").click(function(){syncMapSheetsVisibility()});$("#CoordsLat,#CoordsLng").change(function(){setCoordsLatLngFromInputs();coordsConvertedHide()});$("#CoordsConvertTo").change(function(){coordsConvertedHide()});$("#share-embedoptions-toggle").click(function(){toggleExpandableArea(this,$("#share-embedoptions"))});$("#share-pin-toggle").click(function(){toggleExpandableArea(this,$("#share-pin"))});$("#share-kml-toggle").click(function(){toggleExpandableArea(this,$("#share-kml"))});$("#SharePin").click(function(){syncSharePinVisibility();populateShareLink()});$("#ShareCenterLat,#ShareCenterLng").change(function(){setShareLatLngFromInputs()});$("#ShareCenterLat,#ShareCenterLng").keypress(function(a){a.which=="13"&&setShareLatLngFromInputs()});$("#ShareLabel").change(function(){sharePin.setTitle(getShareLabel());populateShareLink()});$("#ShareFileFormat").change(function(){populateShareLink();syncShareFileLabels()});$("#ShareKml").change(function(){populateShareLink();syncShareFileLabels()});$("#ShareKmlIgnoreOther").click(function(){populateShareLink()});$("#ShareSizeSmall").click(function(){setShareEmbeddedDimensions(300,300);syncShareSizeInputs(true)});$("#ShareSizeMedium").click(function(){setShareEmbeddedDimensions(425,350);syncShareSizeInputs(true)});$("#ShareSizeLarge").click(function(){setShareEmbeddedDimensions(640,480);syncShareSizeInputs(true)});$("#ShareSizeCustom").click(function(){setShareEmbeddedDimensions($("#ShareSizeWidthCustom").val(),$("#ShareSizeHeightCustom").val());syncShareSizeInputs(false)});$("#ShareSizeWidthCustom").change(function(){$("#ShareSizeWidth").val($("#ShareSizeWidthCustom").val());populateShareLink()});$("#ShareSizeHeightCustom").change(function(){$("#ShareSizeHeight").val($("#ShareSizeHeightCustom").val());populateShareLink()});onMapClick=function(a){if(coordsPin.getVisible())syncCoordsLatLng(a.latLng);else syncShareLinks(a.latLng)};onMapMouseMove=function(a){setMouseCoords(a.latLng)};if(typeof urlVars.q!="undefined"){var a=decodeURIComponent(urlVars.q);a=a.replace("+"," ");search(a,1);$("#SearchText").val(a);$("#extruderSearch").openMbExtruder()}syncShareFileLabels()}}function toggleExpandableArea(a,b){if($(a).hasClass("expandable-closed")){$(a).removeClass("expandable-closed");$(a).addClass("expandable-open");$(b).show("slide",{direction:"up"})}else{$(a).removeClass("expandable-open");$(a).addClass("expandable-closed");$(b).hide("slide",{direction:"up"})}}function getShareLabel(){return $.trim($("#ShareLabel").val())}function populateShareLink(){var a="http://www.topomap.co.nz/NZTopoMap?v=2",c=$("#ShareFileFormat").val(),b=$.trim($("#ShareKml").val());if(c==="GPX")b="http://www.topomap.co.nz/proxy.ashx?"+b;if(b!=""&&getShareKmlIgnoreOtherSettings())a+="&"+c.toLowerCase()+"="+encodeURIComponent(b);else{var h=$("#ShareCenterLat").val(),i=$("#ShareCenterLng").val(),g=new google.maps.LatLng(parseFloat(h),parseFloat(i));a+="&ll="+g.toUrlValue()+"&z="+map.getZoom();if(getSharePinVisible()){a+="&pin=1";var f=getShareLabel();if(f!="")a+="&lbl="+encodeURIComponent(f)}if(b!="")a+="&"+c.toLowerCase()+"="+encodeURIComponent(b)}$("#ShareLink").val(a);$("#ShareLinkPreview").attr("href",a);var e=$("#ShareSizeWidth").val(),d=$("#ShareSizeHeight").val();$("#ShareEmbed").val('<iframe width="'+e+'" height="'+d+'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+a.replace("NZTopoMap","NZTopoMapEmbedded")+'"></iframe><br /><small><a href="'+a+'" style="text-align:left">View Larger Topographic Map</a></small>');$("#ShareEmbedPreview").attr("href","http://www.topomap.co.nz/NZTopoMapEmbeddedPreview?w="+e+"&h="+d+"&u="+encodeURIComponent(a))}function populateCoordsLatLng(a){$("#CoordsLat").val(a.lat().toFixed(6));$("#CoordsLng").val(a.lng().toFixed(6));coordsConvertedHide()}function populateShareLat(a){$("#ShareCenterLat").val(a.toFixed(6))}function populateShareLng(a){$("#ShareCenterLng").val(a.toFixed(6))}function syncCoordsLatLng(a){populateCoordsLatLng(a);coordsPin.setPosition(a)}function syncShareLinks(a){populateShareLat(a.lat());populateShareLng(a.lng());populateShareLink();sharePin.setPosition(a)}function setShareEmbeddedDimensions(b,a){$("#ShareSizeWidth").val(b);$("#ShareSizeHeight").val(a);populateShareLink()}function setCoordsLatLngFromInputs(){var a=new google.maps.LatLng(parseFloat($("#CoordsLat").val()),parseFloat($("#CoordsLng").val()));map.setCenter(a);syncCoordsLatLng(a)}function setShareLatLngFromInputs(){var a=new google.maps.LatLng(parseFloat($("#ShareCenterLat").val()),parseFloat($("#ShareCenterLng").val()));map.setCenter(a);syncShareLinks(a)}function syncShareFileLabels(){var a=$("#ShareFileFormat").val();if(a==="KML"){$("#ShareLbl").html("Url of KML / GeoRSS layer to show:");$("#ShareKmlTip").html("Full url of publicly accessible kml file or GeoRSS e.g. http://www.topomap.co.nz/kml/example.kml");$("#ShareKmlIgnoreOtherTip").html("All other share settings are ignored, map centers on KML / GeoRSS.")}else if(a==="GPX"){$("#ShareLbl").html("Url of GPX file to show:");$("#ShareKmlTip").html("Full url of publicly accessible gpx file e.g. http://www.topomap.co.nz/gpx/example.gpx");$("#ShareKmlIgnoreOtherTip").html("All other share settings are ignored, map centers on GPX.")}}function syncShareSizeInputs(a){$("#ShareSizeWidthCustom").attr("disabled",a);$("#ShareSizeHeightCustom").attr("disabled",a)}function syncPrintSeries(){var a=printarea.printZoom;if(a>=nztopomap.TOPO250_ZOOM_MIN&&a<=nztopomap.TOPO250_ZOOM_MAX){$("#print-topo50").hide();$("#print-topo250").show()}else if(a>=nztopomap.TOPO50_ZOOM_MIN&&a<=nztopomap.TOPO50_ZOOM_MAX){$("#print-topo250").hide();$("#print-topo50").show()}}function syncLegend(){var a=topoDetailForCurrentZoom();$("#legend-currentmap>.current").text(a.name);if(a==TopoDetail.TOPO50)selectLegend(TopoDetail.TOPO50);else selectLegend(TopoDetail.TOPO250)}function syncSharePinVisibility(){var a=getSharePinVisible();if(a&&!sharePin.getVisible()){var b=$("#ShareCenterLat").val(),c=$("#ShareCenterLng").val();sharePin.setPosition(new google.maps.LatLng(parseFloat(b),parseFloat(c)))}sharePin.setVisible(a)}function syncMapSheetsVisibility(){setMapSheetsVisibility(getMapSheetsVisible())}function setMapSheetsVisibility(a){if(a){if(mapSheets==undefined)mapSheets=new google.maps.FusionTablesLayer(MAP_SHEETS_FTID);mapSheets.setMap(map)}else mapSheets!=undefined&&mapSheets.setMap(null)}function setMouseCoords(a){$("#coords-mouse-latlng").text(a.lat().toFixed(6)+", "+a.lng().toFixed(6))}function setInitialCoordsLocation(){var a=mapGetCenterWrapped();populateCoordsLatLng(a);setMouseCoords(a)}function getSharePinVisible(){return $("#SharePin").is(":checked")}function getShareKmlIgnoreOtherSettings(){return $("#ShareKmlIgnoreOther").is(":checked")}function getMapSheetsVisible(){return $("#CoordsMapSheets").is(":checked")}function selectLegend(a){if(a==TopoDetail.TOPO50){$("#legend-topo250>.current").hide();$("#legend-topo250>.select").show();$("#legend-topo50>.current").show();$("#legend-topo50>.select").hide();$("#legend-topo250-img").hide();$("#legend-topo50-img").show()}else if(a==TopoDetail.TOPO250){$("#legend-topo250>.current").show();$("#legend-topo250>.select").hide();$("#legend-topo50>.current").hide();$("#legend-topo50>.select").show();$("#legend-topo250-img").show();$("#legend-topo50-img").hide()}}function coordsLocateMe(){var a="Sorry, your browser cannot share your location.";if(navigator.geolocation){$("#coords-locateme-btn").hide();$("#coords-locateme-busy").show();navigator.geolocation.getCurrentPosition(function(b){var a=new google.maps.LatLng(b.coords.latitude,b.coords.longitude);map.setCenter(a);syncCoordsLatLng(a);$("#coords-locateme-busy").hide();$("#coords-locateme-btn").show()},function(){alert(a);$("#coords-locateme-busy").hide();$("#coords-locateme-btn").show()},{enableHighAccuracy:true})}else alert(a)}function coordsConvert(){var a=new google.maps.LatLng(parseFloat($("#CoordsLat").val()),parseFloat($("#CoordsLng").val())),c=$("#CoordsConvertTo").val();if(c.indexOf("NZTM")===0){if(coordsWithinConvertBounds(a,"NZTM")){var b=new Proj4js.Point(a.lng(),a.lat());Proj4js.transform(coordsProjWGS84,coordsProjNZTM,b);if(c=="NZTMStd")coordsConvertedDisplay(b.x.toFixed(3),b.y.toFixed(3),"NZTM");else if(c=="NZTMGrd"){var f=coordsNZTMPoint2Grid(b);if(f==null)coordsDisplayOutsideBoundsMsg("NZTopo50");else coordsConvertedDisplay(null,f,"MAPREF")}}}else if(c=="NZMG"){if(coordsWithinConvertBounds(a,"NZMG")){var b=new Proj4js.Point(a.lng(),a.lat());Proj4js.transform(coordsProjWGS84,coordsProjNZMG,b);coordsConvertedDisplay(b.x.toFixed(3),b.y.toFixed(3),"NZMG")}}else if(c.indexOf("WGS84")===0){var d=c.replace("WGS84",""),e=6;if(d=="dms")e=5;coordsConvertedDisplay(Geo.toLon(a.lng(),d,e),Geo.toLat(a.lat(),d,e),"WGS84")}}function coordsNZTMPoint2Grid(b){for(var c=null,a=0;a<mapsheets.length;a++)if(b.x>=mapsheets[a][2]&&b.x<mapsheets[a][3]&&b.y>=mapsheets[a][4]&&b.y<mapsheets[a][5]){c=mapsheets[a][0];if(mapsheets[a][1]===false)a=mapsheets.length}if(c!=null)c=c+" "+coordsNZTMPointPart2GridPart(b.x)+" "+coordsNZTMPointPart2GridPart(b.y);return c}function coordsNZTMPointPart2GridPart(b){var a=(b/100).toFixed(0).toString();return a.substr(a.length-3,3)}function coordsConvertedDisplay(e,f,d){var a=$("#CoordsYLbl"),b=$("#CoordsXLbl"),c=$("#coords-x-wrap");$(c).show();$(a).removeAttr("title");$(b).removeAttr("title");if(d=="WGS84"){$(a).text("Lat");$(a).attr("title","Latitude");$(b).text("Long");$(b).attr("title","Longitude")}else if(d=="MAPREF"){$(a).text("Map ref");$(c).hide()}else{$(a).text("Northing");$(b).text("Easting")}$("#CoordsY").val(f);$("#CoordsX").val(e);coordsConvertedShow()}function coordsConvertedShow(){var a=$("#coords-converted");$(a).is(":hidden")&&$(a).show("slide",{direction:"up"})}function coordsConvertedHide(){var a=$("#coords-converted");!$(a).is(":hidden")&&$(a).hide("slide",{direction:"up"})}function coordsWithinConvertBounds(b,a){if(coordsConvertBounds.contains(b))return true;else{coordsDisplayOutsideBoundsMsg(a);return false}}function coordsDisplayOutsideBoundsMsg(a){alert("Sorry, the selected coordinates fall outside the area supported for "+a+".")}function search(b,a){searchText=b;$("#search-results,#search-error").hide();a==1&&$("#search-page").hide();if($.trim(b)!=""){$("#search-busy").show();$.ajax({type:"POST",async:true,url:urlSearch,cache:false,data:{SearchText:b,PageSize:SEARCH_PAGESIZE,PageIndex:a},dataType:"json",success:function(b){$("#search-busy").hide();if(b.Results.length>0){var c="#search-results";$(c).empty();$(c).html('<p class="tip">Hover over a place name to see its feature type.</p>');for(var d in b.Results)$("#searchResultTmpl").tmpl(b.Results[d]).appendTo(c);a==1&&searchPaging(b.ResultCount,a);$(c).show()}else searchNoResults()},error:function(){$("#search-busy").hide();$("#search-error").show()}})}else searchNoResults()}function searchNoResults(){var a=$("#search-results");$(a).empty();$(a).html('<p class="noresults">No results found.</p>');$(a).show()}function searchPaging(b){var a=$("#search-page");a.empty();b>SEARCH_PAGESIZE&&$(a).pagination(b,{callback:searchSelectPage,items_per_page:SEARCH_PAGESIZE,num_display_entries:3,num_edge_entries:1,prev_text:"<",next_text:">"});$(a).show()}function searchSelectPage(a){if(a!=searchPageIndex){search(searchText,a+1);searchPageIndex=a}}function contact(){$("#contact-good,#contact-bad").hide();$.ajax({type:"POST",async:true,url:urlContact,cache:false,data:{Name:$("#Name").val(),Email:$("#Email").val(),Subject:$("#Subject").val(),Message:$("#Message").val()},dataType:"json",success:function(c){if(c.IsSuccess==true){$("#contact-good").show();alert("Your message has been sent.")}else{for(var d=$("#contact-bad"),a="",b=0;b<c.Errors.length;b++){if(b>0)a+="<br/>";a+=c.Errors[b]}d.html(a);d.show();alert(a.replace("<br/>","\n"))}},error:function(){var a=$("#contact-bad");a.html('Sorry, an error occurred.<br/>You can also use the contact form at <a href="http://www.gavinharriss.com" target="_blank">www.gavinharriss.com</a>.');a.show();alert("Sorry, an error occurred.")}})}var map,printarea,pin,overlay,OPACITY_MAX_PIXELS=57,PRINT_AREA_MIN_DIMENSION=30,PRINT_AREA_START_MIN_DIMENSION=200,opacityControlMessageDisplayed=false,mapSheets,MAP_SHEETS_FTID=2520575,coordsProjWGS84=new Proj4js.Proj("WGS84"),coordsProjNZTM=new Proj4js.Proj("EPSG:2193"),coordsProjNZMG=new Proj4js.Proj("EPSG:27200"),coordsPin,coordsConvertBounds=new google.maps.LatLngBounds(new google.maps.LatLng(-47.4,166.33),new google.maps.LatLng(-34,178.6)),sharePin,shareKml=null,onMapClick=function(){},callOnMapMouseMove=false,onMapMouseMove=function(){},TopoDetail={NONE:{value:0,name:"None"},TOPO250:{value:250,name:"Topo250"},TOPO50:{value:50,name:"Topo50"}};function createOpacityControl(){var d="/css/opacity-slider3d7.png",a=document.createElement("DIV");a.setAttribute("style","margin:6px 3px;overflow-x:hidden;overflow-y:hidden;background:url("+d+") no-repeat;width:71px;height:21px;cursor:pointer;");a.setAttribute("title","Change transparency of topo map");var c=document.createElement("DIV");c.setAttribute("style","padding:0;margin:0;overflow-x:hidden;overflow-y:hidden;background:url("+d+") no-repeat -71px 0;width:14px;height:21px;");a.appendChild(c);var b=new ExtDraggableObject(c,{restrictY:true,container:a});google.maps.event.addListener(b,"dragend",function(){setOpacity(b.valueX())});google.maps.event.addDomListener(a,"click",function(d){var c=findPosLeft(this),a=d.pageX-c-5;b.setValueX(a);setOpacity(a)});map.controls[google.maps.ControlPosition.TOP_RIGHT].push(a);b.setValueX(OPACITY_MAX_PIXELS)}function findPosLeft(a){var b=0;if(a.offsetParent){do b+=a.offsetLeft;while(a=a.offsetParent);return b}return undefined}function initTopoMap(e,f,d,i){var a=new google.maps.LatLng(e,f),j={zoom:d,minZoom:nztopomap.TOPO_ZOOM_MIN,maxZoom:nztopomap.TOPO_ZOOM_MAX,center:a,disableDefaultUI:true,mapTypeId:google.maps.MapTypeId.ROADMAP,navigationControl:true,navigationControlOptions:{style:google.maps.NavigationControlStyle.DEFAULT,position:google.maps.ControlPosition.TOP_RIGHT},mapTypeControl:true,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},scaleControl:true};map=new google.maps.Map(document.getElementById("map"),j);overlay=new nztopomap.TopoMapOverlay(map);overlay.show();createOpacityControl();if(i!=""){var c=new google.maps.InfoWindow;c.setContent("<p>"+i+"</p>");c.setPosition(mapGetCenterWrapped());c.open(map)}var b=false;if(typeof urlVars.ll!="undefined"&&typeof urlVars.z!="undefined"){var h=decodeURIComponent(urlVars.ll).split(",");e=h[0];f=h[1];d=parseFloat(urlVars.z);a=new google.maps.LatLng(e,f);map.setCenter(a);map.setZoom(d);if(typeof urlVars.pin!="undefined"&&urlVars.pin=="1"){pin=new google.maps.Marker({map:map,position:a});typeof urlVars.lbl!="undefined"&&pin.setTitle(decodeURIComponent(urlVars.lbl))}b=true}if(typeof urlVars.kml!="undefined")var l=new google.maps.KmlLayer(decodeURIComponent(urlVars.kml),{preserveViewport:b,map:map});if(typeof urlVars["ft-id"]!="undefined"){var g=new google.maps.FusionTablesLayer(urlVars["ft-id"]);typeof urlVars["ft-q"]!="undefined"&&g.setQuery(decodeURIComponent(urlVars["ft-q"]));g.setMap(map)}if(typeof urlVars.gpx!="undefined"){var k=decodeURIComponent(urlVars.gpx);$.ajax({url:k,dataType:"xml",success:function(c){var a=new GPXParser(c,map);a.setTrackColour("#ff0000");a.setTrackWidth(5);a.setMinTrackPointDelta(.001);b===false&&a.centerAndZoom(c);a.addTrackpointsToMap();a.addWaypointsToMap();a.addRoutepointsToMap()}})}sharePin=new google.maps.Marker({map:map,draggable:true,animation:google.maps.Animation.DROP,position:a,visible:false});google.maps.event.addListener(sharePin,"dragend",sharePinDragEnd);coordsPin=new google.maps.Marker({map:map,draggable:true,animation:google.maps.Animation.DROP,position:a,visible:false});google.maps.event.addListener(coordsPin,"dragend",coordsPinDragEnd);google.maps.event.addListener(map,"zoom_changed",function(){zoomChanged()});zoomChanged();google.maps.event.addListener(map,"tilesloaded",function(){overlay.deleteHiddenTiles(map.getZoom())});google.maps.event.addListener(map,"click",function(a){onMapClick(a)});google.maps.event.addListener(map,"mousemove",function(a){callOnMapMouseMove&&onMapMouseMove(a)});google.maps.event.addListener(map,"maptypeid_changed",function(){if(!opacityControlMessageDisplayed){alert("Use the transparency slider control to view the Google map beneath the topo map.");opacityControlMessageDisplayed=true}});google.maps.event.addListener(map,"center_changed",function(){centerChanged()});centerChanged();printarea=new nztopomap.PrintArea(map,PRINT_AREA_MIN_DIMENSION,PRINT_AREA_START_MIN_DIMENSION,11,14);$(printarea).bind("change",function(){syncPrintSeries()})}function printMap(){alert("A printer friendly map will open in a new window.");var a=$("input:radio[name=PrintOrientation]:checked").val();if(a==="None")a="Portrait";var b="/Print?sw="+printarea.printTileUrlPointSouthWest.x+","+printarea.printTileUrlPointSouthWest.y+"&ne="+printarea.printTileUrlPointNorthEast.x+","+printarea.printTileUrlPointNorthEast.y+"&z="+printarea.printZoom+"&t="+printarea.printTileSize+"&s="+printarea.pageSize+"&o="+a;window.open(b)}function zoomChanged(){var a=map.getZoom();if(a<nztopomap.TOPO_ZOOM_MIN)map.setZoom(nztopomap.TOPO_ZOOM_MIN);else a>nztopomap.TOPO_ZOOM_MAX&&map.setZoom(nztopomap.TOPO_ZOOM_MAX)}var mapSeriesLabel="250-50";function centerChanged(){for(var a="250-50",c=mapGetCenterWrapped(),b=0;b<nztopomap.OFFSHORE_MAPS.length;b++)if(nztopomap.OFFSHORE_MAPS[b].bounds.contains(c)){a=nztopomap.OFFSHORE_MAPS[b].topo;break}if(mapSeriesLabel!=a){$("#toposeries-img").attr("src","/css/toposeries"+a+".png");mapSeriesLabel=a}}function topoDetailForCurrentZoom(){var a=map.getZoom();return a<nztopomap.TOPO_ZOOM_MIN||a>nztopomap.TOPO_ZOOM_MAX?TopoDetail.NONE:a>=nztopomap.TOPO250_ZOOM_MIN&&a<=nztopomap.TOPO250_ZOOM_MAX?TopoDetail.TOPO250:a>=nztopomap.TOPO50_ZOOM_MIN&&a<=nztopomap.TOPO50_ZOOM_MAX?TopoDetail.TOPO50:void 0}function showLocation(d,c,e,f){var b=new google.maps.LatLng(e,f);map.panTo(b);map.setZoom(14);var a=new google.maps.InfoWindow;a.setContent("<p>"+d+", "+c+"</p>");a.setPosition(b);a.open(map)}function sharePinDragEnd(){syncShareLinks(sharePin.getPosition())}function coordsPinDragEnd(){syncCoordsLatLng(coordsPin.getPosition())}function setOpacity(b){var a=100/OPACITY_MAX_PIXELS*b;if(a==0)overlay.visible==true&&overlay.hide();else{overlay.setOpacity(a);overlay.visible==false&&overlay.show()}}function mapGetCenterWrapped(){var a=map.getCenter();return new google.maps.LatLng(a.lat(),a.lng())}
