// Flash Embed
function flash(url,w,h,id,bg,vars,win,allow){

var flashStr=
"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
"<param name='allowScriptAccess' value='"+allow+"' />"+
"<param name='movie' value='"+url+"' />"+
"<param name='FlashVars' value='"+vars+"' />"+
"<param name='wmode' value='"+win+"' />"+
"<param name='menu' value='false' />"+
"<param name='quality' value='high' />"+
"<param name='bgcolor' value='"+bg+"' />"+
"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='"+allow+"' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
"</object>";

document.write(flashStr);
}

// Current URL
function currentUrl() {
	URL=document.URL
	document.write(URL);
}

// Popup Open
function popOpen(url, t, w, h, s) {
	var sw;
	var sh;
	sw = (screen.Width - w) / 2;
	sh = (screen.Height - h) / 2;
	window.open(url, t, 'Width='+w+'px, Height='+h+'px, Left='+sw+', Top='+sh+', scrollbars='+s);
}

// Main Navigation
function initMainNavigation(){
	// 090812 author by suk(ys3791@nate.com)
	var mnbID = document.getElementById("mnb"); // layer ID
	var mnbDIV = mnbID.getElementsByTagName("div");

	for(i=1; i<=mnbDIV.length; i++){
		midEl = mnbDIV.item(i-1).parentNode;
		midAnchor = midEl.getElementsByTagName("a").item(0);
		midImg = midEl.getElementsByTagName("img").item(0);
		sidEl = midEl.getElementsByTagName("ul").item(0);
		
		// sub over
		subList = mnbDIV.item(i-1).getElementsByTagName("a");
		for(k=1; k<=subList.length; k++){
			subAnchor = subList.item(k-1);
			
			subAnchor.onmouseover = subAnchor.onfocus = function () {
				targetSub = this.parentNode.parentNode.getElementsByTagName("a");
				
				for(l=1; l<=targetSub.length; l++){
					subAll = targetSub.item(l-1).getElementsByTagName("img").item(0);
					subAll.src = subAll.src.replace("_on.gif", ".gif");
				}
				subTarget = this.getElementsByTagName("img").item(0);
				subTarget.src = subTarget.src.replace(".gif", "_on.gif");
			}
		}
		
		// main over
		sidEl.style.visibility = "hidden";
		lastStr = midImg.src.lastIndexOf(".");
		onCheck = midImg.src.substring(lastStr-1,lastStr);

		if(onCheck == "n")
			sidEl.style.visibility = "visible";

		midAnchor.onmouseover = midAnchor.onfocus = function () {
			
			for(j=1; j<=mnbDIV.length; j++){
				midAll = mnbDIV.item(j-1).parentNode;
				anchorAll = midAll.getElementsByTagName("a").item(0);
				imgAll = midAll.getElementsByTagName("img").item(0);
				sidAll = midAll.getElementsByTagName("ul").item(0);
				imgAll.src = imgAll.src.replace("_on.gif", ".gif");
				sidAll.style.visibility = "hidden";
			}
			
			targetImg = this.getElementsByTagName("img").item(0);
			targetEl = this.parentNode.getElementsByTagName("ul").item(0);

			lastStr = targetImg.src.lastIndexOf(".");
			onCheck = targetImg.src.substring(lastStr-1,lastStr);
			
			if(onCheck != "n"){
				targetImg.src = targetImg.src.replace(".gif", "_on.gif");
				targetEl.style.visibility = "visible";
			}
		}	
	}
}

// Quick Over
function quickOver(elID){
	var quickID = document.getElementById(elID); // layer ID
	var quickList = quickID.getElementsByTagName("a");
	for(i=1; i<=quickList.length; i++){
		quickAnchor = quickList.item(i-1);
		quickAnchor.onmouseover = quickAnchor.onfocus  = function () {
			targetImg = this.getElementsByTagName("img").item(0);
			targetImg.src = targetImg.src.replace(".gif", "_on.gif");
		}
		quickAnchor.onmouseout = quickAnchor.onblur =  function () {
			targetImg = this.getElementsByTagName("img").item(0);
			targetImg.src = targetImg.src.replace("_on.gif", ".gif");
		}		
	}
}

// Tab Navigation
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", ".gif");
				} 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");
			} else {
				this.className += " on";
			}
			this.container.current = this;
			
			return false;
		};

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

function ImgShowHide(imgEl,chk,nowPage) {
	var thisImg = document.getElementById(imgEl);
	if (chk != "hide"){
		thisImg.src = thisImg.src.replace("_or.gif", "_ov.gif");
	} else {
		if (imgEl != nowPage){
			thisImg.src = thisImg.src.replace("_ov.gif", "_or.gif");
		}
	}
}

// Images On Off
function imgOn() {
	var num = arguments[0];
	var sn = arguments[1];
	var path = arguments[2];
	var snId = sn+num ;
	var img_path = "../img/"+path+"/";
	var snImg = document.getElementById(snId);
	snImg.src = img_path+sn+"_"+num+"_ov.gif";
}

function imgOff() {
	var num = arguments[0];
	var sn = arguments[1];
	var path = arguments[2];
	var snId = sn+num ;
	var img_path = "../img/"+path+"/";
	var snImg = document.getElementById(snId);
	snImg.src = img_path+sn+"_"+num+"_or.gif";
}

//images simple rollover
function menuOn(imgEl) {
	targetImg = imgEl.getElementsByTagName("img").item(0);
	targetImg.src = targetImg.src.replace(".gif", "_on.gif");
}

function menuOut(imgEl) {
	targetImg = imgEl.getElementsByTagName("img").item(0);
	targetImg.src = targetImg.src.replace("_on.gif", ".gif");
}

function ImgShowHide(imgEl,chk,nowPage) {
	
	var thisImg = document.getElementById(imgEl);
	
	if (chk != "hide"){
		thisImg.src = thisImg.src.replace("_or.gif", "_on.gif");
		
	} else {
		if (imgEl != nowPage){
			thisImg.src = thisImg.src.replace("_on.gif", "_or.gif");
			
		}
	}
}

// Select Choice
function selectLinks(selName) {
	var form = document.siteLink;
	var selectName ;
	if(selName==1)
		selectName = form.familySite1;
	else if(selName==2)
		selectName = form.familySite2;
	else if(selName==3)
		selectName = form.familySite3;
	
	if(selectName.value == '') {
		alert("이동을 원하시는 사이트를 선택해주세요");
		return ;
	}
    var http;
        for(i=0;i<selectName.length;i++) {
            if(selectName.options[i].selected == true) {
                http = selectName.options[i].value;
            }
        }
    window.open(http);
}

function selectURL(id){
	var url = document.getElementById(id).value;
	if(url==""){
		alert("이동을 원하시는 사이트를 선택해주세요");
		return;
	}
	window.open(url);
}

// Input Value Change
function change (target,type) 
{  
       if ( target.value == target.defaultValue && type==0) target.value = ''; 
       if ( !target.value && type==1) target.value = target.defaultValue; 
}

// File Addition
var flen = 0;
function addFile(delete_code) {
	if (upload_count && flen >= upload_count) {
	    alert(upload_count+"개 까지만 파일 업로드가 가능합니다.");
	    return;
	}
	var objTbl;
	var objRow;
	var objCell;
	if (document.getElementById)
	    objTbl = document.getElementById("variableFiles");
	else
	    objTbl = document.all["variableFiles"];
	
	objRow = objTbl.insertRow(objTbl.rows.length);
	objCell = objRow.insertCell(0);
	
	objCell.innerHTML = "<input type='file' name='attach[]' size=45 class=form_gray1>";
	if (delete_code)
	    objCell.innerHTML += delete_code;

	flen++;
}

// Print
var win=null;
function printDiv()  {
	var printId = "sContWrap"; // Layer ID
	var printThis = document.getElementById(printId).innerHTML;
	win = window.open('', 'print', 'width=688px, height=635px, left=100, top=100, scrollbars=yes');
	self.focus();
	win.document.open();
	win.document.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
	win.document.write("<html xmlns='http://www.w3.org/1999/xhtml' lang='ko'>");
	win.document.write("<head>");
	win.document.write("<link rel='stylesheet' type='text/css' href='../css/base.css' />");
	win.document.write("<link rel='stylesheet' type='text/css' href='../css/layout.css' />");
	win.document.write("<link rel='stylesheet' type='text/css' href='../css/sub.css' />");
	win.document.write("</head>");
	win.document.write("<body>");
	win.document.write(printThis);
	win.document.write("</body>");
	win.document.write("</html>");
	win.document.close();
	win.print();
	win.close();
}

// PNG 24bit IE6.0
function setPng24(obj) { 
    obj.width=obj.height=1; 
    obj.className=obj.className.replace(/\bpng24\b/i,''); 
    obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
    obj.src='';  
    return ''; 
} 

// layer_visible
function visLayer(id,num){
	
    var vobj = document.getElementById(id);	

	if (num==2)	{
		vobj.style.visibility ="hidden";
	}else{
		vobj.style.visibility ="visible";
	}
    
}

// Font Size Control
defsize = 12;  // Default Size

function zoom_it() {  
	var size = arguments[0];
	var content = document.getElementById("sContWrap");

	if (size != undefined) {
		defsize+=size; 
	} else {
		defsize = 12 ;
	}

	objs1 = content.getElementsByTagName("th") ;
	objs2 = content.getElementsByTagName("td") ;
	objs3 = content.getElementsByTagName("div") ;
	objs4 = content.getElementsByTagName("li") ;

	for(i=0;i<objs1.length;i++) {
		objs1[i].style.fontSize=defsize + "px" ;
	}
	for(i=0;i<objs2.length;i++) {
		objs2[i].style.fontSize=defsize + "px" ;
    }
	for(i=0;i<objs3.length;i++) {
		objs3[i].style.fontSize=defsize + "px" ;
    }
	for(i=0;i<objs4.length;i++) {
		objs4[i].style.fontSize=defsize + "px" ;
	}
}

//initLoad
function initLoad() {
	initMainNavigation();
	
}
window.onload=initLoad;
// Author by suk - 090808