function sundo_map(){
  var is_ie;
  var ba=navigator.userAgent.toLowerCase();
  if(ba.indexOf("msie")!=-1&&document.all){
    is_ie=true;
  }
  else{
    is_ie=false;
  }
  function oure(r1){
  	return (typeof(r1) != "undefined");
  }
//ºê¶ó¿ìÀú ¼±ÅÃ
  function A(a){
    if(is_ie){
      window.event.cancelBubble=true;
      window.event.returnValue=false
    }
    else{
      if(a){
        a.cancelBubble=true;
        a.preventDefault();
        a.stopPropagation();
      }
    }
  };
  function ud(a){
	a.length=0
  }
  
  function ua(a){
	if(a&&a.parentNode){
		a.parentNode.removeChild(a);
		$b(a)
	}
  };

 function $b(a){
	Y.detachNodeEvents(a);
	var b=a.childNodes;
	for(var c=0;c<b.length;++c){
		arguments.callee(b[c])
	}
 }
  function return_false(){
    return false;
  };

  function return_true(){
    return true;
  };
//ºê¶ó¿ìÀú ¼±ÅÃ ¿©±â±îÁö
//Æ÷ÀÎÆ® °´Ã¼
  function P(x,y){
    var x;
    var y;
    this.x=x;
    this.y=y;
  };

  P.prototype.set=function(x,y){
    this.x=x;
    this.y=y;
    return this;
  };

  P.prototype.add=function(x,y){
    this.x=this.x+x;
    this.y=this.y+y;
    return this;
  };

  P.prototype.to_str=function(){
    return this.x+","+this.y;
  };

  P.prototype.distance=function(point){
    return Math.sqrt((this.x-point.x)*(this.x-point.x)+(this.y-point.y)*(this.y-point.y));
  };

  P.prototype.copy=function(){
    return new P(this.x,this.y);
  };

  P.prototype.equal=function(target){
    return((this.x==target.x)&&(this.y==target.y));
  };
//Æ÷ÀÎÆ® ¿©±â±îÁö

//ÀÌº¥Æ®
  function event_helper(){};
  event_helper.attach_event=function(obj,event_name,event_func){
    if(obj.addEventListener){
      obj.addEventListener(event_name,event_func,false);
    }
    else if(obj.attachEvent){
      obj.attachEvent("on"+event_name,event_func);
    }
  };
  
  event_helper.attach_dom=function(event_src,event_name,obj,dom){
    event_helper.attach_event(event_src,event_name,event_helper.create_adapter(obj,dom));
  };

  event_helper.dettach_event=function(obj,event_name,event_func){
    if(obj.removeEventListener){
      obj.removeEventListener(event_name,event_func,false);
    }
    else if(obj.detachEvent){
      obj.detachEvent("on"+event_name,event_func);
    }
  };

  event_helper.createCallback =function (obj,event_func){
    var e = function(){event_func.apply(obj,arguments)};
    return e;
  };

  event_helper.add_listener=function(obj,event_name,event_func){
    var sys_event_name=event_helper.get_property_name(event_name);
    if(obj[sys_event_name]){
      obj[sys_event_name].push(event_func);
    }
    else{
      obj[sys_event_name]=new Array(event_func);
    }
  };

  event_helper.bind=function(obj,event_name,target_obj,event_func){
    var helper_func=function(){event_func.apply(target_obj,arguments)};
    event_helper.add_listener(obj,event_name,helper_func);
    return helper_func;
  };

  event_helper.remove_listener=function(obj,event_name,event_func){
    var sys_event_name=event_helper.get_property_name(event_name);
    var event_funclist=obj[sys_event_name];

    for(var i=0;i<event_funclist.length;i++){
      if(event_funclist[i]==event_func){
        event_funclist.splice(i,1);
      }
    }
  };

  event_helper.trigger=function(obj,event_name){
    var sys_event_name=event_helper.get_property_name(event_name);
    var event_funclist=obj[sys_event_name];
    if(event_funclist&&event_funclist.length>0){
      var e=new Array();
      for(var i=2;i<arguments.length;i++){
        e.push(arguments[i]);
      };
      e.push(obj);
      for(var i=0;i<event_funclist.length;i++){
        var func=event_funclist[i];
        if(func){
          try{
            func.apply(obj,e)
          }
          catch(g){
          }
        }
      }
    }
  };

  event_helper.get_property_name=function(name){
    return "_event_"+name;
  };

  event_helper.create_adapter=function(a,b){
    return function(c){
      if(!c){
        c=window.event
      };

      if(c&&!c.target){
        c.target=c.srcElement
      };

      b.call(a,c);
    }
  };

  event_helper.event_offset =function (event,r1){
	var s2= new P(0,0);
	if(oure(event.offsetX)){
		var c = event.target||event.srcElement;
		while(c&&c!=r1){
			s2.add(c.offsetLeft,c.offsetTop);
			c = c.offsetParent;
		}
		s2.add(event.offsetX,event.offsetY);
	}else if(oure(event.pageX)){
		s2.set(event.pageX,event.pageY);
		while(r1){
			s2.add(-r1.offsetLeft,-r1.offsetTop);
			r1 = r1.offsetParent;
		}
	}
	return s2;
  };  
//ÀÌº¥Æ® ¿©±â±îÁö
//ÆÐ´× ÀÌº¥Æ®
  function pan_helper(amount){
    this.ticks=amount;
    this.tick=0;
  };

  pan_helper.prototype.reset=function(){
    this.tick=0;
  };

  pan_helper.prototype.next=function(){
    this.tick++;
    var a=Math.PI*(this.tick/this.ticks-0.5);
    return(Math.sin(a)+1)/2;
  };

  pan_helper.prototype.more=function(){
    return this.tick<this.ticks
  };
//ÆÐ´× ÀÌº¥Æ® ¿©±â±îÁö
//µå·¡±× °´Ã¼
  function drag_object(src){
    this.src=src;
    this.set_cursor(this.src,"default");
    this.drag_offset=new P(0,0);
    this.view_size=new P(this.src.offsetWidth , this.src.offsetHeight);
    this.event_src=this.src.setCapture?this.src:window;
    this.onmousemove=event_helper.create_adapter(this,this.drag);
    this.onmouseup=event_helper.create_adapter(this,this.end_drag);
    if(!is_ie){
      event_helper.attach_dom(window,"mouseout",this,this.window_out);
    }
  };

  drag_object.prototype.set_cursor=function(obj,cursor_style){
    if(!obj){
      obj=this.src;
    };
    if(cursor_style){
      this.cursor=cursor_style;
    };

    //obj.style.cursor=this.cursor;
  };

  drag_object.prototype.start_drag=function(a){
    if(!a)
      a=window.event;
    this.drag_point=new P(a.clientX,a.clientY);
    this.set_cursor(this.src,"move");
    event_helper.attach_event(this.event_src,"mousemove",this.onmousemove);
    event_helper.attach_event(this.event_src,"mouseup",this.onmouseup);
    if(this.src.setCapture){
      this.src.setCapture();
    };

    A(a);
  };

  drag_object.prototype.end_drag=function(a){
    if(!a)
      a=window.event;
    this.set_cursor(this.src,"default");
    event_helper.dettach_event(this.event_src,"mousemove",this.onmousemove);
    event_helper.dettach_event(this.event_src,"mouseup",this.onmouseup);
    this.move(new P(this.drag_offset.x+(a.clientX-this.drag_point.x),this.drag_offset.y+(a.clientY-this.drag_point.y)));
    /*document.inputForm.objsrc.value = this.src;
    document.inputForm.drag_x.value = this.drag_offset.x+(a.clientX-this.drag_point.x);
    document.inputForm.drag_y.value = this.drag_offset.y+(a.clientY-this.drag_point.y);
    document.inputForm.action = "/mapkey/mapkey_write.asp";
    document.inputForm.submit();*/
    if(document.releaseCapture){
      document.releaseCapture()
    }
  };
  drag_object.prototype.drag=function(a){
    this.move(new P(this.drag_offset.x+(a.clientX-this.drag_point.x),this.drag_offset.y+(a.clientY-this.drag_point.y)));
    this.drag_point.set(a.clientX,a.clientY);
  };

  drag_object.prototype.window_out=function(a){
    if(!a)
      a=window.event;
    this.set_cursor(this.src,"default");
    event_helper.dettach_event(this.event_src,"mousemove",this.onmousemove);
    event_helper.dettach_event(this.event_src,"mouseup",this.onmouseup);
  };

  drag_object.prototype.move=function(point){
    this.drag_offset.set(point.x,point.y);
    this.src.style.left=point.x;
    this.src.style.top=point.y;
    event_helper.trigger(this,"drag");
  };
//µå·¡±× °´Ã¼ ¿©±â±îÁö
//¼±ÅÃµÈ ºÎºÐ
  function area_select(map){
    this.map=map;
    this.src=map.div;
    this.select_offset=new P(0,0);
    this.onmousemove=event_helper.create_adapter(this,this.select);
    this.onmouseup=event_helper.create_adapter(this,this.end_select);
    this.onmouseout=event_helper.create_adapter(this,this.end_select);
    this.event_src=this.src.setCapture?this.src:window;
    this.rect=new rectangle();
  };

  area_select.prototype.start_select=function(a){
    if(!a)
      a=window.event;
    A(a);
    this.map.add_overlay(this.rect);
    this.start_point=this.map.current_mouse_point(a);
    event_helper.attach_event(this.event_src,"mousemove",this.onmousemove);
    event_helper.attach_event(this.event_src,"mouseup",this.onmouseup);
  };

  area_select.prototype.select=function(a){
    if(!a)
      a=window.event;
    A(a);
    this.rect.set_point(this.start_point,this.map.current_mouse_point(a));
  };

  area_select.prototype.end_select=function(a){
    if(!a)
      a=window.event;
    A(a);
    this.end_point=this.map.current_mouse_point(a);
    event_helper.dettach_event(this.event_src,"mousemove",this.onmousemove);
    event_helper.dettach_event(this.event_src,"mouseup",this.onmouseup);
    //this.map.remove_overlay(this.rect);
    //this.rect.set_point(null,null);
    this.rect.color='#FF0000';
    xcoord = this.start_point.x + "," + this.end_point.x;
    ycoord = this.start_point.y + "," + this.end_point.y;
    event_helper.trigger(this.map,"area_select",this.start_point,this.end_point);
    //newWindow = NewWin('./poi_search.asp?xcoord='+xcoord+'&ycoord='+ycoord,'area',1,1);
    //show_progressbar();
    document.coordForm.xcoord.value=xcoord;
    document.coordForm.ycoord.value=ycoord;
    document.coordForm.target="poi_search_frame";
    document.coordForm.action="poi_search.asp";
    document.coordForm.submit();
	
  };
//¼±ÅÃµÈ ºÎºÐ ¿©±â±îÁö
//Áöµµ °´Ã¼
  function map(container,comm, lib){
    this.zoom_level=0;
    this.container=container;
    this.comm=comm;
    this.lib = lib;
    //this.map_mode=0 ;
    this.is_dragable=true;
    this.overlays=new Array();
    this.mark_pos_list=new Array();
    this.point=new P(0,0);
    this.pixel=new P(0,0);
    this.left_top=new P(0,0);
    this.map_index=new P(0,0);
    this.map_pan_offset=new P(0,0);
    this.is_loaded=false;
    this.min_zoom_level=1;
    this.max_zoom_level=11;
    this.container.style.overflow="hidden";
    if(this.container.style.position!="absolute"){
      this.container.style.position="relative";
    };
    this.view_size=new P(this.container.offsetWidth,this.container.offsetHeight);
    this.center=new P(0.5,0.5);
    this.table_size=new P(Math.ceil(this.view_size.x/this.comm.tile_size)+2,Math.ceil(this.view_size.y/this.comm.tile_size)+2);
    this.tile_padding=new P(Math.round((this.table_size.x*this.comm.tile_size-this.view_size.x)/2),Math.round((this.table_size.y*this.comm.tile_size-this.view_size.y)/2));
    this.static_div=this.create_pane(10);
    this.container.appendChild(this.static_div);
    this.staticLayer = this.create_pane(10);
    this.container.appendChild(this.staticLayer);
    this.div=this.create_pane(0);
    this.container.appendChild(this.div);
    this.map_layer=this.create_pane(10);
    this.div.appendChild(this.map_layer);
    this.path_layer=this.create_pane(15);
    this.div.appendChild(this.path_layer);
    this.mark_layer=this.create_pane(20);
    this.div.appendChild(this.mark_layer);
    this.info_layer=this.create_pane(30);
    this.div.appendChild(this.info_layer);
    this.overlay=this.create_pane(100);
    this.div.appendChild(this.overlay);
    this.drag_obj=new drag_object(this.div);
    this.select_obj=new area_select(this);
    this.wheelAdapter = event_helper.create_adapter(this,this.mousewheel);
    event_helper.bind(this.drag_obj,"drag",this,this.on_drag);
    event_helper.attach_dom(this.div,"mousedown",this,this.mousedown);
    event_helper.attach_dom(this.container,"click",this,this.click);
    event_helper.attach_dom(this.container,"mousemove",this,this.mousemove);
    event_helper.attach_dom(this.container,"dblclick",this,this.dblclick);
    event_helper.attach_dom(this.container,"contextmenu",this,this.contextmenu);
    this.info_win=new info_window();
    this.init();
  };

  map.prototype.enable_drag=function(){
    this.is_dragable=true;
  };

  map.prototype.disable_drag=function(){
    this.is_dragable=false;
  };

  map.prototype.get_shift_pos=function(obj){
    var xy_list=new Array();
    var distance_x;
    var distance_y;
    
    for(var i=0;i<this.mark_pos_list.length;i++){
      xy_list[i]=this.mark_pos_list[i].get_pos();
      for(var j=0;j<i;j++){
        distance_x=(xy_list[j].x-xy_list[i].x)*(xy_list[j].x-xy_list[i].x);
        distance_y=(xy_list[j].y-xy_list[i].y)*(xy_list[j].y-xy_list[i].y);
        if((distance_x < 9)&&(distance_y<9)){
          xy_list[i].add(5,5);
        }
      };
      if(obj==this.mark_pos_list[i]){
        return xy_list[i];
      }
    }
  };

  map.prototype.add_shift=function(obj){
    this.mark_pos_list.push(obj);
  };
  
  map.prototype.rec_add_shift=function(obj){
    this.overlays.push(obj);
  };
  	
  map.prototype.remove_shift=function(obj){
    for(var i=0;i<this.mark_pos_list.length;i++){
      if(this.mark_pos_list[i]==obj){
        this.mark_pos_list.splice(i,1);
        break;
      }
    }
  };

  map.prototype.create_pane=function(z_index){
    var b=document.createElement("div");
    b.style.position="absolute";
    b.style.top=0;
    b.style.left=0;
    b.style.zIndex=z_index;
    return b;
  };
  map.prototype.mousewheel =function(a){
	if(!a){
		a = window.event;
	}
	var delta = a.wheelDelta;
	if(delta>0){
		this.zoom_in();
	}else if(delta<0){
		this.zoom_out();
	}
	a.cancelBubble = true;
	return false;
  };

  map.prototype.mousedown=function(a){
    if(!a){
      a=window.event;
    };

    window.clearTimeout(this.pan_timeout);
    switch(this.map_mode){
      case 0:
        if(this.is_dragable){
          this.drag_obj.start_drag(a);
        };
        break;

      case 1:
        var mouse=this.get_event_pos(a);
        this.zoom_in();
        break;

      case 2:
        this.zoom_out();
        break;

      case 3:
        this.select_obj.start_select(a);
        break;
    }
  };

  map.prototype.mousemove=function(a){
    if(!a){
      a=window.event;
    };
    event_helper.trigger(this,"mousemove",this.current_mouse_point(a));
  };

  map.prototype.click=function(a){
    if(!a){
      a=window.event;
    };

    event_helper.trigger(this,"click",this.current_mouse_point(a));
  };
  
  map.prototype.dblclick=function(a){
	if(!a){
		a = window.event;
	};
	this.zoom_in();
  };
  
  map.prototype.contextmenu=function(a){
  	if(!a){
  		a = window.event;
  	}
  	this.zoom_out();
  };
  
  map.prototype.enableWheelZoom =function(){
	this.container.onmousewheel = return_false;
	event_helper.attach_event(this.container,"mousewheel",this.wheelAdapter)
  };
  
  map.prototype.disableWheelZoom =function(){
	this.container.onmousewheel='';
	event_helper.detach_event(this.container,"mousewheel",this.wheelAdapter)
  };
  map.prototype.set_mode=function(mode){
    this.map_mode=mode;
  };

  map.prototype.current_mouse_pixel=function(a){
    var diff=this.get_diff_from_center(a);
    var mouse_pixel=this.get_center_pixel();
    mouse_pixel.add(diff.x,diff.y);
    return mouse_pixel;
  };

  map.prototype.current_mouse_point=function(a){
    return this.comm.pixel2point(this.current_mouse_pixel(a),this.zoom_level);
  };

  map.prototype.modi_current_mouse_point=function(a){
    NewWin('../open_location_modi.asp?xcoord='+a.x+'&ycoord='+a.y+'&level='+this.zoom_level,'modi',552,730);
    event_helper.remove_listener(this,"click",this.modi_current_mouse_point);
  };
  
  map.prototype.start_current_mouse_point=function(a){
    event_helper.remove_listener(this,"click",this.start_current_mouse_point);
    area_mark(a.x,a.y,'start');
  };
  
  map.prototype.end_current_mouse_point=function(a){
    event_helper.remove_listener(this,"click",this.end_current_mouse_point);
    area_mark(a.x,a.y,'end');
  };
  
  map.prototype.get_diff_from_center=function(a){
    var b=this.get_event_pos(a,this.container);
    return new P(b.x-Math.floor(this.view_size.x/2),Math.floor(this.view_size.y/2)-b.y);
  };

  map.prototype.get_event_pos=function(a,b){
    if(typeof a.offsetX!="undefined"){
      var c=a.target||a.srcElement;
      var d=new P(0,0);
      while(c&&c!=b){
        d.x+=c.offsetLeft;
        d.y+=c.offsetTop;
        c=c.offsetParent;
      };
      return new P(a.offsetX+d.x,a.offsetY+d.y)
    }
    else if(typeof a.pageX!="undefined"){
      var e=new P(0,0);
      while(b){
        e.x+=b.offsetLeft;
        e.y+=b.offsetTop;
        b=b.offsetParent
      };
      return new P(a.pageX-e.x,a.pageY-e.y)
    }
    else{
      return new P();
    }
  };

  map.prototype.on_drag=function(){
    this.on_move();
    this.rotate_tiles();
    var tmp=this.get_center_pixel();
  };

  map.prototype.on_move=function(){
    this.pixel.set(this.map_index.x*this.comm.tile_size+this.tile_padding.x+this.center.x*this.view_size.x-this.drag_obj.drag_offset.x ,(this.map_index.y+1)*this.comm.tile_size-this.tile_padding.y-this.center.y*this.view_size.y+this.drag_obj.drag_offset.y);
    event_helper.trigger(this,"mapmove",this.get_center_point());
  };

  map.prototype.rotate_tiles=function(){
    var drag_offset=this.drag_obj.drag_offset;
    var current_offset=new P(this.map_pan_offset.x * this.comm.tile_size+drag_offset.x,-this.map_pan_offset.y * this.comm.tile_size+drag_offset.y);
    if(current_offset.x <-this.tile_padding.x/2){
      this.rotate_right(this.tile_images,false);
      if(this.comm.has_overlay()){
        this.rotate_right(this.overlay_images,true);
      }
    }
    else if(current_offset.x > this.tile_padding.x/2){
      this.rotate_left(this.tile_images,false);
      if(this.comm.has_overlay()){
        this.rotate_left(this.overlay_images,true);
      }
    };

    if(current_offset.y <-this.tile_padding.y/2){
      this.rotate_down(this.tile_images,false);
      if(this.comm.has_overlay()){
        this.rotate_down(this.overlay_images,true);
      }
    }
    else if(current_offset.y > this.tile_padding.y/2){
      this.rotate_up(this.tile_images,false);
      if(this.comm.has_overlay()){
        this.rotate_up(this.overlay_images,true);
      }
    }
  };

  map.prototype.rotate_right=function(tile_images,overlay_flag){
    if(!overlay_flag){
      this.map_pan_offset.x++;
    };

    var c=tile_images.shift();
    tile_images.push(c);
    var e=tile_images.length-1;
    for(var d=0;d<c.length;d++){
      this.set_image(c[d],e,d,overlay_flag);
    }
  };

  map.prototype.rotate_left=function(tile_images,overlay_flag){
    if(!overlay_flag){
      this.map_pan_offset.x--;
    };

    var c=tile_images.pop();
    if(c){
      tile_images.unshift(c);
      for(var d=0;d<c.length;d++){
        this.set_image(c[d],0,d,overlay_flag);
      }
    }
  };

  map.prototype.rotate_up=function(tile_images,overlay_flag){
    if(!overlay_flag){
      this.map_pan_offset.y++;
    };

    for(var c=0;c<tile_images.length;c++){
      var d=tile_images[c].pop();tile_images[c].unshift(d);
      this.set_image(d,c,0,overlay_flag);
    }
  };

  map.prototype.rotate_down=function(tile_images,overlay_flag){
    if(!overlay_flag){
      this.map_pan_offset.y--;
    };

    var b=tile_images[0].length-1;
    for(var c=0;c<tile_images.length;c++){
      var d=tile_images[c].shift();
      tile_images[c].push(d);
      this.set_image(d,c,b,overlay_flag);
    }
  };

  map.prototype.moveto=function(point){
    this.is_loaded=true;
    if(this.point.x !=point.x || this.point.y !=point.y){
      this.point.set(point.x,point.y);this.pixel=this.comm.point2pixel(this.point,this.zoom_level);this.redraw();
    }
  };

  map.prototype.pan=function(x,y){
    if(this.is_dragable){
      this.pan_amount=new P(-x,y);
      this.pan_start=this.drag_obj.drag_offset.copy();
      this.pan_obj=new pan_helper(Math.max(20,Math.floor(Math.sqrt(x*x+y*y)/20)));
      this.dopan();
    }
  };

  map.prototype.dopan=function(){
    if(this.is_dragable){
      var factor=this.pan_obj.next();
      this.drag_obj.move(new P(this.pan_start.x+this.pan_amount.x * factor , this.pan_start.y+this.pan_amount.y * factor));
      this.on_drag();
      if(this.pan_obj.more()){
        this.pan_timeout=oa(this,function(){this.dopan()},10);
      }
    }
  };

  function oa(a,b,c){
    var d=window.setTimeout(function(){b.apply(a)},c);
    return d;
  };

  map.prototype.get_center_pixel=function(center_pixel){
    if(!center_pixel){
      center_pixel=new P(0,0);
    };
    center_pixel.set(this.pixel.x,this.pixel.y);
    return center_pixel;
  };

  map.prototype.get_center_point=function(center_point){
    var tmp;
    if(!center_point){
      center_point=new P(0,0);
    };

    tmp=this.comm.pixel2point(this.get_center_pixel(),this.zoom_level);
    center_point.set(tmp.x,tmp.y);
    
    var current_pathname = document.location.pathname;
    if(current_pathname.indexOf("mapkey") < 0){
    	map_move(center_point.x,center_point.y,'');
    }
    
    return center_point;
  };

  map.prototype.calculate_point=function(){
    this.left_top=new P(this.pixel.x-this.center.x * this.view_size.x-this.tile_padding.x , this.pixel.y+this.center.y * this.view_size.y+this.tile_padding.y);
    this.map_index=new P(Math.floor(this.left_top.x/this.comm.tile_size),Math.floor(this.left_top.y/this.comm.tile_size));
    this.move_offset=new P(this.map_index.x * this.comm.tile_size-this.left_top.x , this.left_top.y-(this.map_index.y+1)* this.comm.tile_size);
    if(this.move_offset.x <-this.tile_padding.x/2){
      this.map_index.x++;
      this.move_offset.x+=this.comm.tile_size;
    }
    else if(this.move_offset.x > this.tile_padding.x/2){
      this.map_index.x--;this.move_offset.x-=this.comm.tile_size;
    };

    if(this.move_offset.y <-this.tile_padding.y/2){
      this.map_index.y--;
      this.move_offset.y+=this.comm.tile_size;
    }

    else if(this.move_offset.y > this.tile_padding.y/2){
      this.map_index.y++;
      this.move_offset.y-=this.comm.tile_size;
    };
    this.drag_obj.move(this.move_offset);
  };

  map.prototype.redraw=function(){
    if(!this.is_loaded){
      return;
    };

    this.calculate_point();
    this.reset_all_images();
    this.info_win.redraw();
    event_helper.trigger(this,"redraw");
  };

  map.prototype.set_center_and_zoom=function(point,level){
    var is_redraw=false;
    this.is_loaded=true;
    if(this.point.x !=point.x || this.point.y !=point.y){
      this.point.set(point.x,point.y);
      this.pixel=this.comm.point2pixel(this.point,level);
      is_redraw=true
    };

    if(this.zoom_level !=level){
      this.zoom_level=level;
      is_redraw=true;
      event_helper.trigger(this,"zoom",this.zoom_level);
    }
    if(is_redraw)this.redraw()
  };

  map.prototype.set_area=function(left,top,right,down){
    var width=Math.abs(left-right);
    var height=Math.abs(top-down);
    var distance_per_pixel;
    var level;
    if((width/height)>(this.view_size.x/this.view_size.y)){
      distance_per_pixel=width/this.view_size.x;
    }
    else{
      distance_per_pixel=height/this.view_size.y;
    };

    for(var i=this.comm.min_level;i<=this.comm.max_level;i++){
      if(this.comm.distance_per_pixel(i)>distance_per_pixel){
        level=i;
        break;
      }
    };
    this.set_center_and_zoom(new P(Math.round((left+right)/2),Math.round((top+down)/2)),level);

  };

  map.prototype.get_bound=function(){
    var center_point=this.get_center_point();
    var distance_per_pixel=this.comm.distance_per_pixel(this.zoom_level);
    var x_dist=Math.round(this.view_size.x * distance_per_pixel/2);
    var y_dist=Math.round(this.view_size.y * distance_per_pixel/2);
    return Array(center_point.x-x_dist,center_point.y-y_dist,center_point.x+x_dist,center_point.y+y_dist);
  };

  map.prototype.set_center=function(point){
    if(this.point.x !=point.x || this.point.y !=point.y){
      this.point.set(point.x,point.y);
      this.pixel=this.comm.point2pixel(this.point,this.zoom_level);
    }
  };

  map.prototype.set_level=function(level){
    if(this.zoom_level !=level){
      var current_point=this.get_center_point();
      var tmp=this.get_center_pixel();
      this.zoom_level=level;
      this.pixel=this.comm.point2pixel(current_point,this.zoom_level);
      this.redraw();
      event_helper.trigger(this,"zoom",this.zoom_level);
    }
  };

  map.prototype.get_level=function(){
    return this.zoom_level;
  };

  map.prototype.set_min_level=function(level){
    this.min_zoom_level=level;
  };

  map.prototype.set_max_level=function(level){
    this.max_zoom_level=level;
  };

  map.prototype.zoom_in=function(){
    if(this.zoom_level > this.min_zoom_level){
      this.set_level(this.zoom_level-1);
    }
  };

  map.prototype.zoom_out=function(){
    if(this.zoom_level <this.max_zoom_level){
      this.set_level(this.zoom_level+1);
    }
  };

  map.prototype.load_layer=function(layer_array,overlay_flag){
    for(var i=0;i<this.table_size.x;i++){
      layer_array.push([]);
      for(var j=0;j<this.table_size.y;j++){
        if(!overlay_flag){
          layer_array[i][j]=tile.create(null,this.comm.tile_size,this.comm.tile_size,null,null,1,this.container.ownerDocument);
        }
        else{
          layer_array[i][j]=overlay.create(null,this.comm.tile_size,this.comm.tile_size,null,null,2,this.container.ownerDocument);
        };

        this.map_layer.appendChild(layer_array[i][j]);
        this.set_image(layer_array[i][j],i,j,false);
      }
    }
  };
  
  map.prototype.init=function(){
    this.tile_images=new Array();
    this.overlay_images=new Array();
    this.load_tile_images();
    this.info_win.init(this);
  };

  map.prototype.show_info_win=function(){
    this.info_win.show_window();
  };

  map.prototype.hide_info_win=function(){
    this.info_win.delay_hide_window();
  };

  map.prototype.set_info=function(point,content){
    this.info_win.set(point,content);
    this.show_info_win();
  };

  map.prototype.load_tile_images=function(){
    this.load_layer(this.tile_images,false);
    if(this.comm.has_overlay()){
      this.load_layer(this.overlay_images,true);
    }
  };

  map.prototype.sort_tile_from_center=function(a){
    var b=new Array();
    for(var c=0;c<a.length;c++){
      for(var d=0;d<a[c].length;d++){
        var e=a[c][d];
        e.coord_x=c;
        e.coord_y=d;
        var f=Math.min(c,a.length-c-1);
        var i=Math.min(d,a[c].length-d-1);
        if(f==0||i==0){
          e.priority=0
        }
        else{
          e.priority=f+i
        };
        b.push(e);
      }
    };

    b.sort(function(g,h){return h.priority-g.priority});
    return b;
  };

  map.prototype.set_image=function(tile,x_coord,y_coord,overlay_flag){
    tile.src=this.comm.empty_tile_url;
    if(this.is_loaded){
//      tile.aa();
      if(!overlay_flag){
//      alert(this.comm.get_tile_url(this.map_index.x+x_coord+this.map_pan_offset.x,this.map_index.y-y_coord+this.map_pan_offset.y,this.zoom_level));
        tile.src=this.comm.get_tile_url(this.map_index.x+x_coord+this.map_pan_offset.x,this.map_index.y-y_coord+this.map_pan_offset.y,this.zoom_level);
//      this.map_index.y-y_coord+this.map_pan_offset.y,this.zoom_level);
//        tile.src="http://218.234.32.209:8080/ImageServlet?x=360000&y=560000&lv=3";
      }
      else{
        tile.src=this.comm.get_overlay_url(this.map_index.x+x_coord+this.map_pan_offset.x,this.map_index.y-y_coord+this.map_pan_offset.y,this.zoom_level);
      }
    };
    tile.left=(x_coord+this.map_pan_offset.x)*this.comm.tile_size-this.tile_padding.x;
    tile.top=(y_coord-this.map_pan_offset.y)*this.comm.tile_size-this.tile_padding.y;
    tile.style.left=tile.left;
    tile.style.top=tile.top;
    tile.style.position="absolute";
  };

  map.prototype.reset_all_images=function(){
    if(this.tile_images.length==0){
      return;
    };
    var a=this.sort_tile_from_center(this.tile_images);
    for(var i=0;i<a.length;i++){
      this.set_image(a[i],a[i].coord_x,a[i].coord_y,false);
    };
    if(this.comm.has_overlay()){
      var b=this.sort_tile_from_center(this.overlay_images);
      for(var i=0;i<b.length;i++){
        this.set_image(b[i],b[i].coord_x,b[i].coord_y,true);
      }
    }
  };

  map.prototype.get_div_coord=function(pixel,coord){
    if(!coord)coord=new P(0,0);
    coord.set(pixel.x-this.map_index.x*this.comm.tile_size-this.tile_padding.x ,(this.map_index.y+1)*this.comm.tile_size-this.tile_padding.y-pixel.y);
    return coord;
  };

  map.prototype.add_overlay=function(obj){
    this.overlays.push(obj);
    obj.init(this);
    obj.redraw(this);
  };
  
  map.prototype.clearOverlays=function(){
	for(var a=0;a<this.overlays.length;a++){
		this.overlays[a].remove()
	}
	ud(this.overlays);
	event_helper.trigger(this,"clearoverlays")
  };
  map.prototype.clear_Overlays =function (obj){
	var cls = new Array();
	var cnt = 0;
	for (var i = 0;this.overlays && i<this.overlays.length;i++){
		if (!(obj && obj!=this.overlays[i][1])){
			this.overlays[i][0].unload();
			this.overlays[i] = null;
		}else{
			cls[cnt] = this.overlays[i];
			this.overlays[i] = null;
			cnt++;
		}
	}
	this.overlays = cls;
  };
		
  map.prototype.remove_overlay=function(obj){
    for(i=0;i<this.overlays.length;i++){
      if(this.overlays[i]==obj){
        for(j=i;j<this.overlays.length-1;j++){
          this.overlays[j]=this.overlays[j+1];
        };
        i=this.overlays.length;
        this.overlays.pop();
      }
    };
    obj.unload(this);
  };
//Áöµµ °´Ã¼ ¿©±â±îÁö
//ÀÌ¹ÌÁö °´Ã¼
  function image(){
  };

  image.create=function(img_url,width,height,left_margin,top_margin,z_index,ownerDocument){
    ownerDocument=ownerDocument||document;
    var n;
    n=ownerDocument.createElement("img");
    n.style.position="absolute";
    n.oncontextmenu=return_false;
    n.onselectstart=return_false;
    n.unselectable="on";
    n.galleryImg="no";
    
    n.style.MozUserSelect="none";
    if(z_index==null){
      z_index=1;
    };
    n.style.zIndex=z_index;
    if(img_url !=null){
      n.src=img_url;
    }
    else{
      n.src=tile.empty_url;
    };
    if(width !=null){
      n.style.width=width;
      n.width=width;
    };
    if(height !=null){
      n.style.height=height;
      n.height=height;
    };
    if(left_margin==null){
      left_margin=-width;
    };
    if(top_margin==null){
      top_margin=-height;
    };
    n.style.left=left_margin;
    n.left=left_margin;
    n.style.top=top_margin;
    n.top=top_margin;
    return n;
  };
//ÀÌ¹ÌÁö °´Ã¼ ¿©±â±îÁö
//Å¸ÀÏ °´Ã¼
  function tile(){
  };
//  tile.aa = function(){
//    alert('aa');
//  }

  tile.empty_url='http://static.naver.com/local/map_img/blank.png';
  tile.create=function(img_url,width,height,left_margin,top_margin,z_index,ownerDocument){
    var n=image.create(img_url,width,height,left_margin,top_margin,z_index,ownerDocument);
    n.onerror=function(){
      n.src=tile.empty_url;
    };
    return n;
  };
//Å¸ÀÏ°´Ã¼ ¿©±â±îÁö

	function wpoint(x,y){
		this.set(x,y);
	}
	wpoint.prototype.set =function (x,y){
		this.x = x;
		this.y = y;
		return this;
	};
	wpoint.prototype.add =function (x,y){
		return this.set(this.x+x,this.y+y);
	};
	wpoint.prototype.distance =function (point){
		return Math.sqrt((this.x - point.x)*(this.x - point.x) + (this.y - point.y)*(this.y - point.y));
	};
	wpoint.prototype.copy =function (point){
		if (point){
			point.set(this.x,this.y);
			return point;
		}else{
			return new wpoint(this.x,this.y);
		}
	};
	wpoint.prototype.equals =function(target){
		return ((this.x==target.x) && (this.y==target.y));
	};
	wpoint.prototype.toStr =function(){
		return this.x+","+this.y;
	};
	
var ya="__maps_events";
function Y(a,b,c,d){
	this.instance=a;
	this.eventName=b;
	this.listenerFn=c;
	this.id=Y.sequence++;
	this.domEvent=d||false;
	if(a==window&&b=="unload"){}
	else{
		Za().add(this.id,this);
		if(this.domEvent){
			var e=a[ya];
			if(!e){
				e=(a[ya]=new T())
			}
			e.add(this.id,this)
		}
	}
}
Y.sequence=1;

function Za(){
	if(!gb){
		var a=new T();
		gb=a
	}
	return gb
}
Y.prototype.unregister=function(){
	if(this.id){
		Za().remove(this.id);
		if(this.domEvent&&this.instance[ya]){
			this.instance[ya].remove(this.id)
		}
		this.instance=null;
		this.listenerFn=null
	}
};
Y.prototype.detach=function(){
	if(this.domEvent){
		j.removeBuiltInListener(this)
	}else{
		j.removeListener(this)
	}
};
Y.detachNodeEvents=function(a){
	var b;
	if(a[ya]&&(b=a[ya])){
		var c=b.items();
		while(c.length){
			c.pop().detach()
		}
	}
};
Y.detachAll=function(){
	var a=Za().items();
	Za().clear();
	while(a.length){
		a.pop().detach()
	}
};

function q(){}
q.create=function(a,b,c,d,e,f,g,h,i){
	return qa.create(a,b,c,d,e,f,g,h,i,q.createElement)
};
q.createElement=function(a,b,c){
	if(typeof arguments.callee.hasFilters=="undefined"){
		var d=document.createElement("div");
		arguments.callee.hasFilters=typeof d.style.filter!="undefined"
	}
	var e;
	if(arguments.callee.hasFilters){
		var f=c.PNG_cache;
		if(f&&f.childNodes.length>0){
			e=f.removeChild(f.lastChild)
		}else{
			e=c.createElement("div");
			e.style.fontSize=n(1);
			q.destroyBeforeUnload(e)
		}
		if(!e.loader){
			e.loader=c.createElement("img");
			e.loader.style.visibility="hidden";
			e.loader.onload=function(){
				if(!e.cleared){
					e.style.filter=q.alphaImageLoader(this.src,this.ieCrop);
					e.src=a
				}
			}
		}
	}else{
		e=c.createElement("img")
	}
	q.setImage(e,a,b);
	return E
};
q.alphaImageLoader=function(a,b){
	var c="DXImageTransform.Microsoft.AlphaImageLoader";
	var d=",sizingMethod="+(b?"crop":"scale");
	return"progid:"+c+'(src="'+a+'"'+d+")"
};
q.remove=function(a,b){
	if(a.nodeName=="DIV"){
		if(!b.PNG_cache){
			b.PNG_cache=b.createElement("div");
			b.PNG_cache.style.display="none";
			b.body.appendChild(b.PNG_cache)
		}
		b.PNG_cache.appendChild(a);
		q.clearImage(a)
	}else{
		ua(a)
	}
};
q.setImage=function(a,b,c){
	if(a.tagName=="DIV"){
		a.cleared=false;
		a.loader.ieCrop=c||false;
		a.loader.src=b
	}else{
		a.src=b
	}
};
q.clearImage=function(a,b){
	if(a.tagName=="DIV"){
		a.cleared=true;
		a.style.filter=""
	}else{
		a.src=b
	}
};
q.destroyBeforeUnload=function(a){
	if(!q.cleanupQueue){
		q.cleanupQueue=[];
		j.addBuiltInListener(window,"unload",q.onUnload)
	}
	q.cleanupQueue.push(a)
};
q.onUnload=function(){
	for(var a=0;a<q.cleanupQueue.length;++a){
		q.destroyImage(q.cleanupQueue[a])
	}
};
q.destroyImage=function(a){
	if(a.loader){
		a.loader.onload=null;
		a.loader=null
	}
};

function staticoverlay(size,point){
	this.align = "left";
	this.valign = "top";
	this.map = null;
	this.overlay = null;
	this.content=null;
	this.opacity = 1;
	this.zIndex = 0;
	if (size){
		this.setSize(size);
	}else{
		this.size = new wpoint(0,0);
	}
	if (point){
		this.setPos(point);
	}else{
		this.point = new P(0,0);
	}
  }
staticoverlay.prototype.init =function(map){
	this.map = map;
	this.overlay = this.map.create_pane(0);
	this.map.staticLayer.appendChild(this.overlay);
	this.overlay.style.overflow='hidden';
	event_helper.bind(this.map,"redraw",this,this.redraw);
	event_helper.bind(this.map,"unload",this,this.unload);
	event_helper.attach_dom(this.overlay,"mousedown",this,this.mouseDown);
	event_helper.attach_dom(this.overlay,"mouseup",this,this.mouseUp);
	event_helper.attach_dom(this.overlay,"click",this,this.click);
};
staticoverlay.prototype.mouseDown =function (a){
	if(!a) a = window.event;
	event_helper.trigger(this,"mousedown");
	A(a);
};
staticoverlay.prototype.mouseUp =function (a){
	if(!a) a = window.event;
	event_helper.trigger(this,"mouseup");
	A(a);
};
staticoverlay.prototype.click =function (a){
	if(!a) a = window.event;
	event_helper.trigger(this,"click");
	A(a);
};
staticoverlay.prototype.unload =function(){
	this.map.staticLayer.removeChild(this.overlay);
	this.overlay = null;
	this.map = null;
};
staticoverlay.prototype.setSize =function (size){
	this.size = size;
	if (this.overlay!=null){
		this.overlay.style.width = size.width;
		this.overlay.style.height = size.height;
	}
	this.redraw();
};
staticoverlay.prototype.setPos =function (point){
	this.point = point;
	this.redraw();
};
staticoverlay.prototype.setZIndex =function (index){
	this.zIndex = index;
	this.redraw();
};
staticoverlay.prototype.setOpacity =function(opacity){
	this.opacity = opacity;
	this.redraw();
};
staticoverlay.prototype.setAlign =function(align){
	this.align = align;
	this.redraw();
};
staticoverlay.prototype.setValign =function(valign){
	this.valign = valign;
	this.redraw();
};
staticoverlay.prototype.setContent =function(content){
	if (this.overlay){
		this.overlay.innerHTML = content;
	}
};
staticoverlay.prototype.appendChild =function(dom){
	this.overlay.appendChild(dom);
};
staticoverlay.prototype.removeChild =function(dom){
	this.overlay.removeChild(dom);
};
staticoverlay.prototype.redraw =function(){
	if (this.map==null){
		return;
	}
	var point = this.getPos();
	this.overlay.style.opacity = this.opacity;
	this.overlay.style.filter ='alpha(opacity = '+(this.opacity*100)+')';
	this.overlay.style.left = point.x;
	this.overlay.style.top = point.y;
	this.overlay.style.width = this.size.x;
	this.overlay.style.height = this.size.y;
	this.overlay.style.zIndex= this.zIndex;
};
staticoverlay.prototype.getPos =function (){
	var left,top;
	var hi9 = this.map.get_bound();
	switch (this.align){
		case "left":
			left = this.point.x + hi9[0];
			break;
		case "center":
			left = Math.round((this.point.x + (this.map.container.width - hi9[0] - hi9[2]) - this.size.width)/2) + hi9[0];
			break;
		case "right":
		//this.size.width - this.s2.x - hi9[2];
			left = this.map.container.offsetWidth - this.size.x - this.point.x;
			break;
	}
	switch (this.valign){
		case "top":
			top = this.point.y + hi9[1];
			break;
		case "center":
			top = Math.round((this.point.y + (this.map.container.height-hi9[1]-hi9[3]) - this.size.height)/2) + hi9[1];
			break;
		case "bottom":
			top = this.map.container.height - this.size.y - this.point.y - hi9[3];
			break;
	}
	//return new P(left,top);
	return new P(left,5);
};

  function zoomcontrol(){
	this.setAlign("right");
	this.setValign("top");
}
zoomcontrol.prototype = new staticoverlay(new wpoint(44,159),new P(7,7));
zoomcontrol.prototype.init =function (map){
	staticoverlay.prototype.init.call(this,map);
	this.setZIndex(1);
	this.Start = event_helper.create_adapter(this,this.start);
	this.Move = event_helper.create_adapter(this,this.move);
	this.End = event_helper.create_adapter(this,this.end);
	this.bar = image.create('http://wooricy.com/wooricy/resource/image/mapview/navi/i_control.gif',20,13,12,45,10);
	this.appendChild(this.bar);
	//event_helper.attach_event(this.bar,"mousedown",this.Start);
	this.Redraw = event_helper.bind(this.map,"redraw",this,this.redraw);
	var backimage = image.create('http://wooricy.com/wooricy/resource/image/mapview/navi/img_mapcontrol.gif',44,159,0,0,0);
	backimage.style.border = "none";
	this.appendChild(backimage);
	event_helper.attach_dom(backimage,"click",this,this.Zoomlevel);
	var zoomin = image.create('http://wooricy.com/wooricy/resource/image/mapview/navi/trans.gif',16,18,14,6,0);
	this.appendChild(zoomin);
	zoomin.style.cursor = 'hand';
	event_helper.attach_dom(zoomin,"click",this,this.zoomIn);
	var zoomout = image.create('http://wooricy.com/wooricy/resource/image/mapview/navi/trans.gif',16,18,14,134,0);
	this.appendChild(zoomout);
	zoomout.style.cursor = 'hand';
	event_helper.attach_dom(zoomout,"click",this,this.zoomOut);
	if (!is_ie){
		event_helper.attach_dom(backimage,"mouseout",this,this.end);
	}
	event_helper.bind(this.map,"zoom",this,this.Top);
};
zoomcontrol.prototype.Zoomlevel =function (e,r1){
	var event = e || window.event;
	var s2 = event_helper.event_offset(event,event.target||event.srcElement);
	var y = s2.y;
	if (y<29){
		y = 29;
	}
	if (y>134 ){
		y = 134;
	}
	var g = Math.round((y - 34) /10 +1);
	g = Math.max(Math.min(g,11),1);
	this.map.set_level(g);
};
zoomcontrol.prototype.zoomIn =function (){
	this.map.zoom_in();
};
zoomcontrol.prototype.zoomOut =function (){
	this.map.zoom_out();
};
zoomcontrol.prototype.Start =function (e){
	var event = e || window.event;
	this.eClientY = event.clientY;
	this.bsTop = parseInt(this.bar.style.top);
	this.Move = event_helper.attach_dom(this.bar,"mousemove",this,this.move);
	this.End = event_helper.attach_dom(this.bar,"mouseup",this,this.end);
	if(this.bar.setCapture){
		this.bar.setCapture();
	}
};
zoomcontrol.prototype.end =function (e){
	g = Math.max(Math.min(Math.ceil((parseInt(this.bar.style.top) - 35) / 10 +1 ),11),1);
	this.map.set_level(g);
	event_helper.dettach_event(this.bar,"mousemove",this.Move);
	event_helper.dettach_event(this.bar,"mouseup",this.End);
	if(document.releaseCapture){
		document.releaseCapture();
	}
};
zoomcontrol.prototype.Top =function (g){
	var s2 = (g -1) * 9 + 29;
	this.bar.style.top = s2;
};
zoomcontrol.prototype.move =function (e){
	var event = e || window.event;
	var s2 = this.bsTop+event.clientY - this.eClientY;
	if (s2<26){
		s2 = 26;
	}
	if (s2>128 ){
		s2 = 128;
	}
	this.bar.style.top = s2;
};
zoomcontrol.prototype.unload =function (){
	this.removeChild(this.bar);
	this.bar = null;
	staticoverlay.prototype.unload.call(this);
};
	
function overlay(){};
	overlay.empty_url='http://static.naver.com/local/map_img/blank.png';
	overlay.create=image.create;
	function rectangle(point1,point2){
		this.map=null;
		this.point1=point1;
		this.point2=point2;
		//this.opacity=0.4;
		//this.color='#33FF33';
		//this.color='#ff0099';
		this.color='#ffffff';
		this.rect=document.createElement("div");
		this.rect.style.position="absolute";
		this.rect.style.border="solid 2px #5D5D5D";
		this.rect.style.top=0;
		this.rect.style.left=0;
		this.rect.style.zIndex=1;
		//this.rect.style.backgroundColor=this.color;
		//this.rect.style.filter='alpha(opacity='+(this.opacity*100)+')';
		//this.rect.style.opacity=this.opacity;
	};
	
	rectangle.prototype.init=function(map){
		this.map=map;
		this.map.overlay.appendChild(this.rect);
		this.map.rec_add_shift(this);
		this.zoom_helper=event_helper.bind(this.map,"redraw",this,this.redraw);
	};

	rectangle.prototype.set_point=function(point1,point2){
		this.point1=point1;
		this.point2=point2;
		this.redraw();
	};
	rectangle.prototype.redraw=function(){
		if(this.map==null){return;};
		if(this.point1&&this.point2){
			var pixel1=this.map.get_div_coord(this.map.comm.point2pixel(this.point1,this.map.zoom_level));
			var pixel2=this.map.get_div_coord(this.map.comm.point2pixel(this.point2,this.map.zoom_level));
			var left=Math.min(pixel1.x,pixel2.x);
			var top=Math.min(pixel1.y,pixel2.y);
			var width=Math.abs(pixel1.x-pixel2.x);
			var height=Math.abs(pixel1.y-pixel2.y);
			this.rect.style.left=left;
			
			this.rect.style.top=top;
			this.rect.style.width=width;
			this.rect.style.height=height;
		}else{
			this.rect.style.left=this.rect.style.left;
			this.rect.style.top=this.rect.style.top;
			this.rect.style.width=this.rect.style.width;
			this.rect.style.height=this.rect.style.height;
		};
		event_helper.trigger(this,"redraw");
	};
	rectangle.prototype.unload=function(){
		try{this.map.overlay.removeChild(this.rect);}
		catch(e){}
	};
	
	function line(point1,point2){
		this.container=null;
		this.point1=point1;
		this.point2=point2;
		this.weight=35;
		this.color='#ff0000';
		this.opacity=0.7;
		this.map=null;
	};
	line.prototype.draw_dott=function(layer,x,y,w,h){
		var dot=document.createElement("div");
		dot.style.position='absolute';
		dot.style.left=x+'px';
		dot.style.top=y+'px';
		dot.style.width=w+'px';
		dot.style.height=h+'px';
		dot.style.filter='alpha(opacity='+(this.opacity*100)+')';
		dot.style.opacity=this.opacity;
		dot.style.clip='rect(0,'+w+'px,'+h+'px,0)';
		dot.style.backgroundColor=this.color;
		dot.style.overflow='hidden';
		layer.appendChild(dot);
	};
	line.prototype.set_weight=function(weight){
		this.weight=weight;
	};
	line.prototype.set_color=function(color){this.color=color;};
	line.prototype.set_opacity=function(opacity){this.opacity=opacity;};
	line.prototype.init=function(map){
		this.map=map;
		this.layer=this.map.create_pane(0);
		this.map.path_layer.appendChild(this.layer);
		this.zoom_helper=event_helper.bind(this.map,"redraw",this,this.redraw);
	};
	line.prototype.draw=function(map_obj,point1,point2,layer){
		if(!layer){layer=map_obj.create_pane(0);};
		var pixel1=map_obj.get_div_coord(map_obj.comm.point2pixel(point1,map_obj.zoom_level));
		var pixel2=map_obj.get_div_coord(map_obj.comm.point2pixel(point2,map_obj.zoom_level));
		var dx=pixel1.x-pixel2.x;
		var dy=pixel1.y-pixel2.y;
		var tmp,x,y,dist_x,dist_y,next_value;
		var weight=Math.max(this.weight/Math.pow(2,map_obj.zoom_level-1),1);
		var dw=dw=Math.ceil(weight/2);
		if(pixel1.equal(pixel2)){
			this.draw_dott(layer, pixel1.x-dw , pixel1.y-dw ,weight, weight);
			return layer;
		};
		if(Math.abs(dx)>Math.abs(dy)){
			if(pixel1.x > pixel2.x){
				tmp=pixel1;
				pixel1=pixel2;
				pixel2=tmp;
			};
			dist_x=Math.abs(dx/dy);
			dist_y=(pixel1.y<pixel2.y)?1:-1;
			x=pixel1.x;
			for(y=pixel1.y*dist_y;y<=pixel2.y*dist_y;y++){
				next_value=Math.min(Math.round(x+dist_x),pixel2.x);
				this.draw_dott(layer,Math.round(x), y*dist_y-dw ,next_value-Math.round(x),weight);
				x=x+dist_x;
			}
		}else{
			if(pixel1.y > pixel2.y){
				tmp=pixel1;
				pixel1=pixel2;
				pixel2=tmp;
			};
			y=pixel1.y;
			dist_x=(pixel1.x<pixel2.x)?1:-1;dist_y=Math.abs(dy/dx);
			for(x=pixel1.x*dist_x;x<=pixel2.x*dist_x;x++){
				next_value=Math.min(Math.round(y+dist_y),pixel2.y);
				this.draw_dott(layer,x*dist_x-dw, Math.round(y),weight, next_value-Math.round(y));
				y=y+dist_y;
			}
		};
		return layer;
	};
	line.prototype.redraw=function(){
		if(this.map==null){
			return;
		};
		if(this.layer.childNodes.length!=0){
			this.layer.removeChild(this.layer.childNodes.item(0));
		};
		this.layer.appendChild(this.draw(this.map,this.point1,this.point2));
		event_helper.trigger(this,"redraw");
	};
	line.prototype.unload=function(){
		event_helper.remove_listener(this.map,"zoom",this.zoom_helper);
		this.map.path_layer.removeChild(this.layer);
	};
	function polyline_ns(){
		this.map=null;
		this.point_list=new Array();
		this.add_points.apply(this,arguments);
		this.line=new line();
		this.line.set_opacity(0.5);
	};
	polyline_ns.prototype.init=function(map){
		this.map=map;this.layer=this.map.create_pane(0);
		this.map.path_layer.appendChild(this.layer);
		this.zoom_helper=event_helper.bind(this.map,"redraw",this,this.redraw);
	};
	polyline_ns.prototype.set_weight=function(weight){
		this.line.set_weight(weight);
	};
	polyline_ns.prototype.set_opacity=function(opacity){
		this.line.set_opacity(opacity);
	};
	polyline_ns.prototype.set_color=function(color){
		this.line.set_color(color);
	};
	polyline_ns.prototype.add_points=function(){
		for(var i=0;i<arguments.length;i++){
			this.point_list.push(arguments[i]);
		}
	};
	polyline_ns.prototype.get_points=function(){return this.point_list;};
	polyline.prototype.set_point=function(index,point){
		this.point_list[index].set(point.x,point.y);
		this.redraw();
	};
	polyline_ns.prototype.redraw=function(){
		if(this.map==null){return;};
		var polyline_layer=this.map.create_pane(0);
		for(i=0;i<this.point_list.length-1;i++){
			this.line.draw(this.map,this.point_list[i],this.point_list[i+1],polyline_layer);
		};
		if(this.layer.childNodes.length!=0){
			this.layer.removeChild(this.layer.childNodes.item(0));
		};
		this.layer.appendChild(polyline_layer);event_helper.trigger(this,"redraw");
	};
	polyline_ns.prototype.show=function(flag){
		if(flag){this.layer.style.display='';
		}else{this.layer.style.display='none';}
	};
	polyline_ns.prototype.unload=function(){
		event_helper.remove_listener(this.map,"zoom",this.zoom_helper);
		this.map.path_layer.removeChild(this.layer);
	};
	function polyline(){
		var minx,maxx,miny,maxy;
		this.point_list=new Array();
		this.opacity=0.7;
		this.weight=25;
		this.color="#F00000";
		this.line=null;
		this.line_property=null;
		this.map=null;
		this.add_points.apply(this,arguments)
	};
	polyline.prototype.init=function(map){
		this.map=map;this.zoom_helper=event_helper.bind(this.map,"redraw",this,this.redraw);
		this.line=document.createElement("shape");
		this.line.unselectable="on";
		this.line.fill=false;
		this.line.filled=false;
		this.line.style.position="absolute";
		this.line_property=document.createElement("stroke");
		this.line_property.joinstyle="round";
		this.line_property.endcap="round";
		this.line_property.opacity=this.opacity;
		this.line_property.color=this.color;
		this.line.appendChild(this.line_property);
		this.map.path_layer.appendChild(this.line);
		this.line.style.behavior='url(#default#VML);';
		this.line_property.style.behavior='url(#default#VML);';
		event_helper.attach_dom(this.line,"mousedown",this,this.mousedown);
		event_helper.attach_dom(this.line,"click",this,this.click);
		event_helper.attach_dom(this.line,"dblclick",this,this.dblclick);
	};
	polyline.prototype.mousedown=function(a){
		var d=new Date();
		var now=d.getHours()* 3600+d.getMinutes()* 60+d.getSeconds();
		this.down_time=now;
	};
	polyline.prototype.click=function(a){
		if(!a){	a=window.event;};
		var d=new Date();
		var now=d.getHours()* 3600+d.getMinutes()* 60+d.getSeconds();
		if((now-this.down_time)>1){
			event_helper.trigger(this,"click",this.map.current_mouse_point(a));
		} 
	};
	polyline.prototype.dblclick=function(a){
		if(!a){a=window.event;};
		event_helper.trigger(this,"dblclick",this.map.current_mouse_point(a));
	};
	polyline.prototype.set_weight=function(weight){
		this.weight=(weight);
	};
	polyline.prototype.set_opacity=function(opacity){
		this.opacit=opacity;
	};
	polyline.prototype.set_color=function(color){
		this.color=color;
	};
	polyline.prototype.add_points=function(){
		for(var i=0;i<arguments.length;i++){
			this.point_list.push(arguments[i]);
		};
		this.redraw();
	};
	polyline.prototype.get_points=function(){
		return this.point_list;
	};
	polyline.prototype.set_point=function(index,point){
		this.point_list[index].set(point.x,point.y);
		this.redraw();
	};
	polyline.prototype.get_path=function(){
		var path,pixel;
		var tmp_point=new Array();
		var minx=Number.MAX_VALUE;
		var maxx=Number.MIN_VALUE;
		var miny=Number.MAX_VALUE;
		var maxy=Number.MIN_VALUE;
		if(this.point_list.length<2){return null;};
		for(var i=1;i<this.point_list.length;i++){
			pixel=this.map.get_div_coord(map_obj.comm.point2pixel(this.point_list[i],this.map.zoom_level));
			if(pixel.x<minx){minx=pixel.x;};
			if(pixel.y<miny){miny=pixel.y;};
			if(pixel.x>maxx){maxx=pixel.x;};
			if(pixel.y>maxy){maxy=pixel.y;};
			tmp_point[i*2-2]=pixel.x;
			tmp_point[i*2-1]=pixel.y;
		};
		pixel=this.map.get_div_coord(map_obj.comm.point2pixel(this.point_list[0],this.map.zoom_level));
		if(pixel.x<minx){minx=pixel.x;};
		if(pixel.y<miny){miny=pixel.y;};
		if(pixel.x>maxx){maxx=pixel.x;};
		if(pixel.y>maxy){maxy=pixel.y;};
		this.minx=minx;
		this.miny=miny;
		this.maxx=maxx;
		this.maxy=maxy;
		path="m "+pixel.x+","+pixel.y+" l "+tmp_point.join(",")+" e";return path;
	};
	polyline.prototype.redraw=function(){
		var path;
		var g;
		if(this.map==null){return;};
		path=this.get_path();
		if(path==null){return;};
		this.line.style.width=this.maxx-this.minx;
		this.line.style.height=this.maxy-this.miny;
		this.line.style.left=this.minx;
		this.line.style.top=this.miny;
		this.line.coordorigin=this.minx+" "+this.miny;this.line.coordsize=(this.maxx-this.minx)+" "+(this.maxy-this.miny);
		this.line.path=path;this.line_property.weight=Math.max(this.weight/Math.pow(2,this.map.zoom_level-1),1);
		event_helper.trigger(this,"redraw");
	};
	polyline.prototype.show=function(flag){
		if(flag){this.line.style.display='';}
		else{this.line.style.display='none';}
	};
	polyline.prototype.unload=function(){
		event_helper.remove_listener(this.map,"zoom",this.zoom_helper);
		this.map.path_layer.removeChild(this.line);
		this.line=null;
	};
	function icon(src,size){
		this.src=src;
		this.size=size;
		this.offset=new P(Math.round(size.x/2),Math.round(size.y/2));
		this.z_index=0;
	};
	function mark(point,icon){
		this.map=null;
		this.point=point;
		this.icon=icon;
		this.images=[];
		var b=this.icon;
		this.icon_image=image.create(this.icon.src,this.icon.size.x,this.icon.size.y,0,0,this.icon.z_index);
		this.icon_image.style.cursor='hand';
		this.images.push(this.icon_image);
		this.set_info_flag=false;
		event_helper.attach_dom(this.icon_image,"mouseover",this,this.mouseover);
		event_helper.attach_dom(this.icon_image,"mouseout",this,this.mouseout);
		event_helper.attach_dom(this.icon_image,"mousedown",this,this.mousedown);
		event_helper.attach_dom(this.icon_image,"mouseup",this,this.mouseup);
		event_helper.attach_dom(this.icon_image,"click",this,this.click);
		this.propagation_event=false;
	};
	mark.prototype.set_propagation_event=function(flag){
		this.propagation_event=flag;
	};
	mark.prototype.set_point=function(point){
		this.point=point;
		this.redraw();
	};
	mark.prototype.get_point=function(point){
		if(!point){
			point=new P(this.point.x,this.point.y);
		};
		return point;
	};
	mark.prototype.get_pos=function(){
		var c=this.map.get_div_coord(this.map.comm.point2pixel(this.point,this.map.zoom_level));
		var x=c.x-this.icon.offset.x;
		var y=c.y-this.icon.offset.y;
		return new P(x,y);
	};
	mark.prototype.init=function(map){
		this.map=map;
		this.map.mark_layer.appendChild(this.icon_image);
		this.map.add_shift(this);
		this.zoom_helper=event_helper.bind(this.map,"redraw",this,this.redraw);
	};
	mark.prototype.unload=function(map){
		this.map=map;
		this.map.mark_layer.removeChild(this.icon_image);
		this.map.remove_shift(this);
		//event_helper.remove_listener(this.map,"redraw",this.zoom_helper);
	};
	mark.prototype.remove=function(){
		for(var a=0;a<this.images.length;a++){
			var b=this.images[a];
			Y.detachNodeEvents(b);
			q.remove(b,document)
		}
		this.images=null;
		if(this.icon_image){
			ua(this.icon_image);
			this.icon_image=null
		}
	};
	mark.prototype.redraw=function(){
		if(this.map==null){
			return;
		};
		var pos=this.map.get_shift_pos(this);
		this.icon_image.style.left=pos.x;
		this.icon_image.style.top=pos.y;
		this.icon_image.pos=pos;
	};
	mark.prototype.show=function(){
		this.icon_image.style.display = '';
	};
	mark.prototype.hide =function (){
		this.icon_image.style.display = 'none';
	};
	mark.prototype.set_info=function(content){
		this.map.set_info(this.get_point(),content);
		this.map.show_info_win();
	};
	mark.prototype.unset_info=function(){
		this.content=null;
		this.set_info_flag=false;
	};
	mark.prototype.click=function(a){
		if(!a)a=window.event;
		if(!this.propagation_event){A(a);};
		event_helper.trigger(this,"click");
	};
	mark.prototype.mousedown=function(a){
		if(!a)a=window.event;
		if(!this.propagation_event){A(a);};
		event_helper.trigger(this,"mousedown");
	};
	mark.prototype.mouseup=function(a){
		if(!a)a=window.event;
		if(!this.propagation_event){A(a);};
		event_helper.trigger(this,"mouseup");
	};
	mark.prototype.mouseover=function(a){
		if(!a)a=window.event;
		if(!this.propagation_event){A(a);};
		if(this.set_info_flag){
			this.map.set_info(this.point,this.content);
		};
		this.current_index=this.icon_image.style.zIndex;
		this.icon_image.style.zIndex=999;
		this.icon_image.style.left=this.icon_image.pos.x-1;
		this.icon_image.style.top=this.icon_image.pos.y-1;
	};
	mark.prototype.mouseout=function(a){
		if(!a)a=window.event;
		if(!this.propagation_event){A(a);};
		if(this.set_info_flag){this.map.hide_info_win();};
		this.icon_image.style.zIndex=this.current_index;
		this.icon_image.style.left=this.icon_image.pos.x;
		this.icon_image.style.top=this.icon_image.pos.y;
	};
	
	
//À©µµ¿ì »óÅÂ
function info_window(){
	this.hideTimeout = null;
	this.map = null;
}
info_window.prototype.init =function (map){
	this.gpoint = new P(0,0);
	this.redrawCallback = event_helper.createCallback(this,this.redraw);
	this.map = map;
	this.infoDiv = this.map.create_pane(0);
	this.map.info_layer.appendChild(this.infoDiv);
	this.init_win();
	event_helper.attach_dom(this.infoDiv,"mouseout",this,this.mouseout);
	event_helper.attach_dom(this.infoDiv,"mouseover",this,this.mouseover);
	event_helper.attach_dom(this.infoDiv,"mousedown",this,this.mousedown);
};
info_window.prototype.init_win =function (){
	this.infoDiv.style.padding  ='0px 0px 0px 0px';
	this.setOpacity(0.9);
	this.infoDiv.style.display ="none";
	this.contentDiv = this.map.create_pane(0);
	this.infoDiv.appendChild(this.contentDiv);
	this.contentDiv.style.position = 'relative';
	this.contentDiv.style.padding = '0px 0px 0px 0px';
};
info_window.prototype.setOpacity =function(opacity){
	this.infoDiv.style.opacity = opacity;
	this.infoDiv.style.filter ='alpha(opacity = '+(opacity*100)+')';
};
info_window.prototype.set =function (point,content){
	this.point = point;
	this.contentDiv.style.width = '';
	this.contentDiv.style.height = '';
	this.infoDiv.style.width = '';
	this.infoDiv.style.height = '';
	this.contentDiv.innerHTML = content;
	if (this.infoDiv.style.display !="none"){
		this.redraw();
	}
};
info_window.prototype.set_point =function (){
	var c = this.map.get_div_coord(this.map.comm.point2pixel(this.point,this.map.zoom_level));
	var f2 = 7;
	var top,left;
	if (this.gpoint.x==1){
		if ((this.map.drag_obj.drag_offset.width + c.x + this.infoDiv.offsetWidth - f2) > (this.map.view_size.width - this.map.tile_images[2])){
			left = c.x - f2 - this.infoDiv.offsetWidth;
			this.gpoint.x =0;
		}else{
			left = c.x + f2;
		}
	}else{
		if ((this.map.drag_obj.drag_offset.width + c.x - f2 - this.infoDiv.offsetWidth) < this.map.tile_images[0]){
			left = this.infoDiv.style.left = c.x + f2;
			this.gpoint.x =1;
		}else{
			left  = c.x - f2 - this.infoDiv.offsetWidth;
		}
	}
	if (this.gpoint.y==1){
		if ((this.map.drag_obj.drag_offset.height + c.y + this.infoDiv.offsetHeight + f2) > (this.map.view_size.height - this.map.tile_images[1])){
			top = c.y + f2 - this.infoDiv.offsetHeight;
			this.gpoint.y =0;
		}else{
			top = c.y - f2;
		}
	}else{
		if ((this.map.drag_obj.drag_offset.height + c.y - f2 - this.infoDiv.offsetHeight) < this.map.tile_images[3]){
			top = c.y + f2;
			this.gpoint.y =1;
		}else{
			top = c.y - f2 - this.infoDiv.offsetHeight;
		}
	}
	this.infoDiv.style.left = c.x - 15;
	this.infoDiv.style.top = c.y + 20;
};
info_window.prototype.redraw =function (){
	if (this.map ==null){
		return;
	}
	if (this.point ==null){
		return;
	}
	if (this.infoDiv.style.display =="none"){
		return;
	}
	this.infoDiv.style.width = this.contentDiv.offsetWidth;
	this.infoDiv.style.height = this.contentDiv.offsetHeight;
	this.set_point();
};
info_window.prototype.pan =function (){
	var c = this.map.get_div_coord(this.map.comm.point2pixel(this.point,this.map.zoom_level));
	var xPos = this.map.drag_obj.drag_offset.width+c.x;
	var yPos = this.map.drag_obj.drag_offset.height+c.y - 40;
	var xPan = Math.min(Math.max(0, 10 - xPos), (this.map.view_size.width - 10 - (xPos +this.infoDiv.clientWidth)));
	var yPan = Math.min(Math.max(0, 10 - (yPos - this.infoDiv.clientHeight)), (this.map.view_size.height - 10 - yPos));
	this.map.pan(xPan,yPan);
};
info_window.prototype.mousedown =function (a){
	if(!a) a = window.event;
	A(a);
};
info_window.prototype.mouseover =function (a){
	if(!a) a = window.event;
	if (a){
		A(a);
	}
	event_helper.trigger(this,"mouseover");
};
info_window.prototype.mouseout =function (a){
	if(!a) a = window.event;
	if (a){
		A(a);
	}
	event_helper.trigger(this,"mouseout");
};
info_window.prototype.showWindow =function (){
	if (this.hideTimeout !=null){
		window.clearTimeout(this.hideTimeout);
		this.hideTimeout = null;
	}
	this.gpoint.set(0,0);
	event_helper.add_listener(this.map,"redraw",this.redrawCallback);
	event_helper.add_listener(this.map,"move",this.redrawCallback);
	this.infoDiv.style.display = '';
	this.redraw();
};
info_window.prototype.hideWindow =function (){
	event_helper.remove_listener(this.map,"redraw",this.redrawCallback);
	event_helper.remove_listener(this.map,"move",this.redraw);
	this.infoDiv.style.display = 'none';
};
info_window.prototype.delayHideWindow =function (time){
	if (!time){
		time = 500;
	}
	if (this.hideTimeout !=null){
		window.clearTimeout(this.hideTimeout);
	}
	this.hideTimeout = oa(this,function(){this.hideWindow()},time);
};
info_window.prototype.unload =function (){
	this.infoDiv.removeChild(this.contentDiv);
	this.contentDiv = null;
	this.map.infoLayer.removeChild(this.infoDiv);
	this.infoDiv = null;
	this.gpoint = null;
	this.redrawCallback = null;
	this.map = null;
};
//À©µµ¿ì »óÅÂ ¿©±â±îÁö

//±âº» ¼³Á¤
  window.return_false=return_false;
  window.return_true=return_true;
  window.map=map;
  window.P=P;
  window.rectangle=rectangle;
  window.line=line;
  window.polyline=polyline;
  window.event_helper=event_helper;
  window.drag_object=drag_object;
  window.mark=mark;
  window.icon=icon;
  window.wpoint=wpoint;
  window.info_window=info_window;
  window.zoomcontrol=zoomcontrol;
  if(is_ie){window.polyline=polyline;}else{window.polyline=polyline_ns;};
};

sundo_map();
var debug_msg=new Array();
var debug_line=10;
var debug_row=60;
function debug(msg,msg_buffer_number,output){
  var display="";
  var line="";
  if(msg_buffer_number==null){
    msg_buffer_number=0;
  };

  debug_buffer=debug_msg;
  if(output==null){
    if(document.getElementById('_debug_out')==null){
      var b=document.createElement("div");
      b.style.position="absolute";
      b.style.top=100;
      b.style.left=100;
      b.style.zIndex=100;
      b.id='_debug_out';
      b.style.width='200px';
      b.style.height='100px';
      b.style.backgroundColor='#FFFFFF';
      b.style.filter='alpha(opacity=50)';
      container.appendChild(b);
    };
    output=_debug_out;
  };
  debug_buffer.unshift(msg);
  if(debug_buffer.length > debug_line){
    debug_buffer.pop();
  };
  for(i=0;i<debug_buffer.length;i++){
    display=display+"&nbsp;&nbsp;&nbsp;"+debug_buffer[i];line=line+debug_buffer[i]+" ";
    if(line.length>debug_row){
      display=display+"<BR>";
      line="";
    }
  };
  output.innerHTML=display;
}



