// Javascript - Actionscript  Interface functions
//
// ==========================================================
//  이벤트 메서드(필수)  !! 메서드명 변경불가
// ==========================================================

var g_nMinX = 999999999;
var g_nMinY = 999999999;
var g_nMaxX = 0;
var g_nMaxY = 0;
var arrSymbolIndex = new Array();
var LBCFlashMap;
//  맵 등장
function MapExist(){
    /* Initialization code. */
	LBCFlashMap = document.getElementById('LBCFlashMap');
	LBCFlashMap.SetImageURL("http://imap.lbcsoft.com/");// 이미지 서버 지정
	//LBCFlashMap.SetLevelNCoord(3, 309901.2, 552063.2);
	/*  마우스 이벤트 등록 */
	if(navigator.appName == "Microsoft Internet Explorer"){
		document.onmousemove = MouseOutFromSwf;
	} else {
	    if (window.addEventListener) {
		    LBCFlashMap.addEventListener('DOMMouseScroll', wheel, false);
			window.addEventListener('mouseup', checkMouseUp, false);
	    }
	    LBCFlashMap.onmousewheel = wheel;
		window.onmouseup = document.onmouseup = checkMouseUp();
    }
    if(arrSymbolIndex.length>0){
        if(location.pathname.indexOf('realty') < 0){
		    ViewSymbol();
		}
		ViewAllResult();
    }
}

//MapSymbol object
function MapSymbol(index, xcoord, ycoord, title, number){
    var index;
	this.index = index;
	this.xcoord = xcoord;
	this.ycoord = ycoord;
	//this.url = url;
	this.title = title;
	this.number = number;
}

//  이미지서버 등록
function SetImageServer(str){
	LBCFlashMap.SetImageServer(str);
}

//  인덱스맵의 로딩 여부
function LoadIndexMap(boolean){
	LBCFlashMap.LoadIndexMap();
	LBCFlashMap.SwitchIndexMapStat(boolean);
}

function init(num){
    if(num==1){
        LoadIndexMap(true);
    } else if(num==2){
        LoadIndexMap(false);
    }
}

//초기화
function initDraw(){
	LBCFlashMap.RemoveAllLineByMouse();
  	LBCFlashMap.DrawAllPolygonRemove();
  	LBCFlashMap.MeasureDistanceStop();
   	LBCFlashMap.MeasureAreaStop();
   	//LBCFlashMap.InitDraw();
}

//이벤트 후 중심좌표 받아오기
function CallScript(){
    var coord = LBCFlashMap.GetObjectCenterCoordinate();
    var level = LBCFlashMap.GetLevel();
    clear_tooltip();
}

// 플래시맵에서 이벤트가 있었던 심볼의 정보를 가지고 있습니다.
// 그 정보를 불러오는 함수 입니다.
// ----->  LBCFlashMap.ReturnSymbolProps();
// 리턴하는 값의 형태입니다.
// ----->  object = {x, y, id, attribute}
function CallTooltipUp(obj){
	overLabel(obj.id);
	//var properties = LBCFlashMap.ReturnSymbolProps();
	//alert(properties.x+' . '+properties.y+' . '+properties.id+''+properties.attribute);
}
function CallTooltipDown(){
	//alert('Mouse Out');
	//LBCFlashMap.ResetSymbolProps();
}
function CallTooltipClick(obj){
//	var properties = LBCFlashMap.ReturnSymbolProps();
//	alert(obj.x+' . '+obj.y+' . '+obj.id+' . '+obj.attribute);
//	symbolCenter(obj.id);
	showInfo(obj.id, '', '');
}
function SetZoomScript(mode){
    clear_tooltip();
	// mode = 1 : 줌인 / mode = 2 : 줌아웃
	//if(mode == 1) alert("ZoomIn");
	//if(mode == 2) alert("ZoomOut");
}
/////////////////////////////////////////////////////////////////////////////////////////////////////

// ==========================================================
//   응용 메서드
// ==========================================================

// 현재 도메인 보기
function domainTrace(){
	var domain = LBCFlashMap.getCurrentDomain();
}

//기본기능
function ZoomIn(){
	LBCFlashMap.ZoomIn();
}
function ZoomOut(){
	LBCFlashMap.ZoomOut();
}

//이동
function Panning(){
    LBCFlashMap.Panning();
}

function GetLevel(){
	var level = LBCFlashMap.GetLevel();
	return level;
}

function SetLevel(level){
    LBCFlashMap.SetLevel(level);
}
// 화면 중심의 실제 좌표값 출력
function GetCenterPoint(){
    var centerPt = LBCFlashMap.GetStringCenterCoordinate();
    return centerPt;
}

function GetCoordinate(){
	var centerPt = LBCFlashMap.GetObjectCenterCoordinate();
	alert(centerPt.x +' . '+centerPt.y);
	return centerPt;
}
function GetMBR(){
	var mbr = LBCFlashMap.GetMBR();
	return mbr;
	//alert("minX: "+mbr[0]+" , "+"minY: "+mbr[1]+" , "+"maxX: "+mbr[2]+" , "+"maxY: "+mbr[3]);
}
// 해당 좌표나 레벨 적용시키기
function MoveMap(x, y){
	LBCFlashMap.MoveMap(x, y);
}
function SetLevelNCoord(lev, x, y){
	LBCFlashMap.SetLevelNCoord(lev, x, y);
}
// 실제좌표의 화면좌표값
function GetScrPoint(x, y){
	var SrcPoint = LBCFlashMap.GetScrPoint(x, y);
	//alert("X:  "+SrcPoint[0]+"  ,  "+"Y:  "+SrcPoint[1]);
	return SrcPoint;
}
// test : 좌표출력(엔터프레임으로)
function ViewCoord(){
	LBCFlashMap.ViewCoord();
}
function StopViewCoord(){
	LBCFlashMap.StopViewCoord();
}
//  부가기능
// x:Number, y:Number, id:String, index:Number, imgW:Number, imgH:Number, url:String, attribute:String, degree:Number, hAlign:String, vAlign:String
//  심볼 추가하기
function AddSymbol(x, y, id, index, imgWidth, imgHeight, url, attribute, degree, hAlign, vAlign){
	LBCFlashMap.AddSymbol(x, y, id, index, imgWidth, imgHeight, url, attribute, degree, hAlign, vAlign);
}
//  index#description#color#size#isBold#outline#bgColor#bgAlpha#X#Y#hAlign#vAlign
function DrawLabel(str){
	LBCFlashMap.DrawLabel(str);
}

// 지우기
function RemoveSymbol(index){
	LBCFlashMap.RemoveSymbol(index);
}
function RemoveLabel(index){
	LBCFlashMap.RemoveLabel(index);
}
function RemoveAllLabel(){
	LBCFlashMap.RemoveAllLabel();
}
function RemoveAllSymbol(){
	LBCFlashMap.RemoveAllSymbol();
}
// 마우스로 심볼 추가하기 / 중지
function AddSymbolStart(){
	LBCFlashMap.AddSymbolStart();
}
function AddSymbolStop(){
	LBCFlashMap.AddSymbolStop();
}

// ==========================================================
// 데이터 값으로 선그리기 / 지우기
function DrawLine(data){
	LBCFlashMap.DrawLine(data);
}
function DrawSimpleLine(data){
	LBCFlashMap.DrawSimpleLine(data);
}
function RemoveLine(id){
	LBCFlashMap.RemoveLine(id);
}
// 선 모두 지우기
function RemoveAllLine(){
	LBCFlashMap.RemoveAllLine();
}

// 마우스로 선그리기
function DrawLineStart(){
	LBCFlashMap.DrawLineStart();
}
function DrawLineStop(){
	LBCFlashMap.DrawLineStop();
}
// 거리 재기 시작 / 끝내기
function MeasureDistanceStart() {
    initDraw();
	LBCFlashMap.MeasureDistanceStart();
}
function MeasureDistanceStop() {
	LBCFlashMap.MeasureDistanceStop();
}
//  지우기
function RemoveLineByMouse(index){
	LBCFlashMap.RemoveLineByMouse(index);
}
function RemoveAllLineByMouse(){
	LBCFlashMap.RemoveAllLineByMouse();
}
function MeasureDistanceRemove(){
	LBCFlashMap.MeasureRemove();
}
// ==========================================================
// 마우스로 면 그리기
function DrawPolygonStart(){
	LBCFlashMap.DrawPolygonStart();
}
function DrawPloygonStop(){
	LBCFlashMap.DrawPolygonStop();
}
// 면적 측정 시작 / 끝내기
function MeasureAreaStart(){
    initDraw();
	LBCFlashMap.MeasureAreaStart();
}
function MeasureAreaStop(){
	LBCFlashMap.MeasureAreaStop();
}
// 면적 지우기
function MeasureAreaRemove(){
	LBCFlashMap.MeasureAreaRemove();
}
// 그린 면 지우기
function DrawPolygonRemove(index){
	LBCFlashMap.DrawPolygonRemove(index);
}
// 그린 면 모두 지우기
function DrawAllPolygonRemove(){
	LBCFlashMap.DrawAllPolygonRemove();
}

// 모든 그려진 객체 지우기
function RemoveAllDraw() {
	LBCFlashMap.RemoveAllDraw();
}

function GetClickPoint(num){
	LBCFlashMap.ReadyToClick(num);
}

// 마우스 좌표 가져오기
function SetClickPoint(obj){
    if(obj.Mode == 1){
		NewWin("pop_urlcopy.aspx?x="+obj.x+"&y="+obj.y, "urlcopy", 600, 350);
	} else if(obj.Mode == 2){
		NewWin('open_map_modify.php?x='+obj.x+'&y='+obj.y,'modify',577,735);
	} else if(obj.Mode == 3){
		area_mark(obj.x,obj.y,'start','');
	} else if(obj.Mode == 4){
		area_mark(obj.x,obj.y,'end','');
	} else if(obj.Mode == 5){
		area_mark(obj.x,obj.y,'thru1','');
	} else{
		area_mark(obj.x,obj.y,'thru2','');
	}
}

// ==========================================================
// Refresh 관련
function InitAll(){
	LBCFlashMap.refreshAll();
}
function refreshMap(){
	LBCFlashMap.refreshMaps();
}
function refreshDrawing(){
	LBCFlashMap.refreshDrawings();
}

// Microsoft Internet Explorer
function MouseOutFromSwf() {
	if(!event) event = window.event;
	if (event.button == 0) {
		LBCFlashMap.MouseOut();
	}
}

//이전
function Undo(){
	LBCFlashMap.Undo();
}

//다음
function Redo(){
	LBCFlashMap.Redo();
}

//레이블클릭시
function labelClick(id){
    LabelClick(id);
}

function callLevel(level){
	set_zoom_bar();
}
// 이미지 저장
function SaveImage()
{
	var nMapWidth = document.body.clientWidth - 300;
	var nMapHeight = document.body.clientHeight - 200;

	var level = LBCFlashMap.GetLevel();
	var temp = LBCFlashMap.GetMBR();
	window.open("http://i.map.empas.com/download.php?Level="+level+"&ImageWidth="+nMapWidth+"&ImageHeight="+nMapHeight+"&MapX1="+temp[0]*100+"&MapY1="+temp[1]*100+"&MapX2="+temp[2]*100+"&MapY2="+temp[3]*100, "_self");
}

function Help_Popup()
{
	if (document.getElementById('help').value == 1)
	{
		var viewmap = window.open("http://blog.empas.com/empas/read.html?a=15925647", "viewmap", "toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes, top=0 left=200, width=800, height=600");
		viewmap.focus();
	}
	else if (document.getElementById('help').value == 2)
	{
		var viewmap = window.open("http://blog.empas.com/empas/read.html?a=15928756", "viewmap", "toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes, top=0 left=200, width=800, height=600");
		viewmap.focus();
	}
}

function OnLoadPopup()
{
	var viewmap = window.open("pop_onload.htm", "viewmap", "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes, top=0 left=0, width=492, height=532");
	viewmap.focus();
}

// 인쇄
function PopupPrint()
{
		var level = LBCFlashMap.GetLevel();
		var temp = LBCFlashMap.GetObjectCenterCoordinate();
		//var symbolSave = document.getElementById("SymbolSave").value;
		var mapWin = window.open("pop_print.asp?state="+g_strState+"&level="+level+"&x="+temp.x+"&y="+temp.y+"&name="+g_nEmpasTextName+"&symbol="+symbolSave+TextSymbol,"print", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no, top=100, left=100, width=670, height=1000");
		mapWin.focus();
}
function PrintPop(){
    var temp = GetCenterPoint();
    temp = temp.split(',');
    xcoord = temp[0];
    ycoord = temp[1];
    level = GetLevel();
    window.open("open_print.php?xcoord="+xcoord+"&ycoord="+ycoord+"&level="+level,"print", "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, top=100 left=100 width=577 height=645");

}

function OpenWindow(url, winsize)
{
	var viewmap = window.open(url, "viewmap", "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes, top=0 left=200,"+winsize);
	viewmap.focus();
}

function NewWin(wurl,n_name,wwidth,wheight) {
	optionstr = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes,"
	optionstr = optionstr + "width=" + wwidth
	optionstr = optionstr + ",height=" + wheight
	servicewindow = open(wurl,n_name,optionstr)
}

//URL복사하기
function LocationCopy()
{
    alert("해당 위치에 클릭해 주십시오.");
    GetClickPoint(1);
}

//지도수정요청
function Location_Modify()
{
	alert('수정 위치를 클릭해주세요');
	GetClickPoint(2);
}

function handle(delta) {
	if (delta < 0)
		LBCFlashMap.ZoomByMouse(2);
	else if(delta > 0)
		LBCFlashMap.ZoomByMouse(1);
}

function wheel(event){
    var delta = 0;
    if (!event) event = window.event;

    if (event.wheelDelta) {
		delta = event.wheelDelta/120;
		if (window.opera) delta = -delta;
	} else if (event.detail) {
		delta = -event.detail/3;
	}
	if (delta)
		handle(delta);
}

function Unload(){
	RemoveAllSymbol();
}

function AddResult(x, y, idx, name, number){
    if (x > 0 && y > 0){
		if (g_nMinX > x)
			g_nMinX = x;
		if (g_nMaxX < x)
			g_nMaxX = x;
		if (g_nMinY > y)
			g_nMinY = y;
		if (g_nMaxY < y)
			g_nMaxY = y;
	}
	//DrawLabel(idx +'#'+name+'#0x000000#12#1#1#0xFFFFFF#100#'+x+'#'+y+'#center#top#0#15');
    var Symbol = new MapSymbol(idx, x, y, name, number);
	arrSymbolIndex.splice(idx,1,Symbol);
}

function AddressPoint(x, y){
	RemoveSymbol(100);
    var symbol = "images/pointer.gif";
	AddSymbol(x, y, 100, 100, 24, 39, symbol, '', 0, 'center', 'bottom');
	SetLevelNCoord(1, x, y);
}

function ViewSymbol(){
    var symbolString = "abcdefghijklmn";
    for(i=0;i<arrSymbolIndex.length;i++){
        var x = arrSymbolIndex[i].xcoord;
		var y = arrSymbolIndex[i].ycoord;
		var icon = "images/alcon_"+symbolString.charAt(i)+".gif";
		AddSymbol(x, y, arrSymbolIndex[i].index, arrSymbolIndex[i].index, 13, 13, icon, '', 0, 'center', 'center');
	}
}

function ViewAllResult(){
	if (g_nMinX < 0 || g_nMinX > 999999 || g_nMaxX < 0 || g_nMaxX > 999999 || g_nMinY < 0 || g_nMinY > 999999 || g_nMaxY < 0 || g_nMaxY > 999999) return;

	var nMarginX = (g_nMaxX - g_nMinX) * 0.3;
	var nMarginY = (g_nMaxY - g_nMinY) * 0.3;

	nMarginX = Math.round(nMarginX);
	nMarginY = Math.round(nMarginY);


	var g_nMinX_All = g_nMinX - nMarginX;
	var g_nMaxX_All = g_nMaxX + nMarginX;
	var g_nMinY_All = g_nMinY - nMarginY;
	var g_nMaxY_All = g_nMaxY + nMarginY;

	g_nMinX_All = Math.round(g_nMinX_All);
	g_nMaxX_All = Math.round(g_nMaxX_All);
	g_nMinY_All = Math.round(g_nMinY_All);
	g_nMaxY_All = Math.round(g_nMaxY_All);

	MoveMapByMBR(g_nMinX_All, g_nMinY_All, g_nMaxX_All, g_nMaxY_All);
}

function MoveMapByMBR (nMinX, nMinY, nMaxX, nMaxY){
	nCenterX = (parseFloat(nMaxX) - parseFloat(nMinX)) / 2 + parseFloat(nMinX);
	nCenterY = (parseFloat(nMaxY) - parseFloat(nMinY)) / 2 + parseFloat(nMinY);
	nCenterX = nCenterX;
	nCenterY = nCenterY;
	nMapWidth = document.body.clientWidth - 400;
	nMapHeight = document.body.clientHeight - 300;
	var nMap = Math.sqrt(Math.pow(nMapWidth, 2) + Math.pow(nMapHeight, 2));
	var nRealMap = Math.sqrt(Math.pow((nMaxX - nMinX), 2) + Math.pow((nMaxY - nMinY), 2));
	level = nRealMap / nMap ;

	for (var i = 11; i > 0; i--){
		if (level > Math.pow(2, (i-1))){
			level = i+1;
			break;
		}
	}
	if (level < 1){
		level = 1;
	}
	if (level > 11){
		level = 11;
	}

	SetLevelNCoord(level, nCenterX, nCenterY);
}

function add_line(){
    x = document.getElementById("sx").value;
	y = document.getElementById("sy").value;
    AddSymbol(x, y, 100, 100, 82, 34, start_symbol, '', 0, 'center', 'bottom');
    x = document.getElementById("ex").value;
	y = document.getElementById("ey").value;
	AddSymbol(x, y, 200, 200, 82, 34, end_symbol, '', 0, 'center', 'bottom');
	var line = document.getElementById("line").value;
	document.getElementById('test').value = line;
	line = line.split(",");

	var coordList = new Array();
	var lineLength = parseInt((line.length - 1) / 2);
	var middleCoord = '';
	for (var i = 0; i < lineLength; i++)
	{
		if(i == 0){
		    var firstCoord = line[i*2]+'#'+line[i*2+1];
		}else if(i == lineLength - 1){
		    var endCoord = line[i*2]+'#'+line[i*2+1];
		}else{
		    if(i == lineLength - 2){
		        middleCoord += line[i*2]+'#'+line[i*2+1]
		    }else{
		        middleCoord += line[i*2]+'#'+line[i*2+1]+'#';
		    }
		}
	}
	var middleNum = lineLength - 2;
	var middleEndNum = lineLength - 1;
	LBCFlashMap.DrawLine('1#1#3#0xFF0000#80#'+lineLength+'#'+firstCoord);
	LBCFlashMap.DrawLine('1#2#'+middleNum+'#2#'+middleEndNum+'#'+middleCoord);
	LBCFlashMap.DrawLine('1#3#'+lineLength+'#'+endCoord+'#1');
	//poly_count++;
	pastway_view_all_line();
}

function pastway_view_all_line(){
	var line = document.getElementById("line").value;
	line = line.split(",");

	var MinX = 999999;
	var MinY = 999999;
	var MaxX = 000000;
	var MaxY = 000000;

	for (var i = 0; i < (line.length - 1) / 2; i++)
	{
		if (MinX > line[i*2])
			MinX = line[i*2];
		if (MaxX < line[i*2])
			MaxX = line[i*2];
		if (MinY > line[i*2+1])
			MinY = line[i*2+1];
		if (MaxY < line[i*2+1])
			MaxY = line[i*2+1];
	}
	MoveMapByMBR(MinX, MinY, MaxX, MaxY);
}

function paging(num){
    document.form1.page.value = num;
    document.form1.submit();
}

function setPosition(x, y){
    SetLevelNCoord(2, x, y);
}

var tooltip = document.createElement("iframe");
function showInfo(num, idx, str){
		if(arrSymbolIndex[num].number)
			idx = arrSymbolIndex[num].number;
		if(arrSymbolIndex[num].title)
			str = arrSymbolIndex[num].title;

        if(str == 'realty'){
            RemoveSymbol(1);
            var symbolString = "abcdefghijklmn";
            var icon = "images/alcon_"+symbolString.charAt(num)+".gif";
            AddSymbol(arrSymbolIndex[num].xcoord, arrSymbolIndex[num].ycoord, 1, 1, 13, 13, icon, '', 0, 'center', 'center');
		}
		if(!arrSymbolIndex[num])
			return false;
        xcoord = arrSymbolIndex[num].xcoord;
        ycoord = arrSymbolIndex[num].ycoord+(Math.pow(2, GetLevel()-1)*120);
        MoveMap(xcoord, ycoord);
        getScrPoint = GetScrPoint(xcoord,ycoord);
        nx = getScrPoint[0];
        ny = getScrPoint[1];
        var flash_map = document.getElementById("FlashMap");
        tooltip.id = "iframeID";
        tooltip.scrolling='no';
        tooltip.allowTransparency = true;
	    tooltip.style.zIndex =10;
	    tooltip.frameBorder = 0;
	    tooltip.style.display = "block";
	    tooltip.style.position='absolute';
	    tooltip.style.backgroundColor="transparent";
	    if(str == 'site'){
	        tooltip.style.width = 320;
	        tooltip.style.height = 200;
	        topnum = 2.2;
	        leftnum = 10;
        } else if(str == 'reginfo'){
            tooltip.style.width = 350;
	        tooltip.style.height = 300;
	        topnum = 3.2;
	        leftnum = 40;
	    } else if(str == 'acco' || str == 'tour' || str == 'shopping'){
            tooltip.style.width = 350;
	        tooltip.style.height = 300;
	        topnum = 3.2;
	        leftnum = 40;
	    } else if(str == 'realty'){
	        tooltip.style.width = 240;
	        tooltip.style.height = 110;
	        topnum = 9.0;
	        leftnum = 0;
	    } else if(str == 'recruit'){
	        tooltip.style.width = 320;
	        tooltip.style.height = 370;
	        topnum = 1.45;
	        leftnum = -7;
	    } else if(str == 'gastation'){
	        tooltip.style.width = 200;
	        tooltip.style.height = 200;
	        topnum = 2.9;
	        leftnum = -7;
	    }

	    tooltipWidth = parseInt(tooltip.style.width);
	    tooltipHeight = parseInt(tooltip.style.height);

        tooltip.style.left = nx;
	    tooltip.style.top = ny;
	    tooltip.style.marginTop = -(tooltipHeight/topnum);
	    tooltip.style.marginLeft = -tooltipWidth+leftnum;
	    tooltip.style.overflow="hidden";

        if(str=="site"){
	        var url ="site_layers.php?idx="+idx+"&symbol="+num;
        } else if(str=="reginfo"){
            var url ="guide_food_layers.php?idx="+idx+"&symbol="+num;
        } else if(str=="tour"){
            var url ="guide_tour_layers.php?idx="+idx+"&symbol="+num;
        } else if(str=="shopping"){
            var url ="guide_shop_layers.php?idx="+idx+"&symbol="+num;
        } else if(str=="acco"){
            var url ="guide_room_layers.php?idx="+idx+"&symbol="+num;
        } else if(str=='realty'){
            var url ="immovable_layers.php?idx="+idx+"&symbol="+num;
        } else if(str == 'recruit'){
            var url ="job_layers.php?idx="+idx+"&symbol="+num;
        } else if(str == 'gastation'){
            var url ="gas_layers.php?idx="+idx+"&symbol="+num;
        }

        tooltip.src = url;
        flash_map.appendChild(tooltip);
}

/*--------------------------------------------------------*/

// Javascript - Actionscript  Interface functions
//
// ==========================================================
//  이벤트 메서드(필수)  !! 메서드명 변경불가
// ==========================================================

var g_nMinX = 999999999;
var g_nMinY = 999999999;
var g_nMaxX = 0;
var g_nMaxY = 0;
var arrSymbolIndex = new Array();
var LBCFlashMap;
//  맵 등장
function MapExist(){
    /* Initialization code. */
	LBCFlashMap = document.getElementById('LBCFlashMap');
	LBCFlashMap.SetImageURL("http://imap.lbcsoft.com/");// 이미지 서버 지정
	//LBCFlashMap.SetLevelNCoord(3, 309901.2, 552063.2);
	/*  마우스 이벤트 등록 */
	if(navigator.appName == "Microsoft Internet Explorer"){
		document.onmousemove = MouseOutFromSwf;
	} else {
	    if (window.addEventListener) {
		    LBCFlashMap.addEventListener('DOMMouseScroll', wheel, false);
			window.addEventListener('mouseup', checkMouseUp, false);
	    }
	    LBCFlashMap.onmousewheel = wheel;
		window.onmouseup = document.onmouseup = checkMouseUp();
    }
    if(arrSymbolIndex.length>0){
        if(location.pathname.indexOf('realty') < 0){
		    ViewSymbol();
		}
		ViewAllResult();
    }
}

//MapSymbol object
function MapSymbol(index, xcoord, ycoord, title, number){
    var index;
	this.index = index;
	this.xcoord = xcoord;
	this.ycoord = ycoord;
	//this.url = url;
	this.title = title;
	this.number = number;
}

//  이미지서버 등록
function SetImageServer(str){
	LBCFlashMap.SetImageServer(str);
}

//  인덱스맵의 로딩 여부
function LoadIndexMap(boolean){
	LBCFlashMap.LoadIndexMap();
	LBCFlashMap.SwitchIndexMapStat(boolean);
}

function init(num){
    if(num==1){
        LoadIndexMap(true);
    } else if(num==2){
        LoadIndexMap(false);
    }
}

//초기화
function initDraw(){
	LBCFlashMap.RemoveAllLineByMouse();
  	LBCFlashMap.DrawAllPolygonRemove();
  	LBCFlashMap.MeasureDistanceStop();
   	LBCFlashMap.MeasureAreaStop();
   	//LBCFlashMap.InitDraw();
}

//이벤트 후 중심좌표 받아오기
function CallScript(){
    var coord = LBCFlashMap.GetObjectCenterCoordinate();
    var level = LBCFlashMap.GetLevel();
    clear_tooltip();
}

// 플래시맵에서 이벤트가 있었던 심볼의 정보를 가지고 있습니다.
// 그 정보를 불러오는 함수 입니다.
// ----->  LBCFlashMap.ReturnSymbolProps();
// 리턴하는 값의 형태입니다.
// ----->  object = {x, y, id, attribute}
function CallTooltipUp(obj){
	overLabel(obj.id);
	//var properties = LBCFlashMap.ReturnSymbolProps();
	//alert(properties.x+' . '+properties.y+' . '+properties.id+''+properties.attribute);
}
function CallTooltipDown(){
	//alert('Mouse Out');
	//LBCFlashMap.ResetSymbolProps();
}
function CallTooltipClick(obj){
//	var properties = LBCFlashMap.ReturnSymbolProps();
//	alert(obj.x+' . '+obj.y+' . '+obj.id+' . '+obj.attribute);
//	symbolCenter(obj.id);
	showInfo(obj.id, '', '');
}
function SetZoomScript(mode){
    clear_tooltip();
	// mode = 1 : 줌인 / mode = 2 : 줌아웃
	//if(mode == 1) alert("ZoomIn");
	//if(mode == 2) alert("ZoomOut");
}
/////////////////////////////////////////////////////////////////////////////////////////////////////

// ==========================================================
//   응용 메서드
// ==========================================================

// 현재 도메인 보기
function domainTrace(){
	var domain = LBCFlashMap.getCurrentDomain();
}

//기본기능
function ZoomIn(){
	LBCFlashMap.ZoomIn();
}
function ZoomOut(){
	LBCFlashMap.ZoomOut();
}

//이동
function Panning(){
    LBCFlashMap.Panning();
}

function GetLevel(){
	var level = LBCFlashMap.GetLevel();
	return level;
}

function SetLevel(level){
    LBCFlashMap.SetLevel(level);
}
// 화면 중심의 실제 좌표값 출력
function GetCenterPoint(){
    var centerPt = LBCFlashMap.GetStringCenterCoordinate();
    return centerPt;
}

function GetCoordinate(){
	var centerPt = LBCFlashMap.GetObjectCenterCoordinate();
	alert(centerPt.x +' . '+centerPt.y);
	return centerPt;
}
function GetMBR(){
	var mbr = LBCFlashMap.GetMBR();
	return mbr;
	//alert("minX: "+mbr[0]+" , "+"minY: "+mbr[1]+" , "+"maxX: "+mbr[2]+" , "+"maxY: "+mbr[3]);
}
// 해당 좌표나 레벨 적용시키기
function MoveMap(x, y){
	LBCFlashMap.MoveMap(x, y);
}
function SetLevelNCoord(lev, x, y){
	LBCFlashMap.SetLevelNCoord(lev, x, y);
}
// 실제좌표의 화면좌표값
function GetScrPoint(x, y){
	var SrcPoint = LBCFlashMap.GetScrPoint(x, y);
	//alert("X:  "+SrcPoint[0]+"  ,  "+"Y:  "+SrcPoint[1]);
	return SrcPoint;
}
// test : 좌표출력(엔터프레임으로)
function ViewCoord(){
	LBCFlashMap.ViewCoord();
}
function StopViewCoord(){
	LBCFlashMap.StopViewCoord();
}
//  부가기능
// x:Number, y:Number, id:String, index:Number, imgW:Number, imgH:Number, url:String, attribute:String, degree:Number, hAlign:String, vAlign:String
//  심볼 추가하기
function AddSymbol(x, y, id, index, imgWidth, imgHeight, url, attribute, degree, hAlign, vAlign){
	LBCFlashMap.AddSymbol(x, y, id, index, imgWidth, imgHeight, url, attribute, degree, hAlign, vAlign);
}
//  index#description#color#size#isBold#outline#bgColor#bgAlpha#X#Y#hAlign#vAlign
function DrawLabel(str){
	LBCFlashMap.DrawLabel(str);
}

// 지우기
function RemoveSymbol(index){
	LBCFlashMap.RemoveSymbol(index);
}
function RemoveLabel(index){
	LBCFlashMap.RemoveLabel(index);
}
function RemoveAllLabel(){
	LBCFlashMap.RemoveAllLabel();
}
function RemoveAllSymbol(){
	LBCFlashMap.RemoveAllSymbol();
}
// 마우스로 심볼 추가하기 / 중지
function AddSymbolStart(){
	LBCFlashMap.AddSymbolStart();
}
function AddSymbolStop(){
	LBCFlashMap.AddSymbolStop();
}

// ==========================================================
// 데이터 값으로 선그리기 / 지우기
function DrawLine(data){
	LBCFlashMap.DrawLine(data);
}
function DrawSimpleLine(data){
	LBCFlashMap.DrawSimpleLine(data);
}
function RemoveLine(id){
	LBCFlashMap.RemoveLine(id);
}
// 선 모두 지우기
function RemoveAllLine(){
	LBCFlashMap.RemoveAllLine();
}

// 마우스로 선그리기
function DrawLineStart(){
	LBCFlashMap.DrawLineStart();
}
function DrawLineStop(){
	LBCFlashMap.DrawLineStop();
}
// 거리 재기 시작 / 끝내기
function MeasureDistanceStart() {
    initDraw();
	LBCFlashMap.MeasureDistanceStart();
}
function MeasureDistanceStop() {
	LBCFlashMap.MeasureDistanceStop();
}
//  지우기
function RemoveLineByMouse(index){
	LBCFlashMap.RemoveLineByMouse(index);
}
function RemoveAllLineByMouse(){
	LBCFlashMap.RemoveAllLineByMouse();
}
function MeasureDistanceRemove(){
	LBCFlashMap.MeasureRemove();
}
// ==========================================================
// 마우스로 면 그리기
function DrawPolygonStart(){
	LBCFlashMap.DrawPolygonStart();
}
function DrawPloygonStop(){
	LBCFlashMap.DrawPolygonStop();
}
// 면적 측정 시작 / 끝내기
function MeasureAreaStart(){
    initDraw();
	LBCFlashMap.MeasureAreaStart();
}
function MeasureAreaStop(){
	LBCFlashMap.MeasureAreaStop();
}
// 면적 지우기
function MeasureAreaRemove(){
	LBCFlashMap.MeasureAreaRemove();
}
// 그린 면 지우기
function DrawPolygonRemove(index){
	LBCFlashMap.DrawPolygonRemove(index);
}
// 그린 면 모두 지우기
function DrawAllPolygonRemove(){
	LBCFlashMap.DrawAllPolygonRemove();
}

// 모든 그려진 객체 지우기
function RemoveAllDraw() {
	LBCFlashMap.RemoveAllDraw();
}

function GetClickPoint(num){
	LBCFlashMap.ReadyToClick(num);
}

// 마우스 좌표 가져오기
function SetClickPoint(obj){
    if(obj.Mode == 1){
		NewWin("pop_urlcopy.aspx?x="+obj.x+"&y="+obj.y, "urlcopy", 600, 350);
	} else if(obj.Mode == 2){
		NewWin('open_map_modify.php?x='+obj.x+'&y='+obj.y,'modify',577,735);
	} else if(obj.Mode == 3){
		area_mark(obj.x,obj.y,'start','');
	} else if(obj.Mode == 4){
		area_mark(obj.x,obj.y,'end','');
	} else if(obj.Mode == 5){
		area_mark(obj.x,obj.y,'thru1','');
	} else{
		area_mark(obj.x,obj.y,'thru2','');
	}
}

// ==========================================================
// Refresh 관련
function InitAll(){
	LBCFlashMap.refreshAll();
}
function refreshMap(){
	LBCFlashMap.refreshMaps();
}
function refreshDrawing(){
	LBCFlashMap.refreshDrawings();
}

// Microsoft Internet Explorer
function MouseOutFromSwf() {
	if(!event) event = window.event;
	if (event.button == 0) {
		LBCFlashMap.MouseOut();
	}
}

//이전
function Undo(){
	LBCFlashMap.Undo();
}

//다음
function Redo(){
	LBCFlashMap.Redo();
}

//레이블클릭시
function labelClick(id){
    LabelClick(id);
}

function callLevel(level){
	set_zoom_bar();
}
// 이미지 저장
function SaveImage()
{
	var nMapWidth = document.body.clientWidth - 300;
	var nMapHeight = document.body.clientHeight - 200;

	var level = LBCFlashMap.GetLevel();
	var temp = LBCFlashMap.GetMBR();
	window.open("http://i.map.empas.com/download.php?Level="+level+"&ImageWidth="+nMapWidth+"&ImageHeight="+nMapHeight+"&MapX1="+temp[0]*100+"&MapY1="+temp[1]*100+"&MapX2="+temp[2]*100+"&MapY2="+temp[3]*100, "_self");
}

function Help_Popup()
{
	if (document.getElementById('help').value == 1)
	{
		var viewmap = window.open("http://blog.empas.com/empas/read.html?a=15925647", "viewmap", "toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes, top=0 left=200, width=800, height=600");
		viewmap.focus();
	}
	else if (document.getElementById('help').value == 2)
	{
		var viewmap = window.open("http://blog.empas.com/empas/read.html?a=15928756", "viewmap", "toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes, top=0 left=200, width=800, height=600");
		viewmap.focus();
	}
}

function OnLoadPopup()
{
	var viewmap = window.open("pop_onload.htm", "viewmap", "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes, top=0 left=0, width=492, height=532");
	viewmap.focus();
}

// 인쇄
function PopupPrint()
{
		var level = LBCFlashMap.GetLevel();
		var temp = LBCFlashMap.GetObjectCenterCoordinate();
		//var symbolSave = document.getElementById("SymbolSave").value;
		var mapWin = window.open("pop_print.asp?state="+g_strState+"&level="+level+"&x="+temp.x+"&y="+temp.y+"&name="+g_nEmpasTextName+"&symbol="+symbolSave+TextSymbol,"print", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no, top=100, left=100, width=670, height=1000");
		mapWin.focus();
}
function PrintPop(){
    var temp = GetCenterPoint();
    temp = temp.split(',');
    xcoord = temp[0];
    ycoord = temp[1];
    level = GetLevel();
    window.open("open_print.php?xcoord="+xcoord+"&ycoord="+ycoord+"&level="+level,"print", "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, top=100 left=100 width=577 height=645");

}

function OpenWindow(url, winsize)
{
	var viewmap = window.open(url, "viewmap", "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes, top=0 left=200,"+winsize);
	viewmap.focus();
}

function NewWin(wurl,n_name,wwidth,wheight) {
	optionstr = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes,"
	optionstr = optionstr + "width=" + wwidth
	optionstr = optionstr + ",height=" + wheight
	servicewindow = open(wurl,n_name,optionstr)
}

//URL복사하기
function LocationCopy()
{
    alert("해당 위치에 클릭해 주십시오.");
    GetClickPoint(1);
}

//지도수정요청
function Location_Modify()
{
	alert('수정 위치를 클릭해주세요');
	GetClickPoint(2);
}

function handle(delta) {
	if (delta < 0)
		LBCFlashMap.ZoomByMouse(2);
	else if(delta > 0)
		LBCFlashMap.ZoomByMouse(1);
}

function wheel(event){
    var delta = 0;
    if (!event) event = window.event;

    if (event.wheelDelta) {
		delta = event.wheelDelta/120;
		if (window.opera) delta = -delta;
	} else if (event.detail) {
		delta = -event.detail/3;
	}
	if (delta)
		handle(delta);
}

function Unload(){
	RemoveAllSymbol();
}

function AddResult(x, y, idx, name, number){
    if (x > 0 && y > 0){
		if (g_nMinX > x)
			g_nMinX = x;
		if (g_nMaxX < x)
			g_nMaxX = x;
		if (g_nMinY > y)
			g_nMinY = y;
		if (g_nMaxY < y)
			g_nMaxY = y;
	}
	//DrawLabel(idx +'#'+name+'#0x000000#12#1#1#0xFFFFFF#100#'+x+'#'+y+'#center#top#0#15');
    var Symbol = new MapSymbol(idx, x, y, name, number);
	arrSymbolIndex.splice(idx,1,Symbol);
}

function AddressPoint(x, y){
	RemoveSymbol(100);
    var symbol = "images/pointer.gif";
	AddSymbol(x, y, 100, 100, 24, 39, symbol, '', 0, 'center', 'bottom');
	SetLevelNCoord(1, x, y);
}

function ViewSymbol(){
    var symbolString = "abcdefghijklmn";
    for(i=0;i<arrSymbolIndex.length;i++){
        var x = arrSymbolIndex[i].xcoord;
		var y = arrSymbolIndex[i].ycoord;
		var icon = "images/alcon_"+symbolString.charAt(i)+".gif";
		AddSymbol(x, y, arrSymbolIndex[i].index, arrSymbolIndex[i].index, 13, 13, icon, '', 0, 'center', 'center');
	}
}

function ViewAllResult(){
	if (g_nMinX < 0 || g_nMinX > 999999 || g_nMaxX < 0 || g_nMaxX > 999999 || g_nMinY < 0 || g_nMinY > 999999 || g_nMaxY < 0 || g_nMaxY > 999999) return;

	var nMarginX = (g_nMaxX - g_nMinX) * 0.3;
	var nMarginY = (g_nMaxY - g_nMinY) * 0.3;

	nMarginX = Math.round(nMarginX);
	nMarginY = Math.round(nMarginY);


	var g_nMinX_All = g_nMinX - nMarginX;
	var g_nMaxX_All = g_nMaxX + nMarginX;
	var g_nMinY_All = g_nMinY - nMarginY;
	var g_nMaxY_All = g_nMaxY + nMarginY;

	g_nMinX_All = Math.round(g_nMinX_All);
	g_nMaxX_All = Math.round(g_nMaxX_All);
	g_nMinY_All = Math.round(g_nMinY_All);
	g_nMaxY_All = Math.round(g_nMaxY_All);

	MoveMapByMBR(g_nMinX_All, g_nMinY_All, g_nMaxX_All, g_nMaxY_All);
}

function MoveMapByMBR (nMinX, nMinY, nMaxX, nMaxY){
	nCenterX = (parseFloat(nMaxX) - parseFloat(nMinX)) / 2 + parseFloat(nMinX);
	nCenterY = (parseFloat(nMaxY) - parseFloat(nMinY)) / 2 + parseFloat(nMinY);
	nCenterX = nCenterX;
	nCenterY = nCenterY;
	nMapWidth = document.body.clientWidth - 400;
	nMapHeight = document.body.clientHeight - 300;
	var nMap = Math.sqrt(Math.pow(nMapWidth, 2) + Math.pow(nMapHeight, 2));
	var nRealMap = Math.sqrt(Math.pow((nMaxX - nMinX), 2) + Math.pow((nMaxY - nMinY), 2));
	level = nRealMap / nMap ;

	for (var i = 11; i > 0; i--){
		if (level > Math.pow(2, (i-1))){
			level = i+1;
			break;
		}
	}
	if (level < 1){
		level = 1;
	}
	if (level > 11){
		level = 11;
	}

	SetLevelNCoord(level, nCenterX, nCenterY);
}

function add_line(){
    x = document.getElementById("sx").value;
	y = document.getElementById("sy").value;
    AddSymbol(x, y, 100, 100, 82, 34, start_symbol, '', 0, 'center', 'bottom');
    x = document.getElementById("ex").value;
	y = document.getElementById("ey").value;
	AddSymbol(x, y, 200, 200, 82, 34, end_symbol, '', 0, 'center', 'bottom');
	var line = document.getElementById("line").value;
	document.getElementById('test').value = line;
	line = line.split(",");

	var coordList = new Array();
	var lineLength = parseInt((line.length - 1) / 2);
	var middleCoord = '';
	for (var i = 0; i < lineLength; i++)
	{
		if(i == 0){
		    var firstCoord = line[i*2]+'#'+line[i*2+1];
		}else if(i == lineLength - 1){
		    var endCoord = line[i*2]+'#'+line[i*2+1];
		}else{
		    if(i == lineLength - 2){
		        middleCoord += line[i*2]+'#'+line[i*2+1]
		    }else{
		        middleCoord += line[i*2]+'#'+line[i*2+1]+'#';
		    }
		}
	}
	var middleNum = lineLength - 2;
	var middleEndNum = lineLength - 1;
	LBCFlashMap.DrawLine('1#1#3#0xFF0000#80#'+lineLength+'#'+firstCoord);
	LBCFlashMap.DrawLine('1#2#'+middleNum+'#2#'+middleEndNum+'#'+middleCoord);
	LBCFlashMap.DrawLine('1#3#'+lineLength+'#'+endCoord+'#1');
	//poly_count++;
	pastway_view_all_line();
}

function pastway_view_all_line(){
	var line = document.getElementById("line").value;
	line = line.split(",");

	var MinX = 999999;
	var MinY = 999999;
	var MaxX = 000000;
	var MaxY = 000000;

	for (var i = 0; i < (line.length - 1) / 2; i++)
	{
		if (MinX > line[i*2])
			MinX = line[i*2];
		if (MaxX < line[i*2])
			MaxX = line[i*2];
		if (MinY > line[i*2+1])
			MinY = line[i*2+1];
		if (MaxY < line[i*2+1])
			MaxY = line[i*2+1];
	}
	MoveMapByMBR(MinX, MinY, MaxX, MaxY);
}

function paging(num){
    document.form1.page.value = num;
    document.form1.submit();
}

function setPosition(x, y){
    SetLevelNCoord(2, x, y);
}

var tooltip = document.createElement("iframe");
function showInfo2(num, idx, str){
		if(arrSymbolIndex[num].number)
			idx = arrSymbolIndex[num].number;
		if(arrSymbolIndex[num].title)
			str = arrSymbolIndex[num].title;

        if(str == 'realty'){
            RemoveSymbol(1);
            var symbolString = "abcdefghijklmn";
            var icon = "images/alcon_"+symbolString.charAt(num)+".gif";
            AddSymbol(arrSymbolIndex[num].xcoord, arrSymbolIndex[num].ycoord, 1, 1, 13, 13, icon, '', 0, 'center', 'center');
		}
		if(!arrSymbolIndex[num])
			return false;
        xcoord = arrSymbolIndex[num].xcoord;
        ycoord = arrSymbolIndex[num].ycoord+(Math.pow(2, GetLevel()-1)*120);
        MoveMap(xcoord, ycoord);
        getScrPoint = GetScrPoint(xcoord,ycoord);
        nx = getScrPoint[0];
        ny = getScrPoint[1];
        var flash_map = document.getElementById("FlashMap");
        tooltip.id = "iframeID";
        tooltip.scrolling='no';
        tooltip.allowTransparency = true;
	    tooltip.style.zIndex =10;
	    tooltip.frameBorder = 0;
	    tooltip.style.display = "block";
	    tooltip.style.position='absolute';
	    tooltip.style.backgroundColor="transparent";
	    if(str == 'site'){
	        tooltip.style.width = 320;
	        tooltip.style.height = 200;
	        topnum = 2.2;
	        leftnum = 10;
        } else if(str == 'reginfo'){
            tooltip.style.width = 350;
	        tooltip.style.height = 300;
	        topnum = 3.2;
	        leftnum = 40;
	    } else if(str == 'acco' || str == 'tour' || str == 'shopping'){
            tooltip.style.width = 350;
	        tooltip.style.height = 300;
	        topnum = 3.2;
	        leftnum = 40;
	    } else if(str == 'realty'){
	        tooltip.style.width = 240;
	        tooltip.style.height = 110;
	        topnum = 9.0;
	        leftnum = 0;
	    } else if(str == 'recruit'){
	        tooltip.style.width = 320;
	        tooltip.style.height = 370;
	        topnum = 1.45;
	        leftnum = -7;
	    } else if(str == 'gastation'){
	        tooltip.style.width = 200;
	        tooltip.style.height = 200;
	        topnum = 2.9;
	        leftnum = -7;
	    }

	    tooltipWidth = parseInt(tooltip.style.width);
	    tooltipHeight = parseInt(tooltip.style.height);

        tooltip.style.left = nx;
	    tooltip.style.top = ny;
	    tooltip.style.marginTop = -(tooltipHeight/topnum);
	    tooltip.style.marginLeft = -tooltipWidth+leftnum;
	    tooltip.style.overflow="hidden";
    
	alert("aaa");
		
		if(str=="site"){
		alert("bbb");

	        var url ="site_layers_test.php?idx="+idx+"&symbol="+num;
        } else if(str=="reginfo"){
            var url ="guide_food_layers.php?idx="+idx+"&symbol="+num;
        } else if(str=="tour"){
            var url ="guide_tour_layers.php?idx="+idx+"&symbol="+num;
        } else if(str=="shopping"){
            var url ="guide_shop_layers.php?idx="+idx+"&symbol="+num;
        } else if(str=="acco"){
            var url ="guide_room_layers.php?idx="+idx+"&symbol="+num;
        } else if(str=='realty'){
            var url ="immovable_layers.php?idx="+idx+"&symbol="+num;
        } else if(str == 'recruit'){
            var url ="job_layers.php?idx="+idx+"&symbol="+num;
        } else if(str == 'gastation'){
            var url ="gas_layers.php?idx="+idx+"&symbol="+num;
        }

        tooltip.src = url;
        flash_map.appendChild(tooltip);
}

function clear_tooltip(){
    if(tooltip.style.display = "block"){
	    tooltip.style.display = "none";
	}
}

function tbShowHide(){
    if(document.getElementById('lefttd').style.display == "block" || document.getElementById('lefttd').style.display==''){
        document.getElementById('lefttd').style.display = "none";
        document.getElementById('hide').style.left = "10px";
        document.getElementById('imgBtn').src = "images/tap_show.gif";
    } else{
        document.getElementById('lefttd').style.display = "block";
        document.getElementById('hide').style.left = "270px";
        document.getElementById('imgBtn').src = "images/tap_hide.gif";
    }
}

function SetPosition(x, y){
	RemoveSymbol(100);
	var symbol = "images/pointer.gif";
	AddSymbol(x, y, 100, 100, 24, 39, symbol, '', 0, 'center', 'bottom');
	SetLevelNCoord(1, x, y);
}





/*---------------------------------------------------------*/
function clear_tooltip(){
    if(tooltip.style.display = "block"){
	    tooltip.style.display = "none";
	}
}

function tbShowHide(){
    if(document.getElementById('lefttd').style.display == "block" || document.getElementById('lefttd').style.display==''){
        document.getElementById('lefttd').style.display = "none";
        document.getElementById('hide').style.left = "10px";
        document.getElementById('imgBtn').src = "images/tap_show.gif";
    } else{
        document.getElementById('lefttd').style.display = "block";
        document.getElementById('hide').style.left = "270px";
        document.getElementById('imgBtn').src = "images/tap_hide.gif";
    }
}

function SetPosition(x, y){
	RemoveSymbol(100);
	var symbol = "images/pointer.gif";
	AddSymbol(x, y, 100, 100, 24, 39, symbol, '', 0, 'center', 'bottom');
	SetLevelNCoord(1, x, y);
}

