

/***********************************************************
	CLASS NAME	:	MAPLOAD
	작성자		:	김정대
	처리내용		: 	지도 정의
**********************************************************/
var map;
var G_XPOS , G_YPOS ,G_SCALE;
var yourMapType;
var MAP_NULL_MARK=-1;
var MAP_START_MARK=0;
var MAP_DEST_MARK=1;
var MAP_VIA_MARK=2;
var mapMark = MAP_NULL_MARK;
var mapMarkListener = null;
//출발지 목적지 경유지 담을 마크 배열 변수
var roadMark = new Array();	
//초기화 [출발지, 목적지,경유지1, 경유지 2]
roadMark[0]="",roadMark[1]="",roadMark[2]="",roadMark[3]="";
	/**----------------------------
	처리내용		:지도 생성
	-----------------------------**/
var MAPLOAD = {
	mapIMG :null,
	create : function(nWidth , nHeight ,  xpos , ypos , nControl , nScale, nDivName) {
	
		var div_Name = '';		
		if(nDivName&&nDivName!=''){div_Name =nDivName;}else{div_Name = "map";}
		
		var imsiWidth = 400;
		var imsiHeight = 400;
		if(nWidth&&nWidth!='0'){imsiWidth = eval(nWidth);}
		if(nHeight&&nHeight!='0'){imsiHeight = eval(nHeight);}
		
		var control_index = 2;
		if(nControl&&nControl!='0'){control_index = nControl;}else{control_index='null';}
		
		var imsixpos = 317800 , imsiypos = 544488;
		if(xpos&&xpos!='0'){imsixpos = eval(xpos);}
		if(ypos&&ypos!='0'){imsiypos = eval(ypos);}
		
		var imsiScale=3;
		if(nScale&&nScale!='0'){imsiScale = eval(nScale);}
		
		//전역변수에 셋팅;
		G_XPOS = imsixpos;
		G_YPOS = imsiypos;
    		G_SCALE = imsiScale;
    		
		map = new WitMap(document.getElementById(div_Name));

		// 초기 지도의 크기 설정
		document.getElementById(div_Name).style.width=imsiWidth;
		document.getElementById(div_Name).style.height=imsiHeight;
		map.initialize(new WitPoint(imsixpos,imsiypos), imsiScale, imsiWidth, imsiHeight, control_index);
		
		WitEvent.addListener(map, 'click', function(a,b){ 
			map.setMapPoint(a,b);
		});
	}	
}
	/**----------------------------
	처리내용		:지도 리로드
	-----------------------------**/
MAPLOAD.reLoad = function() {
	map.centerAndZoom(new WitPoint(G_XPOS,G_YPOS),G_SCALE);
	//기존 Mark 변수 초기화
	roadMark = new Array();	
}

	/**----------------------------
	처리내용		:지도 아이콘 초기화
	-----------------------------**/
MAPLOAD.ClearOverlay = function() {
	map.clearOverlays();
}
	/**----------------------------
	처리내용		:지도 크기 재 조정
	-----------------------------**/
MAPLOAD.reSize = function(nWidth , nHeight){
	map.resize(new WitSize(nWidth , nHeight));	
}
	/**----------------------------
	처리내용		:txt 파일로 저장된 경로데이터로 경로 그리기
	-----------------------------**/
MAPLOAD.DrawPath = function(oj){ 	
	var color="#000000";
	var width=7;
	var opacity=0.8;
	var pathData = oj.responseText;		
	
	var points=new Array();
	var coord=pathData.trim();
	var coordArr = coord.split(",");
	for (var i = 0,j=0; i < coordArr.length; ) {
		var xVal = coordArr[i++];
		var yVal = coordArr[i++];
		points[j]=new WitPoint(xVal,yVal);
		j++;
	}
	if(!points){return;}
	map.addOverlay(new WitPath(points,color,width,opacity));
} 

	/**----------------------------
	처리내용		:지도 이미지 처리
	-----------------------------**/
MAPLOAD.IMG = function(nType , nZoom , nWidth ,nHeight , rpFile , icParam , nStyle , nCp,nPathType){
	
		if(nCp){
			var param = "?type1="+nType+"&zoom="+nZoom+"&width="+nWidth+"&height="+nHeight+"&rp_file=" + rpFile + "&cp="+nCp+"&pathtype="+nPathType+"&"+icParam;	
		}else{
			var param = "?type1="+nType+"&zoom="+nZoom+"&width="+nWidth+"&height="+nHeight+"&rp_file=" + rpFile + "&pathtype="+nPathType+"&"+icParam;
		}		
		if(!nStyle){var imsiStyle = "style='border:1px solid #666666;'";}else{imsiStyle = nStyle;}
		
		return "<img src=" + GETMAPIMAGE_PAGE +param + " width="+nWidth+" height="+nHeight+" " + imsiStyle+ ">";
}

	/**----------------------------
	처리내용		:지점 확대-1
	-----------------------------**/
MAPLOAD.Blowup = function(x,y){
	var point = new WitPoint(x,y);
	map.showMapBlowup(point,0,yourMapType);
}
	/**----------------------------
	처리내용		:지점 확대-2
	-----------------------------**/
MAPLOAD.BlowupZoom = function(x,y,zoomMode){
	//alert(x+':'+y+':'+zoomMode);
	var point = new WitPoint(x,y);
	map.centerAndZoom(point,zoomMode*1);
} 
	/**----------------------------
	처리내용		:지점 확대-3 [대표경로]
	-----------------------------**/
MAPLOAD.PathBlowup = function(idx){
	map.showMapBlowup(G_MARKER_POINTS[idx],0,yourMapType);
}

MAPLOAD.ShowWinCenter = function(markerId,x,y,zIdx){
	var marker= map.getMarkerById(markerId);
	var point=new WitPoint(x,y);	//해당 지점을 생성한다
	if(zIdx){
		map.centerAndZoom(point,zIdx);
	}else{
		map.centerAndZoom(point,6);
	}
	marker.openWindow();
}

	/**----------------------------
	처리내용		:지도위에 직접 설정하기 
	-----------------------------**/
MAPLOAD.setSRMark = function(valMark , icon , nWidth , nHeight , srMode){
		
		if(mapMark == valMark){
			return;
		}
		
		if(valMark == MAP_NULL_MARK){
			mapMark = MAP_NULL_MARK;
			return;
		}

		var imsiWidth = 12;
		var imsiHeight = 12;
		if(nWidth&&nWidth!='0'){imsiWidth = eval(nWidth);}
		if(nHeight&&nHeight!='0'){imsiHeight = eval(nHeight);}
		
		if(mapMarkListener)
			WitEvent.removeListener(mapMarkListener);

		mapMark = valMark;
	
		mapMarkListener = WitEvent.addListener(map,'click', function(marker,point){
			
			//document.all.map.style.cursor = "move";
			
			if(mapMark == MAP_NULL_MARK){
				return;
			}
			if(marker){
				newPoint = marker.point;
			}else{
				newPoint = point;
			}
			var imsi_icon=location_point_img;
			if(icon){
				imsi_icon = icon;
			}
			
			if(!roadMark[mapMark]){
				roadMark[mapMark] = MAPLOAD.IconMark(mapMark,newPoint, imsi_icon , imsiWidth,imsiHeight);
				MAPLOAD.AddRoadMark(mapMark);
			}else{
				roadMark[mapMark].point=newPoint;
				roadMark[mapMark].redraw(true);
			}

			map.zoomTo(0);

			var x ,y;
			x = roadMark[mapMark].point.x;
			y = roadMark[mapMark].point.y; 

			if(mapMark == 2) {
				document.getElementById("pstn_x_2").value = x;							
				document.getElementById("pstn_y_2").value = y;							
			}else if(mapMark == 5) {
				document.getElementById("pstn_x_2").value = x;							
				document.getElementById("pstn_y_2").value = y;
			}else if(mapMark == 7) {
				document.getElementById("pstn_x_2").value = x;							
				document.getElementById("pstn_y_2").value = y;
			}else if(mapMark == 9) {
				document.getElementById("pstn_x_2").value = x;							
				document.getElementById("pstn_y_2").value = y;
			}else if(mapMark == 23) {
				document.getElementById("pstn_x_2").value = x;							
				document.getElementById("pstn_y_2").value = y;
			}else if(mapMark == 24) {
				document.getElementById("pstn_x_3").value = x;							
				document.getElementById("pstn_y_3").value = y;
			}else if(mapMark == 28) {
				document.getElementById("pstn_x_2").value = x;							
				document.getElementById("pstn_y_2").value = y;
			}else if(mapMark == 32) {
				document.getElementById("pstn_x_2").value = x;							
				document.getElementById("pstn_y_2").value = y;
			}else if(mapMark == 33) {
				document.getElementById("pstn_x_3").value = x;							
				document.getElementById("pstn_y_3").value = y;
			}else if(mapMark == 100) {
				document.getElementById("pstn_x_4").value = x;							
				document.getElementById("pstn_y_4").value = y;
			}else {
				document.getElementById("pstn_x_1").value = x;							
				document.getElementById("pstn_y_1").value = y;				
			}
			get_katech(x,y);
			
		});	
		
	};
	
MAPLOAD.delSRMark = function(valMark){
		if(mapMarkListener)
			WitEvent.removeListener(mapMarkListener);
		var marker = map.getMarkerById(valMark);
		map.removeOverlay(marker);
	};
	
	
MAPLOAD.CreateRoadMark = function(mark, point){
		var mapModeIcon = map.getBaseIcon(67,28);
		
		if(mark == MAP_START_MARK){
			mapModeIcon.image = startModeIcon_img;
		}else if(mark == MAP_DEST_MARK){
			mapModeIcon.image = destModeIcon_img;
		}else{
			var iconNum = parseInt(mark)-1;
			var viaModeIcon_img = viaModeIcon_img_folder + iconNum.toString() + ".gif";
			mapModeIcon.image = viaModeIcon_img;
		}
		
		mapMark = mark;
		return new WitMarker(point, mapModeIcon);
	}
	
MAPLOAD.IconMark = function (mark, point , icon , nWidth,nHeight){
		
		var imsiWidth = 12;
		var imsiHeight = 12;
		if(nWidth&&nWidth!='0'){imsiWidth = eval(nWidth);}
		if(nHeight&&nHeight!='0'){imsiHeight = eval(nHeight);}
		
		var mapModeIcon = map.getBaseIcon(imsiWidth,imsiHeight);
			mapModeIcon.image = icon;
		mapMark = mark;
		return new WitMarker(point, mapModeIcon);
	}

MAPLOAD.AddRoadMark=function(mark){
		if(roadMark[mark]){
			map.addOverlay(roadMark[mark]);
		}
	}

MAPLOAD.MarkerINIT = function(vMarker){

	mapMark = MAP_NULL_MARK;
	roadMark[vMarker]="";	
}


/***********************************************************
	CLASS NAME	:	MAPHTML
	작성자		:	김정대
	처리내용		: 	지도위에 말풍선 UI 출력 관련 정의
	사용 법		:	
	*	MAPHTML.create(poiname , xpos ,ypos , poiAddr , poiCategory ,poitel, poiImg, nWidth , SRmode ,zoomMode , zoomLevel,ohtml , targetUrlLink);
	- poiname : 지점명
	- xpos : 지점 x 좌표값
	- ypos : 지점 y 좌표값
	- poiAddr : 지점 주소값
	- poiCategory : 카테고리 명 
	- poitel : 전화번호
	- poiImg : 지점 이미지 경로 (/img/xxx.gif)
	- nWidth : 말풍선 width 값 
	- SRmode : 경로 탐색 html 출력 여부 [1:미 출력 / 2 : 출력]
	- zoomMode : 확장 옵션 [1과 2 사용 서로 다른 모슴의 확장 지도 표현]
	- zoomLevel : 확장 옵션[zoomMode]이 2일 경우에만 쓰임 zoom level 값 
	- ohtml	:	기타 추가적인 문구 삽입시 html로 넘기되 escape로 처리하여 받을시에는 unescape로 출력
	- targetUrlLink : 말풍선에 출력되는 지점명에 링크 주소
***********************************************************/
var MAPHTML = { 
	USER_ID:null,
	myPois:null,
	html:null,
	create : function(poiname , xpos ,ypos , poiAddr , poiCategory ,poitel, poiImg, nWidth , SRmode ,zoomMode , zoomLevel , ohtml , targetUrlLink){
		
 		var html="";
 		var tWidth=300;
 		var tDest = poiname;
 		
 		var tImg = poiImg;
 		//지점명과 주소명이 같을 시에는 관할 행정구청 이미지로 표시 
 		if(poiname.trim()==poiAddr.trim()){tImg="/images/local/search/03.gif";}
 		if(!poiname){tImg="/images/local/search/03.gif";}
 		
 		var tZoomLevel = 0 ;
 		//var tDest=poiname;
 		var tHtml ='';
 		if(poiname==""){tDest = poiAddr;}
 		if(tDest==""){tDest = "[NO POI NAME!]";}
 		if(ohtml){tHtml = unescape(ohtml);}
 		if(nWidth){tWidth = nWidth;}
 		
 		if(targetUrlLink){
 			targetUrlLink= "<a href='"+unescape(targetUrlLink)+"' target='_blank'><span class='poi07'>"+tDest+"</span></a>";
 		}else{ 
 			targetUrlLink = tDest;
 		}
 		var img_id = "img_"+xpos + "_" + ypos;
 			html +="		<table cellpadding='0' cellspacing='0' border='0' width='"+tWidth+"'>";
 			html +="			<tr>";
 			html +="				<td style='padding:1 0 3 0' class='b dot_line poi07' colspan='2'>" + targetUrlLink  + "</td>"; 
 			html +="			</tr>";
 			html +="			<tr>";
 			html +="				<td width=70 style='padding-top:3px;padding-right:2px;'>";
			//html +="					<div style='padding-bottom:3px;'><a href='#' onfocus='this.blur()'><img src='"+tImg+"' id='"+img_id+"' width='75' height='56' onError="+img_id+".src='/images/noimage/noimage76.gif'></a></div>";
			html +="					<div style='padding-bottom:3px;padding-top:3px;'><img src='"+tImg+"' id='"+img_id+"' width='75' height='56' onError="+img_id+".src='/images/noimage/noimage76.gif'></div>";
			if(zoomMode=="1"){
			html +="					<div><a href=javascript:MAPLOAD.Blowup('" + xpos +"','" + ypos +"'); onfocus='this.blur()'><img src='/images/guide/common/btn_branch_expansion.gif' alt='지점확대'></a></div>				";
			}else if(zoomMode=="2"){
				if(zoomLevel){tZoomLevel = zoomLevel}
			html +="					<div><a href=javascript:MAPLOAD.BlowupZoom('" + xpos +"','" + ypos +"',"+tZoomLevel+"); onfocus='this.blur()'><img src='/images/guide/common/btn_branch_expansion.gif' alt='지점확대'></a></div>				";
			}
 			html +="				</td>";
 			html +="				<td width='100%' valign=top  style='padding:3 0 3 0;'>";
 			if(poiCategory){
 			html +="					<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
 			html +="						<tr>";
 			html +="							<td width='10%'><span class='left_mapblog'>" +poiCategory + "</span></td>";
 			html +="						</tr>";
 			html +="					</table>";
 			}
 			if(poitel){
 			html +="					<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
 			html +="						<tr>";
 			html +="							<td width='10%'><span class='left_mapblog'>" +poitel + "</span></td>";
 			html +="						</tr>";
 			html +="					</table>";
 			}
 			if(poiAddr){
 			html +="					<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
 			html +="						<tr>";
 			html +="							<td width='10%'><span class='left_mapblog'>" +poiAddr + "</span></td>";
 			html +="						</tr>";
 			html +="					</table>";
 			}
 			if(tHtml){
 			html +="					<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
 			html +="						<tr>";
 			html +="							<td width='100%' style='padding-top:3px;'>"+tHtml+"</td>";
 			html +="						</tr>";
 			html +="					</table>";
 			}
 			html +="				</td>";
 			html +="			<tr>";

 			if(SRmode=="2"){		//경로 검색 html 출력
 				var uid = xpos + "_" + ypos;
 			html +="			<tr>";
 			html +="				<td colspan=2 align=right>";
 			html +="				<span id='ctl_map_sr_div1'><img src='/images/icon/search/head.gif' align='absmiddle' style='margin-right:5px;'> <a onClick=mapVia_div_"+uid+".style.display='block';ctl_map_sr_div1.style.display='none';ctl_map_sr_div2.style.display='block'; style='cursor:hand;'><font color='#C19849'>경로검색 Open</font></a></span>";
 			html +="				<span id='ctl_map_sr_div2' style='display:none;'><img src='/images/icon/search/head.gif' align='absmiddle' style='margin-right:5px;'> <a onClick=mapVia_div_"+uid+".style.display='none';ctl_map_sr_div1.style.display='block';ctl_map_sr_div2.style.display='none';SR_POI_VIA_1_"+uid+".style.display='none';SR_POI_VIA_2_"+uid+".style.display='none'; style='cursor:hand;'><font color='#C19849'>경로검색 Close</font></a></span>";
 			html +="				</td>";
 			html +="			</tr>";
 			html +="			<tr>";
 			html +="				<td colspan=2>";

 			if(tDest.indexOf("<b>")!=-1){tDest = tDest.replace("<b>" , "");tDest = tDest.replace("</b>" , "");}	

 			html +="		<form name='mapHtmlFrm_"+uid+"' method='post' onsubmit='javascript:return false;'> ";
			html+="		<input type='hidden' name='SN' value=''>";
			html+="		<input type='hidden' name='S_POS' value=''>";
			html+="		<input type='hidden' name='EN' value='"+tDest+"'>";
			html+="		<input type='hidden' name='E_POS' value='"+xpos+","+ypos+"'>";
			html+="		<input type='hidden' name='VN1' value=''>";
			html+="		<input type='hidden' name='V1_POS' value=''>";
			html+="		<input type='hidden' name='VN2' value=''>";
			html+="		<input type='hidden' name='V2_POS' value=''>";
			html+="		<input type='hidden' name='RO' value='B'>";
			html +="		<span id='mapVia_div_"+uid+"' style='display:none;'>";
 			html +="		<table cellpadding='0' cellspacing='0' border='0' width='100%' bgcolor='#F8F8F8' style='border:2px solid #E5E5E5;'>";
 			html +="			<tr><td height=3></td><tr>";
 			html +="			<tr>";
 			html +="				<td width='100%' border=0 valign=top style='padding:3 0 5 5;'>";
 			html +="				<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
 			html +="					<tr>";
 			html +="						<td ><input type=checkbox id='searchArea01' name='searchArea01' value='1' checked onClick=\"searchArea02.checked=false;mainSearchDiv1.style.display='block';mainSearchDiv2.style.display='none';MAPHTML.hiddenReSet('"+uid+"');\"> 지점검색 &nbsp;&nbsp;";
 			if(MAPHTML.USER_ID==""){
 			html +="						<input type=checkbox id='searchArea02' name='searchArea02' value='2' onClick=\"javascript:callPopLoginWin('opener' , '/road/');\"> 내 지점 가져오기";
 			}else{
 			html +="						<input type=checkbox id='searchArea02' name='searchArea02' value='2' onClick=\"searchArea01.checked=false;mainSearchDiv1.style.display='none';mainSearchDiv2.style.display='block';MAPHTML.hiddenReSet('"+uid+"');\"> 내 지점 가져오기";
 			}
 			html +="						</td>";
 			html +="					</tr>";
 			html +="					<tr>";
 			html +="						<td>";
 			html +="						<div id='mainSearchDiv1'>";
 			html +="						<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
 			html +="							<tr>";
 			html +="								<td  width='50%'><span id='SR_POI_"+uid+"'><input type=text name='SR_POI_"+uid+"_KEYWORD'  onKeydown=\"javascript:MAPHTML.checkSpace(event,'SR_POI_"+uid+"','"+uid+"','START');\" value='출발지를 입력하세요' onFocus=\"javascript:MAPHTML.setTxtEmptyBox(this);\" class='text' size=20 ></span></td>";
 			html +="								<td align=left><a href=\"javascript:MAPHTML.openWindRoad('SR_POI_"+uid+"','"+uid+"','START');\" onfocus='this.blur();'><img src='/images/guide/common/btn_srch.gif' border=0></a></td>";
 			html +="							</tr>";
 			html +="						</table>";
 			html +="						</div>";
 			html +="						<div id='mainSearchDiv2' style='display:none;'>";
 			html +="						<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
 			html +="							<tr>";
 			html +="								<td  width='50%'><select name='SR_POI_"+uid+"_OPT'>";
 			var POIs = unescape(MAPHTML.myPois).split("^");
 			if(POIs.length-1>0){
	 			for(var m=0 ; m<POIs.length ; m++){
	 					if(POIs[m]){
	 						var poiVal = POIs[m].split("|")[0]+"|"+POIs[m].split("|")[2] +"|"+ POIs[m].split("|")[3]+"|"+POIs[m].split("|")[1];		
	 						html +="	<option value='" + poiVal + "'>"+POIs[m].split("|")[1]+"</option>"		
	 					}
	 			}
	 			
 			}else{
 				html +="	<option value=''>등록된 지점이 없습니다.</option>"		
 			}
 			html +="								</select></td>";
 			html +="								<td align=left><a href=\"javascript:MAPHTML.myPOICall('"+uid+"');\" onfocus='this.blur();'><img src='/images/road/common/ok_btn.gif' border=0></a></td>";
 			html +="							</tr>";
 			html +="						</table>";
 			html +="						</div>";
 			html +="						</td>";
 			html +="					</tr>";
 			html +="					<tr>";
 			html +="						<td height=25 ><span id='add_via_1'><img src='/images/icon/search/head.gif' align='absmiddle' style='margin-right:5px;'><a onClick=SR_POI_VIA_1_"+uid+".style.display='block';add_via_2.style.display='block';add_via_1.style.display='none'; style='cursor:hand;'><span class='line' style='color:#75AC09;'>경유지 추가</span></a></span>";
 			html +="<span id='add_via_2' style='display:none;'><img src='/images/icon/search/head.gif' align='absmiddle' style='margin-right:5px;'><a onClick=SR_POI_VIA_2_"+uid+".style.display='block';add_via_2.style.display='none';add_via_1.style.display='block'; style='cursor:hand;'><span class='line' style='color:#75AC09;'>경유지 추가</span></a></span></td>";
 			html +="					</tr>";
 			html +="					<tr>";
 			html +="						<td >";
			html+="							<div style='padding:0 0 5 0px;' id='SR_POI_VIA_1_"+uid+"' style='display:none;'>";
			html+="								<span class='left_mapblog'>경유지</span> <input type='Text' name='SR_POI_VIA_1_"+uid+"_KEYWORD' value='경유지를 입력하세요' class='text' style='width:120px;margin-left:10px;' onFocus=\"javascript:MAPHTML.setTxtEmptyBox(this);\" onKeydown=\"javascript:MAPHTML.checkSpace(event,'SR_POI_VIA_1_"+uid+"','"+uid+"','VIA_1');\"> <a href=\"javascript:MAPHTML.openWindRoad('SR_POI_VIA_1_"+uid+"','"+uid+"','VIA_1');\" onfocus='this.blur()'><img src='/images/search/btn/search.gif' align='absmiddle' style='margin-right:10px;'></a>";
			html+="								<a onClick=SR_POI_VIA_1_"+uid+".style.display='none';document.mapHtmlFrm_"+uid+".VN1.value='';document.mapHtmlFrm_"+uid+".V1_POS.value=''; style='cursor:hand;'><span class='poi_gray2'>[삭제]</span></a>";
			html+="							</div>";
			html+="							<div style='padding:0 0 5 0px;' id='SR_POI_VIA_2_"+uid+"' style='display:none;'>";
			html+="								<span class='left_mapblog'>경유지</span> <input type='Text' name='SR_POI_VIA_2_"+uid+"_KEYWORD' value='경유지를 입력하세요' class='text' style='width:120px;margin-left:10px;' onFocus=\"javascript:MAPHTML.setTxtEmptyBox(this);\" onKeydown=\"javascript:MAPHTML.checkSpace(event,'SR_POI_VIA_2_"+uid+"','"+uid+"','VIA_2');\"> <a href=\"javascript:MAPHTML.openWindRoad('SR_POI_VIA_2_"+uid+"','"+uid+"','VIA_2');\" onfocus='this.blur()'><img src='/images/search/btn/search.gif' align='absmiddle' style='margin-right:10px;'></a>";
			html+="								<a onClick=SR_POI_VIA_2_"+uid+".style.display='none';document.mapHtmlFrm_"+uid+".VN2.value='';document.mapHtmlFrm_"+uid+".V2_POS.value=''; style='cursor:hand;'><span class='poi_gray2'>[삭제]</span></a>";
			html+="							</div>";
			html+="							<div class='left_mapblog' style='padding-top:5'>목적지 : <b>"+tDest+"</b>&nbsp; <a href=\"javascript:MAPHTML.RoadSearch('"+uid+"');\" onfocus='this.blur()'><img src='/images/search/btn/path_srch.gif' align='absmiddle' style='margin-left:5px;'></a></div>";
			html +="						</td>";
			html +="					</tr>";
 			html +="				</table>";
 			html +="				</td>";
 			html +="			</tr>";
 			html +="		</table>";
 			html +="		</span>";
 			html +="		</form>";
 			html +="				</td>";
 			html +="			</tr>";			
 			}
 			html +="		</table>";
 			MAPHTML.html = escape(html);
	}
}
	/**----------------------------
	처리내용		:TEXTBOX에 포커스 오면 공백 처리
	-----------------------------**/
MAPHTML.setTxtEmptyBox = function(thisFrm){
	if(thisFrm.value=="출발지를 입력하세요" || thisFrm.value=="경유지를 입력하세요"){
			thisFrm.value="";
	}
						
}

MAPHTML.loginPop = function(){
		////javascript:callPopLoginWin('opener' , '/road/');
}
	/**----------------------------
	처리내용		:엔터키
	-----------------------------**/

MAPHTML.checkSpace = function(event,sectionName,uid,mode){
	if(event.keyCode==13){
		MAPHTML.openWindRoad(sectionName,uid,mode);
	}
}
MAPHTML.hiddenReSet = function(uid){
	eval("document.mapHtmlFrm_"+uid+".SN").value="";
	eval("document.mapHtmlFrm_"+uid+".S_POS").value="";
}
	/**----------------------------
	처리내용		:지점 검색 페이지 호출 
	-----------------------------**/
MAPHTML.openWindRoad = function (sectionName,uid,mode)
{
	var kw = eval("document.mapHtmlFrm_"+uid+"."+sectionName+"_KEYWORD");
	if(isEmpty(kw.value) || kw.value=="경유지를 입력하세요" || kw.value=="출발지를 입력하세요"){
		alert("검색어를 입력해 주세요");
		kw.focus();
		return;
	}else{
		var mode2 = "";
		if(mode =="START"){mode2 = mode;}
		else{mode2 = "VIA";}
		
		var sa1 = 0 , sa2 = 0;
		if(eval("document.mapHtmlFrm_"+uid+".searchArea01").checked){sa1=1;}
		if(eval("document.mapHtmlFrm_"+uid+".searchArea02").checked){sa2=2;}
		
		var param = "?Keyword_Mode="+mode+"&KEYWORD="+kw.value+"&searchArea01="+sa1+"&searchArea02="+sa2+"&searchMode="+mode2+"&divname="+sectionName+"&divNum="+uid+"&formName=mapHtmlFrm_"+uid;
		
		var targetWin = "/road/pop_poi_search_frm.asp" + param ;
		window.open(targetWin, "SearchRoadPopWin","width=400 , height=650, scrollbars=no,resizable=yes,menubar=no,status=yes,toolbar=no,location=no");
	}
} 

MAPHTML.myPOICall = function(uid){	
	var optVal = eval("document.mapHtmlFrm_"+uid+".SR_POI_"+uid+"_OPT").value;
	
	if(optVal){
		var x = optVal.split("|")[1];
		var y = optVal.split("|")[2];
		var poiName = optVal.split("|")[3];
		eval("document.mapHtmlFrm_"+uid+".SN").value = poiName;
		eval("document.mapHtmlFrm_"+uid+".S_POS").value = x +"," + y;	
	}else{
		MAPHTML.hiddenReSet(uid);
		alert("선택된 지점이 없습니다.");
	}
}
	/**----------------------------
	처리내용		:지점 검색에서 선택된 지점을 부모창 HIDDEN 값에 셋팅  
	-----------------------------**/
MAPHTML.setPOIINFOValue = function(Pid,X,Y,PoiName,sectionName,uid,mode){
	
	//현재 사용안하는 파라미터 : Pid 	
	if(mode =="START"){
		eval("document.mapHtmlFrm_"+uid+"."+sectionName+"_KEYWORD").value = PoiName;
		eval("document.mapHtmlFrm_"+uid+".SN").value = PoiName;
		eval("document.mapHtmlFrm_"+uid+".S_POS").value = X +"," + Y;
	}else if(mode =="VIA_1"){
		eval("document.mapHtmlFrm_"+uid+"."+sectionName+"_KEYWORD").value = PoiName;
		eval("document.mapHtmlFrm_"+uid+".VN1").value = PoiName;
		eval("document.mapHtmlFrm_"+uid+".V1_POS").value = X +"," + Y;	
	}else if(mode =="VIA_2"){
		eval("document.mapHtmlFrm_"+uid+"."+sectionName+"_KEYWORD").value = PoiName;
		eval("document.mapHtmlFrm_"+uid+".VN2").value = PoiName;
		eval("document.mapHtmlFrm_"+uid+".V2_POS").value = X +"," + Y;	
	}
}

	/**----------------------------
	처리내용		:경로 탐색 
	-----------------------------**/
MAPHTML.RoadSearch = function(uid){
	var doc = eval("document.mapHtmlFrm_"+uid);
	if(isEmpty(doc.SN.value)){alert("출발지를 입력하세요");return;}
	var winName;
	winName = window.open("", "SearchRoadPopWin2","width=700 , height=750, top=100 , left=200,scrollbars=yes,resizable=no,menubar=no,status=yes,toolbar=no,location=no");
	doc.action = "/road/pop_search_frm.asp";
	doc.target = "SearchRoadPopWin2";
	if(winName){
		doc.submit();
		winName.focus();
	}
}
