﻿	var j = 0;
	function contUpDown() {
		var bcontTop = document.getElementById("bcontbox").style.marginTop;

		if(j==0) {
			document.getElementById("bcontbox").style.marginTop = parseInt(bcontTop)+170 + "px";
			document.getElementById("updown").style.background = "url(../../images/map/bg_bottominfortop_off.png) no-repeat left top";
			document.getElementById("buttonupdown").src = "../../images/map/btn_bottominfor_up.gif";
			document.getElementById("mapmainInfo").style.display = "none";
			j = 1;
		}else{
			document.getElementById("bcontbox").style.marginTop = parseInt(bcontTop)-170 + "px";
			document.getElementById("updown").style.background = "url(../../images/map/bg_bottominfortop_on.png) no-repeat left top";
			document.getElementById("buttonupdown").src = "../../images/map/btn_bottominfor_down.gif";
			document.getElementById("mapmainInfo").style.display = "block";
			j = 0;
		}
	}



	// 기본 탭 스트립트
	function tabChange(who, name, cnum){
		for(var i=0; i<100; i++){
			who = who.parentNode;
			if(who.nodeName == "UL") break; // 일단 ul까지 올라가서 탭메뉴 루트인 ul를 저장
		}

			var menu = who.getElementsByTagName("LI");
			for(var i=0; i<menu.length; i++){ // li의 갯수(=메뉴의갯수) 만큼 반복
				   if(!document.getElementById(name + (i+1))){
						 //alert((i+1) + "번째 텝내용이 없습니다.");
						 continue;
					  }
				if(i == cnum-1){ // 활성화
					if(i==0) {
						menu['0'].className = "first current";
					} else {
						menu[i].className = "current";
					}

					var tabimg = menu[i].getElementsByTagName("img")[0];

					if (tabimg.src.indexOf("_off.gif") != -1) {
						tabimg.src = tabimg.src.replace("_off.gif","_on.gif");
					}

				document.getElementById(name + (cnum)).style.display = "block";
			}else{ // 비활성화
				menu[i].className = " ";


				var tabimg = menu[i].getElementsByTagName("img")[0];

				if (tabimg.src.indexOf("_on.gif") != -1) {
					tabimg.src = tabimg.src.replace("_on.gif","_off.gif");
				}

				if (i==0){
					menu['0'].className = "first";
				}

				document.getElementById(name + (i+1)).style.display = "none";
			}
		}
	}

	// 문서의 높이 얻기
	function getWinHeight() {
		if (window.self && self.innerHeight) {
			return self.innerHeight;
		}
		if (document.documentElement && document.documentElement.clientHeight) {
			return document.documentElement.clientHeight;
		}
		return 0;
	}
	// 문서의 너비 얻기
	function getWinWidth() {
		if (window.self && self.innerWidth) {
			return self.innerWidth;
		}
		if (document.documentElement && document.documentElement.clientWidth) {
			return document.documentElement.clientWidth;
		}
		return 0;
	}

	// 돔객체 얻기
	function DOM(id) {return document.getElementById(id);}

	function resizeWin() {
		var width = Math.max(getWinWidth(), 1250); // 전체가로 넓이 한계값 설정
		var height = Math.max(getWinHeight(), 600); //전체세로 높이 한계값 설정
		//if(!width||!height) return;

		DOM("divDoc").style.width = width+"px";
		DOM("divDoc").style.height = height+"px";
		if(width!=null) {
			DOM("MapMain").style.width = width+"px";
			//DOM("theme-map").style.right = (width/2)-600+"px";
//			DOM("bcontbox2").style.width = width-260+"px";
//			DOM("bcontbox2").style.right = (width/2)-305+"px";
			DOM("div_SetArea").style.left = (width*(1/2))+180+"px";
			DOM("div_DetailWrite").style.left = (width*(1/2))+180+"px";
		}
		if(height!=null) {
			DOM("MapMain").style.height = height-151+"px";
			DOM("mapnavi").style.height = height-106+"px";
			DOM("theme-map").style.top	= height-75+"px";
			DOM("navicontent1").style.height = height-126+"px";
			DOM("navicontent2").style.height = height-126+"px";
            DOM("textinformation").style.height = height-206+"px";
            DOM("div_globalsearch_result").style.height = height-206+"px";

//			DOM("navicontent3").style.height = 80+"px";
//			DOM("div_GlobalSearch_result").style.height = height-298+"px";
//			DOM("div_default").style.height = height-298+"px";
//			DOM("bcontbox").style.marginTop = -205+"px";
//            DOM("bcontbox2").style.marginTop = -(height-151)+"px";
            DOM("listDiv").style.height = (height-580)+"px";
            DOM("listDiv2").style.height = (height-415)+"px";
		}
		DOM("control").style.width = width+"px";
		if(j==1){
			j=0;
			contUpDown();
		}

		height-= (136+0);

	}

	/************************************************************************************************************
	(C) www.dhtmlgoodies.com, October 2005

	Version 1.2: Updated, November 12th. 2005

	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.

	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.

	Thank you!

	www.dhtmlgoodies.com
	Alf Magne Kalleland

	************************************************************************************************************/
	var width = Math.max(getWinWidth(), 1250); // 전체가로 넓이 한계값 설정
	var height = Math.max(getWinHeight(), 600); //전체세로 높이 한계값 설정
	var panelWidth = 348;    // Width of help panel
	var slideSpeed = 15;        // Higher = quicker slide
	var slideTimer = 10;    // Lower = quicker slide
	var slideActive = true;    // Slide active ?
	var initBodyMargin = 0;    // Left or top margin of your <body> tag (left if panel is at the left, top if panel is on the top)
	var pushMainContentOnSlide = false;    // Push your main content to the right when sliding

	var slideLeftPanelObj=false;
	var slideInProgress = false;
	var startScrollPos = false;
	var panelVisible = false;
	function initSlideLeftPanel(expandOnly) {

		if(slideInProgress)return;
		if(!slideLeftPanelObj){
			if(document.getElementById('mapnavi')){
				slideLeftPanelObj = document.getElementById('mapnavi');
				slideLeftPanelObjSide = document.getElementById('movelocation');
			}else{
				slideLeftPanelObj.id = 'mapnavi';
				slideLeftPanelObj.style.display='none';
				document.body.appendChild(slideLeftPanelObj);
			}

			slideLeftPanelObj.style.left = 0 + 'px';
			slideLeftPanelObjSide.style.left = 348 + 'px';
			slideLeftPanelObj.style.top = 106 + 'px';
			slideLeftPanelObj.style.width = panelWidth + 'px';

			//if(!document.all || navigator.userAgent.indexOf('Opera')>=0)slideLeftPanelObj.style.position = 'relative';
		}

		if(document.documentElement.clientHeight){
			slideLeftPanelObj.style.height = DOM("mapnavi").style.height = height + "px";
			resizeWin();
		}else if(document.body.clientHeight){
			slideLeftPanelObj.style.height = document.body.clientHeight + 'px';
		}

		var leftPos = slideLeftPanelObj.style.left.replace(/[^0-9\-]/g,'')/1;
		startScrollPos = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);

		if(leftPos<(0+startScrollPos)){
			if(slideActive){
				slideLeftPanel(slideSpeed);
			}else{
				document.body.style.marginLeft = panelWidth + 'px';
				slideLeftPanelObj.style.left = '0px';
				slideLeftPanelObjSide.style.left = '348px';
			}
		}else{
			if(expandOnly)return;
			if(slideActive){
				slideLeftPanel(slideSpeed*-1);
			}else{
				if(pushMainContentOnSlide)document.body.style.marginLeft =  initBodyMargin + 'px';
				slideLeftPanelObj.style.left = (panelWidth*-1) + 'px';
				slideLeftPanelObjSide.style.left = (panelWidth*-1) + 348 + 'px';
			}
		}

	}

	function slideLeftPanel(slideSpeed){
		slideInProgress =true;
		var scrollValue = 0;
		var leftPos = slideLeftPanelObj.style.left.replace(/[^0-9\-]/g,'')/1;

		leftPos+=slideSpeed;
		okToSlide = true;
		if(slideSpeed<0){
			if(leftPos < ((panelWidth*-1) + startScrollPos+25)){
				leftPos = (panelWidth*-1) + startScrollPos+25;
				document.getElementById("mapnavibtn-in").style.display = "none";
				document.getElementById("mapnavibtn-out").style.display = "";
//				document.getElementById("bcontbox").style.width = width-20+"px";
//				document.getElementById("bcontbox2").style.width = width-20+"px";
//				DOM("bcontbox2").style.right = (width/2)-305+125+"px";
				okToSlide=false;
			}

		}
		if(slideSpeed>0){
			if(leftPos > (0 + startScrollPos)){
				leftPos = 0 + startScrollPos;
				document.getElementById("mapnavibtn-out").style.display = "none";
				document.getElementById("mapnavibtn-in").style.display = "";
				okToSlide = false;
			}
//			document.getElementById("bcontbox").style.width = width-280+"px";
//			document.getElementById("bcontbox2").style.width = width-280+"px";
//			DOM("bcontbox2").style.right = (width/2)-305+"px";
			//alert(document.getElementById('bcontbox').style.width);
		}

		slideLeftPanelObj.style.left = leftPos + startScrollPos +  'px';
		slideLeftPanelObjSide.style.left = leftPos + startScrollPos + 340 +  'px';
		if(pushMainContentOnSlide)document.body.style.marginLeft = leftPos - startScrollPos + panelWidth + 'px';

		if(okToSlide)setTimeout('slideLeftPanel(' + slideSpeed + ')',slideTimer); else {
			slideInProgress = false;
			if(slideSpeed>0)panelVisible=true; else panelVisible = false;
		}
	}

	function mapnavi(num){
		for(var i=1; i<3; i++) {
			document.getElementById("tab-search"+i).style.top = -1000 + "px";
			// 검색초기화를 위한 분기처리
			if (i == 2)
			{
				route_tabChange('1');
			}
		}
		document.getElementById("tab-search"+num).style.top = 0 + "px";
	}
