Comparing version 1.2.2 to 1.4.1
@@ -1271,4 +1271,4 @@ /* | ||
wax.GridInstance.prototype.resolveCode = function(key) { | ||
(key >= 93) && key--; | ||
(key >= 35) && key--; | ||
if (key >= 93) key--; | ||
if (key >= 35) key--; | ||
key -= 32; | ||
@@ -1384,3 +1384,3 @@ return key; | ||
// Syntax errors in formatter | ||
console && console.log(e); | ||
if (console) console.log(e); | ||
} | ||
@@ -1398,3 +1398,3 @@ } else { | ||
} catch (e) { | ||
console && console.log(e); | ||
if (console) console.log(e); | ||
} | ||
@@ -1428,7 +1428,8 @@ }; | ||
}, this); | ||
var renderLegend = function(data) { | ||
if (data && data.legend) render(url, data.legend); | ||
}; | ||
for (var i = 0; i < urls.length; i++) { | ||
var url = this.legendUrl(urls[i]); | ||
wax.request.get(url, function(data) { | ||
(data && data.legend) && (render(url, data.legend)); | ||
}); | ||
wax.request.get(url, renderLegend); | ||
} | ||
@@ -1518,3 +1519,3 @@ }; | ||
$(context).triggerHandler('removedtooltip', [feature, context, evt]) | ||
$(context).triggerHandler('removedtooltip', [feature, context, evt]); | ||
}; | ||
@@ -1521,0 +1522,0 @@ // Wax for Google Maps API v3 |
@@ -10,2 +10,2 @@ /* | ||
* MIT License: http://www.opensource.org/licenses/mit-license.php | ||
*/(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="<script/>",t="success",u="timeout",v=a.browser,w=a("head")[0]||document.documentElement,x={},y=0,z,A={callback:l,url:location.href};B.setup=function(b){a.extend(A,b)},a.jsonp=B})(jQuery,setTimeout);var wax=wax||{};wax.Record=function(a,b){var c=function(a,b){var c=_.reduce(a.split("."),function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(_.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=_.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=d.slice,g=d.unshift,h=e.toString,i=e.hasOwnProperty,j=d.forEach,k=d.map,l=d.reduce,m=d.reduceRight,n=d.filter,o=d.every,p=d.some,q=d.indexOf,r=d.lastIndexOf,s=Array.isArray,t=Object.keys,u=function(a){return new z(a)};typeof module!="undefined"&&module.exports?(module.exports=u,u._=u):a._=u,u.VERSION="1.1.4";var v=u.each=u.forEach=function(a,b,d){var e;if(a!=null)if(j&&a.forEach===j)a.forEach(b,d);else if(u.isNumber(a.length)){for(var f=0,g=a.length;f<g;f++)if(b.call(d,a[f],f,a)===c)return}else for(var h in a)if(i.call(a,h)&&b.call(d,a[h],h,a)===c)return};u.map=function(a,b,c){var d=[];if(a==null)return d;if(k&&a.map===k)return a.map(b,c);v(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)});return d},u.reduce=u.foldl=u.inject=function(a,b,c,d){var e=c!==void 0;a==null&&(a=[]);if(l&&a.reduce===l){d&&(b=u.bind(b,d));return e?a.reduce(b,c):a.reduce(b)}v(a,function(a,f,g){!e&&f===0?(c=a,e=!0):c=b.call(d,c,a,f,g)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},u.reduceRight=u.foldr=function(a,b,c,d){a==null&&(a=[]);if(m&&a.reduceRight===m){d&&(b=u.bind(b,d));return c!==void 0?a.reduceRight(b,c):a.reduceRight(b)}var e=(u.isArray(a)?a.slice():u.toArray(a)).reverse();return u.reduce(e,b,c,d)},u.find=u.detect=function(a,b,c){var d;w(a,function(a,e,f){if(b.call(c,a,e,f)){d=a;return!0}});return d},u.filter=u.select=function(a,b,c){var d=[];if(a==null)return d;if(n&&a.filter===n)return a.filter(b,c);v(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)});return d},u.reject=function(a,b,c){var d=[];if(a==null)return d;v(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)});return d},u.every=u.all=function(a,b,d){b=b||u.identity;var e=!0;if(a==null)return e;if(o&&a.every===o)return a.every(b,d);v(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c});return e};var w=u.some=u.any=function(a,b,d){b=b||u.identity;var e=!1;if(a==null)return e;if(p&&a.some===p)return a.some(b,d);v(a,function(a,f,g){if(e=b.call(d,a,f,g))return c});return e};u.include=u.contains=function(a,b){var c=!1;if(a==null)return c;if(q&&a.indexOf===q)return a.indexOf(b)!=-1;w(a,function(a){if(c=a===b)return!0});return c},u.invoke=function(a,b){var c=f.call(arguments,2);return u.map(a,function(a){return(b?a[b]:a).apply(a,c)})},u.pluck=function(a,b){return u.map(a,function(a){return a[b]})},u.max=function(a,b,c){if(!b&&u.isArray(a))return Math.max.apply(Math,a);var d={computed:-Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})});return d.value},u.min=function(a,b,c){if(!b&&u.isArray(a))return Math.min.apply(Math,a);var d={computed:Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})});return d.value},u.sortBy=function(a,b,c){return u.pluck(u.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},u.sortedIndex=function(a,b,c){c=c||u.identity;var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},u.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(u.isArray(a))return a;if(u.isArguments(a))return f.call(a);return u.values(a)},u.size=function(a){return u.toArray(a).length},u.first=u.head=function(a,b,c){return b&&!c?f.call(a,0,b):a[0]},u.rest=u.tail=function(a,b,c){return f.call(a,u.isUndefined(b)||c?1:b)},u.last=function(a){return a[a.length-1]},u.compact=function(a){return u.filter(a,function(a){return!!a})},u.flatten=function(a){return u.reduce(a,function(a,b){if(u.isArray(b))return a.concat(u.flatten(b));a[a.length]=b;return a},[])},u.without=function(a){var b=f.call(arguments,1);return u.filter(a,function(a){return!u.include(b,a)})},u.uniq=u.unique=function(a,b){return u.reduce(a,function(a,c,d){if(0==d||(b===!0?u.last(a)!=c:!u.include(a,c)))a[a.length]=c;return a},[])},u.intersect=function(a){var b=f.call(arguments,1);return u.filter(u.uniq(a),function(a){return u.every(b,function(b){return u.indexOf(b,a)>=0})})},u.zip=function(){var a=f.call(arguments),b=u.max(u.pluck(a,"length")),c=Array(b);for(var d=0;d<b;d++)c[d]=u.pluck(a,""+d);return c},u.indexOf=function(a,b,c){if(a==null)return-1;if(c){var d=u.sortedIndex(a,b);return a[d]===b?d:-1}if(q&&a.indexOf===q)return a.indexOf(b);for(var d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},u.lastIndexOf=function(a,b){if(a==null)return-1;if(r&&a.lastIndexOf===r)return a.lastIndexOf(b);var c=a.length;while(c--)if(a[c]===b)return c;return-1},u.range=function(a,b,c){var d=f.call(arguments),e=d.length<=1,a=e?0:d[0],b=e?d[0]:d[1],c=d[2]||1,g=Math.max(Math.ceil((b-a)/c),0),h=0,i=Array(g);while(h<g)i[h++]=a,a+=c;return i},u.bind=function(a,b){var c=f.call(arguments,2);return function(){return a.apply(b||{},c.concat(f.call(arguments)))}},u.bindAll=function(a){var b=f.call(arguments,1);b.length==0&&(b=u.functions(a)),v(b,function(b){a[b]=u.bind(a[b],a)});return a},u.memoize=function(a,b){var c={};b=b||u.identity;return function(){var d=b.apply(this,arguments);return d in c?c[d]:c[d]=a.apply(this,arguments)}},u.delay=function(a,b){var c=f.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},u.defer=function(a){return u.delay.apply(u,[a,1].concat(f.call(arguments,1)))};var x=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d);if(c||!d)d=setTimeout(g,b)}};u.throttle=function(a,b){return x(a,b,!1)},u.debounce=function(a,b){return x(a,b,!0)},u.wrap=function(a,b){return function(){var c=[a].concat(f.call(arguments));return b.apply(this,c)}},u.compose=function(){var a=f.call(arguments);return function(){var b=f.call(arguments);for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},u.keys=t||function(a){if(u.isArray(a))return u.range(0,a.length);var b=[];for(var c in a)i.call(a,c)&&(b[b.length]=c);return b},u.values=function(a){return u.map(a,u.identity)},u.functions=u.methods=function(a){return u.filter(u.keys(a),function(b){return u.isFunction(a[b])}).sort()},u.extend=function(a){v(f.call(arguments,1),function(b){for(var c in b)a[c]=b[c]});return a},u.clone=function(a){return u.isArray(a)?a.slice():u.extend({},a)},u.tap=function(a,b){b(a);return a},u.isEqual=function(a,b){if(a===b)return!0;var c=typeof a,d=typeof b;if(c!=d)return!1;if(a==b)return!0;if(!a&&b||a&&!b)return!1;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual)return a.isEqual(b);if(u.isDate(a)&&u.isDate(b))return a.getTime()===b.getTime();if(u.isNaN(a)&&u.isNaN(b))return!1;if(u.isRegExp(a)&&u.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(c!=="object")return!1;if(a.length&&a.length!==b.length)return!1;var e=u.keys(a),f=u.keys(b);if(e.length!=f.length)return!1;for(var g in a)if(!(g in b)||!u.isEqual(a[g],b[g]))return!1;return!0},u.isEmpty=function(a){if(u.isArray(a)||u.isString(a))return a.length===0;for(var b in a)if(i.call(a,b))return!1;return!0},u.isElement=function(a){return!!a&&a.nodeType==1},u.isArray=s||function(a){return h.call(a)==="[object Array]"},u.isArguments=function(a){return!!a&&!!i.call(a,"callee")},u.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)},u.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},u.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)},u.isNaN=function(a){return a!==a},u.isBoolean=function(a){return a===!0||a===!1},u.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},u.isRegExp=function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},u.isNull=function(a){return a===null},u.isUndefined=function(a){return a===void 0},u.noConflict=function(){a._=b;return this},u.identity=function(a){return a},u.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},u.mixin=function(a){v(u.functions(a),function(b){B(b,u[b]=a[b])})};var y=0;u.uniqueId=function(a){var b=y++;return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},u.template=function(a,b){var c=u.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj",d);return b?e(b):e};var z=function(a){this._wrapped=a};u.prototype=z.prototype;var A=function(a,b){return b?u(a).chain():a},B=function(a,b){z.prototype[a]=function(){var a=f.call(arguments);g.call(a,this._wrapped);return A(b.apply(u,a),this._chain)}};u.mixin(u),v(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];z.prototype[a]=function(){b.apply(this._wrapped,arguments);return A(this._wrapped,this._chain)}}),v(["concat","join","slice"],function(a){var b=d[a];z.prototype[a]=function(){return A(b.apply(this._wrapped,arguments),this._chain)}}),z.prototype.chain=function(){this._chain=!0;return this},z.prototype.value=function(){return this._wrapped}}();var wax=wax||{};(function(a){a.fn.extend({nondrag:function(b){a(this).bind("mousedown mouseup mousemove",function(a){var c=!1;if(a.type==="mouseup")c=!1;else if(c||a.type==="mousedown"){c=!0;return}b(a)});return this}})})(jQuery),wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,$.jsonp({url:a,context:this,callback:"grid",callbackParameter:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=b;for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a])},error:function(){c.locks[a]=!1,c.cache[a]=null;for(var b=0;b<c.promises[a].length;b++)c.promises[a][b](c.cache[a])}})}}},wax.GridInstance=function(a,b){this.grid_tile=a,this.formatter=b,this.tileRes=4},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){var e,f;if(c.left&&c.top)e=c.left,f=c.top;else{var g=$(c);e=g.offset().left,f=g.offset().top}if(Math.floor((b-f)/this.tileRes)>256||Math.floor((a-e)/this.tileRes)>256)return;var h=this.grid_tile.grid[Math.floor((b-f)/this.tileRes)].charCodeAt(Math.floor((a-e)/this.tileRes));h=this.resolveCode(h);if(this.grid_tile.keys[h])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[h]])}},wax.GridManager=function(){this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d){if(!d)return b(!1);wax.request.get(c.tileDataUrl(a),function(a){b(new wax.GridInstance(a,d))})})},wax.GridManager.prototype.makeEvent=function(a){return{target:a.target||a.srcElement,pX:a.pageX||a.clientX,pY:a.pageY||a.clientY,evt:a}},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(this.formatters[a]):wax.request.get(a,function(d){d&&d.formatter?c.formatters[a]=new wax.Formatter(d):c.formatters[a]=!1,b(c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.context=a,this.container=b||$('<div class="wax-legends"></div>'),this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){$(".wax-legend",this.container).hide();var b=$.proxy(function(a,b){b?this.legends[a]?this.legends[a].show():(this.legends[a]=$("<div class='wax-legend'></div>").append(b),this.container.append(this.legends[a])):this.legends[a]=!1},this);for(var c=0;c<a.length;c++){var d=this.legendUrl(a[c]);wax.request.get(d,function(a){a&&a.legend&&b(d,a.legend)})}},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var wax=wax||{};wax.tooltip={},wax.tooltip.getToolTip=function(a,b,c,d){var e=$(b).children("div.wax-tooltip-"+c+":not(.removed)");e.size()===0&&(e=$("<div class='wax-tooltip wax-tooltip-"+c+"'>"+"</div>").html(a),$(b).triggerHandler("addedtooltip",[e,b,d])||$(b).append(e));for(var f=c-1;f>0;f--){var g=$("div.wax-tooltip-"+f+":not(.removed)");g.size()>0&&g.addClass("hidden").hide()}return e},wax.tooltip.click=function(a,b,c){var d=wax.tooltip.getToolTip(a,b,c),e=$('<a href="#close" class="close">Close</a>');e.click(function(){d.addClass("removed").fadeOut("fast",function(){$(this).remove()});return!1}),d.addClass("wax-popup").html(a).append(e)},wax.tooltip.select=function(a,b,c,d){!a||(wax.tooltip.getToolTip(a,b,c,d),$(b).css("cursor","pointer"),$("div",b).css("cursor","pointer"))},wax.tooltip.unselect=function(a,b,c,d){$(b).css("cursor","default"),c?$("div.wax-tooltip-"+c+":not(.wax-popup)").remove():$("div.wax-tooltip:not(.wax-popup)").remove(),$("div",b).css("cursor","default"),$("div.wax-tooltip:first").removeClass("hidden").show(),$(b).triggerHandler("removedtooltip",[a,b,d])};var wax=wax||{};wax.g=wax.g||{},wax.g.Controls=function(a){this.map=a,this.mapDiv=!1;for(var b in a)if(a[b]&&a[b].nodeType>0){this.mapDiv=a[b];break}},wax.g.Controls.prototype.calculateGrid=function(){if(!this.map.interaction_grid){var a=$("div.interactive-div-"+this.map.getZoom()+" img",this.mapDiv),b=$(this.mapDiv).offset(),c=$(a).map(function(c){var d=$(a[c]).offset();return{xy:{left:d.left-b.left,top:d.top-b.top},tile:a[c]}});return c}},wax.g.Controls.prototype.interaction=function(a){a=a||{};var b=this,c=new wax.GridManager,d=null,e=a.callbacks||{out:wax.tooltip.unselect,over:wax.tooltip.select,click:wax.tooltip.click},f=function(a,b){if(b.top<a.y&&b.top+256>a.y&&b.left<a.x&&b.left+256>a.x)return!0},g=$.proxy(function(a,b){var c=!1,d=this.calculateGrid();for(var e=0;e<d.length&&!c;e++)if(f(b.pixel,d[e].xy))var c=d[e];return c},this);google.maps.event.addListener(this.map,"mousemove",function(a){var f={format:"teaser"},h=g(this.map,a);!h||c.getGrid($(h.tile).attr("src"),function(c){if(!!c){var g=c.getFeature(a.pixel.x+$(b.mapDiv).offset().left,a.pixel.y+$(b.mapDiv).offset().top,h.tile,f);g!==d&&(e.out(g,$(b.mapDiv),0),e.over(g,$(b.mapDiv),0),d=g)}})}),google.maps.event.addListener(this.map,"click",function(d){var f={format:a.clickAction||"full"},h=g(this.map,d);!h||c.getGrid($(h.tile).attr("src"),function(a){if(!!a){var c=a.getFeature(d.pixel.x+$(b.mapDiv).offset().left,d.pixel.y+$(b.mapDiv).offset().top,h.tile,f);c&&(f.format=="full"?e.click(c,$(b.mapDiv),0):window.location=c)}})});return this},wax.g.Controls.prototype.legend=function(){var a=new wax.Legend($(this.mapDiv)),b=null;google.maps.event.addListener(this.map,"idle",$.proxy(function(){if(!b){var c=$("div.interactive-div-"+this.map.getZoom()+" img:first",this.mapDiv);c&&(b=c.attr("src"))&&a.render([b])}},this));return this},wax.g.Controls.prototype.embedder=function(a){$(this.mapDiv).prepend($('<input type="text" class="embed-src" />').css({"z-index":"9999999999",position:"relative"}).val("<div id='"+a+"'>"+$("#"+a).html()+"</div>"));return this};var wax=wax||{};wax.g=wax.g||{},wax.g.MapType=function(a){a=a||{},this.name=a.name||"",this.alt=a.alt||"",this.filetype=a.filetype||".png",this.layerName=a.layerName||"world-light",a.zoomRange?(this.minZoom=a.zoomRange[0],this.maxZoom=a.zoomRange[1]):(this.minZoom=0,this.maxZoom=18),this.baseUrl=a.baseUrl||"http://a.tile.mapbox.com/",this.blankImage=a.blankImage||"",this.interactive=!0,this.tileSize=new google.maps.Size(256,256),this.cache={}},wax.g.MapType.prototype.getTile=function(a,b,c){var d=b+"/"+a.x+"/"+a.y;this.cache[d]=this.cache[d]||$("<div></div>").addClass("interactive-div-"+b).width(256).height(256).data("gTileKey",d).append($("<img />").width(256).height(256).attr("src",this.getTileUrl(a,b)).error(function(){$(this).hide()}))[0];return this.cache[d]},wax.g.MapType.prototype.releaseTile=function(a){var b=$(a).data("gTileKey");this.cache[b]&&delete this.cache[b],$(a).remove()},wax.g.MapType.prototype.getTileUrl=function(a,b){var c=Math.pow(2,b),d=c-1-a.y,e=a.x%c;e=e<0?a.x%c+c:e;return d>=0?this.baseUrl+"1.0.0/"+this.layerName+"/"+b+"/"+e+"/"+d+this.filetype:this.blankImage} | ||
*/(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="<script/>",t="success",u="timeout",v=a.browser,w=a("head")[0]||document.documentElement,x={},y=0,z,A={callback:l,url:location.href};B.setup=function(b){a.extend(A,b)},a.jsonp=B})(jQuery,setTimeout);var wax=wax||{};wax.Record=function(a,b){var c=function(a,b){var c=_.reduce(a.split("."),function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(_.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=_.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=d.slice,g=d.unshift,h=e.toString,i=e.hasOwnProperty,j=d.forEach,k=d.map,l=d.reduce,m=d.reduceRight,n=d.filter,o=d.every,p=d.some,q=d.indexOf,r=d.lastIndexOf,s=Array.isArray,t=Object.keys,u=function(a){return new z(a)};typeof module!="undefined"&&module.exports?(module.exports=u,u._=u):a._=u,u.VERSION="1.1.4";var v=u.each=u.forEach=function(a,b,d){var e;if(a!=null)if(j&&a.forEach===j)a.forEach(b,d);else if(u.isNumber(a.length)){for(var f=0,g=a.length;f<g;f++)if(b.call(d,a[f],f,a)===c)return}else for(var h in a)if(i.call(a,h)&&b.call(d,a[h],h,a)===c)return};u.map=function(a,b,c){var d=[];if(a==null)return d;if(k&&a.map===k)return a.map(b,c);v(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)});return d},u.reduce=u.foldl=u.inject=function(a,b,c,d){var e=c!==void 0;a==null&&(a=[]);if(l&&a.reduce===l){d&&(b=u.bind(b,d));return e?a.reduce(b,c):a.reduce(b)}v(a,function(a,f,g){!e&&f===0?(c=a,e=!0):c=b.call(d,c,a,f,g)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},u.reduceRight=u.foldr=function(a,b,c,d){a==null&&(a=[]);if(m&&a.reduceRight===m){d&&(b=u.bind(b,d));return c!==void 0?a.reduceRight(b,c):a.reduceRight(b)}var e=(u.isArray(a)?a.slice():u.toArray(a)).reverse();return u.reduce(e,b,c,d)},u.find=u.detect=function(a,b,c){var d;w(a,function(a,e,f){if(b.call(c,a,e,f)){d=a;return!0}});return d},u.filter=u.select=function(a,b,c){var d=[];if(a==null)return d;if(n&&a.filter===n)return a.filter(b,c);v(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)});return d},u.reject=function(a,b,c){var d=[];if(a==null)return d;v(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)});return d},u.every=u.all=function(a,b,d){b=b||u.identity;var e=!0;if(a==null)return e;if(o&&a.every===o)return a.every(b,d);v(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c});return e};var w=u.some=u.any=function(a,b,d){b=b||u.identity;var e=!1;if(a==null)return e;if(p&&a.some===p)return a.some(b,d);v(a,function(a,f,g){if(e=b.call(d,a,f,g))return c});return e};u.include=u.contains=function(a,b){var c=!1;if(a==null)return c;if(q&&a.indexOf===q)return a.indexOf(b)!=-1;w(a,function(a){if(c=a===b)return!0});return c},u.invoke=function(a,b){var c=f.call(arguments,2);return u.map(a,function(a){return(b?a[b]:a).apply(a,c)})},u.pluck=function(a,b){return u.map(a,function(a){return a[b]})},u.max=function(a,b,c){if(!b&&u.isArray(a))return Math.max.apply(Math,a);var d={computed:-Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})});return d.value},u.min=function(a,b,c){if(!b&&u.isArray(a))return Math.min.apply(Math,a);var d={computed:Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})});return d.value},u.sortBy=function(a,b,c){return u.pluck(u.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},u.sortedIndex=function(a,b,c){c=c||u.identity;var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},u.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(u.isArray(a))return a;if(u.isArguments(a))return f.call(a);return u.values(a)},u.size=function(a){return u.toArray(a).length},u.first=u.head=function(a,b,c){return b&&!c?f.call(a,0,b):a[0]},u.rest=u.tail=function(a,b,c){return f.call(a,u.isUndefined(b)||c?1:b)},u.last=function(a){return a[a.length-1]},u.compact=function(a){return u.filter(a,function(a){return!!a})},u.flatten=function(a){return u.reduce(a,function(a,b){if(u.isArray(b))return a.concat(u.flatten(b));a[a.length]=b;return a},[])},u.without=function(a){var b=f.call(arguments,1);return u.filter(a,function(a){return!u.include(b,a)})},u.uniq=u.unique=function(a,b){return u.reduce(a,function(a,c,d){if(0==d||(b===!0?u.last(a)!=c:!u.include(a,c)))a[a.length]=c;return a},[])},u.intersect=function(a){var b=f.call(arguments,1);return u.filter(u.uniq(a),function(a){return u.every(b,function(b){return u.indexOf(b,a)>=0})})},u.zip=function(){var a=f.call(arguments),b=u.max(u.pluck(a,"length")),c=Array(b);for(var d=0;d<b;d++)c[d]=u.pluck(a,""+d);return c},u.indexOf=function(a,b,c){if(a==null)return-1;if(c){var d=u.sortedIndex(a,b);return a[d]===b?d:-1}if(q&&a.indexOf===q)return a.indexOf(b);for(var d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},u.lastIndexOf=function(a,b){if(a==null)return-1;if(r&&a.lastIndexOf===r)return a.lastIndexOf(b);var c=a.length;while(c--)if(a[c]===b)return c;return-1},u.range=function(a,b,c){var d=f.call(arguments),e=d.length<=1,a=e?0:d[0],b=e?d[0]:d[1],c=d[2]||1,g=Math.max(Math.ceil((b-a)/c),0),h=0,i=Array(g);while(h<g)i[h++]=a,a+=c;return i},u.bind=function(a,b){var c=f.call(arguments,2);return function(){return a.apply(b||{},c.concat(f.call(arguments)))}},u.bindAll=function(a){var b=f.call(arguments,1);b.length==0&&(b=u.functions(a)),v(b,function(b){a[b]=u.bind(a[b],a)});return a},u.memoize=function(a,b){var c={};b=b||u.identity;return function(){var d=b.apply(this,arguments);return d in c?c[d]:c[d]=a.apply(this,arguments)}},u.delay=function(a,b){var c=f.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},u.defer=function(a){return u.delay.apply(u,[a,1].concat(f.call(arguments,1)))};var x=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d);if(c||!d)d=setTimeout(g,b)}};u.throttle=function(a,b){return x(a,b,!1)},u.debounce=function(a,b){return x(a,b,!0)},u.wrap=function(a,b){return function(){var c=[a].concat(f.call(arguments));return b.apply(this,c)}},u.compose=function(){var a=f.call(arguments);return function(){var b=f.call(arguments);for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},u.keys=t||function(a){if(u.isArray(a))return u.range(0,a.length);var b=[];for(var c in a)i.call(a,c)&&(b[b.length]=c);return b},u.values=function(a){return u.map(a,u.identity)},u.functions=u.methods=function(a){return u.filter(u.keys(a),function(b){return u.isFunction(a[b])}).sort()},u.extend=function(a){v(f.call(arguments,1),function(b){for(var c in b)a[c]=b[c]});return a},u.clone=function(a){return u.isArray(a)?a.slice():u.extend({},a)},u.tap=function(a,b){b(a);return a},u.isEqual=function(a,b){if(a===b)return!0;var c=typeof a,d=typeof b;if(c!=d)return!1;if(a==b)return!0;if(!a&&b||a&&!b)return!1;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual)return a.isEqual(b);if(u.isDate(a)&&u.isDate(b))return a.getTime()===b.getTime();if(u.isNaN(a)&&u.isNaN(b))return!1;if(u.isRegExp(a)&&u.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(c!=="object")return!1;if(a.length&&a.length!==b.length)return!1;var e=u.keys(a),f=u.keys(b);if(e.length!=f.length)return!1;for(var g in a)if(!(g in b)||!u.isEqual(a[g],b[g]))return!1;return!0},u.isEmpty=function(a){if(u.isArray(a)||u.isString(a))return a.length===0;for(var b in a)if(i.call(a,b))return!1;return!0},u.isElement=function(a){return!!a&&a.nodeType==1},u.isArray=s||function(a){return h.call(a)==="[object Array]"},u.isArguments=function(a){return!!a&&!!i.call(a,"callee")},u.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)},u.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},u.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)},u.isNaN=function(a){return a!==a},u.isBoolean=function(a){return a===!0||a===!1},u.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},u.isRegExp=function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},u.isNull=function(a){return a===null},u.isUndefined=function(a){return a===void 0},u.noConflict=function(){a._=b;return this},u.identity=function(a){return a},u.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},u.mixin=function(a){v(u.functions(a),function(b){B(b,u[b]=a[b])})};var y=0;u.uniqueId=function(a){var b=y++;return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},u.template=function(a,b){var c=u.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj",d);return b?e(b):e};var z=function(a){this._wrapped=a};u.prototype=z.prototype;var A=function(a,b){return b?u(a).chain():a},B=function(a,b){z.prototype[a]=function(){var a=f.call(arguments);g.call(a,this._wrapped);return A(b.apply(u,a),this._chain)}};u.mixin(u),v(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];z.prototype[a]=function(){b.apply(this._wrapped,arguments);return A(this._wrapped,this._chain)}}),v(["concat","join","slice"],function(a){var b=d[a];z.prototype[a]=function(){return A(b.apply(this._wrapped,arguments),this._chain)}}),z.prototype.chain=function(){this._chain=!0;return this},z.prototype.value=function(){return this._wrapped}}();var wax=wax||{};(function(a){a.fn.extend({nondrag:function(b){a(this).bind("mousedown mouseup mousemove",function(a){var c=!1;if(a.type==="mouseup")c=!1;else if(c||a.type==="mousedown"){c=!0;return}b(a)});return this}})})(jQuery),wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,$.jsonp({url:a,context:this,callback:"grid",callbackParameter:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=b;for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a])},error:function(){c.locks[a]=!1,c.cache[a]=null;for(var b=0;b<c.promises[a].length;b++)c.promises[a][b](c.cache[a])}})}}},wax.GridInstance=function(a,b){this.grid_tile=a,this.formatter=b,this.tileRes=4},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){var e,f;if(c.left&&c.top)e=c.left,f=c.top;else{var g=$(c);e=g.offset().left,f=g.offset().top}if(Math.floor((b-f)/this.tileRes)>256||Math.floor((a-e)/this.tileRes)>256)return;var h=this.grid_tile.grid[Math.floor((b-f)/this.tileRes)].charCodeAt(Math.floor((a-e)/this.tileRes));h=this.resolveCode(h);if(this.grid_tile.keys[h])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[h]])}},wax.GridManager=function(){this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d){if(!d)return b(!1);wax.request.get(c.tileDataUrl(a),function(a){b(new wax.GridInstance(a,d))})})},wax.GridManager.prototype.makeEvent=function(a){return{target:a.target||a.srcElement,pX:a.pageX||a.clientX,pY:a.pageY||a.clientY,evt:a}},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(this.formatters[a]):wax.request.get(a,function(d){d&&d.formatter?c.formatters[a]=new wax.Formatter(d):c.formatters[a]=!1,b(c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.context=a,this.container=b||$('<div class="wax-legends"></div>'),this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){$(".wax-legend",this.container).hide();var b=$.proxy(function(a,b){b?this.legends[a]?this.legends[a].show():(this.legends[a]=$("<div class='wax-legend'></div>").append(b),this.container.append(this.legends[a])):this.legends[a]=!1},this),c=function(a){a&&a.legend&&b(e,a.legend)};for(var d=0;d<a.length;d++){var e=this.legendUrl(a[d]);wax.request.get(e,c)}},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var wax=wax||{};wax.tooltip={},wax.tooltip.getToolTip=function(a,b,c,d){var e=$(b).children("div.wax-tooltip-"+c+":not(.removed)");e.size()===0&&(e=$("<div class='wax-tooltip wax-tooltip-"+c+"'>"+"</div>").html(a),$(b).triggerHandler("addedtooltip",[e,b,d])||$(b).append(e));for(var f=c-1;f>0;f--){var g=$("div.wax-tooltip-"+f+":not(.removed)");g.size()>0&&g.addClass("hidden").hide()}return e},wax.tooltip.click=function(a,b,c){var d=wax.tooltip.getToolTip(a,b,c),e=$('<a href="#close" class="close">Close</a>');e.click(function(){d.addClass("removed").fadeOut("fast",function(){$(this).remove()});return!1}),d.addClass("wax-popup").html(a).append(e)},wax.tooltip.select=function(a,b,c,d){!a||(wax.tooltip.getToolTip(a,b,c,d),$(b).css("cursor","pointer"),$("div",b).css("cursor","pointer"))},wax.tooltip.unselect=function(a,b,c,d){$(b).css("cursor","default"),c?$("div.wax-tooltip-"+c+":not(.wax-popup)").remove():$("div.wax-tooltip:not(.wax-popup)").remove(),$("div",b).css("cursor","default"),$("div.wax-tooltip:first").removeClass("hidden").show(),$(b).triggerHandler("removedtooltip",[a,b,d])};var wax=wax||{};wax.g=wax.g||{},wax.g.Controls=function(a){this.map=a,this.mapDiv=!1;for(var b in a)if(a[b]&&a[b].nodeType>0){this.mapDiv=a[b];break}},wax.g.Controls.prototype.calculateGrid=function(){if(!this.map.interaction_grid){var a=$("div.interactive-div-"+this.map.getZoom()+" img",this.mapDiv),b=$(this.mapDiv).offset(),c=$(a).map(function(c){var d=$(a[c]).offset();return{xy:{left:d.left-b.left,top:d.top-b.top},tile:a[c]}});return c}},wax.g.Controls.prototype.interaction=function(a){a=a||{};var b=this,c=new wax.GridManager,d=null,e=a.callbacks||{out:wax.tooltip.unselect,over:wax.tooltip.select,click:wax.tooltip.click},f=function(a,b){if(b.top<a.y&&b.top+256>a.y&&b.left<a.x&&b.left+256>a.x)return!0},g=$.proxy(function(a,b){var c=!1,d=this.calculateGrid();for(var e=0;e<d.length&&!c;e++)if(f(b.pixel,d[e].xy))var c=d[e];return c},this);google.maps.event.addListener(this.map,"mousemove",function(a){var f={format:"teaser"},h=g(this.map,a);!h||c.getGrid($(h.tile).attr("src"),function(c){if(!!c){var g=c.getFeature(a.pixel.x+$(b.mapDiv).offset().left,a.pixel.y+$(b.mapDiv).offset().top,h.tile,f);g!==d&&(e.out(g,$(b.mapDiv),0),e.over(g,$(b.mapDiv),0),d=g)}})}),google.maps.event.addListener(this.map,"click",function(d){var f={format:a.clickAction||"full"},h=g(this.map,d);!h||c.getGrid($(h.tile).attr("src"),function(a){if(!!a){var c=a.getFeature(d.pixel.x+$(b.mapDiv).offset().left,d.pixel.y+$(b.mapDiv).offset().top,h.tile,f);c&&(f.format=="full"?e.click(c,$(b.mapDiv),0):window.location=c)}})});return this},wax.g.Controls.prototype.legend=function(){var a=new wax.Legend($(this.mapDiv)),b=null;google.maps.event.addListener(this.map,"idle",$.proxy(function(){if(!b){var c=$("div.interactive-div-"+this.map.getZoom()+" img:first",this.mapDiv);c&&(b=c.attr("src"))&&a.render([b])}},this));return this},wax.g.Controls.prototype.embedder=function(a){$(this.mapDiv).prepend($('<input type="text" class="embed-src" />').css({"z-index":"9999999999",position:"relative"}).val("<div id='"+a+"'>"+$("#"+a).html()+"</div>"));return this};var wax=wax||{};wax.g=wax.g||{},wax.g.MapType=function(a){a=a||{},this.name=a.name||"",this.alt=a.alt||"",this.filetype=a.filetype||".png",this.layerName=a.layerName||"world-light",a.zoomRange?(this.minZoom=a.zoomRange[0],this.maxZoom=a.zoomRange[1]):(this.minZoom=0,this.maxZoom=18),this.baseUrl=a.baseUrl||"http://a.tile.mapbox.com/",this.blankImage=a.blankImage||"",this.interactive=!0,this.tileSize=new google.maps.Size(256,256),this.cache={}},wax.g.MapType.prototype.getTile=function(a,b,c){var d=b+"/"+a.x+"/"+a.y;this.cache[d]=this.cache[d]||$("<div></div>").addClass("interactive-div-"+b).width(256).height(256).data("gTileKey",d).append($("<img />").width(256).height(256).attr("src",this.getTileUrl(a,b)).error(function(){$(this).hide()}))[0];return this.cache[d]},wax.g.MapType.prototype.releaseTile=function(a){var b=$(a).data("gTileKey");this.cache[b]&&delete this.cache[b],$(a).remove()},wax.g.MapType.prototype.getTileUrl=function(a,b){var c=Math.pow(2,b),d=c-1-a.y,e=a.x%c;e=e<0?a.x%c+c:e;return d>=0?this.baseUrl+"1.0.0/"+this.layerName+"/"+b+"/"+e+"/"+d+this.filetype:this.blankImage} |
@@ -10,2 +10,2 @@ /* | ||
* MIT License: http://www.opensource.org/licenses/mit-license.php | ||
*/(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="<script/>",t="success",u="timeout",v=a.browser,w=a("head")[0]||document.documentElement,x={},y=0,z,A={callback:l,url:location.href};B.setup=function(b){a.extend(A,b)},a.jsonp=B})(jQuery,setTimeout);var wax=wax||{};wax.Record=function(a,b){var c=function(a,b){var c=_.reduce(a.split("."),function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(_.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=_.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=d.slice,g=d.unshift,h=e.toString,i=e.hasOwnProperty,j=d.forEach,k=d.map,l=d.reduce,m=d.reduceRight,n=d.filter,o=d.every,p=d.some,q=d.indexOf,r=d.lastIndexOf,s=Array.isArray,t=Object.keys,u=function(a){return new z(a)};typeof module!="undefined"&&module.exports?(module.exports=u,u._=u):a._=u,u.VERSION="1.1.4";var v=u.each=u.forEach=function(a,b,d){var e;if(a!=null)if(j&&a.forEach===j)a.forEach(b,d);else if(u.isNumber(a.length)){for(var f=0,g=a.length;f<g;f++)if(b.call(d,a[f],f,a)===c)return}else for(var h in a)if(i.call(a,h)&&b.call(d,a[h],h,a)===c)return};u.map=function(a,b,c){var d=[];if(a==null)return d;if(k&&a.map===k)return a.map(b,c);v(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)});return d},u.reduce=u.foldl=u.inject=function(a,b,c,d){var e=c!==void 0;a==null&&(a=[]);if(l&&a.reduce===l){d&&(b=u.bind(b,d));return e?a.reduce(b,c):a.reduce(b)}v(a,function(a,f,g){!e&&f===0?(c=a,e=!0):c=b.call(d,c,a,f,g)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},u.reduceRight=u.foldr=function(a,b,c,d){a==null&&(a=[]);if(m&&a.reduceRight===m){d&&(b=u.bind(b,d));return c!==void 0?a.reduceRight(b,c):a.reduceRight(b)}var e=(u.isArray(a)?a.slice():u.toArray(a)).reverse();return u.reduce(e,b,c,d)},u.find=u.detect=function(a,b,c){var d;w(a,function(a,e,f){if(b.call(c,a,e,f)){d=a;return!0}});return d},u.filter=u.select=function(a,b,c){var d=[];if(a==null)return d;if(n&&a.filter===n)return a.filter(b,c);v(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)});return d},u.reject=function(a,b,c){var d=[];if(a==null)return d;v(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)});return d},u.every=u.all=function(a,b,d){b=b||u.identity;var e=!0;if(a==null)return e;if(o&&a.every===o)return a.every(b,d);v(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c});return e};var w=u.some=u.any=function(a,b,d){b=b||u.identity;var e=!1;if(a==null)return e;if(p&&a.some===p)return a.some(b,d);v(a,function(a,f,g){if(e=b.call(d,a,f,g))return c});return e};u.include=u.contains=function(a,b){var c=!1;if(a==null)return c;if(q&&a.indexOf===q)return a.indexOf(b)!=-1;w(a,function(a){if(c=a===b)return!0});return c},u.invoke=function(a,b){var c=f.call(arguments,2);return u.map(a,function(a){return(b?a[b]:a).apply(a,c)})},u.pluck=function(a,b){return u.map(a,function(a){return a[b]})},u.max=function(a,b,c){if(!b&&u.isArray(a))return Math.max.apply(Math,a);var d={computed:-Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})});return d.value},u.min=function(a,b,c){if(!b&&u.isArray(a))return Math.min.apply(Math,a);var d={computed:Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})});return d.value},u.sortBy=function(a,b,c){return u.pluck(u.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},u.sortedIndex=function(a,b,c){c=c||u.identity;var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},u.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(u.isArray(a))return a;if(u.isArguments(a))return f.call(a);return u.values(a)},u.size=function(a){return u.toArray(a).length},u.first=u.head=function(a,b,c){return b&&!c?f.call(a,0,b):a[0]},u.rest=u.tail=function(a,b,c){return f.call(a,u.isUndefined(b)||c?1:b)},u.last=function(a){return a[a.length-1]},u.compact=function(a){return u.filter(a,function(a){return!!a})},u.flatten=function(a){return u.reduce(a,function(a,b){if(u.isArray(b))return a.concat(u.flatten(b));a[a.length]=b;return a},[])},u.without=function(a){var b=f.call(arguments,1);return u.filter(a,function(a){return!u.include(b,a)})},u.uniq=u.unique=function(a,b){return u.reduce(a,function(a,c,d){if(0==d||(b===!0?u.last(a)!=c:!u.include(a,c)))a[a.length]=c;return a},[])},u.intersect=function(a){var b=f.call(arguments,1);return u.filter(u.uniq(a),function(a){return u.every(b,function(b){return u.indexOf(b,a)>=0})})},u.zip=function(){var a=f.call(arguments),b=u.max(u.pluck(a,"length")),c=Array(b);for(var d=0;d<b;d++)c[d]=u.pluck(a,""+d);return c},u.indexOf=function(a,b,c){if(a==null)return-1;if(c){var d=u.sortedIndex(a,b);return a[d]===b?d:-1}if(q&&a.indexOf===q)return a.indexOf(b);for(var d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},u.lastIndexOf=function(a,b){if(a==null)return-1;if(r&&a.lastIndexOf===r)return a.lastIndexOf(b);var c=a.length;while(c--)if(a[c]===b)return c;return-1},u.range=function(a,b,c){var d=f.call(arguments),e=d.length<=1,a=e?0:d[0],b=e?d[0]:d[1],c=d[2]||1,g=Math.max(Math.ceil((b-a)/c),0),h=0,i=Array(g);while(h<g)i[h++]=a,a+=c;return i},u.bind=function(a,b){var c=f.call(arguments,2);return function(){return a.apply(b||{},c.concat(f.call(arguments)))}},u.bindAll=function(a){var b=f.call(arguments,1);b.length==0&&(b=u.functions(a)),v(b,function(b){a[b]=u.bind(a[b],a)});return a},u.memoize=function(a,b){var c={};b=b||u.identity;return function(){var d=b.apply(this,arguments);return d in c?c[d]:c[d]=a.apply(this,arguments)}},u.delay=function(a,b){var c=f.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},u.defer=function(a){return u.delay.apply(u,[a,1].concat(f.call(arguments,1)))};var x=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d);if(c||!d)d=setTimeout(g,b)}};u.throttle=function(a,b){return x(a,b,!1)},u.debounce=function(a,b){return x(a,b,!0)},u.wrap=function(a,b){return function(){var c=[a].concat(f.call(arguments));return b.apply(this,c)}},u.compose=function(){var a=f.call(arguments);return function(){var b=f.call(arguments);for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},u.keys=t||function(a){if(u.isArray(a))return u.range(0,a.length);var b=[];for(var c in a)i.call(a,c)&&(b[b.length]=c);return b},u.values=function(a){return u.map(a,u.identity)},u.functions=u.methods=function(a){return u.filter(u.keys(a),function(b){return u.isFunction(a[b])}).sort()},u.extend=function(a){v(f.call(arguments,1),function(b){for(var c in b)a[c]=b[c]});return a},u.clone=function(a){return u.isArray(a)?a.slice():u.extend({},a)},u.tap=function(a,b){b(a);return a},u.isEqual=function(a,b){if(a===b)return!0;var c=typeof a,d=typeof b;if(c!=d)return!1;if(a==b)return!0;if(!a&&b||a&&!b)return!1;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual)return a.isEqual(b);if(u.isDate(a)&&u.isDate(b))return a.getTime()===b.getTime();if(u.isNaN(a)&&u.isNaN(b))return!1;if(u.isRegExp(a)&&u.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(c!=="object")return!1;if(a.length&&a.length!==b.length)return!1;var e=u.keys(a),f=u.keys(b);if(e.length!=f.length)return!1;for(var g in a)if(!(g in b)||!u.isEqual(a[g],b[g]))return!1;return!0},u.isEmpty=function(a){if(u.isArray(a)||u.isString(a))return a.length===0;for(var b in a)if(i.call(a,b))return!1;return!0},u.isElement=function(a){return!!a&&a.nodeType==1},u.isArray=s||function(a){return h.call(a)==="[object Array]"},u.isArguments=function(a){return!!a&&!!i.call(a,"callee")},u.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)},u.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},u.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)},u.isNaN=function(a){return a!==a},u.isBoolean=function(a){return a===!0||a===!1},u.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},u.isRegExp=function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},u.isNull=function(a){return a===null},u.isUndefined=function(a){return a===void 0},u.noConflict=function(){a._=b;return this},u.identity=function(a){return a},u.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},u.mixin=function(a){v(u.functions(a),function(b){B(b,u[b]=a[b])})};var y=0;u.uniqueId=function(a){var b=y++;return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},u.template=function(a,b){var c=u.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj",d);return b?e(b):e};var z=function(a){this._wrapped=a};u.prototype=z.prototype;var A=function(a,b){return b?u(a).chain():a},B=function(a,b){z.prototype[a]=function(){var a=f.call(arguments);g.call(a,this._wrapped);return A(b.apply(u,a),this._chain)}};u.mixin(u),v(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];z.prototype[a]=function(){b.apply(this._wrapped,arguments);return A(this._wrapped,this._chain)}}),v(["concat","join","slice"],function(a){var b=d[a];z.prototype[a]=function(){return A(b.apply(this._wrapped,arguments),this._chain)}}),z.prototype.chain=function(){this._chain=!0;return this},z.prototype.value=function(){return this._wrapped}}();var wax=wax||{};(function(a){a.fn.extend({nondrag:function(b){a(this).bind("mousedown mouseup mousemove",function(a){var c=!1;if(a.type==="mouseup")c=!1;else if(c||a.type==="mousedown"){c=!0;return}b(a)});return this}})})(jQuery),wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,$.jsonp({url:a,context:this,callback:"grid",callbackParameter:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=b;for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a])},error:function(){c.locks[a]=!1,c.cache[a]=null;for(var b=0;b<c.promises[a].length;b++)c.promises[a][b](c.cache[a])}})}}},wax.GridInstance=function(a,b){this.grid_tile=a,this.formatter=b,this.tileRes=4},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){var e,f;if(c.left&&c.top)e=c.left,f=c.top;else{var g=$(c);e=g.offset().left,f=g.offset().top}if(Math.floor((b-f)/this.tileRes)>256||Math.floor((a-e)/this.tileRes)>256)return;var h=this.grid_tile.grid[Math.floor((b-f)/this.tileRes)].charCodeAt(Math.floor((a-e)/this.tileRes));h=this.resolveCode(h);if(this.grid_tile.keys[h])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[h]])}},wax.GridManager=function(){this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d){if(!d)return b(!1);wax.request.get(c.tileDataUrl(a),function(a){b(new wax.GridInstance(a,d))})})},wax.GridManager.prototype.makeEvent=function(a){return{target:a.target||a.srcElement,pX:a.pageX||a.clientX,pY:a.pageY||a.clientY,evt:a}},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(this.formatters[a]):wax.request.get(a,function(d){d&&d.formatter?c.formatters[a]=new wax.Formatter(d):c.formatters[a]=!1,b(c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.context=a,this.container=b||$('<div class="wax-legends"></div>'),this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){$(".wax-legend",this.container).hide();var b=$.proxy(function(a,b){b?this.legends[a]?this.legends[a].show():(this.legends[a]=$("<div class='wax-legend'></div>").append(b),this.container.append(this.legends[a])):this.legends[a]=!1},this);for(var c=0;c<a.length;c++){var d=this.legendUrl(a[c]);wax.request.get(d,function(a){a&&a.legend&&b(d,a.legend)})}},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var wax=wax||{};wax.tooltip={},wax.tooltip.getToolTip=function(a,b,c,d){var e=$(b).children("div.wax-tooltip-"+c+":not(.removed)");e.size()===0&&(e=$("<div class='wax-tooltip wax-tooltip-"+c+"'>"+"</div>").html(a),$(b).triggerHandler("addedtooltip",[e,b,d])||$(b).append(e));for(var f=c-1;f>0;f--){var g=$("div.wax-tooltip-"+f+":not(.removed)");g.size()>0&&g.addClass("hidden").hide()}return e},wax.tooltip.click=function(a,b,c){var d=wax.tooltip.getToolTip(a,b,c),e=$('<a href="#close" class="close">Close</a>');e.click(function(){d.addClass("removed").fadeOut("fast",function(){$(this).remove()});return!1}),d.addClass("wax-popup").html(a).append(e)},wax.tooltip.select=function(a,b,c,d){!a||(wax.tooltip.getToolTip(a,b,c,d),$(b).css("cursor","pointer"),$("div",b).css("cursor","pointer"))},wax.tooltip.unselect=function(a,b,c,d){$(b).css("cursor","default"),c?$("div.wax-tooltip-"+c+":not(.wax-popup)").remove():$("div.wax-tooltip:not(.wax-popup)").remove(),$("div",b).css("cursor","default"),$("div.wax-tooltip:first").removeClass("hidden").show(),$(b).triggerHandler("removedtooltip",[a,b,d])};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.embedder=function(a){a=a||{},$("#"+this.el+"-script").length&&$(this.parent).prepend($('<input type="text" class="embed-src" />').css({"z-index":"9999999999",position:"relative"}).val("<div id='"+this.el+"-script'>"+$("#"+this.el+"-script").html()+"</div>"));return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.fullscreen=function(){$('<a class="wax-fullscreen" href="#fullscreen">fullscreen</a>').toggle($.proxy(this.maximize,this),$.proxy(this.minimize,this)).appendTo(this.parent);return this},com.modestmaps.Map.prototype.maximize=function(a){a&&a.preventDefault(),this.smallSize=[$(this.parent).width(),$(this.parent).height()],$(this.parent).addClass("wax-fullscreen-map"),this.setSize($(this.parent).outerWidth(),$(this.parent).outerHeight())},com.modestmaps.Map.prototype.minimize=function(a){a&&a.preventDefault(),$(this.parent).removeClass("wax-fullscreen-map"),this.setSize(this.smallSize[0],this.smallSize[1])};if(!com){var com={};com.modestmaps||(com.modestmaps={})}var limit=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d);if(c||!d)d=setTimeout(g,b)}},throttle=function(a,b){return limit(a,b,!1)};com.modestmaps.Map.prototype.hash=function(a){var b,c=90-1e-8,d,e={map:this,parser:function(a){var b=a.split("/").map(Number);if(b.length<3||b.some(isNaN))return!0;b.length==3&&this.map.setCenterZoom(new com.modestmaps.Location(b[1],b[2]),b[0])},formatter:function(){var a=this.map.getCenter(),b=this.map.getZoom(),c=Math.max(0,Math.ceil(Math.log(b)/Math.LN2));return"#"+[b.toFixed(2),a.lat.toFixed(c),a.lon.toFixed(c)].join("/")},move:function(){var a=e.formatter();b!==a&&location.replace(b=a)},hashchange:function(){location.hash!==b&&e.parser((b=location.hash).substring(1))&&move()}};location.hash?e.hashchange():e.move(),this.addCallback("drawn",throttle(e.move,500)),window.addEventListener("hashchange",e.hashchange,!1);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.interaction=function(a){a=a||{},this.waxGM=new wax.GridManager,this.callbacks=a.callbacks||{out:wax.tooltip.unselect,over:wax.tooltip.select,click:wax.tooltip.click},this.clickAction=a.clickAction||"full",this.waxGetTileGrid=function(){var a=this.getZoom();return this._waxGetTileGrid||(this._waxGetTileGrid=function(b){var c=[];$.each(b,function(b,d){if(b.split(",")[0]==a){var e=$(d),f=e.offset();c.push([f.top,f.left,e])}});return c}(this.tiles))},this.waxClearTimeout=function(){if(this.clickTimeout){window.clearTimeout(this.clickTimeout),this.clickTimeout=null;return!0}return!1},$(this.parent).mousedown($.proxy(function(a){if(!this.waxClearTimeout()){var b=4;this.downEvent=a,$(this.parent).one("mouseup",$.proxy(function(a){Math.round(a.pageY/b)===Math.round(this.downEvent.pageY/b)&&Math.round(a.pageX/b)===Math.round(this.downEvent.pageX/b)&&(this.clickTimeout=window.setTimeout($.proxy(function(){this.waxHandleClick(a)},this),300))},this))}},this)),this.waxHandleClick=function(a){var b=this.waxGetTile(a);b&&this.waxGM.getGrid(b.attr("src"),$.proxy(function(c){if(c){var d=c.getFeature(a.pageX,a.pageY,b,{format:this.clickAction});if(d)switch(this.clickAction){case"full":this.callbacks.click(d,this.parent,0,a);break;case"location":window.location=d}}},this))},this.waxGetTile=function(a){var b,c=this.waxGetTileGrid();for(var d=0;d<c.length;d++)if(c[d][0]<a.pageY&&c[d][0]+256>a.pageY&&c[d][1]<a.pageX&&c[d][1]+256>a.pageX){b=c[d][2];break}return b||!1},$(this.parent).nondrag($.proxy(function(a){var b=this.waxGetTile(a);b&&this.waxGM.getGrid(b.attr("src"),$.proxy(function(c){if(c){var d=c.getFeature(a.pageX,a.pageY,b,{format:"teaser"});d?d&&this.feature!==d?(this.feature=d,this.callbacks.out(d,this.parent,0,a),this.callbacks.over(d,this.parent,0,a)):d||(this.feature=null,this.callbacks.out(d,this.parent,0,a)):(this.feature=null,this.callbacks.out({},this.parent,0,a))}},this))},this));var b=["zoomed","panned","centered","extentset","resized","drawn"],c=function(a,b){a._waxGetTileGrid=null};for(var d=0;d<b.length;d++)this.addCallback(b[d],c);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.legend=function(a){a=a||{},this.legend=new wax.Legend(this.parent,a.container),this.legend.render([this.provider.getTileUrl({zoom:0,column:0,row:0})]);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.zoomer=function(){var a=$('<a class="zoomer zoomin" href="#zoomin">+</a>').click($.proxy(function(a){a.preventDefault(),this.zoomIn()},this)).appendTo(this.parent),b=$('<a class="zoomer zoomout" href="#zoomout">-</a>').click($.proxy(function(a){a.preventDefault(),this.zoomOut()},this)).appendTo(this.parent);this.addCallback("drawn",function(c,d){c.coordinate.zoom===c.provider.outerLimits()[0].zoom?b.addClass("zoomdisabled"):c.coordinate.zoom===c.provider.outerLimits()[1].zoom?a.addClass("zoomdisabled"):(a.removeClass("zoomdisabled"),b.removeClass("zoomdisabled"))});return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.WaxProvider=function(a){this.layerName=a.layerName,this.baseUrls=typeof a.baseUrl=="string"?[a.baseUrl]:a.baseUrl,this.n_urls=this.baseUrls.length,this.filetype=a.filetype||".png",this.zoomRange=a.zoomRange||[0,18]},com.modestmaps.WaxProvider.prototype={outerLimits:function(){return[(new com.modestmaps.Coordinate(0,0,0)).zoomTo(this.zoomRange[0]),(new com.modestmaps.Coordinate(1,1,0)).zoomTo(this.zoomRange[1])]},getTileUrl:function(a){var b;a=this.sourceCoordinate(a);if(!a)return null;var c=Math.pow(2,a.zoom);a.row=Math.pow(2,a.zoom)-a.row-1,this.n_urls===1?b=this.baseUrls[0]:b=this.baseUrls[parseInt(c*a.row+a.column,10)%this.n_urls];var d=["1.0.0",this.layerName,a.zoom,a.column,a.row].join("/");return b+d+this.filetype}},com.modestmaps.extend(com.modestmaps.WaxProvider,com.modestmaps.MapProvider) | ||
*/(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="<script/>",t="success",u="timeout",v=a.browser,w=a("head")[0]||document.documentElement,x={},y=0,z,A={callback:l,url:location.href};B.setup=function(b){a.extend(A,b)},a.jsonp=B})(jQuery,setTimeout);var wax=wax||{};wax.Record=function(a,b){var c=function(a,b){var c=_.reduce(a.split("."),function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(_.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=_.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=d.slice,g=d.unshift,h=e.toString,i=e.hasOwnProperty,j=d.forEach,k=d.map,l=d.reduce,m=d.reduceRight,n=d.filter,o=d.every,p=d.some,q=d.indexOf,r=d.lastIndexOf,s=Array.isArray,t=Object.keys,u=function(a){return new z(a)};typeof module!="undefined"&&module.exports?(module.exports=u,u._=u):a._=u,u.VERSION="1.1.4";var v=u.each=u.forEach=function(a,b,d){var e;if(a!=null)if(j&&a.forEach===j)a.forEach(b,d);else if(u.isNumber(a.length)){for(var f=0,g=a.length;f<g;f++)if(b.call(d,a[f],f,a)===c)return}else for(var h in a)if(i.call(a,h)&&b.call(d,a[h],h,a)===c)return};u.map=function(a,b,c){var d=[];if(a==null)return d;if(k&&a.map===k)return a.map(b,c);v(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)});return d},u.reduce=u.foldl=u.inject=function(a,b,c,d){var e=c!==void 0;a==null&&(a=[]);if(l&&a.reduce===l){d&&(b=u.bind(b,d));return e?a.reduce(b,c):a.reduce(b)}v(a,function(a,f,g){!e&&f===0?(c=a,e=!0):c=b.call(d,c,a,f,g)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},u.reduceRight=u.foldr=function(a,b,c,d){a==null&&(a=[]);if(m&&a.reduceRight===m){d&&(b=u.bind(b,d));return c!==void 0?a.reduceRight(b,c):a.reduceRight(b)}var e=(u.isArray(a)?a.slice():u.toArray(a)).reverse();return u.reduce(e,b,c,d)},u.find=u.detect=function(a,b,c){var d;w(a,function(a,e,f){if(b.call(c,a,e,f)){d=a;return!0}});return d},u.filter=u.select=function(a,b,c){var d=[];if(a==null)return d;if(n&&a.filter===n)return a.filter(b,c);v(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)});return d},u.reject=function(a,b,c){var d=[];if(a==null)return d;v(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)});return d},u.every=u.all=function(a,b,d){b=b||u.identity;var e=!0;if(a==null)return e;if(o&&a.every===o)return a.every(b,d);v(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c});return e};var w=u.some=u.any=function(a,b,d){b=b||u.identity;var e=!1;if(a==null)return e;if(p&&a.some===p)return a.some(b,d);v(a,function(a,f,g){if(e=b.call(d,a,f,g))return c});return e};u.include=u.contains=function(a,b){var c=!1;if(a==null)return c;if(q&&a.indexOf===q)return a.indexOf(b)!=-1;w(a,function(a){if(c=a===b)return!0});return c},u.invoke=function(a,b){var c=f.call(arguments,2);return u.map(a,function(a){return(b?a[b]:a).apply(a,c)})},u.pluck=function(a,b){return u.map(a,function(a){return a[b]})},u.max=function(a,b,c){if(!b&&u.isArray(a))return Math.max.apply(Math,a);var d={computed:-Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})});return d.value},u.min=function(a,b,c){if(!b&&u.isArray(a))return Math.min.apply(Math,a);var d={computed:Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})});return d.value},u.sortBy=function(a,b,c){return u.pluck(u.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},u.sortedIndex=function(a,b,c){c=c||u.identity;var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},u.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(u.isArray(a))return a;if(u.isArguments(a))return f.call(a);return u.values(a)},u.size=function(a){return u.toArray(a).length},u.first=u.head=function(a,b,c){return b&&!c?f.call(a,0,b):a[0]},u.rest=u.tail=function(a,b,c){return f.call(a,u.isUndefined(b)||c?1:b)},u.last=function(a){return a[a.length-1]},u.compact=function(a){return u.filter(a,function(a){return!!a})},u.flatten=function(a){return u.reduce(a,function(a,b){if(u.isArray(b))return a.concat(u.flatten(b));a[a.length]=b;return a},[])},u.without=function(a){var b=f.call(arguments,1);return u.filter(a,function(a){return!u.include(b,a)})},u.uniq=u.unique=function(a,b){return u.reduce(a,function(a,c,d){if(0==d||(b===!0?u.last(a)!=c:!u.include(a,c)))a[a.length]=c;return a},[])},u.intersect=function(a){var b=f.call(arguments,1);return u.filter(u.uniq(a),function(a){return u.every(b,function(b){return u.indexOf(b,a)>=0})})},u.zip=function(){var a=f.call(arguments),b=u.max(u.pluck(a,"length")),c=Array(b);for(var d=0;d<b;d++)c[d]=u.pluck(a,""+d);return c},u.indexOf=function(a,b,c){if(a==null)return-1;if(c){var d=u.sortedIndex(a,b);return a[d]===b?d:-1}if(q&&a.indexOf===q)return a.indexOf(b);for(var d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},u.lastIndexOf=function(a,b){if(a==null)return-1;if(r&&a.lastIndexOf===r)return a.lastIndexOf(b);var c=a.length;while(c--)if(a[c]===b)return c;return-1},u.range=function(a,b,c){var d=f.call(arguments),e=d.length<=1,a=e?0:d[0],b=e?d[0]:d[1],c=d[2]||1,g=Math.max(Math.ceil((b-a)/c),0),h=0,i=Array(g);while(h<g)i[h++]=a,a+=c;return i},u.bind=function(a,b){var c=f.call(arguments,2);return function(){return a.apply(b||{},c.concat(f.call(arguments)))}},u.bindAll=function(a){var b=f.call(arguments,1);b.length==0&&(b=u.functions(a)),v(b,function(b){a[b]=u.bind(a[b],a)});return a},u.memoize=function(a,b){var c={};b=b||u.identity;return function(){var d=b.apply(this,arguments);return d in c?c[d]:c[d]=a.apply(this,arguments)}},u.delay=function(a,b){var c=f.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},u.defer=function(a){return u.delay.apply(u,[a,1].concat(f.call(arguments,1)))};var x=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d);if(c||!d)d=setTimeout(g,b)}};u.throttle=function(a,b){return x(a,b,!1)},u.debounce=function(a,b){return x(a,b,!0)},u.wrap=function(a,b){return function(){var c=[a].concat(f.call(arguments));return b.apply(this,c)}},u.compose=function(){var a=f.call(arguments);return function(){var b=f.call(arguments);for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},u.keys=t||function(a){if(u.isArray(a))return u.range(0,a.length);var b=[];for(var c in a)i.call(a,c)&&(b[b.length]=c);return b},u.values=function(a){return u.map(a,u.identity)},u.functions=u.methods=function(a){return u.filter(u.keys(a),function(b){return u.isFunction(a[b])}).sort()},u.extend=function(a){v(f.call(arguments,1),function(b){for(var c in b)a[c]=b[c]});return a},u.clone=function(a){return u.isArray(a)?a.slice():u.extend({},a)},u.tap=function(a,b){b(a);return a},u.isEqual=function(a,b){if(a===b)return!0;var c=typeof a,d=typeof b;if(c!=d)return!1;if(a==b)return!0;if(!a&&b||a&&!b)return!1;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual)return a.isEqual(b);if(u.isDate(a)&&u.isDate(b))return a.getTime()===b.getTime();if(u.isNaN(a)&&u.isNaN(b))return!1;if(u.isRegExp(a)&&u.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(c!=="object")return!1;if(a.length&&a.length!==b.length)return!1;var e=u.keys(a),f=u.keys(b);if(e.length!=f.length)return!1;for(var g in a)if(!(g in b)||!u.isEqual(a[g],b[g]))return!1;return!0},u.isEmpty=function(a){if(u.isArray(a)||u.isString(a))return a.length===0;for(var b in a)if(i.call(a,b))return!1;return!0},u.isElement=function(a){return!!a&&a.nodeType==1},u.isArray=s||function(a){return h.call(a)==="[object Array]"},u.isArguments=function(a){return!!a&&!!i.call(a,"callee")},u.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)},u.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},u.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)},u.isNaN=function(a){return a!==a},u.isBoolean=function(a){return a===!0||a===!1},u.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},u.isRegExp=function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},u.isNull=function(a){return a===null},u.isUndefined=function(a){return a===void 0},u.noConflict=function(){a._=b;return this},u.identity=function(a){return a},u.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},u.mixin=function(a){v(u.functions(a),function(b){B(b,u[b]=a[b])})};var y=0;u.uniqueId=function(a){var b=y++;return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},u.template=function(a,b){var c=u.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj",d);return b?e(b):e};var z=function(a){this._wrapped=a};u.prototype=z.prototype;var A=function(a,b){return b?u(a).chain():a},B=function(a,b){z.prototype[a]=function(){var a=f.call(arguments);g.call(a,this._wrapped);return A(b.apply(u,a),this._chain)}};u.mixin(u),v(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];z.prototype[a]=function(){b.apply(this._wrapped,arguments);return A(this._wrapped,this._chain)}}),v(["concat","join","slice"],function(a){var b=d[a];z.prototype[a]=function(){return A(b.apply(this._wrapped,arguments),this._chain)}}),z.prototype.chain=function(){this._chain=!0;return this},z.prototype.value=function(){return this._wrapped}}();var wax=wax||{};(function(a){a.fn.extend({nondrag:function(b){a(this).bind("mousedown mouseup mousemove",function(a){var c=!1;if(a.type==="mouseup")c=!1;else if(c||a.type==="mousedown"){c=!0;return}b(a)});return this}})})(jQuery),wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,$.jsonp({url:a,context:this,callback:"grid",callbackParameter:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=b;for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a])},error:function(){c.locks[a]=!1,c.cache[a]=null;for(var b=0;b<c.promises[a].length;b++)c.promises[a][b](c.cache[a])}})}}},wax.GridInstance=function(a,b){this.grid_tile=a,this.formatter=b,this.tileRes=4},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){var e,f;if(c.left&&c.top)e=c.left,f=c.top;else{var g=$(c);e=g.offset().left,f=g.offset().top}if(Math.floor((b-f)/this.tileRes)>256||Math.floor((a-e)/this.tileRes)>256)return;var h=this.grid_tile.grid[Math.floor((b-f)/this.tileRes)].charCodeAt(Math.floor((a-e)/this.tileRes));h=this.resolveCode(h);if(this.grid_tile.keys[h])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[h]])}},wax.GridManager=function(){this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d){if(!d)return b(!1);wax.request.get(c.tileDataUrl(a),function(a){b(new wax.GridInstance(a,d))})})},wax.GridManager.prototype.makeEvent=function(a){return{target:a.target||a.srcElement,pX:a.pageX||a.clientX,pY:a.pageY||a.clientY,evt:a}},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(this.formatters[a]):wax.request.get(a,function(d){d&&d.formatter?c.formatters[a]=new wax.Formatter(d):c.formatters[a]=!1,b(c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.context=a,this.container=b||$('<div class="wax-legends"></div>'),this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){$(".wax-legend",this.container).hide();var b=$.proxy(function(a,b){b?this.legends[a]?this.legends[a].show():(this.legends[a]=$("<div class='wax-legend'></div>").append(b),this.container.append(this.legends[a])):this.legends[a]=!1},this),c=function(a){a&&a.legend&&b(e,a.legend)};for(var d=0;d<a.length;d++){var e=this.legendUrl(a[d]);wax.request.get(e,c)}},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var wax=wax||{};wax.tooltip={},wax.tooltip.getToolTip=function(a,b,c,d){var e=$(b).children("div.wax-tooltip-"+c+":not(.removed)");e.size()===0&&(e=$("<div class='wax-tooltip wax-tooltip-"+c+"'>"+"</div>").html(a),$(b).triggerHandler("addedtooltip",[e,b,d])||$(b).append(e));for(var f=c-1;f>0;f--){var g=$("div.wax-tooltip-"+f+":not(.removed)");g.size()>0&&g.addClass("hidden").hide()}return e},wax.tooltip.click=function(a,b,c){var d=wax.tooltip.getToolTip(a,b,c),e=$('<a href="#close" class="close">Close</a>');e.click(function(){d.addClass("removed").fadeOut("fast",function(){$(this).remove()});return!1}),d.addClass("wax-popup").html(a).append(e)},wax.tooltip.select=function(a,b,c,d){!a||(wax.tooltip.getToolTip(a,b,c,d),$(b).css("cursor","pointer"),$("div",b).css("cursor","pointer"))},wax.tooltip.unselect=function(a,b,c,d){$(b).css("cursor","default"),c?$("div.wax-tooltip-"+c+":not(.wax-popup)").remove():$("div.wax-tooltip:not(.wax-popup)").remove(),$("div",b).css("cursor","default"),$("div.wax-tooltip:first").removeClass("hidden").show(),$(b).triggerHandler("removedtooltip",[a,b,d])};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.boxselector=function(a){var b=document.createElement("div");b.id=this.parent.id+"-boxselector",b.className="boxselector-box-container",b.style.width=this.dimensions.x+"px",b.style.height=this.dimensions.y+"px",this.parent.appendChild(b);var c=document.createElement("div");c.id=this.parent.id+"-boxselector-box",c.className="boxselector-box",b.appendChild(c);var d=null,e=this,f=typeof a=="function"?a:a.callback,g=this.boxselector;this.boxselector.getMousePoint=function(a){var b=new com.modestmaps.Point(a.clientX,a.clientY);b.x+=document.body.scrollLeft+document.documentElement.scrollLeft,b.y+=document.body.scrollTop+document.documentElement.scrollTop;for(var c=e.parent;c;c=c.offsetParent)b.x-=c.offsetLeft,b.y-=c.offsetTop;return b},this.boxselector.mouseDown=function(a){if(a.shiftKey){d=g.getMousePoint(a),c.style.left=d.x+"px",c.style.top=d.y+"px",c.style.height="auto",c.style.width="auto",com.modestmaps.addEvent(e.parent,"mousemove",g.mouseMove),com.modestmaps.addEvent(e.parent,"mouseup",g.mouseUp),e.parent.style.cursor="crosshair";return com.modestmaps.cancelEvent(a)}},this.boxselector.mouseMove=function(a){var b=g.getMousePoint(a);c.style.display="block",b.x<d.x?(c.style.left=b.x+"px",c.style.right=e.dimensions.x-d.x+"px"):(c.style.left=d.x+"px",c.style.right=e.dimensions.x-b.x+"px"),b.y<d.y?c.style.top=b.y+"px":c.style.bottom=e.dimensions.y-b.y+"px";return com.modestmaps.cancelEvent(a)},this.boxselector.mouseUp=function(a){var b=g.getMousePoint(a),c=e.pointLocation(b),h=e.pointLocation(d),i=[];i.push(new com.modestmaps.Location(Math.max(c.lat,h.lat),Math.min(c.lon,h.lon))),i.push(new com.modestmaps.Location(Math.min(c.lat,h.lat),Math.max(c.lon,h.lon))),g.box=[c,h],f(i),com.modestmaps.removeEvent(e.parent,"mousemove",g.mouseMove),com.modestmaps.removeEvent(e.parent,"mouseup",g.mouseUp),e.parent.style.cursor="auto";return com.modestmaps.cancelEvent(a)},com.modestmaps.addEvent(b,"mousedown",g.mouseDown);var h=function(a,b){if(a.boxselector.box){c.style.display="block",c.style.height="auto",c.style.width="auto";var d=a.locationPoint(a.boxselector.box[0]),e=a.locationPoint(a.boxselector.box[1]);c.style.left=Math.max(0,e.x)+"px",c.style.top=Math.max(0,e.y)+"px",c.style.right=Math.max(0,a.dimensions.x-d.x)+"px",c.style.bottom=Math.max(0,a.dimensions.y-d.y)+"px"}};this.addCallback("drawn",h),this.boxselector.remove=function(){b.parentNode.removeChild(b),e.removeCallback("mousedown",h)};return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.embedder=function(a){a=a||{},$("#"+this.el+"-script").length&&$(this.parent).prepend($('<input type="text" class="embed-src" />').css({"z-index":"9999999999",position:"relative"}).val("<div id='"+this.el+"-script'>"+$("#"+this.el+"-script").html()+"</div>"));return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.fullscreen=function(){$('<a class="wax-fullscreen" href="#fullscreen">fullscreen</a>').toggle($.proxy(this.maximize,this),$.proxy(this.minimize,this)).appendTo(this.parent);return this},com.modestmaps.Map.prototype.maximize=function(a){a&&a.preventDefault(),this.smallSize=[$(this.parent).width(),$(this.parent).height()],$(this.parent).addClass("wax-fullscreen-map"),this.setSize($(this.parent).outerWidth(),$(this.parent).outerHeight())},com.modestmaps.Map.prototype.minimize=function(a){a&&a.preventDefault(),$(this.parent).removeClass("wax-fullscreen-map"),this.setSize(this.smallSize[0],this.smallSize[1])};if(!com){var com={};com.modestmaps||(com.modestmaps={})}var limit=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d);if(c||!d)d=setTimeout(g,b)}},throttle=function(a,b){return limit(a,b,!1)};com.modestmaps.Map.prototype.hash=function(a){var b,c=90-1e-8,d,e={map:this,parser:function(a){var b=a.split("/").map(Number);if(b.length<3||b.some(isNaN))return!0;b.length==3&&this.map.setCenterZoom(new com.modestmaps.Location(b[1],b[2]),b[0])},formatter:function(){var a=this.map.getCenter(),b=this.map.getZoom(),c=Math.max(0,Math.ceil(Math.log(b)/Math.LN2));return"#"+[b.toFixed(2),a.lat.toFixed(c),a.lon.toFixed(c)].join("/")},move:function(){var a=e.formatter();b!==a&&location.replace(b=a)},hashchange:function(){location.hash!==b&&e.parser((b=location.hash).substring(1))&&move()}};location.hash?e.hashchange():e.move(),this.addCallback("drawn",throttle(e.move,500)),window.addEventListener("hashchange",e.hashchange,!1);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.interaction=function(a){a=a||{},this.waxGM=new wax.GridManager,this.callbacks=a.callbacks||{out:wax.tooltip.unselect,over:wax.tooltip.select,click:wax.tooltip.click},this.clickAction=a.clickAction||"full",this.waxGetTileGrid=function(){var a=this.getZoom();return this._waxGetTileGrid||(this._waxGetTileGrid=function(b){var c=[];$.each(b,function(b,d){if(b.split(",")[0]==a){var e=$(d),f=e.offset();c.push([f.top,f.left,e])}});return c}(this.tiles))},this.waxClearTimeout=function(){if(this.clickTimeout){window.clearTimeout(this.clickTimeout),this.clickTimeout=null;return!0}return!1},$(this.parent).mousedown($.proxy(function(a){if(!this.waxClearTimeout()){var b=4;this.downEvent=a,$(this.parent).one("mouseup",$.proxy(function(a){Math.round(a.pageY/b)===Math.round(this.downEvent.pageY/b)&&Math.round(a.pageX/b)===Math.round(this.downEvent.pageX/b)&&(this.clickTimeout=window.setTimeout($.proxy(function(){this.waxHandleClick(a)},this),300))},this))}},this)),this.waxHandleClick=function(a){var b=this.waxGetTile(a);b&&this.waxGM.getGrid(b.attr("src"),$.proxy(function(c){if(c){var d=c.getFeature(a.pageX,a.pageY,b,{format:this.clickAction});if(d)switch(this.clickAction){case"full":this.callbacks.click(d,this.parent,0,a);break;case"location":window.location=d}}},this))},this.waxGetTile=function(a){var b,c=this.waxGetTileGrid();for(var d=0;d<c.length;d++)if(c[d][0]<a.pageY&&c[d][0]+256>a.pageY&&c[d][1]<a.pageX&&c[d][1]+256>a.pageX){b=c[d][2];break}return b||!1},$(this.parent).nondrag($.proxy(function(a){var b=this.waxGetTile(a);b&&this.waxGM.getGrid(b.attr("src"),$.proxy(function(c){if(c){var d=c.getFeature(a.pageX,a.pageY,b,{format:"teaser"});d?d&&this.feature!==d?(this.feature=d,this.callbacks.out(d,this.parent,0,a),this.callbacks.over(d,this.parent,0,a)):d||(this.feature=null,this.callbacks.out(d,this.parent,0,a)):(this.feature=null,this.callbacks.out({},this.parent,0,a))}},this))},this));var b=["zoomed","panned","centered","extentset","resized","drawn"],c=function(a,b){a._waxGetTileGrid=null};for(var d=0;d<b.length;d++)this.addCallback(b[d],c);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.legend=function(a){a=a||{},this.legend=new wax.Legend(this.parent,a.container),this.legend.render([this.provider.getTileUrl({zoom:0,column:0,row:0})]);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.zoombox=function(a){var b=document.createElement("div");b.id=this.parent.id+"-zoombox",b.className="zoombox-box-container",b.style.width=this.dimensions.x+"px",b.style.height=this.dimensions.y+"px",this.parent.appendChild(b);var c=document.createElement("div");c.id=this.parent.id+"-zoombox-box",c.className="zoombox-box",b.appendChild(c);var d=null,e=this,f={map:this,getMousePoint:function(a){var b=new com.modestmaps.Point(a.clientX,a.clientY);b.x+=document.body.scrollLeft+document.documentElement.scrollLeft,b.y+=document.body.scrollTop+document.documentElement.scrollTop;for(var c=this.map.parent;c;c=c.offsetParent)b.x-=c.offsetLeft,b.y-=c.offsetTop;return b},mouseDown:function(a){if(a.shiftKey){d=f.getMousePoint(a),c.style.left=d.x+"px",c.style.top=d.y+"px",com.modestmaps.addEvent(e.parent,"mousemove",f.mouseMove),com.modestmaps.addEvent(e.parent,"mouseup",f.mouseUp),e.parent.style.cursor="crosshair";return com.modestmaps.cancelEvent(a)}},mouseMove:function(a){var b=f.getMousePoint(a);c.style.display="block",b.x<d.x?c.style.left=b.x+"px":c.style.left=d.x+"px",c.style.width=Math.abs(b.x-d.x)+"px",b.y<d.y?c.style.top=b.y+"px":c.style.top=d.y+"px",c.style.height=Math.abs(b.y-d.y)+"px";return com.modestmaps.cancelEvent(a)},mouseUp:function(a){var b=f.getMousePoint(a),g=e.pointLocation(b),h=e.pointLocation(d);e.setExtent([g,h]),c.style.display="none",com.modestmaps.removeEvent(e.parent,"mousemove",f.mouseMove),com.modestmaps.removeEvent(e.parent,"mouseup",f.mouseUp),e.parent.style.cursor="auto";return com.modestmaps.cancelEvent(a)}};com.modestmaps.addEvent(b,"mousedown",f.mouseDown);return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.Map.prototype.zoomer=function(){var a=$('<a class="zoomer zoomin" href="#zoomin">+</a>').click($.proxy(function(a){a.preventDefault(),this.zoomIn()},this)).appendTo(this.parent),b=$('<a class="zoomer zoomout" href="#zoomout">-</a>').click($.proxy(function(a){a.preventDefault(),this.zoomOut()},this)).appendTo(this.parent);this.addCallback("drawn",function(c,d){c.coordinate.zoom===c.provider.outerLimits()[0].zoom?b.addClass("zoomdisabled"):c.coordinate.zoom===c.provider.outerLimits()[1].zoom?a.addClass("zoomdisabled"):(a.removeClass("zoomdisabled"),b.removeClass("zoomdisabled"))});return this};if(!com){var com={};com.modestmaps||(com.modestmaps={})}com.modestmaps.WaxProvider=function(a){this.layerName=a.layerName,this.baseUrls=typeof a.baseUrl=="string"?[a.baseUrl]:a.baseUrl,this.n_urls=this.baseUrls.length,this.filetype=a.filetype||".png",this.zoomRange=a.zoomRange||[0,18]},com.modestmaps.WaxProvider.prototype={outerLimits:function(){return[(new com.modestmaps.Coordinate(0,0,0)).zoomTo(this.zoomRange[0]),(new com.modestmaps.Coordinate(1,1,0)).zoomTo(this.zoomRange[1])]},getTileUrl:function(a){var b;a=this.sourceCoordinate(a);if(!a)return null;var c=Math.pow(2,a.zoom);a.row=Math.pow(2,a.zoom)-a.row-1,this.n_urls===1?b=this.baseUrls[0]:b=this.baseUrls[parseInt(c*a.row+a.column,10)%this.n_urls];var d=["1.0.0",this.layerName,a.zoom,a.column,a.row].join("/");return b+d+this.filetype}},com.modestmaps.extend(com.modestmaps.WaxProvider,com.modestmaps.MapProvider) |
@@ -1271,4 +1271,4 @@ /* | ||
wax.GridInstance.prototype.resolveCode = function(key) { | ||
(key >= 93) && key--; | ||
(key >= 35) && key--; | ||
if (key >= 93) key--; | ||
if (key >= 35) key--; | ||
key -= 32; | ||
@@ -1384,3 +1384,3 @@ return key; | ||
// Syntax errors in formatter | ||
console && console.log(e); | ||
if (console) console.log(e); | ||
} | ||
@@ -1398,3 +1398,3 @@ } else { | ||
} catch (e) { | ||
console && console.log(e); | ||
if (console) console.log(e); | ||
} | ||
@@ -1428,7 +1428,8 @@ }; | ||
}, this); | ||
var renderLegend = function(data) { | ||
if (data && data.legend) render(url, data.legend); | ||
}; | ||
for (var i = 0; i < urls.length; i++) { | ||
var url = this.legendUrl(urls[i]); | ||
wax.request.get(url, function(data) { | ||
(data && data.legend) && (render(url, data.legend)); | ||
}); | ||
wax.request.get(url, renderLegend); | ||
} | ||
@@ -1518,3 +1519,3 @@ }; | ||
$(context).triggerHandler('removedtooltip', [feature, context, evt]) | ||
$(context).triggerHandler('removedtooltip', [feature, context, evt]); | ||
}; | ||
@@ -1630,7 +1631,7 @@ // Wax header | ||
function(i) { | ||
// TODO: make better indication of whether | ||
// this is an interactive layer | ||
return (this.map.layers[i].visibility === true) && | ||
(this.map.layers[i].CLASS_NAME === 'OpenLayers.Layer.TMS'); | ||
} | ||
// TODO: make better indication of whether | ||
// this is an interactive layer | ||
return (this.map.layers[i].visibility === true) && | ||
(this.map.layers[i].CLASS_NAME === 'OpenLayers.Layer.TMS'); | ||
} | ||
); | ||
@@ -1637,0 +1638,0 @@ }, |
@@ -10,2 +10,2 @@ /* | ||
* MIT License: http://www.opensource.org/licenses/mit-license.php | ||
*/(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="<script/>",t="success",u="timeout",v=a.browser,w=a("head")[0]||document.documentElement,x={},y=0,z,A={callback:l,url:location.href};B.setup=function(b){a.extend(A,b)},a.jsonp=B})(jQuery,setTimeout);var wax=wax||{};wax.Record=function(a,b){var c=function(a,b){var c=_.reduce(a.split("."),function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(_.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=_.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=d.slice,g=d.unshift,h=e.toString,i=e.hasOwnProperty,j=d.forEach,k=d.map,l=d.reduce,m=d.reduceRight,n=d.filter,o=d.every,p=d.some,q=d.indexOf,r=d.lastIndexOf,s=Array.isArray,t=Object.keys,u=function(a){return new z(a)};typeof module!="undefined"&&module.exports?(module.exports=u,u._=u):a._=u,u.VERSION="1.1.4";var v=u.each=u.forEach=function(a,b,d){var e;if(a!=null)if(j&&a.forEach===j)a.forEach(b,d);else if(u.isNumber(a.length)){for(var f=0,g=a.length;f<g;f++)if(b.call(d,a[f],f,a)===c)return}else for(var h in a)if(i.call(a,h)&&b.call(d,a[h],h,a)===c)return};u.map=function(a,b,c){var d=[];if(a==null)return d;if(k&&a.map===k)return a.map(b,c);v(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)});return d},u.reduce=u.foldl=u.inject=function(a,b,c,d){var e=c!==void 0;a==null&&(a=[]);if(l&&a.reduce===l){d&&(b=u.bind(b,d));return e?a.reduce(b,c):a.reduce(b)}v(a,function(a,f,g){!e&&f===0?(c=a,e=!0):c=b.call(d,c,a,f,g)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},u.reduceRight=u.foldr=function(a,b,c,d){a==null&&(a=[]);if(m&&a.reduceRight===m){d&&(b=u.bind(b,d));return c!==void 0?a.reduceRight(b,c):a.reduceRight(b)}var e=(u.isArray(a)?a.slice():u.toArray(a)).reverse();return u.reduce(e,b,c,d)},u.find=u.detect=function(a,b,c){var d;w(a,function(a,e,f){if(b.call(c,a,e,f)){d=a;return!0}});return d},u.filter=u.select=function(a,b,c){var d=[];if(a==null)return d;if(n&&a.filter===n)return a.filter(b,c);v(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)});return d},u.reject=function(a,b,c){var d=[];if(a==null)return d;v(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)});return d},u.every=u.all=function(a,b,d){b=b||u.identity;var e=!0;if(a==null)return e;if(o&&a.every===o)return a.every(b,d);v(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c});return e};var w=u.some=u.any=function(a,b,d){b=b||u.identity;var e=!1;if(a==null)return e;if(p&&a.some===p)return a.some(b,d);v(a,function(a,f,g){if(e=b.call(d,a,f,g))return c});return e};u.include=u.contains=function(a,b){var c=!1;if(a==null)return c;if(q&&a.indexOf===q)return a.indexOf(b)!=-1;w(a,function(a){if(c=a===b)return!0});return c},u.invoke=function(a,b){var c=f.call(arguments,2);return u.map(a,function(a){return(b?a[b]:a).apply(a,c)})},u.pluck=function(a,b){return u.map(a,function(a){return a[b]})},u.max=function(a,b,c){if(!b&&u.isArray(a))return Math.max.apply(Math,a);var d={computed:-Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})});return d.value},u.min=function(a,b,c){if(!b&&u.isArray(a))return Math.min.apply(Math,a);var d={computed:Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})});return d.value},u.sortBy=function(a,b,c){return u.pluck(u.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},u.sortedIndex=function(a,b,c){c=c||u.identity;var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},u.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(u.isArray(a))return a;if(u.isArguments(a))return f.call(a);return u.values(a)},u.size=function(a){return u.toArray(a).length},u.first=u.head=function(a,b,c){return b&&!c?f.call(a,0,b):a[0]},u.rest=u.tail=function(a,b,c){return f.call(a,u.isUndefined(b)||c?1:b)},u.last=function(a){return a[a.length-1]},u.compact=function(a){return u.filter(a,function(a){return!!a})},u.flatten=function(a){return u.reduce(a,function(a,b){if(u.isArray(b))return a.concat(u.flatten(b));a[a.length]=b;return a},[])},u.without=function(a){var b=f.call(arguments,1);return u.filter(a,function(a){return!u.include(b,a)})},u.uniq=u.unique=function(a,b){return u.reduce(a,function(a,c,d){if(0==d||(b===!0?u.last(a)!=c:!u.include(a,c)))a[a.length]=c;return a},[])},u.intersect=function(a){var b=f.call(arguments,1);return u.filter(u.uniq(a),function(a){return u.every(b,function(b){return u.indexOf(b,a)>=0})})},u.zip=function(){var a=f.call(arguments),b=u.max(u.pluck(a,"length")),c=Array(b);for(var d=0;d<b;d++)c[d]=u.pluck(a,""+d);return c},u.indexOf=function(a,b,c){if(a==null)return-1;if(c){var d=u.sortedIndex(a,b);return a[d]===b?d:-1}if(q&&a.indexOf===q)return a.indexOf(b);for(var d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},u.lastIndexOf=function(a,b){if(a==null)return-1;if(r&&a.lastIndexOf===r)return a.lastIndexOf(b);var c=a.length;while(c--)if(a[c]===b)return c;return-1},u.range=function(a,b,c){var d=f.call(arguments),e=d.length<=1,a=e?0:d[0],b=e?d[0]:d[1],c=d[2]||1,g=Math.max(Math.ceil((b-a)/c),0),h=0,i=Array(g);while(h<g)i[h++]=a,a+=c;return i},u.bind=function(a,b){var c=f.call(arguments,2);return function(){return a.apply(b||{},c.concat(f.call(arguments)))}},u.bindAll=function(a){var b=f.call(arguments,1);b.length==0&&(b=u.functions(a)),v(b,function(b){a[b]=u.bind(a[b],a)});return a},u.memoize=function(a,b){var c={};b=b||u.identity;return function(){var d=b.apply(this,arguments);return d in c?c[d]:c[d]=a.apply(this,arguments)}},u.delay=function(a,b){var c=f.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},u.defer=function(a){return u.delay.apply(u,[a,1].concat(f.call(arguments,1)))};var x=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d);if(c||!d)d=setTimeout(g,b)}};u.throttle=function(a,b){return x(a,b,!1)},u.debounce=function(a,b){return x(a,b,!0)},u.wrap=function(a,b){return function(){var c=[a].concat(f.call(arguments));return b.apply(this,c)}},u.compose=function(){var a=f.call(arguments);return function(){var b=f.call(arguments);for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},u.keys=t||function(a){if(u.isArray(a))return u.range(0,a.length);var b=[];for(var c in a)i.call(a,c)&&(b[b.length]=c);return b},u.values=function(a){return u.map(a,u.identity)},u.functions=u.methods=function(a){return u.filter(u.keys(a),function(b){return u.isFunction(a[b])}).sort()},u.extend=function(a){v(f.call(arguments,1),function(b){for(var c in b)a[c]=b[c]});return a},u.clone=function(a){return u.isArray(a)?a.slice():u.extend({},a)},u.tap=function(a,b){b(a);return a},u.isEqual=function(a,b){if(a===b)return!0;var c=typeof a,d=typeof b;if(c!=d)return!1;if(a==b)return!0;if(!a&&b||a&&!b)return!1;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual)return a.isEqual(b);if(u.isDate(a)&&u.isDate(b))return a.getTime()===b.getTime();if(u.isNaN(a)&&u.isNaN(b))return!1;if(u.isRegExp(a)&&u.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(c!=="object")return!1;if(a.length&&a.length!==b.length)return!1;var e=u.keys(a),f=u.keys(b);if(e.length!=f.length)return!1;for(var g in a)if(!(g in b)||!u.isEqual(a[g],b[g]))return!1;return!0},u.isEmpty=function(a){if(u.isArray(a)||u.isString(a))return a.length===0;for(var b in a)if(i.call(a,b))return!1;return!0},u.isElement=function(a){return!!a&&a.nodeType==1},u.isArray=s||function(a){return h.call(a)==="[object Array]"},u.isArguments=function(a){return!!a&&!!i.call(a,"callee")},u.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)},u.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},u.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)},u.isNaN=function(a){return a!==a},u.isBoolean=function(a){return a===!0||a===!1},u.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},u.isRegExp=function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},u.isNull=function(a){return a===null},u.isUndefined=function(a){return a===void 0},u.noConflict=function(){a._=b;return this},u.identity=function(a){return a},u.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},u.mixin=function(a){v(u.functions(a),function(b){B(b,u[b]=a[b])})};var y=0;u.uniqueId=function(a){var b=y++;return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},u.template=function(a,b){var c=u.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj",d);return b?e(b):e};var z=function(a){this._wrapped=a};u.prototype=z.prototype;var A=function(a,b){return b?u(a).chain():a},B=function(a,b){z.prototype[a]=function(){var a=f.call(arguments);g.call(a,this._wrapped);return A(b.apply(u,a),this._chain)}};u.mixin(u),v(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];z.prototype[a]=function(){b.apply(this._wrapped,arguments);return A(this._wrapped,this._chain)}}),v(["concat","join","slice"],function(a){var b=d[a];z.prototype[a]=function(){return A(b.apply(this._wrapped,arguments),this._chain)}}),z.prototype.chain=function(){this._chain=!0;return this},z.prototype.value=function(){return this._wrapped}}();var wax=wax||{};(function(a){a.fn.extend({nondrag:function(b){a(this).bind("mousedown mouseup mousemove",function(a){var c=!1;if(a.type==="mouseup")c=!1;else if(c||a.type==="mousedown"){c=!0;return}b(a)});return this}})})(jQuery),wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,$.jsonp({url:a,context:this,callback:"grid",callbackParameter:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=b;for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a])},error:function(){c.locks[a]=!1,c.cache[a]=null;for(var b=0;b<c.promises[a].length;b++)c.promises[a][b](c.cache[a])}})}}},wax.GridInstance=function(a,b){this.grid_tile=a,this.formatter=b,this.tileRes=4},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){var e,f;if(c.left&&c.top)e=c.left,f=c.top;else{var g=$(c);e=g.offset().left,f=g.offset().top}if(Math.floor((b-f)/this.tileRes)>256||Math.floor((a-e)/this.tileRes)>256)return;var h=this.grid_tile.grid[Math.floor((b-f)/this.tileRes)].charCodeAt(Math.floor((a-e)/this.tileRes));h=this.resolveCode(h);if(this.grid_tile.keys[h])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[h]])}},wax.GridManager=function(){this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d){if(!d)return b(!1);wax.request.get(c.tileDataUrl(a),function(a){b(new wax.GridInstance(a,d))})})},wax.GridManager.prototype.makeEvent=function(a){return{target:a.target||a.srcElement,pX:a.pageX||a.clientX,pY:a.pageY||a.clientY,evt:a}},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(this.formatters[a]):wax.request.get(a,function(d){d&&d.formatter?c.formatters[a]=new wax.Formatter(d):c.formatters[a]=!1,b(c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.context=a,this.container=b||$('<div class="wax-legends"></div>'),this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){$(".wax-legend",this.container).hide();var b=$.proxy(function(a,b){b?this.legends[a]?this.legends[a].show():(this.legends[a]=$("<div class='wax-legend'></div>").append(b),this.container.append(this.legends[a])):this.legends[a]=!1},this);for(var c=0;c<a.length;c++){var d=this.legendUrl(a[c]);wax.request.get(d,function(a){a&&a.legend&&b(d,a.legend)})}},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var wax=wax||{};wax.tooltip={},wax.tooltip.getToolTip=function(a,b,c,d){var e=$(b).children("div.wax-tooltip-"+c+":not(.removed)");e.size()===0&&(e=$("<div class='wax-tooltip wax-tooltip-"+c+"'>"+"</div>").html(a),$(b).triggerHandler("addedtooltip",[e,b,d])||$(b).append(e));for(var f=c-1;f>0;f--){var g=$("div.wax-tooltip-"+f+":not(.removed)");g.size()>0&&g.addClass("hidden").hide()}return e},wax.tooltip.click=function(a,b,c){var d=wax.tooltip.getToolTip(a,b,c),e=$('<a href="#close" class="close">Close</a>');e.click(function(){d.addClass("removed").fadeOut("fast",function(){$(this).remove()});return!1}),d.addClass("wax-popup").html(a).append(e)},wax.tooltip.select=function(a,b,c,d){!a||(wax.tooltip.getToolTip(a,b,c,d),$(b).css("cursor","pointer"),$("div",b).css("cursor","pointer"))},wax.tooltip.unselect=function(a,b,c,d){$(b).css("cursor","default"),c?$("div.wax-tooltip-"+c+":not(.wax-popup)").remove():$("div.wax-tooltip:not(.wax-popup)").remove(),$("div",b).css("cursor","default"),$("div.wax-tooltip:first").removeClass("hidden").show(),$(b).triggerHandler("removedtooltip",[a,b,d])};var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Embedder=OpenLayers.Class(OpenLayers.Control,{initialize:function(a){a=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},setMap:function(a){$("#"+this.el+"-script").length&&(OpenLayers.Control.prototype.setMap.apply(this,arguments),$(a.div).prepend($('<input type="text" class="embed-src" />').css({"z-index":"9999999999",position:"relative"}).val("<div id='"+this.el+"-script'>"+$("#"+this.el+"-script").html()+"</div>"))),this.activate()},CLASS_NAME:"wax.ol.Embedder"});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Interaction=OpenLayers.Class(OpenLayers.Control,{feature:{},handlerOptions:null,handlers:null,gm:new wax.GridManager,initialize:function(a){this.options=a||{},this.clickAction=this.options.clickAction||"full",OpenLayers.Control.prototype.initialize.apply(this,[this.options||{}]),this.callbacks={out:wax.tooltip.unselect,over:wax.tooltip.select,click:wax.tooltip.click}},setMap:function(a){$(a.viewPortDiv).bind("mousemove",$.proxy(this.getInfoForHover,this)),$(a.viewPortDiv).bind("mouseout",$.proxy(this.resetLayers,this)),this.clickHandler=new OpenLayers.Handler.Click(this,{click:this.getInfoForClick}),this.clickHandler.setMap(a),this.clickHandler.activate(),a.events.on({addlayer:this.resetLayers,changelayer:this.resetLayers,removelayer:this.resetLayers,changebaselayer:this.resetLayers,scope:this}),OpenLayers.Control.prototype.setMap.apply(this,arguments)},getTileStack:function(a,b){var c=[];layerfound:for(var d=0;d<a.length;d++)for(var e=0;e<a[d].grid.length;e++)for(var f=0;f<a[d].grid[e].length;f++){var g=$(a[d].grid[e][f].imgDiv).offset();if(g&&g.top<b.pageY&&g.top+256>b.pageY&&g.left<b.pageX&&g.left+256>b.pageX){c.push(a[d].grid[e][f]);continue layerfound}}return c},viableLayers:function(){if(this._viableLayers)return this._viableLayers;return this._viableLayers=$(this.map.layers).filter(function(a){return this.map.layers[a].visibility===!0&&this.map.layers[a].CLASS_NAME==="OpenLayers.Layer.TMS"})},resetLayers:function(){this._viableLayers=null,this.callbacks.out()},getInfoForClick:function(a){var b=this.viableLayers(),c=this.getTileStack(this.viableLayers(),a),d=null,e=null,f=this;for(var g=0;g<c.length;g++)this.gm.getGrid(c[g].url,function(b){if(!!b){var d=b.getFeature(a.pageX,a.pageY,c[g].imgDiv,{format:f.clickAction});if(d)switch(f.clickAction){case"full":f.callbacks.click(d,c[g].layer.map.viewPortDiv,g);break;case"location":window.location=d}}})},getInfoForHover:function(a){var b={format:"teaser"},c=this.viableLayers(),d=this.getTileStack(this.viableLayers(),a),e=null,f=null,g=this;for(var h=0;h<d.length;h++)this.gm.getGrid(d[h].url,function(c){if(c&&d[h]){var e=c.getFeature(a.pageX,a.pageY,d[h].imgDiv,b);if(e){if(!d[h])return;e&&g.feature[h]!==e?(g.feature[h]=e,g.callbacks.out(e,d[h].layer.map.div,h,a),g.callbacks.over(e,d[h].layer.map.div,h,a)):e||(g.feature[h]=null,g.callbacks.out(e,d[h].layer.map.div,h,a))}else g.feature[h]=null,d[h]?g.callbacks.out({},d[h].layer.map.div,h,a):g.callbacks.out({},!1,h)}})},CLASS_NAME:"wax.ol.Interaction"});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Legend=OpenLayers.Class(OpenLayers.Control,{CLASS_NAME:"wax.ol.Legend",legend:null,options:null,initialize:function(a){this.options=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},activate:function(){this.legend=new wax.Legend(this.map.viewPortDiv,this.options.container);return OpenLayers.Control.prototype.activate.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments),this.activate(),this.map.events.on({addlayer:this.setLegend,changelayer:this.setLegend,removelayer:this.setLegend,changebaselayer:this.setLegend,scope:this})},setLegend:function(){var a=[];for(var b=0;b<this.map.layers.length;b++){var c=this.map.layers[b];c&&c.getURL&&c.visibility&&a.push(c.getURL(new OpenLayers.Bounds))}this.legend.render(a)}});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Switcher=OpenLayers.Class(OpenLayers.Control,{CLASS_NAME:"wax.ol.Switcher",initialize:function(a){this.$element=$(a.e),this.options=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments),this.map.events.on({addlayer:this.redraw,changelayer:this.redraw,removelayer:this.redraw,changebaselayer:this.redraw,scope:this}),this.redraw()},layerClick:function(a){var b=a.currentTarget,c=$(b).data("layer");$("a.active",this.$element).removeClass("active"),$.each(this.map.getLayersBy("isBaseLayer",!1),function(){this.CLASS_NAME!=="OpenLayers.Layer.Vector.RootContainer"&&this.displayInLayerSwitcher&&this.setVisibility(!1)}),c.setVisibility(!0),$(b).addClass("active")},needsRedraw:function(){if(!this.layerStates||this.layerStates.length||this.map.layers.length!=this.layerStates.length)return!0;for(var a=0,b=this.layerStates.length;a<b;a++){var c=this.layerStates[a],d=this.map.layers[a];if(c.name!=d.name||c.inRange!=d.inRange||c.id!=d.id||c.visibility!=d.visibility)return!0}return!1},redraw:function(){if(this.needsRedraw()){this.$element.html("");var a=this.map.layers.length;this.layerStates=[];for(var b=0;b<a;b++){var c=this.map.layers[b];this.layerStates[b]={name:c.name,visibility:c.visibility,inRange:c.inRange,id:c.id}}var d=this.map.layers.slice();for(b=0,a=d.length;b<a;b++){var e=d[b];if(e.displayInLayerSwitcher){var f=e.isBaseLayer?e===this.map.baseLayer:e.getVisibility(),g=$.proxy(function(a){this.layerClick(a);return!1},this),h=$("<a></a>");h.click(g).attr("href","#").text(e.name).addClass("layer-toggle").data("layer",e).attr("disabled",!e.inRange),f&&h.addClass("active")}this.$element.append(h),this.$element.trigger("layeradded",h)}}}}) | ||
*/(function(a,b){function B(m){function P(a){!(M++)&&b(function(){N(),G&&a!=u&&(x[I]=a),f(m.error,m,[m,a]),f(B,m,[m,a])},0)}function O(a){!(M++)&&b(function(){N(),G&&(x[I]={s:[a]}),C&&(a=C.apply(m,[a])),f(m.success,m,[a,t]),f(B,m,[m,t])},0)}m=a.extend({},A,m);var B=m.complete,C=m.dataFilter,D=m.callbackParameter,E=m.callback,F=m.cache,G=m.pageCache,H=m.charset,I=m.url,J=m.data,K=m.timeout,L,M=0,N=c;m.abort=function(){!(M++)&&N()};if(f(m.beforeSend,m,[m])===!1||M)return m;I=I||j,J=J?typeof J=="string"?J:a.param(J,m.traditional):j,I+=J?g(I)+J:j,D&&(I+=g(I)+encodeURIComponent(D)+"=?"),!F&&!G&&(I+=g(I)+"_"+(new Date).getTime()+"="),I=I.replace(/=\?(&|$)/,"="+E+"$1"),G&&(L=x[I])?L.s?O(L.s[0]):P(L):b(function(f,g,j){if(!M){j=K>0&&b(function(){P(u)},K),N=function(){j&&clearTimeout(j),f[q]=f[n]=f[p]=f[o]=null,w[r](f),g&&w[r](g)},window[E]=d,f=a(s)[0],f.id=l+y++,H&&(f[i]=H);function m(a){(f[n]||c)(),a=z,z=undefined,a?O(a[0]):P(k)}v.msie?(f.event=n,f.htmlFor=f.id,f[q]=function(){/loaded|complete/.test(f.readyState)&&m()}):(f[o]=f[p]=m,v.opera?(g=a(s)[0]).text="jQuery('#"+f.id+"')[0]."+o+"()":f[h]=h),f.src=I,e(f),g&&e(g)}},0);return m}function g(a){return/\?/.test(a)?"&":"?"}function f(a,b,c){return a&&a.apply(b.context||b,c)}function e(a){w.insertBefore(a,w.firstChild)}function d(a){z=[a]}function c(){}var h="async",i="charset",j="",k="error",l="_jqjsp",m="on",n=m+"click",o=m+k,p=m+"load",q=m+"readystatechange",r="removeChild",s="<script/>",t="success",u="timeout",v=a.browser,w=a("head")[0]||document.documentElement,x={},y=0,z,A={callback:l,url:location.href};B.setup=function(b){a.extend(A,b)},a.jsonp=B})(jQuery,setTimeout);var wax=wax||{};wax.Record=function(a,b){var c=function(a,b){var c=_.reduce(a.split("."),function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return _.isString(a)&&_.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(_.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=_.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=d.slice,g=d.unshift,h=e.toString,i=e.hasOwnProperty,j=d.forEach,k=d.map,l=d.reduce,m=d.reduceRight,n=d.filter,o=d.every,p=d.some,q=d.indexOf,r=d.lastIndexOf,s=Array.isArray,t=Object.keys,u=function(a){return new z(a)};typeof module!="undefined"&&module.exports?(module.exports=u,u._=u):a._=u,u.VERSION="1.1.4";var v=u.each=u.forEach=function(a,b,d){var e;if(a!=null)if(j&&a.forEach===j)a.forEach(b,d);else if(u.isNumber(a.length)){for(var f=0,g=a.length;f<g;f++)if(b.call(d,a[f],f,a)===c)return}else for(var h in a)if(i.call(a,h)&&b.call(d,a[h],h,a)===c)return};u.map=function(a,b,c){var d=[];if(a==null)return d;if(k&&a.map===k)return a.map(b,c);v(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)});return d},u.reduce=u.foldl=u.inject=function(a,b,c,d){var e=c!==void 0;a==null&&(a=[]);if(l&&a.reduce===l){d&&(b=u.bind(b,d));return e?a.reduce(b,c):a.reduce(b)}v(a,function(a,f,g){!e&&f===0?(c=a,e=!0):c=b.call(d,c,a,f,g)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},u.reduceRight=u.foldr=function(a,b,c,d){a==null&&(a=[]);if(m&&a.reduceRight===m){d&&(b=u.bind(b,d));return c!==void 0?a.reduceRight(b,c):a.reduceRight(b)}var e=(u.isArray(a)?a.slice():u.toArray(a)).reverse();return u.reduce(e,b,c,d)},u.find=u.detect=function(a,b,c){var d;w(a,function(a,e,f){if(b.call(c,a,e,f)){d=a;return!0}});return d},u.filter=u.select=function(a,b,c){var d=[];if(a==null)return d;if(n&&a.filter===n)return a.filter(b,c);v(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)});return d},u.reject=function(a,b,c){var d=[];if(a==null)return d;v(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)});return d},u.every=u.all=function(a,b,d){b=b||u.identity;var e=!0;if(a==null)return e;if(o&&a.every===o)return a.every(b,d);v(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c});return e};var w=u.some=u.any=function(a,b,d){b=b||u.identity;var e=!1;if(a==null)return e;if(p&&a.some===p)return a.some(b,d);v(a,function(a,f,g){if(e=b.call(d,a,f,g))return c});return e};u.include=u.contains=function(a,b){var c=!1;if(a==null)return c;if(q&&a.indexOf===q)return a.indexOf(b)!=-1;w(a,function(a){if(c=a===b)return!0});return c},u.invoke=function(a,b){var c=f.call(arguments,2);return u.map(a,function(a){return(b?a[b]:a).apply(a,c)})},u.pluck=function(a,b){return u.map(a,function(a){return a[b]})},u.max=function(a,b,c){if(!b&&u.isArray(a))return Math.max.apply(Math,a);var d={computed:-Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})});return d.value},u.min=function(a,b,c){if(!b&&u.isArray(a))return Math.min.apply(Math,a);var d={computed:Infinity};v(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})});return d.value},u.sortBy=function(a,b,c){return u.pluck(u.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},u.sortedIndex=function(a,b,c){c=c||u.identity;var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},u.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(u.isArray(a))return a;if(u.isArguments(a))return f.call(a);return u.values(a)},u.size=function(a){return u.toArray(a).length},u.first=u.head=function(a,b,c){return b&&!c?f.call(a,0,b):a[0]},u.rest=u.tail=function(a,b,c){return f.call(a,u.isUndefined(b)||c?1:b)},u.last=function(a){return a[a.length-1]},u.compact=function(a){return u.filter(a,function(a){return!!a})},u.flatten=function(a){return u.reduce(a,function(a,b){if(u.isArray(b))return a.concat(u.flatten(b));a[a.length]=b;return a},[])},u.without=function(a){var b=f.call(arguments,1);return u.filter(a,function(a){return!u.include(b,a)})},u.uniq=u.unique=function(a,b){return u.reduce(a,function(a,c,d){if(0==d||(b===!0?u.last(a)!=c:!u.include(a,c)))a[a.length]=c;return a},[])},u.intersect=function(a){var b=f.call(arguments,1);return u.filter(u.uniq(a),function(a){return u.every(b,function(b){return u.indexOf(b,a)>=0})})},u.zip=function(){var a=f.call(arguments),b=u.max(u.pluck(a,"length")),c=Array(b);for(var d=0;d<b;d++)c[d]=u.pluck(a,""+d);return c},u.indexOf=function(a,b,c){if(a==null)return-1;if(c){var d=u.sortedIndex(a,b);return a[d]===b?d:-1}if(q&&a.indexOf===q)return a.indexOf(b);for(var d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},u.lastIndexOf=function(a,b){if(a==null)return-1;if(r&&a.lastIndexOf===r)return a.lastIndexOf(b);var c=a.length;while(c--)if(a[c]===b)return c;return-1},u.range=function(a,b,c){var d=f.call(arguments),e=d.length<=1,a=e?0:d[0],b=e?d[0]:d[1],c=d[2]||1,g=Math.max(Math.ceil((b-a)/c),0),h=0,i=Array(g);while(h<g)i[h++]=a,a+=c;return i},u.bind=function(a,b){var c=f.call(arguments,2);return function(){return a.apply(b||{},c.concat(f.call(arguments)))}},u.bindAll=function(a){var b=f.call(arguments,1);b.length==0&&(b=u.functions(a)),v(b,function(b){a[b]=u.bind(a[b],a)});return a},u.memoize=function(a,b){var c={};b=b||u.identity;return function(){var d=b.apply(this,arguments);return d in c?c[d]:c[d]=a.apply(this,arguments)}},u.delay=function(a,b){var c=f.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},u.defer=function(a){return u.delay.apply(u,[a,1].concat(f.call(arguments,1)))};var x=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d);if(c||!d)d=setTimeout(g,b)}};u.throttle=function(a,b){return x(a,b,!1)},u.debounce=function(a,b){return x(a,b,!0)},u.wrap=function(a,b){return function(){var c=[a].concat(f.call(arguments));return b.apply(this,c)}},u.compose=function(){var a=f.call(arguments);return function(){var b=f.call(arguments);for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},u.keys=t||function(a){if(u.isArray(a))return u.range(0,a.length);var b=[];for(var c in a)i.call(a,c)&&(b[b.length]=c);return b},u.values=function(a){return u.map(a,u.identity)},u.functions=u.methods=function(a){return u.filter(u.keys(a),function(b){return u.isFunction(a[b])}).sort()},u.extend=function(a){v(f.call(arguments,1),function(b){for(var c in b)a[c]=b[c]});return a},u.clone=function(a){return u.isArray(a)?a.slice():u.extend({},a)},u.tap=function(a,b){b(a);return a},u.isEqual=function(a,b){if(a===b)return!0;var c=typeof a,d=typeof b;if(c!=d)return!1;if(a==b)return!0;if(!a&&b||a&&!b)return!1;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual)return a.isEqual(b);if(u.isDate(a)&&u.isDate(b))return a.getTime()===b.getTime();if(u.isNaN(a)&&u.isNaN(b))return!1;if(u.isRegExp(a)&&u.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(c!=="object")return!1;if(a.length&&a.length!==b.length)return!1;var e=u.keys(a),f=u.keys(b);if(e.length!=f.length)return!1;for(var g in a)if(!(g in b)||!u.isEqual(a[g],b[g]))return!1;return!0},u.isEmpty=function(a){if(u.isArray(a)||u.isString(a))return a.length===0;for(var b in a)if(i.call(a,b))return!1;return!0},u.isElement=function(a){return!!a&&a.nodeType==1},u.isArray=s||function(a){return h.call(a)==="[object Array]"},u.isArguments=function(a){return!!a&&!!i.call(a,"callee")},u.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)},u.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},u.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)},u.isNaN=function(a){return a!==a},u.isBoolean=function(a){return a===!0||a===!1},u.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},u.isRegExp=function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},u.isNull=function(a){return a===null},u.isUndefined=function(a){return a===void 0},u.noConflict=function(){a._=b;return this},u.identity=function(a){return a},u.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},u.mixin=function(a){v(u.functions(a),function(b){B(b,u[b]=a[b])})};var y=0;u.uniqueId=function(a){var b=y++;return a?a+b:b},u.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},u.template=function(a,b){var c=u.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj",d);return b?e(b):e};var z=function(a){this._wrapped=a};u.prototype=z.prototype;var A=function(a,b){return b?u(a).chain():a},B=function(a,b){z.prototype[a]=function(){var a=f.call(arguments);g.call(a,this._wrapped);return A(b.apply(u,a),this._chain)}};u.mixin(u),v(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];z.prototype[a]=function(){b.apply(this._wrapped,arguments);return A(this._wrapped,this._chain)}}),v(["concat","join","slice"],function(a){var b=d[a];z.prototype[a]=function(){return A(b.apply(this._wrapped,arguments),this._chain)}}),z.prototype.chain=function(){this._chain=!0;return this},z.prototype.value=function(){return this._wrapped}}();var wax=wax||{};(function(a){a.fn.extend({nondrag:function(b){a(this).bind("mousedown mouseup mousemove",function(a){var c=!1;if(a.type==="mouseup")c=!1;else if(c||a.type==="mousedown"){c=!0;return}b(a)});return this}})})(jQuery),wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(!this.locks[a]){var c=this;this.locks[a]=!0,$.jsonp({url:a,context:this,callback:"grid",callbackParameter:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=b;for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a])},error:function(){c.locks[a]=!1,c.cache[a]=null;for(var b=0;b<c.promises[a].length;b++)c.promises[a][b](c.cache[a])}})}}},wax.GridInstance=function(a,b){this.grid_tile=a,this.formatter=b,this.tileRes=4},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){var e,f;if(c.left&&c.top)e=c.left,f=c.top;else{var g=$(c);e=g.offset().left,f=g.offset().top}if(Math.floor((b-f)/this.tileRes)>256||Math.floor((a-e)/this.tileRes)>256)return;var h=this.grid_tile.grid[Math.floor((b-f)/this.tileRes)].charCodeAt(Math.floor((a-e)/this.tileRes));h=this.resolveCode(h);if(this.grid_tile.keys[h])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[h]])}},wax.GridManager=function(){this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d){if(!d)return b(!1);wax.request.get(c.tileDataUrl(a),function(a){b(new wax.GridInstance(a,d))})})},wax.GridManager.prototype.makeEvent=function(a){return{target:a.target||a.srcElement,pX:a.pageX||a.clientX,pY:a.pageY||a.clientY,evt:a}},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(this.formatters[a]):wax.request.get(a,function(d){d&&d.formatter?c.formatters[a]=new wax.Formatter(d):c.formatters[a]=!1,b(c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.context=a,this.container=b||$('<div class="wax-legends"></div>'),this.legends={},$(this.context).append(this.container)},wax.Legend.prototype.render=function(a){$(".wax-legend",this.container).hide();var b=$.proxy(function(a,b){b?this.legends[a]?this.legends[a].show():(this.legends[a]=$("<div class='wax-legend'></div>").append(b),this.container.append(this.legends[a])):this.legends[a]=!1},this),c=function(a){a&&a.legend&&b(e,a.legend)};for(var d=0;d<a.length;d++){var e=this.legendUrl(a[d]);wax.request.get(e,c)}},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var wax=wax||{};wax.tooltip={},wax.tooltip.getToolTip=function(a,b,c,d){var e=$(b).children("div.wax-tooltip-"+c+":not(.removed)");e.size()===0&&(e=$("<div class='wax-tooltip wax-tooltip-"+c+"'>"+"</div>").html(a),$(b).triggerHandler("addedtooltip",[e,b,d])||$(b).append(e));for(var f=c-1;f>0;f--){var g=$("div.wax-tooltip-"+f+":not(.removed)");g.size()>0&&g.addClass("hidden").hide()}return e},wax.tooltip.click=function(a,b,c){var d=wax.tooltip.getToolTip(a,b,c),e=$('<a href="#close" class="close">Close</a>');e.click(function(){d.addClass("removed").fadeOut("fast",function(){$(this).remove()});return!1}),d.addClass("wax-popup").html(a).append(e)},wax.tooltip.select=function(a,b,c,d){!a||(wax.tooltip.getToolTip(a,b,c,d),$(b).css("cursor","pointer"),$("div",b).css("cursor","pointer"))},wax.tooltip.unselect=function(a,b,c,d){$(b).css("cursor","default"),c?$("div.wax-tooltip-"+c+":not(.wax-popup)").remove():$("div.wax-tooltip:not(.wax-popup)").remove(),$("div",b).css("cursor","default"),$("div.wax-tooltip:first").removeClass("hidden").show(),$(b).triggerHandler("removedtooltip",[a,b,d])};var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Embedder=OpenLayers.Class(OpenLayers.Control,{initialize:function(a){a=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},setMap:function(a){$("#"+this.el+"-script").length&&(OpenLayers.Control.prototype.setMap.apply(this,arguments),$(a.div).prepend($('<input type="text" class="embed-src" />').css({"z-index":"9999999999",position:"relative"}).val("<div id='"+this.el+"-script'>"+$("#"+this.el+"-script").html()+"</div>"))),this.activate()},CLASS_NAME:"wax.ol.Embedder"});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Interaction=OpenLayers.Class(OpenLayers.Control,{feature:{},handlerOptions:null,handlers:null,gm:new wax.GridManager,initialize:function(a){this.options=a||{},this.clickAction=this.options.clickAction||"full",OpenLayers.Control.prototype.initialize.apply(this,[this.options||{}]),this.callbacks={out:wax.tooltip.unselect,over:wax.tooltip.select,click:wax.tooltip.click}},setMap:function(a){$(a.viewPortDiv).bind("mousemove",$.proxy(this.getInfoForHover,this)),$(a.viewPortDiv).bind("mouseout",$.proxy(this.resetLayers,this)),this.clickHandler=new OpenLayers.Handler.Click(this,{click:this.getInfoForClick}),this.clickHandler.setMap(a),this.clickHandler.activate(),a.events.on({addlayer:this.resetLayers,changelayer:this.resetLayers,removelayer:this.resetLayers,changebaselayer:this.resetLayers,scope:this}),OpenLayers.Control.prototype.setMap.apply(this,arguments)},getTileStack:function(a,b){var c=[];layerfound:for(var d=0;d<a.length;d++)for(var e=0;e<a[d].grid.length;e++)for(var f=0;f<a[d].grid[e].length;f++){var g=$(a[d].grid[e][f].imgDiv).offset();if(g&&g.top<b.pageY&&g.top+256>b.pageY&&g.left<b.pageX&&g.left+256>b.pageX){c.push(a[d].grid[e][f]);continue layerfound}}return c},viableLayers:function(){if(this._viableLayers)return this._viableLayers;return this._viableLayers=$(this.map.layers).filter(function(a){return this.map.layers[a].visibility===!0&&this.map.layers[a].CLASS_NAME==="OpenLayers.Layer.TMS"})},resetLayers:function(){this._viableLayers=null,this.callbacks.out()},getInfoForClick:function(a){var b=this.viableLayers(),c=this.getTileStack(this.viableLayers(),a),d=null,e=null,f=this;for(var g=0;g<c.length;g++)this.gm.getGrid(c[g].url,function(b){if(!!b){var d=b.getFeature(a.pageX,a.pageY,c[g].imgDiv,{format:f.clickAction});if(d)switch(f.clickAction){case"full":f.callbacks.click(d,c[g].layer.map.viewPortDiv,g);break;case"location":window.location=d}}})},getInfoForHover:function(a){var b={format:"teaser"},c=this.viableLayers(),d=this.getTileStack(this.viableLayers(),a),e=null,f=null,g=this;for(var h=0;h<d.length;h++)this.gm.getGrid(d[h].url,function(c){if(c&&d[h]){var e=c.getFeature(a.pageX,a.pageY,d[h].imgDiv,b);if(e){if(!d[h])return;e&&g.feature[h]!==e?(g.feature[h]=e,g.callbacks.out(e,d[h].layer.map.div,h,a),g.callbacks.over(e,d[h].layer.map.div,h,a)):e||(g.feature[h]=null,g.callbacks.out(e,d[h].layer.map.div,h,a))}else g.feature[h]=null,d[h]?g.callbacks.out({},d[h].layer.map.div,h,a):g.callbacks.out({},!1,h)}})},CLASS_NAME:"wax.ol.Interaction"});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Legend=OpenLayers.Class(OpenLayers.Control,{CLASS_NAME:"wax.ol.Legend",legend:null,options:null,initialize:function(a){this.options=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},activate:function(){this.legend=new wax.Legend(this.map.viewPortDiv,this.options.container);return OpenLayers.Control.prototype.activate.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments),this.activate(),this.map.events.on({addlayer:this.setLegend,changelayer:this.setLegend,removelayer:this.setLegend,changebaselayer:this.setLegend,scope:this})},setLegend:function(){var a=[];for(var b=0;b<this.map.layers.length;b++){var c=this.map.layers[b];c&&c.getURL&&c.visibility&&a.push(c.getURL(new OpenLayers.Bounds))}this.legend.render(a)}});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Switcher=OpenLayers.Class(OpenLayers.Control,{CLASS_NAME:"wax.ol.Switcher",initialize:function(a){this.$element=$(a.e),this.options=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments),this.map.events.on({addlayer:this.redraw,changelayer:this.redraw,removelayer:this.redraw,changebaselayer:this.redraw,scope:this}),this.redraw()},layerClick:function(a){var b=a.currentTarget,c=$(b).data("layer");$("a.active",this.$element).removeClass("active"),$.each(this.map.getLayersBy("isBaseLayer",!1),function(){this.CLASS_NAME!=="OpenLayers.Layer.Vector.RootContainer"&&this.displayInLayerSwitcher&&this.setVisibility(!1)}),c.setVisibility(!0),$(b).addClass("active")},needsRedraw:function(){if(!this.layerStates||this.layerStates.length||this.map.layers.length!=this.layerStates.length)return!0;for(var a=0,b=this.layerStates.length;a<b;a++){var c=this.layerStates[a],d=this.map.layers[a];if(c.name!=d.name||c.inRange!=d.inRange||c.id!=d.id||c.visibility!=d.visibility)return!0}return!1},redraw:function(){if(this.needsRedraw()){this.$element.html("");var a=this.map.layers.length;this.layerStates=[];for(var b=0;b<a;b++){var c=this.map.layers[b];this.layerStates[b]={name:c.name,visibility:c.visibility,inRange:c.inRange,id:c.id}}var d=this.map.layers.slice();for(b=0,a=d.length;b<a;b++){var e=d[b];if(e.displayInLayerSwitcher){var f=e.isBaseLayer?e===this.map.baseLayer:e.getVisibility(),g=$.proxy(function(a){this.layerClick(a);return!1},this),h=$("<a></a>");h.click(g).attr("href","#").text(e.name).addClass("layer-toggle").data("layer",e).attr("disabled",!e.inRange),f&&h.addClass("active")}this.$element.append(h),this.$element.trigger("layeradded",h)}}}}) |
@@ -89,4 +89,4 @@ // Wax GridUtil | ||
wax.GridInstance.prototype.resolveCode = function(key) { | ||
(key >= 93) && key--; | ||
(key >= 35) && key--; | ||
if (key >= 93) key--; | ||
if (key >= 35) key--; | ||
key -= 32; | ||
@@ -202,3 +202,3 @@ return key; | ||
// Syntax errors in formatter | ||
console && console.log(e); | ||
if (console) console.log(e); | ||
} | ||
@@ -216,4 +216,4 @@ } else { | ||
} catch (e) { | ||
console && console.log(e); | ||
if (console) console.log(e); | ||
} | ||
}; |
@@ -27,7 +27,8 @@ // Wax Legend | ||
}, this); | ||
var renderLegend = function(data) { | ||
if (data && data.legend) render(url, data.legend); | ||
}; | ||
for (var i = 0; i < urls.length; i++) { | ||
var url = this.legendUrl(urls[i]); | ||
wax.request.get(url, function(data) { | ||
(data && data.legend) && (render(url, data.legend)); | ||
}); | ||
wax.request.get(url, renderLegend); | ||
} | ||
@@ -34,0 +35,0 @@ }; |
@@ -78,3 +78,3 @@ // Wax GridUtil | ||
$(context).triggerHandler('removedtooltip', [feature, context, evt]) | ||
$(context).triggerHandler('removedtooltip', [feature, context, evt]); | ||
}; |
@@ -11,2 +11,10 @@ // namespacing! | ||
/* Ideal layout | ||
map.hash({ | ||
push: function(), | ||
init: function(callback) | ||
}); | ||
*/ | ||
// Internal function used to implement `_.throttle` and `_.debounce`. | ||
@@ -13,0 +21,0 @@ var limit = function(func, wait, debounce) { |
@@ -81,7 +81,7 @@ // Wax header | ||
function(i) { | ||
// TODO: make better indication of whether | ||
// this is an interactive layer | ||
return (this.map.layers[i].visibility === true) && | ||
(this.map.layers[i].CLASS_NAME === 'OpenLayers.Layer.TMS'); | ||
} | ||
// TODO: make better indication of whether | ||
// this is an interactive layer | ||
return (this.map.layers[i].visibility === true) && | ||
(this.map.layers[i].CLASS_NAME === 'OpenLayers.Layer.TMS'); | ||
} | ||
); | ||
@@ -88,0 +88,0 @@ }, |
{ | ||
"author": "Development Seed <info@developmentseed.org>", | ||
"name": "wax", | ||
"version": "1.2.2", | ||
"files": [ "build" ] | ||
"author": [ | ||
"Tom MacWright <macwright@gmail.com>" | ||
], | ||
"contributors": [ | ||
"Young Hahn <young@developmentseed.org>", | ||
"Will White <will@developmentseed.org>" | ||
], | ||
"licenses": [{ | ||
"type": "BSD" | ||
}], | ||
"version": "1.4.1", | ||
"files": [ | ||
"build" | ||
], | ||
"devDependencies": { | ||
"jshint": "0.2.x", | ||
"docco": "0.3.x" | ||
} | ||
} |
@@ -30,2 +30,4 @@ # Wax | ||
* `.fullscreen()` | ||
* `.zoombox()` | ||
* `.hash()` | ||
@@ -106,2 +108,14 @@ #### Lib | ||
#### 1.4.1 | ||
* Tweaks to `boxselect` including removability. | ||
#### 1.4.0 | ||
* Added `.boxselect(function())` | ||
#### 1.3.0 | ||
* Added `.zoombox()` and `hash()` controls for Modest Maps. | ||
#### 1.2.1 | ||
@@ -108,0 +122,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1058690
46
13289
169
2