
// »ó´Ü ³×ºñ°ÔÀÌ¼Ç
function topMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var naviContainer = document.getElementById(tabContainerID);
	var naviAnchor = naviContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "hide")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);

		thismenu.onmouseover = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", "_off.gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace("_off.gif", "_on.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return true;
		}		
		thismenu.onfocus = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", "_off.gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace("_off.gif", "_on.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return true;
		}	
	}	

	for(i=0; i<naviAnchor.length; i++) {
		if (naviAnchor.item(i).className == "navi")
			thismenu = naviAnchor.item(i);
		else
			continue;

			thismenu.container2 = tabContainer;
			thismenu.targetEl2 = document.getElementById(naviAnchor.item(i).href.split("#")[1]);
			thismenu.imgEl2 = thismenu.getElementsByTagName("img").item(0);

			thismenu.onmouseover = function naviOver() {
				currentmenu = this.container2.current;
				if (currentmenu == this)
					return false;

				if (currentmenu) {
					if (currentmenu.imgEl2) {
						currentmenu.imgEl2.src = currentmenu.imgE2l.src.replace("_on.gif", "_off.gif");
					} else {
						currentmenu.className = currentmenu.className.replace("on", "");
					}
				}

					if (this.imgEl2) {
						this.imgEl2.src = this.imgEl2.src.replace("_off.gif", "_on.gif");
					} else {
						this.className += " on";
					}

				return true;
			}
			
			thismenu.onmouseout = function naviOut() {
				currentmenu = this.container2.current;
				if (currentmenu == this)
					return false;

				if (currentmenu) {
					if (currentmenu.imgEl2) {
						currentmenu.imgEl2.src = currentmenu.imgEl2.src.replace("_off.gif", "_on.gif");
					} else {
						currentmenu.className = currentmenu.className.replace("on", "");
					}
				}

					if (this.imgEl2) {
						this.imgEl2.src = this.imgEl2.src.replace("_on.gif", "_off.gif");
					} else {
						this.className += " on";
					}

				return true;
			}
		}

	if (tabContainer.first)
		tabContainer.first.onmouseover();
	
}

// ¸ÞÀÎ »ö¼Ç
function mainContents(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "contents")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
//		alert(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);

		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
			
			}
			this.targetEl.style.display = "";

			this.container.current = this;

			return true;
		};

		thismenu.onfocus = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
			
			}
			this.targetEl.style.display = "";

			this.container.current = this;

			return true;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();

}

// ¸ÞÀÎ »ö¼Ç
function mainSection(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "section")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
//		alert(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);

		thismenu.onmouseover = function tabMenuOver() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.jpg", "_off.jpg");
				} else {
					currentmenu.className = currentmenu.className.replace("on", "");
				}
			}

				if (this.imgEl) {
					this.imgEl.src = this.imgEl.src.replace("_off.jpg", "_on.jpg");
				} else {
					this.className += " on";
				}

			return true;
		}

		thismenu.onmouseout = function tabMenuOut() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_off.jpg", "_on.jpg");
				} else {
					currentmenu.className = currentmenu.className.replace("on", "");
				}
			}

				if (this.imgEl) {
					this.imgEl.src = this.imgEl.src.replace("_on.jpg", "_off.jpg");
				} else {
					this.className += " on";
				}

			return true;
		}

		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";			
			}

			this.targetEl.style.display = "";				
			this.container.current = this;
			return true;
		}
		thismenu.onfocus = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";			
			}

			this.targetEl.style.display = "";				
			this.container.current = this;
			return true;
		}

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;

	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}


function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);

		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", "_off.gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace("_off.gif", "_on.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return true;
		};
		thismenu.onfocus = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", "_off.gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace("_off.gif", "_on.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return true;
		};
		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();

}

// ÀÌ¹ÌÁö ¹öÆ°ÀÌ ¾Æ´Ñ °æ¿ì - Ã¹¹øÂ°°¡ ¾È º¸ÀÏ¶§
function showHide(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "hide")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";

		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";				
			}
			this.targetEl.style.display = "";			
			this.container.current = this;
			return true;
		};

	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}

// ÀÌ¹ÌÁö ¹öÆ°ÀÌ ¾Æ´Ñ °æ¿ì - Ã¹¹øÂ°°¡ º¸ÀÏ¶§
function showHide2(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "hide")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";

		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";				
			}
			this.targetEl.style.display = "";			
			this.container.current = this;
			return true;
		};
		if (!thismenu.container.first)
			thismenu.container.first = thismenu;

	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}

//ÆË¾÷Á¸.

window.onload = function () {

}
	var popup_timer = null;
	var popup_delay_time = 10000;
	var popup_pause = false;
	var popup_button_pause = false;
	var select_popup_num = 1;
	
	
	function popup_display(popupIDX, move) {
		if(!popupIDX)  {
			popupIDX = select_popup_num;
			if(popup_pause==true && !move) return;
			if(popup_button_pause==true && !move) return;
			if(!move) move = 'next';
			hide_popup(popupIDX);
		}else{
			hide_popup(select_popup_num);
		}
		if(move=='prev') {
			if(popupIDX==1) {
				popupIDX = popup_object_num;
			} else {
				popupIDX--;
			}
		} else if(move=='next') {
			if(popupIDX==popup_object_num) {
				popupIDX = 1;
			} else {
				popupIDX++;
			}
		}

		show_popup(popupIDX);
		select_popup_num = popupIDX;


	}
	
	function hide_popup(num) {
		document.getElementById("popupzoneImage" + num).style.display = 'none';
		document.getElementById("popupzoneNumber" + num).src = '/html/kor/images/new_index/icon_num' + num + '_off.gif';
	}
	
	function show_popup(num) {
		document.getElementById("popupzoneImage" + num).style.display = 'block';
		document.getElementById("popupzoneNumber" + num).src = '/html/kor/images/new_index/icon_num' + num + '_on.gif';
	}

	function popup_scroll() {
		setInterval("popup_display()", popup_delay_time); 
	}
	
// ÇÏ´Ü ¹è³Ê
var mtickerEl = new Array();
function initmTicker(mtickerContainer, mtickerContent, delay) {
	mtickerEl[mtickerEl.length] = mtickerContainer;
	var speed = 20; //½ºÅ©·Ñ¼Óµµ-ÀÛÀ»¼ö·Ïºü¸§
	var mtickerElsum = 2; //initmTickerÇÔ¼öÀüÃ¼È£Ãâ¼ö-Ãß°¡ÇÒ¶§¸¶´Ù¼öÁ¤¿äÇÔ
	mtickerContainer.delay = delay/(speed/mtickerElsum); //mtickerEl.length¸¦mtickerElsum·Î¼öÁ¤
	mtickerContainer.moveOffset = mtickerContainer.offsetHeight;//Safari¸¸´Ù¸¥°ª.°¡²ûµÉ¶§µµÀÖÀ½.
	mtickerContainer.count = 0;
	mtickerContainer.mtickerOver = false;
	mtickerContainer.cont = mtickerContent;
	mtickerContainer.cont.currentHeight = 0;
//	mtickerContainer.cont.innerHTML += mtickerContainer.cont.innerHTML;//ÄÁÅÙÃ÷º¹Á¦ÇØ¼­2¹ø·»´õ¸µ..½ºÅ©·Ñ½Ã¸¸ÇÊ¿ä
	mtickerContainer.move = setInterval("movemTicker()", speed);
	//for (i=0; i<mtickerEl.length; i++) {
	//	mtickerEl[i].onmouseover = function() { this.mtickerOver=true; }
	//	mtickerEl[i].onmouseout = function() { this.mtickerOver=false; }
	//}
}
function movemStop(){
	//mtickerEl[mtickerEl.length] = mtickerContainer;
	for (i=0; i<mtickerEl.length; i++) {
		mtickerEl[i].mtickerOver=true;
		//mtickerEl[i].onmouseout = function() { this.mtickerOver=false; }
	}
}
function movemStart(){
	//mtickerEl[mtickerEl.length] = mtickerContainer;
	for (i=0; i<mtickerEl.length; i++) {
		mtickerEl[i].mtickerOver=false;
		//mtickerEl[i].onmouseout = function() { this.mtickerOver=false; }
	}
}
function movemTicker() {
	for (i=0; i<mtickerEl.length; i++) {
		if (mtickerEl[i].cont.currentHeight % mtickerEl[i].moveOffset == 0 && mtickerEl[i].count < mtickerEl[i].delay) {
			if(!mtickerEl[i].mtickerOver) mtickerEl[i].count++;//mtickerOver°¡ false ÀÏ¶§ Ä«¿îÆ®Áõ°¡½ÃÅ²´Ù
		} else {
			mtickerEl[i].count = 0;
//			mtickerEl[i].cont.currentHeight--;//½ºÅ©·ÑÇÔ
			mtickerEl[i].cont.currentHeight -= mtickerEl[i].moveOffset;//½ºÅ©·Ñ¾ÈÇÔ
			if (mtickerEl[i].cont.currentHeight % (mtickerEl[i].cont.offsetHeight) == 0) {
				mtickerEl[i].cont.currentHeight = 0;
			}
			mtickerEl[i].cont.style.top = mtickerEl[i].cont.currentHeight + "px";
		}
//	var test = document.getElementById("test");//test
//	test.innerHTML =  mtickerEl[i].moveOffset +"  currentHeight="+mtickerEl[i].cont.currentHeight;//test
	}
}
function prevmTicker(mtickerElnum) {
	var mtickerElnum = mtickerElnum-1;
	mtickerEl[mtickerElnum].count = 0;
	mtickerEl[mtickerElnum].cont.currentHeight+= mtickerEl[mtickerElnum].moveOffset;
	if (-mtickerEl[mtickerElnum].cont.currentHeight < 0) {
		mtickerEl[mtickerElnum].cont.currentHeight = mtickerEl[mtickerElnum].moveOffset-mtickerEl[mtickerElnum].cont.offsetHeight;
	}
	mtickerEl[mtickerElnum].cont.style.top = mtickerEl[mtickerElnum].cont.currentHeight + "px";
}
function nextmTicker(mtickerElnum) {
	var mtickerElnum = mtickerElnum-1;
	mtickerEl[mtickerElnum].count = 0;
	mtickerEl[mtickerElnum].cont.currentHeight-= mtickerEl[mtickerElnum].moveOffset;
	if (-mtickerEl[mtickerElnum].cont.currentHeight >= mtickerEl[mtickerElnum].cont.offsetHeight) {
		mtickerEl[mtickerElnum].cont.currentHeight = 0;
	}
	mtickerEl[mtickerElnum].cont.style.top = mtickerEl[mtickerElnum].cont.currentHeight + "px";
}

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 smbaMail(boardId,seq)
{	
//	location.href="mailto:"+smba+"@smba.go.kr";
//    var url = "/smba/common/SendEmail.jsp?boardId="+boardId+"&seq="+seq;
    var url = "/smba/BoardWriteView.do?method=sendEmailView&boardId="+boardId+"&seq="+seq;
    var name = "sendMail";
    var width = "530";
    var height = "300";
    var winPosLeft = (screen.width - width) / 2; // »õÃ¢ Y ÁÂÇ¥
    var winPosTop = (screen.height - height) / 2; // »õÃ¢ X ÁÂÇ¥
    var winOpt = "width="+width+",height="+height+",top="+winPosTop+",left="+winPosLeft;
    POP = window.open(url, name, winOpt + ",statusbar=no,status=no,menubar=no,toolbar=no,location=no,directory=no,scrollbars=no,resizable=no");
}
function linkSite(obj) {
 var o = obj.selSite
 if (o.value == "") {
     alert("ÀÌµ¿ÇÒ »çÀÌÆ®¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
 } else {
     var win_url = o.value;
     window.open(win_url, "", "");
 }
  return false;

	/* 
	var f  = obj;  

	if(f.selSite.value == ""){ 
		alert("ÀÌµ¿ÇÒ ½ÎÀÌÆ®¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
        return false;
	}else{  
		f.target ="_blank";     
		f.action = obj.selSite.value;
		return true; 
	} 
*/	
	
	/*
	var errorMessage=null;
	var objFocus=null;

	    if (obj.value == "") {
	        alert("ÀÌµ¿ÇÒ ½ÎÀÌÆ®¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
	        return false;
	    } else {
	        var win_url = obj.value;
	        var win_title = obj.options[obj.selectedIndex].text;

	        //window.open(win_url, win_title, "width=950, height=650, toolbar=yes, menubar=yes, location=yes, scrollbars=yes, status=yes, resizable=yes, channelmode=yes");
	        return true;
	    }

	    if(errorMessage !=null){
	    	alter(errorMessage);
	    	objFocus.focus();
	    	return false;
	    }
	    */
	}
function goFileDownLoad(save_name, file_name){
    var form = document.file_frm;
    form.save_name.value = save_name;
    form.file_name.value = file_name;
    //form.action = "/smba/DownLoad.do?save_name="+encodeURI(save_name)+"&file_name="+encodeURI(file_name);
    form.action = "/smba.tdf?a=common.DownloadApp&c=1001";
    form.submit();
}

//ÀÎ¼â
function go_print(){
	var pWin=window.open('/html/print.html','print','toolbar=no, scrollbars=yes, width=720, height=500');
	pWin.focus();
}

