//**********************************************************************************
// ITSN Web Standardization Team (http://www.itsn.co.kr/) 
// ÃÖÁ¾ ÀÛ¾÷ÀÚ ÀÌ¸§ / ³¯Â¥ :
//**********************************************************************************
//* Script All Document *//

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_preloadImages() { //v3.0
  var d=document; if(d.Imgs){ 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_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];}
}

function goAlert(){
  alert("ÇöÀç ¼­ºñ½º ÁØºñÁßÀÌ¸ç ºü¸¥½Ã°£³»¿¡ Á¤»óÀûÀÎ ¼­ºñ½º°¡ µÉ ¼ö ÀÖµµ·Ï ÇÏ°Ú½À´Ï´Ù.");
}
// next
/////////////////////////////////////////////////////////////////////////////////// 
//gnb menu script
///////////////////////////////////////////////////////////////////////////////////
var menuonnumber = 0;

function topOn(tabid,a) {
menuonnumber=a;
for (i=1;i<=10;i++) {
if(i<10){inn="0"+i;} else {inn=""+i;}
topMenu = document.getElementById("top"+tabid+"m"+i);//1p
topContent = document.getElementById("top"+tabid+"c"+i);
if (topMenu) { //°´Ã¼°¡Á¸ÀçÇÏ¸é
if (topMenu.tagName=="IMG") { topMenu.src = topMenu.src.replace("on0" + i + ".jpg", "off0" + i + ".jpg"); } //ÀÌ¹ÌÁöº¯°æ//
if (topMenu.tagName=="A") { topMenu.className=""; } //¾ÞÄ¿ÀÏ¶§
}
if(i!=a){
	if (topContent) { topContent.style.display="none"; }
}
}
if(a<10){ann="0"+a;} else {ann=""+a;}
topMenu = document.getElementById("top"+tabid+"m"+a);
topContent = document.getElementById("top"+tabid+"c"+a);
//alert(topMenu.tagName);
if (topMenu) { //°´Ã¼°¡Á¸ÀçÇÏ¸é
if (topMenu.tagName=="IMG") { topMenu.src = topMenu.src.replace("off0" + a + ".jpg", "on0" + a + ".jpg"); } //ÀÌ¹ÌÁöÀÏ¶§
if (topMenu.tagName=="A") { topMenu.className="on"; } //¾ÞÄ¿ÀÏ¶§
}
if (topContent) { topContent.style.display="block"; }
topMore = document.getElementById("top"+tabid+"more");
}

function topOff(tabid,a){
	menuonnumber=0;
	Fntime=setTimeout( 'topOff2('+tabid+','+a+')', 100 );
}

function topOff2(tabid,a) {
	if(menuonnumber!=a){
		for (i=1;i<=10;i++) {
			if(menuonnumber!=i){
			if(i<10){inn="0"+i;} else {inn=""+i;}
			topMenu = document.getElementById("top"+tabid+"m"+i);//1p
			topContent = document.getElementById("top"+tabid+"c"+i);
			if (topMenu) { //°´Ã¼°¡Á¸ÀçÇÏ¸é
			if (topMenu.tagName=="IMG") { topMenu.src = topMenu.src.replace("on0" + i + ".jpg", "off0" + i + ".jpg"); } //ÀÌ¹ÌÁöº¯°æ//
			if (topMenu.tagName=="A") { topMenu.className=""; } //¾ÞÄ¿ÀÏ¶§
			}
				if (topContent) { topContent.style.display="none"; }
			}
		}
	}
	//else if(menuonnumber!=0){
	//}
}
///////////////////////////////////////////////////////////////////////////////////
// Sliding All Sitemap
///////////////////////////////////////////////////////////////////////////////////

var initHeight = 0;
var slidedown_direction = 1;
var slidedownContentBox = false;
var slidedownContent = false;
var slidedownActive = false;
var contentHeight = false;
var slidedownSpeed = 10;  //¼ýÀÚ°¡ Å¬¼ö·Ï ³ªÅ¸³ª´Â ¼Óµµ°¡ ºü¸¨´Ï´Ù.
var slidedownTimer = 7; // Lower value = faster script

function slidedown_showHide() {
  if(initHeight==0)slidedown_direction=slidedownSpeed; else slidedown_direction = slidedownSpeed*-1;
  if(!slidedownContentBox) {
    slidedownContentBox = document.getElementById('dhtmlgoodies_contentBox');
    slidedownContent = document.getElementById('dhtmlgoodies_content');
    contentHeight = document.getElementById('dhtmlgoodies_content').offsetHeight;
  }
  slidedownContentBox.style.visibility='visible';
  slidedownActive = true;
  slidedown_showHide_start();
}

function slidedown_showHide_start() {
  if(!slidedownActive)return;
  initHeight = initHeight/1 + slidedown_direction;
  if(initHeight <= 0) {
    slidedownActive = false;
    slidedownContentBox.style.visibility='hidden';
    initHeight = 0;
  }
  if(initHeight>contentHeight) {
    slidedownActive = false;
  }
  slidedownContentBox.style.height = initHeight + 'px';
  slidedownContent.style.top = initHeight - contentHeight + 'px';
  setTimeout('slidedown_showHide_start()',slidedownTimer); // Choose a lower value than 10 to make the script move faster
}

function setslidedownWidth(newWidth) {
  document.getElementById('dhtmlgoodies_slidedown').style.width = newWidth + 'px';
  document.getElementById('dhtmlgoodies_contentBox').style.width = newWidth + 'px';
}
//next
/////////////////////////////////////////////////////////////////////////////////// 
//Search Select box 
///////////////////////////////////////////////////////////////////////////////////
function toggleView(target){
    var sTarget = target.href.split("#");
    var aTarget = document.getElementById(sTarget[sTarget.length-1]);
    if(aTarget.style.display == "none") aTarget.style.display = "block";
    else aTarget.style.display = "none";
}
//next
/////////////////////////////////////////////////////////////////////////////////// 
//Quickmenu
///////////////////////////////////////////////////////////////////////////////////
String.prototype.toInteger = function() {
	return this.replace(/[^0-9]/g, '') * 1;
}

function floatScroll(div_id, origin_top, limit_top, margin_top) {
	var d, t, s, g, target_height;
	origin_top *= 1;
	limit_top *= 1;
	margin_top *= 1;

	d = document.getElementById(div_id);
	s = document.documentElement.scrollTop + "";

	target_height = s.toInteger() + margin_top;
	if(target_height < limit_top) {
		target_height = origin_top;
	}

	t = d.style.top.toInteger();
	if(t != target_height) {
		g = Math.ceil((t - target_height) / 5);
		if(g > 1000) {
			g = 1000;
		}
		else if (g < -1000) {
			g = -1000;
		}
		d.style.top = (t - g) + "px";
	}
	setTimeout("floatScroll('" + div_id + "', " + origin_top + ", " + limit_top + ", " + margin_top + ")", 1);
}

function quick() {
	b = document.getElementById("floatmenu");
	floatScroll("floatmenu", 128, 128, 0);
}
//next
/////////////////////////////////////////////////////////////////////////////////// 
//Sub main tab
///////////////////////////////////////////////////////////////////////////////////
function tabOn(tabid,a) {
					for (i=1;i<=10;i++) {
						if(i<10){inn="0"+i;} else {inn=""+i;}
						tabMenu = document.getElementById("tab"+tabid+"m"+i);
						tabContent = document.getElementById("tab"+tabid+"c"+i);
						if (tabMenu) { //°´Ã¼°¡Á¸ÀçÇÏ¸é
							if (tabMenu.tagName=="IMG") { tabMenu.src = tabMenu.src.replace("on0" + i + ".gif", "off0" + i + ".gif"); } //ÀÌ¹ÌÁöÀÏ¶§
							if (tabMenu.tagName=="A") { tabMenu.className=""; } //¾ÞÄ¿ÀÏ¶§
						}
						if (tabContent) { tabContent.style.display="none"; }
					}
					if(a<10){ann="0"+a;} else {ann=""+a;}
					tabMenu = document.getElementById("tab"+tabid+"m"+a);
					tabContent = document.getElementById("tab"+tabid+"c"+a);
					//alert(tabMenu.tagName);
					if (tabMenu) { //°´Ã¼°¡Á¸ÀçÇÏ¸é
						if (tabMenu.tagName=="IMG") { tabMenu.src = tabMenu.src.replace("off0" + a + ".gif", "on0" + a + ".gif"); } //ÀÌ¹ÌÁöÀÏ¶§
						if (tabMenu.tagName=="A") { tabMenu.className="on"; } //¾ÞÄ¿ÀÏ¶§
					}
					if (tabContent) { tabContent.style.display="block"; }
					tabMore = document.getElementById("tab"+tabid+"more");
					}
//next

/////////////////////////////////////////////////////////////////////////////////// 
//Sub tab common 090625
///////////////////////////////////////////////////////////////////////////////////

function fa(i){
	(i).style.backgroundPosition='0 -31px';
}
function ba(i){
	(i).style.backgroundPosition='0 0';
}
function fi(id){
	for(num=1; num<=7; num++) document.getElementById('i'+num).style.zIndex='1';
	document.getElementById(id).style.zIndex='2';
	document.getElementById(id).style.backgroundPosition='right -31px';
}
function bi(id){
	document.getElementById(id).style.backgroundPosition='right 0';
}
//next

/////////////////////////////////////////////////////////////////////////////////// 
//Secret text 090626
///////////////////////////////////////////////////////////////////////////////////
function img_view(e,div_id,idx){
  var x = e.pageX?e.pageX:document.documentElement.scrollLeft+event.clientX;
  var y = e.pageY?e.pageY:document.documentElement.scrollTop+event.clientY;
  view=document.getElementById(div_id);
  view.style.top=y;
  view.style.left=x;
  view.style.display='block';
}
function img_hide(div_id){
  document.getElementById(div_id).style.display='none';
}
//next

/////////////////////////////////////////////////////////////////////////////////// 
//Open text 090706
///////////////////////////////////////////////////////////////////////////////////
function clickshow(num) {
    for (i=1; i<20; i++) {
        menu=eval("document.all.block"+i+".style");
        if (num==i) {
            if (menu.display=="block") {
                menu.display="none"; 
            }
            else {
                menu.display="block"; 
            }
        }
    }
}
//next


// ÅÇ ÄÁÅÙÆ® »ý¼ºÀÚ
function TabContent(tabContainerID,triggers,self,img,showFirst) {
	this.tabContainerID = tabContainerID;
	this.trigger = triggers;
	this.selfClose = self;
	this.imgEnhance = img;
	this.showFirst = showFirst;
}

//Toggle.prototype
TabContent.prototype.init = function() {
	var tabContainer = document.getElementById(this.tabContainerID);
	var tabAnchor =tabContainer.getElementsByTagName("a");
	var selfClose = new Boolean(this.selfClose);
	var showFirst = new Boolean(this.showFirst);
	var i,j;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == this.trigger)
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		

		if(this.imgEnhance && this.imgEnhance == 1)
			thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onclick = function() {
			currentmenu = this.container.current;

			if (currentmenu == this) {
				if(selfClose && (selfClose.toString() == "true")) {
					currentmenu.targetEl.style.display = "none";
					if (currentmenu.imgEl) {
						currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", ".gif");
					} else {
						currentmenu.className = currentmenu.className.replace(" on", "");
					}
					this.container.current = null;
				} else {
					return false;
				}
			} else {
				if (currentmenu) {
					currentmenu.targetEl.style.display = "none";
					if (currentmenu.imgEl) {
						currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", ".gif");
						currentmenu.className = currentmenu.className.replace(" on", "");
					} else {
						currentmenu.className = currentmenu.className.replace(" on", "");
					}
				}
				this.targetEl.style.display = "block";
				if (this.imgEl) {
					this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
					this.className += " on";
				} else {
					this.className += " on";
				}
				
				this.container.current = this;
			}
			return false;
		};
		if (!thismenu.container.first) {
			thismenu.container.first = thismenu;
		}
	}
	if(showFirst && (showFirst.toString() == "true")) {
		if (tabContainer.first)
			tabContainer.first.onclick();
	}
}

/////////////////////////////////////////////////////////////////////////////////// 
// Left Sub Menu
///////////////////////////////////////////////////////////////////////////////////
function toggle_content(f_menu){
	
	if (document.getElementById(f_menu).style.display == "block"){ 
		document.getElementById(f_menu).style.display = "none" 
	} else { 
		document.getElementById(f_menu).style.display = "block" 
	} 
} 

function goUrl(urlCode){
	var	form = document.koshaForm; 

	var spliteStr	= new Array(15);
	spliteStr		= urlCode.split('|');
	var spliteCnt	= spliteStr.length;
	var servletUse	= spliteStr[1];
	var menuUrl		= spliteStr[8];

	form.urlCode.value		= urlCode;

	if(servletUse == 'Y'){
		if(menuUrl.indexOf("&") > -1) {
			menuUrlParse(menuUrl);
		}else{
			form.action = menuUrl;
		}
	}else{
		form.action = "/main";
	}

	form.submit();
}


function goSimpleLink(menuId){
	location.href="/bridge?menuId="+menuId;
}
function goDownLink(path,name){
	location.href="/common/include/downloadFile.jsp?FILE_NAME="+name+"&FILE_PATH="+path;
}

function swapMenu(menuCode){
	var obj = eval("document.all.groupMenu"+menuCode);
	if(obj !=undefined) {
		if(obj.style.display == "block") {
			obj.style.display = "none";
		}else{
			obj.style.display = "block";
		}
	}
}


function goPrint(menuId){
	actionUrl = "/bridge?menuId="+menuId+"&printYn=y";
	usrWin = window.open(actionUrl,"window_printpop", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=1,width=720,height=700,left=10,top=10");
}


function printDiv() { 
	alert('\nÀÌ °Ô½Ã¹°ÀÇ ºÎºÐ Ãâ·Â(Print)¸¦ À§ÇÑ ÁØºñ¸¦ ¸¶ÃÆ½À´Ï´Ù.\n\nÈ®ÀÎÀ» Å¬¸¯ÇÏ½Ã¸é ÇÁ¸°Æ®¸¦ À§ÇÑ Ã¢ÀÌ ½ÇÇàµÇ´Ï ÀÎ¼â¸¦ Å¬¸¯ÇØÁÖ¼¼¿ä\n\n*ÇÁ¸°ÅÍ°¡ ¼³Ä¡µÇ¾î ÀÖÁö ¾Ê°Å³ª, ÇÁ¸°ÅÍ µå¶óÀÌ¹ö¿¡ ÀÌ»óÀÌ ÀÖÀ»°æ¿ì Ãâ·ÂÀÌ µÇÁö ¾ÊÀ» ¼ö ÀÖ½À´Ï´Ù.');
   if (document.all && window.print) { 
	   window.print(); 
   } 
} 

function goTabMenu(tabId, menuUrl,servletUse){
	var	form = document.koshaForm; 
	form.menuUrl.value = menuUrl;
	form.tabId.value = tabId;
	if(servletUse == 'Y'){
		form.action = menuUrl;
	}else{
		form.action = "/main";
	}
	form.submit();
}



	function GoTourlMoveSRcK(v){

	//alert("°ª Ãâ·Â=====>" + v);
	if(v=='nodata'){
		return false;
	}
	else{
		location.href=v;  //ÆäÀÌÁö ÀÌµ¿
	}
}

