if(!this.JSON)this.JSON={};
(function(){function a(k){return k<10?"0"+k:k}function i(k){f.lastIndex=0;return f.test(k)?'"'+k.replace(f,function(l){var m=h[l];return typeof m==="string"?m:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+k+'"'}function d(k,l){var m,n,r=g,q,o=l[k];if(o&&typeof o==="object"&&typeof o.toJSON==="function")o=o.toJSON(k);if(typeof j==="function")o=j.call(l,k,o);switch(typeof o){case "string":return i(o);case "number":return isFinite(o)?String(o):"null";case "boolean":case "null":return String(o);case "object":if(!o)return"null";
g+=b;q=[];if(Object.prototype.toString.apply(o)==="[object Array]"){n=o.length;for(k=0;k<n;k+=1)q[k]=d(k,o)||"null";l=q.length===0?"[]":g?"[\n"+g+q.join(",\n"+g)+"\n"+r+"]":"["+q.join(",")+"]";g=r;return l}if(j&&typeof j==="object"){n=j.length;for(k=0;k<n;k+=1){m=j[k];if(typeof m==="string")if(l=d(m,o))q.push(i(m)+(g?": ":":")+l)}}else for(m in o)if(Object.hasOwnProperty.call(o,m))if(l=d(m,o))q.push(i(m)+(g?": ":":")+l);l=q.length===0?"{}":g?"{\n"+g+q.join(",\n"+g)+"\n"+r+"}":"{"+q.join(",")+"}";
g=r;return l}}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var c=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
f=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g,b,h={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},j;if(typeof JSON.stringify!=="function")JSON.stringify=function(k,l,m){var n;b=g="";if(typeof m==="number")for(n=0;n<m;n+=1)b+=" ";else if(typeof m==="string")b=m;if((j=l)&&typeof l!=="function"&&(typeof l!=="object"||typeof l.length!=="number"))throw new Error("JSON.stringify");return d("",
{"":k})};if(typeof JSON.parse!=="function")JSON.parse=function(k,l){function m(n,r){var q,o,s=n[r];if(s&&typeof s==="object")for(q in s)if(Object.hasOwnProperty.call(s,q)){o=m(s,q);if(o!==undefined)s[q]=o;else delete s[q]}return l.call(n,r,s)}c.lastIndex=0;if(c.test(k))k=k.replace(c,function(n){return"\\u"+("0000"+n.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(k.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){k=eval("("+k+")");return typeof l==="function"?m({"":k},""):k}throw new SyntaxError("JSON.parse");}})();xorse={};xorse.PARSING="xorse.utils";xorse.DEBUG=false;try{if(window)xorse.WINDOW=true}catch(e){window=this}xorse.require=function(a){for(var i=a.split("."),d=window,c=0;c<i.length;c++){d=d[i[c]];if(d===undefined){xorse.write_error(a+" is needed by "+xorse.PARSING+" and has not been loaded!",true);break}}};
xorse.extend=function(){var a=arguments[0]||{},i=1,d=arguments.length,c=false,f;if(typeof a==="boolean"){c=a;a=arguments[1]||{};i=2}if(typeof a!=="object")a={};for(;i<d;i++)if((f=arguments[i])!=null)for(var g in f){var b=a[g],h=f[g];if(a!==h)if(c&&h&&typeof h==="object"&&!h.nodeType)a[g]=xorse.extend(c,b||(h.length!=null?[]:{}),h);else if(h!==undefined)a[g]=h}return a};
xorse.is_node=function(a){return typeof Node==="object"?a instanceof Node:typeof a==="object"&&typeof a.nodeType==="number"&&typeof a.nodeName==="string"};xorse.is_element=function(a){return typeof HTMLElement==="object"?a instanceof HTMLElement:a==="object"&&a.nodeType===1&&a.nodeName==="string"};xorse.write_error=function(a,i){if(i)try{console.error(a)}catch(d){}};xorse.write_log=function(a){try{console.log(a)}catch(i){}};xorse.timer_id=0;xorse.timer_objects={};
xorse.start_timer=function(){xorse.timer_objects[++xorse.timer_id]=(new Date).getTime();return xorse.timer_id};xorse.end_timer=function(a){return xorse.timer_objects[a]?(new Date).getTime()-xorse.timer_objects[a]:-1};xorse.stop_event=function(a){if(navigator&&navigator.userAgent.indexOf("MSIE")!==-1&&document.all){window.event.cancelBubble=true;window.event.returnValue=false}else a.stopPropagation()};xorse.signals={};
xorse.signal=function(a,i,d){if(xorse.signals[a]===undefined){xorse.signals[a]={};xorse.signals[a][i]=d}else if(xorse.signals[a][i]===undefined)xorse.signals[a][i]=d};xorse.delete_signal=function(a,i){try{delete xorse.signals[a][i]}catch(d){}};xorse.send_signal=function(a,i,d){i=i||null;if(xorse.signals[a])for(var c in xorse.signals[a]){xorse.signals[a][c](i);d&&d()}else return false};xorse.subclasses=function(a,i){var d=Array.prototype.slice.call(arguments,2);a.apply(i,d);return a.prototype};
xorse.subclasses_many=function(a,i){var d={};for(var c in a){eval("klass").apply(i,a[c]);d[c]=eval("klass").prototype}return d};xorse.create_cookie=function(a,i,d){var c="";if(d){c=new Date;c.setTime(c.getTime()+d*24*60*60*1E3);c="; expires="+c.toGMTString()}document.cookie=a+"="+i+c+"; path=/"};
xorse.read_cookie=function(a){a=a+"=";for(var i=document.cookie.split(";"),d=i.length,c=0;c<d;c++){for(var f=i[c];f.charAt(0)==" ";)f=f.substring(1,f.length);if(f.indexOf(a)==0)return f.substring(a.length,f.length)}return null};xorse.erase_cookie=function(a){xorse.create_cookie(a,"",-1)};xorse.export_methods=function(a){for(var i=0;i<a.length;i++)this[a[i][0]]=a[i][1]};this.xorse=xorse;var xorse=xorse===undefined?{}:xorse;xorse.PARSING="xorse.hash";xorse.hash={};xorse.hash.internal=false;xorse.hash._hash="#";xorse.hash.callbacks={};xorse.hash.callbacks.functions={};xorse.hash.callbacks.empty=[function(){}];
xorse.hash.callbacks._util=function(a,i,d){if(i===undefined)return xorse.hash.callbacks.functions[a]&&xorse.hash.callbacks.functions[a][d]?xorse.hash.callbacks.functions[a][d]:xorse.hash.callbacks.empty;else if(xorse.hash.callbacks.functions[a])if(xorse.hash.callbacks.functions[a][d])xorse.hash.callbacks.functions[a][d].push(i);else xorse.hash.callbacks.functions[a][d]=[i];else{xorse.hash.callbacks.functions[a]={};xorse.hash.callbacks.functions[a][d]=[i]}};
xorse.hash.callbacks.read=function(a,i){return xorse.hash.callbacks._util(a,i,"read")};xorse.hash.callbacks.write=function(a,i){return xorse.hash.callbacks._util(a,i,"write")};
xorse.hash.read=function(a,i){hash=xorse.hash.internal?xorse.hash._hash:window.location.hash;i=i===undefined?false:i;if(hash.length>0){hash=hash.substr(1);for(var d=hash.split("&"),c=null,f=0;f<d.length;f++)if(d[f].indexOf(a+"=")!==-1)c=d[f].split("=")[1];c=c!==null&&c!==""?c:i;if(c!==null){a=xorse.hash.callbacks.read(a);for(d=0;d<a.length;d++)a[d](c)}return c!==null?c:i}else return i};
xorse.hash.write_all=function(a,i){hash=xorse.hash.internal?xorse.hash._hash:window.location.hash;if(hash.length>1){hash=hash.substr(1);var d=hash.split("&")}else d=[];for(var c=false,f=[],g=0;g<a.length;g++){var b=a[g],h=i[g];c=false;if(d.length)for(var j=0;j<d.length;j++){if(d[j].indexOf(b+"=")!==-1)if(h===null){delete d[j];break}else{d[j]=b+"="+h;c=true}if(c){f.push(d[j]);break}}!c&&h!==null&&f.push(b+"="+h)}out=f.length>1?f.join("&"):f.join("");if(xorse.hash.internal)xorse.hash._hash="#"+out;
else window.location.hash=out;for(g=0;g<a.length;g++){i=xorse.hash.callbacks.write(a[g]);for(j=0;j<i.length;j++)i[j](h)}};
xorse.hash.write=function(a,i){hash=xorse.hash.internal?xorse.hash._hash:window.location.hash;i=i===undefined?"":i;if(hash.length>0){hash=hash.substr(1);for(var d=hash.split("&"),c=false,f=[],g=false,b=0;b<d.length;b++){if(d[b].indexOf(a+"=")!==-1)if(i===null){g=true;delete d[b]}else{d[b]=a+"="+i;c=true}g||f.push(d[b])}!c&&i!==null&&f.push(a+"="+i);out=f.length>1?f.join("&"):f.join("");if(xorse.hash.internal)xorse.hash._hash="#"+out;else window.location.hash=out}else if(xorse.hash.internal)xorse.hash._hash=
"#"+a+"="+i;else window.location.hash=a+"="+i;a=xorse.hash.callbacks.write(a);for(b=0;b<a.length;b++)a[b](i)};xorse.hash.remove=function(a){xorse.hash.write(a,null)};xorse=xorse===undefined?{}:xorse;xorse.ajax=xorse.ajax===undefined?{}:xorse.ajax;xorse.PARSING="xorse.ajax";xorse.ajax.DEBUG=xorse.DEBUG;xorse.ajax.errors={no_xmlhttprequest_support:"This browser does not natively support XMLHttpRequest",no_native_json_support:"This browser does not natively support JSON. The json2.js library was also not loaded to fix this."};
xorse.ajax.sanity_tests=function(){var a=false;try{if(XMLHttpRequest===undefined)throw new Error(xorse.ajax.errors.no_xmlhttprequest_support);if(JSON===undefined)throw new Error(xorse.ajax.errors.no_native_json_support);a=true}catch(i){xorse.write_error(i,xorse.ajax.DEBUG)}finally{return a}};xorse.ajax.sanity_tests();
xorse.ajax.build_request_url=function(a,i){var d=[],c=i===undefined?true:false;if(c)i=a;for(var f in i)if(i[f]instanceof Array)for(var g=0;g<i[f].length;g++)d.push(escape(f)+"="+escape(i[f][g]));else d.push(escape(f)+"="+escape(i[f]));if(d.length&&!c){if(a.indexOf("?")===-1)a+="?";a+=d.join("&")}else if(c)return d.join("&");return a};
xorse.ajax.response_callback=function(a,i,d,c){if(a.readyState===4){d=d||a.responseText;var f=a.status;if(i[f])i[f](d,a);else{var g=Math.floor(f/100);if(i[g+"xx"])i[g+"xx"](d,a);else i.xxx?i.xxx(d,a):xorse.write_error("Request: <"+c+"> made with no available callbacks - Received Status <"+f+">",xorse.ajax.DEBUG)}}};
xorse.ajax.create=function(a,i,d,c,f){var g=new XMLHttpRequest;c=c||{};f=f||false;i=xorse.ajax.build_request_url(i,d);g.open(a,i,true);g.onreadystatechange=function(){if(xorse.ajax.DEBUG&&start!==0&&g.readyState===4){var b=xorse.end_timer(start);xorse.write_log('Request: "'+i+'", Time: '+b+"ms")}xorse.ajax.response_callback(g,c,null,i)};if(f){if(xorse.ajax.DEBUG)start=xorse.start_timer();g.send(null)}return g};xorse.ajax.get=function(a,i,d,c){c=c||true;return xorse.ajax.create("GET",a,i,d,c)};
xorse.ajax.put=function(a,i,d){xorse.ajax.create("PUT",a,{},d,false).send(xorse.ajax.build_request_url(i))};xorse.ajax.post=function(a,i,d){i=xorse.ajax.build_request_url(i);a=xorse.ajax.create("POST",a,{},d,false);a.setRequestHeader("Content-type","application/x-www-form-urlencoded");a.setRequestHeader("Content-length",i.length);a.setRequestHeader("Connection","close");a.send(i)};
xorse.ajax.get_json=function(a,i,d){xorse.ajax.get(a,i,{xxx:function(c,f){c=JSON.parse(c||"{}");xorse.ajax.response_callback(f,d,c,a)}})};xorse.ajax.post_json=function(a,i,d){xorse.ajax.post(a,i,{xxx:function(c,f){c=JSON.parse(c||"{}");xorse.ajax.response_callback(f,d,c,a)}})};xorse=xorse===undefined?{}:xorse;xorse.PARSING="xorse.Module";xorse.require("google.maps");xorse.Module=function(a){var i=this,d=i._={},c=i.$={};this.pub=i;this.pri=d;this.pro=c;i.get_module_name=function(){return a};i.bind=function(f,g,b){return xorse.maphat.google.Event(f,g,b)};i.bind_dom=function(f,g,b,h){return xorse.maphat.google.DOMEvent(f,g,b,h)};i.trigger=function(f,g){return google.maps.Event.trigger(f,g)};i.trigger_dom=function(f,g){return google.maps.Event.triggerDom(f,g)}};
window["xorse.Module"]=xorse.Module;xorse.PARSING="xorse.Module";xorse.MultiModule=function(a,i){var d=this;d.$={};var c=d._={};d.get_module_name=function(){return a};c.constructor=function(){for(var f=0;f<i.length;f++){var g=new i[f];xorse.extend(d,g)}};c.constructor()};window["xorse.MultiModule"]=xorse.MultiModule;xorse.PARSING="xorse.maphat.google";xorse.maphat=xorse.maphat===undefined?{}:xorse.maphat;xorse.require("google.maps");xorse.maphat.GMAP2=2;xorse.maphat.GMAP3=3;xorse.maphat.MAP_VERSION=""+(xorse.maphat.MAP_VERSION===undefined?xorse.maphat.GMAP2:xorse.maphat.GMAP3);xorse.maphat.api_convert=function(a){a=a[xorse.maphat.MAP_VERSION];if(a!==undefined)return a()};
xorse.maphat.google={Map:function(a,i){return xorse.maphat.api_convert({"2":function(){var d=new google.maps.Map2(a);d.setUIToDefault();d.disableScrollWheelZoom();d.setCenter(i.center,i.zoom);return d},"3":function(){return new google.maps.Map(a,i)}})},Event:function(a,i,d){return xorse.maphat.api_convert({"2":function(){return google.maps.Event.addListener(a,i,d)},"3":function(){return google.maps.event.addListener(a,i,d)}})},DOMEvent:function(a,i,d,c){return xorse.maphat.api_convert({"2":function(){return google.maps.Event.addDomListener(a,
i,d,c)},"3":function(){return google.maps.event.addDomListener(a,i,d,c)}})},Size:function(a,i){return xorse.maphat.api_convert({"2":function(){return new google.maps.Size(a,i)},"3":function(){return new google.maps.Size(a,i)}})},LatLng:function(a,i,d){d=d||false;return xorse.maphat.api_convert({"2":function(){return new google.maps.LatLng(a,i,d)},"3":function(){return new google.maps.LatLng(a,i,d)}})},Overlay:function(){return xorse.maphat.api_convert({"2":function(){return new google.maps.Overlay},
"3":function(){return new google.maps.OverlayView}})},RoadMap:function(){return xorse.maphat.api_convert({"2":function(){return G_NORMAL_MAP},"3":function(){return google.maps.MapTypeId.ROADMAP}})}};window["xorse.maphat.google"]=xorse.maphat.google;window["xorse.maphat.google.Overlay"]=xorse.maphat.google.Overlay;xorse.PARSING="xorse.maphat.Overlay";xorse.maphat=xorse.maphat===undefined?{}:xorse.maphat;xorse.require("xorse.Module");xorse.require("google.maps");xorse.maphat.panes=xorse.maphat.panes===undefined?null:xorse.maphat.panes;
xorse.maphat.Overlay=function(a,i){var d=this,c=d._=d.pri={},f=d.$=d.pro={};f.latlng=a.latlng;var g=xorse.maphat.api_convert;c.initialize_dom_nodes=function(){c.div_display=a.display_node||document.createElement("div");c.div_shadow=a.shadow_node||document.createElement("div");c.div_content=a.content_node||document.createElement("div");if(!a.display_node)c.div_display.style.position="absolute";if(!a.div_shadow)c.div_display.style.position="absolute";if(!a.content_node)c.div_content=c.div_display.appendChild(c.div_content);
c.div_display.className=a.display_class_name||"";c.div_content.className=a.content_class_name||"";c.div_shadow.className=a.shadow_class_name||"";c.is_visible=false};c.initialize_binds=function(){};c.move_to=function(b,h){var j=b,k=h;h=h;b=b;if(a.offset){j-=a.offset.display_top||0;k+=a.offset.display_left||0;h+=a.offset.shadow_left||0;b-=a.offset.shadow_top||0}k+="px";h+="px";j+="px";b+="px";c.div_display.style.top=j;c.div_display.style.left=k;c.div_shadow.style.top=b;c.div_shadow.style.left=h;xorse.send_signal(i+
"_moved",f.latlng)};d.show=function(){c.div_display.style.display="block";c.div_shadow.style.display="block";c.is_visible=true;xorse.send_signal(i+"_visible")};d.shown=function(){return c.is_visible};d.hide=function(){c.div_display.style.display="none";c.div_shadow.style.display="none";c.div_shadow.style.display="none";c.is_visible=false;xorse.send_signal(i+"_hidden")};d.hidden=function(){return!c.is_visible};d.toggle=function(){c.is_visible?d.hide():d.show()};g({"2":function(){d.remove=function(){f.marker_cfg.panes.overlayFloat.removeChild(c.div_display);
f.marker_cfg.panes.overlayFloatShadow.removeChild(c.div_shadow)}},"3":function(){d.onRemove=function(){}}});g({"2":function(){d.add=function(){if(c.created)d.redraw(true);else{if(xorse.maphat.panes===null)xorse.maphat.panes={overlayImage:a.map.getPane(G_MAP_MARKER_PANE),overlayMouseTarget:a.map.getPane(G_MAP_MARKER_MOUSE_TARGET_PANE),overlayShadow:a.map.getPane(G_MAP_MARKER_SHADOW_PANE),overlayFloat:a.map.getPane(G_MAP_FLOAT_PANE),overlayFloatShadow:a.map.getPane(G_MAP_FLOAT_SHADOW_PANE)};a.panes=
xorse.maphat.panes;c.div_display=a.panes.overlayFloat.appendChild(c.div_display);c.div_shadow=a.panes.overlayFloatShadow.appendChild(c.div_shadow);d.bind_dom(c.div_display,"mousedown",xorse.stop_event);d.bind_dom(c.div_display,"dblclick",xorse.stop_event);d.bind_dom(c.div_display,"singlerightclick",xorse.stop_event);d.bind_dom(c.div_display,"DOMMouseScroll",xorse.stop_event);a.map.addOverlay(d);c.is_visible=true;c.created=true;xorse.send_signal(i+"_created")}}},"3":function(){d.onAdd=function(){if(xorse.maphat.panes===
null)xorse.maphat.panes=d.getPanes();a.panes=xorse.maphat.panes;a.panes.overlayFloat.appendChild(c.div_display);a.panes.overlayShadow.appendChild(c.div_shadow);c.is_visible=true;c.created=true;xorse.send_signal(i+"_created")}}});g({"2":function(){d.redraw=function(b){if(!b)return d;b=a.map.fromLatLngToDivPixel(f.latlng);c.move_to(b.y,b.x);return d}},"3":function(){d.draw=function(){var b=d.getProjection().fromLatLngToDivPixel(f.latlng);c.move_to(b.y,b.x);return d}}});g({"2":function(){d.initialize=
function(){c.initialize_binds()}}});d.bind=function(b,h,j){return xorse.maphat.google.Event(b,h,j)};d.bind_dom=function(b,h,j,k){return xorse.maphat.google.DOMEvent(b,h,j,k)};d.html=function(b,h){c.div_content.innerHTML=b;h||xorse.send_signal(i+"_html",b);return d};d.focus=function(){var b=c.div_display.offsetWidth,h=c.div_display.offsetHeight,j=a.map.fromLatLngToContainerPixel(f.latlng),k=a.map.getSize();h=j.y-h;b=j.x-k.width+b;h=h<0?-(h-40):0;b=b>0?-(b+40):0;a.map.panBy(xorse.maphat.google.Size(b,
h))};c.constructor=function(){c.initialize_dom_nodes();g({"2":function(){d.add()},"3":function(){d.setMap(a.map)}})};c.constructor()};xorse.maphat.Overlay.prototype=window["xorse.maphat.google.Overlay"]();window["xorse.maphat.Overlay"]=xorse.maphat.Overlay;xorse.PARSING="xorse.maphat.Infowindow";xorse.maphat=xorse.maphat===undefined?{}:xorse.maphat;xorse.require("xorse.Module");xorse.require("google.maps");xorse.maphat.panes=xorse.maphat.panes===undefined?null:xorse.maphat.panes;
xorse.maphat.Infowindow=function(a,i){var d=this,c=d._=d.pri={},f=d.$=d.pro={};f.latlng=a.latlng;var g=xorse.maphat.api_convert;c.initialize_dom_nodes=function(){c.div_display=a.infowindow.template.node;c.div_shadow=a.infowindow.shadow.node;c.div_display.className=a.infowindow.template.class_name;c.div_content=a.infowindow.content.node;c.div_content.className=a.infowindow.content.class_name;c.div_shadow.className=a.infowindow.shadow.class_name;c.is_visible=false};c.initialize_binds=function(){a.infowindow.close&&
d.bind_dom(a.infowindow.close,"click",function(){xorse.send_signal("infowindow_hidden",false);d.hide()});a.infowindow.maximize&&d.bind_dom(a.infowindow.maximize,"click",d.maximize)};c.move_to=function(b,h){var j=h+"px",k=h+c.div_shadow.style.width+"px",l=-1*(b-c.div_shadow.style.height)+"px";h=h+c.div_loading_shadow.style.width+"px";var m=-1*(b-c.div_loading_shadow.style.height)+"px";c.div_display.style.bottom=-1*(b-c.div_display.style.height)+"px";c.div_display.style.left=j;c.div_shadow.style.bottom=
l;c.div_shadow.style.left=k;c.div_loading_shadow.style.bottom=m;c.div_loading_shadow.style.left=h;xorse.send_signal(i+"_moved",f.latlng)};d.loading=function(){xorse.send_signal(i+"_loading");d.html(c.loading_text,false,true);c.is_loading=true;return d};d.show=function(){c.div_display.style.display="block";if(c.is_loading){c.div_shadow.style.display="none";c.div_loading_shadow.style.display="block"}else{c.div_shadow.style.display="block";c.div_loading_shadow.style.display="none"}c.is_visible=true;
xorse.send_signal(i+"_visible")};d.shown=function(){return c.is_visible};d.hide=function(){c.div_display.style.display="none";c.div_shadow.style.display="none";c.div_loading_shadow.style.display="none";c.div_shadow.style.display="none";c.is_visible=false;xorse.send_signal(i+"_hidden")};d.hidden=function(){return!c.is_visible};d.toggle=function(){c.is_visible?d.hide():d.show()};g({"2":function(){d.remove=function(){f.marker_cfg.panes.overlayFloat.removeChild(c.div_display);f.marker_cfg.panes.overlayFloatShadow.removeChild(c.div_shadow)}},
"3":function(){d.onRemove=function(){}}});g({"2":function(){d.add=function(){if(c.created)d.redraw(true);else{if(xorse.maphat.panes===null)xorse.maphat.panes={overlayImage:a.map.getPane(G_MAP_MARKER_PANE),overlayMouseTarget:a.map.getPane(G_MAP_MARKER_MOUSE_TARGET_PANE),overlayShadow:a.map.getPane(G_MAP_MARKER_SHADOW_PANE),overlayFloat:a.map.getPane(G_MAP_FLOAT_PANE),overlayFloatShadow:a.map.getPane(G_MAP_FLOAT_SHADOW_PANE)};var b=a.infowindow.loading||false,h=c.div_shadow.cloneNode(false);if(b){c.loading_text=
b.content||"Loading...";h=b.shadow||h;h.className=b.class_name}a.panes=xorse.maphat.panes;c.div_display=a.panes.overlayFloat.appendChild(c.div_display);if(a.infowindow.shadow_same_pane){c.div_shadow=a.panes.overlayFloat.appendChild(c.div_shadow);c.div_loading_shadow=a.panes.overlayFloat.appendChild(h)}else{c.div_shadow=a.panes.overlayFloatShadow.appendChild(c.div_shadow);c.div_loading_shadow=a.panes.overlayFloatShadow.appendChild(h)}d.bind_dom(c.div_display,"mousedown",xorse.stop_event);d.bind_dom(c.div_display,
"dblclick",xorse.stop_event);d.bind_dom(c.div_display,"singlerightclick",xorse.stop_event);d.bind_dom(c.div_display,"DOMMouseScroll",xorse.stop_event);a.map.addOverlay(d);c.is_visible=true;c.created=true;xorse.send_signal(i+"_created")}}},"3":function(){d.onAdd=function(){if(xorse.maphat.panes===null)xorse.maphat.panes=d.getPanes();a.panes=xorse.maphat.panes;a.panes.overlayFloat.appendChild(c.div_display);a.panes.overlayShadow.appendChild(c.div_shadow);c.is_visible=true;c.created=true;xorse.send_signal(i+
"_created")}}});g({"2":function(){d.redraw=function(b){if(!b)return d;b=a.map.fromLatLngToDivPixel(f.latlng);c.move_to(b.y,b.x);return d}},"3":function(){d.draw=function(){var b=d.getProjection().fromLatLngToDivPixel(f.latlng);c.move_to(b.y,b.x);return d}}});g({"2":function(){d.initialize=function(){c.initialize_binds()}}});d.bind=function(b,h,j){return xorse.maphat.google.Event(b,h,j)};d.bind_dom=function(b,h,j,k){return xorse.maphat.google.DOMEvent(b,h,j,k)};d.html=function(b,h,j){if(c.is_loading&&
d.shown()){c.div_shadow.style.display="block";c.div_loading_shadow.style.display="none"}c.is_loading=false;c.div_content.innerHTML=b;h||xorse.send_signal(i+"_html",b);j||d.focus();return d};d.focus=function(){var b=c.div_display.offsetWidth,h=c.div_display.offsetHeight,j=a.map.fromLatLngToContainerPixel(f.latlng),k=a.map.getSize();h=j.y-h;b=j.x-k.width+b;h=h<0?-(h-40):0;b=b>0?-(b+40):0;if(h===0)h=j.y>k.height?k.height-(j.y+40):0;if(b===0)b=j.x<0?-(j.x-80):b;Math.abs(h)>k.height+800||Math.abs(b)>k.width+
800?a.map.panTo(f.latlng):a.map.panBy(xorse.maphat.google.Size(b,h))};c.constructor=function(){c.initialize_dom_nodes();g({"2":function(){d.add()},"3":function(){d.setMap(a.map)}})};c.constructor()};xorse.maphat.Infowindow.prototype=xorse.maphat.google.Overlay();window["xorse.maphat.Infowindow"]=xorse.maphat.Infowindow;xorse.PARSING="xorse.maphat.CenterMarker";xorse.maphat=xorse.maphat===undefined?{}:xorse.maphat;xorse.require("xorse.Module");xorse.require("google.maps");
xorse.maphat.CenterMarker=function(a,i,d){var c=this,f=c.pub,g=c.pri;g.config=xorse.extend({},{settings:{icon:G_DEFAULT_ICON,dragCrossMove:false,title:"Drag Me!",clickable:false,draggable:true,bouncy:true,bounceGravity:0.5,autoPan:true,zIndexProcess:function(){return 1},hide:false,click:false},event_overrides:{click:false,dblclick:false,mouseup:false,mousedown:false,mouseover:false,mouseout:false,dragstart:false,dragend:false,drag:false}},d);g.settings=g.config.settings;g.overrides=g.config.event_overrides;
g.marker=new google.maps.Marker(i,g.settings);g.initialize_binds=function(){f.bind_dom(g.marker,"click",function(b){xorse.send_signal("center_marker_click",{marker:g.marker,event:b})});f.bind_dom(g.marker,"dblclick",function(b){xorse.send_signal("center_marker_dblclick",{marker:g.marker,event:b})});f.bind_dom(g.marker,"mouseup",function(b){xorse.send_signal("center_marker_mouseup",{marker:g.marker,event:b})});f.bind_dom(g.marker,"mousedown",function(b){xorse.send_signal("center_marker_mousedown",
{marker:g.marker,event:b})});f.bind_dom(g.marker,"mouseover",function(b){xorse.send_signal("center_marker_mouseover",{marker:g.marker,event:b})});f.bind_dom(g.marker,"mouseout",function(b){xorse.send_signal("center_marker_mouseout",{marker:g.marker,event:b})});f.bind_dom(g.marker,"dragstart",function(b){xorse.send_signal("center_marker_dragstart",{marker:g.marker,event:b})});f.bind(g.marker,"dragend",function(b){xorse.send_signal("center_marker_dragend",{marker:g.marker,event:b})});f.bind_dom(g.marker,
"drag",function(b){xorse.send_signal("center_marker_drag",{marker:g.marker,event:b})})};g.initialize_signals=function(){var b=Math.random();xorse.signal("new_search","center_marker-"+b,function(h){g.marker.setLatLng(h)})};f.constructor=function(){g.initialize_binds();g.initialize_signals()};f.constructor();a.pro.map.addOverlay(g.marker)};xorse.maphat.CenterMarker.prototype=new xorse.Module("xorse.maphat.CenterMarker");window["xorse.maphat.CenterMarker"]=xorse.maphat.CenterMarker;xorse.PARSING="xorse.maphat.MarkerBase";xorse.maphat=xorse.maphat===undefined?{}:xorse.maphat;xorse.require("xorse.Module");xorse.require("google.maps");xorse.maphat.panes=xorse.maphat.panes===undefined?null:xorse.maphat.panes;
xorse.maphat.BaseMarker=function(a,i){var d=xorse.subclasses(xorse.maphat.google.Overlay,this),c=this,f=c.pub=c,g=c._=c.pri={},b=c.$=c.pro={};c.SuperOverlay=d;b.marker_cfg=xorse.extend({},{},a);b.manager_instance=i;a=xorse.maphat.api_convert;g.created=false;g.no_hide=false;g.cached=null;g.initially_hidden=false;g.id=null;g.ready=false;g.initialize_dom_nodes=function(){g.div_display=document.createElement("div");g.div_target=document.createElement("div");g.div_shadow=document.createElement("div");
g.div_display.className=b.marker_cfg.icon_display;g.div_target.className=b.marker_cfg.icon_target;g.div_shadow.className=b.marker_cfg.icon_shadow;g.is_visible=false};g.move_to=function(h,j){var k=j+"px";j=j+"px";var l=h-5+"px";g.div_target.style.top=g.div_display.style.top=h+"px";g.div_target.style.left=g.div_display.style.left=k;g.div_shadow.style.top=l;g.div_shadow.style.left=j};f.show=function(){g.div_display.style.display="block";g.div_target.style.display="block";g.div_shadow.style.display="block";
g.is_visible=true;return c};f.shown=function(){return g.is_visible};f.hide=function(){if(g.no_hide)return c;g.div_display.style.display="none";g.div_target.style.display="none";g.div_shadow.style.display="none";g.is_visible=false;return c};f.hidden=function(){return!g.is_visible};f.toggle=function(){g.is_visible?f.hide():f.show()};a({"2":function(){f.remove=function(){b.marker_cfg.panes.overlayImage.removeChild(g.div_display);b.marker_cfg.panes.overlayMouseTarget.removeChild(g.div_target);b.marker_cfg.panes.overlayShadow.removeChild(g.div_shadow)}},
"3":function(){f.onRemove=function(){}}});a({"2":function(){f.add=function(){if(g.created)f.redraw(true);else{if(xorse.maphat.panes===null)xorse.maphat.panes={overlayImage:b.marker_cfg.map.getPane(G_MAP_MARKER_PANE),overlayMouseTarget:b.marker_cfg.map.getPane(G_MAP_MARKER_MOUSE_TARGET_PANE),overlayShadow:b.marker_cfg.map.getPane(G_MAP_MARKER_SHADOW_PANE),overlayLayer:b.marker_cfg.map.getPane(G_MAP_OVERLAY_PANE)};b.marker_cfg.panes=xorse.maphat.panes;i.fragment.image.appendChild(g.div_display);i.fragment.shadow.appendChild(g.div_shadow);
i.fragment.target.appendChild(g.div_target);if(g.initially_hidden){g.div_display.style.display="none";g.div_target.style.display="none";g.div_shadow.style.display="none"}b.marker_cfg.map.addOverlay(c);g.created=true;g.ready=true;if(!g.initially_hidden)g.is_visible=true}}},"3":function(){f.onAdd=function(){if(xorse.maphat.panes===null)xorse.maphat.panes=f.getPanes();b.marker_cfg.panes=xorse.maphat.panes;b.marker_cfg.panes.overlayImage.appendChild(g.div_display);b.marker_cfg.panes.overlayShadow.appendChild(g.div_shadow);
b.marker_cfg.panes.overlayMouseTarget.appendChild(g.div_target);g.is_visible=true;g.created=true}}});a({"2":function(){f.redraw=function(h){if(h){h=b.marker_cfg.map.fromLatLngToDivPixel(b.marker_cfg.latlng);g.move_to(h.y,h.x)}}},"3":function(){f.draw=function(){var h=f.getProjection().fromLatLngToDivPixel(b.marker_cfg.latlng);g.move_to(h.y,h.x)}}});g.initialize=null;a({"2":function(){f.initialize=function(){g.initialize!==null&&g.initialize()}}});return this};xorse.maphat.BaseMarker.prototype=new xorse.Module("xorse.maphat.BaseMarker");
xorse.maphat.BaseMarker.prototype.constructor=function(a){var i=xorse.maphat.api_convert,d=this.pri,c=this.pub,f=this.pro;d.initialize_dom_nodes();d.initially_hidden=a||false;d.id=f.marker_cfg.id;i({"2":function(){c.add()},"3":function(){c.setMap(f.marker_cfg.map)}})};window["xorse.maphat.BaseMarker"]=xorse.maphat.BaseMarker;xorse.PARSING="xorse.maphat.Marker";xorse.maphat=xorse.maphat===undefined?{}:xorse.maphat;xorse.require("xorse.Module");xorse.require("xorse.maphat.BaseMarker");xorse.require("google.maps");xorse.maphat.panes=xorse.maphat.panes===undefined?null:xorse.maphat.panes;
xorse.maphat.Marker=function(a,i,d){var c=xorse.subclasses(xorse.maphat.BaseMarker,this,a,i),f=this,g=f.pub,b=f.pri;f.SuperBaseMarker=c;b.initialize_click_handler=function(){g.bind_dom(b.div_target,"click",function(h){var j=a.latlng,k=a.id,l=i.infowindow,m=i.maphat.pro.infowindow_picons;xorse.send_signal("marker_click",{config:a,event:h,id:k,infowindow:l,instance:f,latlng:j,url_schema:d,click:b.click});if(!a.overrides.click)if(!b.click){g.trigger(f,"hide_tooltip");b.no_hide=true;b.click=true;xorse.send_signal("infowindow_hidden",
true);xorse.signal("infowindow_hidden","marker-"+k,function(){b.no_hide=false;b.click=false;m.hide();g.trigger(f,"hide_directions");xorse.delete_signal("infowindow_hidden","marker-"+k)});xorse.signal("marker_"+k+"_clear_cache","marker-"+k,function(){b.cached=null});l.pro.latlng=j;l.redraw(true).loading().show();m.pro.latlng=j;m.redraw(true).hide();if(b.cached===null)xorse.ajax.get_json(d.property_data(k),{},{"200":function(n){b.cached=n;m.html(n.picons).show();l.html(n.template);xorse.send_signal("marker_data_loaded",
l.pri.div_content);xorse.send_signal("marker_"+k+"_viewed")},xxx:function(n,r){xorse.send_signal("marker_data_fail",r);l.html("Failed to load Property #"+k)}});else{l.html(b.cached.template);m.html(b.cached.picons).show();xorse.send_signal("marker_data_loaded",l.pri.div_content)}}})};b.initialize_directions_handler=function(){b.directions_blocking=false;b.directions_center=null;b.directions_cached=false;b.directions_visible=false;g.directions=null;g.bind(f,"directions",function(){if(!b.directions_blocking)if(b.directions_cached&&
!b.directions_visible){g.directions.show();b.directions_visible=true}else if(!b.directions_cached){b.directions_blocking=true;b.directions=null;b.directions_center=i.maphat.pro.center_marker.pri.marker.getLatLng();var h=d.directions_polyline(b.id)+"?";h+="to="+b.directions_center.lat()+","+b.directions_center.lng();xorse.ajax.get_json(h,{},{"6xx":function(){g.directions=false;g.trigger(b.div_target,"mouseover")},"2xx":function(j){if(j.points){g.directions=google.maps.Polyline.fromEncoded({color:a.directions_cfg.color,
weight:a.directions_cfg.weight,points:j.points,levels:j.levels,zoomFactor:j.zoomFactor,numLevels:j.numLevels});b.directions_cached=true;g.directions.distance=j.distance;g.directions.hide();i.maphat.pro.map.addOverlay(g.directions);xorse.signal("hide_directions","marker-"+b.id,function(){if(!b.click)if(g.directions&&b.directions_visible&&g.directions.supportsHide()){g.directions.hide();b.directions_visible=false}else if(g.directions&&b.directions_visible&&!g.directions.supportsHide()){i.maphat.pro.map.removeOverlay(g.directions);
b.directions_visible=false}});xorse.signal("center_marker_dragend","marker-"+b.id,function(){i.maphat.pro.map.removeOverlay(g.directions);g.directions=null;b.directions_cached=false;b.directions_visible=false;xorse.delete_signal("center_marker_dragend","marker-"+b.id);b.click&&g.trigger(b.div_target,"mouseover")});b.directions_blocking=false;b.mouseover&&g.trigger(b.div_target,"mouseover")}b.directions_blocking=false}})}});g.bind(f,"hide_directions",function(){b.click||xorse.send_signal("hide_directions",
g.directions)})};b.initialize_tooltip_handler=function(){g.bind(f,"tooltip",function(){if(!(b.click||b.disable_tooltip)){var h=a.latlng,j=i.tooltip,k=null;if(a.overrides.tooltip)k=a.overrides.tooltip(f,a);else if(a.overrides.tooltip===false){b.disable_tooltip=true;return}else k="<div><h1>Property #"+a.id+"</h1><p>Click property icon to view</p></div>";j.pro.latlng=h;j.redraw(true).html(k,true,true).show()}});g.bind(f,"hide_tooltip",function(){b.click||b.disable_tooltip||i.tooltip.hide()})};b.initialize_mouseover_handler=
function(){g.bind(f,"bulge",function(){b.div_display.style.zIndex=10});g.bind(f,"flaccid",function(){b.div_display.style.zIndex=b.div_display_z_index});g.bind_dom(b.div_target,"mouseover",function(){b.mouseover=true;g.trigger(f,"directions");g.trigger(f,"tooltip")});g.bind_dom(b.div_target,"mouseover_bulge",function(){g.trigger(f,"bulge")})};b.initialize_mouseout_handler=function(){g.bind_dom(b.div_target,"mouseout",function(){b.mouseover=false;g.trigger(f,"hide_directions");g.trigger(f,"hide_tooltip");
g.trigger(f,"flaccid")})};b.initialize_binds=function(){b.initialize_directions_handler();b.initialize_tooltip_handler();b.initialize_click_handler();b.initialize_mouseover_handler();b.initialize_mouseout_handler()};b.initialize=function(){b.initialize_binds();a.is_favorite&&xorse.send_signal("marker_"+b.id+"_favorite");a.is_recently_viewed&&xorse.send_signal("marker_"+b.id+"_viewed");b.div_display_z_index=b.div_display.style.zIndex};g.ghost=function(){g.hide();b.div_display.style.opacity="0.75";
b.div_display.style.display="block"};g.unghost=function(){b.div_display.style.opacity="1.0";g.hide()};xorse.signal("marker_"+a.id+"_click","marker-"+a.id,function(){b.ready&&g.trigger(b.div_target,"click")});xorse.signal("marker_"+a.id+"_mouseover","marker-"+a.id,function(){b.ready&&g.trigger(b.div_target,"mouseover")});xorse.signal("marker_"+a.id+"_mouseover_bulge","marker-"+a.id,function(){b.ready&&g.trigger(b.div_target,"mouseover_bulge")});xorse.signal("marker_"+a.id+"_mouseout","marker-"+a.id,
function(){b.ready&&g.trigger(b.div_target,"mouseout")});xorse.signal("marker_"+a.id+"_classname","marker-"+a.id,function(h){b.div_display.className=h.display||b.div_display.className;b.div_shadow.className=h.shadow||b.div_shadow.className});if(i.maphat.pro.maphat_cfg.enable_favorites){xorse.signal("marker_"+a.id+"_favorite_viewed","marker-"+a.id,function(){b.div_display.className=a.icon_favorite_viewed;b.div_shadow.className=a.icon_favorite_viewed_shadow;b.div_target.className=a.icon_favorite_viewed_target});
xorse.signal("marker_"+a.id+"_favorite","marker-"+a.id,function(h){a.is_favorite=true;if(a.is_recently_viewed)xorse.send_signal("marker_"+a.id+"_favorite_viewed",h);else{b.div_display.className=a.icon_favorite;b.div_shadow.className=a.icon_favorite_shadow;b.div_target.className=a.icon_favorite_target}});xorse.signal("marker_"+a.id+"_unfavorite","marker-"+a.id,function(h){a.is_favorite=false;if(a.is_recently_viewed)xorse.send_signal("marker_"+a.id+"_viewed",h);else{b.div_display.className=a.icon_display;
b.div_shadow.className=a.icon_shadow;b.div_target.className=a.icon_target}})}if(i.maphat.pro.maphat_cfg.enable_recently_viewed){xorse.signal("marker_"+a.id+"_viewed","marker-"+a.id,function(h){a.is_recently_viewed=true;if(a.is_favorite)xorse.send_signal("marker_"+b.id+"_favorite_viewed",h);else{b.div_display.className=a.icon_viewed;b.div_shadow.className=a.icon_viewed_shadow;b.div_target.className=a.icon_viewed_target}});xorse.signal("marker_"+a.id+"_new","marker-"+a.id,function(h){a.is_recently_viewed=
false;if(a.is_favorite)xorse.send_signal("marker_"+a.id+"_favorite",h);else{b.div_display.className=a.icon_display;b.div_shadow.className=a.icon_shadow;b.div_target.className=a.icon_target}})}a.no_create||c.constructor.call(this)};xorse.maphat.Marker.prototype=new xorse.Module("xorse.maphat.Marker");xorse.maphat.MarkerSkeleton=function(){var a=this;a.show=function(){};a.hide=function(){}};xorse.maphat.MarkerSkeleton.prototype=new xorse.Module("xorse.maphat.MarkerSkeleton");
window["xorse.maphat.Marker"]=xorse.maphat.Marker;window["xorse.maphat.MarkerSkeleton"]=xorse.maphat.MarkerSkeleton;xorse.PARSING="xorse.maphat.ClusterMarker";xorse.maphat=xorse.maphat===undefined?{}:xorse.maphat;xorse.require("xorse.Module");xorse.require("google.maps");xorse.require("xorse.maphat.BaseMarker");xorse.maphat.panes=xorse.maphat.panes===undefined?null:xorse.maphat.panes;
xorse.maphat.ClusterMarker=function(a,i,d){var c=xorse.subclasses(xorse.maphat.BaseMarker,this,a,i),f=this,g=f.pub,b=f.pri,h=f.pro;f.SuperBaseMarker=c;h.children=[];b.initialize_click_handler=function(){g.bind_dom(b.div_target,"click",function(j){var k=a.id,l=i.infowindow,m=a.latlng;xorse.send_signal("cluster_marker_click",{children:h.children,children_length:h.children.length,config:a,event:j,id:k,infowindow:l,instance:f,latlng:m,url_schema:d});if(!a.overrides.click){b.no_hide=true;xorse.send_signal("infowindow_hidden");
xorse.signal("infowindow_hidden","cluster-marker-"+k,function(){b.no_hide=false;xorse.delete_signal("infowindow_hidden","marker-"+k)});l.pro.latlng=m;l.redraw(true).loading().show();if(b.cached===null)xorse.ajax.get(d.cluster_children_data(a.id),{},{"200":function(n){b.cached=n;l.html(n);xorse.send_signal("cluster_marker_data_loaded",l.pri.div_content)},xxx:function(n,r){xorse.send_signal("cluster_marker_data_fail",r);l.html("Failed to load Property #"+k)}});else{l.html(b.cached);xorse.send_signal("cluster_marker_data_loaded",
l.pri.div_content)}}})};b.initialize_hover_handler=function(){g.bind_dom(b.div_target,"mouseover",function(j){var k=h.children.length,l=h.children;xorse.send_signal("cluster_marker_mouseover",{children:l,children_length:k,config:a,event:j,id:a.id,infowindow:i.infowindow,instance:f,latlng:a.latlng,url_schema:d});if(!a.overrides.mouseover){b.div_display.style.display="none";b.div_shadow.style.display="none";for(j=0;j<k;j++)l[j].ghost()}});g.bind_dom(b.div_target,"mouseout",function(j){var k=h.children.length,
l=h.children;xorse.send_signal("cluster_marker_mouseout",{children:l,children_length:k,config:a,event:j,id:a.id,infowindow:i.infowindow,instance:f,latlng:a.latlng,url_schema:d});if(!a.overrides.mouseout){g.show();for(j=0;j<k;j++)l[j].unghost()}})};b.initialize_binds=function(){b.initialize_click_handler();b.initialize_hover_handler()};b.initialize=function(){b.initialize_binds()};c.constructor.call(this);g.constructor()};xorse.maphat.ClusterMarker.prototype=new xorse.Module("xorse.maphat.ClusterMarker");
xorse.maphat.ClusterMarker.prototype.constructor=function(){for(var a=this.pro,i=this.SuperBaseMarker,d=this.pri,c=a.marker_cfg.children,f=a.manager_instance,g=c.length,b=0;b<g;b++){var h=c[b],j=null;h.latlng=xorse.maphat.google.LatLng(h.point[0],h.point[1]);h.icon=h.listing;j=f.pro.add_marker_simple(c[b]);i.constructor.call(j,true);a.children.push(j)}d.div_display.innerHTML="<div>"+g+"</div>"};xorse.maphat.ClusterSkeleton=function(){var a=this;a.show=function(){};a.hide=function(){}};
xorse.maphat.MarkerSkeleton.prototype=new xorse.Module("xorse.maphat.ClusterSkeleton");window["xorse.maphat.CLusterMarker"]=xorse.maphat.ClusterMarker;window["xorse.maphat.ClusterSkeleton"]=xorse.maphat.ClusterSkeleton;xorse.PARSING="xorse.maphat.MarkerManager";xorse.maphat=xorse.maphat===undefined?{}:xorse.maphat;xorse.require("xorse.Module");xorse.require("xorse.maphat.BaseMarker");xorse.require("xorse.maphat.Marker");xorse.require("xorse.maphat.ClusterMarker");xorse.require("google.maps");
xorse.maphat.MarkerManager=function(a,i,d,c){var f=this,g=f.pri,b=f.pro;f.fragment={image:document.createDocumentFragment(),shadow:document.createDocumentFragment(),target:document.createDocumentFragment()};f.clear_fragments=function(){f.fragment={image:document.createDocumentFragment(),shadow:document.createDocumentFragment(),target:document.createDocumentFragment()}};f.append_fragments=function(){xorse.maphat.panes.overlayImage.appendChild(f.fragment.image);xorse.maphat.panes.overlayShadow.appendChild(f.fragment.shadow);
xorse.maphat.panes.overlayMouseTarget.appendChild(f.fragment.target);f.clear_fragments()};g.id=0;g.icon_set={};g.overrides={marker:{},cluster_marker:{},directions:{},tooltip:false};f.favorites={};f.recently_viewed={};g.url_schema=a.pro.maphat_cfg.url_schema;g.empty_marker=new xorse.maphat.MarkerSkeleton;b.map_panes=null;f.markers={};g.markers_list=[];f.maphat=a;g.constructor=function(){f.infowindow=i;f.tooltip=d;var h=f.maphat.pro.maphat_cfg;if(h.overrides){g.overrides.marker=h.overrides.marker||
{};g.overrides.cluster_marker=h.overrides.cluster_marker||{};g.overrides.directions=h.overrides.directions||{};g.overrides.tooltip=h.overrides.tooltip||false}xorse.signal("marker_click","marker_manager",function(j){j.click||f.maphat.refinement_manager.set_property(j.id,true)})};g.constructor();f.get_marker=function(h){if(f.markers[h])return f.markers[h];else if(xorse.maphat.DEBUG)throw new Error("Failed to retrieve marker #"+h);else return g.empty_marker};f.hide=function(h){f.get_marker(h).hide()};
f.show=function(h){f.get_marker(h).show()};f.new_set=function(){for(var h=g.markers_list,j=h.length,k=0;k<j;k++)h[k].hide()};f.shown=function(){var h=0;for(var j in f.markers)f.markers[j].shown()&&h++;return h};f.hidden=function(){var h=0;for(var j in f.markers)f.markers[j].hidden()&&h++;return h};b.add_marker_simple=function(h){h=xorse.extend({},{},h);h.no_create=true;return f.add_marker(h)};f.add_marker=function(h){if(h.id&&f.markers[h.id]!==undefined)return f.markers[h.id].show();var j={latlng:f.maphat.pro.maphat_cfg.center,
map:f.maphat.pro.map,panes:b.map_panes,icon:f.maphat.pro.maphat_cfg.default_icon};j.directions_cfg={color:"#FF0000",weight:5};xorse.extend(j.directions_cfg,g.overrides.directions);j.latlng=h.latlng===undefined?j.latlng:h.latlng;j.map=h.map===undefined?j.map:h.map;j.icon=h.icon===undefined?j.icon:h.icon;j.id=h.id;j.overrides=g.overrides.marker;j.no_create=h.no_create||false;j.json=h;var k=xorse.maphat.Marker,l=false;if(c&&h.children&&h.children.length>1){l=true;k=xorse.maphat.ClusterMarker;j.overrides=
g.overrides.cluster_marker;if(h.children===undefined)throw new Error(xorse.maphat.errors.marker.not_a_cluster);else j.children=h.children}var m=h.icon;if(l)m="cluster";if(g.icon_set[m]===undefined)g.icon_set[m]={icon_display:m+"-display",icon_shadow:m+"-shadow",icon_target:m+"-target",icon_viewed:m+"-viewed",icon_viewed_shadow:m+"-viewed-shadow",icon_viewed_target:m+"-viewed-target",icon_favorite:m+"-favorite",icon_favorite_shadow:m+"-favorite-shadow",icon_favorite_target:m+"-favorite-target",icon_favorite_viewed:m+
"-favorite-viewed",icon_favorite_viewed_shadow:m+"-favorite-viewed-shadow",icon_favorite_viewed_target:m+"-favorite-viewed-target"};for(var n in g.icon_set[m])j[n]=g.icon_set[m][n];if(j.id===undefined){for(;f.markers[++g.id]!==undefined;);j.id=g.id}l=String(j.id);j.is_favorite=f.favorites[l]?true:false;j.is_recently_viewed=f.recently_viewed[l]?true:false;if(h.no_create)return new k(j,f,g.url_schema);else{h=new k(j,f,g.url_schema);f.markers[j.id]=h;g.markers_list.push(f.markers[j.id])}};f.set_favorites=
function(h){var j=h.length;f.favorites={};for(var k=0;k<j;k++){var l=h[k];xorse.send_signal("marker_"+l.id+"_favorite");f.favorites[l.id]=l}};f.set_recently_viewed=function(h){var j=h.length;f.recently_viewed={};for(var k=0;k<j;k++){var l=h[k];xorse.send_signal("marker_"+l.id+"_viewed");f.recently_viewed[l.id]=l}};f.marker_exists=function(h){return f.markers[h]!==undefined};f.deconstructor=function(){for(marker in f.markers)f.markers[marker].remove();delete g.markers_list;delete f.favorites;delete f.recently_viewed}};
xorse.maphat.MarkerManager.prototype=new xorse.Module("xorse.maphat.MarkerManager");window["xorse.maphat.MarkerManager"]=xorse.maphat.MarkerManager;xorse.PARSING="xorse.maphat.RefinementManager";xorse.maphat=xorse.maphat===undefined?{}:xorse.maphat;xorse.require("xorse.Module");xorse.require("xorse.hash");
xorse.maphat.RefinementManager=function(a,i,d){var c=this,f=c.pri;f.refinements={};c.add=function(g,b){f.refinements[g]=b;c["get_"+g]=function(){d&&d(g);return f.refinements[g]};c["set_"+g]=function(h,j){xorse.hash.write(g,h);f.refinements[g]=h;!j&&i&&i(g,h)}};c.add_hashes=function(){var g=[],b=[];for(key in f.refinements){g.push(key);b.push(f.refinements[key])}xorse.hash.write_all(g,b)};c.get_all=function(){var g={};for(var b in f.refinements)f.refinements[b]===null||f.refinements[b]=="null"||(g[b]=
f.refinements[b]);return g};f.constructor=function(){for(var g in a)c.add(g,a[g])};f.constructor();c.deconstructor=function(){delete f.refinements};xorse.export_methods.call(c,[["add",c.add],["add_hashes",c.add_hashes],["get_all",c.get_all]])};xorse.maphat.RefinementManager.prototype=new xorse.Module("xorse.maphat.RefinementManager");xorse.PARSING="xorse.maphat.MapHat";xorse.maphat=xorse.maphat===undefined?{}:xorse.maphat;xorse.maphat=xorse.maphat;xorse.require("xorse.Module");xorse.require("xorse.ajax");xorse.require("xorse.maphat.CenterMarker");xorse.require("xorse.maphat.MarkerManager");xorse.require("xorse.maphat.RefinementManager");xorse.require("xorse.maphat.google");xorse.require("google.maps");
xorse.maphat.errors={invalid_dom_node:"FATAL! Invalid setup configuration! setup_cfg.dom_node is not a DOM element or DOM node.",invalid_dom_node_infowindow:"FATAL! Invalid setup configuration! setup_cfg.infowindow_node is not a DOM element or DOM node.",missing_setup_cfg:"FATAL! A setup config was not found",missing_dom_node:"FATAL! setup_cfg.dom_node was not found in the config.",missing_infowindow:"FATAL! setup_cfg.infowindow is malformed or non-existent",missing_tooltip_template:"FATAL! The tooltip template has not been loaded.",
missing_infowindow_template:"FATAL! The infowindow template has not been loaded.",no_url_schema:"FATAL! A URL schema was not found in setup_cfg.url_schema.",no_property_object:"FATAL! The JSON returned did not contain a property object.",url_schema:{map_data:"FATAL! Missing a vital URL schema. url_schema.map_data was not found in setup_cfg.",cluster_data:"FATAL! Missing a vital URL schema. url_schema.cluster_data was not found in setup_cfg."},marker:{not_a_cluster:"WARNING! Clustering data did not have children defined in the JSON object."}};
xorse.maphat.DEBUG=xorse.DEBUG;
xorse.maphat.MapHat=function(a,i){var d=this,c=d.pri,f=d.pro,g=xorse.maphat.api_convert;d.marker_manager=null;d.refinement_manager=null;d.disable_unnecessary_updates=false;d.listview_update=false;f.clustering=false;f.property_length=0;f.queue=[];c.data_url=null;c.listview_url=null;f.center_marker=null;c.listview_data={};c.listview_data_old={};c.initialize_google_maps=function(b){var h={zoom:8,mapTypeId:xorse.maphat.google.RoadMap(),center:xorse.maphat.google.LatLng(-34,150),default_icon:"default"};
xorse.extend(h,a);c.data_url=h.url_schema.map_data();c.listview_url=h.url_schema.listview();if(a.clustering&&a.clustering.enable===true){f.clustering=true;c.data_url=h.url_schema.cluster_data()}f.maphat_cfg=h;var j=d.refinement_manager.get_search();if(!j){j=d.refinement_manager.get_property();if(j=="null")j=null}if(j){var k=d.refinement_manager.get_property();return d.request_latlng(j,function(l,m,n){h.center=xorse.maphat.google.LatLng(l,m);f.map=xorse.maphat.google.Map(h.dom_node,h);if(!n&&k)n=k;
n&&d.refinement_manager.set_property(n,true);(function(){b();d.refresh()})()},"location")}else{f.map=xorse.maphat.google.Map(h.dom_node,h);return function(){b();d.refresh()}()}};c.initialize_refinement_manager=function(){d.refinement_manager=new xorse.maphat.RefinementManager(a.refinements,function(){if(f.map){xorse.send_signal("refinement_update");d.refresh()}},function(){});d.refinement_manager.add_hashes()};c.initialize_sanity_tests=function(){var b=false;try{if(!a)throw new Error(xorse.maphat.errors.missing_setup_cfg);
if(!a.dom_node)throw new Error(xorse.maphat.errors.missing_dom_node);if(!xorse.is_element(a.dom_node)&&!xorse.is_node(a.dom_node))throw new Error(xorse.maphat.errors.invalid_dom_node);if(!a.infowindow||!a.infowindow.template.node||!a.infowindow.shadow||!a.infowindow.shadow.class_name)throw new Error(xorse.maphat.errors.missing_infowindow_template);if(!a.tooltip||!a.tooltip.template.node||!a.tooltip.shadow||!a.tooltip.shadow.class_name)throw new Error(xorse.maphat.errors.missing_tooltip_template);
if(!xorse.is_element(a.infowindow.template.node)&&!xorse.is_node(a.infowindow.template.node))throw new Error(xorse.maphat.errors.invalid_dom_node_infowindow);if(a.url_schema){if((a.clustering===undefined||a.clustering.enable===false)&&!a.url_schema.map_data)throw new Error(xorse.maphat.errors.url_schema.map_data);if(!a.url_schema.cluster_data&&a.clustering&&a.clustering.enable===true)throw new Error(xorse.maphat.errors.url_schema.cluster_data);}else throw new Error(xorse.maphat.errors.no_url_schema);
b=true}catch(h){xorse.write_error(h,xorse.maphat.DEBUG)}finally{return b}};c.initialize_binds=function(){g({"2":function(){d.bind(f.map,"moveend",d.refresh)},"3":function(){d.bind(f.map,"idle",d.refresh)}})};c.initialize_infowindow=function(){f.infowindow_picons=new xorse.maphat.Overlay({latlng:f.maphat_cfg.center,map:f.map,offset:{display_top:216,display_left:-50,shadow_left:-50,shadow_top:200}},"picons");f.infowindow=new xorse.maphat.Infowindow({infowindow:f.maphat_cfg.infowindow,latlng:f.maphat_cfg.center,
map:f.map},"infowindow");f.tooltip=new xorse.maphat.Infowindow({infowindow:f.maphat_cfg.tooltip,latlng:f.maphat_cfg.center,map:f.map},"tooltip");d.marker_manager=f.clustering?new xorse.maphat.MarkerManager(d,f.infowindow,f.tooltip,true):new xorse.maphat.MarkerManager(d,f.infowindow,f.tooltip,false)};c.initialize_center_marker=function(){var b=f.maphat_cfg.center,h=f.maphat_cfg.center_marker_cfg;if(h.force_center)b=h.force_center;f.center_marker=new xorse.maphat.CenterMarker(d,b,h)};c.initialize_signals=
function(){xorse.signal("marker_data_loaded","maphat",function(){d.get_recently_viewed()});xorse.signal("infowindow_hidden","maphat",function(b){b||d.refinement_manager.set_property(null,true)});xorse.signal("window_resized","maphat",function(){f.map.checkResize();f.map.disableScrollWheelZoom();d.refresh()})};c.point_to_str=function(b,h){return h+","+b};c.parse_property_request=function(b){var h=xorse.start_timer(),j=b.length;d.marker_manager.new_set();if(f.clustering){f.property_length=0;for(var k in b){j=
b[k];var l={};l.id=k;l.icon="cluster";l.children=[];if(j.length==1){var m=j[0];m.latlng=xorse.maphat.google.LatLng(m.point[0],m.point[1]);m.icon="preferred";f.property_length++;d.marker_manager.marker_exists(m.id)?d.marker_manager.show(m.id):d.marker_manager.add_marker(m)}else if(d.marker_manager.marker_exists(l.id))d.marker_manager.show(l.id);else{for(var n=0;n<j.length;n++){m=j[n];m.latlng=xorse.maphat.google.LatLng(m.point[0],m.point[1]);m.icon="preferred";l.children.push(m);f.property_length++}l.latlng=
l.children[0].latlng;d.marker_manager.add_marker(l)}}}else for(n=0;n<j;n++)if(d.marker_manager.marker_exists(b[n].id))d.marker_manager.show(b[n].id);else{p=b[n];p.latlng=xorse.maphat.google.LatLng(p.point[0],p.point[1]);p.icon="preferred";d.marker_manager.add_marker(p)}h=xorse.end_timer(h);d.marker_manager.append_fragments();xorse.maphat.DEBUG&&xorse.write_log("Property Count: "+b.length+", Draw Time: "+h+"ms")};d.request_latlng=function(b,h){d.refinement_manager.set_property(null);xorse.ajax.get_json(f.maphat_cfg.url_schema.get_latlng(b),
{},{"200":function(j){return h(j[0],j[1],j[2]||false)},"4xx":function(){xorse.send_signal("maphat_request_not_found",{arg:b});return d.request_latlng("Tucson, AZ",h)}})};d.request_and_center=function(b,h){xorse.ajax.get_json(f.maphat_cfg.url_schema.get_latlng(b),{},{"200":function(j){var k=xorse.maphat.google.LatLng(j[0],j[1]);j=j[2]||false;h&&f.queue.push(h);j&&d.refinement_manager.set_property(j,true);f.center_marker.pri.marker.setLatLng(k);f.map.setCenter(k,f.maphat_cfg.zoom)},"4xx":function(){xorse.send_signal("maphat_request_not_found",
{arg:b})}})};d.get_favorites=function(){f.maphat_cfg.enable_favorites&&xorse.ajax.get_json(f.maphat_cfg.url_schema.favorite(),{},{"200":function(b){for(var h=0;h<b.length;h++)c.listview_data[b[h].id]=b[h];d.marker_manager.set_favorites(b);xorse.send_signal("favorites_loaded",b)},"401":function(){}})};d.get_recently_viewed=function(){f.maphat_cfg.enable_recently_viewed&&xorse.ajax.get_json(f.maphat_cfg.url_schema.recently_viewed(),{},{"200":function(b){d.marker_manager.set_recently_viewed(b);for(var h=
0;h<b.length;h++)c.listview_data[b[h].id]=b[h];xorse.send_signal("recently_viewed_loaded",b)},"401":function(){}})};d.get_listview=function(b){if(f.maphat_cfg.enable_listview&&d.listview_update)if(!d.disable_unnecessary_updates){if(b.length>100)return xorse.send_signal("maphat_listview_length_error");var h={id:[]},j=[],k={},l={};if(f.clustering)for(var m in b)for(var n=0;n<b[m].length;n++){var r=b[m][n].id;l[r]=true;c.listview_data[r]?j.push(c.listview_data[r]):h.id.push(r)}else for(n=0;n<b.length;n++){r=
b[n].id;l[r]=true;c.listview_data[r]?j.push(c.listview_data[r]):h.id.push(r)}c.listview_data_old=l;if(h.length===0)return xorse.send_signal("maphat_listview_loaded",j);xorse.ajax.post_json(c.listview_url,h,{"200":function(q){for(var o=0;o<q.length;o++)c.listview_data[q[o].id]=q[o];if(j.length)q=q.concat(j);xorse.send_signal("maphat_listview_loaded",{new_set:q,old_set:k})},"412":function(){},"401":function(){}})}};d.get_properties=function(){if(!c.locked){var b=f.map.getBounds(),h=b.getSouthWest(),
j=b.getNorthEast();b=c.point_to_str(h.lat(),h.lng());j=c.point_to_str(j.lat(),j.lng());var k=d.refinement_manager.get_all();k.sw=b;k.ne=j;k.placemark=[[h.lng(),h.lat()]];c.locked=true;xorse.send_signal("maphat_requesting_properties");xorse.ajax.get_json(c.data_url,k,{"200":function(l){c.locked=false;if(l.properties){f.property_length=l.properties.length;c.parse_property_request(l.properties);for(var m=0;m<f.queue.length;m++)f.queue[m](l.properties);f.queue=[];d.listview_update&&d.get_listview(l.properties);
d.listview_update=true;(m=d.refinement_manager.get_property())&&xorse.send_signal("marker_"+m+"_click");xorse.send_signal("maphat_properties_loaded",l)}else xorse.write_error(xorse.maphat.errors.no_property_object)},"5xx":function(){c.locked=false}})}};d.prevent_listview_update=function(){d.listview_update=false};d.refresh=function(){d.get_properties()};c.constructor=function(){if(c.initialize_sanity_tests()){c.initialize_refinement_manager();c.initialize_google_maps(function(){c.initialize_infowindow();
c.initialize_center_marker();c.initialize_signals();c.initialize_binds();d.get_favorites();d.get_recently_viewed();i&&i.call(d)})}};c.constructor();d.deconstructor=function(){GUnload()};xorse.export_methods.call(d,[["deconstructor",d.deconstructor],["get_favorites",d.get_favorites],["get_recently_viewed",d.get_recently_viewed],["get_listview",d.get_listview],["get_properties",d.get_properties],["prevent_listview_update",d.prevent_listview_update],["refresh",d.refresh]])};
xorse.maphat.MapHat.prototype=new xorse.Module("xorse.maphat.MapHat");xorse.maphat.MapHat=xorse.maphat.MapHat;

