function $(a){return document.getElementById(a)}function show_element(a){if($(a)){$(a).style.display="block"}}function hide_element(a){if($(a)){$(a).style.display="none"}}function removeElement(b){var a=$(b);if(a){a.parentNode.removeChild(a)}}function get_level(){return MapAPI.viewportInfo.levelIndex}function get_center(){var c=new Point,b=MapAPI.viewportInfo;if(is_geo()){var a=MapAPI.viewportInfo.centerGeo;c.x=a.lon;c.y=a.lat;return c}return MapAPI.viewportInfo.centerMetric}function is_geo(){return(MapAPI.viewportInfo.projection.name=="Mercator WGS-1984")?1:0}function ajax(b,d,c){if(document.getElementById){var a=(window.ActiveXObject)?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()}if(a){a.onreadystatechange=function(){if(a.readyState==4&&a.status==200){if(typeof d=="function"){d(a.responseText)}}else{if(typeof c=="function"){c()}}};a.open("GET",b,true);a.send(null)}return a}function get_screen_size(){var b=0,a=0;if(typeof(window.innerWidth)=="number"){b=window.innerWidth;a=window.innerHeight}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){b=document.documentElement.clientWidth;a=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){b=document.body.clientWidth;a=document.body.clientHeight}}}return Array(b,a)};SD={version:"0.9"};window["undefined"]=window["undefined"];SD.apply=function(d,e,b){if(b){SD.apply(d,b)}if(d&&e&&typeof e=="object"){for(var a in e){d[a]=e[a]}}return d};(function(){var idSeed=0;var ua=navigator.userAgent.toLowerCase();var isStrict=document.compatMode=="CSS1Compat",isOpera=ua.indexOf("opera")>-1,isSafari=(/webkit|khtml/).test(ua),isSafari3=isSafari&&ua.indexOf("webkit/5")!=-1,isIE=!isOpera&&ua.indexOf("msie")>-1,isIE6=!isOpera&&ua.indexOf("msie 6.0")>-1,isIE7=!isOpera&&ua.indexOf("msie 7")>-1,isGecko=!isSafari&&ua.indexOf("gecko")>-1,isGecko3=!isSafari&&ua.indexOf("rv:1.9")>-1,isBorderBox=isIE&&!isStrict,isWindows=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1),isMac=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1),isAir=(ua.indexOf("adobeair")!=-1),isLinux=(ua.indexOf("linux")!=-1),isIphone=ua.indexOf("iphone")!=-1||ua.indexOf("ipad")!=-1||ua.indexOf("ipod")!=-1||ua.indexOf("android")!=-1,isSecure=window.location.href.toLowerCase().indexOf("https")===0;if(isIE&&!isIE7){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}if(isIE7){var meta=document.createElement("meta");meta.setAttribute("http-equiv","X-UA-Compatible");meta.setAttribute("content","IE=EmulateIE7");var head=document.getElementsByTagName("head")[0];head.appendChild(meta)}SD.apply(SD,{isSvg:(document.createElementNS&&((document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG","1.1")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")))||(window.opera&&isOpera&&parseInt(ua.substring(ua.indexOf("opera")+6))>=8))?true:false),BASE_URL:"http://"+location.hostname+"/dragmap/xg/",POSITION_TOP_RIGHT:-1,POSITION_TOP_LEFT:-2,POSITION_BOTTOM_RIGHT:-3,POSITION_BOTTOM_LEFT:-4,applyIf:function(o,c){if(o&&c){for(var p in c){if(typeof o[p]=="undefined"){o[p]=c[p]}}}return o},extend:function(){var io=function(o){for(var m in o){this[m]=o[m]}};var oc=Object.prototype.constructor;return function(sb,sp,overrides){if(typeof sp=="object"){overrides=sp;sp=sb;sb=overrides.constructor!=oc?overrides.constructor:function(){sp.apply(this,arguments)}}var F=function(){},sbp,spp=sp.prototype;F.prototype=spp;sbp=sb.prototype=new F();sbp.constructor=sb;sb.superclass=spp;if(spp.constructor==oc){spp.constructor=sp}sb.override=function(o){SD.override(sb,o)};sbp.override=io;SD.override(sb,overrides);sb.extend=function(o){SD.extend(sb,o)};return sb}}(),override:function(origclass,overrides){if(overrides){var p=origclass.prototype;for(var method in overrides){p[method]=overrides[method]}}},namespace:function(){var a=arguments,o=null,i,j,d,rt;for(i=0;i<a.length;++i){d=a[i].split(".");rt=d[0];eval("if (typeof "+rt+' == "undefined"){'+rt+" = {};} o = "+rt+";");for(j=1;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]]}}},removeNode:isIE?function(){var d;return function(n){if(n&&n.tagName!="BODY"){d=d||document.createElement("div");d.appendChild(n);d.innerHTML=""}}}():function(n){if(n&&n.parentNode&&n.tagName!="BODY"){n.parentNode.removeChild(n)}},isOpera:isOpera,isSafari:isSafari,isSafari3:isSafari3,isSafari2:isSafari&&!isSafari3,isIE:isIE,isIE6:isIE6,isIE7:isIE7,isGecko:isGecko,isGecko2:isGecko&&!isGecko3,isGecko3:isGecko3,isBorderBox:isBorderBox,isLinux:isLinux,isWindows:isWindows,isMac:isMac,isIphone:isIphone,isAir:isAir,useShims:((isIE&&!isIE7)||(isMac&&isGecko&&!isGecko3))});SD.ns=SD.namespace})();SD.ns("SD","SD.util","SD.shape","SD.drawing","SD.projection","SD.genmap");SD.applyIf(Array.prototype,{clone:function(){return this.slice(0)}});SD.applyIf(Number.prototype,{toFixed:function(a){var b=this;b=Math.round(b*Math.pow(10,a))/Math.pow(10,a);return b}});SD.util={addScript:function(a){meta=document.createElement("script");meta.setAttribute("type","text/javascript");meta.setAttribute("src",a);var b=document.getElementsByTagName("head")[0];b.appendChild(meta);return meta},removeScript:function(a){var b=document.getElementsByTagName("head")[0];b.removeChild(a)},defaultIcon:function(){var a=new SD.genmap.MarkerImage();a.iconSize=new Size(19,32);a.iconAnchor=new Point(9,34);a.infoWindowAnchor=new Point(9,35);a.image=SD.BASE_URL+"/icon.php";return a},debug:function(c,b){var a=document.getElementById("debug");if(a){if(b){a.innerHTML=c+"<br>"}else{a.innerHTML+=c+"<br>"}}},clone:function(b){var a=(b instanceof Array)?[]:{};for(i in b){if(i=="clone"){continue}if(b[i]&&b[i].nodeName=="IMG"&&b[i].nodeType==1&&b[i].complete){a[i]=b[i].cloneNode(true)}else{if(b[i]&&typeof b[i]=="object"&&!b[i].nodeType){a[i]=SD.util.clone(b[i])}else{a[i]=b[i]}}}return a},arrayMin:function(a){if(a.length==0){return 0}if(a.length==1){return 1}var c=a[0];for(var b=1;b<a.length;b+=1){if(a[b]<c){c=a[b]}}return parseInt(c)},arrayMax:function(c){for(var b=0;b<c.length;b+=1){c[b]=c[b]*-1}var a=SD.util.arrayMin(c);a=a*-1;return parseInt(a)},easeInOut:function(d,e,c){var f=Math.abs(d.first-d.latest);var a=(Math.pow(((1/e)*c),0.5)*f);var b=d.first>d.latest?d.first-a:d.first+a;return b},getDistance:function(a,b){if(isNaN(a.x)||isNaN(a.y)||isNaN(b.x)||isNaN(b.y)){return}return Math.sqrt((a.x-b.x)*(a.x-b.x)+(b.y-a.y)*(b.y-a.y))},isDivExist:function(b,d){var c=b.childNodes;for(var a=0;a<c.length;a++){if(d==c[a]){return true}}return false},isNearBoundary:function(e,b,a){var d={x:0,y:0},c=50;e=SD.util.offsetPoint(e,a.x,a.y);if(e.x<c){d.x=10}else{if(e.x>b.width-c){d.x=-10}}if(e.y<c){d.y=10}else{if(e.y>b.height-c){d.y=-10}}if(d.x!=0||d.y!=0){return d}return false},panByOffset:function(a,e,c){var d=parseFloat(a.style.left);var b=parseFloat(a.style.top);if(!isNaN(d)&&!isNaN(b)&&a!=null){a.style.left=(d+e)+"px";a.style.top=(b+c)+"px"}},offsetPoint:function(c,b,d){var a={x:0,y:0};a.x=c.x+b;a.y=c.y+d;return a},getTopLeft:function(a){if(a==undefined){return{x:0,y:0}}var b=curtop=0;if(a.offsetParent){b=a.offsetLeft;curtop=a.offsetTop;while(a=a.offsetParent){b+=a.offsetLeft;curtop+=a.offsetTop}}return{x:b,y:curtop}},cancelEvent:function(a,b){a=a?a:window.event;if(a.stopPropagation){a.stopPropagation()}if(a.preventDefault){a.preventDefault()}a.cancelBubble=true;a.cancel=true;a.returnValue=false;if(!b){if(SD.isIE||SD.isIE7){document.execCommand("Stop")}else{window.stop()}}},getCursorPos:function(g,f){var h=SD.util.getTopLeft(f);var d,b,c,a;if(SD.isIphone&&g.touches&&g.touches[0]!=undefined){d=g.touches[0].pageX;b=g.touches[0].pageY}else{d=(!document.all)?g.pageX:(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));b=(!document.all)?g.pageY:(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop))}d-=h.x;b-=h.y;return{x:d,y:b,vx:c,vy:a}},getMouseButton:function(a){if(typeof a=="undefined"){a=window.event}if(!a){return"LEFT"}if(a.which==null){button=(a.button<2)?"LEFT":((a.button==4)?"MIDDLE":"RIGHT")}else{button=(a.which<2)?"LEFT":((a.which==2)?"MIDDLE":"RIGHT")}return button},createElement:function(c,b,n,l,k,g,m,d,e,j,f,h){var a=document.createElement(c);if(b!=undefined&&b!=""){a.id=b}if(n!=undefined&&n!=""){a.style.left=n}if(l!=undefined&&l!=""){a.style.top=l}if(h!=undefined&&h!=""){a.style.bottom=h}if(k!=undefined&&k!=""){a.style.width=k}if(g!=undefined&&g!=""){a.style.height=g}if(m!=undefined&&m!=""){a.style.position=m}if(e!=undefined&&e!=""){a.src=e}if(d!=undefined){a.style.zIndex=d}if(j!=undefined&&j!=""){a.style.backgroundColor=j}if(f!=undefined&&f==true){a.style.overflow="hidden"}return a},createDiv:function(a,k,h,g,d,j,b,f,c,e){return SD.util.createElement("div",a,k,h,g,d,j,b,"",f,c,e)},createImg:function(a,c,k,h,g,f,j,b,d){var e=SD.util.createElement("img",a,k,h,g,f,j,b,c,d);e.style.filter="Progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+c+"')";return e},createImgSprite:function(g,q,e,r,a,b,c,j,l,p,o){o=(o==undefined)?false:true;if(SD.isIE6&&!o){var n=document.createElement("div");b=(b==undefined)?"":"left:"+b+"px;";c=(c==undefined)?"":"top:"+(c)+"px;";j=(j==undefined)?"":j;n.style.cssText="position:absolute; "+b+c+j;var m=document.createElement("div");m.style.cssText="width:"+q+"px; height:"+e+"px; position: relative; overflow:hidden;";var k=document.createElement("div");k.className=g;l=(l==undefined)?1000:l;p=(p==undefined)?1000:p;k.style.cssText="width: "+l+"px; height: "+p+"px; position:absolute; left:"+(-r)+"px; top: "+(-a)+"px;";m.appendChild(k);n.appendChild(m);n.setClassName=function(d){n.childNodes[0].childNodes[0].className=d};n.setBgPosition=function(f,d){n.childNodes[0].childNodes[0].style.left=-f+"px";n.childNodes[0].childNodes[0].style.top=-d+"px"};n.setWidth=function(d){n.childNodes[0].style.width=d+"px"};n.setHeight=function(d){n.childNodes[0].style.height=d+"px"};n.setTopLeft=function(d,f){n.style.top=f+"px";n.style.left=d+"px"};n.getTopLeft=function(){return n.style.left+" "+n.style.top};n.getBgPosition=function(){return n.childNodes[0].childNodes[0].style.left+" "+n.childNodes[0].childNodes[0].style.top};return n}else{var m=document.createElement("div");b=(b==undefined)?"":"left:"+b+"px;";c=(c==undefined)?"":"top:"+c+"px;";m.className=g;m.style.cssText="background-position: "+(-r)+"px "+(-a)+"px;width:"+q+"px; height:"+e+"px; position:absolute;"+b+""+c+j;m.setClassName=function(d){m.className=d};m.setBgPosition=function(f,d){m.style.backgroundPosition=(-f)+"px "+(-d)+"px"};m.setWidth=function(d){m.style.width=d+"px"};m.setHeight=function(d){m.style.height=d+"px"};m.setTopLeft=function(d,f){m.style.top=f+"px";m.style.left=d+"px"};m.getBgPosition=function(){return m.style.backgroundPosition};m.getTopLeft=function(){return m.style.left+" "+m.style.top};return m}},createInfoFrame:function(k,f,c,m,b,g,a){var j=SD.util.createDiv("",c+"px",m+"px",k+"px",f+"px","absolute",0,"",true);var e=SD.util.createImg("",SD.BASE_URL+"img/"+a,b+"px",g+"px","","","absolute");e.style.border="0px";j.appendChild(e);return j},purge:function(f){if(f==null||f==undefined){return}var c=f.attributes,e,b,g;if(c){b=c.length;for(e=0;e<b;e+=1){g=c[e].name;if(typeof f[g]==="function"){f[g]=null}}}c=f.childNodes;if(c){b=c.length;for(e=0;e<b;e+=1){this.purge(f.childNodes[e])}}},getHttpObject:function(){var a;try{a=new XMLHttpRequest()}catch(b){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(b){try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(b){alert("Your browser does not support AJAX!");return false}}}return a},initVML:function(){if(SD.isIE8){document.namespaces.add("v","urn:schemas-microsoft-com:vml","#default#VML");var c=document.createStyleSheet();var a=["group","oval","stroke","fill","polyline","line","path","textpath","rect"];for(var b=0;b<a.length;b++){c.addRule("v\\:"+a[b],"behavior: url(#default#VML);")}}else{if(!document.namespaces.v){document.namespaces.add("v","urn:schemas-microsoft-com:vml");document.createStyleSheet().addRule("v\\:*","behavior: url(#default#VML);")}}},Ajax:function(b,d){var c=SD.util.getHttpObject();c.onreadystatechange=a;function a(){if(c.readyState==4){if(c.status==200){if(d){d(c.responseXML)}}}}this.doGet=function(){c.open("GET",b,true);c.send(null)};this.doPost=function(e,f){c.open("POST",b,true);c.setRequestHeader("Content-Type","application/x-www-form-urlencoded");if(f==true||f!=undefined){c.setRequestHeader("Content-Type","text/xml")}c.send(e)}},AjaxJson:function(b,d){var c=SD.util.getHttpObject();c.onreadystatechange=a;function a(){if(c.readyState==4){if(c.status==200){if(d){d(c.responseText)}}}}this.doGet=function(){c.open("GET",b,true);c.send(null)};this.doPost=function(e,f){c.open("POST",b,true);c.setRequestHeader("Content-Type","application/x-www-form-urlencoded");if(f==true||f!=undefined){c.setRequestHeader("Content-Type","text/xml")}c.send(e)}}};SD.drawing.setTilePosition=function(a,d,c,b,g,f,e){d.left=((b-f)*a.mapTileSize.x)+a.offsetContainer.x;d.top=((g-e)*a.mapTileSize.y)+a.offsetContainer.y;d.setWidth(a.mapTileSize.x);d.setHeight(a.mapTileSize.y);c.top=d.top;c.left=d.left;if(SD.isIE||SD.isIE7||SD.isIphone){d.setWidth(a.mapTileSize.x);d.setHeight(a.mapTileSize.y)}var h=c.div?c.div:c.img;h.style.position="absolute";h.style.width=Math.ceil(d.width())+"px";h.style.height=Math.ceil(d.height())+"px";h.style.top=d.top+"px";h.style.left=d.left+"px"};SD.drawing.Point=function(a,b){this.x=a;this.y=b};SD.drawing.GeoPoint=function(a,b){this.lon=a;this.lat=b};SD.drawing.Size=function(b,a){this.width=b;this.height=a};SD.drawing.Rectangle=function(d,c,b,a){this.left=d;this.top=c;this.right=b;this.bottom=a;this.setWidth=function(e){this.right=this.left+e};this.setHeight=function(e){this.bottom=this.top+e};this.offset=function(e,f){this.left=d+e;this.top=top+f;this.right=b+e;this.bottom=a+f};this.width=function(){return Math.abs(this.right-this.left)};this.height=function(){return Math.abs(this.bottom-this.top)}};SD.genmap.OverlayManager=function(){};SD.genmap.OverlayManager.prototype={node:[],add:function(a){this.node.push(a)},remove:function(c){if(c==undefined||c==null){return}var a=-1;for(var b=0;b<this.node.length;b++){if(c==this.node[b]){a=b}break}if(a!=-1){this.node.splice(a,1)}}};var Point=SD.drawing.Point,Vertex=SD.drawing.Point,GeoPoint=SD.drawing.GeoPoint,GLatLng=SD.drawing.GeoPoint,Size=SD.drawing.Size,Rectangle=SD.drawing.Rectangle;if(typeof loadCSS=="function"){if(SD.isIE6){loadCSS("/css/new/map_ie.css?v=10")}else{loadCSS("/css/new/map.css?v=10")}};function ViewportInfo(){this.div=null;this.scale=66.66666940601503;this.levelIndex=1;this.lastCursorLatLon=new GeoPoint(0,0);this.lastCursorPosDown=new Point(0,0);this.lastCursorPosUp=new Point(0,0);this.lastCursorPosMove=new Point(0,0);this.lastCursorPosOffset=new Point(0,0);this.lastCursorDelta=0;this.projection=new SD.projection.Default();this.canvasSize=new Size(0,0);this.centerGeo=new GeoPoint(0,0);this.centerMetric=new Vertex(0,0);this.centerScreen=new Point(0,0);this.topLeftGeo=new GeoPoint(0,0);this.topLeftMetric=new Vertex(0,0);this.topLeftScreen=new Point(0,0);this.screenView=new Rectangle(0,0,0,0);this.metricView=new Rectangle(0,0,0,0);this.geoView=new Rectangle(0,0,0,0);this.mapConfig=null;this.init=function(a,d,b){if(d!=null){this.projection=d}if(b){this.centerGeo=this.projection.metricToGeo(this.centerMetric.x,this.centerMetric.y)}else{this.centerMetric=this.projection.geoToMetric(this.centerGeo.lon,this.centerGeo.lat)}this.centerScreen=this.projection.metricToPixel(this.centerMetric.x,this.centerMetric.y,this.scale);if(a!=null){this.canvasSize=a}this.topLeftScreen.x=this.centerScreen.x-(this.canvasSize.width/2);this.topLeftScreen.y=this.centerScreen.y-(this.canvasSize.height/2);this.recalculate()};this.recalculate=function(){this.topLeftMetric=this.projection.pixelToMetric(this.topLeftScreen.x,this.topLeftScreen.y,this.scale);this.topLeftGeo=this.projection.pixelToGeo(this.topLeftScreen.x,this.topLeftScreen.y,this.scale);this.screenView=new Rectangle(this.topLeftScreen.x,this.topLeftScreen.y,this.canvasSize.width,this.canvasSize.height);var a=this.projection.pixelToMetric(this.topLeftScreen.x+this.canvasSize.width,this.topLeftScreen.y+this.canvasSize.height,this.scale);this.metricView=new Rectangle(this.topLeftMetric.x,this.topLeftMetric.y,a.x,a.y);var b=this.projection.pixelToGeo(this.topLeftScreen.x+this.canvasSize.width,this.topLeftScreen.y+this.canvasSize.height,this.scale);this.geoView=new Rectangle(this.topLeftGeo.lon,this.topLeftGeo.lat,b.lon,b.lat)};this.getCanvasRect=function(){if(this.mapConfig==null){return false}var b=this.projection.geoToPixel(this.mapConfig.minLongitude,this.mapConfig.maxLatitude,this.scale);var d={x:this.topLeftScreen.x-b.x,y:this.topLeftScreen.y-b.y};var a={x:d.x+this.canvasSize.width,y:d.y+this.canvasSize.height};return new Rectangle(d.x,d.y,a.x,a.y)};this.getCanvasSize=function(){if(this.mapConfig==null){return false}var a=this.mapConfig.ratio==0.99?1:this.mapConfig.ratio;return{x:this.mapConfig.mapTileWidth*a,y:this.mapConfig.mapTileHeight*a}};this.reInit=function(){this.init(this.canvasSize,this.projection)};this.viewportScreenToGeo=function(a,b){return this.projection.screenToGeo(a,b,this.scale,this.topLeftScreen)};this.viewportGeoToScreen=function(a){return this.projection.geoToScreen(a.lon,a.lat,this.scale,this.topLeftScreen)};this.viewportScreenToMetric=function(a,b){return this.projection.screenToMetric(a,b,this.scale,this.topLeftScreen)};this.canvasGeoToScreen=function(a){if(this.topLeftOverlay==undefined){return false}return this.projection.geoToScreen(a.lon,a.lat,this.scale,this.topLeftOverlay)};this.setCenterFromViewportScreenPosition=function(a,b){this.centerGeo=this.viewportScreenToGeo(a,b);this.reInit()};this.viewportScale=function(a){if(a!=undefined){this.scale=a;this.reInit()}else{return this.scale}};this.setCenter=function(a,d){var b=this.projection.inflateGeo(this.centerGeo,-a,-d,this.scale);if(b){this.centerGeo=c;this.reInit()}};this.getMetricPosDown=function(){var a=this.lastCursorPosDown;return this.viewportScreenToMetric(a.x,a.y)};this.getMetricPosMove=function(){var a=this.lastCursorPosMove;return this.viewportScreenToMetric(a.x,a.y)}}function ViewportControl(){this.viewportInfo=new ViewportInfo();this.defaultTool=new ViewportPanTool();this.activeTool=this.defaultTool;this.onDrag=false;this.viewportLayer=new SDLayer();this.zoomLayer=new ZoomObject();this.mapLayer=new MapObject();this.vectorLayer=new DrawingLayer();this.container=new SDLayer();this.hintLayer=new SDLayer();this.infoWindow=new SD.genmap.SDInfoWindow();this.tooltip=new SD.genmap.SDTooltip();this.markerStaticLayer=new MarkerStaticLayer();this.size=new Size(0,0);this.canvasInfo={};this.mapAPI=null;this.mapManager=null;this.projection=null;this.scrollwheel=true;this.enableDefaultLogo=true;this.control=null;this.OnLevelChanged=new EventDelegates();this.OnDraw=new EventDelegates();this.OnEndDrag=new EventDelegates();this.OnDraw.register(function(){if(typeof onDrawMap=="function"){onDrawMap()}if(this.mapAPI.thumb){this.mapAPI.thumb.configure()}this.removePreloadMap()},this);this.OnEndDrag.register(function(){if(typeof onEndDragMap=="function"){onEndDragMap()}if(this.mapAPI.thumb){this.mapAPI.thumb.configure()}this.removePreloadMap()},this)}ViewportControl.prototype={ActiveTool:function(a){if(a!=undefined){this.activeTool=a}else{return this.activeTool}},requestForRedraw:function(a){var b=this;if(a==1){setTimeout(function(){b.draw()},0)}else{if(a==0){setTimeout(function(){b.moveViewport()},0)}}},getCenter:function(d){var b=this.viewportInfo.centerGeo;var a=this.projection.geoToMetric(b.lon,b.lat);return this.projection.inflateVert(a,-d.x,-d.y,this.viewportInfo.scale)},setLevel:function(b){if(this.mapManager!=null){var a=this.mapManager.getLength();if(b<=a&&1<=b){this.viewportInfo.levelIndex=b}}else{if(b>0){this.viewportInfo.levelIndex=b}}},setCenter:function(a,b){if(this.projection!=null){this.viewportInfo.centerGeo=a;if(b==true){this.draw()}}},getCenterOnWorldBound:function(g){var f=this.viewportInfo.levelIndex<6?this.viewportInfo.levelIndex-1:-1;var h=this.mapManager.layers[f];if(h==null){return g}var e=g.x?g.x:g.lon;var j=g.y?g.y:g.lat;var a=g.x||g.y?h.boundsMetric:h.bounds;if(e<a.left){var i=a.left-e;e=a.right-i}else{if(e>a.right){var i=a.right-e;e=a.left-i}}if(g.lon){g.lon=e}else{g.x=e}return g},panCenter:function(d,b){if(this.projection!=null){var a=this.projection.inflateVert(this.viewportInfo.centerMetric,-d.x,-d.y,this.viewportInfo.scale);a=this.getCenterOnWorldBound(a);this.viewportInfo.centerMetric=a}},wheelCenter:function(e,d,a){if(this.projection!=null&&e>0){if(d==undefined||d==null){d=this.getCursorDistanceFromCenter()}if(a==undefined||a==null){a=this.viewportInfo.lastCursorLatLon}var b=this.projection.inflateGeo(a,d.x,d.y,e);b=this.getCenterOnWorldBound(b);this.setCenter(b,false)}},getNextLevel:function(e){var d=this.viewportInfo.levelIndex+(e?1:-1);var a=this.mapManager.layers.length;d=d<=0?1:a<=d?a:d;var b=this.mapManager.getMapLayerByLevel(d,this.viewportInfo.lastCursorLatLon.lon,this.viewportInfo.lastCursorLatLon.lat);return b.scale==undefined?-1:b.scale},setScale:function(a,b){if(this.projection!=null){if(a>0&&!isNaN(a)){this.viewportInfo.scale=a}if(b==true){this.draw()}}},updateMapLayerByLevel:function(b){var a=this.mapManager.getMapLayerByLevel(b,this.viewportInfo.centerGeo.lon,this.viewportInfo.centerGeo.lat);if(!a){return false}if(a.scale<0){return false}this.viewportInfo.mapConfig=a;this.viewportInfo.levelIndex=b;this.setScale(a.scale,false);this.projection=a.projection;this.mapLayer.clear();if(this.zoomLayer){this.zoomLayer.clear()}this.levelChanged();if(this.OnLevelChanged){this.OnLevelChanged.triggered(this.viewportInfo)}},updateMapLayerByNearest:function(b){var a=this.mapManager.getMapLayerByNearest(b,this.viewportInfo.levelIndex,this.viewportInfo.centerGeo.lon,this.viewportInfo.centerGeo.lat);if(!a.layer||b<=0){return false}if(a.layer.scale<0){return false}a.layer.ratio=1;this.projection=a.layer.projection;this.setScale(a.layer.scale,false);this.viewportInfo.mapConfig=a.layer;this.levelChanged();if(this.OnLevelChanged){this.OnLevelChanged.triggered(this.viewportInfo)}},levelChanged:function(){this.mapLayer.isRender=true;this.markerStaticLayer.setDraw(true);this.viewportLayer.setTopLeft({x:0,y:0})},removePreloadMap:function(){if($("preloadMap")){removeElement("preloadMap")}},MouseWheel:function(b){var d=0;if(typeof b=="undefined"){b=window.event}if(b.wheelDelta){d=b.wheelDelta/120}else{if(b.detail){d=-b.detail/3}}var a=SD.util.getCursorPos(b,this.control.realDiv);this.control.viewportInfo.lastCursorWheel=this.control.viewportInfo.viewportScreenToGeo(a.x,a.y);this.control.viewportInfo.lastCursorLatLon=this.control.viewportInfo.lastCursorWheel;this.control.viewportInfo.lastCursorDelta=d;if(this.control.activeTool){if(this.control.scrollwheel){this.control.activeTool.AnimatedMouseWheel(b,this.control)}else{this.control.activeTool.MouseWheel(b,this.control)}}SD.util.cancelEvent(b,true);return false},MouseDown:function(d){if(typeof d=="undefined"){d=window.event}if(d.preventDefault){d.preventDefault()}var b=SD.util.getCursorPos(d,this.control.realDiv);this.control.onDrag=true;this.control.viewportInfo.lastCursorPosDown=b;if(SD.isIphone){this.control.viewportInfo.lastCursorPosMove=b;if(this.control.viewportInfo.lastCursorLatLon.lon==0){var a=this.control.viewportInfo.viewportScreenToGeo(b.x,b.y);this.control.viewportInfo.lastCursorLatLon=this.control.getCenterOnWorldBound(a)}}if(this.control.activeTool){this.control.activeTool.MouseDown(d,this.control)}},MouseMove:function(d){if(typeof d=="undefined"){d=window.event}if(d.preventDefault){d.preventDefault()}var b=SD.util.getCursorPos(d,this.control.realDiv);this.control.viewportInfo.lastCursorPosOffset=SD.util.offsetPoint(b,-this.control.viewportInfo.lastCursorPosMove.x,-this.control.viewportInfo.lastCursorPosMove.y);this.control.viewportInfo.lastCursorPosMove=b;if(this.control.onDrag){var a=this.control.viewportInfo.viewportScreenToGeo(b.x,b.y);this.control.viewportInfo.lastCursorLatLon=a;if(!isNaN(a.lon)&&!isNaN(a.lat)){this.control.viewportInfo.lastCursorLatLon=this.control.getCenterOnWorldBound(a);this.control.getInfo(true)}}if(this.control.activeTool){this.control.activeTool.MouseMove(d,this.control)}},MouseUp:function(d){if(typeof d=="undefined"){d=window.event}if(d.preventDefault){d.preventDefault()}var b=SD.util.getCursorPos(d,this.control.realDiv);if(this.control.onDrag){var a=this.control.viewportInfo.viewportScreenToGeo(b.x,b.y);if(!isNaN(a.lon)&&!isNaN(a.lat)){this.control.viewportInfo.lastCursorLatLon=this.control.getCenterOnWorldBound(a)}}this.control.onDrag=false;this.control.viewportInfo.lastCursorPosUp=b;if(this.control.activeTool){this.control.activeTool.MouseUp(d,this.control)}},MouseClick:function(a){if(this.control.activeTool){this.control.activeTool.MouseClick(a,this.control)}},MouseDblClick:function(a){if(this.control.activeTool){this.control.activeTool.MouseDblClick(a,this.control)}},GestureStart:function(a){if(this.control.activeTool){this.control.activeTool.GestureStart(a,this.control)}},GestureEnd:function(a){if(this.control.activeTool){this.control.activeTool.GestureEnd(a,this.control)}},GestureChange:function(a){if(this.control.activeTool){this.control.activeTool.GestureChange(a,this.control)}},zoomIn:function(){var a=this.viewportInfo.levelIndex+1;if(typeof(global)!="undefined"&&typeof(global.star_pos)!="undefined"){var e=this.viewportInfo;var d=e.viewportGeoToScreen(global.star_pos);var f=this.getCursorDistanceFromCenter(d);var b=this.mapManager.getMapLayerByLevel(a,e.centerGeo.lon,e.centerGeo.lat);this.wheelCenter(b.scale,f,global.star_pos)}if(a<=this.mapManager.getLength()&&1<=a){this.updateMapLayerByLevel(a);this.requestForRedraw(1)}},zoomOut:function(){var a=this.viewportInfo.levelIndex-1;if(typeof(global)!="undefined"&&typeof(global.star_pos)!="undefined"){var e=this.viewportInfo;var d=e.viewportGeoToScreen(global.star_pos);var f=this.getCursorDistanceFromCenter(d);var b=this.mapManager.getMapLayerByLevel(a,e.centerGeo.lon,e.centerGeo.lat);this.wheelCenter(b.scale,f,global.star_pos)}if(a<=this.mapManager.getLength()&&1<=a){this.updateMapLayerByLevel(a);this.requestForRedraw(1)}},getInfo:function(a){this.viewportInfo.init(null,this.projection,a);this.rebuildCanvasInfo(a);if(this.mapAPI!=null){this.mapAPI._updateInfo(this)}return this.viewportInfo},rebuildCanvasInfo:function(k){this.canvasInfo=SD.util.clone(this.viewportInfo);if(this.canvasInfo.centerScreen.x==0&&this.canvasInfo.centerScreen.y==0){this.canvasInfo.init(null,this.projection)}var f=this.canvasInfo.getCanvasRect();var i=this.canvasInfo.getCanvasSize();var e=Math.ceil(f.left/i.x);var d=Math.ceil(f.top/i.y);var j=e+Math.ceil(this.canvasInfo.canvasSize.width/i.x);var g=d+Math.ceil(this.canvasInfo.canvasSize.height/i.y);var h=new Rectangle(0,0,0,0);h.top=(d-1)*i.y;h.left=(e-1)*i.x;h.right=(j)*i.x;h.bottom=(g)*i.y;var a=new Rectangle(0,0,0,0);a.left=h.left-f.left;a.top=h.top-f.top;a.setWidth((j-e+1)*i.x);a.setHeight((g-d+1)*i.y);this.canvasInfo.topLeftContainer=this.viewportLayer.rect;this.canvasInfo.offsetContainer={x:a.left-this.viewportLayer.rect.x,y:a.top-this.viewportLayer.rect.y};this.canvasInfo.mapConfigBounds=f;this.canvasInfo.topLeftOverlay={x:this.canvasInfo.topLeftScreen.x+this.viewportLayer.rect.x,y:this.canvasInfo.topLeftScreen.y+this.viewportLayer.rect.y};this.canvasInfo.mapRowCols=new Rectangle(e,d,j,g);this.canvasInfo.pixelMargin=new Rectangle(-i.x,-i.y,(j-e)*i.x,(g-d)*i.y);this.canvasInfo.mapTileBounds=a;this.canvasInfo.mapTileSize=i;this.canvasInfo.recalculate();return this.canvasInfo},update:function(){this.container.update(this.canvasInfo)},draw:function(){this.viewportInfo.mapConfig.ratio=1;this.getInfo();var d=this.canvasInfo.mapRowCols;if(d!=null&&this.canvasInfo.mapConfig!=null){var b=this.canvasInfo.mapConfig;var a=b.createList(d.left,d.top,d.right,d.bottom);this.mapLayer.tiles.unReloadImg();this.mapLayer.clear();this.container.setEnable(true);this.zoomLayer.setEnable(false);this.markerStaticLayer.setDraw(true);this.canvasInfo.layer=this.drawLayer;this.canvasInfo.mapList=a;this.viewportLayer.draw(this.canvasInfo,d.top,d.left,d.bottom,d.right)}if(this.OnDraw){this.OnDraw.triggered(this.canvasInfo)}},drawAll:function(){},drawLayer:function(a){this.modelLayers.setDisplay(true);this.modelLayers.refresh(a==undefined?this.getContainerInfo():a)},clearMap:function(){this.zoomLayer.isRender=true;this.zoomLayer.clear();this.zoomLayer.mapList=SD.util.clone(this.mapLayer.tiles);this.mapLayer.clear()},animateMap:function(){this.getInfo();this.container.setEnable(false);this.zoomLayer.setEnable(true);var a=this.canvasInfo.mapRowCols;this.viewportLayer.draw(this.canvasInfo,a.top,a.left,a.bottom,a.right)},moveViewport:function(){this.moveByOffset({x:(this.viewportInfo.lastCursorPosOffset.x),y:(this.viewportInfo.lastCursorPosOffset.y)},true)},getCursorDistanceFromCenter:function(a){if(a==undefined){a=this.viewportInfo.lastCursorPosMove}return{x:-(a.x-this.viewportInfo.canvasSize.width/2),y:-(a.y-this.viewportInfo.canvasSize.height/2)}},endDrag:function(){this.moveByOffset({x:(this.viewportInfo.lastCursorPosUp.x-this.viewportInfo.lastCursorPosMove.x),y:(this.viewportInfo.lastCursorPosUp.y-this.viewportInfo.lastCursorPosMove.y)},false)},moveByOffset:function(b,a){this.panCenter(b,false);if(a){this.viewportLayer.setOffset(b)}else{this.draw()}},animatePanBy:function(g,b){if(this.interval){clearInterval(this.interval)}var d=1,a=this,f={ox:0,oy:0,x:0,y:0},e;this.interval=setInterval(function(){f.x=SD.util.easeInOut({first:0,latest:g.x},b,d);f.y=SD.util.easeInOut({first:0,latest:g.y},b,d);e={x:f.ox-f.x,y:f.oy-f.y};a.moveByOffset(e,true);f.ox=f.x;f.oy=f.y;d++;if(d>b){a.update();window.clearInterval(a.interval)}},50)},animatePanTo:function(b,d){var a=this.viewportInfo.viewportGeoToScreen(b);var e={x:(a.x-this.viewportInfo.canvasSize.width/2),y:(a.y-this.viewportInfo.canvasSize.height/2)};this.animatePanBy(e,d==undefined?10:d)},addControl:function(a){this.realDiv.appendChild(a.getNavigation());this.control=a.control},setLogoToDefault:function(){var a=new SD.util.createImg("",SD.BASE_URL+"img/logo.gif","0px","0px","76px","30px","absolute");var d=new SD.util.createImg("",SD.BASE_URL+"img/copyright.gif","0px","0px","125px","12px","absolute");var b=new SD.util.createImg("",SD.BASE_URL+"img/north.gif","0px","0px","28px","16px","absolute");d.style.cssText="position: absolute; left:0px; bottom: 0px;";b.style.cssText="position: absolute; right: 0px; bottom: 0px;";this.fakeDiv.appendChild(a);this.fakeDiv.appendChild(d);this.fakeDiv.appendChild(b)},getCursorPosition:function(a){return SD.util.getCursorPos(a,this.realDiv)},init:function(b){this.mapManager=new MapManager();this.fakeDiv=typeof b=="string"?document.getElementById(b):b;var a=document.createElement("div");a.style.cssText="position:absolute;left:0px;top:0px;width:100%;"+(SD.isIE6?"":"height:100%;")+"overflow:hidden";this.root=a;this.realDiv=document.createElement("div");this.fakeDiv.style.overflow="hidden";this.fakeDiv.appendChild(this.realDiv);this.viewportInfo.div=this.realDiv;this.realDiv.appendChild(a);if(this.enableDefaultLogo){this.setLogoToDefault()}this.resize(this.fakeDiv.clientWidth==0?parseInt(this.fakeDiv.style.width):this.fakeDiv.clientWidth,this.fakeDiv.clientHeight==0?parseInt(this.fakeDiv.style.height):this.fakeDiv.clientHeight,false);this.hintLayer.addNode(this.infoWindow);this.container.addNode(this.mapLayer);this.container.addNode(this.vectorLayer);this.container.addNode(this.markerStaticLayer);this.container.addNode(this.hintLayer);this.viewportLayer.addNode(this.zoomLayer);this.viewportLayer.addNode(this.container);a.appendChild(this.viewportLayer.div);this.mapLayer.OnCompleted.register(this.zoomLayer.clear,this.zoomLayer);a.control=this;document.control=this;this.updateMapLayerByLevel(this.viewportInfo.levelIndex);this.viewportInfo.lastCursorLatLon=this.viewportInfo.centerGeo;this.fakeDiv.oncontextmenu=function(){return false};if(SD.isIphone){EventManager.add(a,"touchstart",this.MouseDown);EventManager.add(a,"touchmove",this.MouseMove);EventManager.add(a,"touchend",this.MouseUp);EventManager.add(a,"touchcancel",this.MouseUp);EventManager.add(a,"gesturechange",this.GestureChange);EventManager.add(a,"gesturestart",this.GestureStart);EventManager.add(a,"gestureend",this.GestureEnd);this.ActiveTool(new IphonePanTool())}else{EventManager.add(a,"mousedown",this.MouseDown);EventManager.add(document,"mousemove",this.MouseMove);EventManager.add(document,"mouseup",this.MouseUp);EventManager.add(document,"dblclick",this.MouseDblClick);EventManager.add(a,"DOMMouseScroll",this.MouseWheel);EventManager.add(a,"mousewheel",this.MouseWheel)}},resize:function(b,d,a){this.size.width=b;this.size.height=d;this.fakeDiv.style.width=b+"px";this.fakeDiv.style.height=d+"px";this.viewportInfo.canvasSize.width=b;this.viewportInfo.canvasSize.height=d;this.realDiv.style.position="absolute";this.realDiv.style.width=this.viewportInfo.canvasSize.width+"px";this.realDiv.style.height=this.viewportInfo.canvasSize.height+"px";if(SD.isIE6){this.root.style.height=this.viewportInfo.canvasSize.height+"px"}this.realDiv.style.left="0px";this.realDiv.style.top="0px";if(a){this.draw()}}};function DrawingModelCollection(){this.node=[];this.add=function(a){this.node.push(a)};this.remove=function(b){var a=-1;for(var c=0;c<this.node.length;c++){if(this.node[c]==b){a=c;break}}if(a!=-1){this.node.splice(a,1)}};this.refresh=function(b){for(var a=0;a<this.node.length;a++){this.node[a].init(b,a);this.node[a].hit(b)}};this.setDisplay=function(a){for(var b=0;b<this.node.length;b++){this.node[b].setDisplay(a)}};this.panCenter=function(c,d,b){for(var a=0;a<this.node.length;a++){this.node[a].init(c,a);this.node[a].panCenter(c,d,b)}}}function DrawingTool(){this.getPos=function(b,a){return SD.util.getCursorPos(b,a.viewportInfo.div)};this.getOffset=function(b,a){var c=this.getPos(b,a);return new Point(-(c.x-a.viewportInfo.canvasSize.width/2),-(c.y-a.viewportInfo.canvasSize.height/2))};this.isNeedReload=function(d,b,c){var a=Math.abs(b.x-d.x);var g=Math.abs(b.y-d.y);var f=c.width-c.width/4;var e=c.height-c.height/4;if(a>=f||g>=e){return true}return false};this.fixE=function(a){if(typeof a=="undefined"){a=window.event}return a}}DrawingTool.prototype={MouseUp:function(b,a){},MouseDown:function(b,a){},MouseMove:function(b,a){},MouseWheel:function(b,a){},MouseDblClick:function(b,a){}};SD.extend(DraggableTool,DrawingTool);function DraggableTool(){var d=null;var b=false;var a=null;var c=null;var e={};this.name="drag tool";this.init=function(i,g,f){d=i;e=f;c=g.ActiveTool();var h=this;EventManager.add(d,"mousedown",function(j){g.ActiveTool(h)});EventManager.add(d,"dblclick",function(j){g.ActiveTool(c)})};this.MouseDown=function(g,f){if(SD.util.getMouseButton(g)=="LEFT"){b=true}return false};this.MouseMove=function(g,f){if(SD.util.getMouseButton(g)=="LEFT"&&b){d.setOffset(f.viewportInfo.lastCursorPosOffset,f.viewportInfo.scale);if(e!=null&&e.MouseMove!=undefined){e.MouseMove(g,f)}clearInterval(a);var h=SD.util.isNearBoundary(d.getPtPosition(),f.viewportInfo.canvasSize,f.canvasInfo.topLeftContainer);if(h){a=setInterval(function(){d.setOffset({x:-h.x,y:-h.y},f.viewportInfo.scale);f.moveByOffset({x:h.x,y:h.y},true);f.update()},10)}}g.returnValue=false};this.MouseUp=function(i,f){var h=f.viewportInfo.lastCursorPosDown;var g=f.viewportInfo.lastCursorPosUp;var j=g.x==h.x&&g.y==h.y?true:false;if(b&&!j){d.updatePosition(f.canvasInfo);if(e!=null&&e.MouseUp!=undefined){e.MouseUp(i,f)}f.ActiveTool(f.defaultTool)}clearInterval(a);a=null;b=false;return false}}function ViewportPanTool(){this.limitedPanning=true;var b=false;var e=new Timer();var f=new AnimateZoom();var d=false;var c=false;var a=null;setInterval(function(){g()},150);var g=function(){if(d){if(c){c=false;return}d=false;if(a!=null){a.update()}}};this.MouseClick=function(i,h){var j="-moz-grab";if(!SD.isSvg){j="url('"+SD.BASE_URL+"img/openhand.cur'), default"}h.fakeDiv.style.cursor=j};this.MouseDown=function(i,h){if(SD.util.getMouseButton(i)=="LEFT"){b=true;var j="-moz-grabbing";if(!SD.isSvg){j="url('"+SD.BASE_URL+"img/closedhand.cur'), default"}h.fakeDiv.style.cursor=j}return false};this.MouseMove=function(i,h){if(!b){return}a=h;if(SD.util.getMouseButton(i)=="LEFT"&&b){h.moveViewport();d=true;c=true}else{var j="-moz-grab";if(!SD.isSvg){j="url('"+SD.BASE_URL+"img/openhand.cur'), default"}window.status=j;h.fakeDiv.style.cursor=j}i.returnValue=false};this.MouseUp=function(l,i){var h=SD.util.getMouseButton(l);var k=i.viewportInfo.lastCursorPosDown;var j=i.viewportInfo.lastCursorPosUp;var n=j.x==k.x&&j.y==k.y?true:false;if(n){e.moreInterval=true;e.useTimeout=false;e.setTInterval(250);e.start({callback:function(){SD.util.cancelEvent(l);if(h=="LEFT"){i.viewportInfo.lastCursorDelta=1}else{if(h=="RIGHT"){i.viewportInfo.lastCursorDelta=-1}}f.viewport=i;f.displayCross=true;f.scroll=1;f.callback()}})}if(!n&&b){i.OnEndDrag.triggered(i.viewportInfo)}var m="-moz-grab";if(!SD.isSvg){m="url('"+SD.BASE_URL+"img/openhand.cur'), default"}i.fakeDiv.style.cursor=m;b=false;return false};this.MouseWheel=function(i,h){SD.util.cancelEvent(i);var j=0,k=h.viewportInfo.lastCursorDelta;if(k){if(k>0){j=h.getNextLevel(true);h.wheelCenter(j);h.zoomIn()}else{j=h.getNextLevel(false);h.wheelCenter(j);h.zoomOut()}}};this.AnimatedMouseWheel=function(j,i){var h=i.viewportInfo;var k=h.lastCursorDelta;if(k){f.viewport=i;f.displayCross=true;f.panCenter=false;f.scroll++;f.preInit();e.moreInterval=false;e.useTimeout=true;e.setTInterval(300);e.start(f)}}}SD.extend(ViewportPanTool,DrawingTool);function IphonePanTool(){var c=false;var g=new AnimateZoom();var f=false;var e=false;var a=null;var d=new Timer();var b={x:0,y:0};setInterval(function(){h()},300);var h=function(){if(f){if(e){e=false;return}f=false;if(a!=null){a.update()}}};this.MouseDown=function(k,j){var n=j.viewportInfo.lastCursorPosDown;j.viewportInfo.lastCursorPosMove=n;a=j;c=true;if(j.viewportInfo.lastCursorLatLon.lon==0){var m=j.viewportInfo.viewportScreenToGeo(n.x,n.y);j.viewportInfo.lastCursorLatLon=j.getCenterOnWorldBound(m)}var l=j.viewportInfo;var i=k.touches.length;var o=l.lastCursorPosOffset.x==b.x&&l.lastCursorPosOffset.y==b.y?true:false;if(o||i==2){if(i==1){d.setTInterval(250);j.viewportInfo.lastCursorDelta=1;g.viewport=j;g.displayCross=false;g.panCenter=true;g.scroll++;d.moreInterval=true;d.useTimeout=false;d.start(g)}else{if(i==2){j.viewportInfo.lastCursorDelta=-1;g.scroll++;g.callback()}}}b=l.lastCursorPosOffset};this.MouseMove=function(l,i){a=i;if(c){i.moveViewport();f=true;e=true}var k=i.viewportInfo.lastCursorPosDown;var j=i.viewportInfo.lastCursorPosUp;var m=j.x==k.x&&j.y==k.y?true:false;if(!m&&c){i.OnEndDrag.triggered(i.viewportInfo)}};this.MouseUp=function(j,i){a=i;c=false};this.GestureStart=function(j,i){if(j.preventDefault){j.preventDefault()}c=false};this.GestureEnd=function(j,i){};this.GestureChange=function(j,i){if(j.preventDefault){j.preventDefault()}i.viewportInfo.lastCursorDelta=j.scale>1?1:-1;g.viewport=i;g.displayCross=false;g.panCenter=true;g.scroll++;g.callback()}}SD.extend(IphonePanTool,DrawingTool);function AnimateZoom(){this.viewport=null;this.scroll=0;this.aScale={first:0,latest:0};this.panCenter=false;this.displayCross=true;var c=null;var a=null;var b={offset:null,cursor:null,geo:null};this.init=function(){if(c==null){var d=this.viewport.viewportInfo.canvasSize;c={};c.h=document.createElement("div");c.v=document.createElement("div");c.h.style.cssText="border-style: solid none none none; border-color:rgb(5, 137, 79); width: "+d.width+"px; border-width:1px; height: 1px; position: absolute; left: 0px; top: 0p; display:none";c.v.style.cssText="border-style: none solid none none; border-color:rgb(5, 137, 79); width: 1px; height: "+d.height+"px; border-width:1px; position: absolute; left: 0px; top: 0p; display:none";this.viewport.viewportInfo.div.appendChild(c.h);this.viewport.viewportInfo.div.appendChild(c.v)}};this.setCrossDisplay=function(e){var d="";if(!e){d="none"}else{c.h.style.width=this.viewport.viewportInfo.canvasSize.width+"px";c.v.style.height=this.viewport.viewportInfo.canvasSize.height+"px"}c.h.style.display=d;c.v.style.display=d};this.setCrossCursor=function(d){if(!this.displayCross||d==null){return}this.setCrossDisplay(true);c.h.style.top=d.y+"px";c.v.style.left=d.x+"px"};this.animate=function(e,d){if(a){clearInterval(a)}var f=0,g=this;a=setInterval(function(){g.setCrossCursor(b.cursor);if(f==0){g.viewport.viewportLayer.setTopLeft({x:0,y:0});g.viewport.clearMap()}var j=SD.util.easeInOut(g.aScale,e,f);var i=g.viewport.viewportInfo.mapConfig.scale/j;i=f==0&&i==1?0.99:i;var h=i>=0.1&&g.aScale.latest!=0;if(h){if(!g.panCenter){g.viewport.wheelCenter(j,b.offset,b.geo)}g.viewport.viewportInfo.mapConfig.ratio=i;g.viewport.setScale(j);g.viewport.animateMap()}f++;if(f>e||i<0.09){g.zoomViewport(d);window.clearInterval(a);a=null}},20)};this.zoomViewport=function(d){this.setCrossDisplay(false);this.viewport.setLevel(d?this.viewport.viewportInfo.levelIndex+1:this.viewport.viewportInfo.levelIndex-1);if(!this.panCenter){this.viewport.wheelCenter(this.aScale.latest,b.offset,b.geo)}if(this.aScale.latest==0){return}this.viewport.updateMapLayerByNearest(this.aScale.latest);this.viewport.draw();this.scroll=0;this.aScale={first:0,latest:0};b={offset:null,cursor:null,geo:null}};this.preInit=function(){if(this.scroll==1){b.offset=this.viewport.getCursorDistanceFromCenter();b.geo=this.viewport.viewportInfo.lastCursorLatLon;b.cursor=this.viewport.viewportInfo.lastCursorPosMove}};this.callback=function(){this.init();var g=this.viewport.viewportInfo.lastCursorDelta;var e=this.viewport.viewportInfo.levelIndex;if(this.scroll>5){if(g>0){this.viewport.setLevel(e+1)}else{this.viewport.setLevel(e-1)}}this.aScale.first=this.viewport.viewportInfo.scale;this.aScale.latest=this.viewport.getNextLevel(g>0?true:false);if(this.aScale.latest==-1){if(this.scroll>5){this.viewport.setLevel(g>0?e-1:e+1)}this.scroll=0;b={offset:null,cursor:null,geo:null}}else{if(this.aScale.first!=this.aScale.latest){var f=Math.abs(this.aScale.first-this.aScale.latest);this.animate(f<4?2:3,g>0)}else{this.scroll=0;b={offset:null,cursor:null,geo:null}}}}}function Timer(){this.moreInterval=true;this.useTimeout=false;var c={interval:25,time:null,deviation:0};var b=null,a=0;this.setTInterval=function(d){c.interval=d};this.isRender=function(){if(c.time!=null){var d=new Date();c.deviation=d.getTime()-c.time.getTime();if(!this.useTimeout){c.time=d}if(c.deviation==0){return false}if((this.moreInterval&&c.deviation<c.interval)||(!this.moreInterval&&c.deviation>=c.interval)){return true}}return false};this.reset=function(){c.deviation=0;a=0;if(b&&this.useTimeout){window.clearTimeout(b)}b=null};this.hit=function(d){var e=this;if(b&&this.useTimeout){window.clearTimeout(b)}if(this.isRender()){if(d!=undefined&&d.callback){d.callback();this.reset()}}else{if((this.moreInterval&&c.deviation>c.interval)||(!this.moreInterval&&c.deviation>1000)){this.reset()}else{if(this.useTimeout){a++;b=window.setTimeout(function(){e.hit(d)},50)}}}};this.start=function(d){if(c.time==null||this.useTimeout){c.time=new Date()}this.hit(d)}};function Thumbnail(a){this.fakeDiv=null;this.mainViewport=a;this.size={width:174,height:119};this.root=null;this.imgThumb=null;this.controlBox=null;this.lastMap=null;this.scale=null;this.level1={minlong:-179.559936,maxlong:180.4402483,minlat:-85,maxlat:84.6015693,area:"wrd",img:"WorldMap.gif",wa:156,ha:130,defaults:{minlong:-179.559936,maxlong:180.4402483,minlat:-85,maxlat:84.6015693,area:"wrd",img:"WorldMap.gif",wa:156,ha:130}};this.level6={minlong:92.1063388,maxlong:143.228317,minlat:-15.2542781,maxlat:25.4995186,area:"asia",img:"AsiaPacific.gif",wa:175,ha:135,defaults:{minlong:92.1063388,maxlong:143.228317,minlat:-15.2542781,maxlat:25.4995186,area:"asia",img:"AsiaPacific.gif",wa:175,ha:135}};this.level7={minlong:new Array(103.609808585,99.8775892772213,114.60302,94.8548488),maxlong:new Array(104.088063761,104.798933294303,127.83109,138.500811),minlat:new Array(1.19945734487,0.488452007561393,4.493315,-16.4249214),maxlat:new Array(1.47421033298,5.43466544153992,18.711014,14.2910547),area:new Array("sg","sgbtmkl","ph","indonesia"),wa:new Array(174,126,124,176),ha:new Array(119,126,135,122),img:new Array("Singapore.gif","SgBtmKl.gif","Philipine.gif","Indonesia.gif"),defaults:{minlong:99.8775892772213,maxlong:104.798933294303,minlat:0.488452007561393,maxlat:5.43466544153992,wa:126,ha:126,area:"sgbtmkl",img:"SgBtmKl.gif"}};this.level8={minlong:new Array(103.609808585,106.334759848859,100.167825048,103.615691745,102.117949882,99.632218768,114.438986201,101.281112675385,103.674636380005,120.704948,123.700577),maxlong:new Array(104.088063761,107.302213789158,100.549782421,104.003560947,102.364870407,99.9451254051,115.735151469,101.876419476806,104.697736191084,121.388196,124.075652),minlat:new Array(1.19945734487,-6.80801456270435,5.17892845377,1.30198487248,2.13866765987,6.16497749908,-8.84114745365,2.71610121729173,0.514738655827094,14.336608,10.212236),maxlat:new Array(1.47421033298,-5.90597584876709,5.55582104785,1.7052367493,2.40976800774,6.4837532556,-8.04351119209,3.24483890824036,1.22266865034214,14.794117,10.544826),area:new Array("sg","jkt","png","jb","mlk","lkw","bali","kl","btm","manila","cebu"),wa:new Array(174,131,140,140,140,140,176,143,174,201,154),ha:new Array(119,122,140,140,140,140,122,144,119,138,138),img:new Array("Singapore.gif","jkt.gif","png.gif","jb.gif","mlk.gif","lkw.gif","Indonesia.gif","kl.gif","btm.gif","manila.gif","cebu.gif"),defaults:{minlong:99.8775892772213,maxlong:104.798933294303,minlat:0.488452007561393,maxlat:5.43466544153992,wa:126,ha:126,area:"sgbtmkl",img:"SgBtmKl.gif"}};this.offsetcm=[{x:-3,y:4.7},{x:-3,y:4.7},{x:-3,y:4.7},{x:-3,y:-8},{x:-3,y:-5},{x:-5,y:-3},{x:-3,y:4.7},{x:-3,y:4.7},{x:-3,y:4.7},{x:-3,y:-2},{x:-5,y:-1},{x:-2,y:-2},{x:-5.5,y:-1},{x:-5.5,y:-1}];this.offsetc=[{x:8,y:-7},{x:7,y:-3},{x:8,y:7},{x:8,y:7},{x:8,y:7},{x:5,y:7},{x:6,y:4},{x:4,y:6},{x:4,y:5},{x:4,y:6},{x:4,y:6},{x:4,y:10},{x:4,y:10},{x:4,y:10}];this.init()}Thumbnail.prototype.init=function(){var c=this;this.fakeDiv=document.createElement("div");this.fakeDiv.style.cssText="position: absolute; overflow: hidden; right:0px; bottom:0px; width: "+(this.size.width+3)+"px; height: "+(this.size.height+3)+"px; border-left: 1px solid rgb(151, 151, 151); border-top: 1px solid rgb(151, 151, 151); background-color: #ffffff; display:none;";var g={x:-10,y:-10};var a=document.createElement("div");a.ondragstart=function(){return false};a.onselectstart=function(){return false};a.style.cssText="position: absolute; overflow: hidden; width: "+this.size.width+"px; height: "+this.size.height+"px; bottom: 0px; left: 3px; border-left: 1px solid rgb(151, 151, 151); border-top: 1px solid rgb(151, 151, 151); cursor: pointer;";a.onmousedown=function(j){global.update_star=true;var i=SD.util.getCursorPos(j,this);c.configureMap(i);e.style.left=i.x+g.x+"px";e.style.top=i.y+g.y+"px";global.update_star=false};var e=document.createElement("div");e.drag=false;e.pos={x:this.size.width/2-7,y:this.size.height/2-7};e.style.cssText="position:absolute; left:"+e.pos.x+"px; top:"+e.pos.y+"px; border: 2px solid rgb(136, 136, 255); width: 14px; height: 14px; z-index:10; background: transparent url(/dragmap/xg/img/x.gif) repeat scroll 0 0; cursor: move;  z-index: 3;";e.onmousedown=function(i){this.drag=true;SD.util.cancelEvent(i)};e.onmouseout=function(j){if(checkMouseLeave(this,j)){if(this.drag){global.update_star=true;var i=SD.util.getCursorPos(j,a);c.configureMap(i);e.style.left=i.x+g.x+"px";e.style.top=i.y+g.y+"px";this.drag=false}}};e.onmouseup=function(j){if(this.drag){global.update_star=true;var i=SD.util.getCursorPos(j,a);c.configureMap(i);e.style.left=i.x+g.x+"px";e.style.top=i.y+g.y+"px"}this.drag=false};e.onmousemove=function(i){if(this.drag){var j=SD.util.getCursorPos(i,a);this.style.left=j.x+g.x+"px";this.style.top=j.y+g.y+"px"}};this.controlBox=e;var h=document.createElement("img");h.style.cssText="border: 0px; width: "+this.size.width+"px; height: "+this.size.height+"px; z-index: 2;";h.ondragstart=function(){return false};h.onselectstart=function(){return false};this.imgThumb=h;var b=document.createElement("div");b.drag=false;b.pos={x:this.size.width-16,y:this.size.height-16};b.style.cssText="position: absolute; overflow: hidden; width: 15px; height: 15px; bottom: "+(SD.isIE?"-5":"-4")+"px; right: "+(SD.isIE?"-5":"-3")+"px; cursor: pointer; z-index:1;border-bottom:1px solid #ffffff;";b.onmousedown=function(i){if(c.fakeDiv.style.display!=""){c.fakeDiv.style.display="";c.imgThumbClose.style.display="none";c.imgThumbShow.style.display=""}else{c.fakeDiv.style.display="none";c.imgThumbClose.style.display="";c.imgThumbShow.style.display="none"}SD.util.cancelEvent(i)};b.onmouseout=function(i){};var d=document.createElement("img");d.src="http://"+location.hostname+"/dragmap/xg/img/thumb_max.gif";d.style.cssText="";this.imgThumbClose=d;var f=document.createElement("img");f.src="http://"+location.hostname+"/dragmap/xg/img/thumb_min.gif";f.style.cssText="display:none;";this.imgThumbShow=f;b.appendChild(f);b.appendChild(d);this.mainViewport.fakeDiv.appendChild(b);a.appendChild(h);a.appendChild(e);this.root=a;this.fakeDiv.appendChild(a);this.mainViewport.fakeDiv.appendChild(this.fakeDiv);this.configure()};Thumbnail.prototype.changeMap=function(c,b){var a=this;this.imgThumb.style.display="none";this.imgThumb.onload=function(){this.style.display=""};this.imgThumb.src=c;this.size=b;this.fakeDiv.style.width=this.size.width+3+"px";this.fakeDiv.style.height=this.size.height+3+"px";this.root.style.width=this.imgThumb.style.width=this.size.width+"px";this.root.style.height=this.imgThumb.style.height=this.size.height+"px"};Thumbnail.prototype.configure=function(){var g=this.mainViewport.viewportInfo.levelIndex,d,f,b,e,c,a;d=(this.detectMapName()==false)?this.lastMap:this.detectMapName();f="http://"+location.hostname+"/dragmap/xg/img/"+d.img;if(this.imgThumb.src!=f){this.changeMap(f,{width:d.wa,height:d.ha});this.lastMap=d}e=this.getThumbnailScale(this.lastMap.area);a=(global.star_pos==undefined||1)?this.mainViewport.viewportInfo.centerGeo:global.star_pos;this.scale=e;c={x:(a.lon-e.minLong)/e.x-this.offsetc[g-1].x,y:(e.maxLat-a.lat)/e.y-this.offsetc[g-1].y};this.controlBox.style.left=c.x+"px";this.controlBox.style.top=c.y+"px"};Thumbnail.prototype.detectMapName=function(){last_ll=(global.star_pos==undefined||1)?this.mainViewport.viewportInfo.centerGeo:global.star_pos;var g=(last_ll.lon!=0&&last_ll.lat!=0)?last_ll:this.mainViewport.viewportInfo.centerGeo,a=this.mainViewport.viewportInfo.levelIndex,d,k,b,h,c;if(a==1||a==2||a==3||a==4||a==5){return{minlong:-179.559936,maxlong:180.4402483,minlat:-85,maxlat:84.6015693,area:"wrd",img:"WorldMap.gif",wa:156,ha:130}}else{if(a==6){return{minlong:92.1063388,maxlong:143.228317,minlat:-15.2542781,maxlat:25.4995186,area:"asia",img:"AsiaPacific.gif",wa:175,ha:135}}else{if(a>=7){var j=(a==7)?this.level7:this.level8;d=j.minlong;b=j.maxlong;k=j.minlat;h=j.maxlat;c=j.area;var f=0,e=c.length;for(f=0;f<e;f++){if(g.lon>=d[f]&&g.lon<b[f]&&g.lat>=k[f]&&g.lat<h[f]){return{minlong:d[f],maxlong:b[f],minlat:k[f],maxlat:h[f],area:c[f],img:j.img[f],wa:j.wa[f],ha:j.ha[f]}}}return{minlong:j.defaults.minlong,maxlong:j.defaults.maxlong,minlat:j.defaults.minlat,maxlat:j.defaults.maxlat,area:j.defaults.area,img:j.defaults.img,wa:j.defaults.wa,ha:j.defaults.ha}}}}return false};Thumbnail.prototype.getThumbnailScale=function(k){var a=this.mainViewport.viewportInfo.levelIndex,t,c,l,d,s,b,q,f,j,p,r,g,e,u;if(a==1||a==2||a==3||a==4||a==5||a==6){u=(a==6)?this.level6:this.level1;t=u.minlong;c=u.maxlong;d=u.maxlat;l=u.minlat;j=u.wa;p=u.ha}else{if(a>=7){u=(a==7)?this.level7:this.level8;r=u.area;g=u.wa;e=u.ha;s=u.minlong;b=u.maxlong;q=u.minlat;f=u.maxlat;var o=0,m=r.length;for(o=0;o<m;o++){if(r[o]==k){t=s[o];c=b[o];l=q[o];d=f[o];j=g[o];p=e[o];break}}if(t==null&&c==null&&l==null&&d==null&&j==null&&p==null){t=u.defaults.minlong;c=u.defaults.maxlong;l=u.defaults.minlat;d=u.defaults.maxlat;j=u.defaults.wa;p=u.defaults.ha}}}return this.getScale({maxLong:c,minLong:t,maxLat:d,minLat:l,totalMapCol:1,mapTileWidth:j,mapTileHeight:p})};Thumbnail.prototype.getScale=function(a){return{x:((a.maxLong-a.minLong)/(a.totalMapCol*a.mapTileWidth)),y:((a.maxLat-a.minLat)/(a.totalMapCol*a.mapTileHeight)),minLong:a.minLong,maxLat:a.maxLat}};Thumbnail.prototype.configureMap=function(c){var b=this.mainViewport.viewportInfo.levelIndex;var a={lon:this.scale.x*(c.x+this.offsetcm[b-1].x)+this.scale.minLong,lat:this.scale.maxLat-this.scale.y*(c.y+this.offsetcm[b-1].y)};MapAPI.setCenter(a,get_level())};function MapSlider(a){this.minValue=0;this.maxValue=100;this.width=0;this.height=0;this.position={top:0,left:0};this.value=50;this.increment=1;this.renderTo=null;this.button=null;this.obj=null;this.dragging=false;this.vertical=false;this.drag={start:0,end:0};SD.apply(this,a)}MapSlider.prototype.init=function(){this.obj=document.createElement("div");this.obj.style.cssText="position:absolute;top:"+this.position.top+"px;left:"+this.position.left+"px;width:38px; height:"+this.height+"px; cursor:pointer;";this.button.size={width:18,height:13};this.renderTo.appendChild(this.obj);this.obj.appendChild(this.button);this.obj.attribute=this;this.button.attribute=this;EventManager.add(this.obj,"click",function(a){var b=SD.util.getCursorPos(a,this.attribute.obj);this.attribute.button.style.top=b.y+"px";this.attribute.onDragEnd(a)});EventManager.add(this.button,"mousedown",this.mouseDown)};MapSlider.prototype.mouseDown=function(a){if(SD.util.getMouseButton(a)=="LEFT"){this.attribute.dragging=true;this.attribute.drag.start=SD.util.getCursorPos(a,this.attribute.obj);document.attribute=this.attribute;EventManager.add(document,"mousemove",this.attribute.mouseMove);EventManager.add(document,"mouseup",function(b){this.attribute.dragging=false;this.attribute.onDragEnd(b);this.attribute.drag.start={start:0,end:0}});cancelEvent(a)}};MapSlider.prototype.setFromWheel=function(a){this.setValue(a*this.increment,true)};MapSlider.prototype.setValue=function(c,f){if(c<this.minValue){c=this.minValue}if(c>this.maxValue){c=this.maxValue}var e=c%this.increment,b=c;if(e>0){if(e>(this.increment/2)){b=c+(this.increment-e)}else{b=c-e}}this.value=b;var i=this.maxValue-this.minValue;var h,d,j=this.button.size;if(this.vertical){d=(this.width-j.width)/2+"px";h=(this.height-j.height)*(this.value-this.minValue)/i+"px"}else{d=(this.width-j.width)*(this.value-this.minValue)/i+"px";h=(this.height-j.width)/2+"px"}this.button.style.top=h;this.button.style.left=d;if(this.callback&&!f){var a=this.callback(this.value/this.increment);if(!a){var g=this.viewport.viewportInfo.levelIndex;this.setValue(g*this.increment,true)}}};MapSlider.prototype.mouseMove=function(a){if(SD.util.getMouseButton(a)=="LEFT"&&this.attribute.dragging==true){if(this.attribute.vertical){var c=SD.util.getCursorPos(a,this.attribute.obj);var b=this.attribute.obj.offsetHeight-this.attribute.button.offsetHeight;if(c.y<b&&c.y>0){this.attribute.button.style.top=c.y+"px"}if(c.y>this.attribute.height&&c.y<0){this.attribute.dragging=false}}}a.returnValue=false};MapSlider.prototype.onDragEnd=function(f){var b=this;var a=b.maxValue-b.minValue;var c;if(!b.vertical){c=b.obj.offsetWidth-b.button.offsetWidth}else{c=b.obj.offsetHeight-b.button.offsetHeight}var d=((parseInt(b.button.style.top)+b.button.offsetHeight)/c)*a;b.setValue(d)};function MapControl(a){this.map=a;this.slider=null;this.nav=new Array();this.createContainer=function(e,g,d,f,c,b){return new SD.util.createDiv("",e,g,d,f,"absolute",c,b)};this.createControl=function(d,g,e,f,b){var c=new SD.util.createImg("",d,g+"px",e+"px","","","absolute");c.style.cursor="pointer";if(f){c.style.width=f+"px"}if(b){c.style.height=b+"px"}c.map=this.map;c.control=this;return c};this.createControl2=function(g,l,f,m,b,c,d,i,j,k){var e=new SD.util.createImgSprite(g,l,f,m,b,c,d,i,j,k);e.map=this.map;e.control=this;this.nav.push(e);return e};this.getZoomControl=function(){var c=new SD.util.createDiv("","0px","0px","50px","80px","relative",11);var d=this;var b=this.createControl2("map_legend",14,13,0,435,11,-22,"cursor: pointer;opacity:1;filter:alpha(opacity=100);",248,300);EventManager.add(b,"click",function(){this.map.viewport.zoomIn();global.update_star=true});var e=this.createControl2("map_legend",14,13,0,402,11,-294,"cursor: pointer;opacity:1;filter:alpha(opacity=100);",248,300);EventManager.add(e,"click",function(){this.map.viewport.zoomOut();global.update_star=true});c.appendChild(b);c.appendChild(e);return c};this.getZoomControl2=function(){var c=new SD.util.createDiv("","0px","0px","50px","50px","relative",11);var d=this;var b=this.createControl(SD.BASE_URL+"/img/plus.png",11,0,25,25);EventManager.add(b,"click",function(){this.map.viewport.zoomIn()});var f=this.createControl(SD.BASE_URL+"/img/minus.png",11,30,25,25);EventManager.add(f,"click",function(){this.map.viewport.zoomOut()});var e=this.createControl(SD.BASE_URL+"/img/share_location_default.png",11,60,25,25);EventManager.add(e,"click",function(){if(this.loc==true){this.src=SD.BASE_URL+"/img/share_location_default.png";this.loc=false;icons.remove_group("loc_icon");navigator.geolocation.clearWatch(watchId)}else{if(navigator.geolocation&&navigator.onLine){watchId=navigator.geolocation.watchPosition(function(h){var g=h.coords.longitude,k=h.coords.latitude;icons.create({image:SD.BASE_URL+"/img/point.png",x:g,y:k,w:120,h:120},"loc_icon");e.src=SD.BASE_URL+"/img/share_location_active.png";var j=detectWhereAreYou(),i;if(j=="wrd"||j=="asia"){i=6}else{i=12}MapAPI.setCenter(new GeoPoint(g,k),i);e.loc=true})}}});c.appendChild(b);c.appendChild(f);c.appendChild(e);return c};this.getShareLocation=function(){var b=new SD.util.createDiv("","0px","0px","50px","50px","relative",11);var d=this;var f=this.createControl2("iphone_tool",33,34,43,0,12,80,"",248,300);f.id="iphone_set_location";var c=new SDIphoneBubble(),e="";EventManager.add(f,"click",function(){if(global.loc==true){f.style.backgroundPosition="0px 0px";global.loc=false;icons.remove_group("loc_icon");navigator.geolocation.clearWatch(watchId)}else{if(navigator.geolocation){watchId=navigator.geolocation.watchPosition(function(k){var s=k.coords.longitude,r=k.coords.latitude,g=MapAPI.viewportInfo.levelIndex,n=get_screen_size(),q=getCookie("last_current_location");var l=($("drag_map")?$("drag_map").offsetWidth-1:0),h=((window.navigator.standalone)?n[1]-60:n[1])+28;var j="reset_from_search();point_to_place("+l+","+h+"); setTimeout(function () { window.scrollTo(0, 1); } ,500);";icons.remove_group("loc_icon");var p=icons.create({image:SD.BASE_URL+"/img/point.png",x:s,y:r,w:120,h:120},"loc_icon");f.className="iphone_tool";f.style.backgroundPosition="-43px 0px";if(f.loc==undefined||g<7){var i=detectWhereAreYou(),o;if(i=="wrd"||i=="asia"){o=6}else{o=12}}else{o=g}MapAPI.setCenter(new GeoPoint(s,r),o);f.loc=true;e='<div align="left" id="photo_containers"><div style="font-size:16px;font-weight:bold;color:#ffffff;" ontouchstart="this.style.color=\'#3B7CEF\';" ontouchend="this.style.color=\'#ffffff\';'+j+'" >Current Location</div><div style="font-size:12px;"></div></div>';var m={content:e,w:250,h:50,point:new Point(s,r),options:{arrow_style:2,bo:new Point(0,0)}};icons.action(p,"click",function(){c.open(p,m)});icons.action(p,"touchend",function(){c.open(p,m)});global.loc=true})}}});f.ontouchstart=function(){f.style.backgroundPosition="-0px -89px";f.style.height="43px";f.style.width="43px"};f.ontouchend=function(){if(global.loc==true){f.style.backgroundPosition="0px 0px"}else{f.style.backgroundPosition="-43px 0px"}f.style.height="34px";f.style.width="33px"};b.appendChild(f);return b};this.getZoomControlIphone=function(){var c=new SD.util.createDiv("","0px","0px","50px","50px","relative",11);var e=this;var b=this.createControl2("iphone_tool",35,35,131,0,11,0,"",248,300);var d=document.createElement("div");d.className="iphone_tool";d.style.width="35px";d.style.height="35px";d.style.backgroundPosition="-45px -44px";d.style.display="none";d.style.position="absolute";d.style.left="11px";d.style.top="0px";EventManager.add(b,"click",function(){if(MapAPI.viewportInfo.levelIndex<=13){this.map.viewport.zoomIn()}if((MapAPI.viewportInfo.levelIndex)>13){b.style.display="none";d.style.display=""}else{if((MapAPI.viewportInfo.levelIndex)>1){g.style.display="";f.style.display="none"}}});b.ontouchstart=function(){if(MapAPI.viewportInfo.levelIndex<=13){b.style.backgroundPosition="-108px -89px";b.style.width="45px";b.style.height="45px"}};b.ontouchend=function(){if(MapAPI.viewportInfo.levelIndex<=13){b.style.backgroundPosition="-131px 0px";b.style.width="35px";b.style.height="35px"}};var g=this.createControl2("iphone_tool",35,35,86,0,11,50,"",248,300);var f=document.createElement("div");f.className="iphone_tool";f.style.width="35px";f.style.height="35px";f.style.backgroundPosition="0px -44px";f.style.display="none";f.style.position="absolute";f.style.left="11px";f.style.top="50px";EventManager.add(g,"click",function(){if(MapAPI.viewportInfo.levelIndex>=1){this.map.viewport.zoomOut()}if((MapAPI.viewportInfo.levelIndex)==1){g.style.display="none";f.style.display=""}else{if((MapAPI.viewportInfo.levelIndex)<14){b.style.display="";d.style.display="none"}}});g.ontouchstart=function(){if(MapAPI.viewportInfo.levelIndex>=1){g.style.backgroundPosition="-53px -89px";g.style.width="45px";g.style.height="45px"}};g.ontouchend=function(){if(MapAPI.viewportInfo.levelIndex>=1){g.style.backgroundPosition="-86px 0px";g.style.width="35px";g.style.height="35px"}};c.appendChild(b);c.appendChild(g);c.appendChild(d);c.appendChild(f);return c};this.getLevelControl=function(){var e=new SD.util.createDiv("","0px","0px","38px","328px","relative",11);var d=this.createControl2("map_legend",37,328,37,0,0,0,"cursor: pointer;",248,300);var c=this;var b=this.createControl2("map_legend",18,13,18,370,10,(this.map.viewportInfo.levelIndex-1)*18,"cursor: pointer;",248,300);this.slider=new MapSlider({renderTo:d,button:b,width:38,height:267,position:{top:53,left:0},vertical:true,increment:18,minValue:18,maxValue:272,viewport:this.map.viewport,callback:function(l){global.update_star=true;if(global.star_pos!=undefined){var i=this.viewport.viewportInfo;var h=i.viewportGeoToScreen(global.star_pos);var j=this.viewport.getCursorDistanceFromCenter(h);var g=this.viewport.mapManager.getMapLayerByLevel(l,i.centerGeo.lon,i.centerGeo.lat);this.viewport.wheelCenter(g.scale,j,global.star_pos)}var k=this.viewport.updateMapLayerByLevel(l);if(k==undefined){this.viewport.draw()}return k==false?false:true}});this.slider.init();var f=this.slider;this.map.viewport.OnLevelChanged.register(function(g){f.setFromWheel(g.levelIndex,true)},this.slider);e.appendChild(d);return e};this.getSelectedController=function(c,b){if(c==undefined){return false}for(var d=0;d<c.length;d++){if(d==b){c[d].style.border="1px solid #000"}else{c[d].style.border=""}}}}MapControl.instance=null;MapControl.getInstance=function(a){if(MapControl.instance==null){MapControl.instance=new MapControl(a)}return MapControl.instance};function CompleteMapControl(a){this.control=null;a=(a==true)?120:40;this.getNavigation=function(){var b=new SD.util.createDiv("controlLevelBar","9px",a+"px","38px","308px","absolute",11);b.appendChild(this.control.getLevelControl());b.appendChild(this.control.getZoomControl());return b}}function SmallMapControl(a){this.control=null;this.getNavigation=function(){var b=new SD.util.createDiv("","0px","40px","50px","40px","absolute",11);b.appendChild(this.control.getZoomControl2());return b}}function ShareLocationControl(a){this.control=null;this.getNavigation=function(){var b=new SD.util.createDiv("","0px","5px","50px","50px","absolute",11);b.appendChild(this.control.getShareLocation());return b}}function IphoneMapControl(b,a){this.control=null;this.getNavigation=function(){if(a){var c=new SD.util.createDiv("","5px","","50px","40px","absolute",11,"","","120px")}else{var c=new SD.util.createDiv("","0px","","50px","40px","absolute",11,"","","70px")}c.appendChild(this.control.getZoomControlIphone());return c}}function createpowerby(a,b){this.control=null;this.getNavigation=function(){var d=new SD.util.createDiv("","2px",(a-27)+"px","200px","16px","absolute",11);var c=document.createElement("div");c.style.fontFamily="arial";c.style.fontSize="11px";c.style.fontWeight="bold";if(!b){c.innerHTML='<span style="color:#ff0000">Powered by</span> <span style="color:#008a54"><u><i>Streetdirectory.com</i></u></span>'}else{if(b=="my"){c.innerHTML='<span style="color:#ff0000">Powered by</span> <span style="color:#008a54" ><u><i>Streetdirectory.com.my</i></u></span>'}else{if(b=="id"){c.innerHTML='<span style="color:#ff0000">Powered by</span> <span style="color:#008a54" ><u><i>Streetdirectory.co.id</i></u></span>'}}}d.appendChild(c);return d}}function detectWhereAreYou(c,l){var h={lon:c,lat:l};var k=h,b=7,f,p,d,o;var e={minlong:new Array(103.609808585,99.8775892772213,114.60302,94.8548488),maxlong:new Array(104.088063761,104.798933294303,127.83109,138.500811),minlat:new Array(1.19945734487,0.488452007561393,4.493315,-16.4249214),maxlat:new Array(1.47421033298,5.43466544153992,18.711014,14.2910547),area:new Array("sg","sgbtmkl","ph","indonesia"),defaults:{minlong:99.8775892772213,maxlong:104.798933294303,minlat:0.488452007561393,maxlat:5.43466544153992,area:"sgbtmkl",img:"SgBtmKl.gif"}};var a={minlong:new Array(103.609808585,106.334759848859,100.167825048,103.615691745,102.117949882,99.632218768,114.438986201,101.281112675385,103.674636380005,120.704948,123.700577),maxlong:new Array(104.088063761,107.302213789158,100.549782421,104.003560947,102.364870407,99.9451254051,115.735151469,101.876419476806,104.697736191084,121.388196,124.075652),minlat:new Array(1.19945734487,-6.80801456270435,5.17892845377,1.30198487248,2.13866765987,6.16497749908,-8.84114745365,2.71610121729173,0.514738655827094,14.336608,10.212236),maxlat:new Array(1.47421033298,-5.90597584876709,5.55582104785,1.7052367493,2.40976800774,6.4837532556,-8.04351119209,3.24483890824036,1.22266865034214,14.794117,10.544826),area:new Array("sg","jkt","png","jb","mlk","lkw","bali","kl","btm","manila","cebu"),defaults:{minlong:99.8775892772213,maxlong:104.798933294303,minlat:0.488452007561393,maxlat:5.43466544153992,area:"sgbtmkl",img:"SgBtmKl.gif"}};if(b==1||b==2||b==3||b==4||b==5){return"wrd"}else{if(b==6){return"asia"}else{if(b>=7){var m=(b==7)?e:a;f=m.minlong;d=m.maxlong;p=m.minlat;o=m.maxlat;area=m.area;var j=0,g=area.length;for(j=0;j<g;j++){if(k.lon>=f[j]&&k.lon<d[j]&&k.lat>=p[j]&&k.lat<o[j]){return area[j]}}return m.defaults.area}}}};var EventManager=new EventsManager();function EventsManager(){var a=null;var b=0}EventsManager.prototype.init=function(){if(this.registry!=null){return}this.registry=new Array();this.add(window,"unload",this.unloadEvents)};EventsManager.prototype.add=function(f,d,e,c){this.init();if(typeof f!="object"||typeof e!="function"){return false}f=f.icon!=undefined?f.icon.getObject():(f.getDom!=undefined?f.getDom():f);if(!c){c="EVENT_LABLE_"+(this.last_lable++)}var g=true;var b=false;var h=null;if(f.addEventListener){f.addEventListener(d,e,false)}else{if(f.attachEvent){f["e"+d+e]=e;f[d+e]=function(){f["e"+d+e](window.event)};g=f.attachEvent("on"+d,f[d+e])}else{if(f["on"+d]){var a=f["on"+d];h=function(){e.call(f);a.call(f)}}f["on"+d]=h}}if(g){if(typeof h=="function"){e=h}this.registry[c]={obj:f,eventType:d,func:e};return c}else{return false}};EventsManager.prototype.remove=function(b,a){if(!this.registry[b]){return false}reg=this.registry[b];if(reg.obj.removeEventListener){reg.obj.removeEventListener(reg.eventType,reg.func,false);done=true}else{if(reg.obj.detatchEvent){done=reg.obj.detatchEvent("on"+reg.eventType,reg.func)}else{if(a){reg.obj["on"+reg.eventType]=null;done=true}else{done=false}}}if(done){this.registry[b]=null}return done};EventsManager.prototype.unloadEvents=function(){for(var a in this.registry){if(this.registry[a]==null){continue}this.remove.call(this,a,true)}this.registry=null};function EventDelegates(){this.nodes=[]}EventDelegates.prototype={isAvailable:function(){return this.nodes.length>0?true:false},register:function(b,a){this.nodes.push({fn:b,obj:a})},triggered:function(b){if(!this.isAvailable()){return}for(var a=0;a<this.nodes.length;a++){if(!this.nodes[a]){continue}this.nodes[a].fn.call(this.nodes[a].obj,b)}}};function StdDiv(){this.div=document.createElement("div");this.div.style.cssText="position:absolute; z-Index:0; top:0px; left:0px;";this.rect={x:0,y:0};this.add=function(a){this.div.appendChild(a)};this.remove=function(a){this.div.removeChild(a)};this.getObject=function(){return this.div};this.clear=function(){if(this.div.hasChildNodes()){while(this.div.childNodes.length>=1){var a=this.div.firstChild;if(a){SD.util.purge(a);this.div.removeChild(a)}}}};this.setId=function(a){this.div.setAttribute("id",a)};this.setOffset=function(a){this.rect.x+=a.x;this.rect.y+=a.y;this.div.style.left=this.rect.x+"px";this.div.style.top=this.rect.y+"px"};this.setTopLeft=function(a){this.rect.x=a.x;this.rect.y=a.y;this.div.style.left=a.x+"px";this.div.style.top=a.y+"px"};this.setWidth=function(a){this.div.style.width=a.width+"px";this.div.style.height=a.height+"px"};this.setDisplay=function(a){var b="none";if(a){b=""}this.div.style.display=b}}function StdLayer(){SD.apply(this,new StdDiv());this.node=[];this.enable=true;this.setEnable=function(b){this.enable=b;if(this.node.length==0){return}for(var a=this.node.length-1;a<=0;a--){if(this.node[a]==undefined){break}this.node[a].setEnable(b);this.node[a].setDisplay(b)}this.setDisplay(b)};this.addNode=function(a){if(!a.div){return}this.div.appendChild(a.div);this.node.push(a)};this.replaceNode=function(a,b){for(var c=0;c<this.node.length;c++){if(this.node[c]==a){this.node[c]=b;this.div.replaceChild(b.div,a.div)}}};this.removeNode=function(b){var a=-1;for(var c=0;c<this.node.length;c++){if(this.node[c]==b){a=c;break}}if(a!=-1){this.node.splice(a,1);this.div.removeChild(b.div)}}}function SDLayer(){SD.apply(this,new StdLayer());this.draw=function(a,e,f,c,d){if(!this.enable){return}for(var b=0;b<this.node.length;b++){if(typeof this.node[b].draw=="function"){this.node[b].draw(a,e,f,c,d)}}};this.update=function(a,e,f,c,d){if(!this.enable){return}for(var b=0;b<this.node.length;b++){if(this.node[b].update){this.node[b].update(a,e,f,c,d)}}}}function DrawingLayer(){SD.apply(this,new SDLayer());this.setEnable=function(b){this.enable=b;for(var a=0;a<this.node.length;a++){this.node[a].setEnable(b);this.node[a].setDisplay(b)}this.setDisplay(b)}}function MarkerStaticLayer(){SD.apply(this,new StdLayer());this.setEnable=function(a){this.setDisplay(a)};this.setDraw=function(a){this.enable=a;this.setDisplay(a)};this.draw=function(a,e,f,c,d){if(!this.enable){return}for(var b=0;b<this.node.length;b++){this.node[b].draw(a,e,f,c,d)}this.enable=false}}function MapObject(){SD.apply(this,new StdLayer());this.r=new Rectangle(0,0,0,0);this.bounds=new Rectangle(0,0,0,0);this.tiles=new MapRowCols();this.OnCompleted=new EventDelegates();var b=0;var a=0;this.draw=function(c,f,g,d,e){if(!this.enable){return}if(!this.allow_draw(c)){return false}this.tiles=c.mapConfig.createList(g,f,e,d);this.setDisplay(true);this._draw(c,f,g,d,e)};this.allow_draw=function(c){return true};this.update=function(r){var p=r.mapRowCols;var v=r.mapConfig;var n=this.tiles.node;var h=r.topLeftContainer;var m=r.pixelMargin;var u=m.width();var s=m.height();for(var q=0;q<n.length;q++){var k=n[q].top;var e=n[q].left;var l=n[q].top+h.y;var f=n[q].left+h.x;var c={left:f<m.left,right:f>m.right};var t=l>m.bottom||l<m.top;var o=c.left||c.right;if(t||o){if(t){k+=(l>0?-1:1)*s}if(o){e+=(f>0?-1:1)*u}var g=this.bounds.left+Math.ceil(e/r.mapTileSize.x);var j=this.bounds.top+Math.ceil(k/r.mapTileSize.y);var d=v.getBoundCol(g);n[q].col=g;n[q].row=j;this.reloadImage(j,d,n[q].img,v);if(n[q].img==null){continue}n[q].img.style.position="absolute";n[q].img.style.width=r.mapTileSize.x+"px";n[q].img.style.height=r.mapTileSize.y+"px";n[q].img.style.top=k+"px";n[q].img.style.left=e+"px";n[q].top=k;n[q].left=e}}};this.reloadImage=function(f,e,c,d){if(c==null){return}c.style.display="none";c.onCompleted=this.OnCompleted;c.onload=function(){this.style.display="";b++;if(b==a){this.onCompleted.triggered();b=0}};c.onerror=function(){if((e>=-d.offset&&e<=d.totalMapCol+d.offset)||(f>=-offset&&f<=d.totalMapRow+d.offset)){this.src=SD.BASE_URL+"img/"+d.get_no_map()}else{this.src=SD.BASE_URL+"img/no_map.gif"}};c.src=this.getTileUrl(f,e,d);c.galleryimg="no"};this.getTileUrl=function(e,d,c){return c.getTileUrl(e,d)};this._draw=function(c,m,h,j,e){var l=c.mapConfig;var f;b=0;a=(e-h+1)*(j-m+1);this.bounds=new Rectangle(h,m,e,j);for(var k=h;k<=e;k++){for(var g=m;g<=j;g++){var d=l.getBoundCol(k);f=this.tiles.getMap(g,k,l.name,l.realLevel);if(l.isInRect(g,d)){if(f&&f.img==null){f.img=document.createElement("img");this.div.appendChild(f.img);if(this.cssName!=null){img.className=this.cssName}this.reloadImage(g,d,f.img,l)}}if(!f.img||f.img==null){continue}SD.drawing.setTilePosition(c,this.r,f,k,g,h,m)}}};this.setCC=function(d){if(d==undefined||d==null||d==""){return}var c=this.tiles.node;for(var e=0;e<c.length;e++){if(c[e].img!=null){c[e].img.className=d}}this.cssName=d}}function ZoomObject(){SD.apply(this,new StdLayer());this.r=new Rectangle(0,0,0,0);this.mapList=new MapRowCols();this.isRender=true;this.draw=function(a,j,e,f,c){if(!this.enable){return}var k=a.mapTileSize;var h=a.mapConfig;this.clear();this.setDisplay(true);for(var g=e;g<=c;g++){for(var d=j;d<=f;d++){var b=this.mapList.getMap(d,g,h.name,h.realLevel);if(!b||b.img==null){continue}SD.drawing.setTilePosition(a,this.r,b,g,d,e,j);this.div.appendChild(b.img)}}this.isRender=false}}function LayerObject(){SD.apply(this,new StdLayer());this.r=new Rectangle(0,0,0,0);this.projection=(new SD.projection.Server()).get("UTM WGS-1984 48N");this.getDataUrl=function(c,b,a,d){return"http://sdlocal/api/index.php/layer/data/?s="+a+"&r="+c+"&c="+b+"&l="+d};this.getTileUrl=function(c,b,a,d){return"http://sdlocal/api/index.php/layer/get/?s="+a+"&r="+c+"&c="+b+"&l="+d};this.parseData=function(b,d,a){var f=[],h={name:"",x:0,y:0,px:0,py:0};var e=b.getElementsByTagName("POI");if(e.length==0){return}for(i=0;i<e.length;i++){var c=e.item(i).attributes;h.name=c.getNamedItem("NAME").nodeValue;h.x=parseInt(c.getNamedItem("X").nodeValue);h.y=parseInt(c.getNamedItem("Y").nodeValue);if(h.x>0&&h.y>0){var g=this.projection.metricToScreen(h.x,h.y,a.scale,a.topLeftScreen);h.px=g.x;h.py=g.y}f.push(h)}EventManager.add(d,"mouseover",function(k){var j=SD.util.getCursorPos(k,this);SD.util.debug(j.x+" : "+j.y,true)})};this.draw=function(a,q,j,o,f){if(!this.enable||this.projection.name!=a.projection.name){return}var k=this;var l=0,e=0,m,d;var r=a.mapTileSize;var p=a.mapConfig;m=r.x;d=r.y;this.clear();this.setDisplay(true);for(var n=j;n<=f;n++){for(var g=q;g<=o;g++){if(g<1||n<1||n>p.totalMapCol||g>p.totalMapRow){continue}this.r.left=((n-j)*r.x)+a.offsetContainer.x;this.r.top=((g-q)*r.y)+a.offsetContainer.y;this.r.setWidth(m);this.r.setHeight(d);var c=document.createElement("img");c.style.display="none";c.src=this.getTileUrl(g,n,p.name,p.tileLevel);c.onload=function(){this.style.display=""};var b=this.getDataUrl(g,n,p.name,p.tileLevel);(new SD.util.Ajax(b,function(h){k.parseData(h,c,a)})).doGet();c.style.position="absolute";c.style.width=this.r.width()+"px";c.style.height=this.r.height()+"px";c.style.top=this.r.top+"px";c.style.left=this.r.left+"px";this.div.appendChild(c)}}}};function MapLayer(){this.name="";this.tileLevel=0;this.realLevel=0;this.minLongitude=0;this.minLatitude=0;this.maxLongitude=0;this.maxLatitude=0;this.minVertexLongitude=0;this.minVertexLatitude=0;this.maxVertexLongitude=0;this.maxVertexLatitude=0;this.scale=0;this.drawExpand=false;this.projection=null;this.drawMap=function(b,a){}}function MapRasterLayer(a,k,e,l,b,i,j,d,g,c,f){this.mapTileWidth=0;this.mapTileHeight=0;this.totalMapRow=0;this.totalMapCol=0;this.ratio=1;this.cache=null;this.zoomTiles=null;this.managerInterval=null;this.totalTileLoaded=0;this.gridSystem=false;this.projection=f;this.drawExpand=c;this.initialize(a,k,e,b,l,i,j,d,g)}SD.extend(MapRasterLayer,MapLayer);MapRasterLayer.prototype.initialize=function(a,i,d,b,j,f,g,c,e){this.name=a;this.mapTileWidth=i;this.mapTileHeight=d;this.totalMapCol=b;this.totalMapRow=j;this.minVertexLongitude=f;this.maxVertexLongitude=g;this.maxVertexLatitude=c;this.bounds=null;this.boundsPolyline=false;this.tileLevel=e;this.scale=this.scaleValue();this.minVertexLatitude=this.maxVertexLatitude-(this.totalMapRow*this.mapTileHeight)*this.scale;this.boundsMetric=new Rectangle(this.minVertexLongitude,this.maxVertexLatitude,this.maxVertexLongitude,this.minVertexLatitude);this.setToGeo();this.offset=12};MapRasterLayer.prototype.isInBounds0=function(b){var a=Intersection.RectangleRectangle(this.bounds,b);if(a.hit>0){return true}return false};MapRasterLayer.prototype.isInBounds1=function(d,c){if(this.boundsPolyline instanceof MapArea){var a=this.boundsPolyline.isIn(d,c);return a}if(this.bounds.top>=c&&this.bounds.bottom<=c&&this.bounds.left<=d&&this.bounds.right>=d){return true}return false};MapRasterLayer.prototype.isInRect=function(b,a){return true};MapRasterLayer.prototype.loadFromXml=function(a){this.mapTileWidth=parseInt(a.getNamedItem("WIDTH").nodeValue);this.mapTileHeight=parseInt(a.getNamedItem("HEIGHT").nodeValue);this.totalMapCol=parseInt(a.getNamedItem("MAXCOL").nodeValue);this.totalMapRow=parseInt(a.getNamedItem("MAXROW").nodeValue);this.minVertexLongitude=parseFloat(a.getNamedItem("MINLONG").nodeValue);this.maxVertexLongitude=parseFloat(a.getNamedItem("MAXLONG").nodeValue);this.maxVertexLatitude=parseFloat(a.getNamedItem("MAXLAT").nodeValue);this.tileLevel=parseInt(a.getNamedItem("LEVELCODE").nodeValue);this.scale=this.scaleValue();this.minVertexLatitude=this.maxVertexLatitude-(this.totalMapRow*this.mapTileHeight)*this.scale};MapRasterLayer.prototype.scaleValue=function(){return((this.maxVertexLongitude-this.minVertexLongitude)/(this.totalMapCol*this.mapTileWidth))};MapRasterLayer.prototype.setToGeo=function(){if(this.projection!=null){var b=this.projection.metricToGeo(this.maxVertexLongitude,this.minVertexLatitude);var a=this.projection.metricToGeo(this.minVertexLongitude,this.maxVertexLatitude);this.maxLongitude=b.lon;this.maxLatitude=a.lat;this.minLongitude=a.lon;this.minLatitude=b.lat;this.bounds=new Rectangle(this.minLongitude,this.maxLatitude,this.maxLongitude,this.minLatitude)}};MapRasterLayer.prototype.createList=function(g,d,b,f){var e=new MapRowCols();for(var c=g;c<=b;c++){for(var a=d;a<=f;a++){if(!this.drawExpand&&!this.isInRect(a,c)){continue}e.add({row:a,col:c,img:null,code:this.name,level:this.realLevel,div:null,top:0,left:0})}}return e};MapRasterLayer.prototype.getTileId=function(b,a){return this.name+"_"+b+"_"+a+"_"+this.tileLevel};MapRasterLayer.prototype.setTile=function(a,d,b){a.style.display="none";var c=this.getTileUrl(b,d);a.src=c};MapRasterLayer.prototype.getTileHost=function(b,e){var d="http://172.16.0.4/",a=location.hostname,c=1+(e+b)%4;if(a.indexOf("streetdirectory.co.id")!=-1){d="http://map"+c+".streetdirectory.co.id/"}else{if(a.indexOf("streetdirectory")!=-1||a.indexOf("streetdirectry")!=-1){if(a=="beta.streetdirectory.com"){d="http://beta.streetdirectory.com/"}else{d="http://maps"+c+".streetdirectory.com/"}}else{if(a!="localhost"&&a!="sdcom"&&a!="172.16.0.4"){d="http://maps"+c+".streetdirectory.com/"}}}return d};MapRasterLayer.prototype.getTileUrl=function(s,g){var p=this.getTileHost(g,s),j=p+"data/map/",n=this.tileLevel,k,h=this.name,e;var i=12,d=p+"dragmap/xg/img/",o=this.totalMapCol+i,m=this.totalMapRow+i;if((g>=1&&g<=o)&&(s>=1&&s<=m)){if(h=="jkt"){k=j+"id/jkt/"+n+"/jkt"}else{if(h=="bali"){k=j+"id/bali/"+n+"/bl"}else{if(h=="btm"){k=j+"id/btm/"+n+"/btm"}else{if(h=="png"){k=j+"my/png/"+n+"/png"}else{if(h=="jb"){k=j+"my/jb/"+n+"/jb"}else{if(h=="mlk"){k=j+"my/mlk/"+n+"/mlk"}else{if(h=="kl"){k=j+"my/kv/"+n+"/kv"}else{if(h=="lkw"){k=j+"my/lkw/"+n+"/lkw"}else{if(h=="ph"){k=j+"ph/"+n}else{if(h=="asia"){k=j+"asia/"+n+"/sg"}else{if(h=="wrd"){k=j+"wrd/"+n+"/wrd"}else{if(h=="minimap"){k=j+"minimap/"+n+"/wrd"}else{k=j+"sg/"+n+"/sg"}}}}}}}}}}}}if(this.gridSystem){var b={row:0,col:0};var q=(this.totalMapRow/this.gridSystem.row);var f=(this.totalMapCol/this.gridSystem.col);for(var a=this.gridSystem.row;a>=1;a--){if((a*q)>=s){b.row=a}}for(var l=this.gridSystem.col;l>=1;l--){if((l*f)>=g){b.col=l}}e=k+"/"+b.row+"_"+b.col+"/"+this.tileLevel+"_"+b.row+"_"+b.col+"_"+s+"_"+g+".gif"}else{e=k+s+"_"+g+"_"+this.tileLevel+".gif"}}else{if(g<-this.offset||s<-this.offset){e=d+"no_map.gif"}else{e=d+""+this.get_no_map()}}return e};MapRasterLayer.prototype.get_no_map=function(){var b,a=this.name;if(a=="kl"){b="green.gif"}else{if(a=="png"){b="blue_white.gif"}else{b="blue.gif"}}return b};MapRasterLayer.prototype.createTile=function(e,c){var d=this.getTileUrl(c,e),b=document.createElement("img");b.style.display="none";b.onload=function(){this.style.display=""};b.src=d;b.galleryimg="no";var a=this;b.onerror=function(){if((c>=-a.offset&&c<=a.totalMapCol+a.offset)||(e>=-offset&&e<=a.totalMapRow+a.offset)){this.src=SD.BASE_URL+"img/"+a.get_no_map()}else{this.src=SD.BASE_URL+"img/no_map.gif"}};return b};MapRasterLayer.prototype.getBoundRow=function(a){if(this.ratio==1&&this.drawExpand&&(a<1||a>this.totalMapRow)){a=1}return a};MapRasterLayer.prototype.getBoundCol=function(a){if(this.totalMapCol==1){return 1}if(this.ratio==1&&this.drawExpand){if(a<=-(this.totalMapCol)||a>(this.totalMapCol*2)){a=a%this.totalMapCol}a=a<0?this.totalMapCol+a:(a>this.totalMapCol?a-this.totalMapCol:(a==0||this.totalMapCol==1?this.totalMapCol:a))}return a};function MapRasterLayerRatio(b,a){SD.apply(this,b);this.mapTileWidth*=a;this.mapTileHeight*=a;this.initialize(this.name,this.mapTileWidth,this.mapTileHeight,this.totalMapCol,this.totalMapRow,this.minVertexLongitude,this.maxVertexLongitude,this.maxVertexLatitude,this.tileLevel,this.realLevel)}function MapRasterMini(c,b,a){SD.apply(this,c);this.min=b;this.max=a}function MapRowCols(){this.node=[];this.max=50}MapRowCols.prototype.add=function(a){this.node.push(a)};MapRowCols.prototype.addNode=function(e,c,b,d){var a={row:e,col:c,img:null,code:b,level:d};this.node.push(a);return a};MapRowCols.prototype.getNodeByLevel=function(f){var b=[],a=0;for(var d=0,e=this.node.length;d<e;d++){if(this.node[d].level==f){b[a]=this.node[d];a++}}return b};MapRowCols.prototype.getNodes=function(e,g){var b=[],a=0;for(var d=0,f=this.node.length;d<f;d++){if(this.node[d].level==g&&this.node[d].code==e){b[a]=this.node[d];a++}}return b};MapRowCols.prototype.getSumLoadedNodes=function(a){var d=0;for(var b=0,e=a.length;b<e;b++){if(a[b].img!=undefined&&(!a[b].img.complete||(typeof a[b].img.naturalWidth!="undefined"&&a[b].img.naturalWidth==0))){continue}d++}return d};MapRowCols.prototype.clear=function(){for(var a=0,b=this.node.length;a<b;a++){if(this.node[a].img){SD.util.purge(this.node[a].img);this.node[a].img=undefined}this.node[a]=undefined}this.node=[]};MapRowCols.prototype.remove=function(b){var a=-1;for(var d=0,e=this.node.length;d<e;d++){if(this.node[d]==b){a=d;break}}if(a!=-1){this.node.splice(a,1)}};MapRowCols.prototype.getMap=function(b,f,e,d){for(var a=0,g=this.node.length;a<g;a++){if(this.node[a].row==b&&this.node[a].col==f&&this.node[a].level==d&&this.node[a].code==e){return this.node[a]}}return false};MapRowCols.prototype.unReloadImg=function(){for(var b=0;b<this.node.length;b++){var a=this.node[b];if(a.img!=null){a.img.removeAttribute("src")}}};MapRowCols.prototype.getBounds=function(a){var d=new Rectangle(0,0,0,0);for(var b=0,e=a.length;b<e;b++){if(b==0){d.left=a[b].col;d.right=a[b].col;d.top=a[b].row;d.bottom=a[b].row}if(a[b].col>d.right){d.right=a[b].col}if(a[b].col<d.left){d.left=a[b].col}if(a[b].row<d.top){d.top=a[b].row}if(a[b].row>d.bottom){d.bottom=a[b].row}}return d};MapRowCols.prototype.getIntersectionRect=function(a,c){var d=[];for(var b=c.left;b<=c.right;b++){for(var e=c.top;e<=c.bottom;e++){if(a.right<b||a.left>b||a.top>e||a.bottom<e){d.push({row:e,col:b})}}}return d};MapRowCols.prototype.removeFromLayer=function(b){for(var a=0,d=this.removed.length;a<d;a++){b.removeChild(this.removed[a]);this.removed[a]=null}this.removed=[]};function MapManager(){this.layers=[];this.initConfigDefault()}MapManager.prototype.getLength=function(){return this.layers.length};MapManager.prototype.getMapLayerByNearest=function(d,a,b,h){var e=1000000;var g=false;var i=a-1;var k=this.layers[a-1];if(k!=undefined&&k!=null){if(k.length!=undefined){for(var f=0;f<k.length;f++){if(k[f].isInBounds1(b,h)){if(parseInt(k[f].scale)==parseInt(d)){return{level:i+1,layer:k[f]}}var c=Math.abs(k[f].scale-d);if(c<e){g=k[f]}e=c}}}else{if(typeof k=="object"&&k.isInBounds1(b,h)){if(parseInt(k.scale)==parseInt(d)){return{level:i,layer:k}}var c=Math.abs(k.scale-d);if(c<e){g=k}e=c}}}if(typeof k=="object"&&k.length==0){return{level:i,layer:k}}return{level:(i),layer:g}};MapManager.prototype.getMapLayerByLevel=function(e,d,c){var b=this.layers[e-1];if(b!=undefined){if(b.length!=undefined){for(var a=0;a<b.length;a++){if(b[a].isInBounds1(d,c)){return b[a]}}}else{if(typeof b=="object"){if(b.isInBounds1(d,c)){return b}}}}return false};MapManager.prototype.addLayer=function(d,c){var a=this.layers.length;if(d.length!=undefined){for(var b=0;b<d.length;b++){d[b].realLevel=a+1}}else{if(typeof d=="object"){d.realLevel=a+1}}this.layers.push(d)};function MapArea(b,a){this.nodes=this.formatBounds(b)}MapArea.prototype.formatBounds=function(d){var b=[];for(var c=0;c<d.length-1;c+=2){b.push({lon:d[c],lat:d[c+1]})}return b};MapArea.prototype.isIn=function(b,g){var a=1,f=this.nodes.length;var c=f-1;for(var e=0;e<f;e++){if((this.nodes[e].lat<=g&&g<this.nodes[c].lat)||(this.nodes[c].lat<=g&&g<this.nodes[e].lat)){var d=(this.nodes[c].lon-this.nodes[e].lon)*(g-this.nodes[e].lat)/(this.nodes[c].lat-this.nodes[e].lat)+this.nodes[e].lon;if(b<d){a=1-a}}c=e}return a!=1?true:false};SD.extend(RoutingPanTool,DrawingTool);function RoutingPanTool(){var d=new Point();var c=new Point();var e=new Point();var a=false;var b=function(h){var f=false;var g=(h.target||h.srcElement);if(g!=undefined){var i=g.nodeName.toLowerCase();switch(i){case"v:polyline":case"polyline":f=i;break;case"svg":case"vml":f="vector";break;default:f=i;break}}return f};this.MouseDown=function(i,g){var h;if(i.which){h=(i.which==3)}else{if(i.button){h=(i.button==2)}}var f=b(i);if(getMouseButton(i)=="LEFT"){d=pos;e=pos;if(f=="img"){a=true}}else{if(h){d=pos;allowedRightClick=this.module.validateRightClickMenu();if(allowedRightClick!=0){this.module.menu.activateMenu(allowedRightClick);this.module.menu.object.style.top=pos.y;this.module.menu.object.style.left=pos.x}SD.util.cancelEvent(i)}}};this.MouseMove=function(h,g){h=this.fixE(h);g.obj.style.cursor="";if(getMouseButton(h)=="LEFT"){var f=b(h);var i=this.getPos(h,g);if(a){this.module.model.currentHandle.followMouseMove(i);e=i}else{if(f=="polyline"){this.module.model.currentHandle.setPosition(OffsetPoint(i,-5,-5))}else{if(f=="div"||f=="vector"){this.module.model.currentHandle.setDisplay(false);if(!a&&(f=="div")){g.ActiveTool(g.defaultTool)}}}}}return false};this.MouseUp=function(i,g){i=this.fixE(i);var f=b(i);if(getMouseButton(i)=="LEFT"){if(a&&f=="img"&&i.type!="mouseout"){var k=this.getPos(i,g);if(k.x==d.x&&k.y==d.y){a=false;return}var j=new Point(-(k.x-g.viewportInfo.width/2),-(k.y-g.viewportInfo.height/2));var h=this.getMetricPos(j,g);this.module.recalculate(h);e=k;a=false}if(i.type=="mouseup"){a=false}}if((f=="div"||(f=="vector"&&i.type=="mouseup")||(f=="img"&&i.type=="mouseout"))&&!a){this.module.setHandleDisplay(false);g.ActiveTool(g.defaultTool)}window.status=a+" : "+i.type+" : "+f;return false}}RoutingManager=function(c){this.map=null;this.projection=(new SD.projection.Server()).get("UTM WGS-1984 48N");this.mercatorProjection=(new SD.projection.Server()).get("Mercator WGS-1984");SD.apply(this,c);this.lastCursor=new Point();this.startMarker=null;this.endMarker=null;this.viaMarker=[];this.viaCurrentMarker=null;this.polyline=null;this.cps=[];this.mode=null;this.weight=null;this.mslinks=[];this.keyword=null;this.rightClick=new RightClickMenu(this.map.size);var b=this;var a=this.rightClick;var d=this.map;this.rightClick.addMenu("Via here",function(){b.addMarker({marker:"via"})});this.rightClick.addMenu("Directions from here",function(){b.addMarker({marker:"start"})});this.rightClick.addMenu("Directions to here",function(){b.addMarker({marker:"end"})});this.rightClick.addMenu("Save map as image",function(){window.location="http://"+location.hostname+"/asia_travel/mappage/ajax/get_map.php?level="+(get_level()-3)+"&lat="+MapAPI.viewportInfo.centerGeo.lat+"&lon="+MapAPI.viewportInfo.centerGeo.lon+"&sizex=720&sizey=600"});this.rightClick.addMenu("Reverse direction",function(){b.reverseDirection()});this.rightClick.addMenu("Reset",function(){b.reset()});this.map.viewport.realDiv.appendChild(this.rightClick.object.div);EventManager.add(this.map.viewport.fakeDiv,"mousedown",function(f){if(SD.util.getMouseButton(f)=="RIGHT"){(b.route==null)?a.activateMenu([2,3,4]):a.activateMenu([1,2,3,4,5,6]);var g=d.viewport.getCursorPosition(f);a.object.setTopLeft(g);b.lastCursor=g;b.setMode(0,3)}else{a.object.setDisplay(false)}})};RoutingManager.prototype.setMode=function(b,a){this.mode=(b!=undefined)?b:0;this.weight=(a)?a:0};RoutingManager.prototype.getMode=function(){return this.mode};RoutingManager.prototype.getWeight=function(){return this.weight};RoutingManager.prototype.addMarker=function(f){var g,c;if(f.x!=undefined||f.y!=undefined){g=new GeoPoint(f.x,f.y)}else{g=this.map.viewportInfo.viewportScreenToGeo(this.lastCursor.x,this.lastCursor.y)}if(f.marker=="start"){if(this.startMarker!=null){icons.remove(this.startMarker)}c=this.startMarker=icons.create({css:"map_legend1",w:85,h:112,left:0,top:310,x:g.lon,y:g.lat,offset_x:67,offset_y:112},"routing");if(window.dd_direction){if(dd_direction.load_dd==false){if(routing){var e;var d;if(routing.mode==0){dd_remote_button("car",routing.weight)}else{if(routing.weight==0){dd_remote_button("bus","")}else{if(routing.weight==1){dd_remote_button("mrt","")}else{dd_remote_button("bus_mrt","")}}}}else{dd_remote_button("car","")}}else{if($("dd_start_pin")){dd_direction.remotedRouting("start")}}}else{hideNewDDForm();if(routing){var e;var d;if(routing.mode==0){dd_remote_button("car",routing.weight)}else{if(routing.weight==0){dd_remote_button("bus","")}else{if(routing.weight==1){dd_remote_button("mrt","")}else{dd_remote_button("bus_mrt","")}}}}else{dd_remote_button("car","")}}}else{if(f.marker=="end"){if(this.endMarker!=null){icons.remove(this.endMarker)}c=this.endMarker=icons.create({css:"map_legend1",w:61,h:103,left:86,top:310,x:g.lon,y:g.lat,offset_x:58,offset_y:103},"routing");if(window.dd_direction){if(dd_direction.load_dd==false){if(routing){var e;var d;if(routing.mode==0){dd_remote_button("car",routing.weight)}else{if(routing.weight==0){dd_remote_button("bus","")}else{if(routing.weight==1){dd_remote_button("mrt","")}else{dd_remote_button("bus_mrt","")}}}}else{dd_remote_button("car","")}}else{if($("dd_end_pin")){dd_direction.remotedRouting("end")}}}else{hideNewDDForm();if(routing){var e;var d;if(routing.mode==0){dd_remote_button("car",routing.weight)}else{if(routing.weight==0){dd_remote_button("bus","")}else{if(routing.weight==1){dd_remote_button("mrt","")}else{dd_remote_button("bus_mrt","")}}}}else{dd_remote_button("car","")}}}else{if(f.marker=="via"){var b=this.viaMarker.length;c=this.viaMarker[b]=icons.create({css:"map_legend1",w:68,h:102,left:149,top:310,x:g.lon,y:g.lat,offset_x:65,offset_y:102},"routing")}}}if(f.draggable==true||f.draggable==undefined){var a=new DraggableTool();a.init(c,this.map.viewport,{_manager:this,MouseUp:function(h){this._manager._drawLines()}})}this._drawLines()};RoutingManager.prototype._drawLines=function(){if(this.startMarker==null||this.endMarker==null){showRouteList(this,1,0);return}var via="",viaPos;if(this.viaMarker!=null&&this.viaMarker.length>0){via="&via=";for(var i=0,c=this.viaMarker.length;i<c;i++){viaPos=this.projection.geoToMetric(this.viaMarker[i].position.lon,this.viaMarker[i].position.lat);via+=viaPos.x+","+viaPos.y;via+=i<c-1?";":""}}var mslinks=this.mslinks,mslink="";if(mslinks.length>0){mslink="&mslink="+mslinks[0];for(var i=1;i<mslinks.length;i++){mslink+=","+mslinks[i]}}var name=MapAPI.canvasInfo.mapConfig.name,map_name="&s=";map_name+=(name=="kl")?"kl":"sg";var x1=parseFloat(this.startMarker.position.lon),x2=parseFloat(this.endMarker.position.lon),y1=parseFloat(this.startMarker.position.lat),y2=parseFloat(this.endMarker.position.lat);var start=this.projection.geoToMetric(x1,y1);var end=this.projection.geoToMetric(x2,y2);var mapConfig;if(this.mode==1){mapConfig="http://"+location.hostname+"/travel/ajax/busmrt/busmrt_route.php?mode="+this.weight+"&x1="+start.x+"&y1="+start.y+"&x2="+end.x+"&y2="+end.y+"&v="+global.v_c+global_clear_cache}else{if(this.mode==0){mapConfig="http://"+location.hostname+"/routing/ajax/routing_result.php?x1="+start.x+"&y1="+start.y+"&x2="+end.x+"&y2="+end.y+"&weight="+this.weight+map_name+via+mslink+"&v="+global.v_c+global_clear_cache}}var manager=this,level=get_level();(new SD.util.AjaxJson(mapConfig,function(json){if(json!="[empty]"){var tmp=eval(json);lines.remove_all();icons.hide_group("icon");var opt=new Array(),arrowOption={size:1,color:"red"};opt[0]={color:"#0000ff",size:5,opacity:"0.7",arrowOption:arrowOption};opt[1]={color:"#ff0033",size:5,opacity:"0.7",arrowOption:arrowOption};opt[2]={color:"#ff00cb",size:5,opacity:"0.7",arrowOption:arrowOption};opt[3]={color:"#9900ff",size:5,opacity:"0.7",arrowOption:arrowOption};opt[4]={color:"#4c4c4c",size:5,opacity:"0.7",arrowOption:arrowOption};for(var i=0;i<tmp.length;i++){var tmp2=tmp[i],points=new Array(),pt,mp;for(var j=0;j<tmp2.length;j+=2){if(level<=10){if(tmp2[j]!=undefined&&tmp2[j+1]!=undefined){pt=manager.projection.metricToGeo(tmp2[j],tmp2[j+1]);points.push(pt)}}else{points.push(new Vertex(tmp2[j],tmp2[j+1]))}}manager.route=lines.create(points,opt[i],"routing"+i)}}if(global.fullscreen){slideLeftbar("right",10,15)}showRouteList(manager,1,0)})).doGet()};RoutingManager.prototype.printUrl=function(){var c=this.projection.geoToMetric(this.startMarker.position.lon,this.startMarker.position.lat);var a=this.projection.geoToMetric(this.endMarker.position.lon,this.endMarker.position.lat);if(this.mode==0){var b="";if(this.weight==0){b="shortest_distance"}else{if(this.weight==1){b="nearest_expressway"}else{b="major_roads"}}return"http://"+location.hostname+"/routing/print_map.php?x1="+c.x+"&y1="+c.y+"&x2="+a.x+"&y2="+a.y+"&weight="+this.weight+"&ua="+b}else{var b="";if(this.weight==0){b="bus_guide"}else{if(this.weight==1){b="mrt_guide"}else{b="busmrt_guide"}}return"http://"+location.hostname+"/travel/"+b+"/print_map.php?x1="+c.x+"&y1="+c.y+"&x2="+a.x+"&y2="+a.y}};RoutingManager.prototype.reverseDirection=function(){var c=this.startMarker,b=this.endMarker;icons.remove(this.startMarker);icons.remove(this.endMarker);this.startMarker=icons.create({css:"map_legend1",w:85,h:112,left:0,top:310,x:b.position.lon,y:b.position.lat,offset_x:67,offset_y:112},"routing");var a=new DraggableTool();a.init(this.startMarker,this.map.viewport,{_manager:this,MouseUp:function(d){this._manager._drawLines()}});this.endMarker=icons.create({css:"map_legend1",w:61,h:103,left:86,top:310,x:c.position.lon,y:c.position.lat,offset_x:58,offset_y:103},"routing");var a=new DraggableTool();a.init(this.endMarker,this.map.viewport,{_manager:this,MouseUp:function(d){this._manager._drawLines()}});this._drawLines()};RoutingManager.prototype.reset=function(){icons.remove_group("routing");icons.remove_group("checkpoint");lines.remove(lines.linesArr.routing);this.startMarker=this.endMarker=null;this.viaMarker=new Array();if(this.route!=null){lines.remove(this.route)}this.route=null;clearLHS();if(icons.icons.icon){icons.show_group("icon")}if($("startReplacement")){$("startReplacement").parentNode.removeChild($("startReplacement"))}if($("endReplacement")){$("endReplacement").parentNode.removeChild($("endReplacement"))}if(window.dd_direction){if(dd_direction.load_dd==false){xy=$("last_posLongLat").innerHTML;xy=xy.split(",");x=xy[0];y=xy[1];var d=function(){},c=function(e){dd_direction.showForm(e);if(global.fullscreen){if(SD.isIE){$("dd_go_button_search").style.position="relative";$("dd_go_button_search").style.left="-8px"}else{$("dd_go_button_search").style.position="relative";$("dd_go_button_search").style.left="-15px";$("dd_swap_button").style.position="relative";$("dd_swap_button").style.left="-10px"}}var g=function(){ddChange(0,$("dd_mode").value)};var f=new elmSelect("dd_mode_span","dd_mode",{0:"Shortest Distance",1:"Expressway",3:"Major Roads"},{w:120,limit:20},{val:"Shortest Distance",key:0},g)};var b=document.getElementById("q").value;if(!b){global.link_to="";x="";y=""}var a="http://"+location.hostname+"/asia_travel/mappage/ajax/dd_form.php?fromParam=&toParam="+global.link_to+"&v="+global.v_c+global_clear_cache+"&x="+x+"&y="+y+"&link_id_to="+global.link_id_footer+"&to="+b;ajax(a,c,d);dd_direction.load_dd=true;if($("content_lhs")){$("content_lhs").style.display="none"}if($("content_header_listing")){$("content_header_listing").style.display="block";$("content_header_listing").style.borderBottom="none";$("content_listing_title").parentNode.style.display="none"}}else{var b=document.getElementById("q").value;if(!b||b=="Find Businesses, Addresses or Products & Services here"){if($("travel_from")){$("travel_from").value=""}if($("travel_to")){$("travel_to").value=""}if($("x1")){$("x1").value=""}if($("y1")){$("y1").value=""}if($("x2")){$("x2").value=""}if($("y2")){$("y2").value=""}}else{if($("travel_from")){$("travel_from").value=""}if($("x1")){$("x1").value=""}if($("y1")){$("y1").value=""}}if(dd_direction.startMarker.parentNode){dd_direction.startMarker.parentNode.removeChild(dd_direction.startMarker)}if($("endReplacement")){$("endReplacement").parentNode.removeChild($("endReplacement"))}if(dd_direction.endMarker.parentNode){dd_direction.endMarker.parentNode.removeChild(dd_direction.endMarker)}dd_direction.startMarker=dd_direction.createStartIcon();dd_direction.endMarker=dd_direction.createEndIcon();if($("dd_start_pin")){$("dd_start_pin").appendChild(dd_direction.startMarker)}if($("dd_end_pin")){$("dd_end_pin").appendChild(dd_direction.endMarker)}global.direction_reset=false}}};RoutingManager.prototype.drawCheckpoints=function(){loadCSS("/css/map/star_route.css?v=3");var elm=$("dd_checkpoints");if(elm){try{var checkpoints=eval(elm.innerHTML);if(checkpoints.length>0){icons.remove_group("checkpoint");this.cps=[];for(var i=0;i<checkpoints.length;i++){this.drawCheckpoint(checkpoints,i)}}}catch(e){}}};RoutingManager.prototype.drawCheckpoint=function(e,i){var b=this,a;if(SD.isIE6){a="star_route_ie"}else{a="star_route"}var d=e[i];var h=d.x?d.x:d[0];var f=d.y?d.y:d[1];if(h>1000){pt=b.projection.metricToGeo(h,f);cp=new Object();cp.x=pt.lon;cp.y=pt.lat}else{cp=new Object();cp.x=h;cp.y=f}var g=(i%10)*18,c=Math.floor(i/10)*18;this.cps[i]=(i>0&&i<(e.length-1))?icons.create({css:a,w:18,h:18,left:g,top:c,x:cp.x,y:cp.y,offset_x:10,offset_y:10},"checkpoint"):(i==0)?this.startMarker:this.endMarker;var j=this.cps[i];j.idx=i;icons.action(j,"mouseover",function(k){if(checkMouseEnter(this,k)){routeMouseOver((j.idx+1),true)}});icons.action(j,"mouseout",function(k){if(checkMouseLeave(this,k)){routeMouseOut(j.idx+1)}})};RoutingManager.prototype.loadFromXml=function(f){var h=f.getElementsByTagName("line");var g=[],k="";for(var b=0;b<h.length;b++){var a=h.item(b).childNodes.length;for(var c=0;c<a;c++){k+=(c>0?",":"")+h.item(b).childNodes[c].nodeValue}var e=k.split(",");for(var d=0;d<e.length;d+=2){if(e[d]!=undefined&&e[d+1]!=undefined){g.push(new Vertex(e[d],e[d+1]))}}k=""}return g};function RightClickMenu(a){this.viewportSize=a;this.list=[];this.addStyle();this.object=new StdDiv();this.object.div.style.border="1px solid #777788";this.object.div.style.width="";this.object.setId("rightClickMenu")}function findLevel(c,a){var b=MapAPI.viewportInfo.geoView;if((c.lon>b.left&&c.lon<b.right&&c.lat>b.bottom&&c.lat<b.top)&&(a.lon>b.left&&a.lon<b.right&&a.lat>b.bottom&&a.lat<b.top)){return true}return false}RightClickMenu.prototype={index:1,activateAll:function(){this.object.setDisplay(true);for(var a=0,b=this.list.length;a<b;a++){this.list[a].obj.style.display=""}},activateMenu:function(g){this.object.setDisplay(true);for(var b=0,f=this.list.length;b<f;b++){this.list[b].obj.style.display="none"}for(var b=0,f=this.list.length;b<f;b++){if(this.list[b].obj){if(g.length!=undefined){for(var a=0,e=g.length;a<e;a++){if(g[a]==this.list[b].id){this.list[b].obj.style.display=""}}}else{if(this.list[b].id==g){this.list[b].obj.style.display=""}}}}},addMenu:function(e,d){var a=document.createElement("li");a.appendChild(document.createTextNode(e));a.onmouseover=function(){this.className="sfhover"};a.onmouseout=function(){this.className=""};a.onmousedown=function(f){d(f)};var c=document.createElement("ul");c.appendChild(a);c.style.display="none";this.object.add(c);var b={id:this.index,obj:c};this.list.push(b);this.index++;return b.id},setViewportSize:function(a){this.viewportSize=a},addStyle:function(){if(document.createStyleSheet){with(document.createStyleSheet()){addRule("#rightClickMenu","position: absolute; top: 0px; left: 0px; background-color: #DDDDFF; z-index: 999999; margin: 0; padding: 0; display: ;");addRule("#rightClickMenu ul","list-style: none; padding: 0; margin: 0; border: 0px;");addRule("#rightClickMenu ul li","list-style: none; padding: 3px 5px; margin: 0; display: block; font: 11px Verdana; color: #333355; border-top: 0px; border-bottom: 0px; white-space: nowrap; background-color: #DDDDFF; cursor: auto; ");addRule("#rightClickMenu ul li.sfhover","background-color: #333355; color: #ffffff; cursor: pointer; white-space: nowrap; ")}}else{var myStyle=document.createElement("style");var myStyleStr="";myStyleStr="#rightClickMenu { position: absolute; top: 0px; left: 0px; background-color: #DDDDFF; z-index: 999999; margin: 0; padding: 0; display: ; }\n";myStyleStr=myStyleStr+"#rightClickMenu ul { border: 0px; list-style: none; padding: 0; margin: 0; }\n";myStyleStr=myStyleStr+"#rightClickMenu ul li { font: 11px Verdana; color: #333355; white-space: nowrap; background-color: #DDDDFF; padding: 3px 5px; cursor: auto; display: block;}\n";myStyleStr=myStyleStr+"#rightClickMenu ul li.sfhover { background-color: #333355; color: #ffffff; cursor: pointer; }\n";myStyle.appendChild(document.createTextNode(myStyleStr));var head=document.getElementsByTagName("head")[0];head.appendChild(myStyle)}}};SD.projection.Default=function(){};SD.projection.Default.prototype={geoToMetric:function(b,a){},metricToGeo:function(a,b){},geoToScreen:function(e,c,d,a){var b=this.geoToPixel(e,c,d);b.x-=a.x;b.y-=a.y;return b},screenToGeo:function(a,e,d,c){var b=this.pixelToGeo(a+c.x,e+c.y,d);return b},metricToScreen:function(a,e,d,b){var c=this.metricToPixel(a,e,d);c.x-=b.x;c.y-=b.y;return c},screenToMetric:function(a,e,d,c){var b=this.pixelToMetric(a+c.x,e+c.y,d);return b},geoToPixel:function(d,b,c){var a=this.geoToMetric(d,b);return this.metricToPixel(a.x,a.y,c)},pixelToGeo:function(b,d,c){var a=this.pixelToMetric(b,d,c);return this.metricToGeo(a.x,a.y)},inflateGeo:function(c,a,e,d){var b=this.geoToPixel(c.lon,c.lat,d);b=SD.util.offsetPoint(b,a,e);return this.pixelToGeo(b.x,b.y,d)},inflateVert:function(b,a,e,d){var c=this.metricToPixel(b.x,b.y,d);c=SD.util.offsetPoint(c,a,e);return this.pixelToMetric(c.x,c.y,d)},metricToPixel:function(a,d,c){var b=new Point();b.x=a/c;b.y=(d/c)*-1;return b},pixelToMetric:function(b,d,c){var a=new Point();a.x=b*c;a.y=d*c*-1;return a}};SD.projection.BaseUTM=function(){this.a=6378137;this.b=6356752.3142;this.k0=0.9996;this.tZone=-1;this.tIsSouth=false};SD.projection.BaseUTM.prototype={geoToMetric:function(o,r,d){var u=(this.a-this.b)/(this.a+this.b);var v=Math.PI/(180*60*60);var z=Math.sqrt(1-Math.pow(this.b/this.a,2));var c=Math.pow(z,2)/(1-Math.pow(z,2));r=r*Math.PI/180;var C=this.a/Math.sqrt(1-Math.pow(z*Math.sin(r),2));if(!d){d=31+parseInt((Math.floor(o/6)));this.tZone=d}var a=parseInt((6*d)-183);var b=(o-a);var t=b*3600/10000;var q=this.a*(1-u+(5/4)*Math.pow(u,2)*(1-u)+(81/64)*Math.pow(u,4)*(1-u));var A=(3*this.a*u/2)*(1-u-(7/8)*Math.pow(u,2)*(1-u)+(55/64)*Math.pow(u,4));var f=(15*this.a*Math.pow(u,2)/16)*(1-u+(3/4)*Math.pow(u,2)*(1-u));var s=(35*this.a*Math.pow(u,3)/48)*(1-u+(11/16)*Math.pow(u,2));var B=(315*this.a*Math.pow(u,4)/51)*(1-u);var w=(q*r)-(A*Math.sin(2*r))+(f*Math.sin(4*r))-(s*Math.sin(6*r))+(B*Math.sin(8*r));var m=w*this.k0;var l=this.k0*(100000000)*Math.pow(v,2)*C*Math.sin(r)*Math.cos(r)/2;var k=(this.k0*(10000000000000000)*Math.pow(v,4)*C*Math.sin(r)*Math.pow(Math.sin(r),3)/24)*((5-Math.pow(Math.tan(r),2)+9*c*Math.pow(Math.cos(r),2)+4*Math.pow(c,2)*Math.pow(Math.cos(r),4)));var i=this.k0*10000*v*C*Math.cos(r);var g=(this.k0*(1000000000000)*Math.pow(v,3)*C*Math.pow(Math.cos(r),3)/6)*(1-Math.pow(Math.tan(r),2)+c*Math.pow(Math.cos(r),2));var D=(Math.pow(t*v,6)*C*Math.sin(r)*Math.pow(Math.cos(r),5)/720)*(61-58*Math.pow(Math.tan(r),2)+Math.pow(Math.tan(r),4)+270*c*Math.pow(Math.cos(r),2)-330*c*Math.pow(Math.sin(r),2))*this.k0*Math.pow(10,24);var h=m+(l*Math.pow(t,2))+(k*Math.pow(t,4))+(D*Math.pow(t,6));if(h<0){h=h+10000000;this.tIsSouth=true}var j=(i*t)+(g*Math.pow(t,3))+500000;return new Vertex(j,h)},metricToGeo:function(o,l,f,A){var E=Math.sqrt(1-Math.pow(this.b/this.a,2));var d=Math.pow(E,2)/(1-Math.pow(E,2));o=500000-o;var z=l;if(A){l=10000000-l}var B=6*f-183;var i=l/this.k0;var w=i/(this.a*(1-Math.pow(E,2)/4-3*Math.pow(E,4)/64-5*Math.pow(E,6)/256));var n=(1-Math.sqrt((1-Math.pow(E,2))))/(1+Math.sqrt((1-Math.pow(E,2))));var g=(3*n/2-27*Math.pow(n,3)/32);var c=(21*Math.pow(n,2)/16-55*Math.pow(n,4)/32);var b=(151*Math.pow(n,3)/96);var a=(1097*Math.pow(n,4)/512);var h=w+g*Math.sin(2*w)+c*Math.sin(4*w)+b*Math.sin(6*w)+a*Math.sin(8*w);var C=d*Math.pow(Math.cos(h),2);var v=Math.pow(Math.tan(h),2);var F=this.a*(1-Math.pow(E,2))/Math.pow((1-Math.pow(E,2)*Math.pow(Math.sin(h),2)),(3/2));var s=this.a/Math.sqrt((1-Math.pow(E*Math.sin(h),2)));var u=o/(s*this.k0);var t=s*Math.tan(h)/F;var r=(Math.pow(u,2)/2);var q=(5+3*v+10*C-4*Math.pow(C,2)-9*d)*Math.pow(u,4)/24;var p=(61+90*v+298*C+45*Math.pow(v,2)-3*Math.pow(C,2)-252*d)*Math.pow(u,6)/720;var m=u;var k=(1+2*v+C)*Math.pow(u,3)/6;var j=(5-2*C+28*v-3*Math.pow(C,2)+8*d+24*Math.pow(v,2))*Math.pow(u,5)/120;latitude=180*(h-t*(r-q+p))/Math.PI;if(A){latitude=latitude*-1}longitude=B-((m-k+j)/Math.cos(h))*180/Math.PI;return new GeoPoint(longitude,latitude)}};SD.projection.UTM=function(a,b){this.zone=a;this.isSouth=b;this.obj=new SD.projection.BaseUTM();this.name="UTM WGS-1984 "+this.zone+(this.isSouth?"S":"N");this.geoToMetric=function(d,c){return this.obj.geoToMetric(d,c,this.zone)};this.metricToGeo=function(c,d){return this.obj.metricToGeo(c,d,this.zone,this.isSouth)}};SD.extend(SD.projection.UTM,SD.projection.Default);SD.projection.Mercator=function(){this.rMajor=6378137;this.rMinor=6356752.3142;this.temp=this.rMinor/this.rMajor;this.M_PI_2=Math.PI/2;this.eccent=Math.sqrt(1-(this.temp*this.temp));this.eccnth=0.5*this.eccent;this.name="Mercator WGS-1984";this.radToDeg=function(a){return a*(180/Math.PI)};this.degToRad=function(a){return a*(Math.PI/180)};this.mercX=function(a){return this.rMajor*this.degToRad(a)};this.unMercX=function(a){return this.radToDeg(a)/this.rMajor};this.geoToMetric=function(a,b){return new Vertex(this.mercX(a),this.mercY(b))};this.metricToGeo=function(a,b){return new GeoPoint(this.unMercX(a),this.unMercY(b))};this.unMercY=function(f){var e=Math.exp(-f/this.rMajor);var d=Math.PI/2-2*Math.atan(e);var c=0;var b=1;while(Math.abs(b)>1e-9&&c<15){var a=this.eccent*Math.sin(d);b=this.M_PI_2-2*Math.atan(e*Math.pow((1-a)/(1+a),this.eccnth))-d;d+=b;c++}return this.radToDeg(d)};this.mercY=function(f){if(f>89.5){f=89.5}if(f<-89.5){f=-89.5}var e=this.degToRad(f);var d=Math.sin(e);var a=this.eccent*d;var b=0.5*this.eccent;a=Math.pow(((1-a)/(1+a)),b);var c=Math.tan(0.5*((Math.PI*0.5)-e))/a;var g=0-this.rMajor*Math.log(c);return g}};SD.extend(SD.projection.Mercator,SD.projection.Default);SD.projection.Server=function(){this.list=[{xname:"UTM WGS-1984 48N",obj:new SD.projection.UTM(48,false)},{xname:"UTM WGS-1984 47N",obj:new SD.projection.UTM(47,false)},{xname:"UTM WGS-1984 48S",obj:new SD.projection.UTM(48,true)},{xname:"Mercator WGS-1984",obj:new SD.projection.Mercator()},{xname:"UTM WGS-1984 49S",obj:new SD.projection.UTM(49,true)}];this.get=function(b){if(this.list.length==0){return false}for(var a=0;a<this.list.length;a++){if(escape(this.list[a].xname)==escape(b)){return this.list[a].obj}}return false};this.defaultProjection=function(){return this.list[0].obj}};var _XMLNS_SVG="http://www.w3.org/2000/svg";function VectorSVG(d,c,a){this.div=d;if(!c){c=d.clientWidth}if(!a){a=d.clientHeight}this._currentShape=null;this.width=c;this.height=a;this._stack=[];this._stackSize=0;var b=document.createElementNS(_XMLNS_SVG,"svg");b.setAttribute("width",c);b.setAttribute("height",a);b.setAttribute("overflow","visible");var e=document.createElementNS(_XMLNS_SVG,"rect");e.setAttribute("width",c);e.setAttribute("height",a);e.setAttribute("fill","none");b.appendChild(e);this.div.appendChild(b);this._root=b;this._rect=e;this.setPosition=function(g,f){this._root.style.position="absolute";this._root.style.zIndex=0;if(!isNaN(f)){this._root.style.left=f+"px"}if(!isNaN(g)){this._root.style.top=g+"px"}};this.setViewBox=function(g,f){if(!f){f=2}var h=g.left+" "+g.top+" "+g.width()+" "+g.height();this._root.setAttribute("viewBox",h)};this.setSize=function(f){this._root.setAttribute("width",f.width);this._root.setAttribute("height",f.height);this._rect.setAttribute("width",f.width);this._rect.setAttribute("height",f.height);this.width=f.width;this.height=f.height};this.setAttribute=function(g,f){for(i in f){g.setAttributeNS(null,i,f[i])}};this.createCircle=function(h,g){var f=document.createElementNS(_XMLNS_SVG,"ellipse");f.setAttribute("cx",h.x);f.setAttribute("cy",h.y);f.setAttribute("stroke-linecap","round");f.setAttribute("stroke-linejoin","round");f.setAttribute("rx",g.diameter||g.diameterHorizontal);f.setAttribute("ry",g.diameter||g.diameterVertical);if(g.bgColor){f.setAttribute("fill",g.bgColor)}if(g.lineColor||g.color){f.setAttribute("stroke",g.lineColor||g.color)}if(g.lineWidth||g.size){f.setAttribute("stroke-width",g.lineWidth||g.size)}if(g.opacity){f.setAttribute("opacity",g.opacity)}if(g.fillOpacity>0){f.setAttribute("fill-opacity",g.fillOpacity)}if(g.dash>0){f.setAttribute("stroke-dasharray",g.dash)}this._root.appendChild(f);this._pushStack(f)};this.createArrow=function(k,g){var f=document.createElementNS(_XMLNS_SVG,"polyline");var j=g.diameter;var h=(k.x+j-5)+","+(k.y-5)+" "+(k.x+j)+","+k.y+" "+k.x+","+k.y+" "+(k.x+j)+","+k.y+" "+(k.x+j-5)+","+(k.y+5);f.setAttribute("fill","none");f.setAttribute("stroke-linecap","round");f.setAttribute("stroke-linejoin","round");f.setAttribute("points",h);f.setAttribute("stroke",g.color||g.lineColor);f.setAttribute("stroke-width",g.size||g.lineWidth);this._root.appendChild(f);this._pushStack(f)};this.createText=function(h,g){var f=document.createElementNS(_XMLNS_SVG,"text");f.setAttribute("x",h.x);f.setAttribute("y",h.y-5);f.setAttribute("fill","red");f.setAttribute("stroke-linejoin","bevel");f.setAttribute("font-size",12);f.appendChild(document.createTextNode(g.text));this._root.appendChild(f);this._pushStack(f)};this._pushStack=function(f){if(this._stackSize+1<this._stack.length){this._stack.length=this._stackSize+1}this._stack[this._stackSize++]=f};this.clear=function(){for(var f=this._stackSize;f--;){if(this._stack[f]!=undefined){this._root.removeChild(this._stack[f])}}this._stack.length=0;this._stackSize=0}}function VectorVML(d,c,a){SD.util.initVML();this.div=d;if(!c){c=this.div.clientWidth}if(!a){a=this.div.clientHeight}var b=document.createElement("v:group");b.style.cssText="width:"+c+"px; height:"+a+"px; position: absolute; ";this.div.appendChild(b);this._root=b;this.width=c;this.height=a;this._currentShape=null;this._stack=[];this._stackSize=0;this.setPosition=function(f,e){if(!isNaN(e)){this._root.style.left=e+"px"}if(!isNaN(f)){this._root.style.top=f+"px"}};this.setViewBox=function(f,e){if(!e){e=2}this._root.setAttribute("coordorigin",f.left+" "+f.top);this._root.setAttribute("coordsize",parseFloat(f.width())+","+parseFloat(f.height()))};this.setSize=function(e){this._root.style.width=e.width+"px";this._root.style.height=e.height+"px";this.width=e.width;this.height=e.height};this.setAttribute=function(f,e){for(i in e){f.i=e[i]}};this.createCircle=function(m,g){var f=document.createElement("v:oval");f.strokeweight=2;if(g.diameter){var e=g.diameter*2;f.style.cssText="width: "+e+"px;height: "+e+"px; left: "+(m.x-g.diameter)+"px; top: "+(m.y-g.diameter)+"px; "}if(g.diameterHorizontal&&g.diameterVertical){var e=g.diameterHorizontal*2;var j=g.diameterVertical*2;f.style.cssText="width: "+e+"px;height: "+j+"px; left: "+(m.x-g.diameterHorizontal)+"px; top: "+(m.y-g.diameterVertical)+"px; "}f.filled=g.bgColor=="none"?false:true;if(g.lineColor||g.size){f.strokecolor=g.lineColor||g.size}if(g.lineWidth||g.size){f.strokeweight=(g.lineWidth||g.size)+"px"}var l=document.createElement("v:stroke");l.endcap="round";if(g.opacity){l.opacity=g.opacity}if(g.dash){l.dashstyle="dash"}f.appendChild(l);if(g.fillOpacity>0){var k=document.createElement("v:fill");k.unselectable="on";if(g.bgColor){k.color=g.bgColor}if(g.fillOpacity){k.opacity=g.fillOpacity}f.appendChild(k)}this._root.appendChild(f);this._pushStack(f)};this.createArrow=function(g,f){var e=document.createElement("v:polyline");e.filled=false;if(f.lineColor){e.strokecolor=f.lineColor}if(f.lineWidth){e.strokeweight=f.lineWidth+"px"}e.points=(g.x+f.diameter-5)+","+(g.y-5)+" "+(g.x+f.diameter)+","+g.y+" "+g.x+","+g.y+" "+(g.x+f.diameter)+","+g.y+" "+(g.x+-5)+","+(g.y+5);this._root.appendChild(e);this._pushStack(e)};this.createText=function(g,e){var f=document.createElement("v:line");f.from=g.x+e.diameter+" "+(g.y-10);f.to=(g.x+e.diameter+10)+" "+(g.y-11);f.innerHTML="<v:fill on='True' color='red'/><v:path textpathok='True'/><v:textpath on='True' string='"+e.text+"' style='font-family:Arial;font-size:8pt;'/>";this._root.appendChild(f);this._pushStack(f)};this._pushStack=function(e){if(this._stackSize+1<this._stack.length){this._stack.length=this._stackSize+1}this._stack[this._stackSize++]=e};this.clear=function(){for(var e=this._stack.length;e--;){if(this._stack[e]!=undefined){this._root.removeChild(this._stack[e])}}this._stack.length=0;this._stackSize=0}}function PolylineHandle(a){this.canvas=a._root;this.object=null;if(SD.isSvg){this.initSVG()}else{this.initVML()}}PolylineHandle.prototype.initSVG=function(){if(this.object==null){this.object=document.createElementNS(_XMLNS_SVG,"rect");this.object.setAttribute("width",10);this.object.setAttribute("height",10);this.object.setAttribute("stroke","black");this.object.setAttribute("fill","white");this.object.setAttribute("display","none");if(this.canvas!=null){this.canvas.appendChild(this.object)}}};PolylineHandle.prototype.setPosition=function(a){if(SD.isSvg){this.object.setAttribute("x",a.x);this.object.setAttribute("y",a.y);this.object.setAttribute("display","inline")}else{this.object.style.left=a.x+"px";this.object.style.top=a.y+"px";this.object.style.display="inline"}};PolylineHandle.prototype.initVML=function(){if(this.object==null){this.object=document.createElement("v:rect");this.object.style.cssText="width:10px;height:10px;position:absolute;display:none";this.object.filled=true;this.object.strokecolor="black";this.object.strokeweight="1px";if(this.canvas!=null){this.canvas.appendChild(this.object)}}};function PolylineVector(a){this.canvas=a._root;this.points=null;this.options={};this.arrow=[];this.object=null}PolylineVector.prototype.init=function(b,a){this.points=b;this.options=a;if(SD.isSvg){this.initSVG()}else{this.initVML()}this.setPoints(this.points)};PolylineVector.prototype.addArrow=function(h,f,n){var c=12;var l=new Point(f.x-h.x,f.y-h.y);var m=Math.sqrt(Math.pow(l.x,2)+Math.pow(l.y,2));var o=new Point(l.x/m,l.y/m);var b=new Point(f.x-(c*o.x),f.y-(c*o.y));var k=new Point(l.y,-l.x);var a=Math.sqrt(Math.pow(k.x,2)+Math.pow(k.y,2));var d=new Point(k.x/a,k.y/a);var g=f;var j=new Point(b.x+(c*d.x/2),b.y+(c*d.y/2));var e=new Point(b.x-(c*d.x/2),b.y-(c*d.y/2));if(SD.isSvg){this.arrowSVG(j,g,e,n)}else{this.arrowVML(j,g,e,n)}};PolylineVector.prototype.clearArrow=function(){for(var a=0,b=this.arrow.length;a<b;a++){this.canvas.removeChild(this.arrow[a])}this.arrow=[]};PolylineVector.prototype.initVML=function(){if(this.object==null){this.object=document.createElement("v:polyline");this.object.filled=!this.options.bgColor?false:true;if(this.options.color){this.object.strokecolor=this.options.color}if(this.options.size){this.object.strokeweight=this.options.size+"px"}var b=document.createElement("v:stroke");b.endcap="round";if(this.options.opacity){b.opacity=this.options.opacity}if(this.options.dash){b.dashstyle=this.options.dash+" 1"}this.object.appendChild(b);if(this.options.fillOpacity){var a=document.createElement("v:fill");a.unselectable="on";if(this.options.bgColor){a.color=this.options.bgColor}if(this.options.fillOpacity){a.opacity=this.options.fillOpacity}this.object.appendChild(a)}this.canvas.appendChild(this.object)}};PolylineVector.prototype.setPoints=function(b){if(!b||this.points.length==0){return}var c="";for(var a=0;a<this.points.length;a++){c+=(a>0?" ":"")+this.points[a].x+","+this.points[a].y}if(SD.isSvg){this.object.setAttribute("points",c)}else{this.object.points.value=c}};PolylineVector.prototype.clear=function(){if(this.object!=null){if(SD.isSvg){this.object.setAttribute("points","")}else{this.object.points.value=""}}};PolylineVector.prototype.initSVG=function(){if(this.object==null){this.object=document.createElementNS(_XMLNS_SVG,"polyline");if(!this.options.bgColor){this.options.bgColor="none"}if(this.options.bgColor){this.object.setAttribute("fill",this.options.bgColor)}if(this.options.color){this.object.setAttribute("stroke",this.options.color)}if(this.options.size){this.object.setAttribute("stroke-width",this.options.size)}if(this.options.opacity){this.object.setAttribute("opacity",this.options.opacity)}if(this.options.fillOpacity>0){this.object.setAttribute("fill-opacity",this.options.fillOpacity)}if(this.options.dash>0){this.object.setAttribute("stroke-dasharray",this.options.dash)}this.object.setAttribute("stroke-linecap","round");this.object.setAttribute("stroke-linejoin","round");this.canvas.appendChild(this.object)}};PolylineVector.prototype.arrowSVG=function(f,d,c,a){var e=document.createElementNS(_XMLNS_SVG,"polyline");if(a.color){e.setAttribute("fill",a.color);e.setAttribute("stroke",a.color)}if(a.size){e.setAttribute("stroke-width",a.size)}e.setAttribute("stroke-linecap","round");e.setAttribute("stroke-linejoin","round");var b=d.x+","+d.y+" "+f.x+","+f.y+" "+c.x+","+c.y;e.setAttribute("points",b);this.canvas.appendChild(e);this.arrow.push(e)};PolylineVector.prototype.arrowVML=function(f,d,c,a){var e=document.createElement("v:polyline");e.filled=true;if(a.color){e.fillcolor=a.color;e.strokecolor=a.color}if(a.size){e.strokeweight=a.size+"px"}var b=d.x+","+d.y+" "+f.x+","+f.y+" "+c.x+","+c.y;e.points=b;var g=document.createElement("v:stroke");g.endcap="round";if(a.opacity){g.opacity=a.opacity}e.appendChild(g);this.canvas.appendChild(e);this.arrow.push(e)};function DrawingVector(){if(SD.isSvg){DrawingVector=VectorSVG}else{DrawingVector=VectorVML}DrawingVector.prototype.constructor=DrawingVector}DrawingVector();function MapBubble(a,b,d,c){this.obj=null;this.content=null;this.mapClient=null;this.point=null;this.type="";this.arrow="";this.arrow_img="";this.w=a;this.h=b;this.bg_color=d?"_"+d:"";this.content_color=c;this.top=this.left=null;this.midBorder=this.botBorder=this.blBorder=this.brBorder=null;if(this.bg_color){this.color=d}else{this.color="#f1eedb"}if(this.content_color){this.content_color=c}this.bo=null;this.auto_pan=false;this.auto_pan_timer=null;this.arrow_style=0;this.setContent=function(f,e){this.point=e;if(f==undefined){f="Loading..."}this.content.innerHTML=f;this.obj.style.display="";this.obj.style.position="absolute";this.obj.style.cursor="default";this.updatePosition()};this.init=function(q){loadCSS("/css/map/bubble.css?v=8");this.mapapi=q;var e;if(SD.isIE6){e="bubble"+this.bg_color+"_ie"}else{e="bubble"+this.bg_color}this.obj=document.createElement("div");this.obj.style.zIndex=20;var h=document.createElement("img");if(this.arrow_pos<=1){var r=SD.util.createImgSprite(e,7,7,0,0,0,0);var o=SD.util.createImgSprite(e,7,7,43,0,(this.w-7),0);this.blBorder=SD.util.createImgSprite(e,7,7,0,44,0,(this.h-9));this.brBorder=SD.util.createImgSprite(e,7,7,43,44,(this.w-7),(this.h-9));if(this.arrow_pos==0){var m=this.h-8;var k=SD.util.createImgSprite(e,127,29,0,78,0,m+5)}else{var m=this.h-4;var j=document.all?this.w-31:this.w-30;var k=SD.util.createImgSprite(e,127,29,0,109,j-108,m-2)}h.style.cssText="position: absolute; left: "+(this.w-22)+"px; top: 9px; width: 12 px; height: 12px; border:0px; z-Index:100;"}else{if(this.arrow_pos<=3){var r=SD.util.createImgSprite(e,7,7,0,0,0,0);var o=SD.util.createImgSprite(e,7,7,43,0,(this.w-7),0);this.blBorder=SD.util.createImgSprite(e,7,7,0,44,0,(this.h-8));this.brBorder=SD.util.createImgSprite(e,7,7,43,44,(this.w-7),(this.h-8));if(this.arrow_pos==2){var j=document.all?this.w-31:this.w-30;var k=SD.util.createImgSprite(e,127,29,0,143,j-116,-28)}else{var k=SD.util.createImgSprite(e,127,29,0,174,0,-28)}h.style.cssText="position: absolute; left: "+(this.w-25)+"px; top: 10px; width: 12 px; height: 12px; border:0px; z-Index:100;"}else{if(this.arrow_pos==4){var r=SD.util.createImgSprite(e,7,7,0,0,0,0);var o=SD.util.createImgSprite(e,7,7,43,0,(this.w-7),0);this.blBorder=SD.util.createImgSprite(e,7,7,0,44,0,(this.h-8));this.brBorder=SD.util.createImgSprite(e,7,7,43,44,(this.w-7),(this.h-8));var k=SD.util.createImgSprite(e,9,15,152,26,(this.w-3),(Math.round(this.h/2)-5));h.style.cssText="position: absolute; left: "+(this.w-25)+"px; top: 10px; width: 12 px; height: 12px; border:0px; z-Index:100;"}else{var r=SD.util.createImgSprite(e,7,7,0,0,0,0);var o=SD.util.createImgSprite(e,7,7,43,0,(this.w-7),0);this.blBorder=SD.util.createImgSprite(e,7,7,0,44,0,(this.h-8));this.brBorder=SD.util.createImgSprite(e,7,7,43,44,(this.w-7),(this.h-8));var k=SD.util.createImgSprite(e,9,15,143,26,-7,(Math.round(this.h/2)-5));h.style.cssText="position: absolute; left: "+(this.w-25)+"px; top: 10px; width: 12 px; height: 12px; border:0px; z-Index:100;"}}}this.arrow=k;h.src="http://"+location.hostname+"/dragmap/xg/img/silang.gif";h.title="Close";this.exBtn=h;this.exBtn.style.cursor="pointer";this.exBtn.o=this;var l=this.type.indexOf("prem")!=-1;this.exBtn.onclick=function(){this.o.obj.style.display="none";if($("content_listing")&&$("content_listing").style.display!="none"){unhighlightCompany(last_update_bg_side_bar-1,l)}if(global.nearby_last_idx!=undefined){if($("comList_"+global.nearby_last_idx)){$("comList_"+global.nearby_last_idx).childNodes[0].style.backgroundColor="#FFFFFF"}}if(global.current_photo_tab_active){global.current_photo_tab_active=undefined}global_bubble_flag="";global_bubble.company_id=global_bubble.directory=null;last_update_bg_side_bar=null;if(global.onbus&&global.onbus==true){global.onbus=""}else{if(global.loadPhotopage&&global.loadPhotopage=="show"){global.loadPhotopage=""}else{if(global.plusminus){$("plusminus_list_"+global.plusminus).className="ic_review_plus";global.plusminus=""}if(global.businessCompanyList){if($("mapinclude-sidenav")){$("mapinclude-sidenav").parentNode.removeChild($("mapinclude-sidenav"));close_mini_site()}}}}if(global.more_info_placeid){global.more_info_placeid=""}};var j=document.all?(MapAPI.feature=="dd"?0:2):2;var n=document.all?27:27;var g=document.createElement("div");this.midBorder=document.createElement("div");this.botBorder=document.createElement("div");this.content=document.createElement("div");this.content.id="map_bubble_content";var s=this.color;var p=this.content_color;var f;if(p){f="background-color:"+p+";";wbgcontent="27"}else{f="";wbgcontent="32"}if(this.arrow_pos<=1){g.style.cssText="border-top: 1px solid rgb(171, 171, 171); position: absolute; left: 7px; top: 0px; width: "+(this.w-14)+"px;height: 25px; background-color: "+s+";";this.midBorder.style.cssText="border-left: 1px solid rgb(171, 171, 171); border-right: 1px solid rgb(171, 171, 171); position: absolute; left: 0px; top: 7px; width: "+(this.w-j)+"px;height: "+(this.h-15)+"px; background-color: "+s+";";this.botBorder.style.cssText="border-bottom: 1px solid rgb(171, 171, 171); position: absolute; left: 7px; top: "+(this.h-8)+"px;width: "+(this.w-14)+"px; height: 5px; background-color: "+s+"; overflow: hidden;";this.content.style.cssText="position: absolute; left: 8px; top: 4px; width: "+(this.w-wbgcontent)+"px; z-index: 10; text-align:left; "+f+""}else{if(this.arrow_pos<=3){g.style.cssText="border-top: 1px solid rgb(171, 171, 171); position: absolute; left: 7px; top: 0px; width: "+(this.w-14)+"px;height: 25px; background-color: "+s+";";this.midBorder.style.cssText="border-left: 1px solid rgb(171, 171, 171); border-right: 1px solid rgb(171, 171, 171); position: absolute; left: 0px; top: 7px; width: "+(this.w-j)+"px;height: "+(this.h-15)+"px; background-color: "+s+";";this.botBorder.style.cssText="border-bottom: 1px solid rgb(171, 171, 171); position: absolute; left: 7px; top: "+(this.h-8)+"px;width: "+(this.w-14)+"px; height: 5px; background-color: "+s+"; overflow: hidden;";this.content.style.cssText="position: absolute; left: 8px; top: 4px; width: "+(this.w-wbgcontent)+"px; z-index: 10; text-align:left;"+f+""}else{if(this.arrow_pos==4){g.style.cssText="border-top: 1px solid rgb(171, 171, 171); position: absolute; left: 7px; top: 0px; width: "+(this.w-14)+"px;height: 25px; background-color: "+s+";";this.midBorder.style.cssText="border-left: 1px solid rgb(171, 171, 171); border-right: 1px solid rgb(171, 171, 171); position: absolute; left: 0px; top: 7px; width: "+(this.w-j)+"px;height: "+(this.h-15)+"px; background-color: "+s+";";this.botBorder.style.cssText="border-bottom: 1px solid rgb(171, 171, 171); position: absolute; left: 7px; top: "+(this.h-8)+"px;width: "+(this.w-14)+"px; height: 5px; background-color: "+s+"; overflow: hidden;";this.content.style.cssText="position: absolute; left: 8px; top: 4px; width: "+(this.w-wbgcontent)+"px; z-index: 10; text-align:left;"+f+""}else{if(this.arrow_pos==5){g.style.cssText="border-top: 1px solid rgb(171, 171, 171); position: absolute; left: 7px; top: 0px; width: "+(this.w-14)+"px;height: 25px; background-color: "+s+";";this.midBorder.style.cssText="border-left: 1px solid rgb(171, 171, 171); border-right: 1px solid rgb(171, 171, 171); position: absolute; left: 0px; top: 7px; width: "+(this.w-j)+"px;height: "+(this.h-15)+"px; background-color: "+s+";";this.botBorder.style.cssText="border-bottom: 1px solid rgb(171, 171, 171); position: absolute; left: 7px; top: "+(this.h-8)+"px;width: "+(this.w-14)+"px; height: 5px; background-color: "+s+"; overflow: hidden;";this.content.style.cssText="position: absolute; left: 8px; top: 4px; width: "+(this.w-wbgcontent)+"px; z-index: 10; text-align:left;"+f+""}}}}this.obj.appendChild(r);this.obj.appendChild(o);this.obj.appendChild(this.blBorder);this.obj.appendChild(this.brBorder);this.obj.appendChild(g);this.obj.appendChild(this.midBorder);this.obj.appendChild(this.botBorder);this.obj.appendChild(k);this.obj.appendChild(this.exBtn);this.obj.appendChild(this.content);this.obj.onmousedown=function(i){SD.util.cancelEvent(i);return false}};this.moveArrowByOffset=function(h,f){var g=parseInt(this.arrow.style.left);var e=parseInt(this.arrow.style.top);if(!isNaN(g)&&!isNaN(e)){this.arrow.style.left=(g+h)+"px";this.arrow.style.top=(e+f)+"px"}};this.updatePosition=function(){var p=new Vertex(0,0),u,s;var t=this.mapapi.viewportInfo.projection.geoToScreen(this.point.x,this.point.y,this.mapapi.viewportInfo.scale,this.mapapi.viewportInfo.topLeftScreen);if(t.x==null||t.y==null){return}var o=this.mapapi.canvasInfo.topLeftContainer;var j=new Point(t.x,t.y);t.x+=-(parseInt(o.x));t.y+=-(parseInt(o.y));var g=t;var q=g;s=new Point(this.w,this.h);u=new Point(0,0);g=SD.util.offsetPoint(g,parseInt(u.x),parseInt(u.y));q=SD.util.offsetPoint(q,parseInt(s.x),parseInt(s.y));var l=document.all?2:2;var n=this.type.indexOf("prem")!=-1||global.branch?9:0;var e;if(this.bo!=null){e=this.bo}else{e=new Point(7,7)}var r=get_height();if(this.arrow_pos<=1){if(this.arrow_pos==0){this.obj.style.left=(g.x-l)-n+e.x+"px";this.top=(g.y-this.h+n+1)-25}else{this.obj.style.left=(g.x-this.w+21)-n+e.x+"px";this.top=(g.y-this.h+n+2)-25}}else{if(this.arrow_pos<=3){if(this.arrow_pos==2){this.obj.style.left=(g.x-this.w+21)-n+e.x+"px";this.top=g.y+13+n+14}else{this.top=g.y+14+n+14;var k=parseInt(o.y)+this.top;if(this.arrow_style==1&&k<170){k=parseInt(o.x)+g.x+this.w;if(k>=660){this.top=g.y+14+n;this.obj.style.left=(g.x-l)-n+e.x-(k-603)+"px";this.obj.removeChild(this.arrow);this.arrow=SD.util.createImgSprite("bubble",16,10,162,0,k-607,-7);this.obj.appendChild(this.arrow)}else{this.obj.style.left=(g.x-l)-n+e.x+"px"}}else{this.obj.style.left=(g.x-l)-n+e.x+"px"}}}else{if(this.arrow_pos==4){var f=j.y/r;if(f<0.05){f=0.075}else{if(f>0.75){f=0.75}}this.arrow.style.top=Math.round(f*this.h)+"px";this.obj.style.left=(g.x-this.w)-15+e.x+"px";this.top=g.y-Math.round(f*this.h)-7}else{var f=j.y/r;if(f<0.05){f=0.075}else{if(f>0.75){f=0.75}}this.arrow.style.top=Math.round(f*this.h)+"px";this.obj.style.left=g.x+e.x+15+"px";this.top=g.y-Math.round(f*this.h)-7}}}this.obj.style.top=this.top+e.y+"px";var m=new Object;m.left=parseInt(this.obj.style.left);m.top=parseInt(this.obj.style.top);m.right=m.left+this.w;m.bottom=m.top+this.h;var h=0,i=10};this.fitHeight=function(){this.setHeight(this.content.offsetHeight+10)};this.setHeight=function(e){var f=this.h;this.h=e;this.midBorder.style.height=(this.h-15)+"px";this.botBorder.style.top=this.blBorder.style.top=this.brBorder.style.top=(this.h-8)+"px";if(this.arrow_pos<=1){var i=this.h-f;this.top=this.top-i;if(this.bo==null){this.obj.style.top=this.top+"px"}else{this.obj.style.top=this.top+this.bo.y+"px"}this.moveArrowByOffset(0,i)}else{if(this.arrow_pos==4||this.arrow_pos==5){var h=this.mapapi.viewportInfo.projection.geoToScreen(this.point.x,this.point.y,this.mapapi.viewportInfo.scale,this.mapapi.viewportInfo.topLeftScreen);var g=get_height();if(h.y/g>=0.5){var i=this.h-f;this.top=this.top-i;if(this.bo==null){this.obj.style.top=this.top+"px"}else{this.obj.style.top=this.top+this.bo.y+"px"}this.moveArrowByOffset(0,i)}}}};this.setOptions=function(e){if(e.bo){this.bo=e.bo}if(e.auto_pan){this.auto_pan=e.auto_pan}if(e.arrow_style){this.arrow_style=e.arrow_style}}}SD.genmap.SDInfoWindow=function(options){this.marker=null;this.content="";this.visible=true;this.size=new Size(200,100);SD.apply(this,new StdLayer());SD.apply(this,options);this.popup=null;this.open=function(marker,bubble){this.marker=marker;this.init(bubble);this.visible=true;global.on_bubble=true;return this.popup};this.close=function(){this.visible=false;this.setDisplay(false);global.on_bubble=false;if(global.current_photo_tab_active){global.current_photo_tab_active=undefined}};this.draw=function(clickable){if(this.marker==null){this.setDisplay(false);return}if(this.marker.visible||this.visible){this.setDisplay(false);return}};this.init=function(buble){this.mapapi=MapAPI;var tmp_type,pos,arrow_pos,type=1;this.bubble=buble;var pos=this.mapapi.viewportInfo.projection.geoToScreen(this.bubble.point.x,this.bubble.point.y,this.mapapi.viewportInfo.scale,this.mapapi.viewportInfo.topLeftScreen);var map_width=get_width(),map_height=get_height();var total_buble_h=buble.h+(buble.options.bo?buble.options.bo.y:0)+40;if(typeof(this.bubble.options.arrow_style)=="undefined"){this.bubble.options.arrow_style=1}if(this.bubble.options&&this.bubble.options.arrow_style==1){if(pos.x<map_width/4){arrow_pos=5}else{if((pos.x>=map_width/4)&&(pos.x<=map_width*3/4)){if(pos.x>map_width/2){arrow_pos=pos.y>=map_height/2?(eval(pos.y-total_buble_h)>0?1:4):(eval(pos.y+total_buble_h)>map_height?4:2)}else{arrow_pos=pos.y>=map_height/2?(eval(pos.y-total_buble_h)>0?0:5):(eval(pos.y+total_buble_h)>map_height?5:3)}}else{arrow_pos=4}}}else{if(pos.x>map_width/2){arrow_pos=pos.y>=map_height/2?1:2}else{arrow_pos=pos.y>=map_height/2?0:3}}if(this.popup){this.popup.obj.parentNode.removeChild(this.popup.obj);this.popup=null}var map_bubble=new MapBubble(this.bubble.w,this.bubble.h,this.bubble.color,this.bubble.content_color);map_bubble.arrow_pos=arrow_pos;if(this.bubble.options){map_bubble.setOptions(this.bubble.options)}map_bubble.init(this.mapapi);map_bubble.setContent(this.bubble.content,this.bubble.point);map_bubble.obj.onmouseover=function(){global.on_bubble=true};map_bubble.obj.onmouseout=function(){global.on_bubble=false};map_bubble.obj.ondblclick=function(e){SD.util.cancelEvent(e)};var mousewheel=function(e){if($("tab_photo_ajax")){onwheel(e,$("tab_photo_ajax").childNodes[0])}else{onwheel(e)}};EventManager.add(map_bubble.obj,"DOMMouseScroll",mousewheel);EventManager.add(map_bubble.obj,"mousewheel",mousewheel);if(map_bubble.auto_pan){map_bubble.autoPan()}this.div=map_bubble.obj;this.popup=map_bubble;this.mapapi.viewport.hintLayer.addNode(this)}};SD.genmap.SDTooltip=function(){this.div=null;this.content=null;this.mapapi=null;this.w=20;this.h=30;this.offset_top=1;this.arrow_pos=0;this.type=null;this.color="#f1eedb";this.setContent=function(a,i){loadCSS("/css/map/bubble.css?v=8");this.div.style.zIndex=15;this.div.style.display="block";this.pos=this.mapapi.viewportInfo.projection.geoToScreen(i.x,i.y,this.mapapi.viewportInfo.scale,this.mapapi.viewportInfo.topLeftScreen);if(SD.isIE6){var b='<div style="overflow: hidden; width: 7px; height: 7px; position: relative; left: 0px; top: 0px;"><div class="bubble" style="position: absolute; left: 0px; top: 0px; width: 178px; height: 76px;"></div></div>';var f='<div style="overflow: hidden; width: 7px; height: 7px; position: relative; left: 0; top: 0px;"><div class="bubble" style="position: absolute; left: -43px; top: 0px; width: 178px; height: 76px;"></div></div>';var c='<div style="overflow: hidden; width: 7px; height: 6px; position: relative; left: 0px; top: 0px;"><div class="bubble" style="position: absolute; left: 0px; top: -44px; width: 178px; height: 76px;"></div></div>';var g='<div style="overflow: hidden; width: 7px; height: 6px; position: relative; left: 0px; top: 0px;"><div class="bubble" style="position: absolute; left: -43px; top: -44px; width: 178px; height: 76px;"></div></div>'}else{var b='<div class="bubble" style="overflow: hidden; width: 7px; height: 7px; position: relative; left: 0px; top: 0px; background-position: 0px 0px;"></div>';var f='<div class="bubble" style="overflow: hidden; width: 7px; height: 7px; position: relative; left: 0; top: 0px; background-position: -43px 0px;"></div>';var c='<div class="bubble" style="overflow: hidden; width: 7px; height: 6px; position: relative; left: 0px; top: 0px; background-position: 0px -44px;"></div>';var g='<div class="bubble" style="overflow: hidden; width: 7px; height: 6px; position: relative; left: 0px; top: 0px; background-position: -43px -44px;"></div>'}var d='<table height="20" cellspacing="0" cellpadding="0" border="0"><tr><td height="7" width="7" valign="bottom" align="right">'+b+'</td><td style="line-height: 6px; border-top: 1px solid rgb(171, 171, 171); background-color: '+this.color+'">&nbsp;</td><td width="7" valign="bottom">'+f+'</td></tr><tr style="height: 15px;"><td style="border-left: 1px solid #ababab;background-color: '+this.color+'">&nbsp;</td><td class="ver_11" nowrap="nowrap" style="background-color: '+this.color+'">'+a+'</td><td style="border-right: 1px solid #ababab; background-color: '+this.color+'">&nbsp;</td></tr><tr><td valign="top" align="right">'+c+'</td><td style="background-color: '+this.color+'; border-bottom: 1px solid #ababab; line-height: 5px">&nbsp;</td><td valign="top">'+g+"</td></tr></table>";var e=get_width(),h=get_height();if(this.pos.x>e/2){if(this.pos.y>=h/2){this.arrow_pos=1;if(SD.isIE6){this.div.innerHTML=d+'<div id="tooltip_arrow" style="overflow: hidden; width: 15px; height: 9px; position: relative; left: 0px; top: -2px; z-index: 1;"><div class="bubble" style="position: absolute; left: -163px; top: -10px; width: 178px; height: 76px;"></div></div>'}else{this.div.innerHTML=d+'<div class="bubble" id="tooltip_arrow" style="overflow:hidden; width: 15px; height: 9px; position: relative; left: 0px; top: -2px; z-index: 1; background-position: -163px -10px;"></div>'}$("tooltip_arrow").style.left=(this.div.offsetWidth-(document.all?30:29))+"px"}else{this.arrow_pos=2;if(SD.isIE6){this.div.innerHTML='<div id="tooltip_arrow" style="overflow: hidden; width: 15px; height: 9px; position: relative; left: 0px; top: 2px; z-index: 1;"><div class="bubble" style="position: absolute; left: -163px; top: -0px; width: 178px; height: 76px;"></div></div>'+d}else{this.div.innerHTML='<div class="bubble" id="tooltip_arrow" style="overflow:hidden; width: 15px; height: 9px; position: relative; left: 0px; top: 2px; z-index: 1; background-position: -163px -0px;"></div>'+d}$("tooltip_arrow").style.left=(this.div.offsetWidth-(document.all?30:29))+"px"}}else{if(this.pos.y>=h/2){this.arrow_pos=0;if(SD.isIE6){this.div.innerHTML=d+'<div id="tooltip_arrow" style="overflow: hidden; width: 8px; height: 15px; position: relative; left: 0px; top: -6px; z-index: 1;"><div class="bubble" style="position: absolute; left: -163px; top: -35px; width: 178px; height: 76px;"></div></div>'}else{this.div.innerHTML=d+'<div class="bubble" id="tooltip_arrow" style="overflow:hidden; width: 8px; height: 15px; position: relative; left: 0px; top: -6px; z-index: 1; background-position: -163px -35px;"></div>'}}else{this.arrow_pos=3;if(SD.isIE6){this.div.innerHTML='<div id="tooltip_arrow" style="overflow: hidden; width: 8px; height: 15px; position: relative; left: 0px; top: 8px; z-index: 1;"><div class="bubble" style="position: absolute; left: -163px; top: -19px; width: 178px; height: 76px;"></div></div>'+d}else{this.div.innerHTML='<div class="bubble" id="tooltip_arrow" style="overflow:hidden; width: 8px; height: 15px; position: relative; left: 0px; top: 8px; z-index: 1; background-position: -163px -19px;"></div>'+d}}}this.updatePosition()};this.open=function(a,c){this.marker=a;this.mapapi=this.marker.map;this.close();this.div=document.createElement("div");this.mapapi.viewport.hintLayer.addNode(this);this.div.style.cssText="position: absolute; z-index:15; cursor:pointer;left:0px;top:0px;";this.setOptions(c);this.setContent(this.content,this.point);this.div.onmouseover=function(d){if(checkMouseEnter(this,d)){global.on_tooltips=true}};var b=this;this.div.onmouseout=function(d){if(checkMouseLeave(this,d)){b.close()}}};this.close=function(){if(this.div){this.mapapi.viewport.hintLayer.removeNode(this);global.on_tooltips=undefined}};this.setOptions=function(a){if(a.offset){this.offset=a.offset}else{this.offset=new Point(7,7)}if(a.content){this.content=a.content}if(a.point){this.point=a.point}if(a.type){this.type=a.type}};this.updatePosition=function(){var i,g,a;if(this.pos.x==null||this.pos.y==null){return}var e=this.mapapi.canvasInfo.topLeftContainer;this.pos.x+=-(parseInt(e.x));this.pos.y+=-(parseInt(e.y));var b=this.pos;var f=b;g=new Point(this.w,this.h);i=new Point(0,0);b=SD.util.offsetPoint(b,parseInt(i.x),parseInt(i.y));f=SD.util.offsetPoint(f,parseInt(g.x),parseInt(g.y));var c=this.offset;a=get_level();var d=this.type.indexOf("prem")!=-1||global.branch?(a>9?7:3):0;var h=this.type.indexOf("prem")!=-1||global.branch?(a>9?10:5):0;if(this.arrow_pos==1||this.arrow_pos==2){this.div.style.left=b.x-this.div.offsetWidth+21-d+c.x+"px"}else{this.div.style.left=b.x-2-d+c.x+"px"}if(this.arrow_pos==2){this.div.style.top=b.y+4+d+c.y-3+"px"}else{if(this.arrow_pos==3){this.div.style.top=b.y-1+d+c.y-3+"px"}else{if(this.arrow_pos==1){this.div.style.top=b.y-this.div.offsetHeight+9+h+c.y+"px"}else{this.div.style.top=b.y-this.div.offsetHeight+12+h+c.y+"px"}}}}};MapManager.prototype.initConfigDefault=function(){var u=new SD.projection.Server();var ah=u.get("Mercator WGS-1984");var A=u.get("UTM WGS-1984 47N");var ao=u.get("UTM WGS-1984 48N");var an=u.get("UTM WGS-1984 48S");var X=u.get("UTM WGS-1984 49S");var K=new MapArea([103.6200398313086,1.356649474421636,103.6350875106329,1.368929084250946,103.6424080615462,1.377320102299126,103.6485086104722,1.388780861973965,103.6501354594518,1.396353325130837,103.6517623084313,1.401265001901773,103.6533887980847,1.406176859491704,103.6589810802229,1.410269968672233,103.6611161959902,1.413442241629033,103.6640649159104,1.416000357978513,103.6664035000895,1.418660907472505,103.6690469724761,1.423470383190593,103.6688435938958,1.426437870483011,103.6695553290954,1.429200762712738,103.6715885759094,1.431042560134716,103.6731139152619,1.434112365386708,103.6745373856611,1.436363525768819,103.6770793484206,1.43830757001366,103.6801295779678,1.439228647201329,103.6828745599815,1.440149543572903,103.683484785554,1.441172781854218,103.6847048773729,1.442093859041886,103.686738124187,1.442093859041886,103.6887717303271,1.441889175222404,103.6898903125189,1.442400613546967,103.6902967103535,1.444344929015951,103.6914152027137,1.44587987684597,103.6943640124654,1.448437969483152,103.6979225986319,1.450996315498402,103.6986343338315,1.452838093186672,103.6986343338315,1.454168255916277,103.698024108259,1.455498509053191,103.6968041062716,1.45590787334597,103.6955840144527,1.45590787334597,103.6955840144527,1.456624080043715,103.6969056158987,1.457647490775662,103.6992442000779,1.457647490775662,103.7016845633787,1.457647490775662,103.7043280357653,1.458363697473408,103.7057515061645,1.459898542349402,103.7088018255433,1.4615358187059,103.7123600523837,1.462456707550035,103.7154102819309,1.463377777208787,103.7172405993223,1.464400916718809,103.7178507350633,1.465935852002112,103.7176473564829,1.467675277607003,103.7170371309104,1.469210200185327,103.7163253957108,1.470438011678803,103.7164273544956,1.472484635387608,103.7169356212833,1.474224057605004,103.7169356212833,1.475554390137696,103.715715619296,1.475656549550672,103.7108350723573,1.476372931133346,103.7095135607429,1.476577611585539,103.7059548847448,1.477191472128996,103.7037179000243,1.47954511651609,103.7040227882318,1.48230785058789,103.7067681295715,1.48312639158354,103.7104283151967,1.481079948687854,103.7145970371042,1.479135755611705,103.7192742054625,1.478521714255128,103.7218158088958,1.475349709685504,103.7243577716553,1.46941488063752,103.7274080012026,1.46481010019697,103.7314749439884,1.460410066900759,103.7346267729942,1.458670630285683,103.7391004729406,1.457238126482884,103.7466244922658,1.455396167979997,103.7547582880059,1.453145025998948,103.7595369659913,1.452224046747504,103.764112534891,1.453554209477109,103.7721449108355,1.457033444336494,103.7784484790156,1.463786960686949,103.7817018176486,1.466038193075306,103.7858706293876,1.469721810909249,103.7887174803545,1.47299633651809,103.7911575741608,1.475656730363792,103.7929878017206,1.477600833033381,103.7956312741072,1.481284629140047,103.7962414996797,1.484149613031382,103.7962414996797,1.485582187380342,103.7959361623146,1.487526364163415,103.7958346526876,1.489061273878505,103.7968512760946,1.488958934510059,103.7979698582864,1.485786866117235,103.8001049740537,1.483740432940117,103.8033586720128,1.48312639158354,103.8061036540264,1.483740432940117,103.8104758443458,1.484456633709671,103.8160677671579,1.484251953257479,103.8202365788969,1.48312639158354,103.8241000532708,1.480772928009565,103.8270488630225,1.479442776289994,103.8298957139894,1.480056636833452,103.8330475429953,1.479647456742187,103.8361992821696,1.47872639470732,103.839961336748,1.477600833033381,103.8430115662952,1.475656730363792,103.8465702422932,1.474224238418125,103.8511458111929,1.470540351904899,103.8560259988054,1.469005519733135,103.8623299263117,1.467982298285292,103.865786643525,1.465833510928917,103.868938831857,1.462456707550035,103.8716838138707,1.457033444336494,103.8765643608093,1.449870563693261,103.8795127214033,1.446084560665452,103.883173176523,1.4413774656737,103.8856132703293,1.437898383190791,103.8890699875425,1.43544244858115,103.8926285737091,1.434009842660872,103.8944588012689,1.434521552209577,103.8979158778083,1.434623894119318,103.9088966143468,1.431553998459278,103.9173353881259,1.430121482947047,103.9207924646653,1.430019141037306,103.9229276702641,1.430735534405493,103.9229276702641,1.432577417556688,103.9243510508318,1.433498313928262,103.926791144638,1.433395972018521,103.9358405033157,1.431042560134716,103.9385854853293,1.429712295573856,103.9409240695085,1.428791210952245,103.9433641633147,1.429507610102387,103.9466177714423,1.429507610102387,103.9500748479817,1.428177335355391,103.9541417907675,1.426744717872661,103.9582087335533,1.425005162591503,103.9622756763391,1.4246981343843,103.967054264493,1.425312190798707,103.9721381900119,1.425823633251049,103.975493038272,1.427153907998045,103.9804750948377,1.429302924630918,103.9860672871444,1.43042850867627,103.9897274727695,1.431042560134716,103.9935913064696,1.432475075646947,103.9975563803022,1.433702997747744,103.9990817196546,1.435954158129855,103.9981665160432,1.43830757001366,104.0011149664687,1.440968098034736,104.0058940037802,1.445265825387524,104.0089438740013,1.449154361208839,104.0088423643742,1.451712522196148,103.9915577003294,1.467572937380907,103.911235198526,1.564575343654246,103.8953195669742,1.576702314657709,103.8827664193624,1.586267194587582,103.8538907932066,1.599773366332581,103.8311157159768,1.601819594347007,103.8099672182319,1.608368156800595,103.7888193493077,1.619418539597883,103.7619774191237,1.627604009953804,103.7257816013806,1.630878216176219,103.6997528261918,1.628013342231754,103.6830783877195,1.621055507108734,103.6696568387225,1.61246106483475,103.653796004403,1.612870036752814,103.6273604720535,1.613688701308715,103.5875041093592,1.603456938362791,103.5614757833279,1.585857854899834,103.5533415384302,1.558026844814043,103.5545619895752,1.53797172757329,103.5675759729278,1.5150514830032,103.582217164586,1.490084486751363,103.587301090105,1.47187059403103,103.5828273901585,1.446698431307803,103.5781502218002,1.419888839483766,103.5744901260066,1.409655907365181,103.5740832790145,1.400855808516067,103.5771335983932,1.39389744154062,103.5858776197058,1.38571098334313,103.5968583562442,1.37384083777176,103.6060088652229,1.365859091382708,103.609262563182,1.35931008668829,103.6131260375559,1.357672745103775,103.6200398313086,1.356649474421636]);this.addLayer(new MapRasterLayer("wrd",240,345,2,3,-20031716.74,20046263.33,18980182.4,1,true,ah));this.addLayer(new MapRasterLayer("wrd",256,256,7,7,-20037500,20037600,20145100,2,true,ah));this.addLayer(new MapRasterLayer("wrd",256,256,14,14,-20037500,20037600,20145100,3,true,ah));this.addLayer(new MapRasterLayer("wrd",256,256,21,21,-20037500,20037600,20145100,4,true,ah));this.addLayer(new MapRasterLayer("wrd",256,256,216,216,-20235643.082,20401182.518,19547260.685,5,true,ah));this.addLayer(new MapRasterLayer("wrd",256,256,916,916,-20235643.082,20401182.518,19547260.685,6,true,ah));this.addLayer(new MapRasterLayer("wrd",256,256,2200,2200,-20235643.082,20401182.518,19547260.685,7,true,ah));var T=new MapRasterLayer("ph",256,256,290,250,12413420,14127920,2423690,5,false,ah);T.gridSystem={row:1,col:1};var Q=new MapRasterLayer("ph",256,256,860,760,12401210,14125460,2412080,6,false,ah);Q.gridSystem={row:2,col:1};var P=new MapRasterLayer("ph",256,256,1200,1060,12413240,14123550,2404270,7,false,ah);P.gridSystem={row:2,col:2};var O=new MapRasterLayer("ph",256,256,2800,2800,12421280,14428320,2454320,8,false,ah);O.gridSystem={row:4,col:4};var N=new MapRasterLayer("ph",256,256,5600,4900,12421280,14177440,2454320,9,false,ah);N.gridSystem={row:8,col:7};var C=new MapRasterLayer("ph",256,256,11200,9800,12421280,14177440,2454320,10,false,ah);C.gridSystem={row:16,col:14};var ak=new MapRasterLayer("sg",256,256,70,70,11186657.74,11668634.67,538943.18,"5",false,ah);var aj=new MapRasterLayer("sg",256,256,56,56,11531392.2886,11655119.0086,186194.2375,"6",false,ah);var ai=new MapRasterLayer("sg",256,256,78,78,11531392.2886,11655119.0086,186194.2375,"7",false,ah);var ag=new MapRasterLayer("sg",256,256,32,56,345342.104029,398542.106215,162993.174954,8,false,ao);var af=new MapRasterLayer("sg",256,256,64,112,345342.104029,398542.106215,162993.174954,9,false,ao);var S=new MapRasterLayer("sg",256,256,128,224,345342.104029,398542.106215,162993.174954,10,false,ao);var M=new MapRasterLayerRatio(S,1.0078125);var f=new MapRasterLayer("jb",158,234,8,25,1012279.03,1057879.23,179454.46,5,false,A);var d=new MapRasterLayer("jb",250,250,36,76,1012279.23,1057879.23,179454.46,6,false,A);var c=new MapRasterLayer("jb",250,250,72,152,1012279.23,1057879.23,179454.46,7,false,A);var b=new MapRasterLayer("jb",250,250,144,304,1012279.23,1057879.23,179454.46,8,false,A);var a=new MapRasterLayerRatio(b,2);var B=new MapRasterLayerRatio(a,2);var w=new MapRasterLayerRatio(B,2);f.boundsPolyline=K;d.boundsPolyline=K;c.boundsPolyline=K;b.boundsPolyline=K;a.boundsPolyline=K;B.boundsPolyline=K;var p=new MapRasterLayer("kl",256,256,43,43,660000,960000,500000,5,false,A);var n=new MapRasterLayer("kl",256,256,30,30,751188.14,819798.32,363568.54,6,false,A);var m=new MapRasterLayer("kl",256,256,42,42,751188.14,819798.32,363568.54,7,false,A);var l=new MapRasterLayer("kl",250,250,104,88,762980.49,815780.49,362251.98,8,false,A);var k=new MapRasterLayer("kl",250,250,208,176,762980.49,815780.49,362251.98,9,false,A);var R=new MapRasterLayer("kl",250,250,416,352,762980.49,815780.49,362251.98,10,false,A);var ae=new MapRasterLayer("mlk",191,275,9,15,845986.89,872386.89,260575.38,5,false,A);var ad=new MapRasterLayer("mlk",250,250,36,40,847186.89,871186.89,259375.38,6,false,A);var ac=new MapRasterLayer("mlk",250,250,72,80,847186.89,871186.89,259375.38,7,false,A);var aa=new MapRasterLayer("mlk",250,250,144,160,847186.89,871186.89,259375.38,8,false,A);var Y=new MapRasterLayerRatio(aa,2);var L=new MapRasterLayerRatio(Y,2);var j=new MapRasterLayer("png",261,252,15,17,629953.87,670753.87,611263.57,5,false,A);var i=new MapRasterLayer("png",250,250,58,68,629953.87,670753.87,611263.57,6,false,A);var h=new MapRasterLayer("png",250,250,116,136,629953.87,670753.87,611263.57,7,false,A);var g=new MapRasterLayer("png",250,250,232,272,629953.87,670753.87,611263.57,8,false,A);var e=new MapRasterLayerRatio(g,2);var Z=new MapRasterLayerRatio(e,2);var E=new MapRasterLayer("jkt",256,256,16,16,646862.98,754830.55,9355314.66,5,false,an);var D=new MapRasterLayer("jkt",256,256,47,47,646862.98,754830.55,9355314.66,6,false,an);var z=new MapRasterLayer("jkt",256,256,67,67,646862.98,754830.55,9355314.66,7,false,an);var y=new MapRasterLayer("jkt",256,256,155,165,640000,758272,9351104,8,false,an);var x=new MapRasterLayer("jkt",256,256,310,330,640000,758272,9351104,9,false,an);var o=new MapRasterLayer("jkt",256,256,620,660,640000,758272,9351104,10,false,an);var J=new MapRasterLayer("bali",217,283,5,12,855097.65,1065161.33,9120758.82,5,false,X);var I=new MapRasterLayer("bali",250,250,62,98,878047.82,1020147.82,9109086.09,6,false,X);var H=new MapRasterLayer("bali",250,250,124,196,878047.82,1020147.82,9109086.09,7,false,X);var G=new MapRasterLayer("bali",250,250,248,392,878047.82,1020147.82,9109086.09,8,false,X);var F=new MapRasterLayerRatio(G,2);var ab=new MapRasterLayerRatio(F,2);var W=new MapRasterLayer("btm",256,256,76,76,342960,465360,186150,7,false,ao);var V=new MapRasterLayer("btm",256,256,74,94,375742.11,465042.11,136393.18,8,false,ao);var U=new MapRasterLayer("btm",256,256,148,188,375742.11,465042.11,136393.18,9,false,ao);var al=new MapRasterLayer("btm",256,256,296,376,375742.11,465042.11,136393.18,10,false,ao);var v=new MapRasterLayer("lkw",256,256,5,5,569920.9,604720.89,716397.09,5,false,A);var t=new MapRasterLayer("lkw",256,256,16,15,569920.9,604720.89,716397.09,6,false,A);var s=new MapRasterLayer("lkw",250,250,60,58,569920.9,604720.89,716397.09,7,false,A);var r=new MapRasterLayer("lkw",250,250,120,116,569920.9,604720.89,716397.09,8,false,A);var q=new MapRasterLayer("lkw",250,250,240,232,569920.9,604720.89,716397.09,9,false,A);var am=new MapRasterLayerRatio(q,2);this.addLayer([ak,f,p,ae,j,v,E,T,J]);this.addLayer([d,aj,n,ad,i,t,D,Q,I]);this.addLayer([c,ai,m,ac,h,s,z,P,H]);this.addLayer([b,ag,V,l,aa,r,g,y,O,G]);this.addLayer([a,af,k,q,e,Y,U,x,F,N]);this.addLayer([B,S,al,R,am,Z,L,C,o,ab]);this.addLayer([M,w])};SD.drawing.util={};SD.drawing.util.LineSegment=function(d,c){this.p0=d;this.p1=c;this.distance=function(a){return this.distancePointLine(a,this.p0,this.p1)};this.distancePtoP=function(g,e){var h=g.x-e.x;var f=g.y-e.y;return Math.sqrt(h*h+f*f)};this.distancePointLine=function(f,a,g){if(a.x==g.x&&a.y==g.y){return this.distancePtoP(f,a)}var e=((f.x-a.x)*(g.x-a.x)+(f.y-a.y)*(g.y-a.y))/((g.x-a.x)*(g.x-a.x)+(g.y-a.y)*(g.y-a.y));if(e<=0){return this.distancePtoP(f,a)}if(e>=1){return this.distancePtoP(f,g)}var b=((a.y-f.y)*(g.x-a.x)-(a.x-f.x)*(g.y-a.y))/((g.x-a.x)*(g.x-a.x)+(g.y-a.y)*(g.y-a.y));return Math.abs(b)*Math.sqrt(((g.x-a.x)*(g.x-a.x)+(g.y-a.y)*(g.y-a.y)))}};SD.drawing.util.DPSimplifier=function(b,a){this.pts=b;this.usePt=[];this.seg=new SD.drawing.util.LineSegment();this.distanceTolerance=a;this.simplify=function(){for(var d=0;d<this.pts.length;d++){this.usePt[d]=true}this.simplifySection(0,this.pts.length-1);var c=new Array();for(var d=0;d<this.pts.length;d++){if(this.usePt[d]){c.push(this.pts[d])}}return c};this.simplifySection=function(f,d){if((f+1)==d){return}this.seg.p0=this.pts[f];this.seg.p1=this.pts[d];var g=-1,e=f;for(var c=f+1;c<d;c++){var h=this.seg.distance(this.pts[c]);if(h>g){g=h;e=c}}if(g<=this.distanceTolerance){for(var c=f+1;c<d;c++){this.usePt[c]=false}}else{this.simplifySection(f,e);this.simplifySection(e,d)}}};SD.drawing.util.IntersectionRectangleRectangle=function(j,a){var i=new Point(j.left,j.top);var g=new Point(j.right,j.bottom);var b=new Point(j.right,j.top);var h=new Point(j.left,j.bottom);var f=SD.drawing.util.IntersectionLineRectangle(i,b,a);var e=SD.drawing.util.IntersectionLineRectangle(b,g,a);var d=SD.drawing.util.IntersectionLineRectangle(h,g,a);var c=SD.drawing.util.IntersectionLineRectangle(g,i,a);var k={status:"No Intersection",hit:0};k.hit+=f.hit;k.hit+=e.hit;k.hit+=d.hit;k.hit+=c.hit;if(k.hit>0){k.status="Intersection"}return k};SD.drawing.util.IntersectionLineRectangle=function(b,a,k){var j=new Point(k.left,k.top);var h=new Point(k.right,k.bottom);var c=new Point(k.right,k.top);var i=new Point(k.left,k.bottom);var g=SD.drawing.util.IntersectionLineLine(j,c,b,a);var f=SD.drawing.util.IntersectionLineLine(c,h,b,a);var e=SD.drawing.util.IntersectionLineLine(j,i,b,a);var d=SD.drawing.util.IntersectionLineLine(i,h,b,a);var l={status:"No Intersection",hit:0};l.hit+=g.hit;l.hit+=f.hit;l.hit+=e.hit;l.hit+=d.hit;if(l.hit>0){l.status="Intersection"}return l};SD.drawing.util.IntersectionLineLine=function(e,c,i,h){var j={status:"",hit:0};var f=(h.x-i.x)*(e.y-i.y)-(h.y-i.y)*(e.x-i.x);var g=(c.x-e.x)*(e.y-i.y)-(c.y-e.y)*(e.x-i.x);var d=(h.y-i.y)*(c.x-e.x)-(h.x-i.x)*(c.y-e.y);if(d!=0){var b=f/d;var a=g/d;if(0<=b&&b<=1&&0<=a&&a<=1){j.status="Intersection";j.hit++}else{j.status="No Intersection"}}else{if(f==0||g==0){j.status="Coincident"}else{j.status="Parallel"}}return j};SD.shape.Polyline=function(a,b){this.name="";this.map=null;this.projection=null;this.centerGeo=new GeoPoint();this.boundMetric=new Rectangle();this.boundGeo=new Rectangle();this.bounds=new Rectangle();this.wbound=new Rectangle();this.points=a;this.useMapProjection=false;this._simplifier=new SD.drawing.util.DPSimplifier();this._canvas=null;this._polyline=null;this.hideOnLevel=[1,2,3,4,5,6];SD.apply(this,b);SD.apply(this,new StdLayer());if(this.map!=null){this._canvas=new DrawingVector(this.div,this.map.size.width,this.map.size.height);this._polyline=new PolylineVector(this._canvas);this.map.viewport.vectorLayer.addNode(this);this.getBounds(this.map.canvasInfo);this.draw(this.map.canvasInfo)}};SD.shape.Polyline.prototype.setPoints=function(a){this.points=a;this.resetBounds()};SD.shape.Polyline.prototype.draw=function(c){if(c!=null){var b=0;for(var a=0,f=this.hideOnLevel.length;a<f;a++){if(c.levelIndex==this.hideOnLevel[a]){b++}}if(b!=0){this.setDisplay(false)}else{this.setDisplay(true)}}if(c==null){c=this.map.canvasInfo}else{this.map.canvasInfo=c}this.projection=this.useMapProjection?c.projection:this.projection;var e=(!this.useMapProjection&&this.projection.name==c.projection.name)||this.useMapProjection;if(e){this.updateView(c);this.generateVector(c);this.setDisplay(true)}else{this.setDisplay(false)}};SD.shape.Polyline.prototype.update=function(a){};SD.shape.Polyline.prototype.updateView=function(c){if(this._polyline){this._polyline.clear()}var f=this.getMetricBounds(c);var a,d;a=this.projection.metricToScreen(f.left,f.top,c.scale,c.topLeftOverlay);d=this.projection.metricToScreen(f.right,f.bottom,c.scale,c.topLeftOverlay);var e=new Rectangle(a.x,a.y,d.x,d.y);e.setWidth(e.width()+this.size);e.setHeight(e.height()+this.size);var b=new Size(e.width(),e.height());this._canvas.setViewBox(e,this.size);if(b.width>0&&b.height>0){this._canvas.setSize(b)}if(e.left!=0||e.top!=0){this._canvas.setPosition(e.top,e.left)}};SD.shape.Polyline.prototype.generateVector=function(b){this._canvas.clear();this._polyline.clearArrow();var l,g=new Vertex(0,0),a=new Point();this._simplifier.pts=this.points;this._simplifier.distanceTolerance=b.scale/2;var k=this._simplifier.simplify();var f=55,h=[];for(var c=0,e=k.length;c<e;c++){if(k[c].x==undefined||k[c].y==undefined||(g.x==k[c].x&&g.y==k[c].y)){continue}if(!this.isInBounds({lon:k[c].x,lat:k[c].y},this.bounds)){continue}l=this.projection.metricToScreen(k[c].x,k[c].y,b.scale,b.topLeftOverlay);if(!isNaN(l.x)&&!isNaN(l.y)){h.push(l);if(this.arrowOption!=undefined&&this.arrowOption&&c>0){var j=new Point(l.x-a.x,l.y-a.y);var d=Math.sqrt(Math.pow(j.x,2)+Math.pow(j.y,2));if(d>=f){this._polyline.addArrow(a,l,this.arrowOption)}}}g=k[c];a=l}this._polyline.init(h,this)};SD.shape.Polyline.prototype.isInBoundary=function(b){if(isNaN(this.boundGeo.left)){return true}var a=SD.drawing.util.IntersectionRectangleRectangle(this.boundGeo,b.geoView);if(a.hit>0||(this.isInBounds(this.centerGeo,b.geoView)||this.isInBounds(b.centerGeo,this.boundGeo))){this.setDisplay(true);return true}this.setDisplay(false);return false};SD.shape.Polyline.prototype.isInBounds=function(a,b){if(b.top>=a.lat&&b.bottom<=a.lat&&b.left<=a.lon&&b.right>=a.lon){return true}return false};SD.shape.Polyline.prototype.resetBounds=function(){this.boundMetric.right=0;this.scale=-1};SD.shape.Polyline.prototype.getMetricBounds=function(a){this.bounds=this.boundMetric;return this.boundMetric};SD.shape.Polyline.prototype.getBounds=function(c){if((this.boundMetric.right==0||this.boundMetric.right==undefined)&&this.points!=null){for(var b=0,d=this.points.length;b<d;b++){if(b==0){this.boundMetric.left=this.points[b].x;this.boundMetric.right=this.points[b].x;this.boundMetric.top=this.points[b].y;this.boundMetric.bottom=this.points[b].y}if(this.points[b].x>this.boundMetric.right){this.boundMetric.right=this.points[b].x}if(this.points[b].x<this.boundMetric.left){this.boundMetric.left=this.points[b].x}if(this.points[b].y>this.boundMetric.top){this.boundMetric.top=this.points[b].y}if(this.points[b].y<this.boundMetric.bottom){this.boundMetric.bottom=this.points[b].y}}var a=this.projection.metricToGeo(this.boundMetric.left,this.boundMetric.top);var e=this.projection.metricToGeo(this.boundMetric.right,this.boundMetric.bottom);this.centerGeo.lon=a.lon+((e.lon-a.lon)/2);this.centerGeo.lat=a.lat+((e.lat-a.lat)/2);this.boundGeo.left=a.lon;this.boundGeo.top=a.lat;this.boundGeo.right=e.lon;this.boundGeo.bottom=e.lat}return this.boundMetric};SD.shape.Geofence=function(a,b){this.point=a;this.map=b.map;this.projection=b.projection;this.options={text:b.diameter+" km",color:"red"};this.centerGeo=new GeoPoint();this.boundGeo=new Rectangle();this.boundMetric=new Rectangle();this.scaleDiameter=0;this.diameter=b.diameter;SD.apply(this.options,b);SD.apply(this,new StdLayer());if(this.map!=null){this._canvas=new DrawingVector(this.div,this.map.size.width,this.map.size.height);this.map.viewport.vectorLayer.addNode(this);this.draw(this.map.canvasInfo)}};SD.extend(SD.shape.Geofence,SD.shape.Polyline);SD.shape.Geofence.prototype.getBounds=function(c){this.scaleDiameter=Math.abs(this.diameter/c.scale);if((this.boundMetric.right==0||this.boundMetric.right==undefined)&&this.point!=null){var d=this.projection.inflateVert(this.point,-this.scaleDiameter,-this.scaleDiameter,c.scale);var a=this.projection.inflateVert(this.point,this.scaleDiameter,this.scaleDiameter,c.scale);this.boundMetric=new Rectangle(d.x,d.y,a.x,a.y);var b=this.projection.metricToGeo(this.boundMetric.left,this.boundMetric.top);var e=this.projection.metricToGeo(this.boundMetric.right,this.boundMetric.bottom);this.centerGeo.lon=b.lon+((e.lon-b.lon)/2);this.centerGeo.lat=b.lat+((e.lat-b.lat)/2);this.boundGeo.left=b.lon;this.boundGeo.top=b.lat;this.boundGeo.right=e.lon;this.boundGeo.bottom=e.lat}return this.boundMetric};SD.shape.Geofence.prototype.updateView=function(a){this.bounds=this.getBounds(a);SD.shape.Geofence.superclass.updateView.call(this,a)};SD.shape.Geofence.prototype.generateVector=function(a){this._canvas.clear();var b=this.projection.metricToScreen(this.point.x,this.point.y,a.scale,a.topLeftOverlay);this.options.diameter=this.scaleDiameter;this._canvas.createArrow(b,this.options);this._canvas.createCircle(b,this.options);this._canvas.createText(b,this.options)};SD.genmap.GeofenceManager=function(a){this.map=null;this.projection=(new SD.projection.Server()).get("UTM WGS-1984 48N");SD.apply(this,a);this.add=function(b,c){c.map=this.map;c.projection=this.projection;var d=new SD.shape.Geofence(b,c);SD.genmap.GeofenceManager.superclass.add.call(this,d);return d};this.remove=function(b){SD.genmap.GeofenceManager.superclass.remove.call(b);this.map.viewport.vectorLayer.removeNode(b)}};SD.extend(SD.genmap.GeofenceManager,SD.genmap.OverlayManager);SD.genmap.PolylineManager=function(a){this.map=null;this.projection=(get_level()<=8)?(new SD.projection.Server()).get("Mercator WGS-1984"):(new SD.projection.Server()).get("UTM WGS-1984 48N");SD.apply(this,a);this.add=function(b,c){c.map=this.map;c.projection=this.projection;var d=new SD.shape.Polyline(b,c);SD.genmap.PolylineManager.superclass.add.call(this,d);return d};this.remove=function(b){SD.genmap.PolylineManager.superclass.remove.call(b);this.map.viewport.vectorLayer.removeNode(b)}};SD.extend(SD.genmap.PolylineManager,SD.genmap.OverlayManager);SD.shape.Ellipse=function(a,b){this.position=a;this.map=null;this.projection=null;this._canvas=null;SD.apply(this,b);SD.apply(this,new StdLayer());if(this.map!=null){this._canvas=new DrawingVector(this.div,this.map.size.width,this.map.size.height);this.map.viewport.vectorLayer.addNode(this);this.draw(this.map.canvasInfo)}};SD.shape.Ellipse.prototype.setPosition=function(a){this.position=a};SD.shape.Ellipse.prototype.draw=function(a){if(a==null){a=this.map.canvasInfo}else{this.map.canvasInfo=a}if(this.projection.name==a.projection.name){this.generateVector(a)}else{this.setDisplay(false)}};SD.shape.Ellipse.prototype.generateVector=function(a){this._canvas.clear();var b=this.projection.metricToScreen(this.position.x,this.position.y,a.scale,a.topLeftOverlay);this._canvas.createCircle(b,this.options)};SD.extend(SD.shape.Ellipse,SD.shape.Polyline);SD.genmap.MarkerImage=function(a){this.image=SD.BASE_URL+"icon.php";this.title="";this.pt=new Point(0,0);this.iconSize=new Size(19,32);this.iconAnchor=new Point(9,34);this.infoWindowAnchor=new Point(9,35);this.mode=null;this.useFilter=null;SD.apply(this,a);this.object="";this.getObject=function(i,f){if(this.object==""){if(this.mode=="image"){this.object=document.createElement("img");this.object.style.width=this.iconSize.width;this.object.style.height=this.iconSize.height;this.object.style.position="absolute";this.object.style.cursor="pointer";this.object.src=this.image}else{if(this.mode=="photo"){var b=this.iconSize.width,e=this.iconSize.height;this.object=f?f:document.createElement("div");this.object.id="bldg_img"+this.elm_id;var c=document.createElement("img");this.object.appendChild(c);c.style.width=b;c.style.height=e;c.title=this.alt;c.style.position="absolute";c.src=this.image;this.object.style.width=b;this.object.style.height=e;this.object.style.padding="2px";this.object.style.position="absolute";this.object.style.cursor="pointer";if(a.background!="empty"||a.background==""){this.object.style.backgroundColor="#ffffff";this.object.style.border="1px #777777 solid"}}else{if(this.mode=="sprite"){var g=(this.cursor==undefined)?"pointer":this.cursor;var d=(this.useFilter==undefined)?false:this.useFilter;if(d){this.object=SD.util.createImgSprite(this.css,this.iconSize.width,this.iconSize.height,this.bgPosLeft,this.bgPosTop,this.iconAnchor.x,this.iconAnchor.y,"cursor: "+g,"","",true)}else{this.object=SD.util.createImgSprite(this.css,this.iconSize.width,this.iconSize.height,this.bgPosLeft,this.bgPosTop,this.iconAnchor.x,this.iconAnchor.y,"cursor: "+g)}}}}if(this.title!=""){this.object.alt=this.title;this.object.title=this.title}}if(i>0){this.object.style.zIndex=i}return this.object}};SD.genmap.MarkerImage.prototype.setIndex=function(a){this.object.style.zIndex=a};SD.genmap.MarkerImage.prototype.setImage=function(a){if(this.mode=="image"){this.object.src=a}};SD.genmap.MarkerImage.prototype.setPoint=function(a){this.setPosition(a)};SD.genmap.MarkerImage.prototype.setOffset=function(b){this.pt.x+=b.x;this.pt.y+=b.y;var a=this.getObject();a.style.left=this.pt.x+"px";a.style.top=this.pt.y+"px"};SD.genmap.MarkerImage.prototype.getPosition=function(){return{x:this.pt.x+this.iconAnchor.x,y:this.pt.y+this.iconAnchor.y}};SD.genmap.MarkerImage.prototype.setPosition=function(b){var a=this.getObject();this.pt.x=(b.x-this.iconAnchor.x);this.pt.y=(b.y-this.iconAnchor.y);a.style.left=this.pt.x+"px";a.style.top=this.pt.y+"px"};SD.genmap.MarkerImage.prototype.setDisplay=function(b){var c=this.getObject();var a=b==true?"":"none";c.style.display=a};SD.genmap.MarkerStaticManager=function(a){this.map=null;this.projection=(new SD.projection.Server()).get("Mercator WGS-1984");this.useMapProjection=true;SD.apply(this,a);this.add=function(d){d.map=this.map;d.projection=this.projection;d.useMapProjection=this.useMapProjection;var c=new SD.genmap.MarkerStatic(d);SD.genmap.MarkerStaticManager.superclass.add.call(this,c);return c};this.remove=function(c){SD.genmap.MarkerStaticManager.superclass.remove.call(this,c);this.map.viewport.markerStaticLayer.removeNode(c)};this.setAutoAdjust=function(p){var d=new Rectangle(0,0,0,0);var o=new Rectangle(0,0,0,0);for(var k=0,l=this.node.length;k<l;k++){if(k==0){d.left=this.node[k].position.x;d.right=this.node[k].position.x;d.top=this.node[k].position.y;d.bottom=this.node[k].position.y}if(this.node[k].position.x>d.right){d.right=this.node[k].position.x}if(this.node[k].position.x<d.left){d.left=this.node[k].position.x}if(this.node[k].position.y<d.top){d.top=this.node[k].position.y}if(this.node[k].position.y>d.bottom){d.bottom=this.node[k].position.y}}var g=this.map.viewport.mapManager.layers,e,f=1,n;for(var k=g.length-1;k>=0;k--){e=g[k];if(e.length!=undefined){for(var h=0;h<e.length;h++){if(!e[h].projection){continue}if(e[h].projection.name!=this.projection.name){continue}n=b(this.map.viewportInfo,e[h],d,o);f=!n?f:n}}else{if(typeof e=="object"){if(!e.projection){continue}if(e.projection.name!=this.projection.name){continue}n=b(this.map.viewportInfo,e,d,o);f=!n?f:n}}}if(f>0){var m={x:(d.left+d.right)/2,y:(d.top+d.bottom)/2};this.map.setCenter(this.projection.metricToGeo(m.x,m.y),f)}};var b=function(f,e,d,c){var g={x:f.canvasSize.width*e.scale,y:f.canvasSize.height*e.scale*-1};c.left=f.centerMetric.x-g.x;c.right=f.centerMetric.x+g.x;c.top=f.centerMetric.y+g.y;c.bottom=f.centerMetric.y-g.y;if(d.left>c.left&&d.left<c.right&&d.right>c.left&&d.right<c.right&&d.bottom<c.bottom&&d.bottom>c.top&&d.top<c.bottom&&d.top>c.top){return e.realLevel}return false}};SD.extend(SD.genmap.MarkerStaticManager,SD.genmap.OverlayManager,true);SD.genmap.MarkerStatic=function(c){if(c==null){return}this.map=null;this.icon=new SD.genmap.MarkerImage();this.position=null;this.positionPt=null;this.projection=null;this.draggable=false;this.visible=true;this.hideOnLevel=[1,2,3,4,5,6];this.zIndex=1;this.div=null;this.useMapProjection=true;if(c.icon!=undefined&&typeof c.icon=="string"){var b=c.icon;c.icon=new SD.genmap.MarkerImage();c.icon.image=b}SD.apply(this,c);if(c.title){this.icon.title=c.title}if(this.projection==null){this.projection=this.map.viewportInfo.projection}if(this.div==null){if(c.icon.mode=="photo"){this.div=document.createElement("div");this.map.viewport.markerStaticLayer.addNode(this);this.div=this.icon.getObject(this.zIndex,this.div);this.draw(this.map.canvasInfo)}else{this.div=this.icon.getObject(this.zIndex);this.map.viewport.markerStaticLayer.addNode(this);this.draw(this.map.canvasInfo)}}if(this.draggable){var a=new DraggableTool();a.init(this,this.map.viewport)}};SD.genmap.MarkerStatic.prototype.replaceIcon=function(b){var a=SD.util.clone(this);a.div=b.getObject(this.zIndex);this.map.viewport.markerStaticLayer.replaceNode(this,a);this.icon=b;this.div=a.div};SD.genmap.MarkerStatic.prototype.getDom=function(){return this.div};SD.genmap.MarkerStatic.prototype.getPtPosition=function(){return this.icon.getPosition()};SD.genmap.MarkerStatic.prototype.getSize=function(){return this.icon.iconSize};SD.genmap.MarkerStatic.prototype.updatePosition=function(b){var c=this.getPtPosition();if(this.position.lon||this.position.lat){var a=this.projection.screenToGeo(c.x,c.y,b.scale,b.topLeftOverlay);this.position=a}else{if(this.position.x||this.position.y){var a=this.projection.screenToMetric(c.x,c.y,b.scale,b.topLeftOverlay);this.position=a}}};SD.genmap.MarkerStatic.prototype.setPosition=function(a){if(a==null){return}this.position=a;this.draw(this.map.canvasInfo)};SD.genmap.MarkerStatic.prototype.setOffset=function(b,a){this.icon.setOffset(b)};SD.genmap.MarkerStatic.prototype.draw=function(b){if(b!=null&&this.position!=null){for(var a=0,e=this.hideOnLevel.length;a<e;a++){if(b.levelIndex==this.hideOnLevel[a]){this.setDisplay(false);return}}this.projection=this.useMapProjection?b.projection:this.projection;var c=(!this.useMapProjection&&this.projection.name==b.projection.name)||this.useMapProjection;if(c){if(this.position.lon||this.position.lat){this.positionPt=this.projection.geoToScreen(this.position.lon,this.position.lat,b.scale,b.topLeftOverlay)}else{if(this.position.x||this.position.y){this.positionPt=this.projection.metricToScreen(this.position.x,this.position.y,b.scale,b.topLeftOverlay)}}if(this.positionPt&&(this.positionPt.x||this.positionPt.y)){this.icon.setPosition(this.positionPt);this.setDisplay(true);return}}}this.setDisplay(false)};SD.genmap.MarkerStatic.prototype.setEnable=function(a){this.enable=a;this.setDisplay(a)};SD.genmap.MarkerStatic.prototype.setDisplay=function(a){if(this.div!=null){this.visible=a;this.div.style.display=a?"":"none"}};function DrawingPanTool(c){var b=c;var a=false;this.name="drawing pan tool";this.MouseDblClick=function(e,d){a=false;b.endDraw();d.ActiveTool(d.defaultTool);return false};this.MouseDown=function(e,d){if(SD.util.getMouseButton(e)=="LEFT"){b.drawReal(d.viewportInfo.getMetricPosDown());a=true}else{a=false}};this.MouseMove=function(e,d){if(SD.util.getMouseButton(e)=="LEFT"&&a){b.drawBuffer(d.viewportInfo.getMetricPosMove())}}}SD.extend(DrawingPanTool,DrawingTool);function DrawingManager(a){this.map=null;SD.apply(this,a);this.objects=[];this.activeIndex=0;this.activeObject=null;this.panTool=new DrawingPanTool(this)}DrawingManager.MODE_POLYLINE_OPEN=3;DrawingManager.MODE_POLYLINE_CLOSE=2;DrawingManager.MODE_ELLIPSE=1;DrawingManager.MODE_DRAG=0;DrawingManager.prototype.setActive=function(a){this.activeObject=Shape.getInstance(a,{map:this.map});if(a==DrawingManager.MODE_DRAG){this.map.viewport.ActiveTool(this.map.viewport.defaultTool)}else{this.map.viewport.ActiveTool(this.panTool)}};DrawingManager.prototype.drawReal=function(a){if(this.objects[this.activeIndex]==null||this.objects.length==0){this.objects[this.activeIndex]=this.activeObject.init(a)}else{this.activeObject.clearBuffer();this.activeObject.drawReal(this.objects[this.activeIndex],a)}};DrawingManager.prototype.endDraw=function(){this.activeObject.endDraw(this.objects[this.activeIndex]);this.activeIndex++};DrawingManager.prototype.drawBuffer=function(a){this.activeObject.drawBuffer(a)};function Shape(){}Shape.obj_po=null;Shape.obj_pc=null;Shape.obj_e=null;Shape.getInstance=function(c,a){var b=null;if(c==DrawingManager.MODE_POLYLINE_OPEN){if(Shape.obj_po==null){Shape.obj_po=new SD.drawing.OpenPolyline(a)}b=Shape.obj_po}else{if(c==DrawingManager.MODE_POLYLINE_CLOSE){if(Shape.obj_pc==null){Shape.obj_pc=new SD.drawing.ClosePolyline(a)}b=Shape.obj_pc}else{if(Shape.obj_e==null){Shape.obj_e=new Ellipse()}b=Shape.obj_e}}return b};SD.drawing.OpenPolyline=function(a){this.name="SD.drawing.OpenPolyline";this.closeShape=false;this.positions=[];this.markers=[];SD.apply(this,a);this.buffer=new SD.shape.Polyline([],{map:this.map,projection:this.map.viewportInfo.projection,color:"red",size:2,opacity:"0.9",dash:7});this.buffer.name="ObjectBUFFER"};SD.drawing.OpenPolyline.prototype.init=function(a){this.positions.push(a);var b=new SD.shape.Polyline(this.positions,{map:this.map,projection:this.map.viewportInfo.projection,color:"blue",size:5,opacity:"0.7"});b.name="ObjectREAL";this._addMarker(b,a);return b};SD.drawing.OpenPolyline.prototype.drawBuffer=function(b){var a=this.positions.length;if(a>0){var c=this.positions[a-1];this._drawBuffer([c,b])}};SD.drawing.OpenPolyline.prototype._drawBuffer=function(a){if(!a){return}this._draw(this.buffer,a)};SD.drawing.OpenPolyline.prototype.clearBuffer=function(){this._drawBuffer([])};SD.drawing.OpenPolyline.prototype.drawReal=function(b,a){this.positions.push(a);this._draw(b,this.positions);this._addMarker(b,a)};SD.drawing.OpenPolyline.prototype._draw=function(b,a){if(!b){return}b.setPoints(a);b.draw(null)};SD.drawing.OpenPolyline.prototype.endDraw=function(a){a.nodes=this.markers;this.positions=[];this.markers=[]};SD.drawing.OpenPolyline.prototype.getListMetric=function(d,a,b,g){if(d.nodes&&d.nodes[a]){if(d.nodes.length>0){var f=[];for(var e=0,h=d.points.length;e<h;e++){if(g&&(e==a-1||e==a+1)){f.push(d.points[e])}if(e==a){f.push(b)}else{if(!g){f.push(d.points[e])}}}if(this.closeShape){if(g&&a==0){f=[d.points[h-2],b,d.points[1]]}else{if(!g){f[h-1]=f[0]}}}return f}}return false};SD.drawing.OpenPolyline.prototype._addMarker=function(d,c){var b=new SD.genmap.MarkerStatic({map:this.map,icon:new DrawingNode({opacity:1}),projection:this.projection});b.index=this.markers.length;b.setPosition(c);var a=new DraggableTool();a.init(b,this.map.viewport,{_manager:this,MouseMove:function(h,f){var g=f.viewportInfo.getMetricPosMove();this._manager._drawBuffer(this._manager.getListMetric(d,b.index,g,true))},MouseUp:function(g,f){this._manager.clearBuffer();this._manager._draw(d,this._manager.getListMetric(d,b.index,b.position,false))}});this.markers.push(b)};SD.drawing.ClosePolyline=function(a){SD.drawing.ClosePolyline.superclass.constructor.call(this,a);this.name="SD.drawing.ClosePolyline";this.closeShape=true};SD.extend(SD.drawing.ClosePolyline,SD.drawing.OpenPolyline);SD.drawing.ClosePolyline.prototype.endDraw=function(a){this.positions.push(this.positions[0]);SD.drawing.ClosePolyline.superclass._draw.call(this,a,this.positions);SD.drawing.ClosePolyline.superclass.endDraw.call(this,a)};SD.drawing.Ellipse=function(a){SD.drawing.Ellipse.superclass.constructor.call(this,a);this.name="SD.drawing.Ellipse";this.buffer=new SD.shape.Ellipse([],{map:this.map,projection:this.map.viewportInfo.projection,color:"red",size:2,opacity:"0.9",dash:7});this.buffer.name="ObjectBUFFER"};SD.drawing.Ellipse.prototype.init=function(a){this.positions.push(a);var b=new SD.shape.Polyline(this.positions,{map:this.map,projection:this.map.viewportInfo.projection,color:"blue",size:5,opacity:"0.7"});b.name="ObjectREAL";this._addMarker(b,a);return b};SD.drawing.Ellipse.prototype.drawBuffer=function(b){var a=this.positions.length;if(a>0){var c=this.positions[a-1];this._drawBuffer([c,b])}};SD.drawing.Ellipse.prototype._drawBuffer=function(a){if(!a){return}this._draw(this.buffer,a)};SD.drawing.Ellipse.prototype.clearBuffer=function(){this._drawBuffer([])};SD.drawing.Ellipse.prototype.drawReal=function(b,a){this.positions.push(a);this._draw(b,this.positions);this._addMarker(b,a)};SD.drawing.Ellipse.prototype._draw=function(b,a){if(!b){return}b.setPoints(a);b.draw(null)};SD.drawing.Ellipse.prototype.endDraw=function(a){a.nodes=this.markers;this.positions=[];this.markers=[]};SD.drawing.Ellipse.prototype.getListMetric=function(d,a,b,g){if(d.nodes&&d.nodes[a]){if(d.nodes.length>0){var f=[];for(var e=0,h=d.points.length;e<h;e++){if(g&&(e==a-1||e==a+1)){f.push(d.points[e])}if(e==a){f.push(b)}else{if(!g){f.push(d.points[e])}}}if(this.closeShape){if(g&&a==0){f=[d.points[h-2],b,d.points[1]]}else{if(!g){f[h-1]=f[0]}}}return f}}return false};SD.drawing.Ellipse.prototype._addMarker=function(d,c){var b=new SD.genmap.MarkerStatic({map:this.map,icon:new DrawingNode({opacity:1}),projection:this.projection});b.index=this.markers.length;b.setPosition(c);var a=new DraggableTool();a.init(b,this.map.viewport,{_manager:this,MouseMove:function(h,f){var g=f.viewportInfo.getMetricPosMove();this._manager._drawBuffer(this._manager.getListMetric(d,b.index,g,true))},MouseUp:function(g,f){this._manager.clearBuffer();this._manager._draw(d,this._manager.getListMetric(d,b.index,b.position,false))}});this.markers.push(b)};function DrawingNode(a){this.pt=new Point(0,0);this.iconSize=new Size(8,8);this.iconAnchor=new Point(4,4);this.infoWindowAnchor=new Point(5,5);SD.apply(this,a);this.object="";this.getObject=function(b){if(this.object==""){this.object=document.createElement("div");this.object.style.width="8px";this.object.style.height="8px";this.object.style.position="absolute";this.object.style.cursor="pointer";this.object.style.fontSize="1%";this.object.style.border="1px solid #cfcfcf";this.object.style.backgroundColor="#ffffff";if(this.opacity>0){this.object.style.opacity=this.opacity;this.object.style.filter="alpha(opacity="+(this.opacity*100)+")"}}if(b>0){this.object.style.zIndex=b}return this.object}}SD.extend(DrawingNode,SD.genmap.MarkerImage);SD.genmap.BaseMap=function(b,a){this.zoom=1;this.center=new GeoPoint(106.915305,-6.09949764);this.size=new Size(400,400);this.draggable=true;this.scrollwheel=true;this.enableDefaultLogo=true;SD.apply(this,a);this.viewport=new ViewportControl();this.viewport.projection=(new SD.projection.Server()).get("Mercator WGS-1984");this.viewport.scrollwheel=this.scrollwheel;this.viewport.enableDefaultLogo=this.enableDefaultLogo;this.viewport.setCenter(this.center);this.viewport.setLevel(this.zoom);this.viewport.init(b);if(!this.draggable){this.viewport.ActiveTool(false)}if(this.resize){this.viewport.resize(this.resize.w,this.resize.h,false)}if(this.thumb!=false){this.thumb=new Thumbnail(this.viewport)}this.viewport.mapAPI=this;this.refresh()};SD.genmap.BaseMap.prototype.refresh=function(){this.viewport.draw();this._updateInfo()};SD.genmap.BaseMap.prototype._updateInfo=function(a){if(a==undefined){a=this.viewport}this.viewportInfo=a.viewportInfo;this.canvasInfo=this.viewport.canvasInfo;this.infoWindow=a.infoWindow;this.tooltip=a.tooltip;this.size=this.viewportInfo.canvasSize;this.zoom=this.viewportInfo.levelIndex};SD.genmap.BaseMap.prototype.fromLatLngToCanvasPixel=function(a){return this.canvasInfo.canvasGeoToScreen(a)};SD.genmap.BaseMap.prototype.fromLatLngToContainerPixel=function(a){return this.viewportInfo.viewportGeoToScreen(a)};SD.genmap.BaseMap.prototype.fromContainerPixelToLatLng=function(a){if(a==undefined){a=this.viewportInfo.lastCursorPosDown}return this.viewportInfo.viewportScreenToGeo(a.x,a.y)};SD.genmap.BaseMap.prototype.setZoom=function(b,a){if(b<=this.viewport.mapManager.getLength()&&1<=b){this.zoom=b;this.viewport.setLevel(this.zoom);this.viewport.updateMapLayerByLevel(b);if(a==undefined||a==true){this.refresh()}}};SD.genmap.BaseMap.prototype.getDom=function(){return this.viewport.fakeDiv};SD.genmap.BaseMap.prototype.setCenter=function(a,b){this.center=a;var c=this.zoom!=b;this.viewport.viewportLayer.setTopLeft({x:0,y:0});this.viewport.setCenter(this.center,!c);if(c){this.setZoom(b,c)}};SD.genmap.BaseMap.prototype.getCenter=function(){return this.viewportInfo.centerGeo};SD.genmap.BaseMap.prototype.setInfoWindow=function(a){this.viewport.hintLayer.replaceNode(this.viewport.infoWindow,a);this.viewport.infoWindow=a;this.infoWindow=a};SD.genmap.BaseMap.prototype.panBy=function(b,a){this.viewport.animatePanBy({x:b,y:a},10)};SD.genmap.BaseMap.prototype.panTo=function(a){this.viewport.animatePanTo(a)};SD.genmap.BaseMap.prototype.resizeViewport=function(a,b){this.viewport.updateMapLayerByLevel(this.viewportInfo.levelIndex);this.viewport.resize(a,b);this.refresh();this.viewport.markerStaticLayer.setDraw(true);this.viewport.markerStaticLayer.draw(this.canvasInfo)};SD.genmap.BaseMap.prototype.getBounds=function(){if(!isNaN(this.viewportInfo.centerGeo.lon)&&!isNaN(this.viewportInfo.centerGeo.lat)){return this.viewportInfo.geoView}return false};SD.genmap.BaseMap.prototype.addControl=function(a){a.control=MapControl.getInstance(this);this.viewport.addControl(a)};SD.genmap.BaseMap.prototype.addLogo=function(d,c,g,b,f,a){var e=new SD.util.createImgSprite(d,c,g,b,f);if(a==SD.POSITION_TOP_RIGHT){e.style.top="0px";e.style.right="0px"}else{if(a==SD.POSITION_TOP_LEFT){e.style.top="0px";e.style.left="0px"}else{if(a==SD.POSITION_BOTTOM_RIGHT){e.style.bottom="0px";e.style.right="0px"}else{if(a==SD.POSITION_BOTTOM_LEFT){e.style.bottom="0px";e.style.left="0px"}}}}this.viewport.fakeDiv.appendChild(e)};SD.genmap.Map=function(b,a){return SD.genmap.Map.getInstance(b,a)};SD.genmap.Map.getIndex=function(a){a=typeof a=="string"?$(a):a;return a.id};SD.genmap.Map.getInstance=function(b,a){index=this.getIndex(b);if(SD.genmap.Map.instance[index]==null||!(SD.genmap.Map.instance[index] instanceof SD.genmap.BaseMap)){SD.genmap.Map.instance[index]=new SD.genmap.BaseMap(b,a)}return SD.genmap.Map.instance[index]};SD.genmap.Map.instance=[];function SD_Icon(){this.markerManager=new SD.genmap.MarkerStaticManager({map:MapAPI});this.icons=new Array();this.remove=function(a){if(a){this.markerManager.remove(a)}};this.remove_group=function(b){if(this.icons[b]){var c=this.icons[b].length;for(var a=0;a<c;a++){this.remove(this.icons[b][a])}this.icons[b]=new Array()}};this.hide_group=function(b){if(this.icons[b]){var c=this.icons[b].length;for(var a=0;a<c;a++){this.icons[b][a].setDisplay(false)}}};this.show_group=function(b){if(this.icons[b]){var d=this.icons[b].length,c=get_level();for(var a=0;a<d;a++){if(b=="icon"){if(c<=7&&this.icons[b][a].icon.css=="star"&&global.prem_count>10){this.icons[b][a].setDisplay(true)}else{this.icons[b][a].setDisplay(false)}}else{this.icons[b][a].setDisplay(true)}}}};this.remove_all=function(){var b,a=this.icons;for(b in a){this.remove_group(b)}this.icons=new Array()};this.create=function(a,c){if(c==undefined){c="default"}var f,b,e;if(a.css){b=new SD.genmap.MarkerImage({mode:"sprite",css:a.css,iconSize:new Size(a.w,a.h),bgPosLeft:a.left,bgPosTop:a.top,cursor:a.cursor})}else{if(a.image){b=new SD.genmap.MarkerImage({mode:"image",image:a.image,iconSize:new Size(a.w,a.h)})}}if(a.offset_x!=undefined||a.offset_y!=undefined){b.iconAnchor=new Point(a.offset_x,a.offset_y)}else{b.iconAnchor=new Point(Math.round(a.w/2),Math.round(a.h/2))}if(a.cursor!=undefined){b.cursor=a.cursor}f=(a.x>1000||a.y>1000)?new Point(a.x,a.y):new GeoPoint(a.x,a.y);var d=this.markerManager.add({icon:b,position:f});if(this.icons[c]==undefined){this.icons[c]=new Array()}this.icons[c].push(d);return d};this.createIconPhoto=function(a,c){if(c==undefined){c="default"}var f,b,e;b=new SD.genmap.MarkerImage({mode:"photo",image:a.image,background:a.background,alt:a.alt,elm_id:a.elm_id,iconSize:new Size(a.w,a.h)});if(a.offset_x!=undefined||a.offset_y!=undefined){b.iconAnchor=new Point(a.offset_x,a.offset_y)}f=(a.x>1000||a.y>1000)?new Point(a.x,a.y):new GeoPoint(a.x,a.y);var d=this.markerManager.add({icon:b,position:f});if(this.icons[c]==undefined){this.icons[c]=new Array()}this.icons[c].push(d);return d};this.bubble=function(b,a){var c=function(){MapAPI.infoWindow.open(b,a)};this.action(b,"click",c)};this.action=function(b,a,c){if(typeof c=="function"){EventManager.add(b,a,c)}}}function SD_Line(){this.polyline=new SD.genmap.PolylineManager({map:MapAPI});this.linesArr=new Array();this.prevProj=null;this.create=function(c,b,a){var d,e;if(a==undefined){a="default"}if(b.color==undefined){b.color="blue"}if(b.size==undefined){b.size=5}if(b.opacity==undefined){b.opacity="0.7"}d={color:b.color,size:b.size,opacity:b.opacity};if(a=="routing"){d.arrowOption={size:1,color:"red"}}if(c.length>0){if(c[0].lon&&c[0].lat){for(point in c){if(point!="clone"){c[point]=this.polyline.projection.geoToMetric(c[point].lon,c[point].lat)}}}}if(this.linesArr[a]){this.remove(this.linesArr[a])}e=this.polyline.add(c,d);this.linesArr[a]=e;if(this.prevProj==null){this.prevProj=MapAPI.viewportInfo.projection}return e};this.remove=function(c){var a=this.linesArr,b;if(c){this.polyline.remove(c);for(b in a){if(a[b]==c){delete this.linesArr[b]}}}};this.remove_all=function(){var b,a=this.linesArr;for(b in a){if(!a[b]){continue}if(b!="clone"){this.remove(this.linesArr[b])}}this.linesArr=new Array()};this.adaptProjection=function(){var b=this.linesArr,a,c,e,f;if(get_level()<7){for(name in b){if(name!="clone"){if(!b[name]){continue}b[name].setDisplay(false)}}}this.polyline.projection=MapAPI.viewportInfo.projection;if(this.prevProj==null){this.prevProj=MapAPI.viewportInfo.projection}if(MapAPI.viewportInfo.projection.name!=this.prevProj.name){for(name in b){if(name!="clone"){if(!b[name]){continue}for(var d=0;d<b[name].points.length;d++){a=this.prevProj.metricToGeo(b[name].points[d].x,b[name].points[d].y);c=MapAPI.viewportInfo.projection.geoToMetric(a.lon,a.lat);b[name].points[d]=c}e={color:b[name].color,size:b[name].size,opacity:b[name].opacity};f=this.create(b[name].points,e,name);b[name]=f}}this.linesArr=b;this.prevProj=MapAPI.viewportInfo.projection}}};
