// basic
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}2009-11-17

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


// 통합검색
function totalSearch() {

	var frm = document.getElementById("search-form");

	if(frm.TQUERY.value.length == 0){
		alert("검색어를 입력하세요");
		frm.TQUERY.focus();
		return false;
	}

	var searchtargt = window.open("","searchtargt","");
	frm.target = "searchtargt";
	frm.submit();
	return;
}


// popup
function win_pop(path, win_name, wi, he, leftm, topm, scr) {
	window.open(path,win_name,'width='+wi+',height='+he+', left='+leftm+', top='+topm+', resizable=no,scrollbars='+scr+', status=no,toolbar=no');
}
function win_pop_resize(path, win_name, wi, he, leftm, topm, scr) {
	window.open(path,win_name,'width='+wi+',height='+he+', left='+leftm+', top='+topm+', resizable=yes,scrollbars='+scr+', status=no,toolbar=no');
}
function tourPopup(type, tableNameIdx, categoryIdx){
	if (type == "photo") {
		window.open("/pages/board/boardPhotoTour.jsp?tableNameIdx=" + tableNameIdx + "&categoryIdx=" + categoryIdx, "tourPopup", "width=800,height=680,top=100,left=100,scrollbars=auto,statusbar=yes,resizable=yes");
	} else if (type == "movie") {
		window.open("/pages/board/boardMovieTour.jsp?tableNameIdx=" + tableNameIdx + "&idx=" + categoryIdx, "tourPopup", "width=800,height=680,top=100,left=100,scrollbars=auto,statusbar=yes,resizable=yes");
	} else if (type == "map") {
		window.open("/pages/board/boardMapTour.jsp?tableNameIdx=" + tableNameIdx, "tourPopup", "width=800,height=680,top=100,left=100,scrollbars=auto,statusbar=yes,resizable=yes");
	} else {
		window.open("/pages/board/boardMapTourImg.jsp?tableNameIdx=" + tableNameIdx + "&categoryIdx=" + categoryIdx, "tourPopup", "width=800,height=680,top=100,left=100,scrollbars=auto,statusbar=yes,resizable=yes");
	}
}
function moviePopup(idx){
	window.open("/pages/board/moviePopup.jsp?tableName=tour_movie&idx=" + idx, "moviePopup", "width=700,height=440,top=100,left=100,scrollbars=auto,resizable=yes");
}
function openLogin(){
	window.open("/pages/member/popupLoginForm.jsp", "popupLogin", "width=524,height=416,top=100,left=100,scrollbars=auto,resizable=no");
}
//회원가입
function openRegister(){
	window.open("http://www.yeongju.go.kr/pages/sub.jsp?menuIdx=177", "openRegister", "");
}
//마이페이지
function openMypage(){
	window.open("http://www.yeongju.go.kr/pages/sub.jsp?menuIdx=180", "openMypage", "");
}

function goYeongju(){
	window.open("http://www.yeongju.go.kr", "goYeongju", "");
}

function open_url(url){
	window.open(url, "", "");
}
// Flicker
try { document.execCommand("BackgroundImageCache", false, true); } catch (e) {}


// Screen Zoom
var zoomSize = 100;
function screenZoom(inOrOut) {
	if (navigator.userAgent.toLowerCase().indexOf("msie") != -1) {
		if (inOrOut == "in") {
			zoomSize = zoomSize + 10;
		} else {
			zoomSize = zoomSize - 10;
		}
		
		if (zoomSize > 140) {
			zoomSize = 140;			
		}
		
		if (zoomSize < 60) {
			zoomSize = 60;
		}
		
		document.body.style.zoom = zoomSize + "%";
	}
}


// Screen Reset
function screenReset() {
	if (navigator.userAgent.toLowerCase().indexOf("msie") != -1) {
		zoomSize = 100;
		document.body.style.zoom = zoomSize + "%";
	}
}


// Float Div
function floatDiv(el, sx, sy, my) {
	var px = document.layers ? "" : "px";
	if (document.layers) {
		el.style = el;
	}
	el.cx = el.sx = sx;
	el.cy = el.sy = sy;
	el.sP = function(x, y) {
		this.style.left = x + px;
		this.style.top = y + px;
	};
	
	el.float = function() {
		var pX = (this.sx >= 0) ? 0 : document.body.clientWidth || document.documentElement.clientWidth || 0;
		var pY = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop || 0;
		
		if(this.sy < 0) {
			pY += document.body.clientHeight || document.documentElement.clientHeight || 0;
		}
		
		this.cx += (pX + this.sx - this.cx) / 8;
		this.cy += (pY + this.sy - this.cy) / 8;
		
		if (my > 0) {
			var pmY = (document.body.scrollHeight || document.documentElement.scrollHeight || 0) - my - Element.getDimensions(el).height;
			
			if (pmY < this.cy) {
				this.cy = pmY;
			}
		}
		
		this.sP(this.cx, this.cy);
		setTimeout("$('" + this.id + "').float()", 23);
	}
	
	return el;
}

function documentWrite(str) {
	document.write(str);
}

function antiSpam(id){
	window.open("/pages/util/antispamin.jsp?UniqId=" + id, "AntiSpam", "width=180, height=263, left=1, top=1");
}



// 메인메뉴
function initNavigation(seq) {
	nav = document.getElementById("mainmenu");
	nav.menu = new Array();
	nav.current = null;
	nav.menuseq = 0;
	navLen = nav.childNodes.length;

	if (seq >= 7)
	{
		seq = 1;
	}
	
	allA = nav.getElementsByTagName("a")
	for(k = 0; k < allA.length; k++) {
		allA.item(k).onmouseover = allA.item(k).onfocus = function () {
			nav.isOver = true;
		}
		allA.item(k).onmouseout = allA.item(k).onblur = function () {
			nav.isOver = false;
			setTimeout(function () {
				if (nav.isOver == false) {
					if (nav.menu[seq])
						nav.menu[seq].onmouseover();
					else if(nav.current) {
						menuImg = nav.current.childNodes.item(0);
						menuImg.src = menuImg.src.replace("_on.gif", "_off.gif");
						if (nav.current.submenu)
							nav.current.submenu.style.display = "none";
						nav.current = null;
					}
				}
			}, 3000);
		}
	}

	for (i = 0; i < navLen; i++) {
		navItem = nav.childNodes.item(i);
		if (navItem.tagName != "LI")
			continue;

		navAnchor = navItem.getElementsByTagName("a").item(0);
		navAnchor.submenu = navItem.getElementsByTagName("ul").item(0);
		
		navAnchor.onmouseover = navAnchor.onfocus = function () {
			if (nav.current) {
				menuImg = nav.current.childNodes.item(0);
				menuImg.src = menuImg.src.replace("_on.gif", "_off.gif");
				if (nav.current.submenu)
					nav.current.submenu.style.display = "none";
				nav.current = null;
			}
			if (nav.current != this) {
				menuImg = this.childNodes.item(0);
				menuImg.src = menuImg.src.replace("_off.gif", "_on.gif");
				if (this.submenu)
					this.submenu.style.display = "block";
				nav.current = this;
			}
			nav.isOver = true;
		}
		nav.menuseq++;
		nav.menu[nav.menuseq] = navAnchor;
	}
	if (nav.menu[seq])
		nav.menu[seq].onmouseover();
}

function tabPopup(seq) {
	tabPop = document.getElementById("tabPopup");
	tabPop.tabmenu = new Array();
	tabPop.tabcurrent = null;
	tabPop.tabmenuseq = 0;
	tabPopLen = tabPop.childNodes.length;
	
	taballA = tabPop.getElementsByTagName("a")
	for(k = 0; k < taballA.length; k++) {
		taballA.item(k).onmouseover = taballA.item(k).onfocus = function () {
			tabPop.isOver = true;
		}
		taballA.item(k).onmouseout = taballA.item(k).onblur = function () {
			tabPop.isOver = false;
			setTimeout(function () {
				if (tabPop.isOver == false) {
					if (tabPop.tabmenu[seq])
						tabPop.tabmenu[seq].onmouseover();
					else if(tabPop.tabcurrent) {
						tabPop = tabPop.tabcurrent.childNodes.item(0);
						tabPop.src = tabmenuImg.src.replace("_on.gif", "_off.gif");
						if (tabPop.tabcurrent.tabsubmenu)
							tabPop.tabcurrent.tabsubmenu.style.display = "none";
						tabnav.tabcurrent = null;
					}
				}
			}, 300000);//300초뒤에 선택한 타겟활성화
		}
	}

	for (i = 0; i < tabPopLen; i++) {
		tabPopItem = tabPop.childNodes.item(i);
		if (tabPopItem.tagName != "LI")
			continue;

		tabPopAnchor = tabPopItem.getElementsByTagName("a").item(0);
		tabPopAnchor.tabsubmenu = tabPopItem.getElementsByTagName("ul").item(0);
		
		tabPopAnchor.onmouseover = tabPopAnchor.onfocus = function () {
			if (tabPop.tabcurrent) {
				tabmenuImg = tabPop.tabcurrent.childNodes.item(0);
				tabmenuImg.src = tabmenuImg.src.replace("_on.gif", "_off.gif");
				if (tabPop.tabcurrent.tabsubmenu)
					tabPop.tabcurrent.tabsubmenu.style.display = "none";
				tabPop.tabcurrent = null;
			}
			if (tabPop.tabcurrent != this) {
				tabmenuImg = this.childNodes.item(0);
				tabmenuImg.src = tabmenuImg.src.replace("_off.gif", "_on.gif");
				if (this.tabsubmenu)
					this.tabsubmenu.style.display = "block";					
				tabPop.tabcurrent = this;
			}
			tabPop.isOver = true;
		}
		tabPop.tabmenuseq++;
		tabPop.tabmenu[tabPop.tabmenuseq] = tabPopAnchor;
	}
	if (tabPop.tabmenu[seq])
		tabPop.tabmenu[seq].onmouseover();
}

function initCyberNav(seq) {
	nav = document.getElementById("cyberMenu");
	nav.menu = new Array();
	nav.current = null;
	nav.menuseq = 0;
	navLen = nav.childNodes.length;
	
	allA = nav.getElementsByTagName("a")
	for(k = 0; k < allA.length; k++) {
		allA.item(k).onmouseover = allA.item(k).onfocus = function () {
			nav.isOver = true;
		}
		allA.item(k).onmouseout = allA.item(k).onblur = function () {
			nav.isOver = false;
			setTimeout(function () {
				if (nav.isOver == false) {
					if (nav.menu[seq])
						nav.menu[seq].onmouseover();
					else if(nav.current) {
						menuImg = nav.current.childNodes.item(0);
						menuImg.src = menuImg.src.replace("_on.gif", "_off.gif");
						nav.current = null;
					}
				}
			}, 500);
		}
	}

	for (i = 0; i < navLen; i++) {
		navItem = nav.childNodes.item(i);
		if (navItem.tagName != "LI")
			continue;

		navAnchor = navItem.getElementsByTagName("a").item(0);
		
		navAnchor.onmouseover = navAnchor.onfocus = function () {
			if (nav.current) {
				menuImg = nav.current.childNodes.item(0);
				menuImg.src = menuImg.src.replace("_on.gif", "_off.gif");
				nav.current = null;
			}
			if (nav.current != this) {
				menuImg = this.childNodes.item(0);
				menuImg.src = menuImg.src.replace("_off.gif", "_on.gif");
				nav.current = this;
			}
			nav.isOver = true;
		}
		nav.menuseq++;
		nav.menu[nav.menuseq] = navAnchor;
	}
	if (nav.menu[seq])
		nav.menu[seq].onmouseover();
}

function printPage(paths) {

	var htmls = document.getElementById("contents").innerHTML;
		htmls = htmls.replace(/\<SCRIPT/gi,'<!--<script');
		htmls = htmls.replace(/\<\/SCRIPT\>/gi,'</script>-->');

	Pwin = window.open("","","top=10,left=10,width=700,height=710,scrollbars=1");
	wdata ="<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
	wdata +="<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"ko\" lang=\"ko\">\n";
	wdata +="<head>\n";
	wdata +="<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n";
	wdata +="<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/common/ixcore.css\" />\n";
	wdata +="<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/common/layout.css\" />\n";
	wdata +="<!--[if IE 6]>\n";
	wdata +="<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/common/ie6.css\" />\n";
	wdata +="<![endif]-->\n";
	wdata +="<!--[if IE 7]>\n";
	wdata +="<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/common/ie7.css\" />\n";
	wdata +="<![endif]-->\n";
	wdata +="<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/common/contents/layout.css\" />\n";

//	wdata +="<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/common/submenu/layout.css\" />\n";
//	wdata +="<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/common/header/layout.css\" />\n";
//	wdata +="<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/common/footer/layout.css\" />\n";
//	wdata +="<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/common/board/layout.css\" />\n";

	wdata +="<link rel=\"stylesheet\" type=\"text/css\" href=\"/css"+ paths +"/layout.css\" />\n";
	wdata +="<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/common/print.css\" />\n";

//	wdata +="<link rel=\"stylesheet\" type=\"text/css\" href=\"/js/yui_2_3/container/assets/container-modn.css\" media=\"all\" />";
//	wdata +="<script type=\"text/javascript\" src=\"/js/prototype.js\"></script>";
//	wdata +="<script type=\"text/javascript\" src=\"/js/yui_2_3/yahoo-dom-event/yahoo-dom-event.js\"></script>";
//	wdata +="<script type=\"text/javascript\" src=\"/js/yui_2_3/container/container-min.js\"></script>";
//	wdata +="<script type=\"text/javascript\" src=\"/js/yui_2_3/animation/animation-min.js\"></script>";

	wdata +="<script type=\"text/javascript\" src=\"/js/tour.js\"></script>\n";

//	wdata +="<script type=\"text/javascript\" src=\"/js/wiz_myMenu.js\"></script>\n";
//	wdata +="<script type=\"text/javascript\" src=\"/js/wiz_tour.js\"></script>\n";
//	wdata +="<script type=\"text/javascript\" src=\"/js/wiz_common.js\"></script>\n";
//	wdata +="<script type=\"text/javascript\" src=\"/js/wiz_satisfaction.js\"></script>\n";

	wdata +="</head>\n";
	wdata +="<body>\n";
	wdata +="<div id=\"wrapper\" >\n";
	wdata +="	<div id=\"container\">\n";
//	wdata +="		<div id=\"location\">\n";
//	wdata += document.getElementById("location").innerHTML;
//	wdata += "		</div>\n";
	wdata += "		<div id=\"contents\" >";
//	wdata += document.getElementById("depth4").innerHTML;
	wdata += htmls;
	wdata +="		</div>\n";
	wdata +="	</div>\n";
	wdata +="</div>\n";
//	wdata +="<div class=\"xxx2\"><img src=\"/images"+ paths +"/contents_title.gif\" alt=\"\" /></div>\n";
	wdata +="</body>\n";
	wdata +="</html>";
	
	Pwin.document.write(wdata);
	Pwin.window.print();
	Pwin.window.location.reload();
}
