var component={_XMLNS_SVG:"http://www.w3.org/2000/svg"};function Point(A,B){this.x=A;this.y=B}function Vertex(A,B){this.x=A;this.y=B}function GLatLng(A,B){this.x=A;this.y=B;this.vx=Math.floor(Map.util.findPixelX(this.x));this.vy=Math.floor(Map.util.findPixelY(this.y))}function moveStarPosition(D,E){var C=D.screenToVertex(E);var B=0,A=0;if($("last_pos")){if(D.levelIndex>3){$("last_pos").innerHTML=(C.x+B)+","+(C.y+A)}}if($("dummy_img")){}if($("star_icon"+star_id)){$("star_icon"+star_id).style.display="block";$("star_icon"+star_id).style.zIndex=20;$("star_icon"+star_id).style.left=(-parseInt(D.mapContainer.style.left)+E.x-parseInt(star_width)/2)+"px";$("star_icon"+star_id).style.top=(-parseInt(D.mapContainer.style.top)+E.y-parseInt(star_height)/2)+"px"}}function move_mover_to_level(A){if($("mover")){var B;if(A==7){B=144}else{if(A==6){B=124}else{if(A==5){B=102}else{if(A==4){B=83}else{if(A==3){B=63}else{if(A==2){B=43}else{if(A==1){B=20}}}}}}}$("mover").style.top=B+"px"}}function getTopLeft(A){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}}function cancelEvent(A){A=A?A:window.event;if(A.stopPropagation){A.stopPropagation()}if(A.preventDefault){A.preventDefault()}A.cancelBubble=true;A.cancel=true;A.returnValue=false;return false}function getCursorPos(F,E){var G=getTopLeft(E);var D,B,C,A;D=(!document.all)?F.pageX:(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));D-=G.x;B=(!document.all)?F.pageY:(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop));B-=G.y;if(document.all){C=event.clientX;A=event.clientY}else{C=F.clientX;A=F.clientY}return{x:D,y:B,vx:C,vy:A}}function getHttpObject(){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}function Rectangle(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(B-D)};this.height=function(){return Math.abs(A-top)}}function MapTile(C,B,A,D){this.row=C;this.col=B;this.img=A;this.div=D}function MapTileAdvance(C,A,B,D){this.row=C;this.col=A;this.mapScale=B;this.div=D;this.limitW=400;this.limitH=400;this.setStyle=function(I,F,G,E,H,J){J=J==undefined?"absolute":"relative";I.style.left=F+"px";I.style.top=G+"px";I.style.width=E+"px";I.style.height=H+"px";I.style.position=J;return I};this.getMultipleDiv=function(L){var N=this.mapScale.mapWidth,M=this.mapScale.maxCol,H=this.mapScale.mapHeight,E=this.mapScale.maxRow,I=0,O=0;if(this.mapScale.mapWidth>this.limitW){N=this.limitW;M=Math.ceil(this.mapScale.mapWidth/N)}if(this.mapScale.mapHeight>this.limitH){H=this.limitH;E=Math.ceil(this.mapScale.mapHeight/H)}for(I=0;I<E;I++){for(O=0;O<M;O++){var G=O==M-1?this.mapScale.mapWidth-N*O:N;var J=I==E-1?this.mapScale.mapHeight-H*I:H;var K=this.setStyle(document.createElement("div"),(O*N),(I*H),G,J);var F=document.createElement("img");F.src=L.getMapTileUrlX(A,C,this.mapScale,O,I,N,H);K.appendChild(F);this.div.appendChild(K)}}}}function OffsetPoint(C,B,D){var A=new Point();A.x=C.x+B;A.y=C.y+D;return A}function ViewportInfo(){this.width=0;this.height=0;this.centerVertex=new Vertex(0,0);this.imgUrl="";this.currentLvToHighLvPercentage=0}function Quadtree(A){this.mapClient=A}function MapSource(B,A){this.mapTitle="";this.mapCode="";this.mapYear="";this.mapZone="";this.isSouth="";this.isCassini="";this.mapScales=[];this.pathUrl=B;this.name=A;this.loadFromXml=function(D){this.mapTitle=D.getElementsByTagName("TITLE").item(0).firstChild.nodeValue;this.mapCode=D.getElementsByTagName("MAPCODE").item(0).firstChild.nodeValue;this.mapYear=D.getElementsByTagName("YEAR").item(0).firstChild.nodeValue;this.mapZone=D.getElementsByTagName("MAPZONE").item(0).firstChild.nodeValue;this.mapScales=[];var F=D.getElementsByTagName("SCALE");for(i=0;i<F.length;i++){var C=F.item(i).attributes;var E=new MapScale();if(C.getNamedItem("DISABLED").nodeValue!="True"){E.mapWidth=parseInt(C.getNamedItem("WIDTH").nodeValue);E.mapHeight=parseInt(C.getNamedItem("HEIGHT").nodeValue);E.maxCol=parseInt(C.getNamedItem("MAXCOL").nodeValue);E.maxRow=parseInt(C.getNamedItem("MAXROW").nodeValue);E.minLon=parseFloat(C.getNamedItem("MINLONG").nodeValue);E.maxLon=parseFloat(C.getNamedItem("MAXLONG").nodeValue);E.maxLat=parseFloat(C.getNamedItem("MAXLAT").nodeValue);E._name=C.getNamedItem("LEVELCODE").nodeValue;this.mapScales[E._name]=E}}};this.getMapTileUrl=function(D,L,I,C){var F=this.getTilePath(D,L),H="";if(C==3){I._name=2}else{if(C==4){I._name=3}else{if(C==5){I._name=4}else{if(C==6){I._name=5}else{if(C==7){I._name=6}}}}}var G=F+"data/KL-Getmap/kv"+L+"_"+D+"_"+I._name+".gif";var E=this.levelIndex<=2?6:12;if(D<-E||L<-E){G=F+"dragmap/xg/img/no_map.gif"}else{if((D>=-E&&D<=0)||(L>=-E&&L<=0)){G=F+"dragmap/xg/img/blue.gif"}else{if(C){var K=this.mapScales[C].maxCol+E,J=this.mapScales[C].maxRow+E;if(D>K||L>J){G=F+"dragmap/xg/img/no_map.gif"}else{if((D>this.mapScales[C].maxCol&&D<=K)||(L>this.mapScales[C].maxRow&&L<=J)){G=F+"dragmap/xg/img/blue.gif"}}}}}return G};this.getMapTileUrlX=function(D,J,H,I,G,C,F){var E="http://192.168.0.9/";if(location.hostname!="localhost"){E="http://"+location.hostname+"/"}return E+"sg_getmap.cgi?cd=map&s="+escape(this.name)+"&r="+J+"&c="+D+"&l="+H._name+"&w="+C+"&h="+F+"&r1="+G+"&c1="+I};this.getPhotoTileUrl=function(C,E,D){return"http://"+location.hostname+"/stock_images/travel/sdimages/photo.php?row="+E+"&col="+C+"&level="+D._name};this.getBusCPTileUrl=function(C,E,D){return"http://"+location.hostname+"/asia_travel/mappage/map_tiles/buscp.php?row="+E+"&col="+C+"&level="+D._name};this.getFirstScaleLevel=function(C){if(this.mapScales.length>0){return this.mapScales[C]}};this.getTilePath=function(D,G){var F="http://192.168.0.4/";var C=location.hostname;if(C.indexOf("streetdirectory")!=-1){if(C=="beta.streetdirectory.com"){F="http://beta.streetdirectory.com/"}else{if(C=="beta.streetdirectory.co.id"){F="http://beta.streetdirectory.co.id/"}else{var E=1+(G+D)%4;F="http://map"+E+".streetdirectory.com/"}}}return F}}function MapScale(D,G,L,H,I,J,B,C,F,E,K,A){this.mapWidth=D;this.mapHeight=G;this.maxCol=L;this.maxRow=H;this.minLon=I;this.maxLon=J;this.minLat=B;this.maxLat=C;this._name=F;this.desc=E;this.userScale=K;this.scaleValue=function(){var M=(this.maxLon-this.minLon)/(this.maxCol*this.mapWidth);return M};this.pixelToUtm=function(M,O){var N=this.scaleValue();return new Vertex((this.minLon)+(M*N),(this.maxLat)-(O*N))};this.utmToPixel=function(O,N){var M=new Point();var P=this.scaleValue();M.x=Math.round((O-this.minLon)/P);M.y=Math.round((this.maxLat-N)/P);return M};this.inflateVert=function(O,M,P){var N=this.utmToPixel(O.x,O.y);N=OffsetPoint(N,M,P);return this.pixelToUtm(N.x,N.y)};this.GetDistance=function(M,N){if(isNaN(M.x)||isNaN(M.y)||isNaN(N.x)||isNaN(N.y)){return }return Math.sqrt((M.x-N.x)*(M.x-N.x)+(N.y-M.y)*(N.y-M.y))};this.GetCenterVertex=function(){return this.pixelToUtm((this.maxCol*this.mapWidth)/2,(this.maxRow*this.mapHeight)/2)};this.GetTopLeftPoint=function(O,N,M,P){var Q=this.utmToPixel(O,N);Q=OffsetPoint(Q,-(M/2),-(P/2));return Q}}function MapScaleList(A){this.listSize=A;this.listitems=new Array(A);this.getItem=function(B){return listItems(B)};this.setItem=function(B,C){listItems[B]=C}}function MapClient(){this.viewportInfo=new ViewportInfo();this.mapWidth=0;this.mapHeight=0;this.mapScale=new MapScale();this.centerVertex=new Vertex(0,0);this.levelIndex=0;this.mapName="Kuala Lumpur";this.mapSource=new MapSource();this.setLevelIndex=function(C){if(this.mapSource.mapScales[C]!=undefined){this.levelIndex=C}};this.setCenterVertex=function(C){this.centerVertex.x=C.x;this.centerVertex.y=C.y};this.setMapSource=function(F,E){this.mapName=F;this.mapDraw=E;this.mapConfig=this.baseUrl+"param.php?cd=mc&s="+escape(F);var D=getHttpObject();var G=this;if(!D){alert("Your browser does not support AJAX!");return }D.onreadystatechange=function C(){if(D.readyState==4){if(D.status==200){var H=D.responseXML;if(H==null){return }G.mapSource.name=G.mapName;G.mapSource.loadFromXml(H);G.mapScale=G.mapSource.getFirstScaleLevel(G.levelIndex);if(G.centerVertex.x==0&&G.centerVertex.y==0){G.centerVertex=G.mapScale.GetCenterVertex()}G.DrawMap()}}};D.open("GET",this.mapConfig,true);D.send(null)};this.SetContainerTopLeft=function(D,F,G){var C=this.mapContainer.bound.left;var E=this.mapContainer.bound.top;this.mapContainer.bound.top=(F.y-1)*this.mapScale.mapHeight;this.mapContainer.bound.left=(F.x-1)*this.mapScale.mapWidth;this.mapContainer.bound.right=(G.x)*this.mapScale.mapWidth;this.mapContainer.bound.bottom=(G.y)*this.mapScale.mapHeight;this.mapContainer.rect.x=this.mapContainer.bound.left-D.x;this.mapContainer.rect.y=this.mapContainer.bound.top-D.y;if(this.mapDraw.popup[1]){this.mapDraw.popup[1].obj.style.left=parseInt(this.mapDraw.popup[1].obj.style.left)+C-this.mapContainer.bound.left+"px";this.mapDraw.popup[1].obj.style.top=parseInt(this.mapDraw.popup[1].obj.style.top)+E-this.mapContainer.bound.top+"px"}this.mapContainer.style.left=this.mapContainer.rect.x+"px";this.mapContainer.style.top=this.mapContainer.rect.y+"px";this.mapContainer.style.width=((G.x-F.x+1)*this.mapScale.mapWidth)+"px";this.mapContainer.style.height=((G.y-F.y+1)*this.mapScale.mapHeight)+"px"};this.ClearTilesContainer=function(){var C=this.mapContainer.Items;for(i=0;i<C.length;i++){this.tilesContainer.removeChild(C[i].div);C[i].div=undefined;C[i]=undefined}this.mapContainer.Items=[];if(this.busCPTiles){var D=this.busCPTiles.Items;for(i=0;i<D.length;i++){this.busCPTiles.removeChild(D[i].img);D[i].img=undefined;D[i]=undefined}this.busCPTiles.Items=[]}if(this.photoTiles){photoItems=this.photoTiles.Items;for(i=0;i<photoItems.length;i++){this.photoTiles.removeChild(photoItems[i].img);photoItems[i].img=undefined;photoItems[i]=undefined}this.photoTiles.Items=[]}};this.DrawMap=function(C){this.GenerateMap(this.getviewportInfo(),C,this.levelIndex)};this.MoveViewportPosition=function(C,D){this.centerVertex=this.mapScale.inflateVert(this.centerVertex,-C,-D);this.mapContainer.rect.x+=C;this.mapContainer.rect.y+=D;this.mapContainer.style.left=this.mapContainer.rect.x+"px";this.mapContainer.style.top=this.mapContainer.rect.y+"px";if(this.mapDraw.panelLine.panel){this.mapDraw.panelLine.panByOffset(-C,-D)}};this.UpdateMap=function(){var O=this.tilesContainer.getElementsByTagName("div");if(this.busCPTiles){var D=this.busCPTiles.getElementsByTagName("img")}if(this.photoTiles){var N=this.photoTiles.getElementsByTagName("img")}var L=parseInt(this.mapContainer.style.top);var F=parseInt(this.mapContainer.style.left);for(var H=0;H<O.length;H++){var K=O[H];var C=parseInt(K.style.top);var M=parseInt(K.style.left);var J=L+C;var I=F+M;if(J>global_draw.margin_top||J<global_draw.margin_bottom||I>global_draw.margin_right||I<global_draw.margin_left){if(J>global_draw.margin_top||J<global_draw.margin_bottom){C=C+(J>0?-1:1)*global_draw.height_limit}if(I>global_draw.margin_right||I<global_draw.margin_left){M=M+(I>0?-1:1)*global_draw.width_limit}var G=K.childNodes[0];var E=global_draw.col+M/this.mapScale.mapWidth;var P=global_draw.row+C/this.mapScale.mapHeight;K.id="divImage_"+P+"_"+E;G.id="tile_img_"+P+"_"+E;G.style.display="none";G.onload=function(){this.style.display=""};G.src=this.mapSource.getMapTileUrl(E,P,this.mapScale,this.levelIndex);K.style.top=C+"px";K.style.left=M+"px"}if(this.busCPTiles){this.UpdateBusCPTile(D[H],L,F)}if(this.photoTiles&&N[H]){this.UpdatePhotoTile(N[H],L,F)}}};this.UpdatePhotoTile=function(F,I,E){var C=parseInt(F.style.top);var J=parseInt(F.style.left);var H=I+C;var G=E+J;if(H>global_draw.margin_top||H<global_draw.margin_bottom||G>global_draw.margin_right||G<global_draw.margin_left){if(H>global_draw.margin_top||H<global_draw.margin_bottom){C=C+(H>0?-1:1)*global_draw.height_limit}if(G>global_draw.margin_right||G<global_draw.margin_left){J=J+(G>0?-1:1)*global_draw.width_limit}var D=global_draw.col+J/this.mapScale.mapWidth;var K=global_draw.row+C/this.mapScale.mapHeight;this.drawPhotoTile(F,K,D,this.levelIndex);F.style.top=C+"px";F.style.left=J+"px"}};this.UpdateBusCPTile=function(F,I,E){var C=parseInt(F.style.top);var J=parseInt(F.style.left);var H=I+C;var G=E+J;if(H>global_draw.margin_top||H<global_draw.margin_bottom||G>global_draw.margin_right||G<global_draw.margin_left){if(H>global_draw.margin_top||H<global_draw.margin_bottom){C=C+(H>0?-1:1)*global_draw.height_limit}if(G>global_draw.margin_right||G<global_draw.margin_left){J=J+(G>0?-1:1)*global_draw.width_limit}var D=global_draw.col+J/this.mapScale.mapWidth;var K=global_draw.row+C/this.mapScale.mapHeight;this.drawBusCPTile(F,K,D,this.levelIndex);F.style.top=C+"px";F.style.left=J+"px"}};this.vertexToScreen=function(D,C){var F=this.mapScale.utmToPixel(D,C);var E=this.mapScale.GetTopLeftPoint(this.centerVertex.x,this.centerVertex.y,this.mapWidth,this.mapHeight);F.x-=E.x;F.y-=E.y;return F};this.screenToVertex=function(D){var C=this.mapScale.inflateVert(this.centerVertex,D.x-this.mapWidth/2,D.y-this.mapHeight/2);return C};this.GetVertexTopLeft=function(C,F){var E=this.mapScale.pixelToUtm(C,F);var D=this.mapScale.GetTopLeftPoint(this.centerVertex.x,this.centerVertex.y,this.mapWidth,this.mapHeight);E.x-=D.x;E.y-=D.y;return E};this.PanMapByOffset=function(E,F,D,C){this.centerVertex=this.mapScale.inflateVert(this.centerVertex,-E,-F);this.DrawMap(true)};this.ZoomIn=function(){var C=this.levelIndex+1;if(C>this.mapSource.mapScales.length-1){return }this.ChangeLevel(C)};this.ChangeLevel=function(F){MapAPI.removePreloadMap();if(this.levelIndex==F){return }this.mapDraw.closeInfoWindow(1);hideAllMapIcon();this.mapDraw.closeToolTips();if(global_show_image){this.clearPhoto()}this.setLevelIndex(F);this.mapScale=this.mapSource.mapScales[this.levelIndex];var D=$("last_pos").innerHTML;D=D.split(",");this.mapDraw.panelImage.hideAllIcon();if(global_cat_id){show_blur_map()}this.DrawMap();if(global_curr_level!=F&&global_curr_level>=1){global_curr_level=F}if(client_mode<=0){move_mover_to_level(F)}var C=getLastPos();var E=this.vertexToScreen(C.x,C.y);moveStarPosition(this,E)};this.ZoomOut=function(){var D=this.levelIndex-1;var C=(client_mode==1)?0:0;if(D<=C){return }this.ChangeLevel(D)};this.GenerateMap=function(G,S,R){var Q=G,D=this.baseUrl+"img/no_map.gif",U,T,I;if(S==undefined){global_draw.num_cols=Math.ceil(this.mapWidth/this.mapScale.mapWidth)+1;global_draw.num_rows=Math.ceil(this.mapHeight/this.mapScale.mapHeight)+1;global_draw.margin_top=this.mapScale.mapHeight*(global_draw.num_rows-1);global_draw.margin_bottom=-this.mapScale.mapHeight;global_draw.margin_left=-this.mapScale.mapWidth;global_draw.margin_right=this.mapScale.mapWidth*(global_draw.num_cols-1);global_draw.height_limit=this.mapScale.mapHeight*global_draw.num_rows;global_draw.width_limit=this.mapScale.mapWidth*global_draw.num_cols}var M=this.mapScale.GetTopLeftPoint(this.centerVertex.x,this.centerVertex.y,this.mapWidth,this.mapHeight);var J=Math.ceil(M.x/this.mapScale.mapWidth);var H=Math.ceil(M.y/this.mapScale.mapHeight);var E=J+global_draw.num_cols-1;var N=H+global_draw.num_rows-1;var L=new Rectangle(0,0,0,0);if(S==undefined){global_draw.row=H;global_draw.col=J;var F=new Point(J,H);var C=new Point(E,N);this.ClearTilesContainer();this.SetContainerTopLeft(M,F,C);if(MapAPI.mapDraw.panelLine.panel){MapAPI.mapDraw.panelLine.updatePosition()}}MapAPI.mapDraw.panelImage.updatePosition();if(S==undefined){if(global_show_image){abortAjax(global_ajax.b);if(this.levelIndex<7){this.createPhotoContainer()}}if(document.getElementById("divImage_1")){obj=document.getElementById("divImage_1");obj.parentNode.removeChild(obj)}if(document.getElementById("tileImg_1")){obj=document.getElementById("tileImage_1");obj.parentNode.removeChild(obj)}if(document.getElementById("area_1")){obj=document.getElementById("area_1");obj.parentNode.removeChild(obj)}if(R==1||R==2){var U=document.createElement("div");U.id="divImage_1";U.style.backgroundImage="url("+this.baseUrl+"img/loading.gif)";U.style.position="absolute";U.style.width=this.mapWidth+"px";U.style.height=this.mapHeight+"px";var P=document.createElement("img");P.id="tileImage_1";P.border=0;P.style.top="0px";P.style.left="0px";P.style.width="730px";P.style.height="600px"}if(R==1){U.style.top="0px";U.style.left="0px";U.style.top="151px";U.style.left="52px";P.src="http://"+location.hostname+"/img/malaysia/mappage/kl_level1.gif";P.useMap="#malaysiaMap";U.appendChild(P);var O=document.createElement("div");O.id="area_1";O.innerHTML='<map name="malaysiaMap" id="malaysiaMap"><area shape="rect" coords="64,59,111,93" href="/malaysia/penang/" title="Penang Map" /><area shape="rect" coords="125,122,217,157" href="/malaysia/kl/" title="Kuala Lumpur Map" /><area shape="rect" coords="155,158,210,186" href="/malaysia/malacca/" title="Malacca Map" /><area shape="rect" coords="205,185,299,206" href="/malaysia/johor/" /><area shape="rect" coords="195,209,263,236" href="http://www.streetdirectory.com" title="Singapore Map" /><area shape="rect" coords="285,455,339,492" href="http://www.streetdirectory.co.id/indonesia/jakarta" title="Jakarta Map" /><area shape="rect" coords="609,544,644,586" href="http://www.streetdirectory.co.id/indonesia/bali" title="Bali Map" /></map>';U.appendChild(O);this.tilesContainer.style.zIndex=8;this.tilesContainer.appendChild(U)}else{if(R==2){U.style.top="0px";U.style.left="0px";U.style.top="152px";U.style.left="42px";P.src="http://"+location.hostname+"/img/malaysia/mappage/kl_zone_730x600.gif";U.appendChild(P);this.tilesContainer.appendChild(U)}else{for(iRow=H;iRow<=N;iRow++){for(iCol=J;iCol<=E;iCol++){L.left=(iCol-J)*this.mapScale.mapWidth;L.top=(iRow-H)*this.mapScale.mapHeight;L.Width=this.mapScale.mapWidth;L.Height=this.mapScale.mapHeight;var U=document.createElement("div");U.id="divImage_"+iRow+"_"+iCol;U.style.backgroundImage="url("+this.baseUrl+"img/loading.gif)";U.style.position="absolute";U.style.top=L.top+"px";U.style.left=L.left+"px";U.style.width=this.mapScale.mapWidth+"px";U.style.height=this.mapScale.mapHeight+"px";var T=new MapTile(iRow,iCol,document.createElement("img"),U);var I=this.mapSource.getMapTileUrl(iCol,iRow,this.mapScale,this.levelIndex);U.appendChild(T.img);this.tilesContainer.appendChild(U);this.mapContainer.Items.push(T);T.img.src=I;T.img.onerror=function(){this.src=D};T.img.id="tile_img_"+iRow+"_"+iCol;T.img.galleryimg="no";T.img.style.width=this.mapScale.mapWidth+"px";T.img.style.height=this.mapScale.mapHeight+"px";if(this.busCPTiles){this.CreateBusCPTile(iRow,iCol,L)}if(this.photoTiles){this.CreatePhotoTile(iRow,iCol,L)}if($("imgDiv")){$("imgDiv").style.backgroundImage=""}}}}}}var K=true;if(global_update_data&&((global_cat_id&&global_directory)||global_business_id)){if(global.need_update||(last_row_start!=H||last_col_start!=J||last_row_end!=N||last_col_end!=E)){global.need_update=true;if(global.need_update){global_curr_level=this.levelIndex;if(this.levelIndex>=3){update_data(H,N,J,E)}else{global.update_timer=setTimeout(function(){update_data(H,N,J,E)},500)}}K=false}}global_update_data=true;if(global_show_image){if(this.levelIndex>=5){if(last_row_start!=H||last_col_start!=J||last_row_end!=N||last_col_end!=E){global_curr_level=this.levelIndex;showBuildingImage(H,N,J,E,false);K=false}}}if(this.mapDraw!=undefined&&K&&last_row_start){}last_row_start=H;last_col_start=J;last_row_end=N;last_col_end=E;if(S==undefined){global_curr_level=this.levelIndex}};this.loadOtherMapTile=function(E,J,G,M,C,K){var F,H;if(K){F=0}else{var D=new Array(0,3,3,3,3,3,3);F=D[C]}for(var I=E-F;I<=J+F;I++){for(var L=G-F;L<=M+F;L++){if(!K&&I>=E&&I<=J&&L>=G&&L<=M){continue}H=document.createElement("img");H.id="dummy_img_"+I+"_"+L;$("dummy_img").appendChild(H);H.src=this.mapSource.getMapTileUrl(L,I,this.mapScale,C)}}return false};this.InitPhoto=function(G,E,C,F){var D=new Rectangle(0,0,0,0);for(iRow=E;iRow<=F;iRow++){for(iCol=G;iCol<=C;iCol++){D.left=(iCol-global_draw.col)*this.mapScale.mapWidth;D.top=(iRow-global_draw.row)*this.mapScale.mapHeight;D.Width=this.mapScale.mapWidth;D.Height=this.mapScale.mapHeight;this.CreatePhotoTile(iRow,iCol,D)}}};this.CreatePhotoTile=function(F,D,E){var C=new MapTile(F,D,document.createElement("img"));C.img.style.border="0px none";C.img.style.margin="0px";C.img.style.padding="0px";C.img.style.position="absolute";C.img.style.top=E.top+"px";C.img.style.left=E.left+"px";C.img.style.width=this.mapScale.mapWidth+"px";C.img.style.height=this.mapScale.mapHeight+"px";this.drawPhotoTile(C.img,F,D,this.levelIndex);this.photoTiles.appendChild(C.img);this.photoTiles.Items.push(C)};this.drawPhotoTile=function(E,G,C,H){var D=false;if(G<=0||C<=0||G>this.mapScale.maxRow||C>this.mapScale.maxCol){D=true}E.id="tile_photo_"+H+"_"+G+"_"+C;E.style.display="none";E.onload=function(){this.style.display=""};if(D){var F="http://"+location.hostname+"/dragmap/xg/img/x.gif"}else{this.setPhotoMouseOver(E,G,C,H);var F=this.mapSource.getPhotoTileUrl(C,G,this.mapScale)}E.src=F};this.setPhotoMouseOver=function(D,F,C,G){var E=this;D.onmouseover=function(){var I=G+"_"+F+"_"+C;if(I!=E.lastPhoto){var H="usemap_script";if($(H)){var J=$(H);document.getElementsByTagName("head")[0].removeChild(J)}var J=document.createElement("script");J.id=H;J.setAttribute("type","text/javascript");J.setAttribute("src","http://"+location.hostname+"/asia_travel/mappage/map_tiles/photo_area.php?level="+G+"&col="+C+"&row="+F+"&v="+global.v+global_clear_cache);document.getElementsByTagName("head")[0].appendChild(J);E.lastPhoto=I}}};this.createPhotoMap=function(I,D,K,F){var J=$("tile_photo_"+D+"_"+K+"_"+F);if(J){var G=$("photo_map");G.innerHTML="";for(var H=0;H<I.length;H++){var E=B(I[H],D);G.appendChild(E)}var C=this.viewport;J.useMap="#photo_map"}};function B(I,E){var C=document.createElement("area");C.title=I.title;C.shape="RECT";C.coords=I.coords;var M=new Array(0,160,120,30,10);var G=new Array(0,460,230,40,20);var D=parseInt(I.x_addr)+M[E];var H=parseInt(I.y_addr)+G[E];var N,J,K,F,L=I.title;if(I.portrait){if(L.length>18){L=L.substr(0,15)+"..."}F='<div class="TextBold arial ver_14" style="padding-bottom: 7px; padding-right: 9px" title="'+I.title+'">'+L+"</div>";N=185;J=305;F+='<div align="center"><img src="http://'+location.hostname+"/stock_images/travel/show_map_image.php?imageId="+I.simage_id+'&mode=1" width="150" height="230"/></div>';K="bldg_portrait"}else{if(L.length>28){L=L.substr(0,25)+"..."}F='<div class="TextBold arial ver_14" style="padding-bottom: 7px; padding-right: 9px" title="'+I.title+'">'+L+"</div>";N=265;J=225;F+='<div align="center"><img src="http://'+location.hostname+"/stock_images/travel/show_map_image.php?imageId="+I.simage_id+'&mode=2" width="230" height="150"/></div>';K="bldg_landscape"}C.onclick=function(O){MapAPI.mapDraw.openBubble(N,J,new Point(D,H),F)};return C}this.CreateBusCPTile=function(F,C,E){var D=new MapTile(F,C,document.createElement("img"));D.img.style.border="0px none";D.img.style.margin="0px";D.img.style.padding="0px";D.img.style.position="absolute";D.img.style.top=E.top+"px";D.img.style.left=E.left+"px";D.img.style.width=this.mapScale.mapWidth+"px";D.img.style.height=this.mapScale.mapHeight+"px";this.drawBusCPTile(D.img,F,C,this.levelIndex);this.busCPTiles.appendChild(D.img);this.busCPTiles.Items.push(D)};this.drawBusCPTile=function(D,G,C,H){var E=false;if(G<=0||C<=0||G>this.mapScale.maxRow||C>this.mapScale.maxCol){E=true}D.id="tile_buscp_"+H+"_"+G+"_"+C;D.style.display="none";D.onload=function(){this.style.display=""};if(E){var F="http://"+location.hostname+"/dragmap/xg/img/x.gif"}else{this.setBusCPMouseOver(D,G,C,H);var F=this.mapSource.getBusCPTileUrl(C,G,this.mapScale)}D.src=F};this.setBusCPMouseOver=function(D,F,C,G){var E=this;D.onmouseover=function(){if(global.buscp_mover_timer){clearTimeout(global.buscp_mover_timer);global.buscp_mover_timer=false}global.buscp_mover_timer=setTimeout(function(){E.busCPMouseOver(F,C,G)},300)}};this.busCPMouseOver=function(G,D,H){var E=H+"_"+G+"_"+D;if(E!=this.lastBusCP){var C="buscp_area";if($(C)){var F=$(C);document.getElementsByTagName("head")[0].removeChild(F)}var F=document.createElement("script");F.id=C;F.setAttribute("type","text/javascript");F.setAttribute("src","http://"+location.hostname+"/asia_travel/mappage/map_tiles/buscp_area.php?level="+H+"&col="+D+"&row="+G+"&v="+global.v+global_clear_cache);document.getElementsByTagName("head")[0].appendChild(F);this.lastBusCP=E}};this.createBusCPMap=function(C,D,L,F){var H=$("tile_buscp_"+D+"_"+L+"_"+F);if(H){var I=$("buscp_map");I.innerHTML="";var K=getMapDiv(L,F,D,this.mapScale);for(var G=0;G<C.length;G++){var J=new Point();J.x=Math.round((C[G].x_addr-K.topX)/(K.bottomX-K.topX)*this.mapScale.mapWidth);J.y=Math.round(this.mapScale.mapHeight-(C[G].y_addr-K.topY)/(K.bottomY-K.topY)*this.mapScale.mapHeight);var E=A(C[G],D,J);I.appendChild(E)}H.useMap="#buscp_map"}};function A(K,G,O){var D=document.createElement("area");D.title=K.title;D.shape="RECT";if(G==6){var H=8;px=O.x-6;py=O.y-6}else{var H=5;px=O.x+3;py=O.y+5}D.coords=(px-H)+","+(py-H)+","+(px+H)+","+(py+H);var E=new Array(0,60,200,70,30,10,-4);var C=new Array(0,60,200,70,30,2,10);var F=parseInt(K.x_addr)+E[G];var J=parseInt(K.y_addr)+C[G];var P,L,M,I,N=K.title;I='<div class="TextBold arial ver_14" style="padding-bottom: 7px; padding-right: 9px">'+N+'</div><div id="map_bubble_content_loading" class="arial ver_11">Loading...</div>';L=225;if(K.type=="bus"){P=265}else{P=311}D.onclick=function(R){var Q=MapAPI.mapDraw.openBubble(P,L,new Point(F,J),I);getBusCPBubbleContent(K,Q);MapAPI.mapDraw.closeToolTips()};return D}this.InitWithDefaultMapSource=function(C,D){this.CreateDefaultMapSource(D);this.Init(C,D)};this.Init=function(C){this.mapSource=new MapSource(C.baseUrl);this.mapDraw=C.mapDraw;this.viewport=C.viewportLayer;this.mapWidth=C.granParentLayer.clientWidth==0?parseInt(C.granParentLayer.style.width):C.granParentLayer.clientWidth;this.mapHeight=C.granParentLayer.clientHeight==0?parseInt(C.granParentLayer.style.height):C.granParentLayer.clientHeight;this.baseUrl=C.baseUrl;this.mapContainer=document.createElement("div");this.mapContainer.id="map_container";this.mapContainer.style.position="absolute";this.mapContainer.style.left="0px";this.mapContainer.style.top="0px";this.mapContainer.style.width="100%";this.mapContainer.style.height="100%";this.mapContainer.style.zIndex=7;this.mapContainer.style.backgroundImage="url("+this.baseUrl+"img/x.gif)";this.mapContainer.rect={x:0,y:0};this.mapContainer.Items=[];this.mapContainer.bound=new Rectangle(0,0,0,0);this.tilesContainer=document.createElement("div");this.tilesContainer.style.zIndex=0;this.tilesContainer.style.position="absolute";this.tilesContainer.style.left="0px";this.tilesContainer.style.top="0px";this.mapContainer.appendChild(this.tilesContainer);this.viewport.appendChild(this.mapContainer)};this.createPhotoContainer=function(){this.photoTiles=document.createElement("div");this.photoTiles.style.zIndex=7;this.photoTiles.style.position="absolute";this.photoTiles.style.left="0px";this.photoTiles.style.top="0px";this.photoTiles.Items=[];this.mapContainer.appendChild(this.photoTiles);var C=document.createElement("map");C.id="photo_map";C.name="photo_map";var D=this.viewport;C.onmouseover=function(){D.style.cursor="pointer"};C.onmouseout=function(){MapAPI.setCursor(true)};this.photoTiles.appendChild(C)};this.clearPhoto=function(){if(global_curr_level<6){this.removePhotoContainer()}else{this.mapDraw.panelImage.hideAllIcon()}};this.removePhotoContainer=function(){this.mapContainer.removeChild(this.photoTiles);this.photoTiles=null};this.createBusCPContainer=function(){this.busCPTiles=document.createElement("div");this.busCPTiles.style.zIndex=8;this.busCPTiles.style.position="absolute";this.busCPTiles.style.left="0px";this.busCPTiles.style.top="0px";this.busCPTiles.Items=[];this.mapContainer.appendChild(this.busCPTiles);var D=document.createElement("map");D.id="buscp_map";D.name="buscp_map";var C=this.viewport;D.onmouseover=function(){C.style.cursor="pointer"};D.onmouseout=function(){MapAPI.setCursor(true)};this.busCPTiles.appendChild(D)};this.removeBusCPContainer=function(){this.mapContainer.removeChild(this.busCPTiles);this.busCPTiles=null};this.getviewportInfo=function(){var C=new ViewportInfo();C.width=this.mapWidth;C.height=this.mapHeight;C.centerVertex=this.centerVertex;return C};this.getScalePercentageCurrentLevelToHighLevel=function(){var C=mapSource.getLastLevel();if(C==null){return 100}else{if(C.totalWidth==0){return 100}}return scale.totalWidth/C.totalWidth}}function MapDrawingController(){this.lines=new Array();this.icons=new Array();this.plots=new Array();this.popup=new Array();this.tooltips="";this.color="blue";this.types=new Array("1","biz_prem","res","res_prem","bldg_portrait","bldg_landscape","property");this.panelIcon=new MapIconController();this.panelLine=new MapLineController();this.panelDraw=new MapLineController();this.panelImage=new BuildingImageController();this.Init=function(A){this.client=A;this.panelImage.init(A);this.panelIcon.init(A);this.panelLine.init(A);this.panelDraw.init(A);this.panelDraw.panel.setLineWidth(2);this.panelDraw.panel.setLineColor("red")};this.PanPanelByOffset=function(A,D){this.panelImage.panByOffset(A,D);this.panelIcon.panByOffset(A,D);this.panelLine.panByOffset(A,D);this.panelDraw.panByOffset(A,D);var C;for(var B=0;B<this.types.length;B++){C=this.types[B];if(this.popup[C]){this.popup[C].panByOffset(A,D)}}if(this.tooltips){this.tooltips.panByOffset(A,D)}};this.stop=function(){this.panelDraw.panel.endLine();this.panelDraw.panel.clear();this.getDistanceState();this.plots=new Array()};this.getCurrentPos=function(C){var B=C.x-this.client.mapWidth/2;var A=C.y-this.client.mapHeight/2;return{x:C.x,y:C.y,rx:B,ry:A}};this.savePosition=function(B){var A=this.client.mapScale.inflateVert(this.client.centerVertex,B.rx,B.ry);this.plots.push(A)};this.addIcon=function(B,G,C,D,F,E,A){return this.panelIcon.addIcon(B,G,C,D,F,E,A)};this.addSpecialIcon=function(A,F,B,C,E,D){return this.panelIcon.addSpecialIcon(A,F,B,C,E,D)};this.addBuildingImage=function(E,A,F,B,C,D){return this.panelImage.addImage(E,A,F,B,C,D)};this.hideIcon=function(A){this.panelIcon.hideIcon(A)};this.hideAllIcon=function(){this.panelIcon.hideAllIcon()};this.hideLine=function(){this.panelLine.panel.container.style.display="none"};this.showLine=function(){this.panelLine.panel.container.style.display="block"};this.showIconInZoneOnly=function(A){this.panelIcon.showIconInZoneOnly(A)};this.showIconInDistance=function(A){this.panelIcon.showIconInDistance(A)};this.unHideIcon=function(B,A){this.panelIcon.unHideIcon(B,A)};this.unHideAllIcon=function(){this.panelIcon.unHideAllIcon()};this.addGeofence=function(A,C,B){this.panelDraw.addGeofence(A,C,B)};this.addLine=function(A,B){this.panelLine.addLine(A,B)};this.updatePanel=function(){this.panelImage.updatePosition();this.panelIcon.updatePosition();this.panelLine.updatePosition();this.panelDraw.updatePosition();var B;for(var A=0;A<this.types.length;A++){B=this.types[A];if(this.popup[B]){this.popup[B].updatePosition(true)}}};this.setPosition=function(B,A,C){this.panelIcon.setPosition(B,A,C)};this.draw=function(D,A){var C=this.getCurrentPos(D);if(A==false){this.savePosition(C);this.panelDraw.points=new Array();this.panelDraw.addLine(this.plots);this.getDistanceState()}else{if(this.plots.length>0){var B=this.client.vertexToScreen(this.plots[this.plots.length-1].x,this.plots[this.plots.length-1].y);this.panelDraw.panel.clearShape();this.panelDraw.panel.startLine(B.x,B.y);this.panelDraw.panel.lineTo(C.x,C.y);this.getDistanceState(C)}}};this.getDistanceState=function(D){var E=0;for(var B=0,C=this.plots.length;B<C;B++){if((B+1)<=C-1){E+=this.client.mapScale.GetDistance(this.plots[B],this.plots[B+1])}}if(D!=undefined){var A=this.client.mapScale.inflateVert(this.client.centerVertex,D.rx,D.ry);E+=this.client.mapScale.GetDistance(this.plots[this.plots.length-1],A)}if(E>0){window.status="Distance : "+(E/1000)+" km"}};this.clear=function(){this.panelDraw.clear();this.panelIcon.clear()};this.openInfoWindowHtml=function(F,H,C,I,D,E,B){var A,G,J;var G=this.client.vertexToScreen(I.x,I.y);if(G.x>this.client.mapWidth/2){J=G.y>=this.client.mapHeight/2?1:2}else{J=G.y>=this.client.mapHeight/2?0:3}if(this.popup[F]){this.popup[F].obj.parentNode.removeChild(this.popup[F].obj);this.popup[F]=null}this.popup[F]=new MapBubble(H,C);this.popup[F].type=B;this.popup[F].arrow_pos=J;this.popup[F].init(this.client);this.popup[F].setContent(D,I);this.client.mapContainer.appendChild(this.popup[F].obj);return this.popup[F]};this.openBubble=function(G,B,H,C,D){var A,F,I,E=1;var F=this.client.vertexToScreen(H.x,H.y);if(F.x>this.client.mapWidth/2){I=F.y>=this.client.mapHeight/2?1:2}else{I=F.y>=this.client.mapHeight/2?0:3}if(this.popup[E]){this.popup[E].obj.parentNode.removeChild(this.popup[E].obj);this.popup[E]=null}this.popup[E]=new MapBubble(G,B);this.popup[E].arrow_pos=I;this.popup[E].init(this.client);this.popup[E].setContent(C,H);this.client.mapContainer.appendChild(this.popup[E].obj);return this.popup[E]};this.toolTipsHtml=function(B,C,A,D){if(this.tooltips){this.tooltips.obj.parentNode.removeChild(this.tooltips.obj);this.tooltips=null}this.tooltips=new MapToolTips();this.tooltips.type=D;this.tooltips.init(this.client);this.tooltips.obj.onmouseover=new Function("MapAPI.mapDraw.tooltips.obj.style.display='block'");if(A){this.tooltips.setOffsetTop(A)}this.tooltips.setContent(C,B);return this.tooltips};this.closeToolTips=function(){if(this.tooltips!=undefined){if(this.tooltips.obj){this.tooltips.obj.style.display="none"}}};this.closeInfoWindow=function(A){if(this.popup[A]!=undefined){this.popup[A].obj.style.display="none"}}}function MapLineController(){this.color="#0000FF";this.points=new Array();this.circlePoints=new Array();this.panel=null;this.width="3";this.zIndex=7;this.mapLevel=0;this.mapClient=null;this.firstTime=true;this.init=function(A){this.mapClient=A;this.mapLevel=A.levelIndex;this.panel=new DrawingCanvas(A.mapContainer);this.panel.setLineWidth(this.width);this.panel.setLineColor("#0000FF");this.panel.container.style.zIndex=this.zIndex;this.reset()};this.deleteLines=function(){this.clear();this.points=new Array()};this.deleteGeofences=function(){this.clear();this.circlePoints=new Array()};this.clear=function(){this.reset();this.panel.clear()};this.reset=function(){this.panel.container.style.left="0px";this.panel.container.style.top="0px";this.panel.container.style.position="absolute"};this.addGeofence=function(A,C,B){this.circlePoints.push(new Array(A,C,B));this.updatePosition()};this.addLine=function(A,B){if(B!=undefined){this.color=B}this.points.push(A);this.updatePosition()};this.draw=function(){this.clear();var G="",F=0;for(var B=0,D=this.points.length;B<D;B++){for(var A=0,E=this.points[B].length;A<E;A++){G=this.mapClient.vertexToScreen(this.points[B][A].x,this.points[B][A].y);if(A==0){this.panel.startLine(G.x,G.y)}else{this.panel.lineTo(G.x,G.y)}}this.panel.endLine()}for(var A=0,C=this.circlePoints.length;A<C;A++){G=this.mapClient.vertexToScreen(this.circlePoints[A][0],this.circlePoints[A][1]);F=this.circlePoints[A][2]/this.mapClient.mapScale.scaleValue();this.panel.createGeofence(G.x,G.y,Math.abs(F),this.circlePoints[A][2])}};this.updatePosition=function(){this.draw();this.panel.setSize(parseInt(this.mapClient.mapContainer.style.width),parseInt(this.mapClient.mapContainer.style.height));if(this.panel){this.panel.updatePosition()}};this.panByOffset=function(A,B){this.panel.panByOffset(A,B)}}function MapIconController(){this.icons=new Array();this.mapClient=null;this.zIndex=9;this.icon_groups=new Array();this.init=function(A){this.mapClient=A};this.addIcon=function(G,F,H,B,C,I,E){var D=new MapIcon(G,F,this.zIndex,this.mapClient,H,B,C,"","",E);if(star_id==C){D.hideIcon()}this.icons.push(D);var A=this.icon_groups.length;if(I==""||I==undefined){I="0"}this.icon_groups.push(I);return D};this.hideIcon=function(B){var C=this.icons.length;for(var A=0;A<C;A++){if(this.icon_groups[A]==B&&this.icons[A].zone){if(this.icons[A].obj){this.icons[A].hideIcon();this.icons[A].active=false;this.removeIcon(this.icons[A])}}}};this.hideAllIcon=function(){var B=this.icons.length;for(var A=0;A<B;A++){if(this.icons[A].zone){this.icons[A].hideIcon();if(this.icons[A].obj){this.removeIcon(this.icons[A])}}}};this.hideMarkers=function(){if(this.icons[0]){this.icons[0].hideIcon()}if(this.icons[1].obj){this.removeIcon(this.icons[1])}};this.removeIcon=function(A){if(A){if(A.appended){this.mapClient.mapContainer.removeChild(A.obj);A.appended=false;return true}}return false};this.appendIcon=function(A){if(A){if(!A.appended){this.mapClient.mapContainer.appendChild(A.obj);A.appended=true;return true}}return false};this.showIconInZoneOnly=function(D,A){var C=this.icons.length;for(var B=0;B<C;B++){if((this.icons[B].zone==D||this.icons[B].zone==undefined)&&this.icons[B].active==true){this.icons[B].unHideIcon();if(A){this.icons[B].updatePosition(this.mapClient)}this.mapClient.mapContainer.appendChild(this.icons[B].obj)}else{this.icons[B].hideIcon();this.removeIcon(this.icons[B])}}};this.showIconInDistance=function(D,A){var C=this.icons.length;for(var B=0;B<C;B++){if((this.icons[B].distance<=D||this.icons[B].distance==undefined)&&this.icons[B].active==true){this.icons[B].unHideIcon();if(A==1){this.icons[B].updatePosition(this.mapClient)}this.mapClient.mapContainer.appendChild(this.icons[B].obj)}else{this.icons[B].hideIcon();this.removeIcon(this.icons[B])}}};this.unHideIcon=function(C,B){var D=this.icons.length;for(var A=0;A<D;A++){if(this.icon_groups[A]==C&&this.icons[A].special!=true&&this.icons[A].zone){this.icons[A].unHideIcon();if(B){this.icons[A].setIcon("star"+B+".gif")}this.icons[A].updatePosition(this.mapClient);this.icons[A].active=true;this.mapClient.mapContainer.appendChild(this.icons[A].obj)}}};this.showOneGroupOnly=function(C,A){var D=this.icon_groups.length;for(var B=0;B<D;B++){if(this.icon_groups[B]==C||!this.icons[B].zone){if(this.icons[B].updatePosition(this.mapClient)){this.appendIcon(this.icons[B])}else{if(B>1){this.removeIcon(this.icons[B])}}}else{if(B>1){this.removeIcon(this.icons[B])}}}};this.unHideAllIcon=function(){var B=this.icons.length;for(var A=0;A<B;A++){if(this.icons[A].special==true){continue}this.icons[A].unHideIcon();this.mapClient.mapContainer.appendChild(this.icons[A].obj)}};this.lockStar=function(A){this.icons[0].active=!A};this.updateMarker=function(){if(this.icons[1]){if(this.icons[1].updatePosition(this.mapClient)){this.appendIcon(this.icons[1])}else{this.icons[1].hideIcon()}}};this.updatePosition=function(){if(!document.all){global.i=global.i?global.i:1}var A,D=parseFloat(global_zonename);if(global_zonename=="2000"){this.showIconInDistance(parseFloat(global_zonename),1)}else{if(global_zonename!="all"){this.showIconInZoneOnly(global_zonename,1)}else{for(var B=0,C=this.icons.length;B<C;B++){if(!this.icons[B].special&&this.icons[B].active==true){if(this.icons[B].updatePosition(this.mapClient)){this.appendIcon(this.icons[B])}else{if(B>1&&this.mapClient.levelIndex>=3){this.removeIcon(this.icons[B])}}}}}}};this.setPosition=function(B,A,C){B.x=A;B.y=C;B.updatePosition(this.mapClient)};this.panByOffset=function(A,D){for(var B=0,C=this.icons.length;B<C;B++){if(this.icons[B].obj.style.display!="none"){this.icons[B].offsetPosition(A,D)}}};this.clear=function(){for(var C=0,B=this.icons.length;C<B;C++){for(var A=0;A<this.mapClient.viewport.childNodes.length;A++){if(this.icons[C].obj==this.mapClient.viewport.childNodes[A]){this.mapClient.mapContainer.removeChild(this.icons[C].obj);break}}}};this.deleteAll=function(){this.clear();this.icons=new Array()}}function MapIcon(K,I,J,M,L,B,C,H,A,G){this.x=K;this.y=I;this.special=null;this.zone=H;this.active=true;this.appended=false;this.star_id=C;this.distance=A;this.mapClient=M;this.icon_file=G?G:"star"+C+".gif";var D=navigator.appVersion.split("MSIE");var F=parseFloat(D[1]);if((F>=5.5)&&(F<7)&&(document.body.filters)){var E="http://"+location.hostname+"/img/mappointer/"+this.icon_file;this.obj=document.createElement("span");this.obj.border="1px solid #000";this.obj.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+E+"', sizingMethod='scale')"}else{this.obj=document.createElement("img");this.obj.src="http://"+location.hostname+"/img/mappointer/"+this.icon_file}this.obj.id=(C==1)?"star_icon"+C:"";this.obj.style.left=K+"px";this.obj.style.top=I+"px";this.obj.style.zIndex=(C==1)?10:J;this.obj.style.position="absolute";this.obj.mapIcon=this;this.obj.style.width=L+"px";this.obj.style.height=B+"px";this.setUrl=function(N){this.obj.src=N};this.hideIcon=function(){this.obj.style.display="none"};this.unHideIcon=function(){this.obj.style.display="block"};this.setIcon=function(N){this.obj.src="http://"+location.hostname+"/img/mappointer/"+N};this.setZIndex=function(N){this.obj.style.zIndex=N};this.updatePosition=function(N){var O=N.vertexToScreen(this.x,this.y);if((N.mapWidth>O.x&&O.x>-10)&&(N.mapHeight>O.y&&O.y>-10)&&!isNaN(O.x)&&!isNaN(O.y)){if("star_icon"+star_id!=this.obj.id){this.unHideIcon()}this.obj.style.left=(-parseInt(N.mapContainer.style.left)+O.x-parseInt(this.obj.style.width)/2)+"px";this.obj.style.top=(-parseInt(N.mapContainer.style.top)+O.y-parseInt(this.obj.style.height)/2)+"px";return true}else{}return false};this.offsetPosition=function(Q,O){var P=parseInt(this.obj.style.left);var N=parseInt(this.obj.style.top);if(!isNaN(P)&&!isNaN(N)){this.obj.style.left=(P+Q)+"px";this.obj.style.top=(N+O)+"px"}}}function MapBubble(A,B){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.top=this.left=null;this.midBorder=this.botBorder=this.blBorder=this.brBorder=null;this.setContent=function(D,C){this.point=C;if(D==undefined){D="Loading..."}this.content.innerHTML=D;this.obj.style.display="";this.obj.style.position="absolute";this.obj.style.cursor="default";this.updatePosition(false)};this.updateContent=function(D,C){this.point=C;this.content.innerHTML=D;this.obj.style.display="none";this.obj.style.position="absolute"};this.init=function(J){this.mapClient=J;this.obj=document.createElement("div");this.obj.style.zIndex=20;var D=document.createElement("img");if(this.arrow_pos<=1){var K=this.coreBnd(7,7,0,24,0,0);var H=this.coreBnd(7,7,(this.w-7),24,-43,0);this.blBorder=this.coreBnd(7,7,0,(this.h-9),0,-44);this.brBorder=this.coreBnd(7,7,(this.w-7),(this.h-9),-43,-44);if(this.arrow_pos==0){var G=this.h-8;var F=this.coreBnd(8,15,0,G,-163,-35)}else{var G=this.h-4;var E=document.all?this.w-31:this.w-30;var F=this.coreBnd(16,9,E,G,-162,-10)}D.style.cssText="position: absolute; left: "+(this.w-22)+"px; top: 36px; width: 12 px; height: 12px; border:0px; z-Index:100;"}else{var K=this.coreBnd(7,7,0,0,0,0);var H=this.coreBnd(7,7,(this.w-7),0,-43,0);this.blBorder=this.coreBnd(7,7,0,(this.h-33),0,-44);this.brBorder=this.coreBnd(7,7,(this.w-7),(this.h-33),-43,-44);if(this.arrow_pos==2){var E=document.all?this.w-31:this.w-30;var F=this.coreBnd(16,10,E,-7,-162,0)}else{var F=this.coreBnd(8,15,0,-7,-163,-19)}D.style.cssText="position: absolute; left: "+(this.w-25)+"px; top: 10px; width: 12 px; height: 12px; border:0px; z-Index:100;"}this.arrow=F;D.src=this.mapClient.baseUrl+"img/silang.gif";D.title="Close";this.exBtn=D;this.exBtn.style.cursor="pointer";this.exBtn.o=this;this.exBtn.onclick=function(){this.o.obj.style.display="none";global_bubble_flag="";global_bubble.company_id=global_bubble.directory=null};var E=document.all?2:2;var I=document.all?24:24;var C=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 L="#F1EEDB";if(this.arrow_pos>1){C.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: "+L+";";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-E)+"px;height: "+(this.h-40)+"px; background-color: "+L+";";this.botBorder.style.cssText="border-bottom: 1px solid rgb(171, 171, 171); position: absolute; left: 7px; top: "+(this.h-51)+"px;width: "+(this.w-14)+"px; height: "+I+"px; background-color: "+L+";";this.content.style.cssText="position: absolute; left: 16px; top: 8px; width: "+(this.w-32)+"px; z-index: 10;"}else{C.style.cssText="border-top: 1px solid rgb(171, 171, 171); position: absolute; left: 7px; top: 24px; width: "+(this.w-14)+"px;height: 25px; background-color: "+L+";";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: 31px; width: "+(this.w-E)+"px;height: "+(this.h-40)+"px; background-color: "+L+";";this.botBorder.style.cssText="border-bottom: 1px solid rgb(171, 171, 171); position: absolute; left: 7px; top: "+(this.h-27)+"px;width: "+(this.w-14)+"px; height: "+I+"px; background-color: "+L+";";this.content.style.cssText="position: absolute; left: 16px; top: 33px; width: "+(this.w-32)+"px; z-index: 10;"}this.obj.appendChild(K);this.obj.appendChild(H);this.obj.appendChild(this.blBorder);this.obj.appendChild(this.brBorder);this.obj.appendChild(C);this.obj.appendChild(this.midBorder);this.obj.appendChild(this.botBorder);this.obj.appendChild(F);this.obj.appendChild(this.exBtn);this.obj.appendChild(this.content)};this.coreBnd=function(E,I,D,G,C,H){var J=document.createElement("div");J.style.overflow="hidden";J.style.width=E+"px";J.style.height=I+"px";J.style.position="absolute";J.style.left=D+"px";J.style.top=G+"px";var F=document.createElement("img");F.style.border="0px";F.style.position="absolute";F.style.left=C+"px";F.style.top=H+"px";this.arrow_img=F;F.src=this.mapClient.baseUrl+"img/layer_grey.gif";J.appendChild(F);return J};this.panByOffset=function(F,D){var E=parseInt(this.obj.style.left);var C=parseInt(this.obj.style.top);if(!isNaN(E)&&!isNaN(C)){this.obj.style.left=(E+F)+"px";this.obj.style.top=(C+D)+"px"}};this.moveArrowByOffset=function(F,D){var E=parseInt(this.arrow.style.left);var C=parseInt(this.arrow.style.top);if(!isNaN(E)&&!isNaN(C)){this.arrow.style.left=(E+F)+"px";this.arrow.style.top=(C+D)+"px"}};this.updatePosition=function(I){var J=new Vertex(0,0),N,L;var M=this.mapClient.vertexToScreen(this.point.x,this.point.y);if(M.x==null||M.y==null){return }M.x+=-(parseInt(this.mapClient.mapContainer.style.left));M.y+=-(parseInt(this.mapClient.mapContainer.style.top));var C=M;var K=C;L=new Point(this.w,this.h);N=new Point(0,0);C=OffsetPoint(C,N.x,N.y);K=OffsetPoint(K,L.x,L.y);var F=document.all?2:2;var H=this.type.indexOf("prem")!=-1||global.branch?9:0;if(this.arrow_pos<=1){if(this.arrow_pos==0){this.obj.style.left=(C.x-F)-H+"px"}else{this.obj.style.left=(C.x-this.w+21)-H+"px"}this.top=C.y-this.h+1+H}else{if(this.arrow_pos==2){this.obj.style.left=(C.x-this.w+21)-H+"px";this.top=C.y+13+H}else{this.obj.style.left=(C.x-F)-H+"px";this.top=C.y+14+H}}this.obj.style.top=this.top+"px";var G=new Object;G.left=parseInt(this.obj.style.left);G.top=parseInt(this.obj.style.top);G.right=G.left+this.w;G.bottom=G.top+this.h;var D=0,E=10;this.panByOffset(J.x,J.y);this.moveArrowByOffset(-J.x+D,J.y)};this.fitHeight=function(){this.setHeight(this.content.offsetHeight+50)};this.setHeight=function(C){var D=this.h;this.h=C;this.midBorder.style.height=(this.h-40)+"px";if(this.arrow_pos>1){this.botBorder.style.top=(this.h-51)+"px";this.blBorder.style.top=(this.h-33)+"px";this.brBorder.style.top=(this.h-33)+"px"}else{this.botBorder.style.top=(this.h-27)+"px";this.blBorder.style.top=(this.h-9)+"px";this.brBorder.style.top=(this.h-9)+"px";var E=this.h-D;this.top=this.top-E;this.obj.style.top=this.top+"px";this.moveArrowByOffset(0,E)}}}function MapToolTips(){this.obj=null;this.content=null;this.mapClient=null;this.point=null;this.w=20;this.h=30;this.offset_top=1;this.arrow_pos=0;this.type=null;this.setContent=function(C,B){this.point=B;this.obj.style.zIndex=0;this.obj.style.display="block";var D=this.mapClient.vertexToScreen(B.x,B.y);var A='<table height="20" cellspacing="0" cellpadding="0" border="0"><tr><td height="7" width="7" valign="bottom" align="right"><div style="overflow: hidden; width: 7px; height: 7px; position: relative; left: 0px; top: 0px;"><img style="border: 0px none ; position: absolute; left: 0px; top: 0px;" src="http://'+location.hostname+'/dragmap/xg/img/layer_grey.gif"/></div></td><td style="line-height: 6px; border-top: 1px solid rgb(171, 171, 171); background-color: #f1eedb">&nbsp;</td><td width="7" valign="bottom"><div style="overflow: hidden; width: 7px; height: 7px; position: relative; left: 0; top: 0px;"><img style="border: 0px none ; position: absolute; left: -43px; top: 0px;" src="http://'+location.hostname+'/dragmap/xg/img/layer_grey.gif"/></div></td></tr><tr style="height: 15px;"><td style="border-left: 1px solid #ababab;background-color: #f1eedb">&nbsp;</td><td bgcolor="#f1eedb" class="ver_11" nowrap="nowrap">'+C+'</td><td style="border-right: 1px solid #ababab; background-color: #f1eedb">&nbsp;</td></tr><tr><td valign="top" align="right"><div style="overflow: hidden; width: 7px; height: 6px; position: relative; left: 0px; top: 0px;"><img style="border: 0px none ; position: absolute; left: 0px; top: -44px;" src="http://'+location.hostname+'/dragmap/xg/img/layer_grey.gif"/></div></td><td style="background-color: #f1eedb; border-bottom: 1px solid #ababab; line-height: 5px">&nbsp;</td><td valign="top"><div style="overflow: hidden; width: 7px; height: 6px; position: relative; left: 0px; top: 0px;"><img style="border: 0px none ; position: absolute; left: -43px; top: -44px;" src="http://'+location.hostname+'/dragmap/xg/img/layer_grey.gif"/></div></td></tr></table>';if(D.x>this.mapClient.mapWidth/2){if(D.y>=this.mapClient.mapHeight/2){this.arrow_pos=1;this.obj.innerHTML=A+'<div id="tooltip_arrow" style="overflow:hidden; width: 15px; height: 9px; position: relative; left: 0px; top: -2px; z-index: 1"><img style="border: 0px none ; position: absolute; left: -163px; top: -10px;" src="http://'+location.hostname+'/dragmap/xg/img/layer_grey.gif"/></div>';$("tooltip_arrow").style.left=(this.obj.offsetWidth-(document.all?30:29))+"px"}else{this.arrow_pos=2;this.obj.innerHTML='<div id="tooltip_arrow" style="overflow:hidden; width: 15px; height: 9px; position: relative; left: 0px; top: 2px; z-index: 1"><img style="border: 0px none ; position: absolute; left: -163px; top: 0px;" src="http://'+location.hostname+'/dragmap/xg/img/layer_grey.gif"/></div>'+A;$("tooltip_arrow").style.left=(this.obj.offsetWidth-(document.all?30:29))+"px"}}else{if(D.y>=this.mapClient.mapHeight/2){this.arrow_pos=0;this.obj.innerHTML=A+'<div id="tooltip_arrow" style="overflow:hidden; width: 8px; height: 15px; position: relative; left: 0px; top: -6px; z-index: 1"><img style="border: 0px none ; position: absolute; left: -163px; top: -35px;" src="http://'+location.hostname+'/dragmap/xg/img/layer_grey.gif"/></div>'}else{this.arrow_pos=3;this.obj.innerHTML='<div id="tooltip_arrow" style="overflow:hidden; width: 8px; height: 15px; position: relative; left: 0px; top: 8px; z-index: 1"><img style="border: 0px none ; position: absolute; left: -163px; top: -19px;" src="http://'+location.hostname+'/dragmap/xg/img/layer_grey.gif"/></div>'+A}}this.updatePosition();this.obj.style.zIndex=15};this.setOffsetTop=function(A){this.offset_top=A};this.init=function(A){this.mapClient=A;this.obj=document.createElement("div");this.obj.style.cssText="z-index:15; cursor:pointer;left:0px;top:0px;";this.obj.onmouseout=new Function("MapAPI.mapDraw.closeToolTips();");this.obj.style.position="absolute";this.mapClient.mapContainer.appendChild(this.obj)};this.panByOffset=function(D,B){var C=parseInt(this.obj.style.left);var A=parseInt(this.obj.style.top);if(!isNaN(C)&&!isNaN(A)){this.obj.style.left=(C+D)+"px";this.obj.style.top=(A+B)+"px"}};this.updatePosition=function(){var G=new Vertex(0,0),C,B;var F=this.mapClient.vertexToScreen(this.point.x,this.point.y);if(F.x==null||F.y==null){return }F.x+=-(parseInt(this.mapClient.mapContainer.style.left));F.y+=-(parseInt(this.mapClient.mapContainer.style.top));var E=F;var A=E;B=new Point(this.w,this.h);C=new Point(0,0);E=OffsetPoint(E,C.x,C.y);A=OffsetPoint(A,B.x,B.y);var D=this.type.indexOf("prem")!=-1||global.branch?9:0;if(this.arrow_pos==1||this.arrow_pos==2){this.obj.style.left=E.x-this.obj.offsetWidth+21-D+"px"}else{this.obj.style.left=E.x-2-D+"px"}if(this.arrow_pos==2){this.obj.style.top=E.y+4+D+"px"}else{if(this.arrow_pos==3){this.obj.style.top=E.y-1+D+"px"}else{if(this.arrow_pos==1){this.obj.style.top=E.y-this.obj.offsetHeight+9+D+"px"}else{this.obj.style.top=E.y-this.obj.offsetHeight+14+D+"px"}}}}}function MapApiController(){this.mapClient=new MapClient();this.mapDraw=new MapDrawingController();this.drawMode=false;this.dragging=false;this.thumbNailPanel=null;this.enableThumbnail=true;this.dragging_thumb=null;this.useNavigation=false;this.map_scale_img=null;this.level_7_mode=true;this.useNavType=0;this.currMousePos=null;this.setNavigation=function(H){this.useNavigation=H};this.animatedZoom=function(T,O){global.on_animated=true;var I=this.mapClient.levelIndex,a,J;var R,N,P,Y,f,d;var e=this.mapClient;if(O==-1){var H=I<=2?300:150,L=-25,U=-25;if(I==3){U=-24.1}}else{var H=I<=2?700:400,L=25,U=25}d=$("tile_img_"+last_row_start+"_"+last_col_start);a=parseInt(d.style.width)+L;J=parseInt(d.style.height)+U;var W=T.x-(e.mapWidth/2);var V=T.y-(e.mapHeight/2);var M=this.mapClient.screenToVertex(T);if(!backup_scale_width&&!backup_scale_height){backup_scale_width=e.mapScale.mapWidth;backup_scale_height=e.mapScale.mapHeight}e.mapScale.mapWidth=a;e.mapScale.mapHeight=J;e.centerVertex=e.mapScale.inflateVert(M,-W,-V);var Z=e.mapScale.GetTopLeftPoint(e.centerVertex.x,e.centerVertex.y,e.mapWidth,e.mapHeight);var S=new Point(last_col_start,last_row_start);var K=new Point(last_col_end,last_row_end);e.SetContainerTopLeft(Z,S,K);for(R=last_row_start;R<=last_row_end;R++){for(N=last_col_start;N<=last_col_end;N++){f=$("divImage_"+R+"_"+N);d=$("tile_img_"+R+"_"+N);P=(N-last_col_start)*a;Y=(R-last_row_start)*J;f.style.top=Y+"px";f.style.left=P+"px";d.style.width=f.style.width=a+"px";d.style.height=f.style.height=J+"px"}}var c=O==-1?(parseInt(d.style.width)>H):(parseInt(d.style.width)<H);if(c){var X=this;setTimeout(function(){X.animatedZoom(T,O)},100)}else{var X=this;var b=$("dummy_img_"+global.next_row_end+"_"+global.next_col_end);function Q(){hide_element("crosshair_line_h");hide_element("crosshair_line_w");X.mapClient.mapScale.mapWidth=backup_scale_width;X.mapClient.mapScale.mapHeight=backup_scale_height;X.mapClient.setCenterVertex(global_last_center);backup_scale_height=backup_scale_width=0;X.zoomMap(T,O);global.on_wheel=false}b.onerror=function(){this.error=true};if(b.complete||b.error||global.next_row_end<=0|global.next_col_end<=0){Q()}else{b.onload=Q}}};this.zoomMap=function(M,J){var L=J==-1?this.mapClient.levelIndex-1:this.mapClient.levelIndex+1;var I=this.findNextLevelCenterMapInPos(M,J);this.mapClient.levelIndex=L;this.mapClient.setLevelIndex(L);this.mapClient.mapScale=this.mapClient.mapSource.mapScales[L];this.mapClient.setCenterVertex(I);this.mapClient.DrawMap();this.mapDraw.panelIcon.updateMarker();var H=getLastPos();var K=this.mapClient.vertexToScreen(H.x,H.y);moveStarPosition(this.mapClient,K);if(this.mapDraw.panelLine.panel){this.mapDraw.showLine()}this.updateScaleImage();move_mover_to_level(L);global.on_animated=false};this.findNextLevelCenterMapInPos=function(N,K){var L=copy_obj(this.mapClient);var M=K==-1?L.levelIndex-1:L.levelIndex+1;var H=L.screenToVertex(N);L.levelIndex=M;L.setLevelIndex(M);L.mapScale=L.mapSource.mapScales[M];L.centerVertex=H;var J=L.screenToVertex(N);var I=new Vertex();J.x=J.x-H.x;J.y=J.y-H.y;I.x=H.x-J.x;I.y=H.y-J.y;return I};this.loadNextMapTile=function(N,M){var I=this.findNextLevelCenterMapInPos(N,M);var O=copy_obj(this.mapClient);var H=M==-1?O.levelIndex-1:O.levelIndex+1;O.levelIndex=H;O.setLevelIndex(H);O.mapScale=O.mapSource.mapScales[H];var P=O.mapScale.GetTopLeftPoint(I.x,I.y,O.mapWidth,O.mapHeight);var K=Math.ceil(P.x/O.mapScale.mapWidth);var J=Math.ceil(P.y/O.mapScale.mapHeight);var Q=Math.ceil((P.x+O.mapWidth)/O.mapScale.mapWidth);var L=Math.ceil((P.y+O.mapHeight)/O.mapScale.mapHeight);global.next_col_start=K;global.next_col_end=Q;global.next_row_start=J;global.next_row_end=L;O.loadOtherMapTile(J,L,K,Q,H,true);$("dummy_img_"+global.next_row_end+"_"+global.next_col_end).onerror=function(){this.error=true}};this.crossHairEffect=function(J){if($("crosshair_line_h")){show_element("crosshair_line_h");var I=$("crosshair_line_h");I.style.top=J.y+"px"}else{var I=document.createElement("div");I.id="crosshair_line_h";I.style.cssText="background:url("+this.baseUrl+"img/block_dot.gif) repeat-x; width:"+this.mapClient.mapWidth+"px; height:1px; position:absolute; left:0px; top:"+J.y+"px; z-index:50;";this.viewportLayer.appendChild(I)}if($("crosshair_line_w")){show_element("crosshair_line_w");var H=$("crosshair_line_w");H.style.left=J.x+"px"}else{var H=document.createElement("div");H.id="crosshair_line_w";H.style.cssText="background:url("+this.baseUrl+"img/block_dot.gif) repeat-y; width:1px; height:"+this.mapClient.mapHeight+"px; position:absolute; left:"+J.x+"px; top:0px; z-index:50;";this.viewportLayer.appendChild(H)}};function E(H){if(global.on_animated){return false}MapAPI.removePreloadMap();var J=this._p.mapClient.levelIndex+1;if(J<=7&&$("tile_img_"+last_row_start+"_"+last_col_start)&&$("divImage_"+last_row_start+"_"+last_col_start)){var I=getCursorPos(H,this._p.granParentLayer);this._p.loadNextMapTile(I,1);this._p.crossHairEffect(I);global_last_center=new Vertex(this._p.mapClient.centerVertex.x,this._p.mapClient.centerVertex.y);this._p.mapDraw.hideAllIcon();this._p.mapDraw.closeToolTips();this._p.mapDraw.closeInfoWindow(1);if(this._p.mapClient.busCPTiles){this._p.mapClient.removeBusCPContainer()}if(global_show_image){this._p.mapClient.clearPhoto()}this._p.mapDraw.panelIcon.hideMarkers();if(this._p.mapDraw.panelLine.panel){this._p.mapDraw.hideLine()}this._p.animatedZoom(I,1);this._p.updateThumbNailControl(I,null)}}function F(H){if(MapAPI.mapClient.levelIndex>2){if(global.on_animated){return false}if(window.Event){if(H.which==2||H.which==3){return }}else{if(event.button==2||event.button==3){return }}MapAPI.setCursor(false);MapAPI.removePreloadMap();clearTimeout(timer);clearTimeout(global.update_timer);abortAjax(global_ajax.a);var I=getCursorPos(H,MapAPI.granParentLayer);MapAPI.startX=I.x;MapAPI.startY=I.y;MapAPI.firstX=I.x;MapAPI.firstY=I.y;MapAPI.dragging=true;if(global.buscp_mover_timer){clearTimeout(global.buscp_mover_timer);global.buscp_mover_timer=false}if(MapAPI.drawMode==true){MapAPI.mapDraw.draw(I,false);MapAPI.dragging=false}}}function G(J){MapAPI.currMousePos=getCursorPos(J,MapAPI.granParentLayer);if(!MapAPI.drawMode&&!MapAPI.dragging){return }var K=getCursorPos(J,MapAPI.granParentLayer);var I=K.x;var H=K.y;if(MapAPI.drawMode==true&&MapAPI.dragging==false){MapAPI.mapDraw.draw(K,true)}if(MapAPI.dragging==true){if(MapAPI.mapClient.levelIndex>2){MapAPI.mapClient.MoveViewportPosition(I-MapAPI.startX,H-MapAPI.startY);MapAPI.mapClient.UpdateMap();MapAPI.startX=K.x;MapAPI.startY=K.y;return false}}}function C(H){MapAPI.setCursor(true);closeLoadingLocationBox();if(MapAPI.dragging==true){var I=getCursorPos(H,MapAPI.granParentLayer);if(I.x==MapAPI.firstX&&I.y==MapAPI.firstY){MapAPI.dragging=false;return }MapAPI.dragging=false;MapAPI.mapClient.PanMapByOffset(I.x-MapAPI.startX,I.y-MapAPI.startY,true,false);MapAPI.updateThumbNailControl(I,null);moveStarPosition(MapAPI.mapClient,I)}MapAPI.dragging=false}function B(H){if(MapAPI.dragging||global.on_animated){return false}var K=MapAPI.currMousePos,J;if(global.on_wheel==true||K==null){return false}MapAPI.removePreloadMap();var I=0;if(!H){H=window.event}if(H.wheelDelta){I=H.wheelDelta/120;if(window.opera){I=-I}}else{if(H.detail){I=-H.detail/3}}if($("tile_img_"+last_row_start+"_"+last_col_start)&&$("divImage_"+last_row_start+"_"+last_col_start)){if(I>0){J=this._p.mapClient.levelIndex+1;if(J<=7){global.on_wheel=true;this._p.loadNextMapTile(K,1);this._p.crossHairEffect(K);global_last_center=new Vertex(this._p.mapClient.centerVertex.x,this._p.mapClient.centerVertex.y);this._p.mapDraw.hideAllIcon();this._p.mapDraw.closeToolTips();this._p.mapDraw.closeInfoWindow(1);if(this._p.mapClient.busCPTiles){this._p.mapClient.removeBusCPContainer()}if(global_show_image){this._p.mapClient.clearPhoto()}this._p.mapDraw.panelIcon.hideMarkers();if(this._p.mapDraw.panelLine.panel){this._p.mapDraw.hideLine()}this._p.animatedZoom(K,1);this._p.updateThumbNailControl(K,null)}}else{if(I<0){J=this._p.mapClient.levelIndex-1;if(J>=1){global.on_wheel=true;this._p.loadNextMapTile(K,-1);this._p.crossHairEffect(K);global_last_center=new Vertex(this._p.mapClient.centerVertex.x,this._p.mapClient.centerVertex.y);this._p.mapDraw.hideAllIcon();this._p.mapDraw.closeToolTips();this._p.mapDraw.closeInfoWindow(1);if(this._p.mapClient.busCPTiles){this._p.mapClient.removeBusCPContainer()}if(global_show_image){this._p.mapClient.clearPhoto()}this._p.mapDraw.panelIcon.hideMarkers();if(this._p.mapDraw.panelLine.panel){this._p.mapDraw.hideLine()}this._p.animatedZoom(K,-1);this._p.updateThumbNailControl(K,null)}}}}cancelEvent(H);return false}this.createContainer=function(I,Q,O,N,L,P,M,J,K){var H=document.createElement("div");if(I!=""){H.id=I}H.style.left=Q+"px";H.style.top=O+"px";H.style.width=N+"px";H.style.height=L+"px";H.style.position=P;H.style.zIndex=J;if(M!=""){H.style.backgroundColor=M}if(K!=undefined&&K==true){H.style.overflow="hidden"}return H};this.createNavigationContainer=function(K,M,J,L,I,H){return this.createContainer("div_container",K,M,J,L,"absolute",H,I)};this.createNavigationControl=function(I,J,O,R,K,N,H){var P=document.createElement("div");P._mapClient=this.mapClient;P._p=this;var L=navigator.appVersion.split("MSIE");var M=parseFloat(L[1]);if(H&&(M>=5.5)&&(M<7)&&(document.body.filters)){P.style.left=J+"px";P.style.top=O+"px";P.style.position="absolute";P.style.width=R+"px";P.style.height=K+"px";P.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+I+"')"}else{if(N){P.style.cssText="left:"+J+"px; top:"+O+"px; position:absolute; width:"+R+"px; height:"+K+"px; background:url("+I+") no-repeat;"}else{P.style.left=J+"px";P.style.top=O+"px";P.style.position="absolute";var Q=document.createElement("img");Q.style.width=R+"px";Q.style.height=K+"px";Q.src=I;P.appendChild(Q)}}return P};this.createNavigationControl2=function(I,M,J,H,K){var L=document.createElement("img");L.style.left=M+"px";L.style.top=J+"px";L.style.width=H+"px";L.style.height=K+"px";L.style.position="absolute";L.src=I;L._mapClient=this.mapClient;L._p=this;return L};this.initZoomControl=function(){var P,Q,K=100;var I=100;var L=this.createNavigationContainer(5,35,50,130,11,0);var O=this.baseUrl;var M=this.createNavigationControl(this.baseUrl+"img/minus_normal.png",17,5,16,16,0);M.title="Zoom in";M.style.cursor="pointer";M.onclick=function(){var R=0;if(this._mapClient.levelIndex-1>R){var S=getLastPos();var T=this._mapClient.vertexToScreen(S.x,S.y);this._p.mapDraw.PanPanelByOffset(T.x,T.y);this._mapClient.ZoomOut()}else{if(this._mapClient.levelIndex-1==0&&client_mode==1){this._mapClient.levelIndex=7;this._p.setMapSource("kl");client_mode=0}}this._p.updateScaleImage()};var J=this.createNavigationControl(this.baseUrl+"img/plus_normal.png",17,160,16,16,0);J.title="Zoom out";J.style.cursor="pointer";J.onclick=function(){var R=7;if(this._mapClient.levelIndex+1<=R){var S=getLastPos();var T=this._mapClient.vertexToScreen(S.x,S.y);this._p.mapDraw.PanPanelByOffset(T.x,T.y);this._mapClient.ZoomIn()}else{if(client_mode==0){this._mapClient.levelIndex=1;this._p.setMapSource(client_code);client_mode=1}}this._p.updateScaleImage()};P=this.mapClient.levelIndex;if(P==7){Q=144}else{if(P==6){Q=124}else{if(P==5){Q=102}else{if(P==4){Q=83}else{if(P==3){Q=63}else{if(P==2){Q=43}else{if(P==1){Q=20}}}}}}}var H=this.createNavigationControl(this.baseUrl+"img/mover.png",15,Q,20,18,13);H.id="mover";H.parent=L;H.style.cursor="pointer";H.onmousedown=function(){drag_mover=true};H.onmouseup=this.panel_onmouseup;var N=this.createNavigationControl(this.baseUrl+"img/sleek_bar_id_03.png",5,0,38,182);N.mover=H;N.parent=L;N.style.cursor="pointer";N.onmousedown=this.panel_onmousedown;N.onmousemove=this.panel_onmousemove;N.onmouseup=this.panel_onmouseup_bar;L.appendChild(N);L.appendChild(M);L.appendChild(J);L.appendChild(H);this.parentLayer.appendChild(L)};this.panel_onmousedown=function(H){drag_mover=true;return true};this.panel_onmousemove=function(H){if(drag_mover==true){var I=getCursorPos(H,this.parent);if(I.y>=25&&I.y<=160){this.style.cursor="pointer";this.mover.style.top=(I.y-5)+"px"}}return true};this.panel_onmouseup=function(J){if(drag_mover==true){var H,I,K=getCursorPos(J,this.parent);if(K.y>157){move_mover_to_level(7);showRestoInBuilding();this._p.level_7_mode=true;drag_mover=false;return true}else{if(K.y>123){H=6;I=124}else{if(K.y>101){H=5;I=102}else{if(K.y>82){H=4;I=83}else{if(K.y>62){H=3;I=63}else{if(K.y>42){H=2;I=43}else{H=1;I=20}}}}}}this._mapClient.ChangeLevel(H);this.style.top=I+"px"}drag_mover=false;return true};this.panel_onmouseup1=function(J){if(drag_mover==true){var H,I,K=getCursorPos(J,this.parent);if(K.y>157){move_mover_to_level(7);showRestoInBuilding();this._p.level_7_mode=true;drag_mover=false;return true}else{if(K.y>137){H=6;I=144}else{if(K.y>115){H=5;I=118}else{if(K.y>91){H=4;I=95}else{if(K.y>64){H=3;I=73}else{if(K.y>47){H=2;I=53}else{H=1;I=30}}}}}}this._mapClient.ChangeLevel(H);this.mover.style.top=I+"px";this._p.updateScaleImage()}drag_mover=false;return true};this.panel_onmouseup_bar=function(J){if(drag_mover==true){var H,I,K=getCursorPos(J,this.parent);if(K.y>=153){H=7;I=144}else{if(K.y>123){H=6;I=124}else{if(K.y>101){H=5;I=102}else{if(K.y>82){H=4;I=83}else{if(K.y>62){H=3;I=63}else{if(K.y>42){H=2;I=43}else{H=1;I=20}}}}}}this._mapClient.ChangeLevel(H);this.mover.style.top=I+"px";this._p.updateScaleImage()}drag_mover=false;return true};this.initZoomControl_old=function(){var N=100;var L=100;var O=this.createNavigationContainer(5,35,50,130,11);var Q=this.createNavigationControl(this.baseUrl+"img/nav_up.gif",16,0,17,17);Q.onclick=function(){this._mapClient.PanMapByOffset(0,L,false,false);moveStarPosition(this._mapClient,this._mapClient.vertexToScreen(this._mapClient.centerVertex.x,this._mapClient.centerVertex.y))};Q.onmouseover=function(){Q.style.cursor="pointer"};var P=this.createNavigationControl(this.baseUrl+"img/nav_left.gif",6,22,17,17);P.onclick=function(){this._mapClient.PanMapByOffset(N,0,false,false);moveStarPosition(this._mapClient,this._mapClient.vertexToScreen(this._mapClient.centerVertex.x,this._mapClient.centerVertex.y))};P.onmouseover=function(){P.style.cursor="pointer"};var M=this.createNavigationControl(this.baseUrl+"img/nav_right.gif",27,22,17,17);M.onclick=function(){this._mapClient.PanMapByOffset(-N,0,false,false);moveStarPosition(this._mapClient,this._mapClient.vertexToScreen(this._mapClient.centerVertex.x,this._mapClient.centerVertex.y))};M.onmouseover=function(){M.style.cursor="pointer"};var K=this.createNavigationControl(this.baseUrl+"img/nav_btm.gif",15,44,17,17);K.onclick=function(){this._mapClient.PanMapByOffset(0,-L,false,false);moveStarPosition(this._mapClient,this._mapClient.vertexToScreen(this._mapClient.centerVertex.x,this._mapClient.centerVertex.y))};K.onmouseover=function(){K.style.cursor="pointer"};var J=this.createNavigationControl(this.baseUrl+"img/nav_in.gif",15,66,17,17);J.title="Zoom in";J.onclick=function(){var R=7;if(this._mapClient.levelIndex+1<=R){var S=getLastPos();var T=this._mapClient.vertexToScreen(S.x,S.y);this._p.mapDraw.PanPanelByOffset(T.x,T.y);this._mapClient.ZoomIn()}else{if(client_mode==0){this._mapClient.levelIndex=1;this._p.setMapSource(client_code);client_mode=1}}this._p.updateScaleImage()};J.onmouseover=function(){J.style.cursor="pointer"};var I=this.createNavigationControl(this.baseUrl+"img/nav_out.gif",15,88,17,17);I.title="Zoom out";I.onclick=function(){var R=(client_mode==1)?0:1;if(this._mapClient.levelIndex-1>R){var S=getLastPos();var T=this._mapClient.vertexToScreen(S.x,S.y);this._p.mapDraw.PanPanelByOffset(T.x,T.y);this._mapClient.ZoomOut()}else{if(this._mapClient.levelIndex-1==0&&client_mode==1){this._mapClient.levelIndex=7;this._p.setMapSource("kl");client_mode=0}}this._p.updateScaleImage()};I.onmouseover=function(){I.style.cursor="pointer"};var H=this.createNavigationControl(this.baseUrl+"img/location_spotting.gif",15,111,17,17);H.title="Move to original position";H.onclick=function(){this._mapClient.centerVertex=default_xy;this._mapClient.DrawMap();this._p.updateThumbNailControl(new Vertex(this._mapClient.mapWidth/2,this._mapClient.mapHeight/2),null)};H.onmouseover=function(){H.style.cursor="pointer"};O.appendChild(Q);O.appendChild(P);O.appendChild(M);O.appendChild(K);O.appendChild(J);O.appendChild(I);O.appendChild(H);this.parentLayer.appendChild(O)};this.initMapLegend=function(){var H=this.createNavigationContainer(0,0,this.mapClient.mapWidth,1,11);var N=this.createNavigationControl(this.baseUrl+"img/logo_my.gif",0,0,92,30);var M=this.mapClient.levelIndex>7?7:this.mapClient.levelIndex;var J=(client_mode<=0)?this.baseUrl+"img/kl_scale"+M+".gif":this.baseUrl+"img/x.gif";this.map_scale_img=this.createNavigationControl2(J,this.mapClient.mapWidth-65,0,65,18);var I=($("bizz_map_ad"))?72:12;var L=this.createNavigationControl(this.baseUrl+"img/copyright.gif",0,this.mapClient.mapHeight-I,125,12);var K=this.createNavigationControl(this.baseUrl+"img/north.gif",this.mapClient.mapWidth-170,this.mapClient.mapHeight-16,28,16);H.appendChild(N);H.appendChild(this.map_scale_img);H.appendChild(L);H.appendChild(K);this.parentLayer.appendChild(H)};this.updateScaleImage=function(){if(this.mapClient.levelIndex>7){return }if(client_mode<=0){this.map_scale_img.src=this.baseUrl+"img/kl_scale"+this.mapClient.levelIndex+".gif"}else{this.map_scale_img.src=this.baseUrl+"img/x.gif"}};this.getSelectedController=function(I,H){for(var J=0;J<I.length;J++){if(J==H){I[J].style.border="1px solid #000"}else{I[J].style.border=""}}};this.initThumbNailControl=function(){this.thumbNailPanel=document.createElement("div");this.thumbNailPanel.id="thumbNailPanel";this.thumbNailPanel.style.cssText="border-top: 1px solid rgb(151, 151, 151); border-left: 1px solid rgb(151, 151, 151); overflow: hidden; width: 174px; height: 165px; background-color: white; z-index:11;position: absolute; right: -1px; bottom: -1px;";var K=document.createElement("div");K.style.cssText="position:absolute; left:3px; top:3px;border-top:1px solid rgb(151, 151, 151); border-left:1px solid rgb(151, 151, 151); z-index:1;";var J=document.createElement("img");J.style.cssText="position: absolute; right: 0px; bottom: 0px; cursor:pointer; z-index:11;";J.src=this.baseUrl+"img/thumb_min.gif";J.o=this;J.onclick=function(){if(this.o.thumbNailPanel.style.display=="none"){this.o.thumbNailPanel.style.display="";J.src=this.o.baseUrl+"img/thumb_min.gif"}else{this.o.thumbNailPanel.style.display="none";J.src=this.o.baseUrl+"img/thumb_max.gif"}};this.thumbNailControl=document.createElement("div");this.thumbNailControl.id="thumbNailControl";var I=document.createElement("img");I.src=this.baseUrl+"img/kl_thumbnail.gif";I.useMap="#Thumbnail";I.border=0;K.appendChild(I);var H=document.createElement("div");H.innerHTML='<map name="Thumbnail" id="Thumbnail" onclick="return false;"><area shape="rect" coords="14,3,44,12" href="#" /><area shape="rect" coords="131,144,159,151" href="#" /></map>';this.thumbNailPanel.appendChild(K);this.thumbNailPanel.appendChild(H);this.thumbNailPanel.appendChild(this.thumbNailControl);this.viewportLayer.appendChild(this.thumbNailPanel)};this.updateThumbNailControl=function(P,M){var O=this.mapClient.mapSource.mapScales[3];var R=752648.24,N=819493.58,I=360922.33,H=298163.61;var K=new MapScale(169,160,1,1,R,N,H,I);if(P){var U=this.mapClient.screenToVertex(P);var S=K.GetTopLeftPoint(U.x-500,U.y+500,7,7)}else{var S=K.GetTopLeftPoint(this.mapClient.centerVertex.x-500,this.mapClient.centerVertex.y+2000,7,7)}var J=S.x,T=S.y,Q=14,L=14;this.thumbNailControl.style.cssText="width: "+Q+"px; height: "+L+"px; left:"+J+"px; top: "+T+"px; z-index:2; border-style: solid; border-color: rgb(136, 136, 255); border-width: 2px; position: absolute; cursor: move;background:url("+this.baseUrl+"img/x.gif);";this.thumbNailPanel._scale=K;this.thumbNailPanel.mc=this.mapClient;this.thumbNailPanel.ori_cursor=null;this.thumbNailPanel.onmousedown=this.onmousedown_thumbNailPanel;this.thumbNailPanel.onmouseup=this.onmouseup_thumbNailPanel;this.thumbNailPanel.onmouseout=this.onmouseup_thumbNailPanel;this.thumbNailPanel.onmousemove=this.onmousemove_thumbNailPanel};function A(I,H){var J=getCursorPos(I,H);document.getElementById("thumbNailControl").style.left=(J.x-10)+"px";document.getElementById("thumbNailControl").style.top=(J.y-10)+"px"}function D(K,J){var M=getCursorPos(K,J);var L="http://"+location.hostname;var I=L+"/malaysia/penang/travel.php?travel_id=8147&travel_site=182142&travel_no=&x=646320.638&y=592610.8188&star=1&level=3";var H=L+"/malaysia/malacca/travel/travel_id_8404/travel_site_151944/";if(M.x>20&&M.x<50&&M.y>10&&M.y<20){if(confirm("Are you sure go to Penang map?")){window.location.href=I}return false}else{if(M.x>135&&M.x<165&&M.y>150&&M.y<160){if(confirm("Are you sure go to Malacca map?")){window.location.href=H}return false}}return true}this.onmousedown_thumbNailPanel=function(H){if(D(H,this)){A(H,this);this.dragging_thumb=true}};this.onmouseup_thumbNailPanel=function(I){if(this.dragging_thumb){D(I,this);var J=getCursorPos(I,this);var H=this._scale.pixelToUtm(J.x-5,J.y-4);this.mc.setCenterVertex(new Vertex(H.x,H.y));this.mc.DrawMap();pos_map=new Point(this.mc.mapWidth/2,this.mc.mapHeight/2);moveStarPosition(this.mc,pos_map)}this.dragging_thumb=false};this.onmousemove_thumbNailPanel=function(H){var I=getCursorPos(H,this);if(this.ori_cursor==null){this.ori_cursor=this.style.cursor}if((I.x>7&&I.x<60&&I.y>10&&I.y<20)||(I.x>130&&I.x<173&&I.y>150&&I.y<160)){this.style.cursor="hand"}else{this.style.cursor=this.ori_cursor}if(this.dragging_thumb){A(H,this)}};this.initController=function(){this.viewportLayer._p=this;this.viewportLayer._mapClient=this.mapClient;this.viewportLayer._mapDraw=this.mapDraw;this.viewportLayer.onmousedown=F;document.onmousemove=G;document.onmouseup=C;this.viewportLayer.ondblclick=E;if(window.addEventListener){this.viewportLayer.addEventListener("DOMMouseScroll",B,false)}else{this.viewportLayer.onmousewheel=B}this.initMapLegend();this.initZoomControl();this.initThumbNailControl()};this.initContainer=function(H){this.granParentLayer=$(H);this.granParentLayer.setAttribute("onmousedown","if (typeof event.preventDefault != 'undefined') { event.preventDefault();}");this.parentLayer=document.createElement("div");this.viewportLayer=document.createElement("div");this.viewportLayer.style.position="absolute";this.viewportLayer.style.overflow="hidden";this.viewportLayer.style.left="0px";this.viewportLayer.style.top="0px";this.viewportLayer.style.width="100%";this.viewportLayer.style.height="100%";this.parentLayer.appendChild(this.viewportLayer);this.granParentLayer.appendChild(this.parentLayer)};this.setCursor=function(H){if(H==true){if(document.namespaces&&document.namespaces.add){if(this.viewportLayer.style.cursor!="url('"+this.baseUrl+"img/openhand.cur'), default"){this.viewportLayer.style.cursor="url('"+this.baseUrl+"img/openhand.cur'), default"}}else{this.viewportLayer.style.cursor="-moz-grab"}}else{if(H==false){if(document.namespaces&&document.namespaces.add){if(this.viewportLayer.style.cursor!="url('"+this.baseUrl+"img/closehand.cur'), default"){this.viewportLayer.style.cursor="url('"+this.baseUrl+"img/closehand.cur'), default"}}else{this.viewportLayer.style.cursor="-moz-grabbing"}}}};this.setMapSize=function(I,H){this.mapClient.mapWidth=I;this.mapClient.mapHeight=H;this.mapClient.DrawMap()};this.setMapSource=function(H){this.mapClient.setMapSource(H,this.mapDraw)};this.init=function(H,I,J){this.initContainer(H);this.baseUrl=I;this.mapClient.Init(this,I);this.mapClient.levelIndex=J};this.removePreloadMap=function(){if($("preloadMap")){this.granParentLayer.removeChild($("preloadMap"))}}}var VEvent={addListener:function(B,C,A){if(window.addEventListener){B.obj.addEventListener(C,A,false)}else{B.obj.attachEvent("on"+C,A)}}};function DrawingCanvasSVGT(E,D,A){if(!E){throw new Error("No canvas parent!")}if(!D){D=E.clientWidth}if(!A){A=E.clientHeight}this.parent=E;this.width=D;this.height=A;this._bgColor="none";this._lineWidth=3;this._lineColor="#0000FF";this._isDrawing=false;this._currentShape=null;this._points="";this._dummyDot=null;this._stack=[];this._stackSize=0;this._opacity=0.45;this.vbtop=0;this.vbleft=0;this.vbwidth=1000;this.vbheight=1000;var C=document.createElementNS(this._XMLNS_SVG,"svg");C.setAttribute("width",D);C.setAttribute("height",A);var F=document.createElementNS(this._XMLNS_SVG,"rect");F.setAttribute("width",D);F.setAttribute("height",A);F.setAttribute("fill",this._bgColor);C.appendChild(F);var B=document.createElementNS("http://www.w3.org/1999/xhtml","div");B.setAttribute("style","width: "+D+"px; height: "+A+"px; ");B.appendChild(C);E.appendChild(B);this.container=B;this._svgRoot=C;this._bg=F}DrawingCanvasSVGT.prototype={_XMLNS_SVG:"http://www.w3.org/2000/svg",setSize:function(B,A){this.container.style.width=B+"px";this.container.style.height=A+"px";this._svgRoot.setAttribute("width",B);this._svgRoot.setAttribute("height",A);this._bg.setAttribute("width",B);this._bg.setAttribute("height",A);this.width=B;this.height=A},updatePosition:function(){this.setTopLeft(-parseInt(this.parent.style.left),-parseInt(this.parent.style.top));this.vbleft=0;this.vbtop=0;this.vbwidth=parseInt(this.parent.style.width);this.vbheight=parseInt(this.parent.style.height);this.setViewBox()},setTopLeft:function(B,A){this._svgRoot.setAttribute("style","position:absolute;top:"+A+"px;left:"+B+"px")},setViewBox:function(){this._svgRoot.setAttribute("viewBox",this.vbleft+" "+this.vbtop+" "+this.vbwidth+" "+this.vbheight)},panByOffset:function(A,B){this.setTopLeft(-parseInt(this.parent.style.left),-parseInt(this.parent.style.top));this.vbleft+=A;this.vbtop+=B;this.setViewBox()},setBgColor:function(A){this._bgColor=(A=="transparent")?"none":A;this._refresh()},setLineColor:function(A){this._lineColor=A},setOpacity:function(A){this._opacity=A},setLineWidth:function(A){this._lineWidth=Number(A)||0},createGeofence:function(A,D,B,C){this.createCircle(A,D,B);this.createArrow(A,D,B);this.createText(A,D,B,C)},createCircle:function(A,D,C){var B=document.createElementNS(this._XMLNS_SVG,"circle");B.setAttribute("cx",A);B.setAttribute("cy",D);B.setAttribute("r",C);B.setAttribute("stroke","black");B.setAttribute("stroke-width",2);B.setAttribute("fill","none");this._svgRoot.appendChild(B);this._pushStack(B)},createArrow:function(B,E,D){var A=document.createElementNS(this._XMLNS_SVG,"polyline");var C=(B+D-5)+","+(E-5)+" "+(B+D)+","+E+" "+B+","+E+" "+(B+D)+","+E+" "+(B+D-5)+","+(E+5);A.setAttribute("fill","none");A.setAttribute("stroke","black");A.setAttribute("stroke-width",2);A.setAttribute("stroke-linecap","round");A.setAttribute("stroke-linejoin","round");A.setAttribute("points",C);this._svgRoot.appendChild(A);this._pushStack(A)},createText:function(A,E,D,B){var C=document.createElementNS(this._XMLNS_SVG,"text");C.setAttribute("x",A);C.setAttribute("y",E-5);C.setAttribute("fill","red");C.setAttribute("stroke-linejoin","bevel");C.setAttribute("font-size",18);C.appendChild(document.createTextNode((B/1000)+" km"));this._svgRoot.appendChild(C);this._pushStack(C)},startLine:function(A,D){if(this._isDrawing){this.endLine()}this._isDrawing=true;var C=document.createElementNS(this._XMLNS_SVG,"circle");C.setAttribute("cx",A);C.setAttribute("cy",D);C.setAttribute("r",this._lineWidth/2);this._svgRoot.appendChild(C);C.setAttribute("fill",this._lineColor);this._dummyDot=C;this._points=A+","+D;var B=document.createElementNS(this._XMLNS_SVG,"polyline");B.setAttribute("fill","none");B.setAttribute("stroke",this._lineColor);B.setAttribute("stroke-width",this._lineWidth);B.setAttribute("stroke-linecap","round");B.setAttribute("stroke-linejoin","round");B.setAttribute("opacity",this._opacity);B.setAttribute("points",this._points);this._svgRoot.appendChild(B);this._currentShape=B},endLine:function(){if(!this._isDrawing){return }if(this._dummyDot){this._svgRoot.removeChild(this._currentShape);this._pushStack(this._dummyDot);this._dummyDot=null}else{this._pushStack(this._currentShape)}this._isDrawing=false;this._currentShape=null;this._points=""},lineTo:function(A,B){if(!this._isDrawing){return }if(this._dummyDot){this._svgRoot.removeChild(this._dummyDot);this._dummyDot=null}this._points+=" "+A+","+B;this._currentShape.setAttribute("points",this._points)},undo:function(){if(this._isDrawing){this.endLine()}if(this._stackSize<=0){return false}this._svgRoot.removeChild(this._stack[--this._stackSize]);this._refresh();return true},redo:function(){if(this._isDrawing){this.endLine()}if(this._stackSize>=this._stack.length){return false}this._svgRoot.appendChild(this._stack[this._stackSize++]);this._refresh();return true},clearShape:function(){if(this._isDrawing){this.endLine()}if(this._stack.length>1){this._svgRoot.removeChild(this._stack[this._stack.length-1]);this._refresh();this._stack.length=this._stack.length-1;this._stackSize=this._stackSize-1}},clear:function(){if(this._isDrawing){this.endLine()}for(var A=this._stackSize;A--;){if(this._stack[A]!=undefined){this._svgRoot.removeChild(this._stack[A])}}this._refresh();this._stack.length=0;this._stackSize=0},getX:function(){var B=this.container;var A=B.offsetLeft;while((B=B.offsetParent)){A+=B.offsetLeft}return A},getY:function(){var A=this.container;var B=A.offsetTop;while((A=A.offsetParent)){B+=A.offsetTop}return B},_pushStack:function(A){if(this._stackSize+1<this._stack.length){this._stack.length=this._stackSize+1}this._stack[this._stackSize++]=A},_refresh:function(){this._bg.setAttribute("fill",this._bgColor)}};function DrawingCanvasCanvas(F,E,A){if(!F){throw new Error("No canvas parent!")}if(!E){E=F.clientWidth}if(!A){A=F.clientHeight}this.parent=F;this.width=E;this.height=A;this._bgColor="transparent";this._lineWidth=2;this._lineColor="#000";this._isDrawing=false;this._opacity=0.45;this._points=null;this._stack=[];this._stackSize=0;var C=document.createElement("canvas");C.setAttribute("id","DCCanvas"+(new Date()).getTime()+ ++arguments.callee._count);C.setAttribute("width",E);C.setAttribute("height",A);var B=document.createElement("div");B.setAttribute("style","width: "+E+"px; height: "+A+"px; ");B.appendChild(C);F.appendChild(B);var D=C.getContext("2d");D.lineCap="round";D.lineJoin="round";this.container=B;this._context=D;this._canvas=C}DrawingCanvasCanvas._count=0;DrawingCanvasCanvas.prototype={setBgColor:function(A){this._bgColor=A;this._refresh()},setSize:function(B,A){this.container.style.width=B+"px";this.container.style.height=A+"px";this._canvas.setAttribute("width",B);this._canvas.setAttribute("height",A);this.width=B;this.height=A},updatePosition:function(){},panByOffset:function(A,B){},setLineColor:function(A){this._lineColor=A},setLineWidth:function(A){this._lineWidth=Number(A)||0},setOpacity:function(A){this._opacity=A},startLine:function(A,B){if(this._isDrawing){this.endLine()}this._isDrawing=true;this._context.strokeStyle=this._lineColor;this._context.fillStyle=this._lineColor;this._context.lineWidth=this._lineWidth;this._context.arc(A,B,(this._lineWidth/2),0,(2*Math.PI),true);this._context.fill();this._points=[A,B];this._currentX=A;this._currentY=B;this._currentLineColor=this._lineColor;this._currentLineWidth=this._lineWidth},endLine:function(){if(!this._isDrawing){return }this._isDrawing=false;this._pushStack(this._points,this._currentLineColor,this._currentLineWidth);this._points=null},lineTo:function(A,B){if(!this._isDrawing){return }this._context.moveTo(this._currentX,this._currentY);this._context.lineTo(A,B);this._context.stroke();this._points.push(A,B);this._currentX=A;this._currentY=B},undo:function(){if(this._isDrawing){this.endLine()}if(this._stackSize<=0){return false}--this._stackSize;this._refresh();return true},redo:function(){if(this._isDrawing){this.endLine()}if(this._stackSize>=this._stack.length){return false}++this._stackSize;this._refresh();return true},clearShape:function(){if(this._isDrawing){this.endLine()}if(this._stack.length>1){this._stack[this._stack.length-1]=undefined;this._refresh()}},clear:function(){if(this._isDrawing){this.endLine()}this._stack.length=0;this._stackSize=0;this._refresh()},getX:function(){var B=this.container;var A=B.offsetLeft;while((B=B.offsetParent)){A+=B.offsetLeft}return A},getY:function(){var A=this.container;var B=A.offsetTop;while((A=A.offsetParent)){B+=A.offsetTop}return B},_pushStack:function(B,C,A){if(this._stackSize+1<this._stack.length){this._stack.length=this._stackSize+1}this._stack[this._stackSize++]={type:((B.length==2)?"dot":"polyline"),points:B,lineColor:C,lineWidth:A}},_refresh:function(){if(this._bgColor=="transparent"){this._context.clearRect(0,0,this.width,this.height)}else{this._context.fillStyle=this._bgColor;this._context.fillRect(0,0,this.width,this.height)}for(var C=0;C<this._stackSize;C++){var A=this._stack[C];if(A.type=="dot"){this._context.fillStyle=A.lineColor;this._context.arc(A.points[0],A.points[1],A.lineWidth/2,0,this._MATH_2PI,true);this._context.fill()}else{this._context.strokeStyle=A.lineColor;this._context.lineWidth=A.lineWidth;this._context.moveTo(A.points[0],A.points[1]);for(var B=2,D=A.points.length;B<D;B+=2){this._context.lineTo(A.points[B],A.points[B+1])}this._context.stroke()}}}};function DrawingCanvasCSSP(D,C,A){if(!D){throw new Error("No canvas parent!")}if(!C){C=D.clientWidth}if(!A){A=D.clientHeight}this.parent=D;this.width=C;this.height=A;this._bgColor="transparent";this._lineWidth=2;this._lineColor="#000";this._isDrawing=false;this._currentLayer=null;this._stack=[];this._stackSize=0;this._opacity=0.45;this._dotStyle="";this._currentLineWidth=0;this._dotOffset=0;this._dotX=0;this._dotY=0;var B=document.createElement("div");var E="background-color: "+this._bgColor+"; position: relative; width: "+C+"px; height: "+A+"px; overflow: hidden; ";if(this._useCssText){B.style.cssText=E}else{B.setAttribute("style",E)}D.appendChild(B);this.container=B}DrawingCanvasCSSP.prototype={_useCssText:document.documentElement.getAttribute("style")==document.documentElement.style,setSize:function(B,A){this.container.style.width=B+"px";this.container.style.height=A+"px";this.width=B;this.height=A},updatePosition:function(){},panByOffset:function(A,B){},setBgColor:function(A){this.container.style.backgroundColor=this._bgColor=A},setLineColor:function(A){this._lineColor=A},setLineWidth:function(A){this._lineWidth=Number(A)||0},startLine:function(A,F){if(this._isDrawing){this.endLine()}this._isDrawing=true;A=Math.round(A);F=Math.round(F);var E=this._lineWidth;this._dotStyle="background-color: "+this._lineColor+"; position: absolute; overflow: hidden; ";this._dotOffset=Math.floor(E/2);this._dotX=A-this._dotOffset;this._dotY=F-this._dotOffset;var C=document.createElement("div");var B=document.createElement("div");var D=this._dotStyle+"width: "+E+"px; height: "+E+"px; left: "+this._dotX+"px; top: "+this._dotY+"px; ";if(this._useCssText){B.style.cssText=D}else{B.setAttribute("style",D)}C.appendChild(B);this.container.appendChild(C);this._currentLineWidth=E;this._currentLayer=C},endLine:function(){if(!this._isDrawing){return }this._isDrawing=false;this._pushStack(this._currentLayer);this._currentLineWidth=0;this._currentLayer=null},lineTo:function(J,H){if(!this._isDrawing){return }J=Math.round(J);H=Math.round(H);var S=this._dotX;var Q=this._dotY;var D=J-this._dotOffset;var B=H-this._dotOffset;var X=(S<D)?1:-1;var W=(Q<B)?1:-1;var L=(X==1)?D-S:S-D;var K=(W==1)?B-Q:Q-B;var R,I,G;if(L==0&&K==0){return }var C=document.createDocumentFragment();var M=this._dotStyle;var E=this._useCssText;var A=this._currentLineWidth;var T=A;if(L>=K){var F,P,O;var V=(X==1);R=-L;I=K<<1;G=L<<1;for(var U=0;U<L;++U){R+=I;if(R>=0){F=V?S-T+A:S;P=document.createElement("div");O=M+"width: "+T+"px; height: "+A+"px; left: "+F+"px; top: "+Q+"px; ";if(E){P.style.cssText=O}else{P.setAttribute("style",O)}C.appendChild(P);Q+=W;R-=G;T=A}else{++T}S+=X}F=V?D-T+A:D;P=document.createElement("div");O=M+"width: "+T+"px; height: "+A+"px; left: "+F+"px; top: "+B+"px; ";if(E){P.style.cssText=O}else{P.setAttribute("style",O)}C.appendChild(P)}else{var N,P,O;var V=(W==1);R=-K;I=L<<1;G=K<<1;for(var U=0;U<K;++U){R+=I;if(R>=0){N=V?Q-T+A:Q;P=document.createElement("div");O=M+"width: "+A+"px; height: "+T+"px; left: "+S+"px; top: "+N+"px; ";if(E){P.style.cssText=O}else{P.setAttribute("style",O)}C.appendChild(P);S+=X;R-=G;T=A}else{++T}Q+=W}N=V?B-T+A:B;P=document.createElement("div");O=M+"width: "+A+"px; height: "+T+"px; left: "+D+"px; top: "+N+"px; ";if(E){P.style.cssText=O}else{P.setAttribute("style",O)}C.appendChild(P)}this._currentLayer.appendChild(C);this._dotX=D;this._dotY=B},undo:function(){if(this._isDrawing){this.endLine()}if(this._stackSize<=0){return false}this.container.removeChild(this._stack[--this._stackSize]);return true},redo:function(){if(this._isDrawing){this.endLine()}if(this._stackSize>=this._stack.length){return false}this.container.appendChild(this._stack[this._stackSize++]);return true},clearShape:function(){if(this._isDrawing){this.endLine()}if(this._stack.length>1){this.container.removeChild(this._stack[this._stack.length-1]);this._stack.length=this._stack.length-1;this._stackSize=this._stackSize-1}},clear:function(){if(this._isDrawing){this.endLine()}for(var A=this._stackSize;A--;){this.container.removeChild(this._stack[A])}this._stack.length=0;this._stackSize=0},_htmlIsRoot:(typeof document.compatMode=="string")&&(document.compatMode=="CSS1Compat"),getX:function(){var B=this.container;var A=B.offsetLeft;while((B=B.offsetParent)){A+=B.offsetLeft}if(this._useCssText){A+=(this._htmlIsRoot?document.documentElement:document.body).clientLeft}return A},getY:function(){var A=this.container;var B=A.offsetTop;while((A=A.offsetParent)){B+=A.offsetTop}if(this._useCssText){B+=(this._htmlIsRoot?document.documentElement:document.body).clientTop}return B},_pushStack:function(A){if(this._stackSize+1<this._stack.length){this._stack.length=this._stackSize+1}this._stack[this._stackSize++]=A}};function DrawingCanvasVML(D,C,A){if(!document.namespaces){throw new Error("Not supported!")}if(!document.namespaces.v){document.namespaces.add("v","urn:schemas-microsoft-com:vml");document.createStyleSheet().addRule("v\\:*","behavior: url(#default#VML);")}if(!D){throw new Error("No canvas parent!")}if(!C){C=D.clientWidth}if(!A){A=D.clientHeight}this.parent=D;this.width=C;this.height=A;this._bgColor="none";this._lineWidth=2;this._lineColor="#000";this._isDrawing=false;this._currentShape=null;this._dummyDot=null;this._points="";this._stack=[];this._stackSize=0;this._opacity=0.45;var B=document.createElement("div");B.style.cssText="position: relative; width: "+C+"px; height: "+A+"px; ";D.appendChild(B);this.container=B}DrawingCanvasVML.prototype={setBgColor:function(A){this.container.style.backgroundColor=this._bgColor=A},setSize:function(B,A){this.container.style.width=B+"px";this.container.style.height=A+"px";this.width=B;this.height=A},updatePosition:function(){this.container.style.top=-parseInt(this.parent.style.top)+"px";this.container.style.left=-parseInt(this.parent.style.left)+"px"},panByOffset:function(A,B){},setLineColor:function(A){this._lineColor=A},setOpacity:function(A){this._opacity=A},setLineWidth:function(A){this._lineWidth=Number(A)||0},createGeofence:function(A,D,C,B){this.createCircle(A,D,C);this.createArrow(A,D,C);this.createText(A,D,C,B)},createCircle:function(A,E,D){D=Math.round(D);var C=document.createElement("v:oval");C.strokeweight=2;var B=D*2;C.style.cssText="position: absolute; width: "+B+"px; height: "+B+"px; left: "+(A-D)+"px; top: "+(E-D)+"px; ";C.innerHTML="<v:fill on='false' />";this.container.appendChild(C);this._currentShape=C;this._pushStack(this._currentShape)},createArrow:function(B,D,C){var A=document.createElement("v:polyline");A.filled=false;A.strokecolor="black";A.strokeweight=2;A.points=(B+C-5)+","+(D-5)+" "+(B+C)+","+D+" "+B+","+D+" "+(B+C)+","+D+" "+(B+C-5)+","+(D+5);this.container.appendChild(A);this._currentShape=A;this._pushStack(this._currentShape)},createText:function(A,E,C,B){var D=document.createElement("v:line");D.from=A+" "+(E-10);D.to=(A+C)+" "+(E-11);D.innerHTML="<v:fill on='True' color='red'/><v:path textpathok='True'/><v:textpath on='True' string='"+(B/1000)+" km' style='font:normal normal normal 12pt Arial'/>";this.container.appendChild(D);this._currentShape=D;this._pushStack(this._currentShape)},startLine:function(A,F){if(this._isDrawing){this.endLine()}this._isDrawing=true;var C=document.createElement("v:oval");var D=this._lineWidth;C.fillcolor=this._lineColor;C.strokecolor=this._lineColor;C.style.cssText="position: absolute; width: "+D+"px; height: "+D+"px; left: "+(A-D/2)+"px; top: "+(F-D/2)+"px; ";this.container.appendChild(C);this._dummyDot=C;this._points=A+","+F;var B=document.createElement("v:polyline");B.filled=false;B.strokecolor=this._lineColor;B.strokeweight=this._lineWidth;B.points=this._points;var E=document.createElement("v:stroke");E.endcap="round";E.opacity=this._opacity;B.appendChild(E);this.container.appendChild(B);this._currentShape=B},endLine:function(){if(!this._isDrawing){return }if(this._dummyDot){this.container.removeChild(this._currentShape);this._pushStack(this._dummyDot);this._dummyDot=null}else{this._pushStack(this._currentShape)}this._isDrawing=false;this._currentShape=null;this._points=""},lineTo:function(A,B){if(!this._isDrawing){return }if(this._dummyDot){this.container.removeChild(this._dummyDot);this._dummyDot=null}this._points+=" "+A+","+B;this._currentShape.points.value=this._points},undo:function(){if(this._isDrawing){this.endLine()}if(this._stackSize<=0){return false}this._stack[--this._stackSize].style.visibility="hidden";return true},redo:function(){if(this._isDrawing){this.endLine()}if(this._stackSize>=this._stack.length){return false}this._stack[this._stackSize++].style.visibility="visible";return true},clearShape:function(){if(this._isDrawing){this.endLine()}if(this._stack.length>1){this.container.removeChild(this._stack[this._stack.length-1]);this._stack.length=this._stack.length-1;this._stackSize=this._stackSize-1}},clear:function(){if(this._isDrawing){this.endLine()}for(var A=this._stack.length;A--;){if(this._stack[A]!=undefined){this.container.removeChild(this._stack[A])}}this._stack.length=0;this._stackSize=0},_htmlIsRoot:(typeof document.compatMode=="string")&&(document.compatMode=="CSS1Compat"),getX:function(){var B=this.container;var A=B.offsetLeft;while((B=B.offsetParent)){A+=B.offsetLeft}A+=(this._htmlIsRoot?document.documentElement:document.body).clientLeft;return A},getY:function(){var A=this.container;var B=A.offsetTop;while((A=A.offsetParent)){B+=A.offsetTop}B+=(this._htmlIsRoot?document.documentElement:document.body).clientTop;return B},_pushStack:function(A){var C=this._stack.length;if(this._stackSize<C){for(var B=this._stackSize;B<C;B++){this.container.removeChild(this._stack[B])}this._stack.length=this._stackSize+1}this._stack[this._stackSize++]=A}};function DrawingCanvas(){var C="CSSP";if(document.namespaces&&document.namespaces.add){C="VML"}try{if(document.createElement("canvas").getContext){C="Canvas"}}catch(D){}if(document.createElementNS){var E="http://www.w3.org/TR/SVG11/feature#";if(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(E+"SVG","1.1")||document.implementation.hasFeature(E+"BasicStructure","1.1"))){C="SVGT"}if(window.opera){var B=navigator.userAgent;var A=B.indexOf("Opera");if(A>=0&&parseInt(B.substring(A+6))>=8){C="SVGT"}}}switch(C){case"SVGT":DrawingCanvas=DrawingCanvasSVGT;break;case"Canvas":DrawingCanvas=DrawingCanvasCanvas;break;case"CSSP":DrawingCanvas=DrawingCanvasCSSP;break;case"VML":DrawingCanvas=DrawingCanvasVML;break}DrawingCanvas.backend=C;DrawingCanvas.prototype.constructor=DrawingCanvas}function BuildingImageController(){this.icons=new Array();this.mapClient=null;this.zIndex=9;this.init=function(A){this.mapClient=A};this.addImage=function(F,A,G,B,C,E){var D=new BuildingImage(F,A,G,this.zIndex,this.mapClient,B,C,E);this.icons.push(D);return D};this.removeIcon=function(A){if(A){if(A.appended){this.mapClient.mapContainer.removeChild(A.obj);A.appended=false;return true}}return false};this.hideAllIcon=function(){var B=this.icons.length;for(var A=0;A<B;A++){if(this.icons[A].obj){this.removeIcon(this.icons[A])}}this.icons=new Array()};this.appendIcon=function(A){if(A){if(!A.appended){this.mapClient.mapContainer.appendChild(A.obj);A.appended=true;return true}}return false};this.updatePosition=function(){for(var A=0,B=this.icons.length;A<B;A++){if(!this.icons[A].special&&this.icons[A].active==true){if(this.icons[A].updatePosition(this.mapClient)){this.appendIcon(this.icons[A])}else{if(A>1){this.removeIcon(this.icons[A])}}}}};this.panByOffset=function(A,D){for(var B=0,C=this.icons.length;B<C;B++){if(this.icons[B].obj.style.display!="none"){this.icons[B].offsetPosition(A,D)}}}}function BuildingImage(B,G,D,E,J,H,C,F){this.image_id=B;this.x=G;this.y=D;this.active=true;this.appended=false;this.mapClient=J;this.defaultZIndex=E;this.obj=document.createElement("div");this.obj.id="bldg_img"+B;this.obj.style.left=G+"px";this.obj.style.top=D+"px";this.obj.style.zIndex=E;this.obj.style.position="absolute";this.obj.style.border="1px solid #777777";this.obj.style.backgroundColor="#ffffff";if(global_curr_level<5){this.obj.style.padding="1px"}else{this.obj.style.padding="2px"}var A=document.createElement("img");A.src="http://"+location.hostname+"/stock_images/travel/show_map_image.php?imageId="+B+"&level="+global_curr_level;A.width=H;A.height=C;A.title=F;this.obj.appendChild(A);this.obj.style.width=H+"px";this.obj.style.height=C+"px";this.obj.style.cursor="pointer";this.setUrl=function(K){this.obj.src=K};this.hideIcon=function(){this.obj.style.display="none"};this.unHideIcon=function(){this.obj.style.display="block"};this.setZIndex=function(K){this.obj.style.zIndex=K};this.updatePosition=function(K){var L=K.vertexToScreen(this.x,this.y);if((K.mapWidth>L.x&&L.x>-10)&&(K.mapHeight>L.y&&L.y>-10)&&!isNaN(L.x)&&!isNaN(L.y)){this.obj.style.left=(-parseInt(K.mapContainer.style.left)+L.x-parseInt(this.obj.style.width)/2)+"px";this.obj.style.top=(-parseInt(K.mapContainer.style.top)+L.y-parseInt(this.obj.style.height)/2)+"px";return true}else{this.hideIcon()}return false};this.offsetPosition=function(N,L){var M=parseInt(this.obj.style.left);var K=parseInt(this.obj.style.top);if(!isNaN(M)&&!isNaN(K)){this.obj.style.left=(M+N)+"px";this.obj.style.top=(K+L)+"px"}};var I=this;this.obj.onmouseover=function(){I.obj.style.zIndex=I.defaultZIndex+1};this.obj.onmouseout=function(){I.obj.style.zIndex=I.defaultZIndex}};