//------------------- SWF 
function SWFLoader() {
	var obj = new String;
	var parameter = new String;
	var embed = new String;
	
	var classId = new String;
    var codeBase = new String;
	var pluginSpage = new String;
	var embedType = new String;	
	var allParameter = new String;	
	
	var src = new String;
	var width = new String;
	var height = new String;
	var id = new String;
	var layer = new String;
	var arg = new String;
	var altText = new String;
	var wmode = new String;

	this.init = function ( w, h, s, a ) {
		width = w; //width
		height = h; //height
		src = s; //file src
		arg = a; 
		wmode = 'transparent'; //mode set

		classId = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
		codeBase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0';
		pluginSpage = 'http://www.macromedia.com/go/getflashplayer';
		embedType = 'application/x-shockwave-flash';

		parameter += "<param name='allowScriptAccess' value='always'>\n";
		parameter += "<param name='allowFullScreen' value='false'\n>";
		parameter += "<param name='movie' value='"+ s + "'>\n";
		parameter += "<param name='quality' value='high'>\n";
		parameter += "<param name='base' value='.'>\n";
		parameter += "<param name=FlashVars value='arg="+a+"'>\n";		
	}
	
	//flash object option set
	this.parameter = function ( param, value ) {
		 parameter += "<param name='"+param +"' value='"+ value + "'>\n";
	}

	// flash wmode setFlash.wmode('window')
	this.wmode = function ( value ) {
		wmode = value;
	}

	// flash id set
	this.id = function ( value ) {
		id = value;
	}
	
	// flash alt set
	this.alt = function ( value ) {
		altText = value;
	}

	// flash layer set
	this.layer = function ( value ) {
		if(value == undefined) {
			layer = "";
		} else {
			layer = value;
		}
	}

	this.show = function () {
		obj = '<object id="'+id+'" width="'+width+'" height="'+height+'" classid="'+classId+'" codebase="'+codeBase+'">\n'+
			parameter +
			'<param name="wmode" value="'+wmode+'">\n'+
			'<!--[if !IE]>-->\n' +
			'<object type="application/x-shockwave-flash" data="' + src + '" width="' + width + '" height="' + height + '" name="' + id + '">\n' +
				parameter +
				'<param name="wmode" value="'+wmode+'">\n'+
			'<!--<![endif]-->\n' +
				'<div class="alt-content alt-' + id + '">' + altText + '</div>\n' +
			'<!--[if !IE]>-->\n' +
			'</object>\n' +
			'<!--<![endif]-->\n' +
		'</object>';

		if(layer == "") {
			document.write(obj);
		}else{
			var div = document.getElementById( layer);
			div.style.display = "";
			div.innerHTML = obj;
		}
	}
}

function hideSWFLayer( div) {
	var div = document.getElementById( div);
	div.style.display = "";
	div.innerHTML = "";
}

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	}
	else {
		return document[movieName];
	}
 }

 function callExternalInterface(movieId) {
    thisMovie(movieId).moveMc();	
}
//------------------- SWF control function


// familysite
function famlistAction1() {	
	var target = document.getElementById('familyList1');
	target.style.display = (target.style.display=='block' ? 'none':'block');
}
function famlistAction2() {	
	var target = document.getElementById('familyList2');
	target.style.display = (target.style.display=='block' ? 'none':'block');
}

//* image rollover *//
function overRoll( obj ) {
    obj.src = obj.src.replace( 'off.gif', 'on.gif' );
}
function outRoll( obj ) {
    obj.src = obj.src.replace( 'on.gif', 'off.gif' );
}

//main menu all see script
//id name = file neame ex) siteMap
function viewSWFLayer( _id, _wd, _ht, _dir, _xmlurl) {
	var id = _id;
	var width = _wd;
	var height = _ht;
	var dir = _dir;
	var xmlurl = _xmlurl;
	var html;

	html = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+width+"' height='"+height+"'>";
	html += "<param name='allowScriptAccess' value='always'>";
	html += "<param name='allowFullScreen' value='false'>";
	html += "<param name='movie' value='"+dir+"'>";
	html += "<param name='quality' value='high'>";
	html += "<param name='wmode' value='transparent'>";
	html += "<param name='base' value='.'>";
	html += "<param name=FlashVars value='url1="+xmlurl+"'/>";
	html += "<embed base='.' src='"+dir+"' FlashVars='url1="+xmlurl+"' quality='high' width='"+width+"' height='"+height+"' align='middle' allowScriptAccess='sameDomain' allowFullScreen='false' wmode ='transparent' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'>";
	html += "</object>";

	var layername = document.getElementById( id);
	layername.style.display = "";
	layername.innerHTML = html;
	
}

function hideSWFLayer( _id) {
	var id = _id;
	var layername = document.getElementById( id);
	var hidetarget = document.getElementById('top-sitemap');
	layername.style.display = "none";
	layername.innerHTML = "";
	hidetarget.className = ''
}

// top sitemap layer (height - 0/100%)
function sitmapLayer() {	
	var target = document.getElementById('top-sitemap');
	target.className = (target.className=='' ? 'top-sitemap-open':'');
}

// print
function Printing() {
	var txts = "/language/eng/common/jsp/print.jsp?dep="+mmenu
	window.open(txts,'print','width=658,height=600,scrollbars=yes');void(0);
}	


//viewer download
document.writeln("<form name='down' method='get' action='/common/kep_download.jsp'>");//=>
document.writeln("<input type='hidden' name='FileName3'>");
document.writeln("<input type='hidden' name='FileName2' >");
document.writeln("<input type='hidden' name='FileName1' >");

document.writeln("</form>");
function getDown(sFile1,sFile2) {	
	down.FileName1.value=sFile1;
	down.FileName2.value=sFile2;
	down.submit();
}


//fontSize change ----------------------------------------------
// cookie set
function setCookie(name, value, expires, path, domain, secure) {
  document.cookie = name + "=" + escape(value) +
  ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
  ((path == null) ? "" : "; path=" + path) +
  ((domain == null) ? "" : "; domain=" + domain) +
  ((secure == null) ? "" : "; secure");
}

// cookie del
function delCookie (name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path == null) ? "" : "; path=" + path) +
    ((domain == null) ? "" : "; domain=" + domain) + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
  //page reload
  document.location.reload();
}
var firstCall = true;
function changeFontsize(fSize, increment) {
	if (firstCall) {
		firstCall = false;
		if (increment != "") {
			changeFontsize('12', '');
		}
	}
	if (document.getElementsByTagName) {
	var getElement = document.getElementsByTagName("*");
	var eachElement, currentFontSize, fontIncrease, newFontSize;
	for (i=0; i<getElement.length; i++) {
		eachElement = getElement[i];
		if (increment != "") {
			currentFontSize = parseInt(eachElement.style.fontSize);
			fontIncrease = parseInt(increment);
			newFontSize = currentFontSize + fontIncrease;
		}
		else if (fSize != "") {
			newFontSize = parseInt(fSize);
		}
		if (getElement[i].tagName == "LI") {
			eachElement.style.lineHeight = Math.round(newFontSize*1.2) + "px";
		} else {
			eachElement.style.lineHeight = Math.round(newFontSize*1.5) + "px";
		}
		if (fSize != "") {
			switch(getElement[i].tagName) {
				case "H2": newFontSize += 3; break;
				case "H3": newFontSize += 2; break;
				case "H4": newFontSize += 1; break;
				case "H5": newFontSize += 1; break;
				case "H6": newFontSize += 1;
			}
		}
		eachElement.style.fontSize = newFontSize + "px";
		setCookie('fontSize', newFontSize);
	}
}
}
//---- fontSize change ----------------------------------------------]

// popup
function popup(Fn,Win, X, Y, Scroll){
l = (screen.width) ?	(screen.width- X) / 2	: 0;
t = (screen.height) ?	(screen.height- Y) / 2 : 0;	
	NewWindow=window.open(Fn,Win,'width='+X+',height='+Y+',top='+t+',left='+l+',scrollbars='+Scroll+',toolbar=no,location=no,directories=no,status=no,resizable=no,menubar=no');
}

// quick -----------------------------------------------------------
function getPosition(){
	var start, end, scale, term;
	start = parseInt (document.getElementById('quicktop').style.top, 0);
	end = document.documentElement.scrollTop + 0;
	term = 5;

	if ( start != end ) {
	scale = Math.ceil( Math.abs( end - start ) / 20 );
		if ( end < start )	scale = -scale;
		document.getElementById('quicktop').style.top = parseInt (document.getElementById('quicktop').style.top, 0)+ scale + "px";
		term = 1;
	}
	setTimeout ("getPosition()", term);
}
function moveBanner() {
	document.getElementById('quicktop').style.top = document.documentElement.scrollTop + 0 + "px"; //??? ??? ???? ??.
	getPosition();
	return true;
}

// tab over -------------------------------------------------------
//<![CDATA[
	function chgHeadingTab(el) {
		if (!document.getElementsByTagName) return false;
		var tabtag = el;
		var headings = new RegExp("[h1-6]","i");
		while (!headings.test(tabtag.tagName)) {
			tabtag = tabtag.parentNode;
		}
		if (!headings.test(tabtag.tagName)) return false;
		var tabparent = tabtag.parentNode;
		tabtag = tabtag.tagName;
		var clickedtab = el;
		while (clickedtab.tagName != tabtag) {
			clickedtab = clickedtab.parentNode;
		}
		var tabitems = tabparent.getElementsByTagName(tabtag);
		for (var i=0; i<tabitems.length; i++) {
			var tabimg = tabitems[i].getElementsByTagName("IMG")[0];
			var tabcont = tabitems[i].nextSibling;
			while (tabcont.nodeType != 1) {
				tabcont = tabcont.nextSibling;
			}
			if (tabitems[i] == clickedtab) {
				tabimg.src = tabimg.src.replace("_off.gif","_on.gif");
				tabcont.style.display = "block";
			} else if (tabitems[i] != clickedtab) {
				if (tabimg.src.indexOf("_on.gif") != -1) {
					tabimg.src = tabimg.src.replace("_on.gif","_off.gif");
				}
				tabcont.style.display = "none";
			}
		}
		return false;
	}

	function overImg(obj) {
		obj.src = obj.src.replace( 'off.gif', 'on.gif' );
	}
	function outImg(obj) {
		if (chkContOn(obj)) return false;
		obj.src = obj.src.replace( 'on.gif', 'off.gif' );
	}
	function chkContOn(el) {
		var tab = el;
		var headings = new RegExp("[h1-6]","i");
		while (!headings.test(tab.tagName)) {
			tab = tab.parentNode;
		}
		if (!headings.test(tab.tagName)) return false;
		var tabcont = tab.nextSibling;
		while (tabcont.nodeType != 1) {
			tabcont = tabcont.nextSibling;
		}
		return tabcont.style.display != "none" ? true : false;
	}
//]]>

/* */
function menuMouseOver(idx){
	try{
		for(i=1 ; i<=7 ; i++){
			
			objImage = document.getElementById("menu"+i);
			objLayer = document.getElementById("tab_0"+i);
			if(i == idx){
				objImage.src = objImage.src.replace(i+"_off.gif", i+"_on.gif");
				objLayer.style.display = "block";
			}else{
				objImage.src = objImage.src.replace(i+"_on.gif", i+"_off.gif");
				objLayer.style.display = "none";
			}
		}
	}catch(err){
	
	}
}

// [[ Image Rollover ]]
function menuOn(imgEl) {
	var isrc = imgEl.src;
	if( isrc.indexOf("_on.gif") < 0){
		imgEl.src = imgEl.src.replace("_off.gif", "_on.gif");
	}
}
function menuOut(imgEl) {
	var isrc = imgEl.src;
	if( isrc.indexOf("_on.gif") > -1){
		imgEl.src = imgEl.src.replace("_on.gif", "_off.gif");
	}
}// [[ END Image Rollover ]]

// [[ Image Rollover ]]
function png_menuOn(imgEl) {
	var isrc = imgEl.src;
	if( isrc.indexOf("_on.gif") < 0){
		imgEl.src = imgEl.src.replace("_off.png", "_on.png");
	}
}
function png_menuOut(imgEl) {
	var isrc = imgEl.src;
	if( isrc.indexOf("_on.gif") > -1){
		imgEl.src = imgEl.src.replace("_on.png", "_off.png");
	}
}// [[ END Image Rollover ]]

/* png ÀÌ¹ÌÁö Åõ¸í Àû¿ë script */
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 '';
}

/* left menu */
var old='';

function LeftMenu(name){
	submenu=eval("Leftmenu_"+name+".style");
		if(old!=submenu)
		{
			if(old!='')
			{
			old.display='none';
			}
				submenu.display='block';
				old=submenu;
        }
        else
        {
			submenu.display='none';
			old='';
		}
}