﻿
<!--

//=====================================================================
// 전역변수
//=====================================================================
var g_nCurrentNo				= 0;									// 현재 클릭되어 있는 버튼번호
var g_nCurrentNo2				= 20;
var g_arImageList				= new Array();				// 버튼 이미지 파일명을 담을 리스트
var g_arImageOverList		= new Array();				// 마우스 오버시에 버튼 이미지 파일명을 담을 리스트
var g_arExceptImageList	= new Array();				// 클릭해도 변하는게 없는 버튼 번호
var g_bViewStatus				= false;							// 지도 상태(true:2D, false:3D)
var g_nCircleX					= 0;									// 반경검색시에 세팅됨.
var g_nCircleY					= 0;
var g_nCircleRadius			= 0;



g_arImageList[1] = "Resource/image/navi/btn_menu1.gif";
g_arImageList[2] = "Resource/image/navi/btn_menu2.gif";
g_arImageList[3] = "Resource/image/navi/btn_menu3.gif";
g_arImageList[4] = "Resource/image/navi/btn_menu4.gif";
g_arImageList[5] = "Resource/image/navi/btn_menu5.gif";
g_arImageList[6] = "Resource/image/navi/btn_menu6.gif";
g_arImageList[7] = "Resource/image/navi/btn_menu7.gif";
g_arImageList[8] = "Resource/image/navi/btn_menu8.gif";
g_arImageList[9] = "Resource/image/navi/btn_menu9.gif";
g_arImageList[10] = "Resource/image/navi/btn_menu10.gif";
g_arImageList[11] = "Resource/image/navi/btn_menu11.gif";
g_arImageList[12] = "Resource/image/navi/btn_menu12.gif";
g_arImageList[13] = "Resource/image/navi/btn_menu13.gif";
g_arImageList[14] = "Resource/image/navi/btn_menu14.gif";
g_arImageList[15] = "Resource/image/navi/btn_menu15.gif";
g_arImageList[16] = "Resource/image/navi/btn_menu16.gif";
g_arImageList[20] = "Resource/Image/navi/btn02_menu1.gif";
g_arImageList[21] = "Resource/Image/navi/btn02_menu2.gif";
g_arImageList[22] = "Resource/Image/navi/btn02_menu3.gif";
g_arImageList[23] = "Resource/Image/navi/btn02_menu4.gif";
g_arImageList[24] = "Resource/Image/navi/btn02_menu5.gif";

g_arImageOverList[1] = "Resource/image/navi/btn_menu1_over.gif";
g_arImageOverList[2] = "Resource/image/navi/btn_menu2_over.gif";
g_arImageOverList[3] = "Resource/image/navi/btn_menu3_over.gif";
g_arImageOverList[4] = "Resource/image/navi/btn_menu4_over.gif";
g_arImageOverList[5] = "Resource/image/navi/btn_menu5_over.gif";
g_arImageOverList[6] = "Resource/image/navi/btn_menu6_over.gif";
g_arImageOverList[7] = "Resource/image/navi/btn_menu7_over.gif";
g_arImageOverList[8] = "Resource/image/navi/btn_menu8_over.gif";
g_arImageOverList[9] = "Resource/image/navi/btn_menu9_over.gif";
g_arImageOverList[10] = "Resource/image/navi/btn_menu10_over.gif";
g_arImageOverList[11] = "Resource/image/navi/btn_menu11_over.gif";
g_arImageOverList[12] = "Resource/image/navi/btn_menu12_over.gif";
g_arImageOverList[13] = "Resource/image/navi/btn_menu13_over.gif";
g_arImageOverList[14] = "Resource/image/navi/btn_menu14_over.gif";
g_arImageOverList[15] = "Resource/image/navi/btn_menu15_over.gif";
g_arImageOverList[16] = "Resource/image/navi/btn_menu16_over.gif";
g_arImageOverList[20] = "Resource/Image/navi/btn02_menu1_over.gif";
g_arImageOverList[21] = "Resource/Image/navi/btn02_menu2_over.gif";
g_arImageOverList[22] = "Resource/Image/navi/btn02_menu3_over.gif";
g_arImageOverList[23] = "Resource/Image/navi/btn02_menu4_over.gif";
g_arImageOverList[24] = "Resource/Image/navi/btn02_menu5_over.gif";


/*
var i = 0;
g_arExceptImageList[i++] = 4;
g_arExceptImageList[i++] = 5;
g_arExceptImageList[i++] = 8;
g_arExceptImageList[i++] = 10;
g_arExceptImageList[i++] = 11;
g_arExceptImageList[i++] = 12;
g_arExceptImageList[i++] = 15;
g_arExceptImageList[i++] = 16;
*/
//=====================================================================













//=====================================================================
// 메뉴 버튼 관련
//=====================================================================

function ImageOver(nImageNo)
{
	document.getElementById("Image"+nImageNo).src = g_arImageOverList[nImageNo];
}

function ImageOut(nImageNo)
{
	if (nImageNo != g_nCurrentNo)
		document.getElementById("Image"+nImageNo).src = g_arImageList[nImageNo];
}

//=====================================================================






//=====================================================================
// 메뉴 버튼 관련 -- 팝업창 
//=====================================================================
function ImageStand2(nImageNo)
{
	for (var i = 20 ; i < g_arExceptImageList.length ; i++)
	{
		// 만약 nImageNo 가 제외된 이미지 중에 있으면 그냥 넘어간다.
		if (g_arExceptImageList[i] == nImageNo)
			return;
	}
	ImageOver2(nImageNo);
	var temp = g_nCurrentNo2;
	g_nCurrentNo2 = nImageNo;
	ImageOut2(temp);
}

function ImageOver2(nImageNo)
{
	document.getElementById("Image"+nImageNo).src = g_arImageOverList[nImageNo];
}

function ImageOut2(nImageNo)
{
	if (nImageNo != g_nCurrentNo2)
		document.getElementById("Image"+nImageNo).src = g_arImageList[nImageNo];
}

//=====================================================================




//고정확대축소바
function zoom_bar_click(nImageNo)
{
	var j=0;
	//SetLevel(nImageNo);

	for( j=1 ; j<=11 ; j++) 
	{
		if (j <= nImageNo) 
		{
			document.getElementById("zoom_bar"+j).src = "Resource/Image/set/btn_scale_on.gif";
		} 
		else 
		{ 
			document.getElementById("zoom_bar"+j).src = "Resource/Image/set/btn_scale_off.gif";
		}
	}
}


//숫자체크

//=====================================================================


//=====================================================================
// 레이어 관련
//=====================================================================

function DisplayMainFrame()
{
	document.getElementById("MainTR").style.display = "block";
	document.getElementById("SubTR").style.display = "none";
//	document.getElementById("SubTR").location.href = strUrl;
}

function DisplaySubFrame(strUrl)
{
	document.getElementById("MainTR").style.display = "none";
	document.getElementById("SubTR").style.display = "block";
	SubFrame.location.href = strUrl;
}
//=====================================================================




// 확대
function ZoomIn(){
	mapObj.zoomIn();
}

// 축소
function ZoomOut(){
	mapObj.zoomOut();
}

// 이동
function PanningCommand(){
	//WooricyMap.PanningCommand();
}

// 이전
function GoBack(){
	mapObj.prev();
}

// 이후
function GoForward(){
	mapObj.next();
}

//거리재기
function DistanceStart(mapObj)
{
    mapObj.ToolDistanceStart();
}

// 면적
function MeasureArea(activation){
	//WooricyMap.MeasureArea();
}

// 초기화
function Reset(){
	WooricyMap.Reset();
//	PanningCommand();
}

// 이미지 저장
function SaveImage(){
	downloadMap();
}

// 인쇄
function PopupPrint() {
   var mapWin = window.open("MapPrint.aspx", "print", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no, top=100 left=100 width=647 height=800");
	mapWin.focus();
}


// 레벨 확대/축소
function bar_level(level){
	mapObj.setZoom(level);
}


/////////////////////////////////////////////////////////////////// 기존

var ResourceUrl = "/AjaxMap/Resource/";
var AreaArray	= null;
var ImgIdxArray = null;
var ImgArray	= null;
var ImgBgArray	= null;
var ImgBGIdx	= 0;

function ImgPreload()
{
	var imgTp = "";
	ImgIdxArray = new Array();
	ImgArray = new Array();
	
	imgTp = "gs";
	ImgArray[imgTp] = new Array();
	ImgArray[imgTp][0] = MakeImageTp(imgTp);
	ImgIdxArray[imgTp] = 0;
	
	imgTp = "sk";
	ImgArray[imgTp] = new Array();
	ImgArray[imgTp][0] = MakeImageTp(imgTp);
	ImgIdxArray[imgTp] = 0;
	
	imgTp = "so";
	ImgArray[imgTp] = new Array();
	ImgArray[imgTp][0] = MakeImageTp(imgTp);
	ImgIdxArray[imgTp] = 0;
	
	imgTp = "hd";
	ImgArray[imgTp] = new Array();
	ImgArray[imgTp][0] = MakeImageTp(imgTp);
	ImgIdxArray[imgTp] = 0;
	
	imgTp = "mp";
	ImgArray[imgTp] = new Array();
	ImgArray[imgTp][0] = MakeImageTp(imgTp);
	ImgIdxArray[imgTp] = 0;
	
	ImgBgArray	= new Array();
	ImgBGIdx	= 0;
}

// 이미지 풀을 초기화
function ImgIdxArrayInit()
{
	ImgIdxArray["gs"] = 0;
	ImgIdxArray["sk"] = 0;
	ImgIdxArray["so"] = 0;
	ImgIdxArray["hd"] = 0;
	ImgIdxArray["mp"] = 0;
	
	ImgBGIdx = 0;
}

// 이미지 풀 생성
function MakeImageTp(imgTp)
{
	var arr = new Array();
	var width = 0;
	
	switch(imgTp)
	{
		case "gs" : width = 93; break;
		case "sk" : width = 92; break;
		case "so" : width = 73; break;
		case "hd" : width = 87; break;
		case "mp" : width = 61; break;
	}
	
	arr[0] = new Image();
	arr[0].src = "./Resource/image/" + imgTp + "_basic.gif";
	arr[0].width	= width;
	arr[0].height	= 21;
	arr[0].style.position = "absolute";
	arr[0].border = 0;
	
	arr[1] = new Image();
	arr[1].src = "./Resource/image/" + imgTp + "_over.gif";
	arr[1].width	= width;
	arr[1].height	= 21;
	arr[1].style.position = "absolute";
	arr[1].border = 0;
	
	arr[2] = new Image();
	arr[2].src = "./Resource/image/" + imgTp + "_mini.gif";
	arr[2].width	= 29;
	arr[2].height	= 20;
	arr[2].style.position = "absolute";
	arr[2].border = 0;
	
	return arr;
}

function getImgBg()
{
	var img = ImgBgArray[ImgBGIdx];
	
	if(img == null)
	{
		ImgBgArray[ImgBGIdx] = new Image();
		ImgBgArray[ImgBGIdx].src = ResourceUrl + "img/trans.gif";
		ImgBgArray[ImgBGIdx].style.position = "absolute";
		ImgBgArray[ImgBGIdx].width = 93;
		ImgBgArray[ImgBGIdx].height = 21;
		ImgBgArray[ImgBGIdx].style.zIndex = 1;
		ImgBgArray[ImgBGIdx].border = 0;
		img = ImgBgArray[ImgBGIdx];
	}
	ImgBGIdx ++;
	
	return img;
}

function getImgTp(imgTp)
{
	var img = ImgArray[imgTp][ImgIdxArray[imgTp]];
	if(img == null)
		img = ImgArray[imgTp][ImgIdxArray[imgTp]] = MakeImageTp(imgTp);
	ImgIdxArray[imgTp] ++;
	return img;
}

function goArea(code)
{
	if(AreaArray == null)
	{
		AreaArray = new Array();
		AreaArray[11] = new Array(299392,557728,324992,538528);
		AreaArray[26] = new Array(472448,306560,521074,268160);
		AreaArray[27] = new Array(431901,379866,469204,343424);
		AreaArray[28] = new Array(261408,552704,287008,533504);
		AreaArray[29] = new Array(276700,296272,311127,273252);
		AreaArray[30] = new Array(332536,433445,360456,398303);
		AreaArray[31] = new Array(491200,347828,535749,310080);
		AreaArray[41] = new Array(277888,602368,380288,525568);
		AreaArray[42] = new Array(421504,619648,523904,542848);
		AreaArray[43] = new Array(361920,505984,413120,467584);
		AreaArray[44] = new Array(229368,491776,367715,375440);
		AreaArray[45] = new Array(254848,379520,357248,302720);
		AreaArray[46] = new Array(221952,309888,324352,233088);
		AreaArray[47] = new Array(409088,473728,511488,396928);
		AreaArray[48] = new Array(426624,340992,510931,264192);
		AreaArray[50] = new Array(240000,105280,291200,66880);
	}
	mapObj.setBound(AreaArray[code]);
	miniandzoom.selectArea.hide();
}	
	
function makeTr(name, code)
{
	var tr, td;
	tr	= document.createElement("TR");
	td	= document.createElement("TD");
	td.style.padding = "4px 10pt";
	td.style.fontSize = "11px";
	td.style.fontFamily = "돋움";
	td.style.letterSpacing = "-1px";
	td.innerHTML = "<a href=\"javascript:goArea(" + code + ");\">" + name + "</a>";
	tr.appendChild(td);
	return tr;
}
	
function JSelectArea()
{
	this.setAlign("right");
	this.setValign("top");
	this.bShow = false;
}
JSelectArea.prototype = new JStaticOverlay(new JSize(178,300),new JPoint(52,34));

JSelectArea.prototype.init = function (map)
{
	JStaticOverlay.prototype.init.call(this, map);
	//JEvent.attachDom(this.mainLayer,"mouseout",this,this.mouseout);
	//JEvent.attachDom(this.mainLayer,"mouseover",this,this.mouseover);
	this.over = false;
	this.setZIndex(99);
	this.subLayer = this.map.mkDiv(98);
	this.map.staticLayer.appendChild(this.subLayer);
	
	//this.mainLayer.style.backgroundImage = "url(/AjaxMap/Resource/img/trans.gif)";
	//this.mainLayer.style.backgroundRepeat = "repeat";
	this.subLayer.style.border = "1px solid rgb(153, 153, 153)";
	this.subLayer.style.backgroundColor = "white";
	
	var table = document.createElement("TABLE");
	table.border = 0;
	table.cellPadding = 0;
	table.cellSpacing = 0;
	table.width = 178;
	var tr	= document.createElement("TR");
	var td	= document.createElement("TD");
	td.height = 10;
	tr.appendChild(td);
	table.appendChild(tr);
	table.appendChild(makeTr("서울특별시", 11));
	table.appendChild(makeTr("부산광역시", 26));
	table.appendChild(makeTr("대구광역시", 27));
	table.appendChild(makeTr("인천광역시", 28));
	table.appendChild(makeTr("광주광역시", 29));
	table.appendChild(makeTr("대전광역시", 30));
	table.appendChild(makeTr("울산광역시", 31));
	table.appendChild(makeTr("경기도", 41));
	table.appendChild(makeTr("강원도", 42));
	table.appendChild(makeTr("충청북도", 43));
	table.appendChild(makeTr("충청남도", 44));
	table.appendChild(makeTr("전라북도", 45));
	table.appendChild(makeTr("전라남도", 46));
	table.appendChild(makeTr("경상북도", 47));
	table.appendChild(makeTr("경상남도", 48));
	table.appendChild(makeTr("제주도", 50));
	tr	= document.createElement("TR");
	td	= document.createElement("TD");
	td.height = 10;
	tr.appendChild(td);
	table.appendChild(tr);
	
	var div = this.map.mkDiv(0);
	div.appendChild(table);
	div.innerHTML = "<div>" + div.innerHTML + "</div>"
	this.size = this.map.getHTMLSize(div.innerHTML);
	this.subLayer.appendChild(div);
}

JSelectArea.prototype.redraw = function()
{
	if(this.map!=null && this.subLayer != null && this.subLayer != null)
	{
		var pos = this.getPos();
		
		this.mainLayer.style.left = pos.x;
		this.mainLayer.style.top = pos.y;
		this.mainLayer.style.width = this.size.width;
		this.mainLayer.style.height = this.size.height;
		this.mainLayer.style.zIndex= this.zIndex;
		
		this.subLayer.style.left = pos.x;
		this.subLayer.style.top = pos.y;
		this.subLayer.style.width = this.size.width;
		this.subLayer.style.height = this.size.height;
		this.subLayer.style.zIndex= this.zIndex-1;
	}
};

JSelectArea.prototype.show = function()
{
	this.mainLayer.style.display='';
	this.subLayer.style.display='';
	this.bShow = true;
};


JSelectArea.prototype.hide = function()
{
	this.mainLayer.style.display='none';
	this.subLayer.style.display='none';
	this.bShow = false;
};
	
JSelectArea.prototype.mouseout = function ()
{
	if(this.over)
	{
		this.hide();
		this.over = false;
	}
}

JSelectArea.prototype.mouseover = function ()
{
	this.over = true;
}
	
	
function JMiniAndZoom()
{
	this.setAlign("right");
	this.setValign("top");
	this.bShowMiniMap = true;
}
JMiniAndZoom.prototype = new JStaticOverlay(new JSize(242,157),new JPoint(7,7));
	
JMiniAndZoom.prototype.init = function (map)
{
	JStaticOverlay.prototype.init.call(this, map);
	this.setZIndex(1);
	
	this.selectArea = new JSelectArea();
	this.map.addControl(this.selectArea);
	this.selectArea.hide();
	
	// 줌바 에서 사용
	this.startAdapter = JEvent.createAdapter(this,this.start);
	this.moveAdapter = JEvent.createAdapter(this,this.move);
	this.endAdapter = JEvent.createAdapter(this,this.end);
	
	this.leftLayer = this.map.mkDiv(0);
	this.btn = JImage.create(ResourceUrl+'img/minimap/miniMap_btn02.gif',9,37,0,Math.round((157-37)/2),0);
	setCursor(this.btn,"pointer");
	this.leftLayer.appendChild(this.btn);
	this.leftLayer.appendChild(JImage.create(ResourceUrl+'img/minimap/miniMap_l.gif',4,157,9,0,0))
	this.appendChild(this.leftLayer);
	
	this.miniMapLayer = this.map.mkDiv(0);
	this.miniMapLayer.style.backgroundImage ='url('+ResourceUrl+'img/minimap/miniMap_bg.gif)';
	this.miniMapLayer.style.width ="190px";
	this.miniMapLayer.style.height ="157px";
	this.miniMapLayer.style.left ="13px";
	this.appendChild(this.miniMapLayer);
	
	this.zoomLayer = this.map.mkDiv(0);
	this.zoomLayer.style.backgroundImage ='url('+ResourceUrl+'img/minimap/miniMap_bg.gif)';
	this.zoomLayer.style.width ="35px";
	this.zoomLayer.style.height ="157px";
	this.zoomLayer.style.left ="203px";
	this.appendChild(this.zoomLayer);
	
	var rightLayer = this.map.mkDiv(0);
	rightLayer.style.backgroundImage ='url('+ResourceUrl+'img/minimap/miniMap_r.gif)';
	rightLayer.style.width ="4px";
	rightLayer.style.height ="157px";
	rightLayer.style.left ="238px";
	this.appendChild(rightLayer);

	JEvent.attachDom(this.btn,"click",this,this.ShowMiniMap);
		
	var zoomInner = this.map.mkDiv(0);
	zoomInner.style.width ="21px";
	zoomInner.style.height ="145px";
	zoomInner.style.left ="7px";
	zoomInner.style.top ="6px";
	
	this.bar = JImage.create(ResourceUrl+'img/minimap/g_s.gif',21,15,0,23,10);
	setCursor(this.bar,"pointer");
	zoomInner.appendChild(this.bar);
	JEvent.attachEvent(this.bar,"mousedown",this.startAdapter);
	
	// +
	var plus = JImage.create(ResourceUrl+'img/minimap/g_max.gif',21,18,0,0,0);
	setCursor(plus,"pointer");
	JEvent.attachDom(plus,"click",this,this.zoomIn);
	zoomInner.appendChild(plus);
	
	var top = JImage.create(ResourceUrl+'img/minimap/g_top.gif',21,4,0,18,0);
	zoomInner.appendChild(top);
	
	this.arr_g = new Array(11);
	for(var i=0; i<11; i++)
	{
		this.arr_g[i] = JImage.create(ResourceUrl+'img/minimap/g_off.gif',21,9,0,22+((i)*9),0);
		zoomInner.appendChild(this.arr_g[i] );
	}
	// 시간관계상... 삽질
	JEvent.attachDom(this.arr_g[0] ,"click",this,this.zc1);
	JEvent.attachDom(this.arr_g[1] ,"click",this,this.zc2);
	JEvent.attachDom(this.arr_g[2] ,"click",this,this.zc3);
	JEvent.attachDom(this.arr_g[3] ,"click",this,this.zc4);
	JEvent.attachDom(this.arr_g[4] ,"click",this,this.zc5);
	JEvent.attachDom(this.arr_g[5] ,"click",this,this.zc6);
	JEvent.attachDom(this.arr_g[6] ,"click",this,this.zc7);
	JEvent.attachDom(this.arr_g[7] ,"click",this,this.zc8);
	JEvent.attachDom(this.arr_g[8] ,"click",this,this.zc9);
	JEvent.attachDom(this.arr_g[9] ,"click",this,this.zc10);
	JEvent.attachDom(this.arr_g[10] ,"click",this,this.zc11);
	
	var btm = JImage.create(ResourceUrl+'img/minimap/g_btm.gif',21,3,0,121,0);
	zoomInner.appendChild(btm);
	
	// -
	var minus = JImage.create(ResourceUrl+'img/minimap/g_min.gif',21,20,0,126,0);
	setCursor(minus,"pointer");
	JEvent.attachDom(minus,"click",this,this.zoomOut);
	zoomInner.appendChild(minus);
	
	if (!isMSIE)
	{
		JEvent.attachDom(zoomInner,"mouseout",this,this.end);
	}
	
	JEvent.bind(this.map,"redraw",this,this.redraw);
	JEvent.bind(this.map,"zoom",this,this.setZoomBar);
	
	this.zoomLayer.appendChild(zoomInner);
	this.setZoomBar(this.map.getZoom());
	
	
	var nav_combo = this.map.mkDiv(10);
	nav_combo.style.left = 6;
	nav_combo.style.top = 9;
	setCursor(nav_combo,"pointer");
	nav_combo.appendChild(JImage.create(ResourceUrl+'img/minimap/btn_loca.gif',178,19,0,0,0));
	JEvent.attachDom(nav_combo ,"click",this,this.navComboClick);
	
	var minidiv = this.map.mkDiv(0);
	minidiv.style.left = 6;
	minidiv.style.top = 31;
	minidiv.style.border = '1px #999999 solid';
	
	this.miniMapLayer.appendChild(nav_combo);
	//this.miniMapLayer.appendChild(this.nav_list);
	this.miniMapLayer.appendChild(minidiv);
	
	if(!isMSIE)
		this.miniMap = new JMap(minidiv,176,116,false);
	else
		this.miniMap = new JMap(minidiv,178,116,false);
	this.fillRect = new JRectangle();
	this.emptyRect = new JRectangle();
	
	this.fillRect.setLineWeight(1);
	this.fillRect.setLineColor("#ff9e9b");
	this.fillRect.setFillColor("gray");
	this.fillRect.setOpacity(0.20);
	
	this.emptyRect.setLineWeight(1);
	this.emptyRect.setLineColor("#ff9e9b");
	
	this.miniMap.addOverlay(this.fillRect);
	this.miniMap.addOverlay(this.emptyRect);
	
	this.MapBound2Mini();

	JEvent.attachEvent(this.miniMapLayer,"mousewheel",JEvent.stopEvent);
	JEvent.bind(this.map,"zoom",this,this.MapBound2Mini);
	JEvent.bind(this.map,"resize",this,this.MapBound2Mini);
	JEvent.bind(this.map,"move",this,this.MapCenter2Mini);
	JEvent.bind(this.map,"endDrag",this,this.MapCenter2Mini2);
	JEvent.bind(this.map,"moved",this,this.MapCenter2Mini0);
	JEvent.bind(this.miniMap,"move",this,this.emptyRectCenter);
	JEvent.bind(this.miniMap,"endDrag",this,this.miniCenter2Map);

};
	
JMiniAndZoom.prototype.navComboClick = function ()
{
	if(this.selectArea.bShow)
		this.selectArea.hide();
	else
		this.selectArea.show();
}

JMiniAndZoom.prototype.ShowMiniMap = function ()
{
	if(this.bShowMiniMap)
	{
		this.miniMapLayer.style.display="none";
		this.leftLayer.style.left = "190px";
		this.btn.src = ResourceUrl+'img/minimap/miniMap_btn01.gif';
		this.bShowMiniMap = false;
	}
	else
	{
		this.miniMapLayer.style.display="";
		this.leftLayer.style.left = "0px";
		this.btn.src = ResourceUrl+'img/minimap/miniMap_btn02.gif';
		this.bShowMiniMap = true;
		//this.minimap.redraw();
	}
}

// 시간관계상... 삽질
JMiniAndZoom.prototype.zc1 = function() {this.map.setZoom(1)}
JMiniAndZoom.prototype.zc2 = function() {this.map.setZoom(2)}
JMiniAndZoom.prototype.zc3 = function() {this.map.setZoom(3)}
JMiniAndZoom.prototype.zc4 = function() {this.map.setZoom(4)}
JMiniAndZoom.prototype.zc5 = function() {this.map.setZoom(5)}
JMiniAndZoom.prototype.zc6 = function() {this.map.setZoom(6)}
JMiniAndZoom.prototype.zc7 = function() {this.map.setZoom(7)}
JMiniAndZoom.prototype.zc8 = function() {this.map.setZoom(8)}
JMiniAndZoom.prototype.zc9 = function() {this.map.setZoom(9)}
JMiniAndZoom.prototype.zc10 = function() {this.map.setZoom(10)}
JMiniAndZoom.prototype.zc11 = function() {this.map.setZoom(11)}
/*
JMiniAndZoom.prototype.zoombarClick = function (e,_obj)
{
	var lv;
	if (!isMSIE)
	{
		lv = e.rangeOffset - 3;
		this.map.setZoom(lv);
	}
	else
	{
		//var evt = e || window.event;
		//var y = evt.clientY;
		//lv = Math.max(Math.min(Math.ceil((parseInt(y - this.zoomLayer.clientHeight) - 14) / 9 ),11),1);
	}
		
	//this.map.setZoom(lv);
};
*/
JMiniAndZoom.prototype.zoomIn = function ()
{
	this.map.zoomIn();
};

JMiniAndZoom.prototype.zoomOut = function ()
{
	this.map.zoomOut();
};

JMiniAndZoom.prototype.start = function (e)
{
	var evt = e || window.event;
	this.bar_c_y = evt.clientY;
	this.bar_top = parseInt(this.bar.style.top);
	
	JEvent.attachEvent(document,"mousemove",this.moveAdapter);
	JEvent.attachEvent(this.bar,"mouseup",this.endAdapter);
	
	if(this.bar.setCapture)
	{
		// MSIE 에서만 됨
		this.bar.setCapture();
	}
};

JMiniAndZoom.prototype.end = function (e)
{
	lv = Math.max(Math.min(Math.ceil((parseInt(this.bar.style.top) - 14-4) / 9 ),11),1);
	JEvent.detachEvent(document,"mousemove",this.moveAdapter);
	JEvent.detachEvent(this.bar,"mouseup",this.endAdapter);
	
	if(document.releaseCapture)
	{
		// MSIE 에서만 됨
		document.releaseCapture();
	}
	
	this.map.setZoom(lv);
	this.setZoomBar(lv);
};

JMiniAndZoom.prototype.setZoomBar = function (lv)
{
	for(var i=0; i<11; i++)
	{
		if(lv > i)
			this.arr_g[i].src = ResourceUrl+'img/minimap/g_off.gif';
		else
			this.arr_g[i].src = ResourceUrl+'img/minimap/g_on.gif';
	}
	
	this.bar.style.top = (lv -1) * 9 + 23;
};

JMiniAndZoom.prototype.move = function (e)
{
	var event = e || window.event;
	var pos = this.bar_top+event.clientY - this.bar_c_y;
	if (pos<23)
		pos = 23;
	if (pos>113 )
		pos = 113;
	this.bar.style.top = pos;
};

JMiniAndZoom.prototype.unload = function ()
{
	this.removeChild(this.bar);
	this.bar = null;
	JStaticOverlay.prototype.unload.call(this);
};

JMiniAndZoom.prototype.MapCenter2Mini0  = function ()
{
	this.MapCenter2Mini();
	this.MapCenter2Mini2();
}

JMiniAndZoom.prototype.MapCenter2Mini  = function ()
{
	//if(!isMSIE)console.log("MapCenter2Mini");///////////////////////////////////////////
	
	// 미니맵을 드래그 한경우 바로 fillRect를 세팅하지 않음 (미니맵 센터기준으로 선처리)
	if(this.dragd)
		this.dragd = false;
	else
	{
		this.fillRect.setCenter(this.map.getCenter());
	}
};

JMiniAndZoom.prototype.MapCenter2Mini2  = function ()
{
	//if(!isMSIE)console.log("MapCenter2Mini2");///////////////////////////////////////////

	this.miniMap.setCenter(this.map.getCenter());
	this.emptyRect.setCenter(this.map.getCenter());
};

JMiniAndZoom.prototype.emptyRectCenter  = function ()
{
	//if(!isMSIE)console.log("emptyRectCenter");///////////////////////////////////////////
	
	this.emptyRect.setCenter(this.miniMap.getCenter());
};

JMiniAndZoom.prototype.miniCenter2Map = function ()
{
	//if(!isMSIE)console.log("miniCenter2Map");///////////////////////////////////////////
	
	this.map.setCenter(this.miniMap.getCenter(), false);
	
	//this.map.setCenterAndZoom(this.miniMap.getCenter(), this.map.getZoom());
	
	// 미니맵을 드래그 한경우 바로 fillRect를 세팅(미니맵 센터기준으로)
	//if(!this.dragd)
	//{
		//this.dragd = true;
		this.fillRect.setCenter(this.miniMap.getCenter());
	//}
	
	JEvent.trigger(this.map,"endDragMini");
};

JMiniAndZoom.prototype.MapBound2Mini  = function ()
{
	//if(!isMSIE)console.log("MapBound2Mini");///////////////////////////////////////////
	
	var bound = this.map.getBound();
	var dx = Math.round((bound[2] - bound[0])*0.6);
	var dy = Math.round((bound[3] - bound[1])*0.6);
	this.fillRect.setBound(this.map.getBound());
	this.emptyRect.setBound(this.map.getBound());
	bound[0] = bound[0] - dx;
	bound[1] = bound[1] - dy;
	bound[2] = bound[2] + dx;
	bound[3] = bound[3] + dy;
	this.miniMap.setBound(bound);
	
	this.emptyRect.setCenter(this.miniMap.getCenter());
	this.fillRect.setCenter(this.miniMap.getCenter());
};


function JInfoWindowSkin() {}

JInfoWindowSkin.prototype = new JInfoWindow();

JInfoWindowSkin.prototype.initWin = function ()
{
	// 426 x 318
	// 142 x 202
	this.setOffset(new JSize(10,10));
	this.infoDiv.style.display ="none";
	
	var temp = '';
	temp += '<table width="142" border="0" cellspacing="0" cellpadding="0">';
	temp += '	<tr>';
	temp += '		<td colspan="3"><img src="Resource/image/tip1_top.gif" width="142" height="6" /></td>';
	temp += '	</tr>';
	temp += '	<tr>';
	temp += '		<td width="3" background="Resource/image/tip1_bg.gif">&nbsp;</td>';
	temp += '		<td width="136">';
	temp += '			<div id="divInfo">';
	temp += '			</div>';
	temp += '		</td>';
	temp += '		<td width="3" background="Resource/image/tip1_bg.gif">&nbsp;</td>';
	temp += '	</tr>';
	temp += '	<tr>';
	temp += '		<td colspan="3"><img src="Resource/image/tip1_bottom.gif" width="142" height="6" /></td>';
	temp += '	</tr>';
	temp += '</table>';
	
	this.infoDiv.innerHTML = temp;
};

JInfoWindowSkin.prototype.ContentFill = function (content)
{
	// pollCd+"|"+name+"|"+public_State+"|"+url_YN+"|"+date+"|"+money11+"|"+money1+"|"+money22+"|"+money2+"|"+money33+"|"+money3;
	//    0         1            2             3         4         5           6           7          8           9          10
	var contArr = this.content.split("|");
	
	var imgsrc = '';
	var pollCd = contArr[0];
	if(pollCd == "GSC")		{imgsrc = "Resource/image/gs.gif";}
	else if(pollCd == "SKI"){imgsrc = "Resource/image/sk.gif";}
	else if(pollCd == "SKE"){imgsrc = "Resource/image/sk.gif";}
	else if(pollCd == "HDO"){imgsrc = "Resource/image/hd.gif";}
	else if(pollCd == "SOL"){imgsrc = "Resource/image/s-o.gif";}
	else					{imgsrc = "Resource/image/nop.gif";}
	
	if(contArr[2] == "1") contArr[3] = "N";
	var pkkk = String(this.pk);
	var temp = '';
	temp += '			<table width="136" border="0" cellspacing="0" cellpadding="0" bgcolor="white">';
	temp += '				<tr>';
	temp += '					<td height="29" colspan="2" class="tip01"><img src="' + imgsrc + '" width="28" height="28" align="absmiddle"/><a onclick="if(openHome) openHome(\'' + this.pk + '\', \'' + contArr[3] + '\');">' + contArr[1] + '</a></td>';
	temp += '				</tr>';
	temp += '				<tr>';
	temp += '					<td colspan="2"><img src="Resource/image/tip1_underline.gif" width="136" height="1" /></td>';
	temp += '				</tr>';
		
	if(contArr[2] == "1")
	{
		temp += '			  <tr>';
		temp += '			      <td height="80" class="text_center_bold">가격공개를 거부한<br />';
		temp += '			        주유소입니다.</td>';
		temp += '			  </tr>';
	}
	if(contArr[2] == "2")
	{
		temp += '			  <tr>';
		temp += '			      <td height="80" class="text_center_bold">가격 조사기간 초과 <br />';
		temp += '			        주유소입니다.</td>';
		temp += '			  </tr>';
	}
	else if(contArr[2] == "0")
	{
		
		temp += '				<tr>';
		temp += '					<td height="19" colspan="2" class="tip02">' + contArr[4] + '</td>';
		temp += '				</tr>';
		temp += '			</table>';
		temp += '			<table width="136" border="0" cellspacing="0" cellpadding="0" bgcolor="white">';
		temp += '				<tr>';
		temp += '					<td width="80" height="19" class="tip03">고급휘발유 :';
		temp += '					</td>';
		temp += '					<td width="56" class="tip03">' + contArr[5] + '원</td>';
		temp += '				</tr>';
		temp += '				<tr>';
		temp += '					<td height="19" class="tip03">휘 발 유 :';
		temp += '					</td>';
		temp += '					<td class="tip03">' + contArr[6] + '원</td>';
		temp += '				</tr>';
		/*
		temp += '				<tr>';
		temp += '					<td height="19" class="tip03">고급경유 :';
		temp += '					</td>';
		temp += '					<td class="tip03">' + contArr[7] + '원</td>';
		temp += '				</tr>';
		*/
		temp += '				<tr>';
		temp += '					<td height="19" class="tip03">경 유 :';
		temp += '					</td>';
		temp += '					<td class="tip03">' + contArr[8] + '원</td>';
		temp += '				</tr>';
		temp += '				<tr>';
		temp += '					<td height="19" class="tip03">실내등유 :';
		temp += '					</td>';
		temp += '					<td class="tip03">' + contArr[9] + '원</td>';
		temp += '				</tr>';
		temp += '				<tr>';
		temp += '					<td height="19" class="tip03">보일러등유 :';
		temp += '					</td>';
		temp += '					<td class="tip03">' + contArr[10] + '원</td>';
		temp += '				</tr>';
		//temp += '				<tr>';
		//temp += '					<td height="27" colspan="2"><!--div align="center"><img src="Resource/image/tip1_icon.gif" alt="세차장" width="24" height="23" align="absmiddle" /><img src="Resource/image/tip1_icon2.gif" alt="경정비" width="24" height="23" align="absmiddle" /><img src="Resource/image/tip1_icon3.gif" alt="편의점" width="24" height="23" align="absmiddle" /><img src="Resource/image/tip1_icon4.gif" alt="충전소" width="24" height="23" align="absmiddle" /></div-->';
		//temp += '					</td>';
		//temp += '				</tr>';
	}
	else if(contArr[2] == "M")
	{
		
		temp += '				<tr>';
		temp += '					<td height="19" colspan="2" class="tip02">' + contArr[4] + '</td>';
		temp += '				</tr>';
		temp += '			</table>';
		temp += '			<table width="136" border="0" cellspacing="0" cellpadding="0" bgcolor="white">';
		temp += '				<tr>';
		temp += '					<td height="19" class="tip03">휘 발 유 :';
		temp += '					</td>';
		temp += '					<td class="tip03">' + contArr[6] + '원</td>';
		temp += '				</tr>';
		temp += '				<tr>';
		temp += '					<td height="19" class="tip03">경 유 :';
		temp += '					</td>';
		temp += '					<td class="tip03">' + contArr[8] + '원</td>';
		temp += '				</tr>';
		//temp += '				<tr>';
		//temp += '					<td height="27" colspan="2"><!--div align="center"><img src="Resource/image/tip1_icon.gif" alt="세차장" width="24" height="23" align="absmiddle" /><img src="Resource/image/tip1_icon2.gif" alt="경정비" width="24" height="23" align="absmiddle" /><img src="Resource/image/tip1_icon3.gif" alt="편의점" width="24" height="23" align="absmiddle" /><img src="Resource/image/tip1_icon4.gif" alt="충전소" width="24" height="23" align="absmiddle" /></div-->';
		//temp += '					</td>';
		//temp += '				</tr>';
	}
	
	temp += '			</table>';
	
	return temp;
}

JInfoWindowSkin.prototype.set = function (point,content)
{
	JInfoWindow.prototype.set.call(this,point,content);
};

JInfoWindowSkin.prototype.showWindow = function ()
{
	JInfoWindow.prototype.showWindow.call(this);
	JEvent.trigger(this,"show", this.pk);
}


JInfoWindowSkin.prototype.hideWindow = function ()
{
	JInfoWindow.prototype.hideWindow.call(this);
	JEvent.trigger(this,"hide", this.pk);
}

JInfoWindowSkin.prototype.setPk = function (pk)
{
	this.pk = pk;
}

JInfoWindowSkin.prototype.getPk = function ()
{
	return this.pk;
}

JInfoWindowSkin.prototype.redraw = function (recalc)
{
	if (this.map ==null)
	{
		return;
	}
	if (this.point ==null)
	{
		return;
	}
	if (this.infoDiv.style.display =="none")
	{
		return;
	}
	if (this.content!=null)
	{
		var divInfo = document.getElementById("divInfo");
		divInfo.innerHTML = this.ContentFill(this.content);
		this.content = null;
	}
	
	JInfoWindow.prototype.autoLoc.call(this);
};

JInfoWindowSkin.prototype.unload = function()
{
	JInfoWindow.prototype.unload.call(this);
};



function JRollOver(point, offset, pk, imgTp)
{
	this.map	= null;
	this.mainLayer = null;
	this.bgTransImg= null;
	this.img1 = null;
	this.img2 = null;
	this.img3 = null;
	this.point	= point;
	this.offset = offset;
	this.pk		= pk;
	this.imgTp	= imgTp;
	this.parent = null;
	this.bSelect= false;
	this.shift = false;
};

JRollOver.prototype.init = function(map, parent)
{
	this.map = map;
	if (parent != null)
		this.parent = parent;
	else
		this.parent = this.map.markLayer;
	
	var imgArr = getImgTp(this.imgTp);
	this.img1 = imgArr[0];
	this.img2 = imgArr[1];
	this.img3 = imgArr[2];
	this.bgTransImg = getImgBg();
	setCursor(this.bgTransImg,"pointer");
	this.bgTransImg.style.width = this.img1.width;
	this.bgTransImg.style.height = this.img1.height;
	
	this.mainLayer = this.map.mkDiv(0);
	this.parent.appendChild(this.bgTransImg);
	this.parent.appendChild(this.mainLayer);
	this.mainLayer.appendChild(this.img1);
	this.mainLayer.appendChild(this.img2);
	this.mainLayer.appendChild(this.img3);
	
	JEvent.attachDom(this.bgTransImg,"mouseover",this,this.mouseover);
	JEvent.attachDom(this.bgTransImg,"mouseout",this,this.mouseout);
	JEvent.attachDom(this.bgTransImg,"click",this,this.click);
	JEvent.bind(this.map,"unload",this,this.unload);
	this.redrawCallback = JEvent.bind(this.map,"redraw",this,this.redraw);
	this.zoomCallback = JEvent.bind(this.map,"zoom",this,this.zoom);
	
	this.drawRollOver(this.bSelect);
};

JRollOver.prototype.enableShift = function ()
{
	this.shift = true;
	this.map.addMark(this);
	this.redraw();
};

JRollOver.prototype.disableShift = function ()
{
	this.shift = false;
	this.map.removeMark(this);
	this.redraw();
	
};
	
JRollOver.prototype.setSelect = function(_bSelect)
{
	if(this.bSelect!=_bSelect)
	{
		this.bSelect = _bSelect;
		this.drawRollOver(this.bSelect);
	}
}

JRollOver.prototype.getSelect = function()
{
	return this.bSelect;
}

JRollOver.prototype.setPoint = function (point)
{
	this.point = point;
	this.redraw();
};

JRollOver.prototype.getPoint = function(point)
{
	if(this.point!=null)
	{
		if (!point)
			point = this.point.copy();
		else
			point.set(this.point.x,this.point.y);
		return point;
	}
};

JRollOver.prototype.getPk = function()
{
	return this.pk;
}

JRollOver.prototype.getPos = function ()
{
	var c = this.map.getPos(this.map.spec.point2pixel(this.point,this.map.mapLevel));
	var x = c.x - this.offset.x;
	var y = c.y - this.offset.y;
	return new JPoint(x,y);
};

JRollOver.prototype.unload = function()
{
	JEvent.removeListener(this.map,"redraw",this.redrawCallback);
	JEvent.removeListener(this.map,"zoom",this.zoomCallback);
	
	if (this.map && this.parent)
	{
		if(this.bgTransImg != null)
			this.parent.removeChild(this.bgTransImg);
		if(this.mainLayer != null)
			this.parent.removeChild(this.mainLayer);
	}
	this.map	= null;
	this.img1 = null;
	this.img2 = null;
	this.img3 = null;
	this.point	= null;
	this.offset = null;
	this.pk		= null;
	this.imgTp	= null;
	this.parent = null;
	this.bSelect= null;
};

JRollOver.prototype.zoom = function(lv)
{
	this.drawRollOver(this.bSelect, lv);
}

JRollOver.prototype.drawRollOver = function(bOver, lv)
{
	if(this.map!=null && this.img1!=null && this.img2!=null && this.img3!=null)
	{
		if(lv==null) lv = this.map.getZoom();
		
		if(bOver)
		{
			this.bgTransImg.style.width = this.img1.width;
			this.bgTransImg.style.height = this.img1.height;
			this.bgTransImg.style.zIndex  = 999;
			this.mainLayer.style.zIndex  = 998;
			this.img1.style.display = 'none';
			this.img2.style.display = '';
			this.img3.style.display = 'none';
			
		}
		else
		{
			if(lv >= 4)	// 미니..
			{
				this.bgTransImg.style.width = this.img3.width;
				this.bgTransImg.style.height = this.img3.height;
				this.mainLayer.style.width = this.img3.width;
				this.mainLayer.style.height = this.img3.height;
				this.bgTransImg.style.zIndex = 1;
				this.mainLayer.style.zIndex = 0;
				this.img1.style.display = 'none';
				this.img2.style.display = 'none';
				this.img3.style.display = '';
			}
			else		// 큰사이즈..
			{
				this.bgTransImg.style.width = this.img1.width;
				this.bgTransImg.style.height = this.img1.height;
				this.mainLayer.style.width = this.img1.width;
				this.mainLayer.style.height = this.img1.height;
				this.bgTransImg.style.zIndex = 1;
				this.mainLayer.style.zIndex = 0;
				this.img1.style.display = '';
				this.img2.style.display = 'none';
				this.img3.style.display = 'none';
			}
		}
	}
}

JRollOver.prototype.redraw = function(recalc)
{
	var pos = null;
	if (this.shift)
		pos = this.map.markShift(this);
	else
		pos = this.getPos();
		
	this.bgTransImg.style.left = pos.x;
	this.bgTransImg.style.top  = pos.y;
	this.mainLayer.style.left = pos.x;
	this.mainLayer.style.top  = pos.y;
};

JRollOver.prototype.show = function ()
{
	this.drawRollOver(this.bSelect);
	this.bgTransImg.style.display = '';
	this.mainLayer.style.display = '';
};

JRollOver.prototype.hide = function ()
{
	this.bgTransImg.style.display = 'none';
	this.mainLayer.style.display = 'none';
};

JRollOver.prototype.showInfoWin = function()
{
	if(this.content!=null && this.map!=null)
	{
		this.map.setInfoWin(this.getPoint(),this.content);
		
		if(this.pk != null)
		{
			this.map.infowin.setPk(this.pk);
		}
		this.map.showInfoWin();
	}
};

JRollOver.prototype.hideInfoWin = function(delay)
{
	if(this.map!=null)
		this.map.hideInfoWin(delay);
};

JRollOver.prototype.setContent = function(c)
{
	this.content = c;
};
	
JRollOver.prototype.click= function(a)
{
	var contArr = this.content.split("|");
	if(contArr[3]!=null)
		eval("openHome('" + this.pk + "', '" + contArr[3] + "');");
	JEvent.trigger(this,"click",this.getPoint(), this.pk);
};

JRollOver.prototype.mouseover= function(a)
{
	if(!this.bSelect)
	{
		this.setSelect(true);
		this.showInfoWin();
	}
	JEvent.trigger(this,"mouseover",this.getPoint(), this.pk);
};

JRollOver.prototype.mouseout= function(a)
{
	if(this.bSelect)
	{
		this.setSelect(false);
		this.hideInfoWin();
	}
	JEvent.trigger(this,"mouseout",this.getPoint(), this.pk);
};


//****** 반경검색

var circleMap = null;
var circle = null;
var circleLine = null;
var circleDesc = null;
var Radius_IsDrawing = false;
var Radius_CenterX   = 0;
var Radius_CenterY   = 0;
var Radius_Distance  = 0;

function ClearRadius()
{
	if(circleMap!=null)
	{
		Radius_IsDrawing = false;
		Radius_CenterX   = 0;
		Radius_CenterY   = 0;
		Radius_Distance  = 0;
		circleMap.clearOverlays('circles');	
	}
}

function SetCircleOnMap(map)
{
	circleMap = map;
	mapObj.disableDrag();
	alert("반경을 설정해 주십시오.");
	ClearRadius();
	JEvent.addListener(circleMap,"mousedown",startPoint);
}

function startPoint(pt)
{	
	Radius_CenterX   = pt.x;
	Radius_CenterY   = pt.y;
			
	circleLine = new JPolyline();
	circleLine.setColor("red");
	circleLine.setMaxWeight(3);
	circleLine.setOpacity(0.5)
	circleLine.addPoints(pt);
	circleMap.addOverlay(circleLine, 'circles');
	
	circle = new JCircle(pt, new JSize(4, 4));
	circle.setLineWeight(3); 
	circle.setLineColor('red'); 
	circle.setOpacity(0.5);
	circleMap.addOverlay(circle, 'circles');
		
	circleDesc = new JInfoWindow();
	circleDesc.setOffset(new JSize(-30,-10))
	circleDesc.setPos(new JPoint(1,1));
	circleDesc.setAutoPosX(false);
	circleDesc.setAutoPosY(false);
	circleDesc.setZIndex(100);
	circleMap.addOverlay(circleDesc, 'circles');
	
	JEvent.removeListener(circleMap,"mousedown",startPoint);
	JEvent.addListener(circleMap,"mousemove",displayCircle);
	JEvent.addListener(circleMap,"mouseup",endPoint);
}

function displayCircle(pt, isEnd)
{
	if(circleLine.getPoints().length < 2)
		circleLine.addPoints(pt);
	else
		circleLine.setPoint(1, pt);
		
	var dist = circle.point.distance(pt);
	
	// setSize로 설정하면 pixel단위로 픽스됨(레벨변화시 사이즈 안변함)
	//var distPx = dist / circleMap.spec.distancePerPixel(circleMap.getZoom());
	//circle.setSize(new JSize(distPx*2, distPx*2)); 
	
	circle.setBound(new Array(circle.point.x-dist, circle.point.y+dist, circle.point.x+dist, circle.point.y-dist));
	
	var distInfo = (dist>1000)?(Math.round(dist/10)/100+"km"):(Math.round(dist)+"m");
	distInfo = "반경 : " + distInfo + "&nbsp;&nbsp;";
	if(isEnd!=null && isEnd==true) distInfo+= "<img src='" + ResourceUrl + "img/map_x.gif' width=6 height=5 style='cursor:pointer;' border=0 onclick='ClearRadius();'>&nbsp;";
	circleDesc.set(new JPoint(circle.point.x + (pt.x - circle.point.x)/2, circle.point.y + (pt.y - circle.point.y)/2), "<TABLE cellpadding=0 cellspacing=0><TR><TD><div style='padding-top:2px; background-color:#FFFFFF;border:1px solid #656565;font-family:돋움,dotum;font-size:11px;'>&nbsp;"+distInfo+"</div></TD></TR></TABLE>");
	circleDesc.showWindow();
}

function endPoint(pt)
{
	JEvent.removeListener(circleMap,"mousemove",displayCircle);
	JEvent.removeListener(circleMap,"mouseup",endPoint);
	
	displayCircle(pt, true);
	Radius_Distance = Math.round(circle.point.distance(pt));
	Radius_IsDrawing = true;
	
	
	circleMap.enableDrag();
}


//****** 반경검색 끝

// 화살표 마크를 표시(화살표는 지도상에 한개만)
			var arrowMark = null;	
			function ShowArrow(x,y,name)
			{
				if(arrowMark == null)
				{
					var imgUrl = "./Resource/Image/symbol/img_arrow.gif";
					arrowMark = new JMark(new JPoint(x, y), new JIcon(imgUrl, new JSize(30,44), new JPoint(15,44)));
					arrowMark.setZindex(99);
					mapObj.addOverlay(arrowMark);
				}
				else
				{
				    arrowMark.show();
					arrowMark.setPoint(new JPoint(x, y));
				}
				setCenterAndLevel(x,y,1);
			    arrowMark.setName(name);
			}


			function setCenterAndLevel(x,y,lv)
			{
				mapObj.setCenterAndZoom(new JPoint(x,y), lv);
			}

// 화살표를 숨김
			function HideArrow()
			{
				if(arrowMark != null)
				{
					arrowMark.hide();
				}
			}




// 노선 표시
			
			
			function OriDisplayPath(Obj) {
			
				for(iIndex=0;iIndex<Obj.length;iIndex++) {
					if(Obj[iIndex].nClass == 0) { // 버스
						//alert("bus "+Obj[iIndex].nNumber+"==="+Obj[iIndex].nSID+"==="+Obj[iIndex].nEID);
						add_lane(Obj[iIndex].nNumber,1,Obj[iIndex].nSID,Obj[iIndex].nEID);
					}
					else if(Obj[iIndex].nClass == 1) { // 지하철
						//alert("sub "+Obj[iIndex].nNumber+"==="+Obj[iIndex].nSID+"==="+Obj[iIndex].nEID);
						add_lane(Obj[iIndex].nNumber,2,Obj[iIndex].nSID,Obj[iIndex].nEID);
					}
				}
				load_lane();
			}

			var laneInfo;
			laneInfo = new Array();
			var lane_obj;

			//--------------------------------------- 노선 표시 (폴리라인) ---------------------------------//
			
			function add_lane(laneID, laneClass, startIndex, endIndex)
			{
				laneInfo.push({id:laneID,cls:laneClass,start:startIndex,end:endIndex});
			}
			  
			function load_lane()
			{
				clear_lane();
				var reqUrl="/AjaxMap/Common/Trans/LoadLaneU.asp?param=309947:552079";
				//var param="param=309947:552079";
				var param=null;
				for (i=0 ; i<laneInfo.length ; i++)
				{
					var lane_info = laneInfo[i];
					//alert(lane_info.id+","+lane_info.cls+","+lane_info.start+","+lane_info.end);
					//param = param+"@"+lane_info.id+":"+lane_info.cls+":"+lane_info.start+":"+lane_info.end;
					reqUrl=reqUrl+"@"+lane_info.id+":"+lane_info.cls+":"+lane_info.start+":"+lane_info.end;
				}

				var xmlhttp = new JXmlhttp();
				//xmlhttp.setType(1);
				xmlhttp.loadhttp(reqUrl, getPath);
				
				delete laneInfo;
				laneInfo = new Array();
			}
			  
			function clear_lane()
			{
				mapObj.clearOverlays("lanes");
				lane_obj = new Array();
				
				HideArrow();
			}

			function show_lane2(index)
			{
				var line_obj = lane_obj[index];
				mapObj.addOverlay(line_obj, "lanes");
			}
			  
			function show_lane()
			{
				for (i=0 ; i<lane_obj.length ; i++)
				{
					show_lane2(i);
					//setInterval('show_lane2('+i+')', i * 50);
				}
			}
			
			// 문자열을 XML DOM 으로
			function getXML(str){
				var xmlDoc
				//xml로 가져온 str 재배열하기
				if(window.ActiveXObject){
					xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
					xmlDoc.async=false;
					xmlDoc.loadXML(str); //<--- 메모리상에서 불러오기 위해서
				}else{
					var parser=new DOMParser();
					xmlDoc=parser.parseFromString(str,"text/xml"); //->xml형태로 파싱해줌
				}
				return xmlDoc;
			}
			  
			// 대중교통XML 언파싱
			function getPath(str)
			{		
				var data = null;
				var boundary = {left:99999999,top:0,right:0,bottom:99999999};

				var xml = getXML(str);
       			var nodes = xml.getElementsByTagName("Lane");

       			for (i=0 ; i<nodes.length ; i++)
       			{
       				var nodes2 = nodes[i].getElementsByTagName("Class");
       				var laneClass=parseInt(nodes2[0].firstChild.nodeValue);
       				nodes2 = nodes[i].getElementsByTagName("Type");
       				var laneType=parseInt(nodes2[0].firstChild.nodeValue);
       				nodes2 = nodes[i].getElementsByTagName("Section");

       				for(k=0; k<nodes2.length; k++){
			       	
	       				var nodes3 = nodes2[k].getElementsByTagName("Rule");
	       				var rule=nodes3[0].firstChild.nodeValue;
	       				var nodesX=nodes2[k].getElementsByTagName("X");
	       				var nodesY=nodes2[k].getElementsByTagName("Y");
				       	
	       				var line_obj = new JPolyline();
	       				line_obj.setMinWeight(6);
	       				
	       				if (laneClass == 1)	// 버스
	       				{
	       					switch(laneType)
	       					{
	       					case 1:
	       						line_obj.color="#333333";
	       					break;
	       					case 2:
	       						line_obj.color="#993350";
	       					break;
	       					case 11:
	       						line_obj.color="#3952fb";
	       					break;
	       					case 12:
	       						line_obj.color="#0abb0c";
	       					break;
	       					case 13:
	       						line_obj.color="#ffd700";
	       					break;
	       					case 14:
	       						line_obj.color="#ff673c";
	       					break;
	       					}
	       				}
	       				else	// 지하철
	       				{
	       					switch(laneType)
	       					{
	       					case 0:
	       						line_obj.color="#042566";
	       					break;
	       					case 1:
	       						line_obj.color="#003399";
	       					break;
	       					case 2:
	       						line_obj.color="#0f993d";
	       					break;
	       					case 3:
	       						line_obj.color="#ff6600";
	       					break;
	       					case 4:
	       						line_obj.color="#1d8ac7";
	       					break;
	       					case 5:
	       						line_obj.color="#663399";
	       					break;
	       					case 6:
	       						line_obj.color="#cb7935";
	       					break;
	       					case 7:
	       						line_obj.color="#69870e";
	       					break;
	       					case 8:
	       						line_obj.color="#ec1286";
	       					break;
	       					case 100:
	       						line_obj.color="#ffcd05";
	       					break;
	       					case 21:
	       						line_obj.color="#4c6e99";
	       					break;
	       					case 31:
	       						line_obj.color="#000000";
	       					break;
	       					case 41:
	       						line_obj.color="#d92b2b";
	       					break;
	       					case 42:
	       						line_obj.color="#000000";
	       					break;
	       					case 51:
	       						line_obj.color="#056124";
	       					break;
	       					case 71:
	       						line_obj.color="#c44f27";
	       					break;
	       					case 72:
	       						line_obj.color="#416e3b";
	       					break;
	       					case 73:
	       						line_obj.color="#000000";
	       					break;
	       					}
	       				}
				       	
	       				if (rule == 0)
	       				{
	       					for (j=0 ; j<nodesX.length ; j++)
	       					{
	       						var x = (309947+parseInt(nodesX[j].firstChild.nodeValue));
	       						var y = (552079+parseInt(nodesY[j].firstChild.nodeValue));
	       						var pt = new JPoint(x, y);
	       						line_obj.addPoints(pt);
				   			
	       						if (boundary.left > x) boundary.left=x;
	       						if (boundary.right < x) boundary.right=x;
	       						if (boundary.top < y) boundary.top=y;
	       						if (boundary.bottom > y) boundary.bottom=y;
	       					}
	       				}
	       				else if (rule == 1)
	       				{
	       					for (j=0 ; j<nodesX.length ; j++)
	       					{
	       						var x = (309947+parseInt(nodesX[j].firstChild.nodeValue));
	       						var y = (552079+parseInt(nodesY[j].firstChild.nodeValue));
	       						var pt = new JPoint(x, y);
	       						line_obj.addPoints(pt);
				       			
	       						if (boundary.left > x) boundary.left=x;
	       						if (boundary.right < x) boundary.right=x;
	       						if (boundary.top < y) boundary.top=y;
	       						if (boundary.bottom > y) boundary.bottom=y;
	       					}
	       				}
	       				else if (rule == 2)
	       				{
	       					var j=0;
	       					var k=nodesX.length - 1;
	       					for (j=0 ; j<Math.floor(nodesX.length) ; j+=2)
	       					{
	       						var x = (309947+parseInt(nodesX[j].firstChild.nodeValue));
	       						var y = (552079+parseInt(nodesY[j].firstChild.nodeValue));
	       						var pt = new JPoint(x, y);
	       						line_obj.addPoints(pt);
				       			
	       						if (boundary.left > x) boundary.left=x;
	       						if (boundary.right < x) boundary.right=x;
	       						if (boundary.top < y) boundary.top=y;
	       						if (boundary.bottom > y) boundary.bottom=y;
	       					}
				       		
	       					var startIndex;
	       					if(nodesX.length%2==0) startIndex = nodesX.length-1;
	       					else startIndex = nodesX.length-2;
				       		
	       					for (j=startIndex ; j>1 ; j-=2)
	       					{
	       						var x = (309947+parseInt(nodesX[j].firstChild.nodeValue));
	       						var y = (552079+parseInt(nodesY[j].firstChild.nodeValue));
	       						var pt = new JPoint(x, y);
	       						line_obj.addPoints(pt);
				       			
	       						if (boundary.left > x) boundary.left=x;
	       						if (boundary.right < x) boundary.right=x;
	       						if (boundary.top < y) boundary.top=y;
	       						if (boundary.bottom > y) boundary.bottom=y;
	       					}
	       				}
	       				else if (rule == 3)
	       				{
	       					var j=0;
	       					for (j=0 ; j<Math.floor(nodesX.length/2) ; j++)
	       					{
	       						var x = (309947+parseInt(nodesX[j*2+1].firstChild.nodeValue));
	       						var y = (552079+parseInt(nodesY[j*2+1].firstChild.nodeValue));
	       						var pt = new JPoint(x, y);
	       						line_obj.addPoints(pt);
				       			
	       						if (boundary.left > x) boundary.left=x;
	       						if (boundary.right < x) boundary.right=x;
	       						if (boundary.top < y) boundary.top=y;
	       						if (boundary.bottom > y) boundary.bottom=y;
	
	        					var x = (309947+parseInt(nodesX[j*2].firstChild.nodeValue));
	       						var y = (552079+parseInt(nodesY[j*2].firstChild.nodeValue));
	       						var pt = new JPoint(x, y);
	       						line_obj.addPoints(pt);
				       			
	       						if (boundary.left > x) boundary.left=x;
	       						if (boundary.right < x) boundary.right=x;
	       						if (boundary.top < y) boundary.top=y;
	       						if (boundary.bottom > y) boundary.bottom=y;
	       					}
	        				if (nodesX.length%2 != 0)
	       					{
	       						var x = (309947+parseInt(nodesX[j*2].firstChild.nodeValue));
	       						var y = (552079+parseInt(nodesY[j*2].firstChild.nodeValue));
	       						var pt = new JPoint(x, y);
	       						line_obj.addPoints(pt);
				       			
	       						if (boundary.left > x) boundary.left=x;
	       						if (boundary.right < x) boundary.right=x;
	       						if (boundary.top < y) boundary.top=y;
	       						if (boundary.bottom > y) boundary.bottom=y;
	       					}
	      				}
	       				else if (rule == 4)
	       				{
	       					if (nodesX.length % 2 == 0)
	       					{
	       						for (j=Math.floor(nodesX.length/2) ; j<nodesX.length ; j++)
	       						{
	       							var x = (309947+parseInt(nodesX[j].firstChild.nodeValue));
	       							var y = (552079+parseInt(nodesY[j].firstChild.nodeValue));
	       							var pt = new JPoint(x, y);
	       							line_obj.addPoints(pt);
					       			
	       							if (boundary.left > x) boundary.left=x;
	       							if (boundary.right < x) boundary.right=x;
	       							if (boundary.top < y) boundary.top=y;
	       							if (boundary.bottom > y) boundary.bottom=y;
	       						}
	       					}
	       					else
	       					{
	       						for (j=Math.floor(nodesX.length/2) + 1 ; j<nodesX.length ; j++)
	       						{
	       							var x = (309947+parseInt(nodesX[j].firstChild.nodeValue));
	       							var y = (552079+parseInt(nodesY[j].firstChild.nodeValue));
	       							var pt = new JPoint(x, y);
	       							line_obj.addPoints(pt);
	       							if (boundary.left > x) boundary.left=x;
	       							if (boundary.right < x) boundary.right=x;
	       							if (boundary.top < y) boundary.top=y;
	       							if (boundary.bottom > y) boundary.bottom=y;
	       						}
	       					}
	       					for (j=0 ; j<Math.floor(nodesX.length/2) ; j++)
	       					{
	       						var x = (309947+parseInt(nodesX[j].firstChild.nodeValue));
	       						var y = (552079+parseInt(nodesY[j].firstChild.nodeValue));
	       						var pt = new JPoint(x, y);
	       						line_obj.addPoints(pt);
				       			
	       						if (boundary.left > x) boundary.left=x;
	       						if (boundary.right < x) boundary.right=x;
	       						if (boundary.top < y) boundary.top=y;
	       						if (boundary.bottom > y) boundary.bottom=y;
	       					}
	       				}
	       				//mapObj.addOverlay(line_obj);
	       				lane_obj.push(line_obj);
	       				
	       				if(startMark.isShow())
	       				{
	       					var x = startMark.x;
	       					var y = startMark.y;
	       					if (boundary.left > x) boundary.left=x;
	       					if (boundary.right < x) boundary.right=x;
	       					if (boundary.top < y) boundary.top=y;
	       					if (boundary.bottom > y) boundary.bottom=y;
	       				}
	       				if(endMark.isShow())
	       				{
	       					var x = endMark.x;
	       					var y = endMark.y;
	       					if (boundary.left > x) boundary.left=x;
	       					if (boundary.right < x) boundary.right=x;
	       					if (boundary.top < y) boundary.top=y;
	       					if (boundary.bottom > y) boundary.bottom=y;
	       				}
	       				mapObj.setBound(boundary.left,boundary.top,boundary.right,boundary.bottom);
	       			}
        		}

				nodes = xml.getElementsByTagName("ExPos");
				if (nodes.length > 0)
				{
					for (i = 0 ; i < nodes.length ; i++)
					{
						var nodesX = nodes[i].getElementsByTagName("X");
						var nodesY = nodes[i].getElementsByTagName("Y");
		       			var x = (309947+parseInt(nodesX[0].firstChild.nodeValue));
		       			var y = (552079+parseInt(nodesY[0].firstChild.nodeValue));
		       			var mark_obj = new JMark(new JPoint(x, y), new JIcon("./Resource/Image/symbol/img_change.gif", new JSize(66,59), new JPoint(33,59)));
		       			//mapObj.addOverlay(mark_obj);
					    
		       			lane_obj.push(mark_obj);
					}
				}
				show_lane();        
			}
			//--------------------------------------- 노선 표시 (폴리라인) --------------------------------- 끝 //




-->


