var _UEXT_SCRIPT_ROOT = 'http://api.urmap.com/uext';UMap.prototype.findWithin=function(){var _UMap=this;var timer=null;var timeout=1000;var addMoveHandler=function(){_UMap.addListener('moveend',updateTimer);};var removeMoveHandler=function(){_UMap.removeListener('moveend',updateTimer);};var updateTimer=function(){if(timer)clearTimeout(timer);timer=setTimeout(send,timeout);};var send=function(){var centerLatlng=_UMap.getCenter();var url='http://www.urmap.com/TaiwanFindWithin/FindWithin?lat='+centerLatlng.lat()+'&lng='+centerLatlng.lng()+'&callback='+'Ubreadcrumb.changeMenu&file=.js';UGeneric.getScript(url);};addMoveHandler();};UMap.prototype.addDelayListener=function(d,h,e,a){if(!d){return}var h=h||1000;var e=typeof(e)==="string"?e:"moveend";var a=a?true:false;var f=this;var g=null;var c=f.getBounds();var b=function(){if(g){clearTimeout(g);g=null}if(a){var i=f.getCenter();if(c&&!c.contains(i)){g=setTimeout(function(){d();c=f.getBounds()},h)}}else{g=setTimeout(function(){d()},h)}};f.addListener(e,b);return b};UMap.prototype.adService=function(a){var k=this;var h=320;var m=false;var l,p;var d=UGeneric.getScript;var f="__getnd__";var j="http://ad.urmap.com/newad/get?size=100x200&";var c="http://ad.urmap.com/newad/refer?id=";var b=7;var o='<div class="ad"><a target="_blank" href="http://www.urmap.com/adservice/Advertise_01.html"><img border="0" src="http://www.urmap.com/newAd/imgs/goad.gif"/></a></div>';var e="__BINGO__";var n=[];var i=0;var g=true;(function(){var B=new UPoint(300,400);var G="UAD_box"+(+new Date());var D="UAD_content"+(+new Date());var A="UAD_pre"+(+new Date());var w="UAD_nxt"+(+new Date());var u="UAD_close"+(+new Date());var F=['<div class="head" >','<div class="title">本區快訊</div>',"</div>",'<div id="'+D+'" class="content">',"</div>",'<div class="footer" style="cursor:pointer">','<div id="'+u+'" class="close"></div>','<div id="'+A+'" class="first"><a href="javascript:void(0)" title="下一則廣告"> </a></div>','<div id="'+w+'" class="next"><a href="javascript:void(0)" title="前一則廣告"> </a></div>',"</div>"];l=document.createElement("div");var t=document.createElement("div");t.className="UAD_box_MIN";t.style.display="none";t.innerHTML='<div class="head_close">本區快訊</div>';l.id=G;l.className="UAD_box";l.innerHTML=F.join("");p=new UDom(l);DOM_Overlay2=new UDom(t);k.addStaticOverlay(p,URightBottom,new UPoint(5,0));k.addStaticOverlay(DOM_Overlay2,URightBottom,new UPoint(5,0));var x=document.getElementById(A);l.ondblclick=function(K){K=K||UEvent.getEvent(K);UEvent.stopPropagation(K)};t.ondblclick=function(){return false};x.onclick=function(){if(k.getZoomLevel()<b||!g){y(o)}else{var K=i-1;if(K<0){K=n.length-1}s(K)}return};var q=document.getElementById(w);q.onclick=function(){if(k.getZoomLevel()<b||!g){y(o)}else{var K=i+1;if(K>=n.length){C()}else{s(K)}}return};var z=document.getElementById(u);var I=function(){l.style.display="none";t.style.display="block";t.style.zIndex="1";return};var v=function(){l.style.display="block";t.style.display="none"};z.onclick=I;t.onclick=v;var C=function(){if(!g){y(o);return}var M=k.getBounds();var L=M.getSouthWest();var K=M.getNorthEast();var N=["minlat="+L.lat(),"minlng="+L.lng(),"maxlat="+K.lat(),"maxlng="+K.lng(),"number=1","callback="+f];d(j+N.join("&"))};var E=function(K){n.push(K);s(n.length-1)};var s=function(T){var N=n[T];var M=[];var P=N.length>1?true:false;for(var O in N){var K=N[O].id;var Q=N[O].content;var R=c+K;if(Q){M.push('<div class="'+(P?"ad_txt":"ad")+'">');if(R.indexOf("javascript")>0){var S="?link=";var L=R.substring(R.indexOf(S)+S.length,R.lastIndexOf("&t="));L=decodeURIComponent(L);M.push("<a href='"+L+"' onclick='"+e+'("'+R+"\")'>")}else{M.push('<a href="'+R+'" target="_blank">')}M.push(Q);M.push("</a>");M.push("</div>")}}y(M.join(""));i=T};var y=function(M){var K=document.getElementById(D);K.innerHTML=M;var N=K.getElementsByTagName("img");if(N.length>0){for(var L in N){N[L].border="0"}}};var J=function(){if(!a){return}var K=new Image();K.src=a.image;K.onload=function(){var N=new ULatLng(a.latlng,"DES");var M=new UIcon({image:a.image,iconWidth:this.width,iconHeight:this.height,iconAnchor:new UPoint(this.width/2,this.height),infoWindowAnchor:new UPoint(this.width/2,0)});var L=new UMarker(N,M);L.addListener("click",function(P,O,Q){O.openInfoWindow(a.html)});k.addOverlay(L)}};var H=function(L){var K=new Image();K.src=L;K=null};var r=k.container.clientHeight;C();window[f]=E;window.__getndgo__=C;window.__adClick__=function(L,M,K){var L=L||window.event;if(M&&M.lat){k.openInfoWindow(M,K);UEvent.cancelDefault(L);UEvent.stopPropagation(L);return}};window[e]=H;k.addDelayListener(C,1000,"moveend",true);k.addListener("zoom",function(L,K){if(K<b||!g){y(o)}else{if(n.length>0){s(n.length-1)}}});if(r>h){m=true}else{I()}})()};(function(){var b=function(){var c=UGeneric.activeMaps;for(var d in c){if(c.hasOwnProperty(d)&&!c[d].isOverView){c[d].adService()}}};if(window.urmapEvent&&typeof window.urmapEvent=="function"){var a=window.urmapEvent;window.urmapEvent=function(){a();b()}}else{if(!window.urmapEvent){window.urmapEvent=function(){b()}}}})();// Copyright 2004 www.urmap.com Inc.
//Update by urmapapi@olemap.com 2009/12/10W 05:11
var UGeoCoder=function(){var h="http://www.urmap.com/api/geo/get.jsp";var j=[];var k=[];var c=(document.charset||document.characterSet).replace("-","").toLowerCase();var b=null;var g=null;var m=UGeneric.inArray;var d=UGeneric.getScript;var i=function(n,r,q){if(!n){return}n=encodeURIComponent(n);var p=f(n);b=r;g=q;if(p){e(p)}else{var o=h+"?callback=__U__GEO&qs="+n+"&output="+c;d(o)}};var e=function(p){var n;if(p["api-data-root"]){n=p["api-data-root"]["records"]["record"]}else{n=p}var q=parseFloat(n.latitude);var o=parseFloat(n.longitude);var r;if(q==0&&o==0){r=null}else{r=new ULatLng(q,o)}a(n.address,n);if(typeof b==="function"){b(r,n)}if(r==null&&typeof g=="function"){g()}};var a=function(o,p){if(!UGeneric.GeoCache){UGeneric.GeoCache={};UGeneric.GeoCache.cacheqs=[];UGeneric.GeoCache.opts=[]}var r=false;o=encodeURIComponent(o);if(UGeneric.GeoCache.cacheqs.length){var q=UGeneric.GeoCache.cacheqs;var n=m(q,o);if(n<0){r=true}}if(r){return}UGeneric.GeoCache.cacheqs.push(o);UGeneric.GeoCache.opts.push(p)};var f=function(o){var q=UGeneric.GeoCache?UGeneric.GeoCache.cacheqs:null;if(!q){return null}var n=m(q,o);if(n<0){return null}else{var p=UGeneric.GeoCache.opts[n];return p}};var l=function(){delete UGeneric.GeoCache};window.__U__GEO=e;this.getLatLng=i;this.clearCache=l};UMarker.prototype.locateTo=UMap.prototype.locateTo=function(a,h,g){if(!a){return}var c="UMAP";var f=this;var b=null;if(this.isUMarker){c="UMarker";f=this.parentMap;b=this}if(!f){return}var d=this;var e=UGeneric.GeoCoder;if(!e){UGeneric.GeoCoder=new UGeoCoder();e=UGeneric.GeoCoder}e.getLatLng(a,function(j,i){if(b){if(j){b.setPoint(j)}b.refreshInfoWindow()}else{if(j){f.centerMap(j)}}f.refreshMap();if(typeof h==="function"){h(j,i)}},g)};UGeneric.UWeather=new function(){var s=this,h="http://potter.urmap.com/gisservice/weather?lat=%%lat&lng=%%lng&callback=__weather__&nocache="+(+new Date()),r=UGeneric.getScript,e=document.createElement("img"),i="http://api.urmap.com/uext/demo/weather/",f={iconWidth:"120",iconHeight:"120"},l=null;e.id="weatherIcon";var j=function(u){if(!u||!u.latlng||!u.callback){throw"_getWeather need opt, opt.latlng, opt.callback"}var w=u.latlng,v=u.callback,t=h.replace("%%lat",w.lat()).replace("%%lng",w.lng());r(t,function(){if(typeof v==="function"){v.call(null,l)}})};window.__weather__=function(t){l=t};var k=function(t){if(t.latlng){o(t)}return e},q=function(u){var t=document.createElement("img");if(u.latlng){u.icon=t;o(u)}return t},n=document.createElement("div"),c=document.createElement("div"),b=document.createElement("div"),p=document.createElement("div"),o=function(t){if(!t.latlng){throw"_updateWeatherIcon need opt.latlng";return}var u=t.callback;t.callback=function(x){var w=t.icon||e,y=w.style;if(!x||!x.type){n.style.display="none"}else{n.style.display="";b.innerHTML=x.type;p.innerHTML="紫外線："+x.uv;c.innerHTML=x.avetemp+"°C";var v=i+x.icon+".png";w.src=v;w.width=f.iconWidth;w.height=f.iconHeight}if(typeof u==="function"){u.call(s,w,x)}};j(t)},m=false,d=function(v){var x=v.style,t=arguments.length;for(var w=1;w<t;w++){var y=arguments[w];for(var u in y){switch(u){case"top":x.bottom=null;break;case"right":x.left=null;break;case"bottom":x.top=null;break;case"left":x.right=null;break}x[u]=y[u]}}return v},a=function(u,t){if(!u||!u.container||!u.getCenter){throw"_addWeatherIcon need UMap object as first arguments"}t=t||{right:"0px",top:"30px"};k({latlng:u.getCenter(),callback:function(v,w){if(!m){n.id="weatherDiv";b.id="weatherTypeDiv";p.id="weatherUvDiv";c.id="weatherTemperatureDiv";var x={position:"absolute",zIndex:"99",fontWeight:"bold",left:"0px",top:"0px"};d(n,x,t,{width:f.iconWidth+"px",height:f.iconHeight+"px"});d(b,x,{top:"0px"});d(p,x,{top:"20px"});d(c,x,{top:"40px"});d(v,x);n.appendChild(v);n.appendChild(c);n.appendChild(b);n.appendChild(p);u.container.appendChild(n);m=true}}});return n},g=function(t){if(!t||!t.container||!t.getCenter){throw"_removeWeatherIcon need UMap object as first arguments"}if(m){m=false;t.container.removeChild(n)}};s.setIconDir=function(t){i=t};s.getWeather=j;s.getWeatherDiv=function(){return n};s.getWeatherIcon=k;s.getNewWeatherIcon=q;s.updateWeatherIcon=o;s.addWeatherIcon=a;s.removeWeatherIcon=g};UMap.prototype.addWeatherIcon=function(a){var c=this,b=UGeneric.UWeather;if(!b.exec){b.exec=function(){b.addWeatherIcon(c,a)};b.exec();c.addListener("moveend",b.exec)}};UMap.prototype.removeWeatherIcon=function(){var b=this,a=UGeneric.UWeather;if(a.exec){a.removeWeatherIcon(b);b.removeListener("moveend",a.exec);a.exec=null}};if(typeof UGeneric != 'undefined')
	UGeneric.getCss('uextcss', 'http://api.urmap.com/uext/css/uext.css');
	
