function ajax_comm(){
  this.tile_size = 256;
  this.min_x = 0;
  this.max_x = 99999999;
  this.min_y = -10000000;
  this.max_y = 99999999;

  this.min_level = 1;
  this.max_level = 11;

  this.empty_tile_url = 'http://static.naver.com/local/map_img/blank.png';
  this.base_map_url = 'http://imap.local.naver.com/img/';
}

ajax_comm.prototype.distance_per_pixel =
  function (level){
    return Math.pow(2, level-1)*100;
  }

ajax_comm.prototype.get_row_count =
  function (level){
    var row_image_count = Math.floor((this.max_x - this.min_x)  / (Math.pow(2, level-1)* this.tile_size *100));
    return row_image_count;
  }

ajax_comm.prototype.get_col_count =
  function (level){
    var col_image_count = Math.floor((this.max_y - this.min_y) / (Math.pow(2, level-1)* this.tile_size *100));
    return col_image_count;
  }

ajax_comm.prototype.get_tile_url =
  function (x_index,y_index,level){
  	    var row_image_count = this.get_row_count(level);
    var col_image_count = this.get_col_count(level);

    x_index = (row_image_count*(level+1) + x_index ) % row_image_count;
    y_index = (col_image_count*(level+1) + y_index ) % col_image_count;


    var image_index = y_index * row_image_count + x_index;
    var dir = Math.floor(image_index / 1000)*1000;
    var img_url = "http://imap.wooricy.com/mapimage_256/"+ level + "/" + dir + "/" + image_index +".png";
    return img_url;
    /*
    var row_image_count = this.get_row_count(level);
    var col_image_count = this.get_col_count(level);

    x_index = (row_image_count*(level+1) + x_index ) % row_image_count;
    y_index = (col_image_count*(level+1) + y_index ) % col_image_count;

    var image_index = y_index * row_image_count + x_index;
    var dir = Math.floor(image_index / 1000)*1000;
    var img_url = "http://211.108.60.216:8808/ImageServer/ImageServlet?lv="+ level + "&dir=" + dir + "&img=" + image_index;
    return img_url;*/
  }

ajax_comm.prototype.get_overlay_url =
    function (x_index,y_index,level){
      return "";
    }


ajax_comm.prototype.point2pixel =
    function (point,level){
      var distance_per_pixel = this.distance_per_pixel(level);
      var pixel = new P(Math.round((point.x - this.min_x)/distance_per_pixel),Math.round((point.y - this.min_y)/distance_per_pixel));
      return pixel;
    }

ajax_comm.prototype.pixel2point =
    function (pixel,level){
      var distance_per_pixel = this.distance_per_pixel(level);
      var point = new P(Math.round(pixel.x*distance_per_pixel)+this.min_x,Math.round(pixel.y*distance_per_pixel)+this.min_y);
      return point;
    }

ajax_comm.prototype.has_overlay = return_false;

